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 distribution_over_vec_sum
In [2]:
# check that the built expression is the same as the stored expression
assert distribution_over_vec_sum.expr == stored_expr
assert distribution_over_vec_sum.expr._style_id == stored_expr._style_id
print("Passed sanity check: distribution_over_vec_sum matches stored_expr")
Passed sanity check: distribution_over_vec_sum 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_{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)}~f\left(b_{1}, b_{2}, \ldots, b_{j}\right)\right] \in V\right) \Rightarrow  \\ \left(\begin{array}{c} \begin{array}{l} \left(k \cdot \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]\right) \\  = \left[\sum_{b_{1}, b_{2}, \ldots, b_{j}~|~Q\left(b_{1}, b_{2}, \ldots, b_{j}\right)}~\left(k \cdot f\left(b_{1}, b_{2}, \ldots, b_{j}\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, 60, 59
4Operationoperator: 19
operand: 6
5ExprTuple6
6Lambdaparameter: 65
body: 8
7ExprTuple65
8Conditionalvalue: 9
condition: 10
9Operationoperator: 19
operand: 13
10Operationoperator: 37
operands: 12
11ExprTuple13
12ExprTuple65, 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: 57
body: 26
24Operationoperator: 27
operand: 36
25ExprTuple57
26Conditionalvalue: 29
condition: 30
27Literal
28ExprTuple36
29Operationoperator: 31
operands: 32
30Operationoperator: 37
operands: 33
31Literal
32ExprTuple34, 35
33ExprTuple57, 36
34Operationoperator: 37
operands: 38
35Operationoperator: 39
operands: 40
36Variable
37Literal
38ExprTuple46, 41
39Literal
40ExprTuple42, 43
41Variable
42Operationoperator: 54
operands: 44
43Operationoperator: 48
operand: 47
44ExprTuple57, 46
45ExprTuple47
46Operationoperator: 48
operand: 51
47Lambdaparameters: 61
body: 50
48Literal
49ExprTuple51
50Conditionalvalue: 52
condition: 56
51Lambdaparameters: 61
body: 53
52Operationoperator: 54
operands: 55
53Conditionalvalue: 58
condition: 56
54Literal
55ExprTuple57, 58
56Operationoperator: 59
operands: 61
57Variable
58Operationoperator: 60
operands: 61
59Variable
60Variable
61ExprTuple62
62ExprRangelambda_map: 63
start_index: 64
end_index: 65
63Lambdaparameter: 69
body: 66
64Literal
65Variable
66IndexedVarvariable: 67
index: 69
67Variable
68ExprTuple69
69Variable