logo
In [1]:
import proveit
theory = proveit.Theory() # the theorem's theory
from proveit import l, defaults
from proveit.numbers import subtract
from proveit.physics.quantum.QPE import _full_domain, _t, _two_pow_t, _two_pow__t_minus_one
from proveit.physics.quantum.QPE import (
    _delta_b_is_real, _scaled_delta_b_floor_in_interval,
    _t_in_natural_pos, _two_pow_t_is_nat_pos, _two_pow_t_minus_one_is_nat_pos)
In [2]:
%proving _delta_b_floor_diff_in_interval
With these allowed/disallowed theorem/theory presumptions (e.g., to avoid circular dependencies), we begin our proof of
_delta_b_floor_diff_in_interval:
(see dependencies)
In [3]:
# interesting issue here: cascading "side effect failures" leading to
# max recursion error if we haven't already imported at least one of the
# following: _full_domain, _t, _two_pow_t, _two_pow__t_minus_one
defaults.assumptions = _delta_b_floor_diff_in_interval.all_conditions()
defaults.assumptions:
In [4]:
# previously proven
_scaled_delta_b_floor_in_interval
In [5]:
scaled_delta_less_than_one = (
    _scaled_delta_b_floor_in_interval.derive_element_upper_bound())
scaled_delta_less_than_one:  ⊢  
In [6]:
scaled_delta_greatereq_than_zero = (
    _scaled_delta_b_floor_in_interval.derive_element_lower_bound())
scaled_delta_greatereq_than_zero:  ⊢  
In [7]:
# for convenience, name the product 2^t * delta
scaled_delta = _scaled_delta_b_floor_in_interval.element
scaled_delta:
In [8]:
# for convenience, name the difference 2^t * delta - ell
scaled_delta_minus_ell = subtract(scaled_delta, l)
scaled_delta_minus_ell:
In [9]:
_delta_b_is_real
In [10]:
# This allows a distribution() method to proceed further below
from proveit import b
from proveit.physics.quantum.QPE import _b_floor, _best_floor_is_int
_delta_b_floor_is_real = _delta_b_is_real.instantiate({b: _b_floor})
_delta_b_floor_is_real:  ⊢  
In [11]:
# for convenience, name the ell membership obj
ell_in_full_domain = defaults.assumptions[0]
ell_in_full_domain:
In [12]:
ell_upper_bound = ell_in_full_domain.derive_element_upper_bound()
ell_upper_bound:  ⊢  
In [13]:
ell_lower_bound = ell_in_full_domain.derive_element_lower_bound()
ell_lower_bound:  ⊢  

Upper Bound

Develop upper bound, using information about the bounds on the individual pieces …

In [14]:
from proveit.numbers import one, Neg
negative_ell_upper_bound = ell_lower_bound.left_mult_both_sides(Neg(one))
negative_ell_upper_bound:  ⊢  
In [15]:
# rewrite the bounding inequality so -ell is on the left
negative_ell_upper_bound = negative_ell_upper_bound.with_styles(direction='normal')
negative_ell_upper_bound:  ⊢  
In [16]:
scaled_delta_minus_ell_upper_bound = (
    scaled_delta_minus_ell.deduce_bound(
        [scaled_delta_less_than_one, negative_ell_upper_bound]))
scaled_delta_minus_ell_upper_bound:  ⊢  

Divide through by $2^t$ and Simplify

In [17]:
upper_bound_judgment = scaled_delta_minus_ell_upper_bound.divide_both_sides(_two_pow_t)
upper_bound_judgment:  ⊢  
In [18]:
upper_bound_one_half_02 = upper_bound_judgment.inner_expr().lhs.distribute()
upper_bound_one_half_02:  ⊢  

Lower Bound

Develop lower bound using information about the bounds on the individual pieces …

In [19]:
# recall from earlier:
ell_upper_bound
In [20]:
negative_ell_lower_bound = ell_upper_bound.left_mult_both_sides(Neg(one))
negative_ell_lower_bound:  ⊢  
In [21]:
# recall from earlier:
scaled_delta_minus_ell
In [22]:
scaled_delta_minus_ell_lower_bound = (
    scaled_delta_minus_ell.deduce_bound(
        [scaled_delta_greatereq_than_zero.with_styles(direction='reversed'),
         negative_ell_lower_bound]))
