logo

Theorem qpe_exact of type Forall

from the theory of proveit.physics.quantum.QPE

see dependencies

In [1]:
import proveit
# Automation is not needed when only building an expression:
proveit.defaults.automation = False # This will speed things up.
proveit.defaults.inline_pngs = False # Makes files smaller.
%load_theorem_expr # Load the stored theorem expression as 'stored_expr'
# import the special expression
from proveit.physics.quantum.QPE import qpe_exact
In [2]:
# check that the built expression is the same as the stored expression
assert qpe_exact.expr == stored_expr
assert qpe_exact.expr._style_id == stored_expr._style_id
print("Passed sanity check: qpe_exact matches stored_expr")
Passed sanity check: qpe_exact matches stored_expr
In [3]:
# Show the LaTeX representation of the expression for convenience if you need it.
print(stored_expr.latex())
\begin{array}{l}\forall_{s, t \in \mathbb{N}^+}~\\
\left[\begin{array}{l}\forall_{U \in \textrm{U}\left(2^{s}\right)}~\\
\left[\begin{array}{l}\forall_{\lvert u \rangle \in \mathbb{C}^{2^{s}}~|~\left \|\lvert u \rangle\right \| = 1}~\\
\left[\begin{array}{l}\forall_{\varphi \in \mathbb{R}~|~\left(2^{t} \cdot \varphi\right) \in \{0~\ldotp \ldotp~2^{t} - 1\}, \left(U \thinspace \lvert u \rangle\right) = \left(\mathsf{e}^{2 \cdot \pi \cdot \mathsf{i} \cdot \varphi} \cdot \lvert u \rangle\right)}~\\
\left(\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 2^{t} \cdot \varphi \rangle_{t}} \\
\qin{\lvert + \rangle} & \ghost{\textrm{QPE}\left(U, t\right)} & \meter & \ghostqout{\lvert 2^{t} \cdot \varphi \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 2^{t} \cdot \varphi \rangle_{t}} \\
\qin{\lvert + \rangle} & \ghost{\textrm{QPE}\left(U, t\right)} & \meter & \ghostqout{\lvert 2^{t} \cdot \varphi \rangle_{t}} \\
\qin{\lvert u \rangle} & \ghost{\textrm{QPE}\left(U, t\right)} & { /^{s} } \qw & \qout{\lvert u \rangle}
} \end{array}\right) = 1\right)\end{array}\right]\end{array}\right]\end{array}\right]\end{array}
In [4]:
stored_expr.style_options()
namedescriptiondefaultcurrent valuerelated methods
with_wrappingIf 'True', wrap the Expression after the parametersNoneTrue('with_wrapping',)
condition_wrappingWrap 'before' or 'after' the condition (or None).NoneNone/False('with_wrap_after_condition', 'with_wrap_before_condition')
wrap_paramsIf 'True', wraps every two parameters AND wraps the Expression after the parametersNoneNone/False('with_params',)
justificationjustify to the 'left', 'center', or 'right' in the array cellscentercenter('with_justification',)
In [5]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0Operationoperator: 28
operand: 2
1ExprTuple2
2Lambdaparameters: 3
body: 4
3ExprTuple163, 171
4Conditionalvalue: 5
condition: 6
5Operationoperator: 28
operand: 9
6Operationoperator: 43
operands: 8
7ExprTuple9
8ExprTuple10, 11
9Lambdaparameter: 160
body: 13
10Operationoperator: 58
operands: 14
11Operationoperator: 58
operands: 15
12ExprTuple160
13Conditionalvalue: 16
condition: 17
14ExprTuple163, 18
15ExprTuple171, 18
16Operationoperator: 28
operand: 21
17Operationoperator: 58
operands: 20
18Literal
19ExprTuple21
20ExprTuple160, 22
21Lambdaparameter: 149
body: 23
22Operationoperator: 24
operand: 54
23Conditionalvalue: 26
condition: 27
24Literal
25ExprTuple54
26Operationoperator: 28
operand: 31
27Operationoperator: 43
operands: 30
28Literal
29ExprTuple31
30ExprTuple32, 33
31Lambdaparameter: 167
body: 35
32Operationoperator: 58
operands: 36
33Operationoperator: 60
operands: 37
34ExprTuple167
35Conditionalvalue: 38
condition: 39
36ExprTuple149, 40
37ExprTuple41, 162
38Operationoperator: 60
operands: 42
39Operationoperator: 43
operands: 44
40Operationoperator: 45
operands: 46
41Operationoperator: 47
operand: 149
42ExprTuple49, 162
43Literal
44ExprTuple50, 51, 52
45Literal
46ExprTuple53, 54
47Literal
48ExprTuple149
49Operationoperator: 55
operand: 63
50Operationoperator: 58
operands: 57
51Operationoperator: 58
operands: 59
52Operationoperator: 60
operands: 61
53Literal
54Operationoperator: 168
operands: 62
55Literal
56ExprTuple63
57ExprTuple167, 64
58Literal
59ExprTuple161, 65
60Literal
61ExprTuple66, 67
62ExprTuple170, 163
63Operationoperator: 68
operands: 69
64Literal
65Operationoperator: 144
operands: 70
66Operationoperator: 71
operands: 72
67Operationoperator: 73
operands: 74
68Literal
69ExprTuple75, 76, 77, 78
70ExprTuple79, 80
71Literal
72ExprTuple160, 149
73Literal
74ExprTuple81, 149
75ExprTuple82, 83
76ExprTuple84, 85
77ExprTuple86, 87
78ExprTuple88, 89
79Literal
80Operationoperator: 158
operands: 90
81Operationoperator: 168
operands: 91
82ExprRangelambda_map: 92
start_index: 162
end_index: 171
83ExprRangelambda_map: 93
start_index: 162
end_index: 163
84ExprRangelambda_map: 94
start_index: 162
end_index: 171
85ExprRangelambda_map: 94
start_index: 151
end_index: 152
86ExprRangelambda_map: 95
start_index: 162
end_index: 171
87ExprRangelambda_map: 96
start_index: 162
end_index: 163
88ExprRangelambda_map: 97
start_index: 162
end_index: 171
89ExprRangelambda_map: 98
start_index: 162
end_index: 163
90ExprTuple166, 99
91ExprTuple100, 101
92Lambdaparameter: 150
body: 102
93Lambdaparameter: 150
body: 103
94Lambdaparameter: 150
body: 104
95Lambdaparameter: 150
body: 105
96Lambdaparameter: 150
body: 106
97Lambdaparameter: 150
body: 107
98Lambdaparameter: 150
body: 109
99Operationoperator: 110
operand: 162
100Literal
101Operationoperator: 164
operands: 112
102Operationoperator: 136
operands: 113
103Operationoperator: 120
operands: 114
104Operationoperator: 120
operands: 115
105Operationoperator: 116
operands: 117
106Operationoperator: 137
operands: 118
107Operationoperator: 120
operands: 119
108ExprTuple150
109Operationoperator: 120
operands: 121
110Literal
111ExprTuple162
112ExprTuple170, 122, 123, 167
113NamedExprsstate: 124
114NamedExprselement: 125
targets: 133
115NamedExprselement: 126
targets: 127
116Literal
117NamedExprsbasis: 128
118NamedExprsoperation: 129
119NamedExprselement: 130
targets: 131
120Literal
121NamedExprselement: 132
targets: 133
122Literal
123Literal
124Operationoperator: 134
operand: 146
125Operationoperator: 136
operands: 143
126Operationoperator: 137
operands: 138
127Operationoperator: 144
operands: 139
128Literal
129Literal
130Operationoperator: 142
operands: 140
131Operationoperator: 144
operands: 141
132Operationoperator: 142
operands: 143
133Operationoperator: 144
operands: 145
134Literal
135ExprTuple146
136Literal
137Literal
138NamedExprsoperation: 147
part: 150
139ExprTuple162, 152
140NamedExprsstate: 148
part: 150
141ExprTuple162, 171
142Literal
143NamedExprsstate: 149
part: 150
144Literal
145ExprTuple151, 152
146Literal
147Operationoperator: 153
operands: 154
148Operationoperator: 155
operands: 156
149Variable
150Variable
151Operationoperator: 158
operands: 157
152Operationoperator: 158
operands: 159
153Literal
154ExprTuple160, 171
155Literal
156ExprTuple161, 171
157ExprTuple171, 162
158Literal
159ExprTuple171, 163
160Variable
161Operationoperator: 164
operands: 165
162Literal
163Variable
164Literal
165ExprTuple166, 167
166Operationoperator: 168
operands: 169
167Variable
168Literal
169ExprTuple170, 171
170Literal
171Variable