Lean, informalized

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

Exercise 5.14 - A controlled adder on |0⟩|0\rangle gives the state that the powers of modular multiplication prepare from |1⟩|1\rangle

Modular addition prepares the state of order finding.

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

Order finding for a number xx coprime to NN, with N>1N > 1, uses the operator UU that multiplies by xx modulo NN, U|y⟩=|xymod⁡N⟩U|y\rangle = |xy \bmod N\rangle. With a first register in the superposition ∑j|j⟩\sum_j |j\rangle and a second prepared in |1⟩|1\rangle, applying UjU^j to the second when the first holds jj leaves the two registers in ∑j|j⟩Uj|1⟩=∑j|j⟩|xjmod⁡N⟩\sum_j |j\rangle U^j|1\rangle = \sum_j |j\rangle|x^j \bmod N\rangle. The exercise asks for the same state from addition in place of multiplication: a transform VV that adds xjx^j modulo NN to the second register when the first holds jj, V|j⟩|k⟩=|j⟩|k+xjmod⁡N⟩V|j\rangle|k\rangle = |j\rangle|k + x^j \bmod N\rangle, applied with the second register prepared in |0⟩|0\rangle.

Multiplication and Addition Modulo NN

The first register has dimension mm, with basis states |j⟩|j\rangle for j=0,1,…,m−1j = 0, 1, \dots, m-1; the second has dimension dd, with basis states |k⟩|k\rangle for k=0,1,…,d−1k = 0, 1, \dots, d-1. A basis state of the pair is written |j,k⟩=|j⟩|k⟩|j, k\rangle = |j\rangle|k\rangle.

For natural numbers xx and NN with N≤dN \le d, multiplication by xx modulo NN is the map uu on the labels of the second register given by u(y)={xymod⁡N,y<N,y,N≤y≤d−1.u(y) = \begin{cases} xy \bmod N, & y < N, \\ y, & N \le y \le d-1. \end{cases}(1)✦ When xx and NN are coprime, the operator UU of order finding is the permutation of the basis states of the second register defined by uu, U|y⟩=|u(y)⟩U|y\rangle = |u(y)\rangle.✦

For a natural number cc, addition of cc modulo NN is the map scs_c on the same labels given by sc(k)={(k+c)mod⁡N,k<N,k,N≤k≤d−1,s_c(k) = \begin{cases} (k + c) \bmod N, & k < N, \\ k, & N \le k \le d-1, \end{cases}(2) and the adder modulo NN is the permutation AcA_c of the basis states of the second register defined by scs_c: Ac|k⟩=|sc(k)⟩,k=0,1,…,d−1.A_c|k\rangle = |s_c(k)\rangle, \qquad k = 0, 1, \dots, d-1.(3)

The Transform VV and the Two States

The permutation π\pi of the transform VV is the map on label pairs (j,k)(j, k) of the two registers that applies to kk the addition of xjx^j modulo NN: π(j,k)=(j,sxjmod⁡N(k)).\pi(j, k) = \bigl(j, \, s_{x^j \bmod N}(k)\bigr).(4)✦ The transform VV is the permutation matrix of π\pi, the matrix on the two registers that moves each basis state as π\pi moves its labels: V|j,k⟩=|π(j,k)⟩=|j⟩Axjmod⁡N|k⟩.V|j, k\rangle = |\pi(j, k)\rangle = |j\rangle A_{x^j \bmod N}|k\rangle.(5)✦ For k<Nk < N this is |j⟩|(k+xj)mod⁡N⟩|j\rangle|(k + x^j) \bmod N\rangle, the transform of the exercise.

The state of order finding from the powers of UU is the vector of the two registers |ψU⟩=∑j=0m−1|j⟩Uj|1⟩,|\psi_U\rangle = \sum_{j=0}^{m-1} |j\rangle\, U^j|1\rangle,(6) and the state from the transform is VV applied to the sum of the first register’s basis states with the second register in |0⟩|0\rangle: |ψV⟩=V∑j=0m−1|j⟩|0⟩.|\psi_V\rangle = V \sum_{j=0}^{m-1} |j\rangle|0\rangle.(7)

The Claim

Theorem 1. Let xx and NN be coprime natural numbers with N>1N > 1, let the second register have dimension d≥Nd \ge N, and let the first have any dimension mm. Then the state (7) that VV prepares from the second register in |0⟩|0\rangle equals the state (6) that the powers of UU prepare from |1⟩|1\rangle: |ψV⟩=|ψU⟩.|\psi_V\rangle = |\psi_U\rangle.(8)✦

What Is Checked

The claim is stated over the states (6) and (7): the first built from the operator UU and its multiplication map uu, the second from the transform VV and, through its permutation π\pi, from the adders AcA_c and their addition maps scs_c.

About these constructions the library proves that uu is injective when xx and NN are coprime, xx being invertible modulo NN, and that scs_c is injective for every cc. An injective map of the dd labels to themselves is a bijection.