logo

Expression of type ExprTuple

from the theory of proveit.physics.quantum.algebra

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, Q, f, j, m, n
from proveit.core_expr_types import A_1_to_m, C_1_to_n, Q__b_1_to_j, b_1_to_j, f__b_1_to_j
from proveit.linear_algebra import VecSum
from proveit.linear_algebra.addition import vec_summation_b1toj_fQ
from proveit.logic import And, Equals, Forall, Implies, InClass, InSet
from proveit.numbers import Natural, NaturalPos
from proveit.physics.quantum import Qmult, QmultCodomain
In [2]:
# build up the expression from sub-expressions
sub_expr1 = Qmult(A_1_to_m, vec_summation_b1toj_fQ, C_1_to_n)
expr = ExprTuple(Lambda([j, m, n], Conditional(Forall(instance_param_or_params = [A_1_to_m, C_1_to_n, f, Q], instance_expr = Implies(InClass(sub_expr1, QmultCodomain), Equals(sub_expr1, VecSum(index_or_indices = [b_1_to_j], summand = Qmult(A_1_to_m, f__b_1_to_j, C_1_to_n), condition = Q__b_1_to_j)).with_wrapping_at(1)).with_wrapping_at(2)), And(InSet(j, NaturalPos), InSet(m, Natural), InSet(n, 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(j, m, n\right) \mapsto \left\{\forall_{A_{1}, A_{2}, \ldots, A_{m}, C_{1}, C_{2}, \ldots, C_{n}, f, Q}~\left(\begin{array}{c} \begin{array}{l} \left(\left(A_{1} \thinspace  A_{2} \thinspace  \ldots \thinspace  A_{m} \thinspace \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]\thinspace C_{1} \thinspace  C_{2} \thinspace  \ldots \thinspace  C_{n}\right) \underset{{\scriptscriptstyle c}}{\in} \mathcal{Q^*}\right) \Rightarrow  \\ \left(\begin{array}{c} \begin{array}{l} \left(A_{1} \thinspace  A_{2} \thinspace  \ldots \thinspace  A_{m} \thinspace \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]\thinspace C_{1} \thinspace  C_{2} \thinspace  \ldots \thinspace  C_{n}\right) \\  = \left[\sum_{b_{1}, b_{2}, \ldots, b_{j}~|~Q\left(b_{1}, b_{2}, \ldots, b_{j}\right)}~\left(A_{1} \thinspace  A_{2} \thinspace  \ldots \thinspace  A_{m} \thinspace f\left(b_{1}, b_{2}, \ldots, b_{j}\right)\thinspace C_{1} \thinspace  C_{2} \thinspace  \ldots \thinspace  C_{n}\right)\right] \end{array} \end{array}\right) \end{array} \end{array}\right) \textrm{ if } j \in \mathbb{N}^+ ,  m \in \mathbb{N} ,  n \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
2ExprTuple62, 51, 55
3Conditionalvalue: 4
condition: 5
4Operationoperator: 6
operand: 10
5Operationoperator: 8
operands: 9
6Literal
7ExprTuple10
8Literal
9ExprTuple11, 12, 13
10Lambdaparameters: 14
body: 15
11Operationoperator: 18
operands: 16
12Operationoperator: 18
operands: 17
13Operationoperator: 18
operands: 19
14ExprTuple46, 48, 52, 49
15Operationoperator: 20
operands: 21
16ExprTuple62, 22
17ExprTuple51, 23
18Literal
19ExprTuple55, 23
20Literal
21ExprTuple24, 25
22Literal
23Literal
24Operationoperator: 26
operands: 27
25Operationoperator: 28
operands: 29
26Literal
27ExprTuple31, 30
28Literal
29ExprTuple31, 32
30Literal
31Operationoperator: 43
operands: 33
32Operationoperator: 37
operand: 36
33ExprTuple46, 35, 48
34ExprTuple36
35Operationoperator: 37
operand: 40
36Lambdaparameters: 53
body: 39
37Literal
38ExprTuple40
39Conditionalvalue: 41
condition: 45
40Lambdaparameters: 53
body: 42
41Operationoperator: 43
operands: 44
42Conditionalvalue: 47
condition: 45
43Literal
44ExprTuple46, 47, 48
45Operationoperator: 49
operands: 53
46ExprRangelambda_map: 50
start_index: 61
end_index: 51
47Operationoperator: 52
operands: 53
48ExprRangelambda_map: 54
start_index: 61
end_index: 55
49Variable
50Lambdaparameter: 67
body: 56
51Variable
52Variable
53ExprTuple57
54Lambdaparameter: 67
body: 58
55Variable
56IndexedVarvariable: 59
index: 67
57ExprRangelambda_map: 60
start_index: 61
end_index: 62
58IndexedVarvariable: 63
index: 67
59Variable
60Lambdaparameter: 67
body: 64
61Literal
62Variable
63Variable
64IndexedVarvariable: 65
index: 67
65Variable
66ExprTuple67
67Variable