logo
In [1]:
import proveit
theory = proveit.Theory() # the theorem's theory

from proveit import defaults, Lambda
from proveit import a, b, m, t
from proveit.logic import And, Iff
from proveit.numbers import zero, two, Less, LessEq, greater, Exp
from proveit.physics.quantum.algebra import Ket
from proveit.physics.quantum.QPE import ModAdd
from proveit.physics.quantum.QPE import (
    _phase, _alpha_ideal_case, _outcome_prob, _phase_in_interval, 
    _t, _t_in_natural_pos, _two_pow_t_is_nat_pos)
In [2]:
%proving qpe_exact
With these allowed/disallowed theorem/theory presumptions (e.g., to avoid circular dependencies), we begin our proof of
qpe_exact:
(see dependencies)

First, we'll prove the instance expression in terms of the local QPE literals

In [3]:
_outcome_prob
In [4]:
_alpha_ideal_case
In [5]:
defaults.assumptions = [_alpha_ideal_case.antecedent]
defaults.assumptions:
In [6]:
alpha_eq1 = _alpha_ideal_case.derive_consequent()
alpha_eq1:  ⊢  
In [7]:
_m = alpha_eq1.lhs.index
_m:
In [8]:
prob_eq_1 = _outcome_prob.instantiate({m:_m}, replacements=[alpha_eq1])
prob_eq_1:  ⊢  
In [9]:
qpe_exact_with_extra_cond = prob_eq_1.generalize(
            qpe_exact.instance_param_lists(),
            conditions=qpe_exact.all_conditions() + [_phase_in_interval])
qpe_exact_with_extra_cond:  ⊢  
In [ ]:
 

This has an extra condition that we will eliminate as redundant

Specifically, $\varphi \in [0, 1)$ is redundant given $2^t \varphi \in \{0 .. 2^t - 1\}$.

In [10]:
desired_phase_cond = qpe_exact.instance_expr.instance_expr.instance_expr.condition
desired_phase_cond:
In [11]:
defaults.assumptions = qpe_exact.all_conditions()[:-3] + [desired_phase_cond]
defaults.assumptions:
In [12]:
phase_cond = qpe_exact.all_conditions()[-2]
phase_cond:
In [13]:
phase_cond_lower_bound = phase_cond.derive_element_lower_bound()
phase_cond_lower_bound: ,  ⊢  
In [14]:
phase_cond_lower_bound.divide_both_sides(Exp(two, t))
In [15]:
phase_cond_upper_bound_01 = phase_cond.derive_element_upper_bound()
phase_cond_upper_bound_01: ,  ⊢  
In [16]:
phase_cond_upper_bound_02 = phase_cond_upper_bound_01.divide_both_sides(
    Exp(two, t)).inner_expr().rhs.distribute()
phase_cond_upper_bound_02: ,  ⊢  
In [17]:
inv_two_pow_t_is_pos = greater(phase_cond_upper_bound_02.rhs.operands[1].operand, zero).prove()
inv_two_pow_t_is_pos:  ⊢  
In [18]:
phase_cond_upper_bound_02.rhs.deduce_bound(inv_two_pow_t_is_pos)
In [19]:
_phase_in_interval.literals_as_variables(_phase, _t).prove()
In [ ]:
 

Now we can replace the $\varphi$ condition with the right one

In [20]:
phase_cond = qpe_exact_with_extra_cond.instance_expr.instance_expr.instance_expr.condition.prove()
phase_cond: ,  ⊢  
In [21]:
qpe_exact_with_extra_cond.instance_expr.instance_expr.instance_expr.operand.body
In [22]:
conditional = qpe_exact_with_extra_cond.instance_expr.instance_expr.instance_expr.operand.body
conditional:
In [23]:
cond_equiv = Iff(phase_cond.expr, desired_phase_cond).prove(assumptions=qpe_exact.all_conditions()[:-3])
cond_equiv:  ⊢  
In [24]:
defaults.assumptions = []
defaults.assumptions:
In [25]:
qpe_exact_done = (qpe_exact_with_extra_cond.inner_expr().instance_expr.instance_expr
                  .instance_expr.operand.body.substitute_condition(cond_equiv, assumptions=[]))
qpe_exact_done:  ⊢  
qpe_exact has been proven.  Now simply execute "%qed".
In [26]:
%qed
proveit.physics.quantum.QPE.qpe_exact has been proven.
Out[26]:
 step typerequirementsstatement
