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