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, 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(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))
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(\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)
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
4ExprTuple40, 41, 39, 42
5Conditionalvalue: 6
condition: 7
6Operationoperator: 8
operands: 9
7Operationoperator: 10
operands: 11
8Literal
9ExprTuple12, 13
10Literal
11ExprTuple14, 15, 16, 17, 18
12Operationoperator: 34
operands: 19
13Operationoperator: 32
operands: 20
14ExprRangelambda_map: 21
start_index: 47
end_index: 45
15Operationoperator: 37
operands: 22
16Operationoperator: 37
operands: 23
17ExprRangelambda_map: 24
start_index: 47
end_index: 48
18Operationoperator: 25
operands: 26
19ExprTuple40, 27, 42
20ExprTuple28, 39
21Lambdaparameter: 54
body: 29
22ExprTuple41, 43
23ExprTuple39, 43
24Lambdaparameter: 54
body: 30
25Literal
26ExprTuple39, 31
27Operationoperator: 32
operands: 33
28Operationoperator: 34
operands: 35
29Operationoperator: 37
operands: 36
30Operationoperator: 37
operands: 38
31Literal
32Literal
33ExprTuple41, 39
34Literal
35ExprTuple40, 41, 42
36ExprTuple49, 43
37Literal
38ExprTuple50, 43
39Variable
40ExprRangelambda_map: 44
start_index: 47
end_index: 45
41Variable
42ExprRangelambda_map: 46
start_index: 47
end_index: 48
43Literal
44Lambdaparameter: 54
body: 49
45Variable
46Lambdaparameter: 54
body: 50
47Literal
48Variable
49IndexedVarvariable: 51
index: 54
50IndexedVarvariable: 52
index: 54
51Variable
52Variable
53ExprTuple54
54Variable