import proveit
theory = proveit.Theory() # the theorem's theory
from proveit import defaults
from proveit import b, m
from proveit.logic import Or, Equals, InSet
from proveit.numbers import zero, one, Integer, Neg, Abs, Mod, sqrd
from proveit.numbers.number_sets.real_numbers import pi_between_3_and_4
from proveit.physics.quantum.QPE import (
_outcome_prob, qpe_exact, _best_guarantee, _alpha_ideal_case,
_phase_is_real, _phase_in_interval,
_b_round, _best_round_def, _best_round_is_int, _delta_b_round, _delta_b_def,
_two_pow_t, _t_in_natural_pos, _two_pow_t_is_nat_pos)
%proving qpe_best_guarantee
_outcome_prob
_best_guarantee
_outcome_prob
for the rounded, 'best' case¶_m = _best_guarantee.lhs.base.operand.index
outcome_prob_bound = _outcome_prob.instantiate({m:_m}).apply_transitivity(_best_guarantee)
(outcome_prob_bound.generalize(
qpe_best_guarantee.instance_param_lists(),
conditions=qpe_best_guarantee.all_conditions())
.inner_expr().instance_expr.instance_expr.instance_expr.with_wrapping()
.inner_expr().instance_expr.instance_expr.with_wrapping())
%qed