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 factor_scalar_from_tensor_prod
In [2]:
# check that the built expression is the same as the stored expression
assert factor_scalar_from_tensor_prod.expr == stored_expr
assert factor_scalar_from_tensor_prod.expr._style_id == stored_expr._style_id
print("Passed sanity check: factor_scalar_from_tensor_prod matches stored_expr")
Passed sanity check: factor_scalar_from_tensor_prod 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_{\alpha \in K}~\left[\forall_{i, k \in \mathbb{N}}~\left[\begin{array}{l}\forall_{U_{1}, U_{2}, \ldots, U_{i}, V, 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), b \in V,\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} \left(\alpha \cdot b\right){\otimes} c_{1} {\otimes}  c_{2} {\otimes}  \ldots {\otimes}  c_{k}\right) \\  = \left(\alpha \cdot \left(a_{1} {\otimes}  a_{2} {\otimes}  \ldots {\otimes}  a_{i} {\otimes} b{\otimes} c_{1} {\otimes}  c_{2} {\otimes}  \ldots {\otimes}  c_{k}\right)\right) \end{array} \end{array}\right)\end{array}\right]\end{array}\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: 33
operand: 2
1ExprTuple2
2Lambdaparameter: 73
body: 3
3Operationoperator: 33
operand: 5
4ExprTuple5
5Lambdaparameter: 81
body: 7
6ExprTuple81
7Conditionalvalue: 8
condition: 9
8Operationoperator: 33
operand: 12
9Operationoperator: 79
operands: 11
10ExprTuple12
11ExprTuple81, 73
12Lambdaparameters: 13
body: 14
13ExprTuple88, 91
14Conditionalvalue: 15
condition: 16
15Operationoperator: 33
operand: 19
16Operationoperator: 50
operands: 18
17ExprTuple19
18ExprTuple20, 21
19Lambdaparameters: 22
body: 23
20Operationoperator: 79
operands: 24
21Operationoperator: 79
operands: 25
22ExprTuple26, 71, 27
23Conditionalvalue: 28
condition: 29
24ExprTuple88, 30
25ExprTuple91, 30
26ExprRangelambda_map: 31
start_index: 90
end_index: 88
27ExprRangelambda_map: 32
start_index: 90
end_index: 91
28Operationoperator: 33
operand: 36
29Operationoperator: 50
operands: 35
30Literal
31Lambdaparameter: 99
body: 85
32Lambdaparameter: 99
body: 86
33Literal
34ExprTuple36
35ExprTuple37, 38, 39
36Lambdaparameters: 77
body: 40
37ExprRangelambda_map: 41
start_index: 90
end_index: 88
38Operationoperator: 53
operands: 42
39ExprRangelambda_map: 43
start_index: 90
end_index: 91
40Conditionalvalue: 44
condition: 45
41Lambdaparameter: 99
body: 46
42ExprTuple71, 60
43Lambdaparameter: 99
body: 47
44Operationoperator: 48
operands: 49
45Operationoperator: 50
operands: 51
46Operationoperator: 53
operands: 52
47Operationoperator: 53
operands: 54
48Literal
49ExprTuple55, 56
50Literal
51ExprTuple57, 58, 59
52ExprTuple85, 60
53Literal
54ExprTuple86, 60
55Operationoperator: 76
operands: 61
56Operationoperator: 74
operands: 62
57ExprRangelambda_map: 63
start_index: 90
end_index: 88
58Operationoperator: 79
operands: 64
59ExprRangelambda_map: 65
start_index: 90
end_index: 91
60Operationoperator: 66
operand: 73
61ExprTuple82, 68, 84
62ExprTuple81, 69
63Lambdaparameter: 99
body: 70
64ExprTuple83, 71
65Lambdaparameter: 99
body: 72
66Literal
67ExprTuple73
68Operationoperator: 74
operands: 75
69Operationoperator: 76
operands: 77
70Operationoperator: 79
operands: 78
71Variable
72Operationoperator: 79
operands: 80
73Variable
74Literal
75ExprTuple81, 83
76Literal
77ExprTuple82, 83, 84
78ExprTuple94, 85
79Literal
80ExprTuple95, 86
81Variable
82ExprRangelambda_map: 87
start_index: 90
end_index: 88
83Variable
84ExprRangelambda_map: 89
start_index: 90
end_index: 91
85IndexedVarvariable: 92
index: 99
86IndexedVarvariable: 93
index: 99
87Lambdaparameter: 99
body: 94
88Variable
89Lambdaparameter: 99
body: 95
90Literal
91Variable
92Variable
93Variable
94IndexedVarvariable: 96
index: 99
95IndexedVarvariable: 97
index: 99
96Variable
97Variable
98ExprTuple99
99Variable