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 Conditional, 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 LessEq, Mult, Natural, RealNonNeg
In [2]:
# build up the expression from sub-expressions
expr = 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(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))), 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(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}^{\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] \textrm{ if } i \in \mathbb{N} ,  j \in \mathbb{N}\right..
In [5]:
stored_expr.style_options()
no style options
In [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0Lambdaparameters: 1
body: 2
1ExprTuple43, 46
2Conditionalvalue: 3
condition: 4
3Operationoperator: 13
operand: 7
4Operationoperator: 22
operands: 6
5ExprTuple7
6ExprTuple8, 9
7Lambdaparameters: 35
body: 10
8Operationoperator: 48
operands: 11
9Operationoperator: 48
operands: 12
10Operationoperator: 13
operand: 16
11ExprTuple43, 15
12ExprTuple46, 15
13Literal
14ExprTuple16
15Literal
16Lambdaparameters: 17
body: 18
17ExprTuple36, 37
18Conditionalvalue: 19
condition: 20
19Operationoperator: 34
operands: 21
20Operationoperator: 22
operands: 23
21ExprTuple24, 25
22Literal
23ExprTuple26, 27, 28
24Operationoperator: 30
operands: 29
25Operationoperator: 30
operands: 31
26ExprRangelambda_map: 32
start_index: 45
end_index: 43
27ExprRangelambda_map: 33
start_index: 45
end_index: 46
28Operationoperator: 34
operands: 35
29ExprTuple36, 40, 37
30Literal
31ExprTuple36, 41, 37
32Lambdaparameter: 56
body: 38
33Lambdaparameter: 56
body: 39
34Literal
35ExprTuple40, 41
36ExprRangelambda_map: 42
start_index: 45
end_index: 43
37ExprRangelambda_map: 44
start_index: 45
end_index: 46
38Operationoperator: 48
operands: 47
39Operationoperator: 48
operands: 49
40Variable
41Variable
42Lambdaparameter: 56
body: 50
43Variable
44Lambdaparameter: 56
body: 51
45Literal
46Variable
47ExprTuple50, 52
48Literal
49ExprTuple51, 52
50IndexedVarvariable: 53
index: 56
51IndexedVarvariable: 54
index: 56
52Literal
53Variable
54Variable
55ExprTuple56
56Variable