logo

Expression of type Lambda

from the theory of proveit.linear_algebra.tensors

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 Conditional, Lambda, V, b
from proveit.core_expr_types import a_1_to_i, c_1_to_k, d_1_to_i, e_1_to_k
from proveit.linear_algebra import TensorProd
from proveit.logic import Equals, Implies, InSet
In [2]:
# build up the expression from sub-expressions
expr = Lambda(b, Conditional(Implies(Equals(TensorProd(a_1_to_i, c_1_to_k), TensorProd(d_1_to_i, e_1_to_k)).with_wrapping_at(2), Equals(TensorProd(a_1_to_i, b, c_1_to_k), TensorProd(d_1_to_i, b, e_1_to_k)).with_wrapping_at(2)).with_wrapping_at(2), InSet(b, V)))
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\{\begin{array}{c} \begin{array}{l} \left(\begin{array}{c} \begin{array}{l} \left(a_{1} {\otimes}  a_{2} {\otimes}  \ldots {\otimes}  a_{i}{\otimes} c_{1} {\otimes}  c_{2} {\otimes}  \ldots {\otimes}  c_{k}\right) =  \\ \left(d_{1} {\otimes}  d_{2} {\otimes}  \ldots {\otimes}  d_{i}{\otimes} e_{1} {\otimes}  e_{2} {\otimes}  \ldots {\otimes}  e_{k}\right) \end{array} \end{array}\right) \Rightarrow  \\ \left(\begin{array}{c} \begin{array}{l} \left(a_{1} {\otimes}  a_{2} {\otimes}  \ldots {\otimes}  a_{i} {\otimes} b{\otimes} c_{1} {\otimes}  c_{2} {\otimes}  \ldots {\otimes}  c_{k}\right) =  \\ \left(d_{1} {\otimes}  d_{2} {\otimes}  \ldots {\otimes}  d_{i} {\otimes} b{\otimes} e_{1} {\otimes}  e_{2} {\otimes}  \ldots {\otimes}  e_{k}\right) \end{array} \end{array}\right) \end{array} \end{array} \textrm{ if } b \in V\right..
In [5]:
stored_expr.style_options()
no style options
In [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0Lambdaparameter: 27
body: 2
1ExprTuple27
2Conditionalvalue: 3
condition: 4
3Operationoperator: 5
operands: 6
4Operationoperator: 7
operands: 8
5Literal
6ExprTuple9, 10
7Literal
8ExprTuple27, 11
9Operationoperator: 13
operands: 12
10Operationoperator: 13
operands: 14
11Variable
12ExprTuple15, 16
13Literal
14ExprTuple17, 18
15Operationoperator: 22
operands: 19
16Operationoperator: 22
operands: 20
17Operationoperator: 22
operands: 21
18Operationoperator: 22
operands: 23
19ExprTuple24, 25
20ExprTuple26, 28
21ExprTuple24, 27, 25
22Literal
23ExprTuple26, 27, 28
24ExprRangelambda_map: 29
start_index: 34
end_index: 32
25ExprRangelambda_map: 30
start_index: 34
end_index: 35
26ExprRangelambda_map: 31
start_index: 34
end_index: 32
27Variable
28ExprRangelambda_map: 33
start_index: 34
end_index: 35
29Lambdaparameter: 45
body: 36
30Lambdaparameter: 45
body: 37
31Lambdaparameter: 45
body: 38
32Variable
33Lambdaparameter: 45
body: 39
34Literal
35Variable
36IndexedVarvariable: 40
index: 45
37IndexedVarvariable: 41
index: 45
38IndexedVarvariable: 42
index: 45
39IndexedVarvariable: 43
index: 45
40Variable
41Variable
42Variable
43Variable
44ExprTuple45
45Variable