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, Lambda, c, d, f, fj, g, gj, j, x
from proveit.logic import Equals, Forall
from proveit.numbers import Complex, Integer, Interval, Mult, Sum
In [2]:
# build up the expression from sub-expressions
sub_expr1 = [j]
sub_expr2 = Interval(c, d)
expr = ExprTuple(Lambda([f, g], Forall(instance_param_or_params = [x], instance_expr = Forall(instance_param_or_params = [c, d], instance_expr = Equals(Sum(index_or_indices = sub_expr1, summand = Mult(Mult(x, gj), fj), domain = sub_expr2), Mult(x, Sum(index_or_indices = sub_expr1, summand = Mult(gj, fj), domain = sub_expr2))), domain = Integer), domain = Complex)))
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(\left(f, g\right) \mapsto \left[\forall_{x \in \mathbb{C}}~\left[\forall_{c, d \in \mathbb{Z}}~\left(\left(\sum_{j = c}^{d} \left(\left(x \cdot g\left(j\right)\right) \cdot f\left(j\right)\right)\right) = \left(x \cdot \left(\sum_{j = c}^{d} \left(g\left(j\right) \cdot f\left(j\right)\right)\right)\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
1Lambdaparameters: 2
body: 3
2ExprTuple53, 52
3Operationoperator: 10
operand: 5
4ExprTuple5
5Lambdaparameter: 48
body: 7
6ExprTuple48
7Conditionalvalue: 8
condition: 9
8Operationoperator: 10
operand: 13
9Operationoperator: 46
operands: 12
10Literal
11ExprTuple13
12ExprTuple48, 14
13Lambdaparameters: 56
body: 15
14Literal
15Conditionalvalue: 16
condition: 17
16Operationoperator: 18
operands: 19
17Operationoperator: 20
operands: 21
18Literal
19ExprTuple22, 23
20Literal
21ExprTuple24, 25
22Operationoperator: 34
operand: 30
23Operationoperator: 44
operands: 27
24Operationoperator: 46
operands: 28
25Operationoperator: 46
operands: 29
26ExprTuple30
27ExprTuple48, 31
28ExprTuple58, 32
29ExprTuple59, 32
30Lambdaparameter: 57
body: 33
31Operationoperator: 34
operand: 37
32Literal
33Conditionalvalue: 36
condition: 42
34Literal
35ExprTuple37
36Operationoperator: 44
operands: 38
37Lambdaparameter: 57
body: 39
38ExprTuple40, 50
39Conditionalvalue: 41
condition: 42
40Operationoperator: 44
operands: 43
41Operationoperator: 44
operands: 45
42Operationoperator: 46
operands: 47
43ExprTuple48, 49
44Literal
45ExprTuple49, 50
46Literal
47ExprTuple57, 51
48Variable
49Operationoperator: 52
operand: 57
50Operationoperator: 53
operand: 57
51Operationoperator: 55
operands: 56
52Variable
53Variable
54ExprTuple57
55Literal
56ExprTuple58, 59
57Variable
58Variable
59Variable