logo

Expression of type ExprTuple

from the theory of proveit.numbers.addition

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 Conditional, ExprTuple, Lambda, i, j
from proveit.core_expr_types import a_1_to_i, b_1_to_j
from proveit.logic import And, Equals, Forall, InSet
from proveit.numbers import Add, Complex, Natural, zero
In [2]:
# build up the expression from sub-expressions
expr = ExprTuple(Lambda([i, j], Conditional(Forall(instance_param_or_params = [a_1_to_i, b_1_to_j], instance_expr = Equals(Add(a_1_to_i, zero, b_1_to_j), Add(a_1_to_i, b_1_to_j)), domain = Complex), And(InSet(i, Natural), InSet(j, Natural)))))
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(i, j\right) \mapsto \left\{\forall_{a_{1}, a_{2}, \ldots, a_{i}, b_{1}, b_{2}, \ldots, b_{j} \in \mathbb{C}}~\left(\left(a_{1} +  a_{2} +  \ldots +  a_{i} + 0+ b_{1} +  b_{2} +  \ldots +  b_{j}\right) = \left(a_{1} +  a_{2} +  \ldots +  a_{i}+ b_{1} +  b_{2} +  \ldots +  b_{j}\right)\right) \textrm{ if } i \in \mathbb{N} ,  j \in \mathbb{N}\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
2ExprTuple37, 40
3Conditionalvalue: 4
condition: 5
4Operationoperator: 6
operand: 9
5Operationoperator: 20
operands: 8
6Literal
7ExprTuple9
8ExprTuple10, 11
9Lambdaparameters: 28
body: 12
10Operationoperator: 42
operands: 13
11Operationoperator: 42
operands: 14
12Conditionalvalue: 15
condition: 16
13ExprTuple37, 17
14ExprTuple40, 17
15Operationoperator: 18
operands: 19
16Operationoperator: 20
operands: 21
17Literal
18Literal
19ExprTuple22, 23
20Literal
21ExprTuple24, 25
22Operationoperator: 27
operands: 26
23Operationoperator: 27
operands: 28
24ExprRangelambda_map: 29
start_index: 39
end_index: 37
25ExprRangelambda_map: 30
start_index: 39
end_index: 40
26ExprTuple32, 31, 33
27Literal
28ExprTuple32, 33
29Lambdaparameter: 50
body: 34
30Lambdaparameter: 50
body: 35
31Literal
32ExprRangelambda_map: 36
start_index: 39
end_index: 37
33ExprRangelambda_map: 38
start_index: 39
end_index: 40
34Operationoperator: 42
operands: 41
35Operationoperator: 42
operands: 43
36Lambdaparameter: 50
body: 44
37Variable
38Lambdaparameter: 50
body: 45
39Literal
40Variable
41ExprTuple44, 46
42Literal
43ExprTuple45, 46
44IndexedVarvariable: 47
index: 50
45IndexedVarvariable: 48
index: 50
46Literal
47Variable
48Variable
49ExprTuple50
50Variable