Lean, informalized

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

Problem 5.1 - The nearest estimate of the phase ℓ/p\ell/p comes out with probability at least 4/π24/\pi^2

Phase estimation of the cyclic shift on a prime qudit.

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

A qudit has pp levels |0⟩,…,|p−1⟩|0\rangle, \dots, |p-1\rangle, with pp a prime, and the cyclic shift U1U_1 moves each level up by one, from |p−1⟩|p-1\rangle back to |0⟩|0\rangle. For each level ℓ\ell, the Fourier state Fp−1|ℓ⟩F_p^{-1}|\ell\rangle, the image of |ℓ⟩|\ell\rangle under the inverse quantum Fourier transform, is an eigenstate of U1U_1 with eigenvalue e2πiℓ/pe^{2\pi i\ell/p}. Phase estimation with tt control qubits reads the phase ℓ/p\ell/p off this eigenvalue: it returns tt bits, and the binary number xx they spell gives the estimate x/2tx/2^t. The best estimate, the multiple of 2−t2^{-t} nearest to ℓ/p\ell/p counted modulo one, comes out with probability at least 4/π24/\pi^2, however many control qubits are used.✦

Systems and States

A quantum system SS is described by its state space, a finite dimensional complex Hilbert space; every such space HH is the state space of a system, the system modelled on HH. The composite system S⊗TS \otimes T of two systems has the tensor product of their state spaces as its state space.✦ The qudit with dd levels is the system modelled on ℂd\mathbb{C}^d, whose computational basis is the orthonormal basis of standard unit vectors |0⟩,…,|d−1⟩|0\rangle, \dots, |d-1\rangle. The qubit is the system modelled on ℂ2\mathbb{C}^2, the qudit with two levels.✦

A pure state ψ\psi of SS is a unit vector |ψ⟩|\psi\rangle in the state space of SS, and each computational basis state |i⟩|i\rangle is a pure state of its qudit. A state ρ\rho of SS is a positive operator of unit trace on the state space of SS.✦ A pure state ψ\psi gives the state |ψ⟩⟨ψ||\psi\rangle\langle\psi|, the projector onto |ψ⟩|\psi\rangle.✦

An identification ee of a system SS with a system TT is a linear isometric bijection from the state space of SS onto that of TT; its inverse e−1e^{-1} identifies TT with SS.

Gates

A unitary UU of SS, also called a gate on SS, is an operator on the state space of SS with U†U=UU†=1U^\dagger U = UU^\dagger = 1, and it carries a pure state ψ\psi of SS to U|ψ⟩U|\psi\rangle. The adjoint U†U^\dagger of a unitary UU of SS is a unitary of SS as well.✦ For unitaries UU of SS and VV of TT, the product unitary U⊗VU \otimes V of S⊗TS \otimes T has the tensor product of the two operators as its operator; with VV the identity of TT it is the gate U⊗1U \otimes 1, which acts on the first factor of the composite and leaves the second alone. The factors of a composite are its wires.

Along an identification ee of SS with TT, a unitary UU of SS becomes the unitary eUe−1eUe^{-1} of TT.✦

Every linear isometric bijection of the state space of SS onto itself is a unitary of SS.✦ On the qudit with rr levels, the basis permutation gate of a permutation σ\sigma of the levels is the unitary that carries each basis state |x⟩|x\rangle to |σ(x)⟩|\sigma(x)\rangle.✦ For a level yy of the qudit with rr levels, the shift UyU_y is the basis permutation gate that adds yy modulo rr: Uy|x⟩=|x+ymod⁡r⟩.U_y|x\rangle = |x + y \bmod r\rangle .(1)✦

The quantum Fourier transform FdF_d on the qudit with dd levels is the unitary whose matrix in the computational basis is (Fd)kj=ωjkd,ω=e2πi/d,(F_d)_{kj} = \frac{\omega^{jk}}{\sqrt d}, \qquad \omega = e^{2\pi i/d},(2)✦ The inverse Fd−1F_d^{-1} of the quantum Fourier transform FdF_d is its adjoint, and the inverse transform of a basis state |ℓ⟩|\ell\rangle is the pure state Fd−1|ℓ⟩=1d∑j=0d−1e−2πijℓ/d|j⟩.F_d^{-1}|\ell\rangle = \frac{1}{\sqrt d} \sum_{j=0}^{d-1} e^{-2\pi i j\ell/d}\,|j\rangle .(3)

The Circuit

The control register of tt qubits around a system SS is built by composing qubits on the left of SS one at a time: with no qubit it is SS itself, and with t+1t+1 it is a qubit composed with the control register of tt qubits around SS.✦ Its control wires are numbered 00 to t−1t-1 from the left, and the target SS sits on the right. For bits b0,…,bt−1b_0, \dots, b_{t-1} and a pure state uu of SS, the phase estimation input state is the pure state |b0⟩⊗⋯⊗|bt−1⟩⊗|u⟩|b_0\rangle \otimes \cdots \otimes |b_{t-1}\rangle \otimes |u\rangle of the register.✦

With HH the Hadamard gate of the qubit, the Hadamard layer of the control register of tt qubits around SS is the gate H⊗t⊗1H^{\otimes t} \otimes 1, which applies HH on every control wire and the identity on the target.✦ For a unitary UU of SS, the controlled powers of UU form the gate CUC_U in which wire kk applies U2t−1−kU^{2^{t-1-k}} to the target when it is in |1⟩|1\rangle.✦

