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_factorization_from_summation
In [2]:
# check that the built expression is the same as the stored expression
assert tensor_prod_factorization_from_summation.expr == stored_expr
assert tensor_prod_factorization_from_summation.expr._style_id == stored_expr._style_id
print("Passed sanity check: tensor_prod_factorization_from_summation matches stored_expr")
Passed sanity check: tensor_prod_factorization_from_summation matches stored_expr
In [3]:
# Show the LaTeX representation of the expression for convenience if you need it.
print(stored_expr.latex())
\forall_{K, f, Q}~\left[\forall_{i \in \mathbb{N}, j \in \mathbb{N}^+, k \in \mathbb{N}}~\left[\forall_{V \underset{{\scriptscriptstyle c}}{\in} \textrm{VecSpaces}\left(K\right)}~\left[\forall_{a_{1}, a_{2}, \ldots, a_{i}, c_{1}, c_{2}, \ldots, c_{k}}~\left(\begin{array}{c} \begin{array}{l} \left[\forall_{b_{1}, b_{2}, \ldots, b_{j}~|~Q\left(b_{1}, b_{2}, \ldots, b_{j}\right)}~\left(\left(a_{1} {\otimes}  a_{2} {\otimes}  \ldots {\otimes}  a_{i} {\otimes} f\left(b_{1}, b_{2}, \ldots, b_{j}\right){\otimes} c_{1} {\otimes}  c_{2} {\otimes}  \ldots {\otimes}  c_{k}\right) \in V\right)\right] \Rightarrow  \\ \left(\begin{array}{c} \begin{array}{l} \left[\sum_{b_{1}, b_{2}, \ldots, b_{j}~|~Q\left(b_{1}, b_{2}, \ldots, b_{j}\right)}~\left(a_{1} {\otimes}  a_{2} {\otimes}  \ldots {\otimes}  a_{i} {\otimes} f\left(b_{1}, b_{2}, \ldots, b_{j}\right){\otimes} c_{1} {\otimes}  c_{2} {\otimes}  \ldots {\otimes}  c_{k}\right)\right] \\  = \left(a_{1} {\otimes}  a_{2} {\otimes}  \ldots {\otimes}  a_{i} {\otimes} \left[\sum_{b_{1}, b_{2}, \ldots, b_{j}~|~Q\left(b_{1}, b_{2}, \ldots, b_{j}\right)}~f\left(b_{1}, b_{2}, \ldots, b_{j}\right)\right]{\otimes} c_{1} {\otimes}  c_{2} {\otimes}  \ldots {\otimes}  c_{k}\right) \end{array} \end{array}\right) \end{array} \end{array}\right)\right]\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: 41
operand: 2
1ExprTuple2
2Lambdaparameters: 3
body: 4
3ExprTuple38, 73, 74
4Operationoperator: 41
operand: 6
5ExprTuple6
6Lambdaparameters: 7
body: 8
7ExprTuple70, 83, 72
8Conditionalvalue: 9
condition: 10
9Operationoperator: 41
operand: 14
10Operationoperator: 12
operands: 13
11ExprTuple14
12Literal
13ExprTuple15, 16, 17
14Lambdaparameter: 59
body: 19
15Operationoperator: 54
operands: 20
16Operationoperator: 54
operands: 21
17Operationoperator: 54
operands: 22
18ExprTuple59
19Conditionalvalue: 23
condition: 24
20ExprTuple70, 26
21ExprTuple83, 25
22ExprTuple72, 26
23Operationoperator: 41
operand: 30
24Operationoperator: 28
operands: 29
25Literal
26Literal
27ExprTuple30
28Literal
29ExprTuple59, 31
30Lambdaparameters: 32
body: 33
31Operationoperator: 34
operand: 38
32ExprTuple65, 66
33Operationoperator: 36
operands: 37
34Literal
35ExprTuple38
36Literal
37ExprTuple39, 40
38Variable
39Operationoperator: 41
operand: 45
40Operationoperator: 43
operands: 44
41Literal
42ExprTuple45
43Literal
44ExprTuple46, 47
45Lambdaparameters: 75
body: 48
46Operationoperator: 57
operand: 52
47Operationoperator: 62
operands: 50
48Conditionalvalue: 51
condition: 68
49ExprTuple52
50ExprTuple65, 53, 66
51Operationoperator: 54
operands: 55
52Lambdaparameters: 75
body: 56
53Operationoperator: 57
operand: 61
54Literal
55ExprTuple60, 59
56Conditionalvalue: 60
condition: 68
57Literal
58ExprTuple61
59Variable
60Operationoperator: 62
operands: 63
61Lambdaparameters: 75
body: 64
62Literal
63ExprTuple65, 67, 66
64Conditionalvalue: 67
condition: 68
65ExprRangelambda_map: 69
start_index: 82
end_index: 70
66ExprRangelambda_map: 71
start_index: 82
end_index: 72
67Operationoperator: 73
operands: 75
68Operationoperator: 74
operands: 75
69Lambdaparameter: 87
body: 76
70Variable
71Lambdaparameter: 87
body: 77
72Variable
73Variable
74Variable
75ExprTuple78
76IndexedVarvariable: 79
index: 87
77IndexedVarvariable: 80
index: 87
78ExprRangelambda_map: 81
start_index: 82
end_index: 83
79Variable
80Variable
81Lambdaparameter: 87
body: 84
82Literal
83Variable
84IndexedVarvariable: 85
index: 87
85Variable
86ExprTuple87
87Variable