logo

Expression of type ExprTuple

from the theory of proveit.numbers.addition.subtraction

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, b, d, i, j, k
from proveit.core_expr_types import a_1_to_i, c_1_to_j, e_1_to_k
from proveit.logic import And, Equals, Forall, InSet
from proveit.numbers import Add, Complex, Natural, Neg
In [2]:
# build up the expression from sub-expressions
expr = ExprTuple(Lambda([i, j, k], Conditional(Forall(instance_param_or_params = [a_1_to_i, b, c_1_to_j, d, e_1_to_k], instance_expr = Equals(Add(a_1_to_i, Neg(b), c_1_to_j, d, e_1_to_k), Add(a_1_to_i, c_1_to_j, e_1_to_k)), domain = Complex), And(InSet(i, Natural), InSet(j, Natural), InSet(k, 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, k\right) \mapsto \left\{\forall_{a_{1}, a_{2}, \ldots, a_{i}, b, c_{1}, c_{2}, \ldots, c_{j}, d, e_{1}, e_{2}, \ldots, e_{k} \in \mathbb{C}}~\left(\left(a_{1} +  a_{2} +  \ldots +  a_{i} - b+ c_{1} +  c_{2} +  \ldots +  c_{j} + d+ e_{1} +  e_{2} +  \ldots +  e_{k}\right) = \left(a_{1} +  a_{2} +  \ldots +  a_{i}+ c_{1} +  c_{2} +  \ldots +  c_{j}+ e_{1} +  e_{2} +  \ldots +  e_{k}\right)\right) \textrm{ if } i \in \mathbb{N} ,  j \in \mathbb{N} ,  k \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
2ExprTuple51, 53, 56
3Conditionalvalue: 4
condition: 5
4Operationoperator: 6
operand: 9
5Operationoperator: 23
operands: 8
6Literal
7ExprTuple9
8ExprTuple10, 11, 12
9Lambdaparameters: 13
body: 14
10Operationoperator: 59
operands: 15
11Operationoperator: 59
operands: 16
12Operationoperator: 59
operands: 17
13ExprTuple41, 61, 42, 46, 43
14Conditionalvalue: 18
condition: 19
15ExprTuple51, 20
16ExprTuple53, 20
17ExprTuple56, 20
18Operationoperator: 21
operands: 22
19Operationoperator: 23
operands: 24
20Literal
21Literal
22ExprTuple25, 26
23Literal
24ExprTuple27, 28, 29, 30, 31
25Operationoperator: 33
operands: 32
26Operationoperator: 33
operands: 34
27ExprRangelambda_map: 35
start_index: 55
end_index: 51
28Operationoperator: 59
operands: 36
29ExprRangelambda_map: 37
start_index: 55
end_index: 53
30Operationoperator: 59
operands: 38
31ExprRangelambda_map: 39
start_index: 55
end_index: 56
32ExprTuple41, 40, 42, 46, 43
33Literal
34ExprTuple41, 42, 43
35Lambdaparameter: 70
body: 44
36ExprTuple61, 65
37Lambdaparameter: 70
body: 45
38ExprTuple46, 65
39Lambdaparameter: 70
body: 47
40Operationoperator: 48
operand: 61
41ExprRangelambda_map: 50
start_index: 55
end_index: 51
42ExprRangelambda_map: 52
start_index: 55
end_index: 53
43ExprRangelambda_map: 54
start_index: 55
end_index: 56
44Operationoperator: 59
operands: 57
45Operationoperator: 59
operands: 58
46Variable
47Operationoperator: 59
operands: 60
48Literal
49ExprTuple61
50Lambdaparameter: 70
body: 62
51Variable
52Lambdaparameter: 70
body: 63
53Variable
54Lambdaparameter: 70
body: 64
55Literal
56Variable
57ExprTuple62, 65
58ExprTuple63, 65
59Literal
60ExprTuple64, 65
61Variable
62IndexedVarvariable: 66
index: 70
63IndexedVarvariable: 67
index: 70
64IndexedVarvariable: 68
index: 70
65Literal
66Variable
67Variable
68Variable
69ExprTuple70
70Variable