§5, p. 1498 — r even and x^{r/2} ≢ −1 (mod n) give a nontrivial factor gcd(x^{r/2} − 1, n)
ProvedShorAlgorithms.Reduction.nontrivial_factor_of_even_of_ne_neg_onefactoringnumber-theoryorder-findingp2o-batch-p200bp2o-gran-per-chapterp2o-plan-paperp2o-v1
Let and let be a unit modulo with multiplicative order . Since
the numbers are factors of . The theorem states that if is even and , then
So the reduction can fail only when is odd or . This is the criterion on which the probability estimate of the mission rests.
Formalization Note Shor states the procedure for odd ; oddness is not needed for this step and is not assumed. The gcd is factorCandidate n u from the definition successEvent, computed from the least nonnegative residue of .
Preamble
import Mathlib import Definitions.Def_ShorAlgorithms_Reduction_successEvent
Formal statement
namespace ShorAlgorithms.Reduction
/-- Shor (1997), §5, p. 1498: if the order `r` of `x` is even and `x^{r/2} ≢ -1 (mod n)`,
then `gcd(x^{r/2} - 1, n)` is a nontrivial factor of `n`. -/
theorem nontrivial_factor_of_even_of_ne_neg_one (n : ℕ) (hn : 1 < n) (u : (ZMod n)ˣ)
(heven : Even (orderOf u)) (hne : (u : ZMod n) ^ (orderOf u / 2) ≠ -1) :
1 < factorCandidate n u ∧ factorCandidate n u < n := by sorry
end ShorAlgorithms.Reduction
Source
Shor, Polynomial-Time Algorithms for Prime Factorization and Discrete Logarithms on a Quantum Computer, SIAM J. Comput. 26(5) (1997), p. 1498, §5, "Since (x^{r/2} − 1)(x^{r/2} + 1) = x^r − 1 ≡ 0 (mod n), … This procedure fails only if r is odd, … or if x^{r/2} ≡ −1 (mod n)"
Human review
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.