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, RealPos, greater, zero
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(Add(a_1_to_i, b, c_1_to_j), b), domain = Real), domain = RealPos), And(InSet(i, Natural), InSet(j, Natural), greater(Add(i, j), zero))))
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}^+}~\left[\forall_{b \in \mathbb{R}}~\left(\left(a_{1} +  a_{2} +  \ldots +  a_{i} + b+ c_{1} +  c_{2} +  \ldots +  c_{j}\right) > b\right)\right] \textrm{ if } i \in \mathbb{N} ,  j \in \mathbb{N} ,  \left(i + j\right) > 0\right..
In [5]:
stored_expr.style_options()
no style options
In [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0Lambdaparameters: 24
body: 1
1Conditionalvalue: 2
condition: 3
2Operationoperator: 20
operand: 6
3Operationoperator: 22
operands: 5
4ExprTuple6
5ExprTuple7, 8, 9
6Lambdaparameters: 10
body: 11
7Operationoperator: 40
operands: 12
8Operationoperator: 40
operands: 13
9Operationoperator: 36
operands: 14
10ExprTuple47, 49
11Conditionalvalue: 15
condition: 16
12ExprTuple51, 17
13ExprTuple54, 17
14ExprTuple18, 19
15Operationoperator: 20
operand: 25
16Operationoperator: 22
operands: 23
17Literal
18Literal
19Operationoperator: 45
operands: 24
20Literal
21ExprTuple25
22Literal
23ExprTuple26, 27
24ExprTuple51, 54
25Lambdaparameter: 48
body: 29
26ExprRangelambda_map: 30
start_index: 53
end_index: 51
27ExprRangelambda_map: 31
start_index: 53
end_index: 54
28ExprTuple48
29Conditionalvalue: 32
condition: 33
30Lambdaparameter: 60
body: 34
31Lambdaparameter: 60
body: 35
32Operationoperator: 36
operands: 37
33Operationoperator: 40
operands: 38
34Operationoperator: 40
operands: 39
35Operationoperator: 40
operands: 41
36Literal
37ExprTuple48, 42
38ExprTuple48, 43
39ExprTuple55, 44
40Literal
41ExprTuple56, 44
42Operationoperator: 45
operands: 46
43Literal
44Literal
45Literal
46ExprTuple47, 48, 49
47ExprRangelambda_map: 50
start_index: 53
end_index: 51
48Variable
49ExprRangelambda_map: 52
start_index: 53
end_index: 54
50Lambdaparameter: 60
body: 55
51Variable
52Lambdaparameter: 60
body: 56
53Literal
54Variable
55IndexedVarvariable: 57
index: 60
56IndexedVarvariable: 58
index: 60
57Variable
58Variable
59ExprTuple60
60Variable