logo

Expression of type Conditional

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, 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, RealNonNeg
In [2]:
# build up the expression from sub-expressions
sub_expr1 = [x_1_to_n]
expr = 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, RealNonNeg), domain = S), InSet(Integrate(index_or_indices = sub_expr1, integrand = f__x_1_to_n, domain = S), RealNonNeg))), 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\{\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}^{\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) \textrm{ if } n \in \mathbb{N}^+\right..
In [5]:
stored_expr.style_options()
namedescriptiondefaultcurrent valuerelated methods
condition_delimiter'comma' or 'and'commacomma('with_comma_delimiter', 'with_conjunction_delimiter')
In [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0Conditionalvalue: 1
condition: 2
1Operationoperator: 13
operand: 5
2Operationoperator: 39
operands: 4
3ExprTuple5
4ExprTuple37, 6
5Lambdaparameters: 7
body: 8
6Literal
7ExprTuple28, 42
8Operationoperator: 9
operands: 10
9Literal
10ExprTuple11, 12
11Operationoperator: 13
operand: 16
12Operationoperator: 39
operands: 15
13Literal
14ExprTuple16
15ExprTuple17, 25
16Lambdaparameters: 29
body: 18
17Operationoperator: 19
operand: 22
18Conditionalvalue: 21
condition: 27
19Literal
20ExprTuple22
21Operationoperator: 39
operands: 23
22Lambdaparameters: 29
body: 24
23ExprTuple26, 25
24Conditionalvalue: 26
condition: 27
25Literal
26Operationoperator: 28
operands: 29
27Operationoperator: 30
operands: 31
28Variable
29ExprTuple32
30Literal
31ExprTuple33
32ExprRangelambda_map: 34
start_index: 36
end_index: 37
33ExprRangelambda_map: 35
start_index: 36
end_index: 37
34Lambdaparameter: 45
body: 41
35Lambdaparameter: 45
body: 38
36Literal
37Variable
38Operationoperator: 39
operands: 40
39Literal
40ExprTuple41, 42
41IndexedVarvariable: 43
index: 45
42Variable
43Variable
44ExprTuple45
45Variable