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 ExprTuple, Function, Lambda, Q, f
from proveit.core_expr_types import a_1_to_i, b_1_to_j, c_1_to_k
from proveit.logic import Equals, Forall, Implies, InSet
from proveit.numbers import Complex, Mult, Sum
from proveit.numbers.summation import summation_b1toj_fQ
In [2]:
# build up the expression from sub-expressions
sub_expr1 = [b_1_to_j]
sub_expr2 = Function(f, sub_expr1)
sub_expr3 = Function(Q, sub_expr1)
expr = ExprTuple(Lambda([f, Q], Implies(Forall(instance_param_or_params = sub_expr1, instance_expr = InSet(sub_expr2, Complex), condition = sub_expr3), Forall(instance_param_or_params = [a_1_to_i, c_1_to_k], instance_expr = Equals(Mult(a_1_to_i, summation_b1toj_fQ, c_1_to_k), Sum(index_or_indices = sub_expr1, summand = Mult(a_1_to_i, sub_expr2, c_1_to_k), condition = sub_expr3)).with_wrapping_at(2), domain = Complex).with_wrapping()).with_wrapping_at(2)))
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(f, Q\right) \mapsto \left(\begin{array}{c} \begin{array}{l} \left[\forall_{b_{1}, b_{2}, \ldots, b_{j}~|~Q\left(b_{1}, b_{2}, \ldots, b_{j}\right)}~\left(f\left(b_{1}, b_{2}, \ldots, b_{j}\right) \in \mathbb{C}\right)\right] \Rightarrow  \\ \left[\begin{array}{l}\forall_{a_{1}, a_{2}, \ldots, a_{i}, c_{1}, c_{2}, \ldots, c_{k} \in \mathbb{C}}~\\
\left(\begin{array}{c} \begin{array}{l} \left(a_{1} \cdot  a_{2} \cdot  \ldots \cdot  a_{i} \cdot \left[\sum_{b_{1}, b_{2}, \ldots, b_{j}~|~Q\left(b_{1}, b_{2}, \ldots, b_{j}\right)}~f\left(b_{1}, b_{2}, \ldots, b_{j}\right)\right]\cdot c_{1} \cdot  c_{2} \cdot  \ldots \cdot  c_{k}\right) =  \\ \left[\sum_{b_{1}, b_{2}, \ldots, b_{j}~|~Q\left(b_{1}, b_{2}, \ldots, b_{j}\right)}~\left(a_{1} \cdot  a_{2} \cdot  \ldots \cdot  a_{i} \cdot f\left(b_{1}, b_{2}, \ldots, b_{j}\right)\cdot c_{1} \cdot  c_{2} \cdot  \ldots \cdot  c_{k}\right)\right] \end{array} \end{array}\right)\end{array}\right] \end{array} \end{array}\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
2ExprTuple55, 52
3Operationoperator: 4
operands: 5
4Literal
5ExprTuple6, 7
6Operationoperator: 9
operand: 11
7Operationoperator: 9
operand: 12
8ExprTuple11
9Literal
10ExprTuple12
11Lambdaparameters: 56
body: 13
12Lambdaparameters: 14
body: 15
13Conditionalvalue: 16
condition: 48
14ExprTuple49, 51
15Conditionalvalue: 17
condition: 18
16Operationoperator: 40
operands: 19
17Operationoperator: 20
operands: 21
18Operationoperator: 22
operands: 23
19ExprTuple50, 44
20Literal
21ExprTuple24, 25
22Literal
23ExprTuple26, 27
24Operationoperator: 46
operands: 28
25Operationoperator: 36
operand: 33
26ExprRangelambda_map: 30
start_index: 64
end_index: 54
27ExprRangelambda_map: 31
start_index: 64
end_index: 58
28ExprTuple49, 32, 51
29ExprTuple33
30Lambdaparameter: 70
body: 34
31Lambdaparameter: 70
body: 35
32Operationoperator: 36
operand: 42
33Lambdaparameters: 56
body: 38
34Operationoperator: 40
operands: 39
35Operationoperator: 40
operands: 41
36Literal
37ExprTuple42
38Conditionalvalue: 43
condition: 48
39ExprTuple59, 44
40Literal
41ExprTuple61, 44
42Lambdaparameters: 56
body: 45
43Operationoperator: 46
operands: 47
44Literal
45Conditionalvalue: 50
condition: 48
46Literal
47ExprTuple49, 50, 51
48Operationoperator: 52
operands: 56
49ExprRangelambda_map: 53
start_index: 64
end_index: 54
50Operationoperator: 55
operands: 56
51ExprRangelambda_map: 57
start_index: 64
end_index: 58
52Variable
53Lambdaparameter: 70
body: 59
54Variable
55Variable
56ExprTuple60
57Lambdaparameter: 70
body: 61
58Variable
59IndexedVarvariable: 62
index: 70
60ExprRangelambda_map: 63
start_index: 64
end_index: 65
61IndexedVarvariable: 66
index: 70
62Variable
63Lambdaparameter: 70
body: 67
64Literal
65Variable
66Variable
67IndexedVarvariable: 68
index: 70
68Variable
69ExprTuple70
70Variable