scaled_delta_minus_ell_lower_bound:  ⊢  

Divide through by $2^t$ and Simplify

In [23]:
lower_bound_judgment = scaled_delta_minus_ell_lower_bound.divide_both_sides(_two_pow_t)
lower_bound_judgment:  ⊢  
_delta_b_floor_diff_in_interval may now be readily provable (assuming required theorems are usable).  Simply execute "%qed".
In [24]:
%qed
proveit.physics.quantum.QPE._delta_b_floor_diff_in_interval has been proven.
Out[24]:
 step typerequirementsstatement
0generalization1  ⊢  
1instantiation2, 3, 6, 4, 5  ⊢  
  : , : , :
2conjecture  ⊢  
 proveit.numbers.number_sets.real_numbers.in_IntervalCO
3instantiation170, 6  ⊢  
  :
4instantiation102, 79, 7  ⊢  
  : , :
5instantiation8, 9, 10  ⊢  
  : , :
6instantiation16, 138, 152, 100  ⊢  
  : , :
7instantiation170, 11  ⊢  
  :
8theorem  ⊢  
 proveit.logic.booleans.conjunction.and_if_both
9instantiation13, 12, 15  ⊢  
  : , : , :
10instantiation13, 14, 15  ⊢  
  : , : , :
11instantiation16, 118, 96, 43  ⊢  
  : , :
12instantiation17, 96, 137, 21, 18, 23, 19*  ⊢  
  : , : , :
13theorem  ⊢  
 proveit.logic.equality.sub_right_side_into
14instantiation20, 96, 21, 157, 22, 23, 31*  ⊢  
  : , : , :
15instantiation24, 25, 106, 78, 43, 26*  ⊢  
  : , : , :
16conjecture  ⊢  
 proveit.numbers.division.div_real_closure
17conjecture  ⊢  
 proveit.numbers.division.weak_div_from_numer_bound__pos_denom
18instantiation27, 28, 29  ⊢  
  : , : , :
19instantiation30, 140, 78, 43, 31*  ⊢  
  : , :
20conjecture  ⊢  
 proveit.numbers.division.strong_div_from_numer_bound__pos_denom
21instantiation102, 46, 49  ⊢  
  : , :
22instantiation32, 33, 34  ⊢  
  : , : , :
23instantiation35, 125  ⊢  
  :
24conjecture  ⊢  
 proveit.numbers.division.distribute_frac_through_subtract
25instantiation199, 160, 46  ⊢  
  : , : , :
26instantiation127, 36, 37  ⊢  
  : , : , :
27conjecture  ⊢  
 proveit.numbers.ordering.transitivity_less_eq_less_eq
28instantiation48, 67, 137, 49, 38, 39*  ⊢  
  : , : , :
29instantiation40, 49, 67, 46, 41  ⊢  
  : , : , :
30conjecture  ⊢  
 proveit.numbers.division.neg_frac_neg_numerator
31instantiation42, 140, 78, 43, 44*  ⊢  
  : , :
32conjecture  ⊢  
 proveit.numbers.ordering.transitivity_less_less_eq
33instantiation45, 49, 46, 138, 47  ⊢  
  : , : , :
34instantiation48, 138, 49, 50, 51, 52*  ⊢  
  : , : , :
35conjecture  ⊢  
 proveit.numbers.number_sets.natural_numbers.natural_pos_is_pos
36instantiation53, 54, 55, 58, 56*  ⊢  
  : , : , :
37instantiation57, 58  ⊢  
  :
38instantiation69, 161, 118, 157, 59, 71, 60*, 72*  ⊢  
  : , : , :
39instantiation61, 122  ⊢  
  :
40conjecture  ⊢  
 proveit.numbers.addition.weak_bound_via_left_term_bound
41instantiation62, 67, 138, 68  ⊢  
  : , : , :
42conjecture  ⊢  
 proveit.numbers.division.div_as_mult
