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, 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(Mult(w_1_to_m, frac(x, y), z_1_to_n), 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\{\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} \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
2ExprTuple38, 39, 37, 40
3Conditionalvalue: 4
condition: 5
4Operationoperator: 6
operands: 7
5Operationoperator: 8
operands: 9
6Literal
7ExprTuple10, 11
8Literal
9ExprTuple12, 13, 14, 15, 16
10Operationoperator: 32
operands: 17
11Operationoperator: 30
operands: 18
12ExprRangelambda_map: 19
start_index: 45
end_index: 43
13Operationoperator: 35
operands: 20
14Operationoperator: 35
operands: 21
15ExprRangelambda_map: 22
start_index: 45
end_index: 46
16Operationoperator: 23
operands: 24
17ExprTuple38, 25, 40
18ExprTuple26, 37
19Lambdaparameter: 52
body: 27
20ExprTuple39, 41
21ExprTuple37, 41
22Lambdaparameter: 52
body: 28
23Literal
24ExprTuple37, 29
25Operationoperator: 30
operands: 31
26Operationoperator: 32
operands: 33
27Operationoperator: 35
operands: 34
28Operationoperator: 35
operands: 36
29Literal
30Literal
31ExprTuple39, 37
32Literal
33ExprTuple38, 39, 40
34ExprTuple47, 41
35Literal
36ExprTuple48, 41
37Variable
38ExprRangelambda_map: 42
start_index: 45
end_index: 43
39Variable
40ExprRangelambda_map: 44
start_index: 45
end_index: 46
41Literal
42Lambdaparameter: 52
body: 47
43Variable
44Lambdaparameter: 52
body: 48
45Literal
46Variable
47IndexedVarvariable: 49
index: 52
48IndexedVarvariable: 50
index: 52
49Variable
50Variable
51ExprTuple52
52Variable