logo

Expression of type ExprTuple

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.
%load_expr # Load the stored expression as 'stored_expr'
# import Expression classes needed to build the expression
from proveit import ExprTuple, Function, Lambda, a, b, f, fx, x
from proveit.logic import Equals, Forall
from proveit.numbers import Integer, Interval, Neg, Sum
In [2]:
# build up the expression from sub-expressions
sub_expr1 = [x]
expr = ExprTuple(Lambda(f, Forall(instance_param_or_params = [a, b], instance_expr = Equals(Sum(index_or_indices = sub_expr1, summand = fx, domain = Interval(a, b)), Sum(index_or_indices = sub_expr1, summand = Function(f, [Neg(x)]), domain = Interval(Neg(b), Neg(a)))), 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())
\left(f \mapsto \left[\forall_{a, b \in \mathbb{Z}}~\left(\left(\sum_{x = a}^{b} f\left(x\right)\right) = \left(\sum_{x = -b}^{-a} f\left(-x\right)\right)\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
0ExprTuple1
1Lambdaparameter: 33
body: 3
2ExprTuple33
3Operationoperator: 4
operand: 6
4Literal
5ExprTuple6
6Lambdaparameters: 40
body: 7
7Conditionalvalue: 8
condition: 9
8Operationoperator: 10
operands: 11
9Operationoperator: 12
operands: 13
10Literal
11ExprTuple14, 15
12Literal
13ExprTuple16, 17
14Operationoperator: 19
operand: 23
15Operationoperator: 19
operand: 24
16Operationoperator: 35
operands: 21
17Operationoperator: 35
operands: 22
18ExprTuple23
19Literal
20ExprTuple24
21ExprTuple51, 25
22ExprTuple50, 25
23Lambdaparameter: 44
body: 26
24Lambdaparameter: 44
body: 27
25Literal
26Conditionalvalue: 28
condition: 29
27Conditionalvalue: 30
condition: 31
28Operationoperator: 33
operand: 44
29Operationoperator: 35
operands: 32
30Operationoperator: 33
operand: 38
31Operationoperator: 35
operands: 36
32ExprTuple44, 37
33Variable
34ExprTuple38
35Literal
36ExprTuple44, 39
37Operationoperator: 42
operands: 40
38Operationoperator: 48
operand: 44
39Operationoperator: 42
operands: 43
40ExprTuple51, 50
41ExprTuple44
42Literal
43ExprTuple45, 46
44Variable
45Operationoperator: 48
operand: 50
46Operationoperator: 48
operand: 51
47ExprTuple50
48Literal
49ExprTuple51
50Variable
51Variable