logo

Expression of type Forall

from the theory of proveit.numbers.multiplication

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 x, y
from proveit.core_expr_types import a_1_to_i, b_1_to_j
from proveit.logic import Equals, Forall
from proveit.numbers import Complex, Mult, subtract
In [2]:
# build up the expression from sub-expressions
expr = Forall(instance_param_or_params = [a_1_to_i, x, y, b_1_to_j], instance_expr = Equals(Mult(a_1_to_i, subtract(x, y), b_1_to_j), subtract(Mult(a_1_to_i, x, b_1_to_j), Mult(a_1_to_i, y, b_1_to_j))).with_wrapping_at(2), 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}, x, y, b_{1}, b_{2}, \ldots, b_{j} \in \mathbb{C}}~\left(\begin{array}{c} \begin{array}{l} \left(a_{1} \cdot  a_{2} \cdot  \ldots \cdot  a_{i} \cdot \left(x - y\right)\cdot b_{1} \cdot  b_{2} \cdot  \ldots \cdot  b_{j}\right) =  \\ \left(\left(a_{1} \cdot  a_{2} \cdot  \ldots \cdot  a_{i} \cdot x\cdot b_{1} \cdot  b_{2} \cdot  \ldots \cdot  b_{j}\right) - \left(a_{1} \cdot  a_{2} \cdot  \ldots \cdot  a_{i} \cdot y\cdot b_{1} \cdot  b_{2} \cdot  \ldots \cdot  b_{j}\right)\right) \end{array} \end{array}\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
4ExprTuple44, 37, 45, 46
5Conditionalvalue: 6
condition: 7
6Operationoperator: 8
operands: 9
7Operationoperator: 10
operands: 11
8Literal
9ExprTuple12, 13
10Literal
11ExprTuple14, 15, 16, 17
12Operationoperator: 42
operands: 18
13Operationoperator: 29
operands: 19
14ExprRangelambda_map: 20
start_index: 50
end_index: 48
15Operationoperator: 34
operands: 21
16Operationoperator: 34
operands: 22
17ExprRangelambda_map: 23
start_index: 50
end_index: 51
18ExprTuple44, 24, 46
19ExprTuple25, 26
20Lambdaparameter: 57
body: 27
21ExprTuple37, 39
22ExprTuple45, 39
23Lambdaparameter: 57
body: 28
24Operationoperator: 29
operands: 30
25Operationoperator: 42
operands: 31
26Operationoperator: 40
operand: 38
27Operationoperator: 34
operands: 33
28Operationoperator: 34
operands: 35
29Literal
30ExprTuple37, 36
31ExprTuple44, 37, 46
32ExprTuple38
33ExprTuple52, 39
34Literal
35ExprTuple53, 39
36Operationoperator: 40
operand: 45
37Variable
38Operationoperator: 42
operands: 43
39Literal
40Literal
41ExprTuple45
42Literal
43ExprTuple44, 45, 46
44ExprRangelambda_map: 47
start_index: 50
end_index: 48
45Variable
46ExprRangelambda_map: 49
start_index: 50
end_index: 51
47Lambdaparameter: 57
body: 52
48Variable
49Lambdaparameter: 57
body: 53
50Literal
51Variable
52IndexedVarvariable: 54
index: 57
53IndexedVarvariable: 55
index: 57
54Variable
55Variable
56ExprTuple57
57Variable