logo

Expression of type ExprTuple

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 ExprTuple, 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, RealNonNeg
In [2]:
# build up the expression from sub-expressions
sub_expr1 = [x_1_to_n]
expr = ExprTuple(Lambda([f, S], Implies(Forall(instance_param_or_params = sub_expr1, instance_expr = InSet(f__x_1_to_n, RealNonNeg), domain = S), InSet(Integrate(index_or_indices = sub_expr1, integrand = f__x_1_to_n, domain = S), RealNonNeg))))
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(\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}^{\ge 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}^{\ge 0}\right)\right)\right)
In [5]:
stored_expr.style_options()
no style options
In [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0ExprTuple1
1Lambdaparameters: 2
body: 3
2ExprTuple23, 37
3Operationoperator: 4
operands: 5
4Literal
5ExprTuple6, 7
6Operationoperator: 8
operand: 11
7Operationoperator: 34
operands: 10
8Literal
9ExprTuple11
10ExprTuple12, 20
11Lambdaparameters: 24
body: 13
12Operationoperator: 14
operand: 17
13Conditionalvalue: 16
condition: 22
14Literal
15ExprTuple17
16Operationoperator: 34
operands: 18
17Lambdaparameters: 24
body: 19
18ExprTuple21, 20
19Conditionalvalue: 21
condition: 22
20Literal
21Operationoperator: 23
operands: 24
22Operationoperator: 25
operands: 26
23Variable
24ExprTuple27
25Literal
26ExprTuple28
27ExprRangelambda_map: 29
start_index: 31
end_index: 32
28ExprRangelambda_map: 30
start_index: 31
end_index: 32
29Lambdaparameter: 40
body: 36
30Lambdaparameter: 40
body: 33
31Literal
32Variable
33Operationoperator: 34
operands: 35
34Literal
35ExprTuple36, 37
36IndexedVarvariable: 38
index: 40
37Variable
38Variable
39ExprTuple40
40Variable