logo

Expression of type Lambda

from the theory of proveit.numbers.number_sets.real_numbers

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, a, b, x
from proveit.logic import And, Equals, Forall, InSet
from proveit.numbers import IntervalCO, Less, LessEq, Real
In [2]:
# build up the expression from sub-expressions
expr = Lambda([a, b], Conditional(Forall(instance_param_or_params = [x], instance_expr = Equals(InSet(x, IntervalCO(a, b)), And(InSet(x, Real), And(LessEq(a, x), Less(x, b)).with_total_ordering_style()))), And(InSet(a, Real), InSet(b, 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())
\left(a, b\right) \mapsto \left\{\forall_{x}~\left(\left(x \in \left[a,b\right)\right) = \left(\left(x \in \mathbb{R}\right) \land \left(a \leq x < b\right)\right)\right) \textrm{ if } a \in \mathbb{R} ,  b \in \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
0Lambdaparameters: 24
body: 1
1Conditionalvalue: 2
condition: 3
2Operationoperator: 4
operand: 7
3Operationoperator: 27
operands: 6
4Literal
5ExprTuple7
6ExprTuple8, 9
7Lambdaparameter: 37
body: 11
8Operationoperator: 25
operands: 12
9Operationoperator: 25
operands: 13
10ExprTuple37
11Operationoperator: 14
operands: 15
12ExprTuple36, 29
13ExprTuple38, 29
14Literal
15ExprTuple16, 17
16Operationoperator: 25
operands: 18
17Operationoperator: 27
operands: 19
18ExprTuple37, 20
19ExprTuple21, 22
20Operationoperator: 23
operands: 24
21Operationoperator: 25
operands: 26
22Operationoperator: 27
operands: 28
23Literal
24ExprTuple36, 38
25Literal
26ExprTuple37, 29
27Literal
28ExprTuple30, 31
29Literal
30Operationoperator: 32
operands: 33
31Operationoperator: 34
operands: 35
32Literal
33ExprTuple36, 37
34Literal
35ExprTuple37, 38
36Variable
37Variable
38Variable