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