logo
In [1]:
import proveit
# Automation is not needed when only building an expression:
proveit.defaults.automation = False # This will speed things up.
proveit.defaults.inline_pngs = False # Makes files smaller.
%load_theorem_expr # Load the stored theorem expression as 'stored_expr'
# import the special expression
from proveit.linear_algebra.tensors import tensor_prod_association
In [2]:
# check that the built expression is the same as the stored expression
assert tensor_prod_association.expr == stored_expr
assert tensor_prod_association.expr._style_id == stored_expr._style_id
print("Passed sanity check: tensor_prod_association matches stored_expr")
Passed sanity check: tensor_prod_association matches stored_expr
In [3]:
# Show the LaTeX representation of the expression for convenience if you need it.
print(stored_expr.latex())
\forall_{K}~\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]
In [4]:
stored_expr.style_options()
namedescriptiondefaultcurrent valuerelated methods
with_wrappingIf 'True', wrap the Expression after the parametersNoneNone/False('with_wrapping',)
condition_wrappingWrap 'before' or 'after' the condition (or None).NoneNone/False('with_wrap_after_condition', 'with_wrap_before_condition')
wrap_paramsIf 'True', wraps every two parameters AND wraps the Expression after the parametersNoneNone/False('with_params',)
justificationjustify to the 'left', 'center', or 'right' in the array cellscentercenter('with_justification',)
In [5]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0Operationoperator: 30
operand: 2
1ExprTuple2
2Lambdaparameter: 73
body: 3
3Operationoperator: 30
operand: 5
4ExprTuple5
5Lambdaparameters: 6
body: 7
6ExprTuple75, 92, 79
7Conditionalvalue: 8
condition: 9
8Operationoperator: 30
operand: 12
9Operationoperator: 48
operands: 11
10ExprTuple12
11ExprTuple13, 14, 15
12Lambdaparameters: 16
body: 17
13Operationoperator: 82
operands: 18
14Operationoperator: 82
operands: 19
15Operationoperator: 82
operands: 20
16ExprTuple21, 22, 23
17Conditionalvalue: 24
condition: 25
18ExprTuple75, 26
19ExprTuple92, 26
20ExprTuple79, 26
21ExprRangelambda_map: 27
start_index: 91
end_index: 75
22ExprRangelambda_map: 28
start_index: 91
end_index: 92
23ExprRangelambda_map: 29
start_index: 91
end_index: 79
24Operationoperator: 30
operand: 33
25Operationoperator: 48
operands: 32
26Literal
27Lambdaparameter: 101
body: 86
28Lambdaparameter: 101
body: 87
29Lambdaparameter: 101
body: 89
30Literal
31ExprTuple33
32ExprTuple34, 35, 36
33Lambdaparameters: 60
body: 37
34ExprRangelambda_map: 38
start_index: 91
end_index: 75
35ExprRangelambda_map: 39
start_index: 91
end_index: 92
36ExprRangelambda_map: 40
start_index: 91
end_index: 79
37Conditionalvalue: 41
condition: 42
38Lambdaparameter: 101
body: 43
39Lambdaparameter: 101
body: 44
40Lambdaparameter: 101
body: 45
41Operationoperator: 46
operands: 47
42Operationoperator: 48
operands: 49
43Operationoperator: 52
operands: 50
44Operationoperator: 52
operands: 51
45Operationoperator: 52
operands: 53
46Literal
47ExprTuple54, 55
48Literal
49ExprTuple56, 57, 58
50ExprTuple86, 59
51ExprTuple87, 59
52Literal
53ExprTuple89, 59
54Operationoperator: 76
operands: 60
55Operationoperator: 76
operands: 61
56ExprRangelambda_map: 62
start_index: 91
end_index: 75
57ExprRangelambda_map: 63
start_index: 91
end_index: 92
58ExprRangelambda_map: 64
start_index: 91
end_index: 79
59Operationoperator: 65
operand: 73
60ExprTuple67, 84, 69
61ExprTuple67, 68, 69
62Lambdaparameter: 101
body: 70
63Lambdaparameter: 101
body: 71
64Lambdaparameter: 101
body: 72
65Literal
66ExprTuple73
67ExprRangelambda_map: 74
start_index: 91
end_index: 75
68Operationoperator: 76
operands: 77
69ExprRangelambda_map: 78
start_index: 91
end_index: 79
70Operationoperator: 82
operands: 80
71Operationoperator: 82
operands: 81
72Operationoperator: 82
operands: 83
73Variable
74Lambdaparameter: 101
body: 85
75Variable
76Literal
77ExprTuple84
78Lambdaparameter: 101
body: 88
79Variable
80ExprTuple85, 86
81ExprTuple98, 87
82Literal
83ExprTuple88, 89
84ExprRangelambda_map: 90
start_index: 91
end_index: 92
85IndexedVarvariable: 93
index: 101
86IndexedVarvariable: 94
index: 101
87IndexedVarvariable: 95
index: 101
88IndexedVarvariable: 96
index: 101
89IndexedVarvariable: 97
index: 101
90Lambdaparameter: 101
body: 98
91Literal
92Variable
93Variable
94Variable
95Variable
96Variable
97Variable
98IndexedVarvariable: 99
index: 101
99Variable
100ExprTuple101
101Variable