logo
In [1]:
import proveit
theory = proveit.Theory() # the theorem's theory
from proveit import b, n, x, A, defaults
from proveit.logic import Equals, Forall, Implies, InSet, Not, NotEquals, Or, Set
from proveit.logic.booleans import unfold_is_bool
from proveit.numbers import (
        zero, one, two, Add, Exp, frac, IntervalOO, Less, LessEq, Mult, Neg, Real)
from proveit.numbers.number_sets.real_numbers import not_int_if_not_int_in_interval
from proveit.physics.quantum.QPE import (
        _b_floor, _b_round, _delta_b, _t,
        _scaled_delta_b_floor_in_interval, _scaled_delta_b_round_in_interval)
In [2]:
%proving _scaled_delta_b_is_zero_or_non_int
With these allowed/disallowed theorem/theory presumptions (e.g., to avoid circular dependencies), we begin our proof of
_scaled_delta_b_is_zero_or_non_int:
(see dependencies)
In [3]:
defaults.assumptions = _scaled_delta_b_is_zero_or_non_int.all_conditions()
defaults.assumptions:

Deduce $2^t \delta_{b_f}$ in expanded interval $(-1, 1)$.

In [4]:
_scaled_delta_b_floor_in_interval

Perhaps because of the integer bounds involved, Prove-It has no trouble expanding that interval to the desired open interval $(-1, 1)$:

In [5]:
InSet(_scaled_delta_b_floor_in_interval.element, IntervalOO(Neg(one), one)).prove()

Deduce $2^t \delta_{b_r}$ in expanded interval $(-1, 1)$.

The automation is insufficient when trying to do the analogous thing for $2^t \delta_{b_r}$, so we have to do a bit more work. We need an explicit derivation of either $-1 < -\frac{1}{2}$ or $\frac{1}{2} < 1$ to allow the domain interval expansion.

In [6]:
_scaled_delta_b_round_in_interval
In [7]:
Less(frac(one, two), one).prove()

And from $\frac{1}{2}<1$, we can automatically derive $-1 < -\frac{1}{2}$.
Now Prove-It can derive the expanded interval membership for $2^t \delta_{b_r}$:

In [8]:
InSet(_scaled_delta_b_round_in_interval.element, IntervalOO(Neg(one), one)).prove()

Combine the results for both the $b_f$ and $b_r$ cases:

In [9]:
all_scaled_deltas_in_interval_neg_one_to_one = Forall(b,
       InSet(Mult(Exp(two, _t), _delta_b), IntervalOO(Neg(one), one)),
       domain=Set(_b_floor, _b_round)).prove()
all_scaled_deltas_in_interval_neg_one_to_one:  ⊢  

Establish that $(2^t \delta = 0) \lor (\lnot[2^t \delta = 0])$ using a version of the Law of the Excluded Middle

For convenience, we label the expression $2^{t}\delta_{b}$ as _scaled_delta:

In [10]:
_scaled_delta_b = all_scaled_deltas_in_interval_neg_one_to_one.instance_expr.element
_scaled_delta_b:
In [11]:
# imported above
display(unfold_is_bool)

For convenience, we label our two mutually exclusive assumptions:

In [12]:
non_zero_assumption = NotEquals(_scaled_delta_b, zero)
non_zero_assumption:
In [13]:
zero_assumption = Equals(_scaled_delta_b, zero)
zero_assumption:
In [14]:
scaled_delta_b_is_zero_or_not = unfold_is_bool.instantiate({A: zero_assumption})
scaled_delta_b_is_zero_or_not:  ⊢  

Establish that the assumptions $(2^t \delta = 0)$ and $(\lnot[2^t \delta = 0])$ each imply that $(2^t \delta = 0) \lor (2^t \delta_{b} \notin \mathbb{Z})$

First, assuming that $2^t \delta_b \ne 0$

In [15]:
not_int_if_not_int_in_interval
In [16]:
not_zero_assumption_gives_not_int = not_int_if_not_int_in_interval.instantiate(
    {n: zero, x: _scaled_delta_b},
    assumptions=[*defaults.assumptions, non_zero_assumption])
not_zero_assumption_gives_not_int: ,  ⊢  
In [17]:
Or(zero_assumption, not_zero_assumption_gives_not_int.expr).prove(
        assumptions=[*defaults.assumptions, non_zero_assumption]).as_implication(hypothesis=non_zero_assumption)
In [18]:
not_zero_implies_not_eq_zero = non_zero_assumption.conclude_as_folded(
        assumptions = [Not(zero_assumption)]).as_implication(hypothesis=Not(zero_assumption))
