logo

Expression of type ExprTuple

from the theory of proveit.linear_algebra.matrices.exponentiation

In [1]:
import proveit
# Automation is not needed when building an expression:
proveit.defaults.automation = False # This will speed things up.
proveit.defaults.inline_pngs = False # Makes files smaller.
%load_expr # Load the stored expression as 'stored_expr'
# import Expression classes needed to build the expression
from proveit import A, Conditional, ExprTuple, Lambda, m, rho, x
from proveit.linear_algebra import MatrixExp, MatrixMult, ScalarMult
from proveit.logic import Equals
from proveit.numbers import Exp, Mult, e, i, pi, two
In [2]:
# build up the expression from sub-expressions
expr = ExprTuple(Lambda([A, x], Conditional(Equals(MatrixMult(MatrixExp(A, m), x), ScalarMult(Exp(e, Mult(two, pi, i, Mult(m, rho))), x)), Equals(MatrixMult(A, x), ScalarMult(Exp(e, Mult(two, pi, i, rho)), x)))))
expr:
In [3]:
# check that the built expression is the same as the stored expression
assert expr == stored_expr
assert expr._style_id == stored_expr._style_id
print("Passed sanity check: expr matches stored_expr")
Passed sanity check: expr matches stored_expr
In [4]:
# Show the LaTeX representation of the expression for convenience if you need it.
print(stored_expr.latex())
\left(\left(A, x\right) \mapsto \left\{\left(A^{m} \thinspace x\right) = \left(\mathsf{e}^{2 \cdot \pi \cdot \mathsf{i} \cdot \left(m \cdot \rho\right)} \cdot x\right) \textrm{ if } \left(A \thinspace x\right) = \left(\mathsf{e}^{2 \cdot \pi \cdot \mathsf{i} \cdot \rho} \cdot x\right)\right..\right)
In [5]:
stored_expr.style_options()
no style options
In [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0ExprTuple1
1Lambdaparameters: 15
body: 2
2Conditionalvalue: 3
condition: 4
3Operationoperator: 6
operands: 5
4Operationoperator: 6
operands: 7
5ExprTuple8, 9
6Literal
7ExprTuple10, 11
8Operationoperator: 14
operands: 12
9Operationoperator: 16
operands: 13
10Operationoperator: 14
operands: 15
11Operationoperator: 16
operands: 17
12ExprTuple18, 21
13ExprTuple19, 21
14Literal
15ExprTuple27, 21
16Literal
17ExprTuple20, 21
18Operationoperator: 22
operands: 23
19Operationoperator: 25
operands: 24
20Operationoperator: 25
operands: 26
21Variable
22Literal
23ExprTuple27, 39
24ExprTuple29, 28
25Literal
26ExprTuple29, 30
27Variable
28Operationoperator: 37
operands: 31
29Literal
30Operationoperator: 37
operands: 32
31ExprTuple34, 35, 36, 33
32ExprTuple34, 35, 36, 40
33Operationoperator: 37
operands: 38
34Literal
35Literal
36Literal
37Literal
38ExprTuple39, 40
39Variable
40Variable