logo

Expression of type Conditional

from the theory of proveit.numbers.addition.subtraction

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, d, i, j, k
from proveit.core_expr_types import a_1_to_i, c_1_to_j, e_1_to_k
from proveit.logic import And, Equals, Forall, InSet
from proveit.numbers import Add, Complex, Natural, Neg
In [2]:
# build up the expression from sub-expressions
expr = Conditional(Forall(instance_param_or_params = [a_1_to_i, b, c_1_to_j, d, e_1_to_k], instance_expr = Equals(Add(a_1_to_i, Neg(b), c_1_to_j, d, e_1_to_k), Add(a_1_to_i, c_1_to_j, e_1_to_k)), domain = Complex), And(InSet(i, Natural), InSet(j, Natural), InSet(k, 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_{a_{1}, a_{2}, \ldots, a_{i}, b, c_{1}, c_{2}, \ldots, c_{j}, d, e_{1}, e_{2}, \ldots, e_{k} \in \mathbb{C}}~\left(\left(a_{1} +  a_{2} +  \ldots +  a_{i} - b+ c_{1} +  c_{2} +  \ldots +  c_{j} + d+ e_{1} +  e_{2} +  \ldots +  e_{k}\right) = \left(a_{1} +  a_{2} +  \ldots +  a_{i}+ c_{1} +  c_{2} +  \ldots +  c_{j}+ e_{1} +  e_{2} +  \ldots +  e_{k}\right)\right) \textrm{ if } i \in \mathbb{N} ,  j \in \mathbb{N} ,  k \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: 3
operand: 6
2Operationoperator: 20
operands: 5
3Literal
4ExprTuple6
5ExprTuple7, 8, 9
6Lambdaparameters: 10
body: 11
7Operationoperator: 56
operands: 12
8Operationoperator: 56
operands: 13
9Operationoperator: 56
operands: 14
10ExprTuple38, 58, 39, 43, 40
11Conditionalvalue: 15
condition: 16
12ExprTuple48, 17
13ExprTuple50, 17
14ExprTuple53, 17
15Operationoperator: 18
operands: 19
16Operationoperator: 20
operands: 21
17Literal
18Literal
19ExprTuple22, 23
20Literal
21ExprTuple24, 25, 26, 27, 28
22Operationoperator: 30
operands: 29
23Operationoperator: 30
operands: 31
24ExprRangelambda_map: 32
start_index: 52
end_index: 48
25Operationoperator: 56
operands: 33
26ExprRangelambda_map: 34
start_index: 52
end_index: 50
27Operationoperator: 56
operands: 35
28ExprRangelambda_map: 36
start_index: 52
end_index: 53
29ExprTuple38, 37, 39, 43, 40
30Literal
31ExprTuple38, 39, 40
32Lambdaparameter: 67
body: 41
33ExprTuple58, 62
34Lambdaparameter: 67
body: 42
35ExprTuple43, 62
36Lambdaparameter: 67
body: 44
37Operationoperator: 45
operand: 58
38ExprRangelambda_map: 47
start_index: 52
end_index: 48
39ExprRangelambda_map: 49
start_index: 52
end_index: 50
40ExprRangelambda_map: 51
start_index: 52
end_index: 53
41Operationoperator: 56
operands: 54
42Operationoperator: 56
operands: 55
43Variable
44Operationoperator: 56
operands: 57
45Literal
46ExprTuple58
47Lambdaparameter: 67
body: 59
48Variable
49Lambdaparameter: 67
body: 60
50Variable
51Lambdaparameter: 67
body: 61
52Literal
53Variable
54ExprTuple59, 62
55ExprTuple60, 62
56Literal
57ExprTuple61, 62
58Variable
59IndexedVarvariable: 63
index: 67
60IndexedVarvariable: 64
index: 67
61IndexedVarvariable: 65
index: 67
62Literal
63Variable
64Variable
65Variable
66ExprTuple67
67Variable