not_zero_implies_not_eq_zero:  ⊢  
In [19]:
Implies(Not(zero_assumption), Or(zero_assumption, not_zero_assumption_gives_not_int.expr)).prove()

Second, assuming that $2^t \delta_b = 0$

In [20]:
zero_assumption_gives_zero = zero_assumption.prove(assumptions=[*defaults.assumptions, zero_assumption])
zero_assumption_gives_zero:  ⊢  
In [21]:
Or(zero_assumption_gives_zero.expr, not_zero_assumption_gives_not_int.expr).prove(
        assumptions=[*defaults.assumptions, zero_assumption]).as_implication(hypothesis=zero_assumption)

Thus in all cases we have the desired conclusion:

In [22]:
scaled_delta_b_is_zero_or_not.derive_via_singular_dilemma(_scaled_delta_b_is_zero_or_non_int.instance_expr)
_scaled_delta_b_is_zero_or_non_int may now be readily provable (assuming required theorems are usable).  Simply execute "%qed".
In [23]:
%qed
proveit.physics.quantum.QPE._scaled_delta_b_is_zero_or_non_int has been proven.
Out[23]:
 step typerequirementsstatement
0generalization1  ⊢  
1instantiation2, 9, 3, 4, 5, 6  ⊢  
  : , : , :
2theorem  ⊢  
 proveit.logic.booleans.disjunction.singular_constructive_dilemma
3instantiation7, 9  ⊢  
  :
4instantiation8, 9  ⊢  
  :
5deduction10  ⊢  
6instantiation11, 12, 13  ⊢  
  : , :
7conjecture  ⊢  
 proveit.logic.booleans.negation.closure
8conjecture  ⊢  
 proveit.logic.booleans.unfold_is_bool
9instantiation14  ⊢  
  : , :
10instantiation15, 32, 16  ⊢  
  : , :
11theorem  ⊢  
 proveit.logic.equality.rhs_via_equality
12deduction17  ⊢  
13instantiation18, 19  ⊢  
  : , : , :
14axiom  ⊢  
 proveit.logic.equality.equality_in_bool
15theorem  ⊢  
 proveit.logic.booleans.disjunction.or_if_only_left
16instantiation20, 21  ⊢  
  : , :
17instantiation22, 23, 24,  ⊢  
  : , :
18axiom  ⊢  
 proveit.logic.equality.substitution
19instantiation25  ⊢  
  : , :
20conjecture  ⊢  
 proveit.logic.sets.membership.double_negated_membership
21instantiation165, 166, 26  ⊢  
  : , : , :
22theorem  ⊢  
 proveit.logic.booleans.disjunction.or_if_only_right
23instantiation27, 31  ⊢  
  : , :
24instantiation28, 29, 30, 31,  ⊢  
  : , :
25axiom  ⊢  
 proveit.logic.equality.not_equals_def
26instantiation41, 96, 32  ⊢  
  : , : , :
27theorem  ⊢  
 proveit.logic.equality.unfold_not_equals
28conjecture  ⊢  
 proveit.numbers.number_sets.real_numbers.not_int_if_not_int_in_interval
29conjecture  ⊢  
 proveit.numbers.number_sets.integers.zero_is_int
30instantiation54, 33, 34, 35, 36  ⊢  
  : , : , :
31assumption  ⊢  
32assumption  ⊢  
33instantiation77, 114, 107  ⊢  
  : , :
34instantiation77, 114, 115  ⊢  
  : , :
35instantiation37, 107, 115, 46  ⊢  
  : , : , :
36instantiation58, 38, 39  ⊢  
  : , :
37conjecture  ⊢  
 proveit.numbers.number_sets.real_numbers.all_in_interval_oo__is__real
38instantiation41, 40, 63  ⊢  
  : , : , :
39instantiation41, 42, 43  ⊢  
  : , : , :
40instantiation44, 107, 115, 46  ⊢  
  : , : , :
41theorem  ⊢  
 proveit.logic.equality.sub_left_side_into
42instantiation45, 107, 115, 46  ⊢  
  : , : , :
43instantiation74, 89  ⊢  
  :
44conjecture  ⊢  
 proveit.numbers.number_sets.real_numbers.interval_oo_lower_bound
45conjecture  ⊢  
 proveit.numbers.number_sets.real_numbers.interval_oo_upper_bound
46instantiation47, 48  ⊢  
  :
47instantiation49, 167, 50, 51, 52  ⊢  
  : , : , : , :
48assumption  ⊢  
49conjecture  ⊢  
 proveit.logic.sets.enumeration.true_for_each_then_true_for_all
