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, S, n
from proveit.core_expr_types import a_1_to_n
from proveit.logic import Forall, InSet, SubsetEq
from proveit.numbers import Max, NaturalPos, Real
In [2]:
# build up the expression from sub-expressions
expr = Lambda(S, Conditional(Forall(instance_param_or_params = [n], instance_expr = Forall(instance_param_or_params = [a_1_to_n], instance_expr = InSet(Max(a_1_to_n), S), domain = S), domain = NaturalPos), SubsetEq(S, Real)))
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())
S \mapsto \left\{\forall_{n \in \mathbb{N}^+}~\left[\forall_{a_{1}, a_{2}, \ldots, a_{n} \in S}~\left({\rm Max}\left(a_{1}, a_{2}, \ldots, a_{n}\right) \in S\right)\right] \textrm{ if } S \subseteq \mathbb{R}\right..
In [5]:
stored_expr.style_options()
no style options
In [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0Lambdaparameter: 38
body: 2
1ExprTuple38
2Conditionalvalue: 3
condition: 4
3Operationoperator: 14
operand: 8
4Operationoperator: 6
operands: 7
5ExprTuple8
6Literal
7ExprTuple38, 9
8Lambdaparameter: 34
body: 11
9Literal
10ExprTuple34
11Conditionalvalue: 12
condition: 13
12Operationoperator: 14
operand: 17
13Operationoperator: 35
operands: 16
14Literal
15ExprTuple17
16ExprTuple34, 18
17Lambdaparameters: 28
body: 19
18Literal
19Conditionalvalue: 20
condition: 21
20Operationoperator: 35
operands: 22
21Operationoperator: 23
operands: 24
22ExprTuple25, 38
23Literal
24ExprTuple26
25Operationoperator: 27
operands: 28
26ExprRangelambda_map: 29
start_index: 33
end_index: 34
27Literal
28ExprTuple30
29Lambdaparameter: 41
body: 31
30ExprRangelambda_map: 32
start_index: 33
end_index: 34
31Operationoperator: 35
operands: 36
32Lambdaparameter: 41
body: 37
33Literal
34Variable
35Literal
36ExprTuple37, 38
37IndexedVarvariable: 39
index: 41
38Variable
39Variable
40ExprTuple41
41Variable