§5, p. 1501 — at least values of are good, and each one gives
ProvedShorAlgorithms.OrderFinding.card_good_outcomes_genumber-theoryorder-findingp2o-batch-p200bp2o-gran-per-chapterp2o-plan-paperp2o-v1
Let , let be coprime to with multiplicative order modulo , and let satisfy . Call good if there is with and
Then:
- there are at least good values of , where is Euler's totient function;
- the powers , , take exactly distinct values, so there are at least states with good;
- every good gives us : rounding to the nearest fraction with denominator smaller than returns a fraction with denominator in lowest terms;
- every good satisfies (5.12): for some integer .
Together with the per-state bound , this gives at least outcomes , each of probability at least and each of which yields .
Formalization Note "Gives us " is yieldsOrder n q r c. At the only is (since ), matching . The hypothesis excludes , where no fraction has denominator smaller than .
Preamble
import Mathlib import Definitions.Def_ShorAlgorithms_OrderFinding_yieldsOrder
Formal statement
namespace ShorAlgorithms.OrderFinding
open Classical in
/-- Shor (1997), §5, pp. 1500–1501: the count of good observations. Let `n > 1`, `x` coprime
to `n` with order `r`, and `q = 2^l` with `n² ≤ q < 2n²`. Call `c ∈ {0, …, q-1}` *good* if
`|c/q - d/r| ≤ 1/(2q)` for some `0 ≤ d < r` relatively prime to `r`. Then
1. there are at least `φ(r)` good values of `c`;
2. there are `r` possible values `x^k (mod n)`, `0 ≤ k < r`, so there are at least `r φ(r)`
states `|c, x^k (mod n)⟩` with `c` good; and
3. every good `c` gives us `r` by rounding (`yieldsOrder n q r c`) and satisfies (5.12),
`-r/2 ≤ rc - d'q ≤ r/2` for an integer `d'`. -/
theorem card_good_outcomes_ge (n x q l : ℕ) (hn : 1 < n) (hx : Nat.Coprime x n)
(hq : q = 2 ^ l) (hnq : n ^ 2 ≤ q) (hq2 : q < 2 * n ^ 2) :
Nat.totient (orderOf (x : ZMod n)) ≤
((Finset.univ : Finset (Fin q)).filter (fun c : Fin q => ∃ d : ℕ, d < orderOf (x : ZMod n) ∧
Nat.Coprime d (orderOf (x : ZMod n)) ∧
|((c : ℕ) : ℝ) / q - (d : ℝ) / (orderOf (x : ZMod n) : ℝ)| ≤ 1 / (2 * q))).card ∧
((Finset.range (orderOf (x : ZMod n))).image (fun k : ℕ => (x : ZMod n) ^ k)).card =
orderOf (x : ZMod n) ∧
orderOf (x : ZMod n) * Nat.totient (orderOf (x : ZMod n)) ≤
(((Finset.univ : Finset (Fin q)).filter (fun c : Fin q => ∃ d : ℕ, d < orderOf (x : ZMod n) ∧
Nat.Coprime d (orderOf (x : ZMod n)) ∧
|((c : ℕ) : ℝ) / q - (d : ℝ) / (orderOf (x : ZMod n) : ℝ)| ≤ 1 / (2 * q))) ×ˢ
((Finset.range (orderOf (x : ZMod n))).image (fun k : ℕ => (x : ZMod n) ^ k))).card ∧
∀ c : Fin q, (∃ d : ℕ, d < orderOf (x : ZMod n) ∧ Nat.Coprime d (orderOf (x : ZMod n)) ∧
|((c : ℕ) : ℝ) / q - (d : ℝ) / (orderOf (x : ZMod n) : ℝ)| ≤ 1 / (2 * q)) →
yieldsOrder n q (orderOf (x : ZMod n)) (c : ℕ) ∧
∃ d : ℤ,
-((orderOf (x : ZMod n) : ℝ) / 2) ≤
(orderOf (x : ZMod n) : ℝ) * ((c : ℕ) : ℝ) - (d : ℝ) * (q : ℝ) ∧
(orderOf (x : ZMod n) : ℝ) * ((c : ℕ) : ℝ) - (d : ℝ) * (q : ℝ) ≤
(orderOf (x : ZMod n) : ℝ) / 2 := by sorry
end ShorAlgorithms.OrderFinding
Source
Shor, Polynomial-Time Algorithms for Prime Factorization and Discrete Logarithms on a Quantum Computer, SIAM J. Comput. 26(5) (1997), pp. 1500–1501, §5, "There are φ(r) possible values of d relatively prime to r … which would enable us to obtain r"
Human review
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.