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 Conditional, 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 And, Equals, InSet, 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([w_1_to_m, x, y, z_1_to_n], Conditional(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))), And(ExprRange(sub_expr1, InSet(IndexedVar(w, sub_expr1), Complex), one, m), InSet(x, Complex), InSet(y, Complex), ExprRange(sub_expr1, InSet(IndexedVar(z, sub_expr1), Complex), one, n), 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())
\left(\left(w_{1}, w_{2}, \ldots, w_{m}, x, y, z_{1}, z_{2}, \ldots, z_{n}\right) \mapsto \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) \textrm{ if } \left(w_{1} \in \mathbb{C}\right) ,  \left(w_{2} \in \mathbb{C}\right) ,  \ldots ,  \left(w_{m} \in \mathbb{C}\right) ,  x \in \mathbb{C} ,  y \in \mathbb{C}, \left(z_{1} \in \mathbb{C}\right) ,  \left(z_{2} \in \mathbb{C}\right) ,  \ldots ,  \left(z_{n} \in \mathbb{C}\right) ,  y \neq 0\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
2ExprTuple44, 45, 38, 46
3Conditionalvalue: 4
condition: 5
4Operationoperator: 6
operands: 7
5Operationoperator: 8
operands: 9
6Literal
7ExprTuple10, 11
8Literal
9ExprTuple12, 13, 14, 15, 16
10Operationoperator: 31
operands: 17
11Operationoperator: 40
operand: 26
12ExprRangelambda_map: 19
start_index: 50
end_index: 48
13Operationoperator: 34
operands: 20
14Operationoperator: 34
operands: 21
15ExprRangelambda_map: 22
start_index: 50
end_index: 51
16Operationoperator: 23
operands: 24
17ExprTuple25, 38
18ExprTuple26
19Lambdaparameter: 57
body: 27
20ExprTuple45, 39
21ExprTuple38, 39
22Lambdaparameter: 57
body: 28
23Literal
24ExprTuple38, 29
25Operationoperator: 42
operands: 30
26Operationoperator: 31
operands: 32
27Operationoperator: 34
operands: 33
28Operationoperator: 34
operands: 35
29Literal
30ExprTuple44, 36, 46
31Literal
32ExprTuple37, 38
33ExprTuple52, 39
34Literal
35ExprTuple53, 39
36Operationoperator: 40
operand: 45
37Operationoperator: 42
operands: 43
38Variable
39Literal
40Literal
41ExprTuple45
42Literal
43ExprTuple44, 45, 46
44ExprRangelambda_map: 47
start_index: 50
end_index: 48
45Variable
46ExprRangelambda_map: 49
start_index: 50
end_index: 51
47Lambdaparameter: 57
body: 52
48Variable
49Lambdaparameter: 57
body: 53
50Literal
51Variable
52IndexedVarvariable: 54
index: 57
53IndexedVarvariable: 55
index: 57
54Variable
55Variable
56ExprTuple57
57Variable