logo

Expression of type Conditional

from the theory of proveit.numbers.multiplication

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, i, j, x, y
from proveit.core_expr_types import a_1_to_i, b_1_to_j
from proveit.logic import And, Forall, InSet
from proveit.numbers import LessEq, Mult, Natural, RealNonNeg
In [2]:
# build up the expression from sub-expressions
expr = Conditional(Forall(instance_param_or_params = [x, y], instance_expr = Forall(instance_param_or_params = [a_1_to_i, b_1_to_j], instance_expr = LessEq(Mult(a_1_to_i, x, b_1_to_j), Mult(a_1_to_i, y, b_1_to_j)), domain = RealNonNeg, condition = LessEq(x, y))), And(InSet(i, Natural), InSet(j, Natural)))
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_{x, y}~\left[\forall_{a_{1}, a_{2}, \ldots, a_{i}, b_{1}, b_{2}, \ldots, b_{j} \in \mathbb{R}^{\ge 0}~|~x \leq y}~\left(\left(a_{1} \cdot  a_{2} \cdot  \ldots \cdot  a_{i} \cdot x\cdot b_{1} \cdot  b_{2} \cdot  \ldots \cdot  b_{j}\right) \leq \left(a_{1} \cdot  a_{2} \cdot  \ldots \cdot  a_{i} \cdot y\cdot b_{1} \cdot  b_{2} \cdot  \ldots \cdot  b_{j}\right)\right)\right] \textrm{ if } i \in \mathbb{N} ,  j \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: 11
operand: 5
2Operationoperator: 20
operands: 4
3ExprTuple5
4ExprTuple6, 7
5Lambdaparameters: 33
body: 8
6Operationoperator: 46
operands: 9
7Operationoperator: 46
operands: 10
8Operationoperator: 11
operand: 14
9ExprTuple41, 13
10ExprTuple44, 13
11Literal
12ExprTuple14
13Literal
14Lambdaparameters: 15
body: 16
15ExprTuple34, 35
16Conditionalvalue: 17
condition: 18
17Operationoperator: 32
operands: 19
18Operationoperator: 20
operands: 21
19ExprTuple22, 23
20Literal
21ExprTuple24, 25, 26
22Operationoperator: 28
operands: 27
23Operationoperator: 28
operands: 29
24ExprRangelambda_map: 30
start_index: 43
end_index: 41
25ExprRangelambda_map: 31
start_index: 43
end_index: 44
26Operationoperator: 32
operands: 33
27ExprTuple34, 38, 35
28Literal
29ExprTuple34, 39, 35
30Lambdaparameter: 54
body: 36
31Lambdaparameter: 54
body: 37
32Literal
33ExprTuple38, 39
34ExprRangelambda_map: 40
start_index: 43
end_index: 41
35ExprRangelambda_map: 42
start_index: 43
end_index: 44
36Operationoperator: 46
operands: 45
37Operationoperator: 46
operands: 47
38Variable
39Variable
40Lambdaparameter: 54
body: 48
41Variable
42Lambdaparameter: 54
body: 49
43Literal
44Variable
45ExprTuple48, 50
46Literal
47ExprTuple49, 50
48IndexedVarvariable: 51
index: 54
49IndexedVarvariable: 52
index: 54
50Literal
51Variable
52Variable
53ExprTuple54
54Variable