0instantiation1, 2, 3  ⊢  
  : , :
1theorem  ⊢  
 proveit.logic.equality.rhs_via_equality
2literal generalization4  ⊢  
3instantiation21, 5, 6*, 7*  ⊢  
  : , : , :
4instantiation8, 15, 9*, 10*  ⊢  
  :
5modus ponens11, 12  ⊢  
6instantiation13, 160  ⊢  
  : , :
7instantiation13, 160  ⊢  
  : , :
8conjecture  ⊢  
 proveit.physics.quantum.QPE._outcome_prob
9modus ponens14, 15  ⊢  
10instantiation92, 16, 17  ⊢  
  : , : , :
11instantiation18, 19  ⊢  
  : , : , : , : , : , : , :
12generalization20  ⊢  
13conjecture  ⊢  
 proveit.core_expr_types.conditionals.satisfied_condition_reduction
14conjecture  ⊢  
 proveit.physics.quantum.QPE._alpha_ideal_case
15assumption  ⊢  
16instantiation21, 22  ⊢  
  : , : , :
17instantiation23, 24  ⊢  
  :
18conjecture  ⊢  
 proveit.core_expr_types.lambda_maps.general_lambda_substitution
19conjecture  ⊢  
 proveit.numbers.numerals.decimals.posnat5
20instantiation25, 26  ⊢  
  : , : , :
21axiom  ⊢  
 proveit.logic.equality.substitution
22instantiation27, 28  ⊢  
  :
23conjecture  ⊢  
 proveit.numbers.exponentiation.exponentiated_one
24instantiation158, 128, 29  ⊢  
  : , : , :
25axiom  ⊢  
 proveit.core_expr_types.conditionals.condition_replacement
26instantiation30, 31, 32  ⊢  
  : , :
27conjecture  ⊢  
 proveit.numbers.absolute_value.abs_non_neg_elim
28instantiation33, 151  ⊢  
  :
29instantiation158, 141, 34  ⊢  
  : , : , :
30theorem  ⊢  
 proveit.logic.booleans.implication.iff_intro
31deduction35  ⊢  
32deduction36  ⊢  
33conjecture  ⊢  
 proveit.numbers.number_sets.natural_numbers.natural_lower_bound
34instantiation158, 149, 154  ⊢  
  : , : , :
35instantiation41, 46, 37, 38, 39, 40  ⊢  
  : , :
36instantiation41, 42, 43, 118, 112, 44, 45,  ⊢  
  : , :
37instantiation54  ⊢  
  : , : , :
38instantiation130, 131, 46, 132, 47, 49  ⊢  
  : , : , : , : , :
39instantiation130, 151, 157, 48, 49  ⊢  
  : , : , : , : , :
40instantiation130, 157, 151, 51, 49  ⊢  
  : , : , : , : , :
41conjecture  ⊢  
 proveit.logic.booleans.conjunction.and_if_all
42conjecture  ⊢  
 proveit.numbers.numerals.decimals.nat4
43instantiation50  ⊢  
  : , : , : , :
44instantiation130, 157, 131, 51, 132, 134  ⊢  
  : , : , : , : , :
45instantiation52, 82, 99, 118, 53,  ⊢  
  : , : , :
46conjecture  ⊢  
 proveit.numbers.numerals.decimals.nat3
47instantiation54  ⊢  
  : , : , :
48instantiation143  ⊢  
  : , :
49assumption  ⊢  
50conjecture  ⊢  
 proveit.numbers.numerals.decimals.tuple_len_4_typical_eq
51instantiation143  ⊢  
  : , :
52conjecture  ⊢  
 proveit.numbers.number_sets.real_numbers.in_IntervalCO
53instantiation55, 56, 57,  ⊢  
  : , :
54conjecture  ⊢  
 proveit.numbers.numerals.decimals.tuple_len_3_typical_eq
55theorem  ⊢  
 proveit.logic.booleans.conjunction.and_if_both
56instantiation72, 129, 82, 73, 58, 76, 59*, 77*,  ⊢  
  : , : , :
57instantiation60, 61, 62,  ⊢  
  : , : , :
58instantiation63, 123, 124, 112,  ⊢  
  : , : , :
59instantiation64, 117, 96  ⊢  
  :
60conjecture  ⊢  
 proveit.numbers.ordering.transitivity_less_eq_less
61instantiation65, 66, 67,  ⊢  
  : , : , :
