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, 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))
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}~|~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)
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
4ExprTuple30, 36, 31, 50, 32
5Conditionalvalue: 6
condition: 7
6Operationoperator: 27
operands: 8
7Operationoperator: 9
operands: 10
8ExprTuple11, 12
9Literal
10ExprTuple13, 14, 15, 16, 17, 18
11Operationoperator: 20
operands: 19
12Operationoperator: 20
operands: 21
13ExprRangelambda_map: 22
start_index: 44
end_index: 40
14Operationoperator: 48
operands: 23
15ExprRangelambda_map: 24
start_index: 44
end_index: 42
16Operationoperator: 48
operands: 25
17ExprRangelambda_map: 26
start_index: 44
end_index: 45
18Operationoperator: 27
operands: 28
19ExprTuple30, 36, 31, 29, 32
20Literal
21ExprTuple30, 31, 32
22Lambdaparameter: 59
body: 33
23ExprTuple36, 54
24Lambdaparameter: 59
body: 34
25ExprTuple50, 54
26Lambdaparameter: 59
body: 35
27Literal
28ExprTuple36, 50
29Operationoperator: 37
operand: 50
30ExprRangelambda_map: 39
start_index: 44
end_index: 40
31ExprRangelambda_map: 41
start_index: 44
end_index: 42
32ExprRangelambda_map: 43
start_index: 44
end_index: 45
33Operationoperator: 48
operands: 46
34Operationoperator: 48
operands: 47
35Operationoperator: 48
operands: 49
36Variable
37Literal
38ExprTuple50
39Lambdaparameter: 59
body: 51
40Variable
41Lambdaparameter: 59
body: 52
42Variable
43Lambdaparameter: 59
body: 53
44Literal
45Variable
46ExprTuple51, 54
47ExprTuple52, 54
48Literal
49ExprTuple53, 54
50Variable
51IndexedVarvariable: 55
index: 59
52IndexedVarvariable: 56
index: 59
53IndexedVarvariable: 57
index: 59
54Literal
55Variable
56Variable
57Variable
58ExprTuple59
59Variable