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
from proveit.physics.quantum.circuits import circuit__u_Akl_v__psi_m
In [2]:
# build up the expression from sub-expressions
expr = ExprTuple(circuit__u_Akl_v__psi_m)
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(\begin{array}{c} \Qcircuit@C=1em @R=.7em{
\multiqin{3}{\lvert u \rangle} & \gate{A_{1, 1}} \qwx[1] & \gate{A_{2, 1}} \qwx[1] & \gate{\cdots} \qwx[1] & \gate{A_{k, 1}} \qwx[1] & \multiqout{3}{\lvert v \rangle} \\
\ghostqin{\lvert u \rangle} & \gate{A_{1, 2}} \qwx[1] & \gate{A_{2, 2}} \qwx[1] & \gate{\cdots} \qwx[1] & \gate{A_{k, 2}} \qwx[1] & \ghostqout{\lvert v \rangle} \\
\ghostqin{\lvert u \rangle} & \gate{\vdots} \qwx[1] & \gate{\vdots} \qwx[1] & \gate{\ddots} \qwx[1] & \gate{\vdots} \qwx[1] & \ghostqout{\lvert v \rangle} \\
\ghostqin{\lvert u \rangle} & \gate{A_{1, l}} & \gate{A_{2, l}} & \gate{\cdots} & \gate{A_{k, l}} & \ghostqout{\lvert v \rangle} \\
\qin{\lvert \psi \rangle} & { /^{m} } \qw & { /^{m} } \qw & \gate{\cdots} & { /^{m} } \qw & \qout{\lvert \psi \rangle}
} \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
0ExprTuple1
1Operationoperator: 2
operands: 3
2Literal
3ExprTuple4, 5, 6
4ExprTuple7, 8
5ExprRangelambda_map: 9
start_index: 64
end_index: 10
6ExprTuple11, 12
7ExprRangelambda_map: 13
start_index: 64
end_index: 65
8ExprRangelambda_map: 14
start_index: 64
end_index: 66
9Lambdaparameter: 54
body: 16
10Variable
11ExprRangelambda_map: 17
start_index: 64
end_index: 65
12ExprRangelambda_map: 18
start_index: 64
end_index: 66
13Lambdaparameter: 58
body: 19
14Lambdaparameter: 58
body: 20
15ExprTuple54
16ExprTuple21, 22
17Lambdaparameter: 58
body: 23
18Lambdaparameter: 58
body: 24
19Operationoperator: 30
operands: 25
20Operationoperator: 30
operands: 26
21ExprRangelambda_map: 27
start_index: 64
end_index: 65
22ExprRangelambda_map: 28
start_index: 64
end_index: 66
23Operationoperator: 30
operands: 29
24Operationoperator: 30
operands: 31
25NamedExprselement: 32
targets: 38
26NamedExprselement: 33
targets: 40
27Lambdaparameter: 58
body: 34
28Lambdaparameter: 58
body: 36
29NamedExprselement: 37
targets: 38
30Literal
31NamedExprselement: 39
targets: 40
32Operationoperator: 42
operands: 41
33Operationoperator: 42
operands: 50
34IndexedVarvariable: 43
indices: 44
35ExprTuple58
36Operationoperator: 45
operands: 46
37Operationoperator: 49
operands: 47
38Operationoperator: 51
operands: 48
39Operationoperator: 49
operands: 50
40Operationoperator: 51
operands: 52
41NamedExprsstate: 53
part: 58
42Literal
43Variable
44ExprTuple54, 58
45Literal
46NamedExprsoperation: 55
47NamedExprsstate: 56
part: 58
48ExprTuple64, 65
49Literal
50NamedExprsstate: 57
part: 58
51Literal
52ExprTuple59, 60
53Variable
54Variable
55Literal
56Variable
57Variable
58Variable
59Operationoperator: 62
operands: 61
60Operationoperator: 62
operands: 63
61ExprTuple65, 64
62Literal
63ExprTuple65, 66
64Literal
65Variable
66Variable