43instantiation111, 125  ⊢  
  :
44instantiation127, 63, 64  ⊢  
  : , : , :
45conjecture  ⊢  
 proveit.numbers.addition.strong_bound_via_left_term_bound
46instantiation65, 67, 138, 68  ⊢  
  : , : , :
47instantiation66, 67, 138, 68  ⊢  
  : , : , :
48conjecture  ⊢  
 proveit.numbers.addition.weak_bound_via_right_term_bound
49instantiation170, 118  ⊢  
  :
50instantiation102, 157, 161  ⊢  
  : , :
51instantiation69, 161, 154, 118, 70, 71, 72*, 73*  ⊢  
  : , : , :
52instantiation127, 74, 75  ⊢  
  : , : , :
53conjecture  ⊢  
 proveit.numbers.division.frac_cancel_left
54instantiation199, 130, 76  ⊢  
  : , : , :
55instantiation199, 130, 77  ⊢  
  : , : , :
56instantiation126, 78  ⊢  
  :
57conjecture  ⊢  
 proveit.numbers.division.frac_one_denom
58instantiation199, 160, 79  ⊢  
  : , : , :
59instantiation80, 179, 194, 167  ⊢  
  : , : , :
60instantiation90, 123, 140, 81*  ⊢  
  : , :
61conjecture  ⊢  
 proveit.numbers.addition.elim_zero_left
62conjecture  ⊢  
 proveit.numbers.number_sets.real_numbers.interval_co_lower_bound
63instantiation119, 82  ⊢  
  : , : , :
64instantiation83, 133, 84, 159, 100, 85*  ⊢  
  : , : , :
65conjecture  ⊢  
 proveit.numbers.number_sets.real_numbers.all_in_interval_co__is__real
66conjecture  ⊢  
 proveit.numbers.number_sets.real_numbers.interval_co_upper_bound
67conjecture  ⊢  
 proveit.numbers.number_sets.real_numbers.zero_is_real
68conjecture  ⊢  
 proveit.physics.quantum.QPE._scaled_delta_b_floor_in_interval
69conjecture  ⊢  
 proveit.numbers.multiplication.reversed_weak_bound_via_right_factor_bound
70instantiation86, 179, 194, 167  ⊢  
  : , : , :
71instantiation87, 88  ⊢  
  : , :
72instantiation90, 123, 106, 89*  ⊢  
  : , :
73instantiation90, 123, 136, 91*  ⊢  
  : , :
74instantiation141, 196, 185, 142, 92, 143, 123, 140, 148  ⊢  
  : , : , : , : , : , :
75instantiation146, 123, 140, 93  ⊢  
  : , : , :
76instantiation199, 150, 94  ⊢  
  : , : , :
77instantiation199, 150, 95  ⊢  
  : , : , :
78instantiation199, 160, 96  ⊢  
  : , : , :
79instantiation97, 98  ⊢  
  :
80conjecture  ⊢  
 proveit.numbers.number_sets.integers.interval_upper_bound
81instantiation135, 140  ⊢  
  :
82instantiation99, 133, 171, 161, 100, 101*  ⊢  
  : , : , :
83conjecture  ⊢  
 proveit.numbers.exponentiation.product_of_real_powers
84instantiation102, 171, 161  ⊢  
  : , :
85instantiation127, 103, 104  ⊢  
  : , : , :
86conjecture  ⊢  
 proveit.numbers.number_sets.integers.interval_lower_bound
87conjecture  ⊢  
 proveit.numbers.ordering.relax_less
88instantiation105, 192  ⊢  
  :
89instantiation135, 106  ⊢  
  :
90conjecture  ⊢  
 proveit.numbers.multiplication.mult_neg_left
91instantiation127, 107, 108  ⊢  
  : , : , :
92instantiation158  ⊢  
  : , :
93instantiation162  ⊢  
  :
94instantiation199, 163, 109  ⊢  
  : , : , :
95instantiation199, 163, 110  ⊢  
  : , : , :
96instantiation180, 181, 125  ⊢  
  : , : , :
