logo

Expression of type ExprTuple

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, ExprTuple, IndexedVar, Lambda, 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 = ExprTuple(Lambda([m, n], 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())
\left(\left(m, n\right) \mapsto \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]\right)
In [5]:
stored_expr.style_options()
no style options
In [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0ExprTuple1
1Lambdaparameters: 2
body: 3
2ExprTuple61, 64
3Operationoperator: 4
operand: 6
4Literal
5ExprTuple6
6Lambdaparameters: 7
body: 8
7ExprTuple57, 49, 58, 59
8Conditionalvalue: 9
condition: 10
9Operationoperator: 11
operands: 12
10Operationoperator: 13
operands: 14
11Literal
12ExprTuple15, 16
13Literal
14ExprTuple17, 18, 19, 20, 21, 22, 23
15Operationoperator: 40
operands: 24
16Operationoperator: 53
operand: 34
17ExprRangelambda_map: 26
start_index: 63
end_index: 61
18Operationoperator: 43
operands: 27
19Operationoperator: 43
operands: 28
20ExprRangelambda_map: 29
start_index: 63
end_index: 64
21Operationoperator: 46
operands: 30
22ExprRangelambda_map: 31
start_index: 63
end_index: 61
23ExprRangelambda_map: 32
start_index: 63
end_index: 64
24ExprTuple49, 33
25ExprTuple34
26Lambdaparameter: 70
body: 35
27ExprTuple49, 51
28ExprTuple58, 51
29Lambdaparameter: 70
body: 36
30ExprTuple58, 52
31Lambdaparameter: 70
body: 37
32Lambdaparameter: 70
body: 38
33Operationoperator: 55
operands: 39
34Operationoperator: 40
operands: 41
35Operationoperator: 43
operands: 42
36Operationoperator: 43
operands: 44
37Operationoperator: 46
operands: 45
38Operationoperator: 46
operands: 47
39ExprTuple57, 48, 59
40Literal
41ExprTuple49, 50
42ExprTuple65, 51
43Literal
44ExprTuple66, 51
45ExprTuple65, 52
46Literal
47ExprTuple66, 52
48Operationoperator: 53
operand: 58
49Variable
50Operationoperator: 55
operands: 56
51Literal
52Literal
53Literal
54ExprTuple58
55Literal
56ExprTuple57, 58, 59
57ExprRangelambda_map: 60
start_index: 63
end_index: 61
58Variable
59ExprRangelambda_map: 62
start_index: 63
end_index: 64
60Lambdaparameter: 70
body: 65
61Variable
62Lambdaparameter: 70
body: 66
63Literal
64Variable
65IndexedVarvariable: 67
index: 70
66IndexedVarvariable: 68
index: 70
67Variable
68Variable
69ExprTuple70
70Variable