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, 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), 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}}~\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
3ExprTuple52, 54, 57
4Conditionalvalue: 5
condition: 6
5Operationoperator: 7
operand: 10
6Operationoperator: 24
operands: 9
7Literal
8ExprTuple10
9ExprTuple11, 12, 13
10Lambdaparameters: 14
body: 15
11Operationoperator: 60
operands: 16
12Operationoperator: 60
operands: 17
13Operationoperator: 60
operands: 18
14ExprTuple42, 62, 43, 47, 44
15Conditionalvalue: 19
condition: 20
16ExprTuple52, 21
17ExprTuple54, 21
18ExprTuple57, 21
19Operationoperator: 22
operands: 23
20Operationoperator: 24
operands: 25
21Literal
22Literal
23ExprTuple26, 27
24Literal
25ExprTuple28, 29, 30, 31, 32
26Operationoperator: 34
operands: 33
27Operationoperator: 34
operands: 35
28ExprRangelambda_map: 36
start_index: 56
end_index: 52
29Operationoperator: 60
operands: 37
30ExprRangelambda_map: 38
start_index: 56
end_index: 54
31Operationoperator: 60
operands: 39
32ExprRangelambda_map: 40
start_index: 56
end_index: 57
33ExprTuple42, 41, 43, 47, 44
34Literal
35ExprTuple42, 43, 44
36Lambdaparameter: 71
body: 45
37ExprTuple62, 66
38Lambdaparameter: 71
body: 46
39ExprTuple47, 66
40Lambdaparameter: 71
body: 48
41Operationoperator: 49
operand: 62
42ExprRangelambda_map: 51
start_index: 56
end_index: 52
43ExprRangelambda_map: 53
start_index: 56
end_index: 54
44ExprRangelambda_map: 55
start_index: 56
end_index: 57
45Operationoperator: 60
operands: 58
46Operationoperator: 60
operands: 59
47Variable
48Operationoperator: 60
operands: 61
49Literal
50ExprTuple62
51Lambdaparameter: 71
body: 63
52Variable
53Lambdaparameter: 71
body: 64
54Variable
55Lambdaparameter: 71
body: 65
56Literal
57Variable
58ExprTuple63, 66
59ExprTuple64, 66
60Literal
61ExprTuple65, 66
62Variable
63IndexedVarvariable: 67
index: 71
64IndexedVarvariable: 68
index: 71
65IndexedVarvariable: 69
index: 71
66Literal
67Variable
68Variable
69Variable
70ExprTuple71
71Variable