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_vectors
In [2]:
# check that the built expression is the same as the stored expression
assert factorization_from_vectors.expr == stored_expr
assert factorization_from_vectors.expr._style_id == stored_expr._style_id
print("Passed sanity check: factorization_from_vectors matches stored_expr")
Passed sanity check: factorization_from_vectors 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_{V \underset{{\scriptscriptstyle c}}{\in} \textrm{VecSpaces}\left(K\right)}~\left[\forall_{i \in \mathbb{N}}~\left[\forall_{k \in K,\left(a_{1} \in V\right), \left(a_{2} \in V\right), \ldots, \left(a_{i} \in V\right)}~\left(\begin{array}{c} \begin{array}{l} \left(\left(k \cdot a_{1}\right) +  \left(k \cdot a_{2}\right) +  \ldots +  \left(k \cdot a_{i}\right)\right) =  \\ \left(k \cdot \left(a_{1} +  a_{2} +  \ldots +  a_{i}\right)\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: 21
operand: 2
1ExprTuple2
2Lambdaparameter: 44
body: 3
3Operationoperator: 21
operand: 5
4ExprTuple5
5Lambdaparameter: 53
body: 7
6ExprTuple53
7Conditionalvalue: 8
condition: 9
8Operationoperator: 21
operand: 13
9Operationoperator: 11
operands: 12
10ExprTuple13
11Literal
12ExprTuple53, 14
13Lambdaparameter: 58
body: 16
14Operationoperator: 17
operand: 44
15ExprTuple58
16Conditionalvalue: 19
condition: 20
17Literal
18ExprTuple44
19Operationoperator: 21
operand: 24
20Operationoperator: 49
operands: 23
21Literal
22ExprTuple24
23ExprTuple58, 25
24Lambdaparameters: 26
body: 27
25Literal
26ExprTuple59, 52
27Conditionalvalue: 28
condition: 29
28Operationoperator: 30
operands: 31
29Operationoperator: 32
operands: 33
30Literal
31ExprTuple34, 35
32Literal
33ExprTuple36, 37
34Operationoperator: 47
operands: 38
35Operationoperator: 54
operands: 39
36Operationoperator: 49
operands: 40
37ExprRangelambda_map: 41
start_index: 57
end_index: 58
38ExprTuple42
39ExprTuple59, 43
40ExprTuple59, 44
41Lambdaparameter: 63
body: 45
42ExprRangelambda_map: 46
start_index: 57
end_index: 58
43Operationoperator: 47
operands: 48
44Variable
45Operationoperator: 49
operands: 50
46Lambdaparameter: 63
body: 51
47Literal
48ExprTuple52
49Literal
50ExprTuple60, 53
51Operationoperator: 54
operands: 55
52ExprRangelambda_map: 56
start_index: 57
end_index: 58
53Variable
54Literal
55ExprTuple59, 60
56Lambdaparameter: 63
body: 60
57Literal
58Variable
59Variable
60IndexedVarvariable: 61
index: 63
61Variable
62ExprTuple63
63Variable