logo

Expression of type ExprTuple

from the theory of proveit.physics.quantum.QPE

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.QPE import _phase_est_circuit
In [2]:
# build up the expression from sub-expressions
expr = ExprTuple(_phase_est_circuit)
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{
\qin{\lvert + \rangle} & \multigate{4}{\textrm{QPE}\left(U, t\right)} & \meter & \multiqout{3}{\lvert m \rangle_{t}} \\
\qin{\lvert + \rangle} & \ghost{\textrm{QPE}\left(U, t\right)} & \meter & \ghostqout{\lvert m \rangle_{t}} \\
\qin{\begin{array}{c}:\\ \left(t - 3\right) \times \\:\end{array}} & \ghost{\textrm{QPE}\left(U, t\right)} & \measure{\begin{array}{c}:\\ \left(t - 3\right) \times \\:\end{array}} \qw & \ghostqout{\lvert m \rangle_{t}} \\
\qin{\lvert + \rangle} & \ghost{\textrm{QPE}\left(U, t\right)} & \meter & \ghostqout{\lvert m \rangle_{t}} \\
\qin{\lvert u \rangle} & \ghost{\textrm{QPE}\left(U, t\right)} & { /^{s} } \qw & \qout{\lvert u \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, 7
4ExprTuple8, 9
5ExprTuple10, 11
6ExprTuple12, 13
7ExprTuple14, 15
8ExprRangelambda_map: 16
start_index: 78
end_index: 79
9ExprRangelambda_map: 17
start_index: 78
end_index: 80
10ExprRangelambda_map: 18
start_index: 78
end_index: 79
11ExprRangelambda_map: 18
start_index: 67
end_index: 68
12ExprRangelambda_map: 19
start_index: 78
end_index: 79
13ExprRangelambda_map: 20
start_index: 78
end_index: 80
14ExprRangelambda_map: 21
start_index: 78
end_index: 79
15ExprRangelambda_map: 22
start_index: 78
end_index: 80
16Lambdaparameter: 66
body: 23
17Lambdaparameter: 66
body: 24
18Lambdaparameter: 66
body: 25
19Lambdaparameter: 66
body: 26
20Lambdaparameter: 66
body: 27
21Lambdaparameter: 66
body: 28
22Lambdaparameter: 66
body: 30
23Operationoperator: 52
operands: 31
24Operationoperator: 38
operands: 32
25Operationoperator: 38
operands: 33
26Operationoperator: 34
operands: 35
27Operationoperator: 53
operands: 36
28Operationoperator: 38
operands: 37
29ExprTuple66
30Operationoperator: 38
operands: 39
31NamedExprsstate: 40
32NamedExprselement: 41
targets: 49
33NamedExprselement: 42
targets: 43
34Literal
35NamedExprsbasis: 44
36NamedExprsoperation: 45
37NamedExprselement: 46
targets: 47
38Literal
39NamedExprselement: 48
targets: 49
40Operationoperator: 50
operand: 62
41Operationoperator: 52
operands: 59
42Operationoperator: 53
operands: 54
43Operationoperator: 60
operands: 55
44Literal
45Literal
46Operationoperator: 58
operands: 56
47Operationoperator: 60
operands: 57
48Operationoperator: 58
operands: 59
49Operationoperator: 60
operands: 61
50Literal
51ExprTuple62
52Literal
53Literal
54NamedExprsoperation: 63
part: 66
55ExprTuple78, 68
56NamedExprsstate: 64
part: 66
57ExprTuple78, 79
58Literal
59NamedExprsstate: 65
part: 66
60Literal
61ExprTuple67, 68
62Literal
63Operationoperator: 69
operands: 70
64Operationoperator: 71
operands: 72
65Literal
66Variable
67Operationoperator: 74
operands: 73
68Operationoperator: 74
operands: 75
69Literal
70ExprTuple76, 79
71Literal
72ExprTuple77, 79
73ExprTuple79, 78
74Literal
75ExprTuple79, 80
76Literal
77Variable
78Literal
79Literal
80Literal