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, b, i, j
from proveit.core_expr_types import a_1_to_i, c_1_to_j
from proveit.logic import And, Forall, InSet
from proveit.numbers import Add, Less, Natural, Real, RealNeg
In [2]:
# build up the expression from sub-expressions
expr = ExprTuple(Lambda([i, j], Conditional(Forall(instance_param_or_params = [a_1_to_i, c_1_to_j], instance_expr = Forall(instance_param_or_params = [b], instance_expr = Less(Add(a_1_to_i, b, c_1_to_j), b), domain = Real), domain = RealNeg), 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}, c_{1}, c_{2}, \ldots, c_{j} \in \mathbb{R}^-}~\left[\forall_{b \in \mathbb{R}}~\left(\left(a_{1} +  a_{2} +  \ldots +  a_{i} + b+ c_{1} +  c_{2} +  \ldots +  c_{j}\right) < b\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
2ExprTuple48, 51
3Conditionalvalue: 4
condition: 5
4Operationoperator: 18
operand: 8
5Operationoperator: 20
operands: 7
6ExprTuple8
7ExprTuple9, 10
8Lambdaparameters: 11
body: 12
9Operationoperator: 37
operands: 13
10Operationoperator: 37
operands: 14
11ExprTuple44, 46
12Conditionalvalue: 15
condition: 16
13ExprTuple48, 17
14ExprTuple51, 17
15Operationoperator: 18
operand: 22
16Operationoperator: 20
operands: 21
17Literal
18Literal
19ExprTuple22
20Literal
21ExprTuple23, 24
22Lambdaparameter: 45
body: 26
23ExprRangelambda_map: 27
start_index: 50
end_index: 48
24ExprRangelambda_map: 28
start_index: 50
end_index: 51
25ExprTuple45
26Conditionalvalue: 29
condition: 30
27Lambdaparameter: 57
body: 31
28Lambdaparameter: 57
body: 32
29Operationoperator: 33
operands: 34
30Operationoperator: 37
operands: 35
31Operationoperator: 37
operands: 36
32Operationoperator: 37
operands: 38
33Literal
34ExprTuple39, 45
35ExprTuple45, 40
36ExprTuple52, 41
37Literal
38ExprTuple53, 41
39Operationoperator: 42
operands: 43
40Literal
41Literal
42Literal
43ExprTuple44, 45, 46
44ExprRangelambda_map: 47
start_index: 50
end_index: 48
45Variable
46ExprRangelambda_map: 49
start_index: 50
end_index: 51
47Lambdaparameter: 57
body: 52
48Variable
49Lambdaparameter: 57
body: 53
50Literal
51Variable
52IndexedVarvariable: 54
index: 57
53IndexedVarvariable: 55
index: 57
54Variable
55Variable
56ExprTuple57
57Variable