logo

Expression of type ExprTuple

from the theory of proveit.linear_algebra.matrices

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, b, k, x
from proveit.linear_algebra import MatrixMult, ScalarMult
from proveit.logic import Equals, Forall, Implies, InSet
from proveit.numbers import Complex, Exp
In [2]:
# build up the expression from sub-expressions
expr = ExprTuple(Lambda(b, Conditional(Forall(instance_param_or_params = [A, x], instance_expr = Implies(Equals(MatrixMult(A, x), ScalarMult(b, x)), Equals(MatrixMult(Exp(A, k), x), ScalarMult(Exp(b, k), x)))), InSet(b, Complex))))
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(b \mapsto \left\{\forall_{A, x}~\left(\left(\left(A \thinspace x\right) = \left(b \cdot x\right)\right) \Rightarrow \left(\left(A^{k} \thinspace x\right) = \left(b^{k} \cdot x\right)\right)\right) \textrm{ if } b \in \mathbb{C}\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
1Lambdaparameter: 37
body: 3
2ExprTuple37
3Conditionalvalue: 4
condition: 5
4Operationoperator: 6
operand: 10
5Operationoperator: 8
operands: 9
6Literal
7ExprTuple10
8Literal
9ExprTuple37, 11
10Lambdaparameters: 24
body: 12
11Literal
12Operationoperator: 13
operands: 14
13Literal
14ExprTuple15, 16
15Operationoperator: 18
operands: 17
16Operationoperator: 18
operands: 19
17ExprTuple20, 21
18Literal
19ExprTuple22, 23
20Operationoperator: 26
operands: 24
21Operationoperator: 28
operands: 25
22Operationoperator: 26
operands: 27
23Operationoperator: 28
operands: 29
24ExprTuple36, 32
25ExprTuple37, 32
26Literal
27ExprTuple30, 32
28Literal
29ExprTuple31, 32
30Operationoperator: 34
operands: 33
31Operationoperator: 34
operands: 35
32Variable
33ExprTuple36, 38
34Literal
35ExprTuple37, 38
36Variable
37Variable
38Variable