Lean, informalized

Nielsen & Chuang · Chapter 7, Quantum computers: physical realization · p. 294

Exercise 7.13 - Four oracles on one bit, the optical gates that build the two balanced ones, and the bit the circuit returns

Deutsch’s algorithm from beamsplitters and a Kerr gate.

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 function ff from one bit to one bit is constant when f(0)=f(1)f(0) = f(1) and balanced when f(0)≠f(1)f(0) \neq f(1). There are four of them: the constants 00 and 11, the identity x↦xx \mapsto x and the negation x↦x⊕1x \mapsto x \oplus 1, where ⊕\oplus is the sum modulo 22. Given ff only as a black box acting on two qubits, Deutsch’s algorithm tells the two kinds apart with a single use of the box. The exercise is to build this circuit from optical elements acting on single photons.

The library gives a black box, an oracle, for each of the four functions, and writes the two balanced ones as a controlled phase shift of angle π\pi, the optical Kerr gate, between Hadamard gates. It realises the Hadamard gate on one photon in two modes by a beamsplitter and a mirror, and states for each oracle which bit the measurement of the first qubit returns.

A Quantum System

A quantum system SS is given by its state space, a finite dimensional complex Hilbert space.✦ The composite system S⊗TS \otimes T of two systems SS and TT is the system whose state space is the tensor product of their state spaces.✦ The qubit is the two level system with state space ℂ2\mathbb{C}^2, and its basis states |0⟩|0\rangle and |1⟩|1\rangle are the two standard basis vectors.

A pure state |ψ⟩|\psi\rangle of SS is a unit vector in the state space of SS, and pure states |ψ⟩|\psi\rangle of SS and |φ⟩|\varphi\rangle of TT give the product state |ψ⟩⊗|φ⟩|\psi\rangle \otimes |\varphi\rangle of S⊗TS \otimes T. A state ρ\rho of SS is a positive operator of unit trace on the state space of SS.✦ A pure state |ψ⟩|\psi\rangle gives the state |ψ⟩⟨ψ||\psi\rangle\langle\psi|, the projector onto its vector.✦

A unitary UU of SS is an operator on the state space of SS with U†U=UU†=1U^\dagger U = U U^\dagger = 1; it carries a pure state |ψ⟩|\psi\rangle to the pure state U|ψ⟩U|\psi\rangle. For two unitaries UU and VV of SS, the product UVUV is the unitary that applies VV first and then UU, and the identity evolution II is the unitary whose operator is the identity. Unitaries UU of SS and VV of TT give the product unitary U⊗VU \otimes V of S⊗TS \otimes T; with the identity on the other factor, U⊗IU \otimes I is UU on the first factor and I⊗VI \otimes V is VV on the last. On two copies of one system, the SWAP is the unitary that exchanges the factors, SWAP(|α⟩⊗|β⟩)=|β⟩⊗|α⟩\mathrm{SWAP}\,(|\alpha\rangle \otimes |\beta\rangle) = |\beta\rangle \otimes |\alpha\rangle.✦

Gates

The Hadamard gate HH and the Pauli XX, the quantum NOT, are the unitaries of the qubit whose matrices in the basis |0⟩,|1⟩|0\rangle, |1\rangle are H=12(111−1),X=(0110).H = \frac{1}{\sqrt 2}\begin{pmatrix} 1 & 1 \\ 1 & -1 \end{pmatrix}, \qquad X = \begin{pmatrix} 0 & 1 \\ 1 & 0 \end{pmatrix}.(1) For a real angle α\alpha, the phase shift P(α)P(\alpha) is the unitary of the qubit that leaves |0⟩|0\rangle alone and multiplies |1⟩|1\rangle by eiαe^{i\alpha}.✦

For a unitary UU of a system SS, the controlled gate C(U)C(U) is the unitary of the composite system of a control qubit and a target SS given by C(U)=|0⟩⟨0|⊗I+|1⟩⟨1|⊗U.C(U) = |0\rangle\langle 0| \otimes I + |1\rangle\langle 1| \otimes U.(2)✦ The controlled NOT, or CNOT, is C(X)C(X), and the controlled phase shift with angle φ\varphi is C(P(φ))C(P(\varphi)).

