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 m, n, 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, NaturalPos, frac, zero
In [2]:
# build up the expression from sub-expressions
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(Mult(w_1_to_m, frac(x, y), z_1_to_n), frac(Mult(w_1_to_m, x, z_1_to_n), y)), domain = Complex, condition = NotEquals(y, zero)), domain = NaturalPos)
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 \in \mathbb{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(\left(w_{1} \cdot  w_{2} \cdot  \ldots \cdot  w_{m} \cdot \frac{x}{y}\cdot z_{1} \cdot  z_{2} \cdot  \ldots \cdot  z_{n}\right) = \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: 7
operand: 2
1ExprTuple2
2Lambdaparameters: 3
body: 4
3ExprTuple57, 60
4Conditionalvalue: 5
condition: 6
5Operationoperator: 7
operand: 10
6Operationoperator: 22
operands: 9
7Literal
8ExprTuple10
9ExprTuple11, 12
10Lambdaparameters: 13
body: 14
11Operationoperator: 49
operands: 15
12Operationoperator: 49
operands: 16
13ExprTuple52, 53, 51, 54
14Conditionalvalue: 17
condition: 18
15ExprTuple57, 19
16ExprTuple60, 19
17Operationoperator: 20
operands: 21
18Operationoperator: 22
operands: 23
19Literal
20Literal
21ExprTuple24, 25
22Literal
23ExprTuple26, 27, 28, 29, 30
24Operationoperator: 46
operands: 31
25Operationoperator: 44
operands: 32
26ExprRangelambda_map: 33
start_index: 59
end_index: 57
27Operationoperator: 49
operands: 34
28Operationoperator: 49
operands: 35
29ExprRangelambda_map: 36
start_index: 59
end_index: 60
30Operationoperator: 37
operands: 38
31ExprTuple52, 39, 54
32ExprTuple40, 51
33Lambdaparameter: 66
body: 41
34ExprTuple53, 55
35ExprTuple51, 55
36Lambdaparameter: 66
body: 42
37Literal
38ExprTuple51, 43
39Operationoperator: 44
operands: 45
40Operationoperator: 46
operands: 47
41Operationoperator: 49
operands: 48
42Operationoperator: 49
operands: 50
43Literal
44Literal
45ExprTuple53, 51
46Literal
47ExprTuple52, 53, 54
48ExprTuple61, 55
49Literal
50ExprTuple62, 55
51Variable
52ExprRangelambda_map: 56
start_index: 59
end_index: 57
53Variable
54ExprRangelambda_map: 58
start_index: 59
end_index: 60
55Literal
56Lambdaparameter: 66
body: 61
57Variable
58Lambdaparameter: 66
body: 62
59Literal
60Variable
61IndexedVarvariable: 63
index: 66
62IndexedVarvariable: 64
index: 66
63Variable
64Variable
65ExprTuple66
66Variable