logo

Expression of type Lambda

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, 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, Natural, Real, RealNonNeg, greater_eq
In [2]:
# build up the expression from sub-expressions
expr = 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 = greater_eq(Add(a_1_to_i, b, c_1_to_j), b), domain = Real), domain = RealNonNeg), 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_{a_{1}, a_{2}, \ldots, a_{i}, c_{1}, c_{2}, \ldots, c_{j} \in \mathbb{R}^{\ge 0}}~\left[\forall_{b \in \mathbb{R}}~\left(\left(a_{1} +  a_{2} +  \ldots +  a_{i} + b+ c_{1} +  c_{2} +  \ldots +  c_{j}\right) \geq b\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
1ExprTuple47, 50
2Conditionalvalue: 3
condition: 4
3Operationoperator: 17
operand: 7
4Operationoperator: 19
operands: 6
5ExprTuple7
6ExprTuple8, 9
7Lambdaparameters: 10
body: 11
8Operationoperator: 36
operands: 12
9Operationoperator: 36
operands: 13
10ExprTuple43, 45
11Conditionalvalue: 14
condition: 15
12ExprTuple47, 16
13ExprTuple50, 16
14Operationoperator: 17
operand: 21
15Operationoperator: 19
operands: 20
16Literal
17Literal
18ExprTuple21
19Literal
20ExprTuple22, 23
21Lambdaparameter: 44
body: 25
22ExprRangelambda_map: 26
start_index: 49
end_index: 47
23ExprRangelambda_map: 27
start_index: 49
end_index: 50
24ExprTuple44
25Conditionalvalue: 28
condition: 29
26Lambdaparameter: 56
body: 30
27Lambdaparameter: 56
body: 31
28Operationoperator: 32
operands: 33
29Operationoperator: 36
operands: 34
30Operationoperator: 36
operands: 35
31Operationoperator: 36
operands: 37
32Literal
33ExprTuple44, 38
34ExprTuple44, 39
35ExprTuple51, 40
36Literal
37ExprTuple52, 40
38Operationoperator: 41
operands: 42
39Literal
40Literal
41Literal
42ExprTuple43, 44, 45
43ExprRangelambda_map: 46
start_index: 49
end_index: 47
44Variable
45ExprRangelambda_map: 48
start_index: 49
end_index: 50
46Lambdaparameter: 56
body: 51
47Variable
48Lambdaparameter: 56
body: 52
49Literal
50Variable
51IndexedVarvariable: 53
index: 56
52IndexedVarvariable: 54
index: 56
53Variable
54Variable
55ExprTuple56
56Variable