For angles φa\varphi_a, φb\varphi_b and Δ\Delta, the optical Kerr gate is the unitary of two qubits that applies the controlled phase shift C(P(Δ))C(P(\Delta)) and then a phase shift on each qubit: K(φa,φb,Δ)=(P(φb)⊗I)(I⊗P(φa))C(P(Δ)).K(\varphi_a, \varphi_b, \Delta) = \bigl(P(\varphi_b) \otimes I\bigr) \bigl(I \otimes P(\varphi_a)\bigr)\, C\bigl(P(\Delta)\bigr).(3)✦

Single Photons

A single photon shared between two optical modes is described on the composite system of two qubits, one for each mode, |1⟩|1\rangle standing for a photon in the mode and |0⟩|0\rangle for none. The dual rail logical zero |0L⟩=|01⟩|0_L\rangle = |01\rangle is a photon in the second mode, and the logical one |1L⟩=|10⟩|1_L\rangle = |10\rangle a photon in the first. For complex amplitudes c0c_0 and c1c_1 with |c0|2+|c1|2=1|c_0|^2 + |c_1|^2 = 1, the dual rail state c0|0L⟩+c1|1L⟩c_0|0_L\rangle + c_1|1_L\rangle is the pure state of the two modes with these amplitudes, the general state of one photon in two modes.✦

The beamsplitter with mixing angle θ\theta is the unitary of the two modes with operator B(θ)=1+(cos⁡θ−1)P+sin⁡θG,B(\theta) = 1 + (\cos\theta - 1)\,P + \sin\theta\, G,(4) where P=|01⟩⟨01|+|10⟩⟨10|P = |01\rangle\langle 01| + |10\rangle\langle 10| is the projector onto the dual rail plane, spanned by |0L⟩|0_L\rangle and |1L⟩|1_L\rangle, and G=|10⟩⟨01|−|01⟩⟨10|G = |10\rangle\langle 01| - |01\rangle\langle 10| is the generator of rotations in that plane. Followed by a mirror that exchanges the two modes, the SWAP, the beamsplitter at θ=π/4\theta = \pi/4 gives the unitary SWAPB(π/4)\mathrm{SWAP}\,B(\pi/4).✦

The Oracles and the Circuit

For a function ff from one bit to one bit, a unitary UfU_f of two qubits is an oracle for ff when, for all bits xx and yy, Uf(|x⟩⊗|y⟩)=|x⟩⊗|y⊕f(x)⟩.U_f\bigl(|x\rangle \otimes |y\rangle\bigr) = |x\rangle \otimes |y \oplus f(x)\rangle.(5)✦ The library defines one unitary of two qubits for each function on one bit: U0=I,U_0 = I,(6) U1=I⊗X,U_1 = I \otimes X,(7) Uid=CNOT,U_{\mathrm{id}} = \mathrm{CNOT},(8) U¬=(X⊗I)CNOT(X⊗I).U_{\neg} = (X \otimes I)\, \mathrm{CNOT}\, (X \otimes I).(9)

The Deutsch circuit for a unitary UU of two qubits applies a Hadamard gate to each qubit, then UU, then a Hadamard gate to the first qubit alone: D(U)=(H⊗I)U(H⊗H).D(U) = (H \otimes I)\, U\, (H \otimes H).(10)✦

Measuring the Control Qubit

A measurement on a system SS with a finite set of outcomes is a family of operators MiM_i on the state space of SS, one for each outcome ii, with ∑iMi†Mi=1\sum_i M_i^\dagger M_i = 1, the completeness relation.✦ Performed on a state ρ\rho of SS, it gives the outcome ii with the probability p(i)=Tr⁡(MiρMi†)=Tr⁡(Eiρ)p(i) = \operatorname{Tr}\bigl(M_i \rho M_i^\dagger\bigr) = \operatorname{Tr}(E_i \rho)(11) of the Born rule, where the positive operators Ei=Mi†MiE_i = M_i^\dagger M_i make up the positive operator valued measure of the measurement.

The projective measurement in an orthonormal basis {|bi⟩}\{|b_i\rangle\} is the measurement whose operator for the outcome ii is the projector |bi⟩⟨bi||b_i\rangle\langle b_i|.✦ A measurement with operators MiM_i on SS gives the measurement on the first factor of S⊗TS \otimes T, with the same outcomes and the operators Mi⊗IM_i \otimes I.✦ The measurement of the control qubit on the composite system of a qubit and a system SS is the projective measurement of the qubit in the basis |0⟩,|1⟩|0\rangle, |1\rangle performed on the first factor: its outcomes are 00 and 11, its operators |0⟩⟨0|⊗I|0\rangle\langle 0| \otimes I and |1⟩⟨1|⊗I|1\rangle\langle 1| \otimes I.✦