97conjecture  ⊢  
 proveit.physics.quantum.QPE._delta_b_is_real
98conjecture  ⊢  
 proveit.physics.quantum.QPE._best_floor_is_int
99conjecture  ⊢  
 proveit.numbers.exponentiation.real_power_of_real_power
100instantiation111, 175  ⊢  
  :
101instantiation112, 147, 123, 113*  ⊢  
  : , :
102conjecture  ⊢  
 proveit.numbers.addition.add_real_closure_bin
103instantiation119, 114  ⊢  
  : , : , :
104instantiation115, 116, 198, 117*  ⊢  
  : , :
105conjecture  ⊢  
 proveit.numbers.number_sets.integers.negative_if_in_neg_int
106instantiation199, 160, 118  ⊢  
  : , : , :
107instantiation119, 120  ⊢  
  : , : , :
108instantiation121, 122, 123, 124*  ⊢  
  : , :
109instantiation199, 174, 125  ⊢  
  : , : , :
110instantiation199, 174, 198  ⊢  
  : , : , :
111conjecture  ⊢  
 proveit.numbers.number_sets.natural_numbers.nonzero_if_is_nat_pos
112conjecture  ⊢  
 proveit.numbers.multiplication.mult_neg_right
113instantiation126, 147  ⊢  
  :
114instantiation127, 128, 129  ⊢  
  : , : , :
115conjecture  ⊢  
 proveit.numbers.exponentiation.neg_power_as_div
116instantiation199, 130, 131  ⊢  
  : , : , :
117instantiation132, 133  ⊢  
  :
118instantiation199, 168, 134  ⊢  
  : , : , :
119axiom  ⊢  
 proveit.logic.equality.substitution
120instantiation135, 136  ⊢  
  :
121conjecture  ⊢  
 proveit.numbers.negation.distribute_neg_through_binary_sum
122instantiation199, 160, 137  ⊢  
  : , : , :
123instantiation199, 160, 138  ⊢  
  : , : , :
124instantiation139, 140  ⊢  
  :
125conjecture  ⊢  
 proveit.physics.quantum.QPE._two_pow_t_is_nat_pos
126conjecture  ⊢  
 proveit.numbers.multiplication.elim_one_right
127axiom  ⊢  
 proveit.logic.equality.equals_transitivity
128instantiation141, 142, 185, 196, 143, 144, 147, 148, 145  ⊢  
  : , : , : , : , : , :
129instantiation146, 147, 148, 149  ⊢  
  : , : , :
130conjecture  ⊢  
 proveit.numbers.number_sets.complex_numbers.real_nonzero_within_complex_nonzero
131instantiation199, 150, 151  ⊢  
  : , : , :
132conjecture  ⊢  
 proveit.numbers.exponentiation.complex_x_to_first_power_is_x
133instantiation199, 160, 152  ⊢  
  : , : , :
134instantiation199, 178, 153  ⊢  
  : , : , :
135conjecture  ⊢  
 proveit.numbers.multiplication.elim_one_left
136instantiation199, 160, 154  ⊢  
  : , : , :
137instantiation199, 168, 155  ⊢  
  : , : , :
138instantiation199, 168, 156  ⊢  
  : , : , :
139conjecture  ⊢  
 proveit.numbers.negation.double_negation
140instantiation199, 160, 157  ⊢  
  : , : , :
141conjecture  ⊢  
 proveit.numbers.addition.disassociation
142axiom  ⊢  
 proveit.numbers.number_sets.natural_numbers.zero_in_nats
143conjecture  ⊢  
 proveit.core_expr_types.tuples.tuple_len_0_typical_eq
144instantiation158  ⊢  
  : , :
145instantiation199, 160, 159  ⊢  
  : , : , :
146conjecture  ⊢  
 proveit.numbers.addition.subtraction.add_cancel_triple_13
147instantiation199, 160, 171  ⊢  
  : , : , :
148instantiation199, 160, 161  ⊢  
  : , : , :
149instantiation162  ⊢  
  :
150conjecture  ⊢  
 proveit.numbers.number_sets.real_numbers.rational_nonzero_within_real_nonzero
