# from the theory of proveit.numbers.summation¶

In [1]:
import proveit
# Automation is not needed when building an expression:
proveit.defaults.automation = False # This will speed things up.
proveit.defaults.inline_pngs = False # Makes files smaller.
# import Expression classes needed to build the expression
from proveit import Lambda, a, f, fa, fx, x
from proveit.logic import Equals, Forall
from proveit.numbers import Integer, Interval, Sum
In [2]:
# build up the expression from sub-expressions
expr = Lambda(f, Forall(instance_param_or_params = [a], instance_expr = Equals(Sum(index_or_indices = [x], summand = fx, domain = Interval(a, a)), fa), domain = Integer))
expr:
In [3]:
# check that the built expression is the same as the stored expression
assert expr == stored_expr
assert expr._style_id == stored_expr._style_id
print("Passed sanity check: expr matches stored_expr")
Passed sanity check: expr matches stored_expr
In [4]:
# Show the LaTeX representation of the expression for convenience if you need it.
print(stored_expr.latex())
f \mapsto \left[\forall_{a \in \mathbb{Z}}~\left(\left(\sum_{x = a}^{a} f\left(x\right)\right) = f\left(a\right)\right)\right]
In [5]:
stored_expr.style_options()
no style options
In [6]:
# display the expression information
stored_expr.expr_info()
core typesub-expressionsexpression
0Lambdaparameter: 22
body: 2
1ExprTuple22
2Operationoperator: 3
operand: 5
3Literal
4ExprTuple5
5Lambdaparameter: 30
body: 6
6Conditionalvalue: 7
condition: 8
7Operationoperator: 9
operands: 10
8Operationoperator: 24
operands: 11
9Literal
10ExprTuple12, 13
11ExprTuple30, 14
12Operationoperator: 15
operand: 18
13Operationoperator: 22
operand: 30
14Literal
15Literal
16ExprTuple18
17ExprTuple30
18Lambdaparameter: 26
body: 19
19Conditionalvalue: 20
condition: 21
20Operationoperator: 22
operand: 26
21Operationoperator: 24
operands: 25
22Variable
23ExprTuple26
24Literal
25ExprTuple26, 27
26Variable
27Operationoperator: 28
operands: 29
28Literal
29ExprTuple30, 30
30Variable