logo

Expression of type Lambda

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 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 Less, Mult, RealPos
In [2]:
# build up the expression from sub-expressions
expr = Lambda([x, y], Forall(instance_param_or_params = [a_1_to_i, b_1_to_j], instance_expr = Less(Mult(a_1_to_i, x, b_1_to_j), Mult(a_1_to_i, y, b_1_to_j)), domain = RealPos, condition = Less(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(x, y\right) \mapsto \left[\forall_{a_{1}, a_{2}, \ldots, a_{i}, b_{1}, b_{2}, \ldots, b_{j} \in \mathbb{R}^+~|~x < 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) < \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]
In [5]:
stored_expr.style_options()
no style options
In [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0Lambdaparameters: 23
body: 1
1Operationoperator: 2
operand: 4
2Literal
3ExprTuple4
4Lambdaparameters: 5
body: 6
5ExprTuple24, 25
6Conditionalvalue: 7
condition: 8
7Operationoperator: 22
operands: 9
8Operationoperator: 10
operands: 11
9ExprTuple12, 13
10Literal
11ExprTuple14, 15, 16
12Operationoperator: 18
operands: 17
13Operationoperator: 18
operands: 19
14ExprRangelambda_map: 20
start_index: 33
end_index: 31
15ExprRangelambda_map: 21
start_index: 33
end_index: 34
16Operationoperator: 22
operands: 23
17ExprTuple24, 28, 25
18Literal
19ExprTuple24, 29, 25
20Lambdaparameter: 44
body: 26
21Lambdaparameter: 44
body: 27
22Literal
23ExprTuple28, 29
24ExprRangelambda_map: 30
start_index: 33
end_index: 31
25ExprRangelambda_map: 32
start_index: 33
end_index: 34
26Operationoperator: 36
operands: 35
27Operationoperator: 36
operands: 37
28Variable
29Variable
30Lambdaparameter: 44
body: 38
31Variable
32Lambdaparameter: 44
body: 39
33Literal
34Variable
35ExprTuple38, 40
36Literal
37ExprTuple39, 40
38IndexedVarvariable: 41
index: 44
39IndexedVarvariable: 42
index: 44
40Literal
41Variable
42Variable
43ExprTuple44
44Variable