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 = [m, n], instance_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_{m, n}~\left[\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)\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: 5
operand: 2
1ExprTuple2
2Lambdaparameters: 3
body: 4
3ExprTuple62, 65
4Operationoperator: 5
operand: 7
5Literal
6ExprTuple7
7Lambdaparameters: 8
body: 9
8ExprTuple58, 50, 59, 60
9Conditionalvalue: 10
condition: 11
10Operationoperator: 12
operands: 13
11Operationoperator: 14
operands: 15
12Literal
13ExprTuple16, 17
14Literal
15ExprTuple18, 19, 20, 21, 22, 23, 24
16Operationoperator: 41
operands: 25
17Operationoperator: 54
operand: 35
18ExprRangelambda_map: 27
start_index: 64
end_index: 62
19Operationoperator: 44
operands: 28
20Operationoperator: 44
operands: 29
21ExprRangelambda_map: 30
start_index: 64
end_index: 65
22Operationoperator: 47
operands: 31
23ExprRangelambda_map: 32
start_index: 64
end_index: 62
24ExprRangelambda_map: 33
start_index: 64
end_index: 65
25ExprTuple50, 34
26ExprTuple35
27Lambdaparameter: 71
body: 36
28ExprTuple50, 52
29ExprTuple59, 52
30Lambdaparameter: 71
body: 37
31ExprTuple59, 53
32Lambdaparameter: 71
body: 38
33Lambdaparameter: 71
body: 39
34Operationoperator: 56
operands: 40
35Operationoperator: 41
operands: 42
36Operationoperator: 44
operands: 43
37Operationoperator: 44
operands: 45
38Operationoperator: 47
operands: 46
39Operationoperator: 47
operands: 48
40ExprTuple58, 49, 60
41Literal
42ExprTuple50, 51
43ExprTuple66, 52
44Literal
45ExprTuple67, 52
46ExprTuple66, 53
47Literal
48ExprTuple67, 53
49Operationoperator: 54
operand: 59
50Variable
51Operationoperator: 56
operands: 57
52Literal
53Literal
54Literal
55ExprTuple59
56Literal
57ExprTuple58, 59, 60
58ExprRangelambda_map: 61
start_index: 64
end_index: 62
59Variable
60ExprRangelambda_map: 63
start_index: 64
end_index: 65
61Lambdaparameter: 71
body: 66
62Variable
63Lambdaparameter: 71
body: 67
64Literal
65Variable
66IndexedVarvariable: 68
index: 71
67IndexedVarvariable: 69
index: 71
68Variable
69Variable
70ExprTuple71
71Variable