Lean, informalized

Nielsen & Chuang · Chapter 5, The quantum Fourier transform and its applications · p. 234

Exercise 5.18 - The classical steps of the reduction of factoring to order finding, carried out for 91 and 4

Factoring 91 with the order of 4.

Hover over a blue or green term in the text, or a node in the graph, to find it in the other. Select it to read its declaration both in Lean and in words.

The Exercise

Shor’s algorithm factors a composite number NN through order finding. For xx coprime to NN, the order rr of xx modulo NN is the least positive integer with xr≡1(mod⁡N)x^r \equiv 1 \pmod N. Finding rr is the one step that needs a quantum computer, and the procedure around it is classical:

  1. If NN is even, return the factor 22.

  2. If NN is a perfect power, N=abN = a^b for natural numbers aa and bb with b≥2b \geq 2, return aa.

  3. Choose xx at random with 1≤x≤N−11 \leq x \leq N - 1. If the greatest common divisor gcd⁡(x,N)\gcd(x, N) exceeds 11, return it.

  4. Find the order rr of xx modulo NN with the quantum subroutine.

  5. If rr is even and xr/2≢−1(mod⁡N)x^{r/2} \not\equiv -1 \pmod N, return gcd⁡(xr/2−1,N)\gcd(x^{r/2} - 1, N), a factor of NN other than 11 and NN. Otherwise the run fails.

The exercise runs the procedure on N=91N = 91 with x=4x = 4, which is coprime to 9191. It asks whether 9191 gets past steps one and two, and then for the order of 44 modulo 9191 and the factor that step five returns.

The Claim

The library states the run as six facts about the numbers 9191 and 44.

Theorem 1. Let rr be the order of 44 modulo 9191. Then 91=2k+1for some natural number k,91 = 2k + 1 \quad \text{for some natural number $k$},(1)✦ 91≠abfor all natural numbers a and b with b≥2,91 \neq a^b \quad \text{for all natural numbers $a$ and $b$ with $b \geq 2$},(2)✦ r=6,r = 6,(3)✦ 4r/2≡64(mod⁡91),4^{r/2} \equiv 64 \pmod{91},(4)✦ 4r/2≢−1(mod⁡91),4^{r/2} \not\equiv -1 \pmod{91},(5)✦ and gcd⁡(4r/2−1,91)=7.\gcd(4^{r/2} - 1,\, 91) = 7.(6)✦

Statements (1) and (2) take 9191 past steps one and two of the procedure.

What Is Checked

The theorem is stated over the integers modulo 9191, the residues 0,1,…,900, 1, \dots, 90 added and multiplied modulo 9191, in which −1-1 is the residue 9090: the order in (3) is the order of the residue 44, and (4) and (5) compare residues. The other three statements concern natural numbers; in (6), 4r/2−14^{r/2} - 1 is the integer 6363.