logo

Expression of type Equals

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 Lambda, m
from proveit.logic import Equals, Image
from proveit.physics.quantum.QPE import _Omega, _m_domain, _phase_est_circuit
In [2]:
# build up the expression from sub-expressions
expr = Equals(Image(Lambda(m, _phase_est_circuit), _m_domain), _Omega)
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[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)\right]^{\rightarrow}(\{0~\ldotp \ldotp~2^{t} - 1\}) = \Omega
In [5]:
stored_expr.style_options()
namedescriptiondefaultcurrent valuerelated methods
operation'infix' or 'function' style formattinginfixinfix
wrap_positionsposition(s) at which wrapping is to occur; '2 n - 1' is after the nth operand, '2 n' is after the nth operation.()()('with_wrapping_at', 'with_wrap_before_operator', 'with_wrap_after_operator', 'without_wrapping', 'wrap_positions')
justificationif any wrap positions are set, justify to the 'left', 'center', or 'right'centercenter('with_justification',)
directionDirection of the relation (normal or reversed)normalnormal('with_direction_reversed', 'is_reversed')
In [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0Operationoperator: 1
operands: 2
1Literal
2ExprTuple3, 4
3Operationoperator: 5
operands: 6
4Literal
5Literal
6ExprTuple7, 8
7Lambdaparameter: 97
body: 10
8Operationoperator: 80
operands: 11
9ExprTuple97
10Operationoperator: 12
operands: 13
11ExprTuple14, 15
12Literal
13ExprTuple16, 17, 18, 19
14Literal
15Operationoperator: 94
operands: 20
16ExprTuple21, 22
17ExprTuple23, 24
18ExprTuple25, 26
19ExprTuple27, 28
20ExprTuple29, 30
21ExprRangelambda_map: 31
start_index: 98
end_index: 99
22ExprRangelambda_map: 32
start_index: 98
end_index: 100
23ExprRangelambda_map: 33
start_index: 98
end_index: 99
24ExprRangelambda_map: 33
start_index: 87
end_index: 88
25ExprRangelambda_map: 34
start_index: 98
end_index: 99
26ExprRangelambda_map: 35
start_index: 98
end_index: 100
27ExprRangelambda_map: 36
start_index: 98
end_index: 99
28ExprRangelambda_map: 37
start_index: 98
end_index: 100
29Operationoperator: 38
operands: 39
30Operationoperator: 40
operand: 98
31Lambdaparameter: 86
body: 42
32Lambdaparameter: 86
body: 43
33Lambdaparameter: 86
body: 44
34Lambdaparameter: 86
body: 45
35Lambdaparameter: 86
body: 46
36Lambdaparameter: 86
body: 47
37Lambdaparameter: 86
body: 49
38Literal
39ExprTuple50, 99
40Literal
41ExprTuple98
42Operationoperator: 72
operands: 51
43Operationoperator: 58
operands: 52
44Operationoperator: 58
operands: 53
45Operationoperator: 54
operands: 55
46Operationoperator: 73
operands: 56
47Operationoperator: 58
operands: 57
48ExprTuple86
49Operationoperator: 58
operands: 59
50Literal
51NamedExprsstate: 60
52NamedExprselement: 61
targets: 69
53NamedExprselement: 62
targets: 63
54Literal
55NamedExprsbasis: 64
56NamedExprsoperation: 65
57NamedExprselement: 66
targets: 67
58Literal
59NamedExprselement: 68
targets: 69
60Operationoperator: 70
operand: 82
61Operationoperator: 72
operands: 79
62Operationoperator: 73
operands: 74
63Operationoperator: 80
operands: 75
64Literal
65Literal
66Operationoperator: 78
operands: 76
67Operationoperator: 80
operands: 77
68Operationoperator: 78
operands: 79
69Operationoperator: 80
operands: 81
70Literal
71ExprTuple82
72Literal
73Literal
74NamedExprsoperation: 83
part: 86
75ExprTuple98, 88
76NamedExprsstate: 84
part: 86
77ExprTuple98, 99
78Literal
79NamedExprsstate: 85
part: 86
80Literal
81ExprTuple87, 88
82Literal
83Operationoperator: 89
operands: 90
84Operationoperator: 91
operands: 92
85Literal
86Variable
87Operationoperator: 94
operands: 93
88Operationoperator: 94
operands: 95
89Literal
90ExprTuple96, 99
91Literal
92ExprTuple97, 99
93ExprTuple99, 98
94Literal
95ExprTuple99, 100
96Literal
97Variable
98Literal
99Literal
100Literal