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, b, c_1_to_j, Neg(d), e_1_to_k), Add(a_1_to_i, c_1_to_j, e_1_to_k)), domain = Complex, condition = Equals(b, d)), 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}~|~b = d}~\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
2ExprTuple53, 55, 58
3Conditionalvalue: 4
condition: 5
4Operationoperator: 6
operand: 9
5Operationoperator: 22
operands: 8
6Literal
7ExprTuple9
8ExprTuple10, 11, 12
9Lambdaparameters: 13
body: 14
10Operationoperator: 61
operands: 15
11Operationoperator: 61
operands: 16
12Operationoperator: 61
operands: 17
13ExprTuple43, 49, 44, 63, 45
14Conditionalvalue: 18
condition: 19
15ExprTuple53, 20
16ExprTuple55, 20
17ExprTuple58, 20
18Operationoperator: 40
operands: 21
19Operationoperator: 22
operands: 23
20Literal
21ExprTuple24, 25
22Literal
23ExprTuple26, 27, 28, 29, 30, 31
24Operationoperator: 33
operands: 32
25Operationoperator: 33
operands: 34
26ExprRangelambda_map: 35
start_index: 57
end_index: 53
27Operationoperator: 61
operands: 36
28ExprRangelambda_map: 37
start_index: 57
end_index: 55
29Operationoperator: 61
operands: 38
30ExprRangelambda_map: 39
start_index: 57
end_index: 58
31Operationoperator: 40
operands: 41
32ExprTuple43, 49, 44, 42, 45
33Literal
34ExprTuple43, 44, 45
35Lambdaparameter: 72
body: 46
36ExprTuple49, 67
37Lambdaparameter: 72
body: 47
38ExprTuple63, 67
39Lambdaparameter: 72
body: 48
40Literal
41ExprTuple49, 63
42Operationoperator: 50
operand: 63
43ExprRangelambda_map: 52
start_index: 57
end_index: 53
44ExprRangelambda_map: 54
start_index: 57
end_index: 55
45ExprRangelambda_map: 56
start_index: 57
end_index: 58
46Operationoperator: 61
operands: 59
47Operationoperator: 61
operands: 60
48Operationoperator: 61
operands: 62
49Variable
50Literal
51ExprTuple63
52Lambdaparameter: 72
body: 64
53Variable
54Lambdaparameter: 72
body: 65
55Variable
56Lambdaparameter: 72
body: 66
57Literal
58Variable
59ExprTuple64, 67
60ExprTuple65, 67
61Literal
62ExprTuple66, 67
63Variable
64IndexedVarvariable: 68
index: 72
65IndexedVarvariable: 69
index: 72
66IndexedVarvariable: 70
index: 72
67Literal
68Variable
69Variable
70Variable
71ExprTuple72
72Variable