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.summation import distributive_summation
In [2]:
# check that the built expression is the same as the stored expression
assert distributive_summation.expr == stored_expr
assert distributive_summation.expr._style_id == stored_expr._style_id
print("Passed sanity check: distributive_summation matches stored_expr")
Passed sanity check: distributive_summation matches stored_expr
In [3]:
# Show the LaTeX representation of the expression for convenience if you need it.
print(stored_expr.latex())
\forall_{f}~\left[\forall_{x \in \mathbb{C}}~\left[\forall_{j, k \in \mathbb{Z}}~\left(\left(\sum_{i = j}^{k} \left(x \cdot f\left(i\right)\right)\right) = \left(x \cdot \left(\sum_{i = j}^{k} f\left(i\right)\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: 11
operand: 2
1ExprTuple2
2Lambdaparameter: 45
body: 4
3ExprTuple45
4Operationoperator: 11
operand: 6
5ExprTuple6
6Lambdaparameter: 42
body: 8
7ExprTuple42
8Conditionalvalue: 9
condition: 10
9Operationoperator: 11
operand: 14
10Operationoperator: 47
operands: 13
11Literal
12ExprTuple14
13ExprTuple42, 15
14Lambdaparameters: 52
body: 16
15Literal
16Conditionalvalue: 17
condition: 18
17Operationoperator: 19
operands: 20
18Operationoperator: 21
operands: 22
19Literal
20ExprTuple23, 24
21Literal
22ExprTuple25, 26
23Operationoperator: 35
operand: 31
24Operationoperator: 39
operands: 28
25Operationoperator: 47
operands: 29
26Operationoperator: 47
operands: 30
27ExprTuple31
28ExprTuple42, 32
29ExprTuple53, 33
30ExprTuple54, 33
31Lambdaparameter: 49
body: 34
32Operationoperator: 35
operand: 38
33Literal
34Conditionalvalue: 37
condition: 44
35Literal
36ExprTuple38
37Operationoperator: 39
operands: 40
38Lambdaparameter: 49
body: 41
39Literal
40ExprTuple42, 43
41Conditionalvalue: 43
condition: 44
42Variable
43Operationoperator: 45
operand: 49
44Operationoperator: 47
operands: 48
45Variable
46ExprTuple49
47Literal
48ExprTuple49, 50
49Variable
50Operationoperator: 51
operands: 52
51Literal
52ExprTuple53, 54
53Variable
54Variable