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 ExprRange, IndexedVar, Variable, m, n, w, x, y, z
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, one, zero
In [2]:
# build up the expression from sub-expressions
sub_expr1 = Variable("_a", latex_format = r"{_{-}a}")
expr = Forall(instance_param_or_params = [w_1_to_m, x, y, z_1_to_n], instance_expr = Equals(frac(x, Mult(w_1_to_m, Neg(y), z_1_to_n)), Neg(frac(x, Mult(w_1_to_m, y, z_1_to_n)))), domain = Complex, conditions = [NotEquals(y, zero), ExprRange(sub_expr1, NotEquals(IndexedVar(w, sub_expr1), zero), one, m), ExprRange(sub_expr1, NotEquals(IndexedVar(z, sub_expr1), zero), one, n)])
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(w_{1} \neq 0\right), \left(w_{2} \neq 0\right), \ldots, \left(w_{m} \neq 0\right),\left(z_{1} \neq 0\right), \left(z_{2} \neq 0\right), \ldots, \left(z_{n} \neq 0\right)}~\left(\frac{x}{w_{1} \cdot  w_{2} \cdot  \ldots \cdot  w_{m} \cdot \left(-y\right)\cdot z_{1} \cdot  z_{2} \cdot  \ldots \cdot  z_{n}} = \left(-\frac{x}{w_{1} \cdot  w_{2} \cdot  \ldots \cdot  w_{m} \cdot y\cdot z_{1} \cdot  z_{2} \cdot  \ldots \cdot  z_{n}}\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
4ExprTuple54, 46, 55, 56
5Conditionalvalue: 6
condition: 7
6Operationoperator: 8
operands: 9
7Operationoperator: 10
operands: 11
8Literal
9ExprTuple12, 13
10Literal
11ExprTuple14, 15, 16, 17, 18, 19, 20
12Operationoperator: 37
operands: 21
13Operationoperator: 50
operand: 31
14ExprRangelambda_map: 23
start_index: 60
end_index: 58
15Operationoperator: 40
operands: 24
16Operationoperator: 40
operands: 25
17ExprRangelambda_map: 26
start_index: 60
end_index: 61
18Operationoperator: 43
operands: 27
19ExprRangelambda_map: 28
start_index: 60
end_index: 58
20ExprRangelambda_map: 29
start_index: 60
end_index: 61
21ExprTuple46, 30
22ExprTuple31
23Lambdaparameter: 67
body: 32
24ExprTuple46, 48
25ExprTuple55, 48
26Lambdaparameter: 67
body: 33
27ExprTuple55, 49
28Lambdaparameter: 67
body: 34
29Lambdaparameter: 67
body: 35
30Operationoperator: 52
operands: 36
31Operationoperator: 37
operands: 38
32Operationoperator: 40
operands: 39
33Operationoperator: 40
operands: 41
34Operationoperator: 43
operands: 42
35Operationoperator: 43
operands: 44
36ExprTuple54, 45, 56
37Literal
38ExprTuple46, 47
39ExprTuple62, 48
40Literal
41ExprTuple63, 48
42ExprTuple62, 49
43Literal
44ExprTuple63, 49
45Operationoperator: 50
operand: 55
46Variable
47Operationoperator: 52
operands: 53
48Literal
49Literal
50Literal
51ExprTuple55
52Literal
53ExprTuple54, 55, 56
54ExprRangelambda_map: 57
start_index: 60
end_index: 58
55Variable
56ExprRangelambda_map: 59
start_index: 60
end_index: 61
57Lambdaparameter: 67
body: 62
58Variable
59Lambdaparameter: 67
body: 63
60Literal
61Variable
62IndexedVarvariable: 64
index: 67
63IndexedVarvariable: 65
index: 67
64Variable
65Variable
66ExprTuple67
67Variable