151instantiation199, 163, 164  ⊢  
  : , : , :
152instantiation199, 168, 165  ⊢  
  : , : , :
153instantiation199, 166, 167  ⊢  
  : , : , :
154instantiation199, 168, 169  ⊢  
  : , : , :
155instantiation199, 178, 187  ⊢  
  : , : , :
156instantiation199, 178, 188  ⊢  
  : , : , :
157instantiation180, 181, 201  ⊢  
  : , : , :
158conjecture  ⊢  
 proveit.numbers.numerals.decimals.tuple_len_2_typical_eq
159instantiation170, 171  ⊢  
  :
160conjecture  ⊢  
 proveit.numbers.number_sets.complex_numbers.real_within_complex
161instantiation199, 172, 173  ⊢  
  : , : , :
162axiom  ⊢  
 proveit.logic.equality.equals_reflexivity
163conjecture  ⊢  
 proveit.numbers.number_sets.rational_numbers.nonzero_int_within_rational_nonzero
164instantiation199, 174, 175  ⊢  
  : , : , :
165instantiation199, 178, 176  ⊢  
  : , : , :
166instantiation177, 179, 194  ⊢  
  : , :
167assumption  ⊢  
168conjecture  ⊢  
 proveit.numbers.number_sets.real_numbers.rational_within_real
169instantiation199, 178, 179  ⊢  
  : , : , :
170conjecture  ⊢  
 proveit.numbers.negation.real_closure
171instantiation180, 181, 182  ⊢  
  : , : , :
172conjecture  ⊢  
 proveit.numbers.number_sets.real_numbers.real_neg_within_real
173instantiation199, 183, 184  ⊢  
  : , : , :
174conjecture  ⊢  
 proveit.numbers.number_sets.integers.nat_pos_within_nonzero_int
175conjecture  ⊢  
 proveit.numbers.numerals.decimals.posnat2
176instantiation199, 195, 185  ⊢  
  : , : , :
177conjecture  ⊢  
 proveit.numbers.number_sets.integers.int_interval_within_int
178conjecture  ⊢  
 proveit.numbers.number_sets.rational_numbers.int_within_rational
179instantiation186, 187, 188  ⊢  
  : , :
180theorem  ⊢  
 proveit.logic.sets.inclusion.unfold_subset_eq
181instantiation189, 190  ⊢  
  : , :
182axiom  ⊢  
 proveit.physics.quantum.QPE._t_in_natural_pos
183conjecture  ⊢  
 proveit.numbers.number_sets.real_numbers.rational_neg_within_real_neg
184instantiation199, 191, 192  ⊢  
  : , : , :
185conjecture  ⊢  
 proveit.numbers.numerals.decimals.nat2
186conjecture  ⊢  
 proveit.numbers.addition.add_int_closure_bin
187instantiation193, 194  ⊢  
  :
188instantiation199, 195, 196  ⊢  
  : , : , :
189theorem  ⊢  
 proveit.logic.sets.inclusion.relax_proper_subset
190conjecture  ⊢  
 proveit.numbers.number_sets.real_numbers.nat_pos_within_real
191conjecture  ⊢  
 proveit.numbers.number_sets.rational_numbers.neg_int_within_rational_neg
192instantiation197, 198  ⊢  
  :
193conjecture  ⊢  
 proveit.numbers.negation.int_closure
194instantiation199, 200, 201  ⊢  
  : , : , :
195conjecture  ⊢  
 proveit.numbers.number_sets.integers.nat_within_int
196theorem  ⊢  
 proveit.numbers.numerals.decimals.nat1
197conjecture  ⊢  
 proveit.numbers.negation.int_neg_closure
198conjecture  ⊢  
 proveit.numbers.numerals.decimals.posnat1
199theorem  ⊢  
 proveit.logic.sets.inclusion.superset_membership_from_proper_subset
200conjecture  ⊢  
 proveit.numbers.number_sets.integers.nat_pos_within_int
201conjecture  ⊢  
 proveit.physics.quantum.QPE._two_pow_t_minus_one_is_nat_pos
*equality replacement requirements