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
In [2]:
# build up the expression from sub-expressions
expr = ExprTuple(circuit__u_Akl_v)
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}
} \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
5ExprRangelambda_map: 8
start_index: 39
end_index: 9
6ExprTuple10
7ExprRangelambda_map: 11
start_index: 39
end_index: 40
8Lambdaparameter: 36
body: 13
9Variable
10ExprRangelambda_map: 14
start_index: 39
end_index: 40
11Lambdaparameter: 38
body: 15
12ExprTuple36
13ExprTuple16
14Lambdaparameter: 38
body: 17
15Operationoperator: 20
operands: 18
16ExprRangelambda_map: 19
start_index: 39
end_index: 40
17Operationoperator: 20
operands: 21
18NamedExprselement: 22
targets: 26
19Lambdaparameter: 38
body: 24
20Literal
21NamedExprselement: 25
targets: 26
22Operationoperator: 27
operands: 28
23ExprTuple38
24IndexedVarvariable: 29
indices: 30
25Operationoperator: 31
operands: 32
26Operationoperator: 33
operands: 34
27Literal
28NamedExprsstate: 35
part: 38
29Variable
30ExprTuple36, 38
31Literal
32NamedExprsstate: 37
part: 38
33Literal
34ExprTuple39, 40
35Variable
36Variable
37Variable
38Variable
39Literal
40Variable