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.numbers.multiplication import distribute_through_abs_sum
In [2]:
# check that the built expression is the same as the stored expression
assert distribute_through_abs_sum.expr == stored_expr
assert distribute_through_abs_sum.expr._style_id == stored_expr._style_id
print("Passed sanity check: distribute_through_abs_sum matches stored_expr")
Passed sanity check: distribute_through_abs_sum matches stored_expr
In [3]:
# Show the LaTeX representation of the expression for convenience if you need it.
print(stored_expr.latex())
\forall_{i, j, k \in \mathbb{N}}~\left[\begin{array}{l}\forall_{a_{1}, a_{2}, \ldots, a_{i}, c_{1}, c_{2}, \ldots, c_{k} \in \mathbb{R}^{\ge 0}}~\\
\left[\begin{array}{l}\forall_{b_{1}, b_{2}, \ldots, b_{j} \in \mathbb{C}}~\\
\left(\begin{array}{c} \begin{array}{l} \left(a_{1} \cdot  a_{2} \cdot  \ldots \cdot  a_{i} \cdot \left|b_{1} +  b_{2} +  \ldots +  b_{j}\right|\cdot c_{1} \cdot  c_{2} \cdot  \ldots \cdot  c_{k}\right) =  \\ \left|\left(a_{1} \cdot  a_{2} \cdot  \ldots \cdot  a_{i} \cdot b_{1}\cdot c_{1} \cdot  c_{2} \cdot  \ldots \cdot  c_{k}\right) +  \left(a_{1} \cdot  a_{2} \cdot  \ldots \cdot  a_{i} \cdot b_{2}\cdot c_{1} \cdot  c_{2} \cdot  \ldots \cdot  c_{k}\right) +  \ldots +  \left(a_{1} \cdot  a_{2} \cdot  \ldots \cdot  a_{i} \cdot b_{j}\cdot c_{1} \cdot  c_{2} \cdot  \ldots \cdot  c_{k}\right)\right| \end{array} \end{array}\right)\end{array}\right]\end{array}\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
2Lambdaparameters: 3
body: 4
3ExprTuple72, 64, 77
4Conditionalvalue: 5
condition: 6
5Operationoperator: 21
operand: 9
6Operationoperator: 36
operands: 8
7ExprTuple9
8ExprTuple10, 11, 12
9Lambdaparameters: 13
body: 14
10Operationoperator: 53
operands: 15
11Operationoperator: 53
operands: 16
12Operationoperator: 53
operands: 17
13ExprTuple68, 70
14Conditionalvalue: 18
condition: 19
15ExprTuple72, 20
16ExprTuple64, 20
17ExprTuple77, 20
18Operationoperator: 21
operand: 24
19Operationoperator: 36
operands: 23
20Literal
21Literal
22ExprTuple24
23ExprTuple25, 26
24Lambdaparameters: 59
body: 27
25ExprRangelambda_map: 28
start_index: 76
end_index: 72
26ExprRangelambda_map: 29
start_index: 76
end_index: 77
27Conditionalvalue: 30
condition: 31
28Lambdaparameter: 84
body: 32
29Lambdaparameter: 84
body: 33
30Operationoperator: 34
operands: 35
31Operationoperator: 36
operands: 37
32Operationoperator: 53
operands: 38
33Operationoperator: 53
operands: 39
34Literal
35ExprTuple40, 41
36Literal
37ExprTuple42
38ExprTuple78, 43
39ExprTuple80, 43
40Operationoperator: 65
operands: 44
41Operationoperator: 50
operand: 48
42ExprRangelambda_map: 46
start_index: 76
end_index: 64
43Literal
44ExprTuple68, 47, 70
45ExprTuple48
46Lambdaparameter: 84
body: 49
47Operationoperator: 50
operand: 55
48Operationoperator: 58
operands: 52
49Operationoperator: 53
operands: 54
50Literal
51ExprTuple55
52ExprTuple56
53Literal
54ExprTuple67, 57
55Operationoperator: 58
operands: 59
56ExprRangelambda_map: 60
start_index: 76
end_index: 64
57Literal
58Literal
59ExprTuple61
60Lambdaparameter: 79
body: 62
61ExprRangelambda_map: 63
start_index: 76
end_index: 64
62Operationoperator: 65
operands: 66
63Lambdaparameter: 84
body: 67
64Variable
65Literal
66ExprTuple68, 69, 70
67IndexedVarvariable: 73
index: 84
68ExprRangelambda_map: 71
start_index: 76
end_index: 72
69IndexedVarvariable: 73
index: 79
70ExprRangelambda_map: 75
start_index: 76
end_index: 77
71Lambdaparameter: 84
body: 78
72Variable
73Variable
74ExprTuple79
75Lambdaparameter: 84
body: 80
76Literal
77Variable
78IndexedVarvariable: 81
index: 84
79Variable
80IndexedVarvariable: 82
index: 84
81Variable
82Variable
83ExprTuple84
84Variable