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