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