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 K, Lambda, i, j, k
from proveit.core_expr_types import A_1_to_i, B_1_to_j, C_1_to_k
from proveit.linear_algebra import TensorProd, VecSpaces
from proveit.logic import Equals, Forall
from proveit.numbers import Natural
In [2]:
# build up the expression from sub-expressions
expr = Lambda(K, Forall(instance_param_or_params = [i, j, k], instance_expr = Forall(instance_param_or_params = [A_1_to_i, B_1_to_j, C_1_to_k], instance_expr = Equals(TensorProd(A_1_to_i, B_1_to_j, C_1_to_k), TensorProd(A_1_to_i, TensorProd(B_1_to_j), C_1_to_k)).with_wrapping_at(1), domain = VecSpaces(K)).with_wrapping(), domain = Natural))
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())
K \mapsto \left[\forall_{i, j, k \in \mathbb{N}}~\left[\begin{array}{l}\forall_{A_{1}, A_{2}, \ldots, A_{i}, B_{1}, B_{2}, \ldots, B_{j}, C_{1}, C_{2}, \ldots, C_{k} \underset{{\scriptscriptstyle c}}{\in} \textrm{VecSpaces}\left(K\right)}~\\
\left(\begin{array}{c} \begin{array}{l} \left(A_{1} {\otimes}  A_{2} {\otimes}  \ldots {\otimes}  A_{i}{\otimes} B_{1} {\otimes}  B_{2} {\otimes}  \ldots {\otimes}  B_{j}{\otimes} C_{1} {\otimes}  C_{2} {\otimes}  \ldots {\otimes}  C_{k}\right) \\  = \left(A_{1} {\otimes}  A_{2} {\otimes}  \ldots {\otimes}  A_{i} {\otimes} \left(B_{1} {\otimes}  B_{2} {\otimes}  \ldots {\otimes}  B_{j}\right){\otimes} C_{1} {\otimes}  C_{2} {\otimes}  \ldots {\otimes}  C_{k}\right) \end{array} \end{array}\right)\end{array}\right]\right]
In [5]:
stored_expr.style_options()
no style options
In [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0Lambdaparameter: 65
body: 1
1Operationoperator: 8
operand: 3
2ExprTuple3
3Lambdaparameters: 4
body: 5
4ExprTuple44, 59, 48
5Conditionalvalue: 6
condition: 7
6Operationoperator: 8
operand: 11
7Operationoperator: 25
operands: 10
8Literal
9ExprTuple11
10ExprTuple12, 13, 14
11Lambdaparameters: 32
body: 15
12Operationoperator: 18
operands: 16
13Operationoperator: 18
operands: 17
14Operationoperator: 18
operands: 19
15Conditionalvalue: 20
condition: 21
16ExprTuple44, 22
17ExprTuple59, 22
18Literal
19ExprTuple48, 22
20Operationoperator: 23
operands: 24
21Operationoperator: 25
operands: 26
22Literal
23Literal
24ExprTuple27, 28
25Literal
26ExprTuple29, 30, 31
27Operationoperator: 45
operands: 32
28Operationoperator: 45
operands: 33
29ExprRangelambda_map: 34
start_index: 58
end_index: 44
30ExprRangelambda_map: 35
start_index: 58
end_index: 59
31ExprRangelambda_map: 36
start_index: 58
end_index: 48
32ExprTuple37, 53, 39
33ExprTuple37, 38, 39
34Lambdaparameter: 68
body: 40
35Lambdaparameter: 68
body: 41
36Lambdaparameter: 68
body: 42
37ExprRangelambda_map: 43
start_index: 58
end_index: 44
38Operationoperator: 45
operands: 46
39ExprRangelambda_map: 47
start_index: 58
end_index: 48
40Operationoperator: 51
operands: 49
41Operationoperator: 51
operands: 50
42Operationoperator: 51
operands: 52
43Lambdaparameter: 68
body: 54
44Variable
45Literal
46ExprTuple53
47Lambdaparameter: 68
body: 55
48Variable
49ExprTuple54, 56
50ExprTuple64, 56
51Literal
52ExprTuple55, 56
53ExprRangelambda_map: 57
start_index: 58
end_index: 59
54IndexedVarvariable: 60
index: 68
55IndexedVarvariable: 61
index: 68
56Operationoperator: 62
operand: 65
57Lambdaparameter: 68
body: 64
58Literal
59Variable
60Variable
61Variable
62Literal
63ExprTuple65
64IndexedVarvariable: 66
index: 68
65Variable
66Variable
67ExprTuple68
68Variable