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, b, i, j
from proveit.core_expr_types import a_1_to_i, c_1_to_j
from proveit.logic import And, Equals, Forall, InSet
from proveit.numbers import Complex, Mult, Natural, Neg
In [2]:
# build up the expression from sub-expressions
expr = ExprTuple(Lambda([i, j], Conditional(Forall(instance_param_or_params = [a_1_to_i, b, c_1_to_j], instance_expr = Equals(Neg(Mult(a_1_to_i, Neg(b), c_1_to_j)), Mult(a_1_to_i, b, c_1_to_j)), 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}, b, c_{1}, c_{2}, \ldots, c_{j} \in \mathbb{C}}~\left(\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)\right) = \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 } 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
2ExprTuple45, 50
3Conditionalvalue: 4
condition: 5
4Operationoperator: 6
operand: 9
5Operationoperator: 20
operands: 8
6Literal
7ExprTuple9
8ExprTuple10, 11
9Lambdaparameters: 28
body: 12
10Operationoperator: 38
operands: 13
11Operationoperator: 38
operands: 14
12Conditionalvalue: 15
condition: 16
13ExprTuple45, 17
14ExprTuple50, 17
15Operationoperator: 18
operands: 19
16Operationoperator: 20
operands: 21
17Literal
18Literal
19ExprTuple22, 23
20Literal
21ExprTuple24, 25, 26
22Operationoperator: 46
operand: 32
23Operationoperator: 35
operands: 28
24ExprRangelambda_map: 29
start_index: 49
end_index: 45
25Operationoperator: 38
operands: 30
26ExprRangelambda_map: 31
start_index: 49
end_index: 50
27ExprTuple32
28ExprTuple40, 52, 42
29Lambdaparameter: 57
body: 33
30ExprTuple52, 43
31Lambdaparameter: 57
body: 34
32Operationoperator: 35
operands: 36
33Operationoperator: 38
operands: 37
34Operationoperator: 38
operands: 39
35Literal
36ExprTuple40, 41, 42
37ExprTuple51, 43
38Literal
39ExprTuple53, 43
40ExprRangelambda_map: 44
start_index: 49
end_index: 45
41Operationoperator: 46
operand: 52
42ExprRangelambda_map: 48
start_index: 49
end_index: 50
43Literal
44Lambdaparameter: 57
body: 51
45Variable
46Literal
47ExprTuple52
48Lambdaparameter: 57
body: 53
49Literal
50Variable
51IndexedVarvariable: 54
index: 57
52Variable
53IndexedVarvariable: 55
index: 57
54Variable
55Variable
56ExprTuple57
57Variable