logo

Expression of type Lambda

from the theory of proveit.numbers.integration

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, l
from proveit.logic import And, InSet
from proveit.numbers import Exp, Integrate, IntervalCC, LessEq, RealPos, frac, one, two
In [2]:
# build up the expression from sub-expressions
expr = Lambda([a, b], Conditional(LessEq(Integrate(index_or_indices = [l], integrand = frac(one, Exp(l, two)), domain = IntervalCC(a, b)), frac(one, a)), And(InSet(a, RealPos), InSet(b, RealPos), LessEq(a, b))))
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\{\left(\int_{a}^{b} \frac{1}{l^{2}}\,dl\right) \leq \frac{1}{a} \textrm{ if } a \in \mathbb{R}^+ ,  b \in \mathbb{R}^+ ,  a \leq b\right..
In [5]:
stored_expr.style_options()
no style options
In [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0Lambdaparameters: 34
body: 1
1Conditionalvalue: 2
condition: 3
2Operationoperator: 17
operands: 4
3Operationoperator: 5
operands: 6
4ExprTuple7, 8
5Literal
6ExprTuple9, 10, 11
7Operationoperator: 12
operand: 18
8Operationoperator: 24
operands: 14
9Operationoperator: 26
operands: 15
10Operationoperator: 26
operands: 16
11Operationoperator: 17
operands: 34
12Literal
13ExprTuple18
14ExprTuple28, 37
15ExprTuple37, 19
16ExprTuple38, 19
17Literal
18Lambdaparameter: 35
body: 21
19Literal
20ExprTuple35
21Conditionalvalue: 22
condition: 23
22Operationoperator: 24
operands: 25
23Operationoperator: 26
operands: 27
24Literal
25ExprTuple28, 29
26Literal
27ExprTuple35, 30
28Literal
29Operationoperator: 31
operands: 32
30Operationoperator: 33
operands: 34
31Literal
32ExprTuple35, 36
33Literal
34ExprTuple37, 38
35Variable
36Literal
37Variable
38Variable