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 Lambda, S, f
from proveit.core_expr_types import f__x_1_to_n, x_1_to_n
from proveit.logic import Forall, Implies, InSet
from proveit.numbers import Integrate, RealNonPos
In [2]:
# build up the expression from sub-expressions
sub_expr1 = [x_1_to_n]
expr = Lambda([f, S], Implies(Forall(instance_param_or_params = sub_expr1, instance_expr = InSet(f__x_1_to_n, RealNonPos), domain = S), InSet(Integrate(index_or_indices = sub_expr1, integrand = f__x_1_to_n, domain = S), RealNonPos)))
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(f, S\right) \mapsto \left(\left[\forall_{x_{1}, x_{2}, \ldots, x_{n} \in S}~\left(f\left(x_{1}, x_{2}, \ldots, x_{n}\right) \in \mathbb{R}^{\le 0}\right)\right] \Rightarrow \left(\left[\int_{x_{1}, x_{2}, \ldots, x_{n} \in S}~f\left(x_{1}, x_{2}, \ldots, x_{n}\right)\right] \in \mathbb{R}^{\le 0}\right)\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
1ExprTuple22, 36
2Operationoperator: 3
operands: 4
3Literal
4ExprTuple5, 6
5Operationoperator: 7
operand: 10
6Operationoperator: 33
operands: 9
7Literal
8ExprTuple10
9ExprTuple11, 19
10Lambdaparameters: 23
body: 12
11Operationoperator: 13
operand: 16
12Conditionalvalue: 15
condition: 21
13Literal
14ExprTuple16
15Operationoperator: 33
operands: 17
16Lambdaparameters: 23
body: 18
17ExprTuple20, 19
18Conditionalvalue: 20
condition: 21
19Literal
20Operationoperator: 22
operands: 23
21Operationoperator: 24
operands: 25
22Variable
23ExprTuple26
24Literal
25ExprTuple27
26ExprRangelambda_map: 28
start_index: 30
end_index: 31
27ExprRangelambda_map: 29
start_index: 30
end_index: 31
28Lambdaparameter: 39
body: 35
29Lambdaparameter: 39
body: 32
30Literal
31Variable
32Operationoperator: 33
operands: 34
33Literal
34ExprTuple35, 36
35IndexedVarvariable: 37
index: 39
36Variable
37Variable
38ExprTuple39
39Variable