The Claim

Theorem 1. The beamsplitter at mixing angle π/4\pi/4 followed by the mirror acts on the dual rail qubit as the Hadamard gate (1): SWAPB(π/4)|0L⟩=22(|0L⟩+|1L⟩),\mathrm{SWAP}\,B(\pi/4)\,|0_L\rangle = \tfrac{\sqrt 2}{2}\bigl(|0_L\rangle + |1_L\rangle\bigr),(12)✦ SWAPB(π/4)|1L⟩=22(|0L⟩−|1L⟩).\mathrm{SWAP}\,B(\pi/4)\,|1_L\rangle = \tfrac{\sqrt 2}{2}\bigl(|0_L\rangle - |1_L\rangle\bigr).(13)✦

Theorem 2. Each of the four unitaries is an oracle for its function: for all bits xx and yy, U0(|x⟩⊗|y⟩)=|x⟩⊗|y⟩,U_0\bigl(|x\rangle \otimes |y\rangle\bigr) = |x\rangle \otimes |y\rangle,(14)✦ U1(|x⟩⊗|y⟩)=|x⟩⊗|y⊕1⟩,U_1\bigl(|x\rangle \otimes |y\rangle\bigr) = |x\rangle \otimes |y \oplus 1\rangle,(15)✦ Uid(|x⟩⊗|y⟩)=|x⟩⊗|y⊕x⟩,U_{\mathrm{id}}\bigl(|x\rangle \otimes |y\rangle\bigr) = |x\rangle \otimes |y \oplus x\rangle,(16)✦ U¬(|x⟩⊗|y⟩)=|x⟩⊗|y⊕x⊕1⟩.U_{\neg}\bigl(|x\rangle \otimes |y\rangle\bigr) = |x\rangle \otimes |y \oplus x \oplus 1\rangle.(17)✦

Theorem 3. The two balanced oracles are made from the Kerr gate K(0,0,π)K(0, 0, \pi) between Hadamard gates on the second qubit, the oracle for the negation with a NOT gate on the first qubit before and after: Uid=(I⊗H)K(0,0,π)(I⊗H),U_{\mathrm{id}} = (I \otimes H)\, K(0, 0, \pi)\, (I \otimes H),(18)✦ U¬=(X⊗I)(I⊗H)K(0,0,π)(I⊗H)(X⊗I).U_{\neg} = (X \otimes I)(I \otimes H)\, K(0, 0, \pi)\, (I \otimes H)(X \otimes I).(19)✦

Theorem 4. Let the Deutsch circuit act on the product state |0⟩⊗|1⟩|0\rangle \otimes |1\rangle, write |ψU⟩=D(U)(|0⟩⊗|1⟩)|\psi_U\rangle = D(U)\bigl(|0\rangle \otimes |1\rangle\bigr) for its output with the oracle UU, and let pU(i)p_U(i) be the probability of the outcome ii when the control qubit is measured on the state |ψU⟩⟨ψU||\psi_U\rangle\langle\psi_U|. For the constant oracles the outcome is 00 with certainty, and for the balanced oracles it is 11: pU0(0)=1,p_{U_0}(0) = 1,(20)✦ pU1(0)=1,p_{U_1}(0) = 1,(21)✦ pUid(1)=1,p_{U_{\mathrm{id}}}(1) = 1,(22)✦ pU¬(1)=1.p_{U_{\neg}}(1) = 1.(23)✦

What Is Checked

The claim is stated over the Deutsch circuit (10) with the four oracles (6) to (9), the oracle condition (5), and the Born probability (11) of the measurement of the control qubit; on the optical side, over the Kerr gate (3) between Hadamard gates and over the beamsplitter (4) with its mirror acting on the dual rail states.

About these constructions the library proves that the beamsplitter operator B(θ)B(\theta) is unitary for every angle θ\theta and that C(U)C(U) is unitary for every unitary UU. It proves that the dual rail superposition c0|0L⟩+c1|1L⟩c_0|0_L\rangle + c_1|1_L\rangle is a unit vector whenever |c0|2+|c1|2=1|c_0|^2 + |c_1|^2 = 1, and that the amplitudes 22(c0+c1)\tfrac{\sqrt 2}{2}(c_0 + c_1) and 22(c0−c1)\tfrac{\sqrt 2}{2}(c_0 - c_1) then satisfy the same condition. A measurement on the first factor, the measurement of the control qubit among them, again satisfies the completeness relation.