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_distribution_over_add
In [2]:
# check that the built expression is the same as the stored expression
assert tensor_prod_distribution_over_add.expr == stored_expr
assert tensor_prod_distribution_over_add.expr._style_id == stored_expr._style_id
print("Passed sanity check: tensor_prod_distribution_over_add matches stored_expr")
Passed sanity check: tensor_prod_distribution_over_add 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_{V \underset{{\scriptscriptstyle c}}{\in} \textrm{VecSpaces}\left(K\right)}~\\
\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}}~\\
\left(\begin{array}{c} \begin{array}{l} \left(\left(a_{1} {\otimes}  a_{2} {\otimes}  \ldots {\otimes}  a_{i} {\otimes} \left(b_{1} +  b_{2} +  \ldots +  b_{j}\right){\otimes} c_{1} {\otimes}  c_{2} {\otimes}  \ldots {\otimes}  c_{k}\right) \in V\right) \Rightarrow  \\ \left(\begin{array}{c} \begin{array}{l} \left(a_{1} {\otimes}  a_{2} {\otimes}  \ldots {\otimes}  a_{i} {\otimes} \left(b_{1} +  b_{2} +  \ldots +  b_{j}\right){\otimes} c_{1} {\otimes}  c_{2} {\otimes}  \ldots {\otimes}  c_{k}\right) =  \\ \left(\left(a_{1} {\otimes}  a_{2} {\otimes}  \ldots {\otimes}  a_{i} {\otimes} b_{1}{\otimes} c_{1} {\otimes}  c_{2} {\otimes}  \ldots {\otimes}  c_{k}\right) +  \left(a_{1} {\otimes}  a_{2} {\otimes}  \ldots {\otimes}  a_{i} {\otimes} b_{2}{\otimes} c_{1} {\otimes}  c_{2} {\otimes}  \ldots {\otimes}  c_{k}\right) +  \ldots +  \left(a_{1} {\otimes}  a_{2} {\otimes}  \ldots {\otimes}  a_{i} {\otimes} b_{j}{\otimes} c_{1} {\otimes}  c_{2} {\otimes}  \ldots {\otimes}  c_{k}\right)\right) \end{array} \end{array}\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: 25
operand: 2
1ExprTuple2
2Lambdaparameter: 37
body: 3
3Operationoperator: 25
operand: 5
4ExprTuple5
5Lambdaparameters: 6
body: 7
6ExprTuple65, 57, 70
7Conditionalvalue: 8
condition: 9
8Operationoperator: 25
operand: 13
9Operationoperator: 11
operands: 12
10ExprTuple13
11Literal
12ExprTuple14, 15, 16
13Lambdaparameter: 44
body: 18
14Operationoperator: 40
operands: 19
15Operationoperator: 40
operands: 20
16Operationoperator: 40
operands: 21
17ExprTuple44
18Conditionalvalue: 22
condition: 23
19ExprTuple65, 24
20ExprTuple57, 24
21ExprTuple70, 24
22Operationoperator: 25
operand: 29
23Operationoperator: 27
operands: 28
24Literal
25Literal
26ExprTuple29
27Literal
28ExprTuple44, 30
29Lambdaparameters: 31
body: 32
30Operationoperator: 33
operand: 37
31ExprTuple61, 54, 63
32Operationoperator: 35
operands: 36
33Literal
34ExprTuple37
35Literal
36ExprTuple38, 39
37Variable
38Operationoperator: 40
operands: 41
39Operationoperator: 42
operands: 43
40Literal
41ExprTuple45, 44
42Literal
43ExprTuple45, 46
44Variable
45Operationoperator: 58
operands: 47
46Operationoperator: 51
operands: 48
47ExprTuple61, 49, 63
48ExprTuple50
49Operationoperator: 51
operands: 52
50ExprRangelambda_map: 53
start_index: 69
end_index: 57
51Literal
52ExprTuple54
53Lambdaparameter: 72
body: 55
54ExprRangelambda_map: 56
start_index: 69
end_index: 57
55Operationoperator: 58
operands: 59
56Lambdaparameter: 77
body: 60
57Variable
58Literal
59ExprTuple61, 62, 63
60IndexedVarvariable: 66
index: 77
61ExprRangelambda_map: 64
start_index: 69
end_index: 65
62IndexedVarvariable: 66
index: 72
63ExprRangelambda_map: 68
start_index: 69
end_index: 70
64Lambdaparameter: 77
body: 71
65Variable
66Variable
67ExprTuple72
68Lambdaparameter: 77
body: 73
69Literal
70Variable
71IndexedVarvariable: 74
index: 77
72Variable
73IndexedVarvariable: 75
index: 77
74Variable
75Variable
76ExprTuple77
77Variable