# 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.
# import Expression classes needed to build the expression
from proveit import Lambda, m
from proveit.physics.quantum.QPE import _phase_est_circuit

In [2]:
# build up the expression from sub-expressions
expr = Lambda(m, _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())

m \mapsto \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
0Lambdaparameter: 78
body: 2
1ExprTuple78
2Operationoperator: 3
operands: 4
3Literal
4ExprTuple5, 6, 7, 8
5ExprTuple9, 10
6ExprTuple11, 12
7ExprTuple13, 14
8ExprTuple15, 16
9ExprRangelambda_map: 17
start_index: 79
end_index: 80
10ExprRangelambda_map: 18
start_index: 79
end_index: 81
11ExprRangelambda_map: 19
start_index: 79
end_index: 80
12ExprRangelambda_map: 19
start_index: 68
end_index: 69
13ExprRangelambda_map: 20
start_index: 79
end_index: 80
14ExprRangelambda_map: 21
start_index: 79
end_index: 81
15ExprRangelambda_map: 22
start_index: 79
end_index: 80
16ExprRangelambda_map: 23
start_index: 79
end_index: 81
17Lambdaparameter: 67
body: 24
18Lambdaparameter: 67
body: 25
19Lambdaparameter: 67
body: 26
20Lambdaparameter: 67
body: 27
21Lambdaparameter: 67
body: 28
22Lambdaparameter: 67
body: 29
23Lambdaparameter: 67
body: 31
24Operationoperator: 53
operands: 32
25Operationoperator: 39
operands: 33
26Operationoperator: 39
operands: 34
27Operationoperator: 35
operands: 36
28Operationoperator: 54
operands: 37
29Operationoperator: 39
operands: 38
30ExprTuple67
31Operationoperator: 39
operands: 40
33NamedExprselement: 42
targets: 50
34NamedExprselement: 43
targets: 44
35Literal
36NamedExprsbasis: 45
37NamedExprsoperation: 46
38NamedExprselement: 47
targets: 48
39Literal
40NamedExprselement: 49
targets: 50
41Operationoperator: 51
operand: 63
42Operationoperator: 53
operands: 60
43Operationoperator: 54
operands: 55
44Operationoperator: 61
operands: 56
45Literal
46Literal
47Operationoperator: 59
operands: 57
48Operationoperator: 61
operands: 58
49Operationoperator: 59
operands: 60
50Operationoperator: 61
operands: 62
51Literal
52ExprTuple63
53Literal
54Literal
55NamedExprsoperation: 64
part: 67
56ExprTuple79, 69
part: 67
58ExprTuple79, 80
59Literal
part: 67
61Literal
62ExprTuple68, 69
63Literal
64Operationoperator: 70
operands: 71
65Operationoperator: 72
operands: 73
66Literal
67Variable
68Operationoperator: 75
operands: 74
69Operationoperator: 75
operands: 76
70Literal
71ExprTuple77, 80
72Literal
73ExprTuple78, 80
74ExprTuple80, 79
75Literal
76ExprTuple80, 81
77Literal
78Variable
79Literal
80Literal
81Literal