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, Function, Lambda, Q, f, i, j, k
from proveit.core_expr_types import a_1_to_i, b_1_to_j, c_1_to_k
from proveit.logic import And, Equals, Forall, Implies, InSet
from proveit.numbers import Complex, Mult, Natural, NaturalPos, 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([i, j, k], Conditional(Forall(instance_param_or_params = [f, Q], instance_expr = 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)), And(InSet(i, Natural), InSet(j, NaturalPos), InSet(k, 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, k\right) \mapsto \left\{\forall_{f, Q}~\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) \textrm{ if } i \in \mathbb{N} ,  j \in \mathbb{N}^+ ,  k \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
2ExprTuple69, 80, 73
3Conditionalvalue: 4
condition: 5
4Operationoperator: 24
operand: 8
5Operationoperator: 37
operands: 7
6ExprTuple8
7ExprTuple9, 10, 11
8Lambdaparameters: 12
body: 13
9Operationoperator: 55
operands: 14
10Operationoperator: 55
operands: 15
11Operationoperator: 55
operands: 16
12ExprTuple70, 67
13Operationoperator: 17
operands: 18
14ExprTuple69, 20
15ExprTuple80, 19
16ExprTuple73, 20
17Literal
18ExprTuple21, 22
19Literal
20Literal
21Operationoperator: 24
operand: 26
22Operationoperator: 24
operand: 27
23ExprTuple26
24Literal
25ExprTuple27
26Lambdaparameters: 71
body: 28
27Lambdaparameters: 29
body: 30
28Conditionalvalue: 31
condition: 63
29ExprTuple64, 66
30Conditionalvalue: 32
condition: 33
31Operationoperator: 55
operands: 34
32Operationoperator: 35
operands: 36
33Operationoperator: 37
operands: 38
34ExprTuple65, 59
35Literal
36ExprTuple39, 40
37Literal
38ExprTuple41, 42
39Operationoperator: 61
operands: 43
40Operationoperator: 51
operand: 48
41ExprRangelambda_map: 45
start_index: 79
end_index: 69
42ExprRangelambda_map: 46
start_index: 79
end_index: 73
43ExprTuple64, 47, 66
44ExprTuple48
45Lambdaparameter: 85
body: 49
46Lambdaparameter: 85
body: 50
47Operationoperator: 51
operand: 57
48Lambdaparameters: 71
body: 53
49Operationoperator: 55
operands: 54
50Operationoperator: 55
operands: 56
51Literal
52ExprTuple57
53Conditionalvalue: 58
condition: 63
54ExprTuple74, 59
55Literal
56ExprTuple76, 59
57Lambdaparameters: 71
body: 60
58Operationoperator: 61
operands: 62
59Literal
60Conditionalvalue: 65
condition: 63
61Literal
62ExprTuple64, 65, 66
63Operationoperator: 67
operands: 71
64ExprRangelambda_map: 68
start_index: 79
end_index: 69
65Operationoperator: 70
operands: 71
66ExprRangelambda_map: 72
start_index: 79
end_index: 73
67Variable
68Lambdaparameter: 85
body: 74
69Variable
70Variable
71ExprTuple75
72Lambdaparameter: 85
body: 76
73Variable
74IndexedVarvariable: 77
index: 85
75ExprRangelambda_map: 78
start_index: 79
end_index: 80
76IndexedVarvariable: 81
index: 85
77Variable
78Lambdaparameter: 85
body: 82
79Literal
80Variable
81Variable
82IndexedVarvariable: 83
index: 85
83Variable
84ExprTuple85
85Variable