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.addition import vec_sum_split_before
In [2]:
# check that the built expression is the same as the stored expression
assert vec_sum_split_before.expr == stored_expr
assert vec_sum_split_before.expr._style_id == stored_expr._style_id
print("Passed sanity check: vec_sum_split_before matches stored_expr")
Passed sanity check: vec_sum_split_before matches stored_expr
In [3]:
# Show the LaTeX representation of the expression for convenience if you need it.
print(stored_expr.latex())
\forall_{v}~\left[\forall_{a, b, c \in \mathbb{Z}~|~a < b, b \leq c}~\left(\left(\sum_{i=a}^{c} v\left(i\right)\right) = \left(\left(\sum_{i=a}^{b - 1} v\left(i\right)\right) + \left(\sum_{i=b}^{c} v\left(i\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: 5
operand: 2
1ExprTuple2
2Lambdaparameter: 52
body: 4
3ExprTuple52
4Operationoperator: 5
operand: 7
5Literal
6ExprTuple7
7Lambdaparameters: 8
body: 9
8ExprTuple62, 67, 64
9Conditionalvalue: 10
condition: 11
10Operationoperator: 12
operands: 13
11Operationoperator: 14
operands: 15
12Literal
13ExprTuple16, 17
14Literal
15ExprTuple18, 19, 20, 21, 22
16Operationoperator: 38
operand: 32
17Operationoperator: 24
operands: 25
18Operationoperator: 54
operands: 26
19Operationoperator: 54
operands: 27
20Operationoperator: 54
operands: 28
21Operationoperator: 29
operands: 30
22Operationoperator: 31
operands: 61
23ExprTuple32
24Literal
25ExprTuple33, 34
26ExprTuple62, 35
27ExprTuple67, 35
28ExprTuple64, 35
29Literal
30ExprTuple62, 67
31Literal
32Lambdaparameter: 57
body: 36
33Operationoperator: 38
operand: 41
34Operationoperator: 38
operand: 42
35Literal
36Conditionalvalue: 48
condition: 40
37ExprTuple41
38Literal
39ExprTuple42
40Operationoperator: 54
operands: 43
41Lambdaparameter: 57
body: 44
42Lambdaparameter: 57
body: 45
43ExprTuple57, 46
44Conditionalvalue: 48
condition: 47
45Conditionalvalue: 48
condition: 49
46Operationoperator: 60
operands: 50
47Operationoperator: 54
operands: 51
48Operationoperator: 52
operand: 57
49Operationoperator: 54
operands: 55
50ExprTuple62, 64
51ExprTuple57, 56
52Variable
53ExprTuple57
54Literal
55ExprTuple57, 58
56Operationoperator: 60
operands: 59
57Variable
58Operationoperator: 60
operands: 61
59ExprTuple62, 63
60Literal
61ExprTuple67, 64
62Variable
63Operationoperator: 65
operands: 66
64Variable
65Literal
66ExprTuple67, 68
67Variable
68Operationoperator: 69
operand: 71
69Literal
70ExprTuple71
71Literal