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, Neg, 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(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_{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(\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)\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
3ExprTuple54, 57
4Operationoperator: 5
operand: 7
5Literal
6ExprTuple7
7Lambdaparameters: 8
body: 9
8ExprTuple50, 51, 44, 52
9Conditionalvalue: 10
condition: 11
10Operationoperator: 12
operands: 13
11Operationoperator: 14
operands: 15
12Literal
13ExprTuple16, 17
14Literal
15ExprTuple18, 19, 20, 21, 22
16Operationoperator: 37
operands: 23
17Operationoperator: 46
operand: 32
18ExprRangelambda_map: 25
start_index: 56
end_index: 54
19Operationoperator: 40
operands: 26
20Operationoperator: 40
operands: 27
21ExprRangelambda_map: 28
start_index: 56
end_index: 57
22Operationoperator: 29
operands: 30
23ExprTuple31, 44
24ExprTuple32
25Lambdaparameter: 63
body: 33
26ExprTuple51, 45
27ExprTuple44, 45
28Lambdaparameter: 63
body: 34
29Literal
30ExprTuple44, 35
31Operationoperator: 48
operands: 36
32Operationoperator: 37
operands: 38
33Operationoperator: 40
operands: 39
34Operationoperator: 40
operands: 41
35Literal
36ExprTuple50, 42, 52
37Literal
38ExprTuple43, 44
39ExprTuple58, 45
40Literal
41ExprTuple59, 45
42Operationoperator: 46
operand: 51
43Operationoperator: 48
operands: 49
44Variable
45Literal
46Literal
47ExprTuple51
48Literal
49ExprTuple50, 51, 52
50ExprRangelambda_map: 53
start_index: 56
end_index: 54
51Variable
52ExprRangelambda_map: 55
start_index: 56
end_index: 57
53Lambdaparameter: 63
body: 58
54Variable
55Lambdaparameter: 63
body: 59
56Literal
57Variable
58IndexedVarvariable: 60
index: 63
59IndexedVarvariable: 61
index: 63
60Variable
61Variable
62ExprTuple63
63Variable