logo

Expression of type Forall

from the theory of proveit.numbers.division

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 w_1_to_m, z_1_to_n
from proveit.logic import Equals, Forall, NotEquals
from proveit.numbers import Complex, Mult, Neg, frac, zero
In [2]:
# build up the expression from sub-expressions
expr = Forall(instance_param_or_params = [w_1_to_m, x, y, z_1_to_n], instance_expr = Equals(frac(Mult(w_1_to_m, Neg(x), z_1_to_n), y), Neg(frac(Mult(w_1_to_m, x, z_1_to_n), y))), domain = Complex, condition = NotEquals(y, zero))
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_{w_{1}, w_{2}, \ldots, w_{m}, x, y, z_{1}, z_{2}, \ldots, z_{n} \in \mathbb{C}~|~y \neq 0}~\left(\frac{w_{1} \cdot  w_{2} \cdot  \ldots \cdot  w_{m} \cdot \left(-x\right)\cdot z_{1} \cdot  z_{2} \cdot  \ldots \cdot  z_{n}}{y} = \left(-\frac{w_{1} \cdot  w_{2} \cdot  \ldots \cdot  w_{m} \cdot x\cdot z_{1} \cdot  z_{2} \cdot  \ldots \cdot  z_{n}}{y}\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
4ExprTuple46, 47, 40, 48
5Conditionalvalue: 6
condition: 7
6Operationoperator: 8
operands: 9
7Operationoperator: 10
operands: 11
8Literal
9ExprTuple12, 13
10Literal
11ExprTuple14, 15, 16, 17, 18
12Operationoperator: 33
operands: 19
13Operationoperator: 42
operand: 28
14ExprRangelambda_map: 21
start_index: 52
end_index: 50
15Operationoperator: 36
operands: 22
16Operationoperator: 36
operands: 23
17ExprRangelambda_map: 24
start_index: 52
end_index: 53
18Operationoperator: 25
operands: 26
19ExprTuple27, 40
20ExprTuple28
21Lambdaparameter: 59
body: 29
22ExprTuple47, 41
23ExprTuple40, 41
24Lambdaparameter: 59
body: 30
25Literal
26ExprTuple40, 31
27Operationoperator: 44
operands: 32
28Operationoperator: 33
operands: 34
29Operationoperator: 36
operands: 35
30Operationoperator: 36
operands: 37
31Literal
32ExprTuple46, 38, 48
33Literal
34ExprTuple39, 40
35ExprTuple54, 41
36Literal
37ExprTuple55, 41
38Operationoperator: 42
operand: 47
39Operationoperator: 44
operands: 45
40Variable
41Literal
42Literal
43ExprTuple47
44Literal
45ExprTuple46, 47, 48
46ExprRangelambda_map: 49
start_index: 52
end_index: 50
47Variable
48ExprRangelambda_map: 51
start_index: 52
end_index: 53
49Lambdaparameter: 59
body: 54
50Variable
51Lambdaparameter: 59
body: 55
52Literal
53Variable
54IndexedVarvariable: 56
index: 59
55IndexedVarvariable: 57
index: 59
56Variable
57Variable
58ExprTuple59
59Variable