logo

Expression of type ExprTuple

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 ExprTuple, K, Lambda, i, j, k
from proveit.core_expr_types import U_1_to_i, V_1_to_j, W_1_to_k, 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
sub_expr1 = [U_1_to_i, V_1_to_j, W_1_to_k]
expr = ExprTuple(Lambda(K, Forall(instance_param_or_params = [i, j, k], instance_expr = Forall(instance_param_or_params = sub_expr1, 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(2), domains = sub_expr1).with_wrapping(), 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())
\left(K \mapsto \left[\forall_{i, j, k \in \mathbb{N}}~\left[\begin{array}{l}\forall_{U_{1}, U_{2}, \ldots, U_{i}, V_{1}, V_{2}, \ldots, V_{j}, W_{1}, W_{2}, \ldots, W_{k} \underset{{\scriptscriptstyle c}}{\in} \textrm{VecSpaces}\left(K\right)}~\\
\left[\begin{array}{l}\forall_{\left(a_{1} \in U_{1}\right), \left(a_{2} \in U_{2}\right), \ldots, \left(a_{i} \in U_{i}\right),\left(b_{1} \in V_{1}\right), \left(b_{2} \in V_{2}\right), \ldots, \left(b_{j} \in V_{j}\right),\left(c_{1} \in W_{1}\right), \left(c_{2} \in W_{2}\right), \ldots, \left(c_{k} \in W_{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]\end{array}\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
1Lambdaparameter: 72
body: 2
2Operationoperator: 29
operand: 4
3ExprTuple4
4Lambdaparameters: 5
body: 6
5ExprTuple74, 91, 78
6Conditionalvalue: 7
condition: 8
7Operationoperator: 29
operand: 11
8Operationoperator: 47
operands: 10
9ExprTuple11
10ExprTuple12, 13, 14
11Lambdaparameters: 15
body: 16
12Operationoperator: 81
operands: 17
13Operationoperator: 81
operands: 18
14Operationoperator: 81
operands: 19
15ExprTuple20, 21, 22
16Conditionalvalue: 23
condition: 24
17ExprTuple74, 25
18ExprTuple91, 25
19ExprTuple78, 25
20ExprRangelambda_map: 26
start_index: 90
end_index: 74
21ExprRangelambda_map: 27
start_index: 90
end_index: 91
22ExprRangelambda_map: 28
start_index: 90
end_index: 78
23Operationoperator: 29
operand: 32
24Operationoperator: 47
operands: 31
25Literal
26Lambdaparameter: 100
body: 85
27Lambdaparameter: 100
body: 86
28Lambdaparameter: 100
body: 88
29Literal
30ExprTuple32
31ExprTuple33, 34, 35
32Lambdaparameters: 59
body: 36
33ExprRangelambda_map: 37
start_index: 90
end_index: 74
34ExprRangelambda_map: 38
start_index: 90
end_index: 91
35ExprRangelambda_map: 39
start_index: 90
end_index: 78
36Conditionalvalue: 40
condition: 41
37Lambdaparameter: 100
body: 42
38Lambdaparameter: 100
body: 43
39Lambdaparameter: 100
body: 44
40Operationoperator: 45
operands: 46
41Operationoperator: 47
operands: 48
42Operationoperator: 51
operands: 49
43Operationoperator: 51
operands: 50
44Operationoperator: 51
operands: 52
45Literal
46ExprTuple53, 54
47Literal
48ExprTuple55, 56, 57
49ExprTuple85, 58
50ExprTuple86, 58
51Literal
52ExprTuple88, 58
53Operationoperator: 75
operands: 59
54Operationoperator: 75
operands: 60
55ExprRangelambda_map: 61
start_index: 90
end_index: 74
56ExprRangelambda_map: 62
start_index: 90
end_index: 91
57ExprRangelambda_map: 63
start_index: 90
end_index: 78
58Operationoperator: 64
operand: 72
59ExprTuple66, 83, 68
60ExprTuple66, 67, 68
61Lambdaparameter: 100
body: 69
62Lambdaparameter: 100
body: 70
63Lambdaparameter: 100
body: 71
64Literal
65ExprTuple72
66ExprRangelambda_map: 73
start_index: 90
end_index: 74
67Operationoperator: 75
operands: 76
68ExprRangelambda_map: 77
start_index: 90
end_index: 78
69Operationoperator: 81
operands: 79
70Operationoperator: 81
operands: 80
71Operationoperator: 81
operands: 82
72Variable
73Lambdaparameter: 100
body: 84
74Variable
75Literal
76ExprTuple83
77Lambdaparameter: 100
body: 87
78Variable
79ExprTuple84, 85
80ExprTuple97, 86
81Literal
82ExprTuple87, 88
83ExprRangelambda_map: 89
start_index: 90
end_index: 91
84IndexedVarvariable: 92
index: 100
85IndexedVarvariable: 93
index: 100
86IndexedVarvariable: 94
index: 100
87IndexedVarvariable: 95
index: 100
88IndexedVarvariable: 96
index: 100
89Lambdaparameter: 100
body: 97
90Literal
91Variable
92Variable
93Variable
94Variable
95Variable
96Variable
97IndexedVarvariable: 98
index: 100
98Variable
99ExprTuple100
100Variable