logo

Expression of type Forall

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 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 Equals, Forall
from proveit.numbers import Add, Complex, Natural, Neg
In [2]:
# build up the expression from sub-expressions
expr = Forall(instance_param_or_params = [i, j, k], instance_expr = 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, b, c_1_to_j, Neg(d), e_1_to_k), Add(a_1_to_i, c_1_to_j, e_1_to_k)), domain = Complex, condition = Equals(b, d)), domain = 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())
\forall_{i, j, k \in \mathbb{N}}~\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}~|~b = d}~\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)\right]
In [5]:
stored_expr.style_options()
namedescriptiondefaultcurrent valuerelated methods
with_wrappingIf 'True', wrap the Expression after the parametersNoneNone/False('with_wrapping',)
condition_wrappingWrap 'before' or 'after' the condition (or None).NoneNone/False('with_wrap_after_condition', 'with_wrap_before_condition')
wrap_paramsIf 'True', wraps every two parameters AND wraps the Expression after the parametersNoneNone/False('with_params',)
justificationjustify to the 'left', 'center', or 'right' in the array cellscentercenter('with_justification',)
In [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0Operationoperator: 7
operand: 2
1ExprTuple2
2Lambdaparameters: 3
body: 4
3ExprTuple54, 56, 59
4Conditionalvalue: 5
condition: 6
5Operationoperator: 7
operand: 10
6Operationoperator: 23
operands: 9
7Literal
8ExprTuple10
9ExprTuple11, 12, 13
10Lambdaparameters: 14
body: 15
11Operationoperator: 62
operands: 16
12Operationoperator: 62
operands: 17
13Operationoperator: 62
operands: 18
14ExprTuple44, 50, 45, 64, 46
15Conditionalvalue: 19
condition: 20
16ExprTuple54, 21
17ExprTuple56, 21
18ExprTuple59, 21
19Operationoperator: 41
operands: 22
20Operationoperator: 23
operands: 24
21Literal
22ExprTuple25, 26
23Literal
24ExprTuple27, 28, 29, 30, 31, 32
25Operationoperator: 34
operands: 33
26Operationoperator: 34
operands: 35
27ExprRangelambda_map: 36
start_index: 58
end_index: 54
28Operationoperator: 62
operands: 37
29ExprRangelambda_map: 38
start_index: 58
end_index: 56
30Operationoperator: 62
operands: 39
31ExprRangelambda_map: 40
start_index: 58
end_index: 59
32Operationoperator: 41
operands: 42
33ExprTuple44, 50, 45, 43, 46
34Literal
35ExprTuple44, 45, 46
36Lambdaparameter: 73
body: 47
37ExprTuple50, 68
38Lambdaparameter: 73
body: 48
39ExprTuple64, 68
40Lambdaparameter: 73
body: 49
41Literal
42ExprTuple50, 64
43Operationoperator: 51
operand: 64
44ExprRangelambda_map: 53
start_index: 58
end_index: 54
45ExprRangelambda_map: 55
start_index: 58
end_index: 56
46ExprRangelambda_map: 57
start_index: 58
end_index: 59
47Operationoperator: 62
operands: 60
48Operationoperator: 62
operands: 61
49Operationoperator: 62
operands: 63
50Variable
51Literal
52ExprTuple64
53Lambdaparameter: 73
body: 65
54Variable
55Lambdaparameter: 73
body: 66
56Variable
57Lambdaparameter: 73
body: 67
58Literal
59Variable
60ExprTuple65, 68
61ExprTuple66, 68
62Literal
63ExprTuple67, 68
64Variable
65IndexedVarvariable: 69
index: 73
66IndexedVarvariable: 70
index: 73
67IndexedVarvariable: 71
index: 73
68Literal
69Variable
70Variable
71Variable
72ExprTuple73
73Variable