see dependencies
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_precision_guarantee
# check that the built expression is the same as the stored expression
assert qpe_precision_guarantee.expr == stored_expr
assert qpe_precision_guarantee.expr._style_id == stored_expr._style_id
print("Passed sanity check: qpe_precision_guarantee matches stored_expr")
Passed sanity check: qpe_precision_guarantee matches stored_expr
# Show the LaTeX representation of the expression for convenience if you need it.
print(stored_expr.latex())
\begin{array}{l}\forall_{\epsilon \in \left(0,1\right]}~\\ \left[\begin{array}{l}\forall_{s, n \in \mathbb{N}^+~|~n \geq 2}~\\ \left[\begin{array}{l}\forall_{U \in \textrm{U}\left(2^{s}\right), \lvert u \rangle \in \mathbb{C}^{2^{s}}, \varphi \in \mathbb{R}~|~\varphi \in \left[0,1\right), \left \|\lvert u \rangle\right \| = 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[\begin{array}{l}\forall_{t \in \mathbb{N}^+~|~t \geq \left(n + \left\lceil \textrm{log}_2\left(2 + \frac{1}{2 \cdot \epsilon}\right)\right\rceil\right)}~\\ \left(\left[\begin{array}{l}\textrm{Prob}_{m \in \{0~\ldotp \ldotp~2^{t} - 1\}~|~\left|\frac{m}{2^{t}} - \varphi\right|_{\textup{mod}\thinspace 1} \leq 2^{-n}}~\\ \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)\end{array}\right] \geq \left(1 - \epsilon\right)\right)\end{array}\right]\end{array}\right]\end{array}\right]\end{array}
stored_expr.style_options()
name | description | default | current value | related methods |
---|---|---|---|---|
with_wrapping | If 'True', wrap the Expression after the parameters | None | True | ('with_wrapping',) |
condition_wrapping | Wrap 'before' or 'after' the condition (or None). | None | None/False | ('with_wrap_after_condition', 'with_wrap_before_condition') |
wrap_params | If 'True', wraps every two parameters AND wraps the Expression after the parameters | None | None/False | ('with_params',) |
justification | justify to the 'left', 'center', or 'right' in the array cells | center | center | ('with_justification',) |
# display the expression information
stored_expr.expr_info()