50instantiation145  ⊢  
  : , :
51instantiation54, 107, 115, 108, 53  ⊢  
  : , : , :
52instantiation54, 107, 115, 111, 55  ⊢  
  : , : , :
53instantiation58, 56, 57  ⊢  
  : , :
54conjecture  ⊢  
 proveit.numbers.number_sets.real_numbers.in_IntervalOO
55instantiation58, 59, 60  ⊢  
  : , :
56instantiation65, 107, 114, 61, 62, 63*, 64*  ⊢  
  : , : , :
57instantiation104, 114, 115, 116  ⊢  
  : , : , :
58theorem  ⊢  
 proveit.logic.booleans.conjunction.and_if_both
59instantiation65, 125, 66, 67, 68*, 69*  ⊢  
  : , : , :
60instantiation70, 71, 81  ⊢  
  : , : , :
61instantiation77, 108, 115  ⊢  
  : , :
62instantiation78, 114, 108, 115, 72, 73  ⊢  
  : , : , :
63instantiation74, 88  ⊢  
  :
64instantiation128, 75, 76  ⊢  
  : , : , :
65conjecture  ⊢  
 proveit.numbers.addition.strong_bound_via_left_term_bound
66instantiation77, 111, 135  ⊢  
  : , :
67instantiation78, 125, 111, 135, 79, 106  ⊢  
  : , : , :
68instantiation80, 101, 89, 81  ⊢  
  : , : , :
69instantiation128, 82, 83  ⊢  
  : , : , :
70theorem  ⊢  
 proveit.logic.equality.sub_right_side_into
71instantiation84, 111, 135, 85, 86  ⊢  
  : , : , :
72instantiation92, 114, 115, 116  ⊢  
  : , : , :
73conjecture  ⊢  
 proveit.numbers.numerals.decimals.less_0_1
74conjecture  ⊢  
 proveit.numbers.addition.elim_zero_left
75instantiation95, 96, 167, 144, 97, 87, 90, 89, 88  ⊢  
  : , : , : , : , : , :
76instantiation100, 89, 90, 91  ⊢  
  : , : , :
77conjecture  ⊢  
 proveit.numbers.addition.add_real_closure_bin
78conjecture  ⊢  
 proveit.numbers.ordering.less_eq_add_right_strong
79instantiation92, 125, 135, 126  ⊢  
  : , : , :
80conjecture  ⊢  
 proveit.numbers.addition.subtraction.negated_add
81instantiation93, 136, 164, 94*  ⊢  
  : , : , : , :
82instantiation95, 96, 167, 144, 97, 98, 102, 101, 99  ⊢  
  : , : , : , : , : , :
83instantiation100, 101, 102, 103  ⊢  
  : , : , :
84conjecture  ⊢  
 proveit.numbers.ordering.less_add_right
85instantiation104, 125, 135, 126  ⊢  
  : , : , :
86instantiation105, 106  ⊢  
  : , :
87instantiation145  ⊢  
  : , :
88instantiation165, 152, 107  ⊢  
  : , : , :
89instantiation165, 152, 115  ⊢  
  : , : , :
90instantiation165, 152, 108  ⊢  
  : , : , :
91instantiation112  ⊢  
  :
92conjecture  ⊢  
 proveit.numbers.number_sets.real_numbers.interval_co_lower_bound
93conjecture  ⊢  
 proveit.numbers.addition.rational_pair_addition
94instantiation128, 109, 110  ⊢  
  : , : , :
95conjecture  ⊢  
 proveit.numbers.addition.disassociation
96axiom  ⊢  
 proveit.numbers.number_sets.natural_numbers.zero_in_nats
97conjecture  ⊢  
 proveit.core_expr_types.tuples.tuple_len_0_typical_eq
98instantiation145  ⊢  
  : , :
99instantiation165, 152, 125  ⊢  
  : , : , :
100conjecture  ⊢  
 proveit.numbers.addition.subtraction.add_cancel_triple_23
101instantiation165, 152, 135  ⊢  
  : , : , :
102instantiation165, 152, 111  ⊢  
  : , : , :
103instantiation112  ⊢  
  :
104conjecture  ⊢  
 proveit.numbers.number_sets.real_numbers.interval_co_upper_bound
105conjecture  ⊢  
 proveit.numbers.ordering.relax_less
106instantiation113, 151  ⊢  
  :
107instantiation134, 115  ⊢  
  :
108instantiation124, 114, 115, 116  ⊢  
  : , : , :
109instantiation137, 167, 117, 118, 119, 120  ⊢  
  : , : , : , :
