logo

Expression of type Lambda

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 Lambda
from proveit.core_expr_types import A_1_to_j, B_1_to_k, C_1_to_l, D_1_to_m
from proveit.logic import Implies
from proveit.physics.quantum.circuits import QcircuitEquiv, circuit_AjBkCl, circuit_AjDmCl, circuit_Bk, circuit_Dm
In [2]:
# build up the expression from sub-expressions
expr = Lambda([A_1_to_j, B_1_to_k, C_1_to_l, D_1_to_m], Implies(QcircuitEquiv(circuit_Bk, circuit_Dm), QcircuitEquiv(circuit_AjBkCl, circuit_AjDmCl).with_wrapping_at(1)).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(A_{1}, A_{2}, \ldots, A_{j}, B_{1}, B_{2}, \ldots, B_{k}, C_{1}, C_{2}, \ldots, C_{l}, D_{1}, D_{2}, \ldots, D_{m}\right) \mapsto \left(\begin{array}{c} \begin{array}{l} \left(\left(\begin{array}{c} \Qcircuit@C=1em @R=.7em{
& \gate{\begin{array}{c} \uparrow \\B_{1} \\ \downarrow\end{array}} & \gate{\begin{array}{c} \uparrow \\B_{2} \\ \downarrow\end{array}} & \gate{\begin{array}{c} \uparrow \\\cdots \\ \downarrow\end{array}} & \gate{\begin{array}{c} \uparrow \\B_{k} \\ \downarrow\end{array}} & \qw
} \end{array}\right) \cong \left(\begin{array}{c} \Qcircuit@C=1em @R=.7em{
& \gate{\begin{array}{c} \uparrow \\D_{1} \\ \downarrow\end{array}} & \gate{\begin{array}{c} \uparrow \\D_{2} \\ \downarrow\end{array}} & \gate{\begin{array}{c} \uparrow \\\cdots \\ \downarrow\end{array}} & \gate{\begin{array}{c} \uparrow \\D_{m} \\ \downarrow\end{array}} & \qw
} \end{array}\right)\right) \Rightarrow  \\ \left(\begin{array}{c} \begin{array}{l} \left(\begin{array}{c} \Qcircuit@C=1em @R=.7em{
& \gate{\begin{array}{c} \uparrow \\A_{1} \\ \downarrow\end{array}} & \gate{\begin{array}{c} \uparrow \\A_{2} \\ \downarrow\end{array}} & \gate{\begin{array}{c} \uparrow \\\cdots \\ \downarrow\end{array}} & \gate{\begin{array}{c} \uparrow \\A_{j} \\ \downarrow\end{array}} & \gate{\begin{array}{c} \uparrow \\B_{1} \\ \downarrow\end{array}} & \gate{\begin{array}{c} \uparrow \\B_{2} \\ \downarrow\end{array}} & \gate{\begin{array}{c} \uparrow \\\cdots \\ \downarrow\end{array}} & \gate{\begin{array}{c} \uparrow \\B_{k} \\ \downarrow\end{array}} & \gate{\begin{array}{c} \uparrow \\C_{1} \\ \downarrow\end{array}} & \gate{\begin{array}{c} \uparrow \\C_{2} \\ \downarrow\end{array}} & \gate{\begin{array}{c} \uparrow \\\cdots \\ \downarrow\end{array}} & \gate{\begin{array}{c} \uparrow \\C_{l} \\ \downarrow\end{array}} & \qw
} \end{array}\right) \\  \cong \left(\begin{array}{c} \Qcircuit@C=1em @R=.7em{
& \gate{\begin{array}{c} \uparrow \\A_{1} \\ \downarrow\end{array}} & \gate{\begin{array}{c} \uparrow \\A_{2} \\ \downarrow\end{array}} & \gate{\begin{array}{c} \uparrow \\\cdots \\ \downarrow\end{array}} & \gate{\begin{array}{c} \uparrow \\A_{j} \\ \downarrow\end{array}} & \gate{\begin{array}{c} \uparrow \\D_{1} \\ \downarrow\end{array}} & \gate{\begin{array}{c} \uparrow \\D_{2} \\ \downarrow\end{array}} & \gate{\begin{array}{c} \uparrow \\\cdots \\ \downarrow\end{array}} & \gate{\begin{array}{c} \uparrow \\D_{m} \\ \downarrow\end{array}} & \gate{\begin{array}{c} \uparrow \\C_{1} \\ \downarrow\end{array}} & \gate{\begin{array}{c} \uparrow \\C_{2} \\ \downarrow\end{array}} & \gate{\begin{array}{c} \uparrow \\\cdots \\ \downarrow\end{array}} & \gate{\begin{array}{c} \uparrow \\C_{l} \\ \downarrow\end{array}} & \qw
} \end{array}\right) \end{array} \end{array}\right) \end{array} \end{array}\right)
In [5]:
stored_expr.style_options()
no style options
In [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0Lambdaparameters: 1
body: 2
1ExprTuple20, 19, 22, 21
2Operationoperator: 3
operands: 4
3Literal
4ExprTuple5, 6
5Operationoperator: 8
operands: 7
6Operationoperator: 8
operands: 9
7ExprTuple10, 11
8Literal
9ExprTuple12, 13
10Operationoperator: 17
operands: 14
11Operationoperator: 17
operands: 15
12Operationoperator: 17
operands: 16
13Operationoperator: 17
operands: 18
14ExprTuple19
15ExprTuple21
16ExprTuple20, 19, 22
17Literal
18ExprTuple20, 21, 22
19ExprRangelambda_map: 23
start_index: 30
end_index: 24
20ExprRangelambda_map: 25
start_index: 30
end_index: 26
21ExprRangelambda_map: 27
start_index: 30
end_index: 28
22ExprRangelambda_map: 29
start_index: 30
end_index: 31
23Lambdaparameter: 41
body: 32
24Variable
25Lambdaparameter: 41
body: 33
26Variable
27Lambdaparameter: 41
body: 34
28Variable
29Lambdaparameter: 41
body: 35
30Literal
31Variable
32IndexedVarvariable: 36
index: 41
33IndexedVarvariable: 37
index: 41
34IndexedVarvariable: 38
index: 41
35IndexedVarvariable: 39
index: 41
36Variable
37Variable
38Variable
39Variable
40ExprTuple41
41Variable