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