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, ExprTuple, Lambda, m, n, x, y
from proveit.core_expr_types import w_1_to_m, z_1_to_n
from proveit.logic import And, Equals, Forall, InSet, NotEquals
from proveit.numbers import Complex, Mult, NaturalPos, frac, zero
In [2]:
# build up the expression from sub-expressions
expr = ExprTuple(Lambda([m, n], Conditional(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)), And(InSet(m, NaturalPos), InSet(n, NaturalPos)))))
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(\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) \textrm{ if } m \in \mathbb{N}^+ ,  n \in \mathbb{N}^+\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
2ExprTuple56, 59
3Conditionalvalue: 4
condition: 5
4Operationoperator: 6
operand: 9
5Operationoperator: 21
operands: 8
6Literal
7ExprTuple9
8ExprTuple10, 11
9Lambdaparameters: 12
body: 13
10Operationoperator: 48
operands: 14
11Operationoperator: 48
operands: 15
12ExprTuple51, 52, 50, 53
13Conditionalvalue: 16
condition: 17
14ExprTuple56, 18
15ExprTuple59, 18
16Operationoperator: 19
operands: 20
17Operationoperator: 21
operands: 22
18Literal
19Literal
20ExprTuple23, 24
21Literal
22ExprTuple25, 26, 27, 28, 29
23Operationoperator: 45
operands: 30
24Operationoperator: 43
operands: 31
25ExprRangelambda_map: 32
start_index: 58
end_index: 56
26Operationoperator: 48
operands: 33
27Operationoperator: 48
operands: 34
28ExprRangelambda_map: 35
start_index: 58
end_index: 59
29Operationoperator: 36
operands: 37
30ExprTuple51, 38, 53
31ExprTuple39, 50
32Lambdaparameter: 65
body: 40
33ExprTuple52, 54
34ExprTuple50, 54
35Lambdaparameter: 65
body: 41
36Literal
37ExprTuple50, 42
38Operationoperator: 43
operands: 44
39Operationoperator: 45
operands: 46
40Operationoperator: 48
operands: 47
41Operationoperator: 48
operands: 49
42Literal
43Literal
44ExprTuple52, 50
45Literal
46ExprTuple51, 52, 53
47ExprTuple60, 54
48Literal
49ExprTuple61, 54
50Variable
51ExprRangelambda_map: 55
start_index: 58
end_index: 56
52Variable
53ExprRangelambda_map: 57
start_index: 58
end_index: 59
54Literal
55Lambdaparameter: 65
body: 60
56Variable
57Lambdaparameter: 65
body: 61
58Literal
59Variable
60IndexedVarvariable: 62
index: 65
61IndexedVarvariable: 63
index: 65
62Variable
63Variable
64ExprTuple65
65Variable