logo

Expression of type ExprTuple

from the theory of proveit.numbers.multiplication

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, i, j, x, y
from proveit.core_expr_types import a_1_to_i, b_1_to_j
from proveit.logic import And, Equals, Forall, InSet
from proveit.numbers import Complex, Mult, Natural, subtract
In [2]:
# build up the expression from sub-expressions
expr = ExprTuple(Lambda([i, j], Conditional(Forall(instance_param_or_params = [a_1_to_i, x, y, b_1_to_j], instance_expr = Equals(Mult(a_1_to_i, subtract(x, y), b_1_to_j), subtract(Mult(a_1_to_i, x, b_1_to_j), Mult(a_1_to_i, y, b_1_to_j))).with_wrapping_at(2), domain = Complex), And(InSet(i, Natural), InSet(j, Natural)))))
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(i, j\right) \mapsto \left\{\forall_{a_{1}, a_{2}, \ldots, a_{i}, x, y, b_{1}, b_{2}, \ldots, b_{j} \in \mathbb{C}}~\left(\begin{array}{c} \begin{array}{l} \left(a_{1} \cdot  a_{2} \cdot  \ldots \cdot  a_{i} \cdot \left(x - y\right)\cdot b_{1} \cdot  b_{2} \cdot  \ldots \cdot  b_{j}\right) =  \\ \left(\left(a_{1} \cdot  a_{2} \cdot  \ldots \cdot  a_{i} \cdot x\cdot b_{1} \cdot  b_{2} \cdot  \ldots \cdot  b_{j}\right) - \left(a_{1} \cdot  a_{2} \cdot  \ldots \cdot  a_{i} \cdot y\cdot b_{1} \cdot  b_{2} \cdot  \ldots \cdot  b_{j}\right)\right) \end{array} \end{array}\right) \textrm{ if } i \in \mathbb{N} ,  j \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
2ExprTuple59, 62
3Conditionalvalue: 4
condition: 5
4Operationoperator: 6
operand: 9
5Operationoperator: 21
operands: 8
6Literal
7ExprTuple9
8ExprTuple10, 11
9Lambdaparameters: 12
body: 13
10Operationoperator: 45
operands: 14
11Operationoperator: 45
operands: 15
12ExprTuple55, 48, 56, 57
13Conditionalvalue: 16
condition: 17
14ExprTuple59, 18
15ExprTuple62, 18
16Operationoperator: 19
operands: 20
17Operationoperator: 21
operands: 22
18Literal
19Literal
20ExprTuple23, 24
21Literal
22ExprTuple25, 26, 27, 28
23Operationoperator: 53
operands: 29
24Operationoperator: 40
operands: 30
25ExprRangelambda_map: 31
start_index: 61
end_index: 59
26Operationoperator: 45
operands: 32
27Operationoperator: 45
operands: 33
28ExprRangelambda_map: 34
start_index: 61
end_index: 62
29ExprTuple55, 35, 57
30ExprTuple36, 37
31Lambdaparameter: 68
body: 38
32ExprTuple48, 50
33ExprTuple56, 50
34Lambdaparameter: 68
body: 39
35Operationoperator: 40
operands: 41
36Operationoperator: 53
operands: 42
37Operationoperator: 51
operand: 49
38Operationoperator: 45
operands: 44
39Operationoperator: 45
operands: 46
40Literal
41ExprTuple48, 47
42ExprTuple55, 48, 57
43ExprTuple49
44ExprTuple63, 50
45Literal
46ExprTuple64, 50
47Operationoperator: 51
operand: 56
48Variable
49Operationoperator: 53
operands: 54
50Literal
51Literal
52ExprTuple56
53Literal
54ExprTuple55, 56, 57
55ExprRangelambda_map: 58
start_index: 61
end_index: 59
56Variable
57ExprRangelambda_map: 60
start_index: 61
end_index: 62
58Lambdaparameter: 68
body: 63
59Variable
60Lambdaparameter: 68
body: 64
61Literal
62Variable
63IndexedVarvariable: 65
index: 68
64IndexedVarvariable: 66
index: 68
65Variable
66Variable
67ExprTuple68
68Variable