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 Conditional, ExprTuple, Lambda, S, f, n
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, NaturalPos, RealNeg
In [2]:
# build up the expression from sub-expressions
sub_expr1 = [x_1_to_n]
expr = ExprTuple(Lambda(n, Conditional(Forall(instance_param_or_params = [f, S], instance_expr = Implies(Forall(instance_param_or_params = sub_expr1, instance_expr = InSet(f__x_1_to_n, RealNeg), domain = S), InSet(Integrate(index_or_indices = sub_expr1, integrand = f__x_1_to_n, domain = S), RealNeg))), InSet(n, NaturalPos))))
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(n \mapsto \left\{\forall_{f, S}~\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}^-\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}^-\right)\right) \textrm{ if } n \in \mathbb{N}^+\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
1Lambdaparameter: 40
body: 3
2ExprTuple40
3Conditionalvalue: 4
condition: 5
4Operationoperator: 16
operand: 8
5Operationoperator: 42
operands: 7
6ExprTuple8
7ExprTuple40, 9
8Lambdaparameters: 10
body: 11
9Literal
10ExprTuple31, 45
11Operationoperator: 12
operands: 13
12Literal
13ExprTuple14, 15
14Operationoperator: 16
operand: 19
15Operationoperator: 42
operands: 18
16Literal
17ExprTuple19
18ExprTuple20, 28
19Lambdaparameters: 32
body: 21
20Operationoperator: 22
operand: 25
21Conditionalvalue: 24
condition: 30
22Literal
23ExprTuple25
24Operationoperator: 42
operands: 26
25Lambdaparameters: 32
body: 27
26ExprTuple29, 28
27Conditionalvalue: 29
condition: 30
28Literal
29Operationoperator: 31
operands: 32
30Operationoperator: 33
operands: 34
31Variable
32ExprTuple35
33Literal
34ExprTuple36
35ExprRangelambda_map: 37
start_index: 39
end_index: 40
36ExprRangelambda_map: 38
start_index: 39
end_index: 40
37Lambdaparameter: 48
body: 44
38Lambdaparameter: 48
body: 41
39Literal
40Variable
41Operationoperator: 42
operands: 43
42Literal
43ExprTuple44, 45
44IndexedVarvariable: 46
index: 48
45Variable
46Variable
47ExprTuple48
48Variable