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
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, Neg
In [2]:
# build up the expression from sub-expressions
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)
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_{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)
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: 1
operand: 3
1Literal
2ExprTuple3
3Lambdaparameters: 4
body: 5
4ExprTuple28, 48, 29, 33, 30
5Conditionalvalue: 6
condition: 7
6Operationoperator: 8
operands: 9
7Operationoperator: 10
operands: 11
8Literal
9ExprTuple12, 13
10Literal
11ExprTuple14, 15, 16, 17, 18
12Operationoperator: 20
operands: 19
13Operationoperator: 20
operands: 21
14ExprRangelambda_map: 22
start_index: 42
end_index: 38
15Operationoperator: 46
operands: 23
16ExprRangelambda_map: 24
start_index: 42
end_index: 40
17Operationoperator: 46
operands: 25
18ExprRangelambda_map: 26
start_index: 42
end_index: 43
19ExprTuple28, 27, 29, 33, 30
20Literal
21ExprTuple28, 29, 30
22Lambdaparameter: 57
body: 31
23ExprTuple48, 52
24Lambdaparameter: 57
body: 32
25ExprTuple33, 52
26Lambdaparameter: 57
body: 34
27Operationoperator: 35
operand: 48
28ExprRangelambda_map: 37
start_index: 42
end_index: 38
29ExprRangelambda_map: 39
start_index: 42
end_index: 40
30ExprRangelambda_map: 41
start_index: 42
end_index: 43
31Operationoperator: 46
operands: 44
32Operationoperator: 46
operands: 45
33Variable
34Operationoperator: 46
operands: 47
35Literal
36ExprTuple48
37Lambdaparameter: 57
body: 49
38Variable
39Lambdaparameter: 57
body: 50
40Variable
41Lambdaparameter: 57
body: 51
42Literal
43Variable
44ExprTuple49, 52
45ExprTuple50, 52
46Literal
47ExprTuple51, 52
48Variable
49IndexedVarvariable: 53
index: 57
50IndexedVarvariable: 54
index: 57
51IndexedVarvariable: 55
index: 57
52Literal
53Variable
54Variable
55Variable
56ExprTuple57
57Variable