logo

Expression of type Conditional

from the theory of proveit.numbers.addition

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, b, i, j
from proveit.core_expr_types import a_1_to_i, c_1_to_j
from proveit.logic import And, Forall, InSet
from proveit.numbers import Add, Less, Natural, Real, RealNeg, greater, zero
In [2]:
# build up the expression from sub-expressions
expr = Conditional(Forall(instance_param_or_params = [a_1_to_i, c_1_to_j], instance_expr = Forall(instance_param_or_params = [b], instance_expr = Less(Add(a_1_to_i, b, c_1_to_j), b), domain = Real), domain = RealNeg), And(InSet(i, Natural), InSet(j, Natural), greater(Add(i, j), zero)))
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_{a_{1}, a_{2}, \ldots, a_{i}, c_{1}, c_{2}, \ldots, c_{j} \in \mathbb{R}^-}~\left[\forall_{b \in \mathbb{R}}~\left(\left(a_{1} +  a_{2} +  \ldots +  a_{i} + b+ c_{1} +  c_{2} +  \ldots +  c_{j}\right) < b\right)\right] \textrm{ if } i \in \mathbb{N} ,  j \in \mathbb{N} ,  \left(i + j\right) > 0\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: 19
operand: 5
2Operationoperator: 21
operands: 4
3ExprTuple5
4ExprTuple6, 7, 8
5Lambdaparameters: 9
body: 10
6Operationoperator: 39
operands: 11
7Operationoperator: 39
operands: 12
8Operationoperator: 35
operands: 13
9ExprTuple46, 48
10Conditionalvalue: 14
condition: 15
11ExprTuple50, 16
12ExprTuple53, 16
13ExprTuple17, 18
14Operationoperator: 19
operand: 24
15Operationoperator: 21
operands: 22
16Literal
17Literal
18Operationoperator: 44
operands: 23
19Literal
20ExprTuple24
21Literal
22ExprTuple25, 26
23ExprTuple50, 53
24Lambdaparameter: 47
body: 28
25ExprRangelambda_map: 29
start_index: 52
end_index: 50
26ExprRangelambda_map: 30
start_index: 52
end_index: 53
27ExprTuple47
28Conditionalvalue: 31
condition: 32
29Lambdaparameter: 59
body: 33
30Lambdaparameter: 59
body: 34
31Operationoperator: 35
operands: 36
32Operationoperator: 39
operands: 37
33Operationoperator: 39
operands: 38
34Operationoperator: 39
operands: 40
35Literal
36ExprTuple41, 47
37ExprTuple47, 42
38ExprTuple54, 43
39Literal
40ExprTuple55, 43
41Operationoperator: 44
operands: 45
42Literal
43Literal
44Literal
45ExprTuple46, 47, 48
46ExprRangelambda_map: 49
start_index: 52
end_index: 50
47Variable
48ExprRangelambda_map: 51
start_index: 52
end_index: 53
49Lambdaparameter: 59
body: 54
50Variable
51Lambdaparameter: 59
body: 55
52Literal
53Variable
54IndexedVarvariable: 56
index: 59
55IndexedVarvariable: 57
index: 59
56Variable
57Variable
58ExprTuple59
59Variable