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_sum
In [2]:
# check that the built expression is the same as the stored expression
assert distribute_through_sum.expr == stored_expr
assert distribute_through_sum.expr._style_id == stored_expr._style_id
print("Passed sanity check: distribute_through_sum matches stored_expr")
Passed sanity check: distribute_through_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}, b_{1}, b_{2}, \ldots, b_{j}, c_{1}, c_{2}, \ldots, c_{k} \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]
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: 7
operand: 2
1ExprTuple2
2Lambdaparameters: 3
body: 4
3ExprTuple60, 52, 65
4Conditionalvalue: 5
condition: 6
5Operationoperator: 7
operand: 10
6Operationoperator: 24
operands: 9
7Literal
8ExprTuple10
9ExprTuple11, 12, 13
10Lambdaparameters: 14
body: 15
11Operationoperator: 46
operands: 16
12Operationoperator: 46
operands: 17
13Operationoperator: 46
operands: 18
14ExprTuple56, 48, 58
15Conditionalvalue: 19
condition: 20
16ExprTuple60, 21
17ExprTuple52, 21
18ExprTuple65, 21
19Operationoperator: 22
operands: 23
20Operationoperator: 24
operands: 25
21Literal
22Literal
23ExprTuple26, 27
24Literal
25ExprTuple28, 29, 30
26Operationoperator: 53
operands: 31
27Operationoperator: 41
operands: 32
28ExprRangelambda_map: 33
start_index: 64
end_index: 60
29ExprRangelambda_map: 34
start_index: 64
end_index: 52
30ExprRangelambda_map: 35
start_index: 64
end_index: 65
31ExprTuple56, 36, 58
32ExprTuple37
33Lambdaparameter: 72
body: 38
34Lambdaparameter: 72
body: 39
35Lambdaparameter: 72
body: 40
36Operationoperator: 41
operands: 42
37ExprRangelambda_map: 43
start_index: 64
end_index: 52
38Operationoperator: 46
operands: 44
39Operationoperator: 46
operands: 45
40Operationoperator: 46
operands: 47
41Literal
42ExprTuple48
43Lambdaparameter: 67
body: 49
44ExprTuple66, 50
45ExprTuple55, 50
46Literal
47ExprTuple68, 50
48ExprRangelambda_map: 51
start_index: 64
end_index: 52
49Operationoperator: 53
operands: 54
50Literal
51Lambdaparameter: 72
body: 55
52Variable
53Literal
54ExprTuple56, 57, 58
55IndexedVarvariable: 61
index: 72
56ExprRangelambda_map: 59
start_index: 64
end_index: 60
57IndexedVarvariable: 61
index: 67
58ExprRangelambda_map: 63
start_index: 64
end_index: 65
59Lambdaparameter: 72
body: 66
60Variable
61Variable
62ExprTuple67
63Lambdaparameter: 72
body: 68
64Literal
65Variable
66IndexedVarvariable: 69
index: 72
67Variable
68IndexedVarvariable: 70
index: 72
69Variable
70Variable
71ExprTuple72
72Variable