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, ExprRange, ExprTuple, IndexedVar, Lambda, Variable, a, b, c, i, j
from proveit.core_expr_types import a_1_to_i, c_1_to_j
from proveit.logic import And, Equals, InSet
from proveit.numbers import Complex, Mult, Neg, one
In [2]:
# build up the expression from sub-expressions
sub_expr1 = Variable("_a", latex_format = r"{_{-}a}")
expr = ExprTuple(Lambda([a_1_to_i, b, c_1_to_j], Conditional(Equals(Mult(a_1_to_i, Neg(b), c_1_to_j), Neg(Mult(a_1_to_i, b, c_1_to_j))), And(ExprRange(sub_expr1, InSet(IndexedVar(a, sub_expr1), Complex), one, i), InSet(b, Complex), ExprRange(sub_expr1, InSet(IndexedVar(c, sub_expr1), Complex), one, j)))))
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(a_{1}, a_{2}, \ldots, a_{i}, b, c_{1}, c_{2}, \ldots, c_{j}\right) \mapsto \left\{\left(a_{1} \cdot  a_{2} \cdot  \ldots \cdot  a_{i} \cdot \left(-b\right)\cdot c_{1} \cdot  c_{2} \cdot  \ldots \cdot  c_{j}\right) = \left(-\left(a_{1} \cdot  a_{2} \cdot  \ldots \cdot  a_{i} \cdot b\cdot c_{1} \cdot  c_{2} \cdot  \ldots \cdot  c_{j}\right)\right) \textrm{ if } \left(a_{1} \in \mathbb{C}\right) ,  \left(a_{2} \in \mathbb{C}\right) ,  \ldots ,  \left(a_{i} \in \mathbb{C}\right) ,  b \in \mathbb{C}, \left(c_{1} \in \mathbb{C}\right) ,  \left(c_{2} \in \mathbb{C}\right) ,  \ldots ,  \left(c_{j} \in \mathbb{C}\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: 26
body: 2
2Conditionalvalue: 3
condition: 4
3Operationoperator: 5
operands: 6
4Operationoperator: 7
operands: 8
5Literal
6ExprTuple9, 10
7Literal
8ExprTuple11, 12, 13
9Operationoperator: 25
operands: 14
10Operationoperator: 23
operand: 20
11ExprRangelambda_map: 16
start_index: 37
end_index: 35
12Operationoperator: 28
operands: 17
13ExprRangelambda_map: 18
start_index: 37
end_index: 38
14ExprTuple30, 19, 32
15ExprTuple20
16Lambdaparameter: 44
body: 21
17ExprTuple31, 33
18Lambdaparameter: 44
body: 22
19Operationoperator: 23
operand: 31
20Operationoperator: 25
operands: 26
21Operationoperator: 28
operands: 27
22Operationoperator: 28
operands: 29
23Literal
24ExprTuple31
25Literal
26ExprTuple30, 31, 32
27ExprTuple39, 33
28Literal
29ExprTuple40, 33
30ExprRangelambda_map: 34
start_index: 37
end_index: 35
31Variable
32ExprRangelambda_map: 36
start_index: 37
end_index: 38
33Literal
34Lambdaparameter: 44
body: 39
35Variable
36Lambdaparameter: 44
body: 40
37Literal
38Variable
39IndexedVarvariable: 41
index: 44
40IndexedVarvariable: 42
index: 44
41Variable
42Variable
43ExprTuple44
44Variable