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.scalar_multiplication import factorization_from_vec_sum_with_scalar_mult
In [2]:
# check that the built expression is the same as the stored expression
assert factorization_from_vec_sum_with_scalar_mult.expr == stored_expr
assert factorization_from_vec_sum_with_scalar_mult.expr._style_id == stored_expr._style_id
print("Passed sanity check: factorization_from_vec_sum_with_scalar_mult matches stored_expr")
Passed sanity check: factorization_from_vec_sum_with_scalar_mult 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, c}~\left[\forall_{j \in \mathbb{N}^+}~\left[\forall_{V \underset{{\scriptscriptstyle c}}{\in} \textrm{VecSpaces}\left(K\right)}~\left[\forall_{k \in K}~\left(\begin{array}{c} \begin{array}{l} \left(\left[\sum_{b_{1}, b_{2}, \ldots, b_{j}~|~Q\left(b_{1}, b_{2}, \ldots, b_{j}\right)}~\left(c\left(b_{1}, b_{2}, \ldots, b_{j}\right) \cdot f\left(b_{1}, b_{2}, \ldots, b_{j}\right)\right)\right] \in V\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(\left(k \cdot c\left(b_{1}, b_{2}, \ldots, b_{j}\right)\right) \cdot f\left(b_{1}, b_{2}, \ldots, b_{j}\right)\right)\right] \\  = \left(k \cdot \left[\sum_{b_{1}, b_{2}, \ldots, b_{j}~|~Q\left(b_{1}, b_{2}, \ldots, b_{j}\right)}~\left(c\left(b_{1}, b_{2}, \ldots, b_{j}\right) \cdot f\left(b_{1}, b_{2}, \ldots, b_{j}\right)\right)\right]\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: 19
operand: 2
1ExprTuple2
2Lambdaparameters: 3
body: 4
3ExprTuple36, 67, 62, 66
4Operationoperator: 19
operand: 6
5ExprTuple6
6Lambdaparameter: 72
body: 8
7ExprTuple72
8Conditionalvalue: 9
condition: 10
9Operationoperator: 19
operand: 13
10Operationoperator: 37
operands: 12
11ExprTuple13
12ExprTuple72, 14
13Lambdaparameter: 41
body: 16
14Literal
15ExprTuple41
16Conditionalvalue: 17
condition: 18
17Operationoperator: 19
operand: 23
18Operationoperator: 21
operands: 22
19Literal
20ExprTuple23
21Literal
22ExprTuple41, 24
23Lambdaparameter: 63
body: 26
24Operationoperator: 27
operand: 36
25ExprTuple63
26Conditionalvalue: 29
condition: 30
27Literal
28ExprTuple36
29Operationoperator: 31
operands: 32
30Operationoperator: 37
operands: 33
31Literal
32ExprTuple34, 35
33ExprTuple63, 36
34Operationoperator: 37
operands: 38
35Operationoperator: 39
operands: 40
36Variable
37Literal
38ExprTuple47, 41
39Literal
40ExprTuple42, 43
41Variable
42Operationoperator: 49
operand: 46
43Operationoperator: 60
operands: 45
44ExprTuple46
45ExprTuple63, 47
46Lambdaparameters: 68
body: 48
47Operationoperator: 49
operand: 52
48Conditionalvalue: 51
condition: 57
49Literal
50ExprTuple52
51Operationoperator: 60
operands: 53
52Lambdaparameters: 68
body: 54
53ExprTuple55, 65
54Conditionalvalue: 56
condition: 57
55Operationoperator: 58
operands: 59
56Operationoperator: 60
operands: 61
57Operationoperator: 62
operands: 68
58Literal
59ExprTuple63, 64
60Literal
61ExprTuple64, 65
62Variable
63Variable
64Operationoperator: 66
operands: 68
65Operationoperator: 67
operands: 68
66Variable
67Variable
68ExprTuple69
69ExprRangelambda_map: 70
start_index: 71
end_index: 72
70Lambdaparameter: 76
body: 73
71Literal
72Variable
73IndexedVarvariable: 74
index: 76
74Variable
75ExprTuple76
76Variable