110instantiation121, 122, 123  ⊢  
  :
111instantiation124, 125, 135, 126  ⊢  
  : , : , :
112axiom  ⊢  
 proveit.logic.equality.equals_reflexivity
113conjecture  ⊢  
 proveit.numbers.number_sets.rational_numbers.positive_if_in_rational_pos
114conjecture  ⊢  
 proveit.numbers.number_sets.real_numbers.zero_is_real
115instantiation165, 158, 127  ⊢  
  : , : , :
116conjecture  ⊢  
 proveit.physics.quantum.QPE._scaled_delta_b_floor_in_interval
117instantiation145  ⊢  
  : , :
118instantiation145  ⊢  
  : , :
119instantiation128, 129, 130  ⊢  
  : , : , :
120conjecture  ⊢  
 proveit.numbers.numerals.decimals.mult_2_2
121conjecture  ⊢  
 proveit.numbers.division.frac_cancel_complete
122instantiation165, 152, 131  ⊢  
  : , : , :
123instantiation132, 133  ⊢  
  :
124conjecture  ⊢  
 proveit.numbers.number_sets.real_numbers.all_in_interval_co__is__real
125instantiation134, 135  ⊢  
  :
126conjecture  ⊢  
 proveit.physics.quantum.QPE._scaled_delta_b_round_in_interval
127instantiation165, 163, 136  ⊢  
  : , : , :
128axiom  ⊢  
 proveit.logic.equality.equals_transitivity
129instantiation137, 167, 138, 139, 140, 141  ⊢  
  : , : , : , :
130conjecture  ⊢  
 proveit.numbers.numerals.decimals.add_2_2
131instantiation165, 158, 142  ⊢  
  : , : , :
132conjecture  ⊢  
 proveit.numbers.number_sets.natural_numbers.nonzero_if_is_nat_pos
133conjecture  ⊢  
 proveit.numbers.numerals.decimals.posnat4
134conjecture  ⊢  
 proveit.numbers.negation.real_closure
135instantiation165, 158, 143  ⊢  
  : , : , :
136instantiation165, 166, 144  ⊢  
  : , : , :
137axiom  ⊢  
 proveit.core_expr_types.operations.operands_substitution
138instantiation145  ⊢  
  : , :
139instantiation145  ⊢  
  : , :
140instantiation146, 148  ⊢  
  :
141instantiation147, 148  ⊢  
  :
142instantiation165, 163, 149  ⊢  
  : , : , :
143instantiation165, 150, 151  ⊢  
  : , : , :
144theorem  ⊢  
 proveit.numbers.numerals.decimals.nat1
145conjecture  ⊢  
 proveit.numbers.numerals.decimals.tuple_len_2_typical_eq
146conjecture  ⊢  
 proveit.numbers.multiplication.elim_one_left
147conjecture  ⊢  
 proveit.numbers.multiplication.elim_one_right
148instantiation165, 152, 153  ⊢  
  : , : , :
149instantiation165, 166, 154  ⊢  
  : , : , :
150conjecture  ⊢  
 proveit.numbers.number_sets.rational_numbers.rational_pos_within_rational
151instantiation155, 156, 157  ⊢  
  : , :
152conjecture  ⊢  
 proveit.numbers.number_sets.complex_numbers.real_within_complex
153instantiation165, 158, 159  ⊢  
  : , : , :
154conjecture  ⊢  
 proveit.numbers.numerals.decimals.nat4
155conjecture  ⊢  
 proveit.numbers.division.div_rational_pos_closure
156instantiation165, 161, 160  ⊢  
  : , : , :
157instantiation165, 161, 162  ⊢  
  : , : , :
158conjecture  ⊢  
 proveit.numbers.number_sets.real_numbers.rational_within_real
159instantiation165, 163, 164  ⊢  
  : , : , :
160conjecture  ⊢  
 proveit.numbers.numerals.decimals.posnat1
161conjecture  ⊢  
 proveit.numbers.number_sets.rational_numbers.nat_pos_within_rational_pos
162conjecture  ⊢  
 proveit.numbers.numerals.decimals.posnat2
163conjecture  ⊢  
 proveit.numbers.number_sets.rational_numbers.int_within_rational
164instantiation165, 166, 167  ⊢  
  : , : , :
165theorem  ⊢  
 proveit.logic.sets.inclusion.superset_membership_from_proper_subset
166conjecture  ⊢  
 proveit.numbers.number_sets.integers.nat_within_int
167conjecture  ⊢  
 proveit.numbers.numerals.decimals.nat2
*equality replacement requirements