logo

Expression of type Prob

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.physics.quantum.QPE import _phase_est_circuit
from proveit.statistics import Prob
In [2]:
# build up the expression from sub-expressions
expr = Prob(_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())
\textrm{Pr}\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
0Operationoperator: 1
operand: 3
1Literal
2ExprTuple3
3Operationoperator: 4
operands: 5
4Literal
5ExprTuple6, 7, 8, 9
6ExprTuple10, 11
7ExprTuple12, 13
8ExprTuple14, 15
9ExprTuple16, 17
10ExprRangelambda_map: 18
start_index: 80
end_index: 81
11ExprRangelambda_map: 19
start_index: 80
end_index: 82
12ExprRangelambda_map: 20
start_index: 80
end_index: 81
13ExprRangelambda_map: 20
start_index: 69
end_index: 70
14ExprRangelambda_map: 21
start_index: 80
end_index: 81
15ExprRangelambda_map: 22
start_index: 80
end_index: 82
16ExprRangelambda_map: 23
start_index: 80
end_index: 81
17ExprRangelambda_map: 24
start_index: 80
end_index: 82
18Lambdaparameter: 68
body: 25
19Lambdaparameter: 68
body: 26
20Lambdaparameter: 68
body: 27
21Lambdaparameter: 68
body: 28
22Lambdaparameter: 68
body: 29
23Lambdaparameter: 68
body: 30
24Lambdaparameter: 68
body: 32
25Operationoperator: 54
operands: 33
26Operationoperator: 40
operands: 34
27Operationoperator: 40
operands: 35
28Operationoperator: 36
operands: 37
29Operationoperator: 55
operands: 38
30Operationoperator: 40
operands: 39
31ExprTuple68
32Operationoperator: 40
operands: 41
33NamedExprsstate: 42
34NamedExprselement: 43
targets: 51
35NamedExprselement: 44
targets: 45
36Literal
37NamedExprsbasis: 46
38NamedExprsoperation: 47
39NamedExprselement: 48
targets: 49
40Literal
41NamedExprselement: 50
targets: 51
42Operationoperator: 52
operand: 64
43Operationoperator: 54
operands: 61
44Operationoperator: 55
operands: 56
45Operationoperator: 62
operands: 57
46Literal
47Literal
48Operationoperator: 60
operands: 58
49Operationoperator: 62
operands: 59
50Operationoperator: 60
operands: 61
51Operationoperator: 62
operands: 63
52Literal
53ExprTuple64
54Literal
55Literal
56NamedExprsoperation: 65
part: 68
57ExprTuple80, 70
58NamedExprsstate: 66
part: 68
59ExprTuple80, 81
60Literal
61NamedExprsstate: 67
part: 68
62Literal
63ExprTuple69, 70
64Literal
65Operationoperator: 71
operands: 72
66Operationoperator: 73
operands: 74
67Literal
68Variable
69Operationoperator: 76
operands: 75
70Operationoperator: 76
operands: 77
71Literal
72ExprTuple78, 81
73Literal
74ExprTuple79, 81
75ExprTuple81, 80
76Literal
77ExprTuple81, 82
78Literal
79Variable
80Literal
81Literal
82Literal