logo

Expression of type ExprTuple

from the theory of proveit.numbers.multiplication

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 ExprTuple, Lambda, x, y
from proveit.core_expr_types import a_1_to_i, b_1_to_j
from proveit.logic import Forall
from proveit.numbers import LessEq, Mult, RealNonNeg
In [2]:
# build up the expression from sub-expressions
expr = ExprTuple(Lambda([x, y], Forall(instance_param_or_params = [a_1_to_i, b_1_to_j], instance_expr = LessEq(Mult(a_1_to_i, x, b_1_to_j), Mult(a_1_to_i, y, b_1_to_j)), domain = RealNonNeg, condition = LessEq(x, y))))
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(x, y\right) \mapsto \left[\forall_{a_{1}, a_{2}, \ldots, a_{i}, b_{1}, b_{2}, \ldots, b_{j} \in \mathbb{R}^{\ge 0}~|~x \leq y}~\left(\left(a_{1} \cdot  a_{2} \cdot  \ldots \cdot  a_{i} \cdot x\cdot b_{1} \cdot  b_{2} \cdot  \ldots \cdot  b_{j}\right) \leq \left(a_{1} \cdot  a_{2} \cdot  \ldots \cdot  a_{i} \cdot y\cdot b_{1} \cdot  b_{2} \cdot  \ldots \cdot  b_{j}\right)\right)\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: 24
body: 2
2Operationoperator: 3
operand: 5
3Literal
4ExprTuple5
5Lambdaparameters: 6
body: 7
6ExprTuple25, 26
7Conditionalvalue: 8
condition: 9
8Operationoperator: 23
operands: 10
9Operationoperator: 11
operands: 12
10ExprTuple13, 14
11Literal
12ExprTuple15, 16, 17
13Operationoperator: 19
operands: 18
14Operationoperator: 19
operands: 20
15ExprRangelambda_map: 21
start_index: 34
end_index: 32
16ExprRangelambda_map: 22
start_index: 34
end_index: 35
17Operationoperator: 23
operands: 24
18ExprTuple25, 29, 26
19Literal
20ExprTuple25, 30, 26
21Lambdaparameter: 45
body: 27
22Lambdaparameter: 45
body: 28
23Literal
24ExprTuple29, 30
25ExprRangelambda_map: 31
start_index: 34
end_index: 32
26ExprRangelambda_map: 33
start_index: 34
end_index: 35
27Operationoperator: 37
operands: 36
28Operationoperator: 37
operands: 38
29Variable
30Variable
31Lambdaparameter: 45
body: 39
32Variable
33Lambdaparameter: 45
body: 40
34Literal
35Variable
36ExprTuple39, 41
37Literal
38ExprTuple40, 41
39IndexedVarvariable: 42
index: 45
40IndexedVarvariable: 43
index: 45
41Literal
42Variable
43Variable
44ExprTuple45
45Variable