logo

Expression of type Lambda

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, 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 = 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())
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..
In [5]:
stored_expr.style_options()
no style options
In [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0Lambdaparameter: 36
body: 2
1ExprTuple36
2Conditionalvalue: 3
condition: 4
3Operationoperator: 5
operand: 9
4Operationoperator: 7
operands: 8
5Literal
6ExprTuple9
7Literal
8ExprTuple36, 10
9Lambdaparameters: 23
body: 11
10Literal
11Operationoperator: 12
operands: 13
12Literal
13ExprTuple14, 15
14Operationoperator: 17
operands: 16
15Operationoperator: 17
operands: 18
16ExprTuple19, 20
17Literal
18ExprTuple21, 22
19Operationoperator: 25
operands: 23
20Operationoperator: 27
operands: 24
21Operationoperator: 25
operands: 26
22Operationoperator: 27
operands: 28
23ExprTuple35, 31
24ExprTuple36, 31
25Literal
26ExprTuple29, 31
27Literal
28ExprTuple30, 31
29Operationoperator: 33
operands: 32
30Operationoperator: 33
operands: 34
31Variable
32ExprTuple35, 37
33Literal
34ExprTuple36, 37
35Variable
36Variable
37Variable