62instantiation68, 99, 69, 82, 70, 71*  ⊢  
  : , : , :
63conjecture  ⊢  
 proveit.numbers.number_sets.integers.interval_lower_bound
64conjecture  ⊢  
 proveit.numbers.division.frac_zero_numer
65theorem  ⊢  
 proveit.logic.equality.sub_right_side_into
66instantiation72, 129, 73, 74, 75, 76, 77*,  ⊢  
  : , : , :
67instantiation78, 117, 87, 96, 79*  ⊢  
  : , : , :
68conjecture  ⊢  
 proveit.numbers.addition.strong_bound_via_right_term_bound
69instantiation80, 83  ⊢  
  :
70instantiation81, 82, 83, 84, 85*  ⊢  
  : , :
71instantiation86, 87  ⊢  
  :
72conjecture  ⊢  
 proveit.numbers.division.weak_div_from_numer_bound__pos_denom
73instantiation158, 141, 88,  ⊢  
  : , : , :
74instantiation158, 141, 89  ⊢  
  : , : , :
75instantiation90, 123, 124, 112,  ⊢  
  : , : , :
76instantiation91, 146  ⊢  
  :
77instantiation92, 93, 94,  ⊢  
  : , : , :
78conjecture  ⊢  
 proveit.numbers.division.distribute_frac_through_subtract
79instantiation95, 117, 96  ⊢  
  :
80conjecture  ⊢  
 proveit.numbers.negation.real_closure
81conjecture  ⊢  
 proveit.numbers.negation.negated_strong_bound
82conjecture  ⊢  
 proveit.numbers.number_sets.real_numbers.zero_is_real
83instantiation158, 141, 97  ⊢  
  : , : , :
84instantiation98, 109  ⊢  
  :
85conjecture  ⊢  
 proveit.numbers.negation.negated_zero
86conjecture  ⊢  
 proveit.numbers.addition.elim_zero_right
87instantiation158, 128, 99  ⊢  
  : , : , :
88instantiation158, 149, 100,  ⊢  
  : , : , :
89instantiation158, 149, 124  ⊢  
  : , : , :
90conjecture  ⊢  
 proveit.numbers.number_sets.integers.interval_upper_bound
91conjecture  ⊢  
 proveit.numbers.number_sets.natural_numbers.natural_pos_is_pos
92axiom  ⊢  
 proveit.logic.equality.equals_transitivity
93instantiation101, 102, 103, 106, 104*,  ⊢  
  : , : , :
94instantiation105, 106  ⊢  
  :
95conjecture  ⊢  
 proveit.numbers.division.frac_cancel_complete
96instantiation107, 146  ⊢  
  :
97instantiation158, 108, 109  ⊢  
  : , : , :
98conjecture  ⊢  
 proveit.numbers.number_sets.rational_numbers.positive_if_in_rational_pos
99instantiation158, 141, 110  ⊢  
  : , : , :
100instantiation158, 111, 112,  ⊢  
  : , : , :
101conjecture  ⊢  
 proveit.numbers.division.frac_cancel_left
102instantiation158, 114, 113  ⊢  
  : , : , :
103instantiation158, 114, 115  ⊢  
  : , : , :
104instantiation116, 117  ⊢  
  :
105conjecture  ⊢  
 proveit.numbers.division.frac_one_denom
106instantiation158, 128, 118  ⊢  
  : , : , :
107conjecture  ⊢  
 proveit.numbers.number_sets.natural_numbers.nonzero_if_is_nat_pos
108conjecture  ⊢  
 proveit.numbers.number_sets.rational_numbers.rational_pos_within_rational
109instantiation119, 120, 121  ⊢  
  : , :
110instantiation158, 149, 145  ⊢  
  : , : , :
111instantiation122, 123, 124  ⊢  
  : , :
112instantiation130, 151, 134  ⊢  
  : , : , : , : , :
113instantiation158, 126, 125  ⊢  
  : , : , :
114conjecture  ⊢  
 proveit.numbers.number_sets.complex_numbers.real_nonzero_within_complex_nonzero
115instantiation158, 126, 127  ⊢  
  : , : , :
116conjecture  ⊢  
 proveit.numbers.multiplication.elim_one_right
117instantiation158, 128, 129  ⊢  
  : , : , :
118instantiation130, 131, 157, 132, 133, 134  ⊢  
  : , : , : , : , :
119conjecture  ⊢