Lean, informalized

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

Exercise 5.22 - The discrete logarithm function after a Fourier transform in both exponents

The double Fourier sum reduces to one eigenstate.

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

In the discrete logarithm problem one is given a unit aa of the integers modulo NN and a power asa^s, and asked for the exponent ss. Let rr be the order of aa, the least positive integer with ar≡1(mod⁡N)a^r \equiv 1 \pmod{N}. The quantum algorithm evaluates the function f(x1,x2)=asx1+x2mod⁡Nf(x_1,x_2) = a^{s x_1 + x_2} \bmod N on all pairs of exponents below rr and then Fourier transforms both exponents modulo rr. The exercise is to compute the transform of ff at a pair of labels (ℓ1,ℓ2)(\ell_1,\ell_2) and to find the pairs at which it does not vanish. The library gives the answer in terms of the eigenstates used in the order finding algorithm, which finds the order rr of aa.

The Register

A quantum system is a physical object whose state space is a finite dimensional complex Hilbert space, and any such space is the state space of a system. A pure state |ψ⟩|\psi\rangle of a system SS is a unit vector in the state space of SS, determined physically up to a global phase.✦ The qudit with dd levels is the system whose state space is ℂd\mathbb{C}^d with its standard inner product.✦ For a level i<di < d, the computational basis state |i⟩|i\rangle is the pure state of the qudit whose vector has entry 11 at ii and 00 elsewhere.✦

The register of the algorithm is the qudit with NN levels. For a unit aa modulo NN and a natural number kk, the residue akmod⁡Na^k \bmod N is the integer below NN that represents the power aka^k; it labels the basis state |akmod⁡N⟩|a^k \bmod N\rangle of the register.✦ For a natural number ss and natural numbers x1x_1 and x2x_2, the function value state |f(x1,x2)⟩|f(x_1,x_2)\rangle is the basis state |asx1+x2mod⁡N⟩|a^{s x_1 + x_2} \bmod N\rangle.✦

The Fourier Sums

For natural numbers ℓ1\ell_1 and ℓ2\ell_2, the double Fourier sum of ff is the vector |Φ(ℓ1,ℓ2)⟩=∑x1=0r−1∑x2=0r−1e−2πi(ℓ1x1+ℓ2x2)/r|f(x1,x2)⟩|\Phi(\ell_1,\ell_2)\rangle = \sum_{x_1=0}^{r-1}\sum_{x_2=0}^{r-1} e^{-2\pi i(\ell_1 x_1 + \ell_2 x_2)/r}\,|f(x_1,x_2)\rangle(1) in the state space of the register, and for a natural number ℓ\ell the single Fourier sum |φ(ℓ)⟩|\varphi(\ell)\rangle is the vector |φ(ℓ)⟩=∑j=0r−1e−2πiℓj/r|ajmod⁡N⟩.|\varphi(\ell)\rangle = \sum_{j=0}^{r-1} e^{-2\pi i \ell j/r}\,|a^j \bmod N\rangle.(2) For a label ℓ<r\ell < r, the order finding eigenstate |uℓ⟩|u_\ell\rangle is the pure state of the register |uℓ⟩=1r∑k=0r−1e−2πiℓk/r|akmod⁡N⟩.|u_\ell\rangle = \frac{1}{\sqrt{r}}\sum_{k=0}^{r-1} e^{-2\pi i \ell k/r}\, |a^k \bmod N\rangle.(3)✦ For labels ℓ1,ℓ2<r\ell_1, \ell_2 < r, the Fourier state of ff is the vector |fˆ(ℓ1,ℓ2)⟩={|uℓ2⟩if ℓ1≡sℓ2(mod⁡r),0otherwise.|\hat f(\ell_1,\ell_2)\rangle = \begin{cases} |u_{\ell_2}\rangle & \text{if } \ell_1 \equiv s\ell_2 \pmod{r},\\ 0 & \text{otherwise.} \end{cases}(4)✦

The Claim

Theorem 1. Let aa be a unit of the integers modulo NN, of order rr, and let ss be a natural number. If natural numbers ℓ1\ell_1 and ℓ2\ell_2 satisfy ℓ1≢sℓ2(mod⁡r)\ell_1 \not\equiv s\ell_2 \pmod{r}, then the double Fourier sum (1) is |Φ(ℓ1,ℓ2)⟩=0.|\Phi(\ell_1,\ell_2)\rangle = 0.(5)✦ If they satisfy ℓ1≡sℓ2(mod⁡r)\ell_1 \equiv s\ell_2 \pmod{r}, then, with the single sum (2), |Φ(ℓ1,ℓ2)⟩=r|φ(ℓ2)⟩.|\Phi(\ell_1,\ell_2)\rangle = r\,|\varphi(\ell_2)\rangle.(6)✦ If ℓ1,ℓ2<r\ell_1, \ell_2 < r, then, with the Fourier state (4), |Φ(ℓ1,ℓ2)⟩=rr|fˆ(ℓ1,ℓ2)⟩.|\Phi(\ell_1,\ell_2)\rangle = r\sqrt{r}\,|\hat f(\ell_1,\ell_2)\rangle.(7)✦

What Is Checked

The identities (5) and (6) are stated over the double sum (1) of the function value states and the single sum (2); the identity (7) relates the double sum to the Fourier state (4), built from the order finding eigenstates (3).

About these constructions the library proves that every computational basis state |i⟩|i\rangle is a unit vector, so each |f(x1,x2)⟩|f(x_1,x_2)\rangle is a pure state, and that each eigenstate |uℓ⟩|u_\ell\rangle is a pure state as well: the basis states |akmod⁡N⟩|a^k \bmod N\rangle with k<rk < r are orthonormal, and the rr coefficients of |uℓ⟩|u_\ell\rangle each have squared modulus 1/r1/r.