logo

Expression of type ExprTuple

from the theory of proveit.physics.quantum.circuits

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, Lambda
from proveit.core_expr_types.expr_arrays import A11_to_Akl, A11_to_Akl_varray, B11_to_Bkl, B11_to_Bkl_varray
from proveit.logic import Implies, NotEquals
from proveit.physics.quantum.circuits import circuit_Akl, circuit_Bkl
In [2]:
# build up the expression from sub-expressions
expr = ExprTuple(Lambda([A11_to_Akl, B11_to_Bkl], Implies(NotEquals(A11_to_Akl_varray, B11_to_Bkl_varray), NotEquals(circuit_Akl, circuit_Bkl)).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(A_{1, 1}, A_{1, 2}, \ldots, A_{1, l}, A_{2, 1}, A_{2, 2}, \ldots, A_{2, l}, \ldots\ldots, A_{k, 1}, A_{k, 2}, \ldots, A_{k, l}, B_{1, 1}, B_{1, 2}, \ldots, B_{1, l}, B_{2, 1}, B_{2, 2}, \ldots, B_{2, l}, \ldots\ldots, B_{k, 1}, B_{k, 2}, \ldots, B_{k, l}\right) \mapsto \left(\begin{array}{c} \begin{array}{l} \left(\left(\begin{array}{cccc} 
 A_{1, 1} & A_{2, 1} & \cdots & A_{k, 1} \\
A_{1, 2} & A_{2, 2} & \cdots & A_{k, 2} \\
\vdots & \vdots & \ddots & \vdots \\
A_{1, l} & A_{2, l} & \cdots & A_{k, l} \\
\end{array}
\right) \neq \left(\begin{array}{cccc} 
 B_{1, 1} & B_{2, 1} & \cdots & B_{k, 1} \\
B_{1, 2} & B_{2, 2} & \cdots & B_{k, 2} \\
\vdots & \vdots & \ddots & \vdots \\
B_{1, l} & B_{2, l} & \cdots & B_{k, l} \\
\end{array}
\right)\right) \Rightarrow  \\ \left(\left(\begin{array}{c} \Qcircuit@C=1em @R=.7em{
& \gate{A_{1, 1}} \qwx[1] & \gate{A_{2, 1}} \qwx[1] & \gate{\cdots} \qwx[1] & \gate{A_{k, 1}} \qwx[1] & \qw \\
& \gate{A_{1, 2}} \qwx[1] & \gate{A_{2, 2}} \qwx[1] & \gate{\cdots} \qwx[1] & \gate{A_{k, 2}} \qwx[1] & \qw \\
& \gate{\vdots} \qwx[1] & \gate{\vdots} \qwx[1] & \gate{\ddots} \qwx[1] & \gate{\vdots} \qwx[1] & \qw \\
& \gate{A_{1, l}} & \gate{A_{2, l}} & \gate{\cdots} & \gate{A_{k, l}} & \qw
} \end{array}\right) \neq \left(\begin{array}{c} \Qcircuit@C=1em @R=.7em{
& \gate{B_{1, 1}} \qwx[1] & \gate{B_{2, 1}} \qwx[1] & \gate{\cdots} \qwx[1] & \gate{B_{k, 1}} \qwx[1] & \qw \\
& \gate{B_{1, 2}} \qwx[1] & \gate{B_{2, 2}} \qwx[1] & \gate{\cdots} \qwx[1] & \gate{B_{k, 2}} \qwx[1] & \qw \\
& \gate{\vdots} \qwx[1] & \gate{\vdots} \qwx[1] & \gate{\ddots} \qwx[1] & \gate{\vdots} \qwx[1] & \qw \\
& \gate{B_{1, l}} & \gate{B_{2, l}} & \gate{\cdots} & \gate{B_{k, l}} & \qw
} \end{array}\right)\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
2ExprTuple4, 5
3Operationoperator: 6
operands: 7
4ExprRangelambda_map: 8
start_index: 32
end_index: 24
5ExprRangelambda_map: 9
start_index: 32
end_index: 24
6Literal
7ExprTuple10, 11
8Lambdaparameter: 40
body: 28
9Lambdaparameter: 40
body: 29
10Operationoperator: 13
operands: 12
11Operationoperator: 13
operands: 14
12ExprTuple17, 19
13Literal
14ExprTuple15, 16
15Operationoperator: 18
operands: 17
16Operationoperator: 18
operands: 19
17ExprTuple20
18Literal
19ExprTuple21
20ExprRangelambda_map: 22
start_index: 32
end_index: 24
21ExprRangelambda_map: 23
start_index: 32
end_index: 24
22Lambdaparameter: 40
body: 25
23Lambdaparameter: 40
body: 27
24Variable
25ExprTuple28
26ExprTuple40
27ExprTuple29
28ExprRangelambda_map: 30
start_index: 32
end_index: 33
29ExprRangelambda_map: 31
start_index: 32
end_index: 33
30Lambdaparameter: 41
body: 34
31Lambdaparameter: 41
body: 36
32Literal
33Variable
34IndexedVarvariable: 37
indices: 39
35ExprTuple41
36IndexedVarvariable: 38
indices: 39
37Variable
38Variable
39ExprTuple40, 41
40Variable
41Variable