The last gate is the inverse Fourier transform on the control wires. The split of the control register of tt qubits around SS is the identification of that register with the composite of tt qubits and SS, made by splitting off one qubit at a time. The control register of tt qubits around the trivial system is identified with the qudit with 2t2^t levels, and along this identification F2t−1F_{2^t}^{-1} becomes the inverse quantum Fourier transform on the tt qubits.

The inverse Fourier readout gate of the control register of tt qubits around SS is the gate F2t−1⊗1F_{2^t}^{-1} \otimes 1 on the composite of tt qubits and SS, carried back along the inverse of the split.✦

The phase estimation circuit for a unitary UU of SS with tt control qubits is the gate on the control register of tt qubits around SS that applies the Hadamard layer, then the controlled powers of UU, then the inverse Fourier readout gate. On the qudit with pp levels, with U=U1U = U_1, it takes the input state with every bit 00 and u=Fp−1|ℓ⟩u = F_p^{-1}|\ell\rangle to |Ψ⟩=(F2t−1⊗1)CU1(H⊗t⊗1)(|0⟩⊗t⊗Fp−1|ℓ⟩).|\Psi\rangle = \bigl(F_{2^t}^{-1} \otimes 1\bigr)\, C_{U_1} \bigl(H^{\otimes t} \otimes 1\bigr) \bigl(|0\rangle^{\otimes t} \otimes F_p^{-1}|\ell\rangle\bigr).(4)

The Measurement

A measurement on SS with a finite set of outcomes II is a family of operators MiM_i on the state space of SS, one for each outcome ii, satisfying the completeness relation ∑i∈IMi†Mi=1.\sum_{i \in I} M_i^\dagger M_i = 1 .(5)✦ The effects Ei=Mi†MiE_i = M_i^\dagger M_i of a measurement MM on SS make up its positive operator valued measure.✦ The probability of the outcome ii on a state ρ\rho of SS is given by the Born rule, Pρ(i)=Tr⁡(Eiρ)=Tr⁡(MiρMi†).P_\rho(i) = \operatorname{Tr}(E_i\rho) = \operatorname{Tr}\bigl(M_i \rho M_i^\dagger\bigr).(6)✦

A measurement on SS extends to S⊗TS \otimes T as the measurement on the first wires, with the same outcomes and the operators Mi⊗1M_i \otimes 1.✦

Along an identification ee of SS with TT, a measurement MM on SS becomes the measurement on TT with the operators eMie−1eM_ie^{-1}.✦

The measurement of every control wire measures the register of tt qubits in the computational basis, one bit bkb_k on each wire kk, and its outcome is the string b=b0b1⋯bt−1b = b_0 b_1 \cdots b_{t-1}.✦ The readout of the control register of tt qubits around SS is the measurement of every control wire on the first wires of the composite of tt qubits and SS, carried back along the inverse of the split.

A string bb is read as the integer x(b)=∑k=0t−1bk2t−1−k.x(b) = \sum_{k=0}^{t-1} b_k\, 2^{t-1-k} .(7)✦

The nearest bin to a phase θ\theta among dd bins is the integer nearest to θd/2π\theta d/2\pi, reduced modulo dd: bin⁡d(θ)=round⁡(θd2π)mod⁡d.\operatorname{bin}_d(\theta) = \operatorname{round}\Bigl(\frac{\theta d}{2\pi}\Bigr) \bmod d .(8)✦

The Claim

Theorem 1. Let pp be a prime, ℓ\ell a level of the qudit with pp levels, and t≥1t \ge 1. Let |Ψ⟩|\Psi\rangle be the output (4) of the circuit with tt control qubits, and let bb be a string of tt bits. Then the readout on the state |Ψ⟩⟨Ψ||\Psi\rangle\langle\Psi| gives bb with probability at least 4/π24/\pi^2: P|Ψ⟩⟨Ψ|(b)≥4π2,x(b)=bin⁡2t(2πℓp).P_{|\Psi\rangle\langle\Psi|}(b) \ge \frac{4}{\pi^2}, \qquad x(b) = \operatorname{bin}_{2^t}\Bigl(\frac{2\pi\ell}{p}\Bigr).(9)✦

What Is Checked

The claim is stated over the qudit with pp levels and the control register of tt qubits around it, the Hadamard layer, the controlled powers of U1U_1 and the inverse Fourier readout gate built on that register, the output state |Ψ⟩⟨Ψ||\Psi\rangle\langle\Psi| and the measurement of every control wire carried back to the register around the target. It also uses the cyclic shift U1U_1, the state Fp−1|ℓ⟩F_p^{-1}|\ell\rangle, the integer x(b)x(b) read from a bit string and the nearest bin bin⁡2t\operatorname{bin}_{2^t}.

The library proves that the matrix (2) is unitary, so that FdF_d is a unitary of the qudit, and that the tensor product of two unitaries and a unitary carried along an identification are unitaries again. The library also proves that the extension of a measurement to a composite and its transport along an identification are measurements again, with the completeness relation (5), and that the projector |ψ⟩⟨ψ||\psi\rangle\langle\psi| onto a unit vector is a state. The library also proves that the effects EiE_i of a measurement are positive operators that sum to the identity, and that a unitary carries a pure state to a pure state, since it preserves norms.