logo

Expression of type Lambda

from the theory of proveit.numbers.ordering

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, m
from proveit.core_expr_types import a_1_to_m
from proveit.logic import Equals, Forall, InSet
from proveit.numbers import Min, NaturalPos, Real
In [2]:
# build up the expression from sub-expressions
expr = Lambda(m, Conditional(Forall(instance_param_or_params = [a_1_to_m, b], instance_expr = Equals(Min(a_1_to_m, b), Min(Min(a_1_to_m), b)), domain = Real), InSet(m, NaturalPos)))
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())
m \mapsto \left\{\forall_{a_{1}, a_{2}, \ldots, a_{m}, b \in \mathbb{R}}~\left({\rm Min}\left(a_{1}, a_{2}, \ldots, a_{m}, b\right) = {\rm Min}\left({\rm Min}\left(a_{1}, a_{2}, \ldots, a_{m}\right), b\right)\right) \textrm{ if } m \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
0Lambdaparameter: 36
body: 2
1ExprTuple36
2Conditionalvalue: 3
condition: 4
3Operationoperator: 5
operand: 8
4Operationoperator: 30
operands: 7
5Literal
6ExprTuple8
7ExprTuple36, 9
8Lambdaparameters: 21
body: 10
9Literal
10Conditionalvalue: 11
condition: 12
11Operationoperator: 13
operands: 14
12Operationoperator: 15
operands: 16
13Literal
14ExprTuple17, 18
15Literal
16ExprTuple19, 20
17Operationoperator: 28
operands: 21
18Operationoperator: 28
operands: 22
19ExprRangelambda_map: 23
start_index: 35
end_index: 36
20Operationoperator: 30
operands: 24
21ExprTuple32, 27
22ExprTuple25, 27
23Lambdaparameter: 40
body: 26
24ExprTuple27, 33
25Operationoperator: 28
operands: 29
26Operationoperator: 30
operands: 31
27Variable
28Literal
29ExprTuple32
30Literal
31ExprTuple37, 33
32ExprRangelambda_map: 34
start_index: 35
end_index: 36
33Literal
34Lambdaparameter: 40
body: 37
35Literal
36Variable
37IndexedVarvariable: 38
index: 40
38Variable
39ExprTuple40
40Variable