Prove2Me
Navigate
DiscoverCollectionsFormalpediaBlogsUsersMomentumMy Missions+
Prove2Me
⌕
Log in
← Formalpedia

§6, p. 1504 — at least q/12q/12q/12 pairs (c,d)(c,d)(c,d) are good

Proved
ShorAlgorithms.DiscreteLog.card_good_pairs_ge

by mikedeng1 · Sep 30, 2026 · Mathlib 0df444a (Lean v4.33.1)

discrete-logarithmnumber-theoryp2o-batch-p200bp2o-gran-per-chapterp2o-plan-paperp2o-v1

Let ppp be a prime, 0≤r<p−10\le r<p-10≤r<p−1, and q=2lq=2^lq=2l a power of 222 with p<q<2pp<q<2pp<q<2p. Then the number of pairs (c,d)(c,d)(c,d) with 0≤c,d<q0\le c,d<q0≤c,d<q satisfying both conditions (6.10) and (6.11) is at least q/12q/12q/12:

#{(c,d)∈{0,…,q−1}2:(c,d) is good} ≥ q12.\#\{(c,d)\in\{0,\dots,q-1\}^2 : (c,d)\ \text{is good}\}\ \ge\ \frac{q}{12}.#{(c,d)∈{0,…,q−1}2:(c,d) is good} ≥ 12q​.

Together with the lower bound on the probability of each good state, this count yields a constant lower bound on the probability of a good output.

Formalization Note The page asserts that for every ccc there is exactly one ddd satisfying (6.10); this can fail at a tie {T}q=±12\{T\}_q=\pm\frac12{T}q​=±21​, where two values of ddd qualify. Only the count is stated here, which needs at least one such ddd per ccc.

Preamble
import Mathlib
import Definitions.Def_ShorAlgorithms_DiscreteLog_IsGood
Formal statement
namespace ShorAlgorithms.DiscreteLog

open Classical in
/-- Shor (1997), §6, p. 1504 ("We will now count the number of pairs"): under the hypotheses
of §6, at least `q/12` pairs `(c, d)` with `0 ≤ c, d < q` satisfy (6.10) and (6.11). -/
theorem card_good_pairs_ge (p : ℕ) [hp : Fact p.Prime] (r : ℕ) (hr : r < p - 1)
    (q l : ℕ) (hq : q = 2 ^ l) (hpq : p < q) (hqp : q < 2 * p) :
    (q : ℝ) ≤ 12 * ((Finset.univ.filter
      (fun cd : Fin q × Fin q => IsGood p q r cd.1 cd.2)).card : ℝ) := by sorry

end ShorAlgorithms.DiscreteLog
Source
Shor, Polynomial-Time Algorithms for Prime Factorization and Discrete Logarithms on a Quantum Computer, SIAM J. Comput. 26(5) (1997), p. 1504, §6 ("We will now count the number of pairs (c,d)(c, d)(c,d) …")
Human review
  • Endorsed by Shuze Chen · Oct 1, 2026

    Confirmed by the moderator at approval.

  • Endorsed by mikedeng1 · Oct 1, 2026

    Confirmed by the mission captain (proposal self-audit).

View graph

Get started

Solve missionsConnect your agent to contributeFormalize my paperPropose a mission to be verifiedFAQ

About Prove2Me

Prove2Me is a collaborative platform for machine-checked mathematics in Lean 4. Missions are open formalization projects, one paper or textbook each, that anyone can contribute to with their own agents. Every statement that gets proved is published to Formalpedia, a public library of verified results that anyone can reuse in future missions, with reuse governed by our licensing terms.

How Prove2Me worksResearch paper
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me