Lean, informalized

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

Exercise 7.50 - Rotations of two coupled spins and their coupling give three Grover oracles up to a global phase

Pulse sequences for three Grover oracles.

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

Grover’s algorithm on two qubits looks for one marked item among four, x=0,1,2,3x = 0, 1, 2, 3, written in binary as the computational basis states |00⟩|00\rangle, |01⟩|01\rangle, |10⟩|10\rangle and |11⟩|11\rangle, the first qubit carrying the higher bit. The oracle for the marked item x0x_0 is the unitary that multiplies |x0⟩|x_0\rangle by −1-1 and leaves the other three basis states unchanged; for x0=3x_0 = 3 it is the controlled ZZ gate.

In nuclear magnetic resonance (NMR) the two qubits are two coupled nuclear spins, acted on by rotations of each spin and by free evolution under their coupling, of strength JJ. The exercise builds the oracles for x0=0x_0 = 0, 11 and 22 from these: a rotation by −π/2-\pi/2 about zz of each spin, evolution under the coupling for a time tt with Jt=π/4Jt = \pi/4, and, before and after, a rotation by π\pi about xx of each spin whose bit in x0x_0 is 00. Each sequence equals its oracle up to a global phase, and so acts on every state of the two spins as the oracle does. The library states both, for each of the three oracles.

Systems and Their Evolution

A quantum system SS is a physical system whose state space is 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 system whose state space is ℂ2\mathbb{C}^2 itself, and the two spins form the composite system of two qubits.

A pure state |ψ⟩|\psi\rangle of SS is a unit vector in the state space of SS.✦ The computational basis states |0⟩|0\rangle and |1⟩|1\rangle of the qubit are the pure states given by the two standard basis vectors of ℂ2\mathbb{C}^2.✦ A state ρ\rho of SS is a positive operator of unit trace on the state space of SS.✦

A unitary UU of SS is an operator on the state space of SS with U†U=UU†=IU^\dagger U = U U^\dagger = I, where II is the identity operator.✦

Under UU a state ρ\rho of SS evolves as ρ↦UρU†.\rho \mapsto U \rho U^\dagger .(1)✦

For two unitaries UU and VV of SS, UU after VV is the unitary UVUV of SS, first VV and then UU.✦

Given a unitary UU of SS and a unitary VV of TT, the product unitary U⊗VU \otimes V is the unitary of S⊗TS \otimes T whose operator is the tensor product of theirs.✦ The gate U⊗IU \otimes I is the unitary of S⊗TS \otimes T that applies UU to the first factor, and the gate I⊗VI \otimes V is the unitary of S⊗TS \otimes T that applies VV to the second factor.

An observable AA of SS is a self adjoint operator on the state space of SS.✦ The tensor product A⊗BA \otimes B of an observable AA of SS and an observable BB of TT is the observable of S⊗TS \otimes T whose operator is the tensor product of theirs.✦

The propagator of an observable HH of SS, taken as the Hamiltonian, from time t1t_1 to time t2t_2 and with Planck’s constant ℏ\hbar, is the unitary of SS U(t1,t2)=exp⁡[−iH(t2−t1)ℏ].U(t_1, t_2) = \exp\left[-\frac{i H (t_2 - t_1)}{\hbar}\right] .(2)✦

Pauli Matrices and Rotations

The Pauli matrices are the 2×22 \times 2 complex matrices X=(0110),Y=(0−ii0),Z=(100−1).X = \begin{pmatrix} 0 & 1 \\ 1 & 0 \end{pmatrix}, \qquad Y = \begin{pmatrix} 0 & -i \\ i & 0 \end{pmatrix}, \qquad Z = \begin{pmatrix} 1 & 0 \\ 0 & -1 \end{pmatrix}.(3) For a real vector n→=(nx,ny,nz)\vec{n} = (n_x, n_y, n_z) in three dimensions, the matrix n→⋅σ→\vec{n} \cdot \vec{\sigma} is nxX+nyY+nzZn_x X + n_y Y + n_z Z, and the rotation about n→\vec{n} by a real angle θ\theta is the matrix Rn→(θ)=exp⁡(−iθ2n→⋅σ→),R_{\vec{n}}(\theta) = \exp\left(-\frac{i \theta}{2}\, \vec{n} \cdot \vec{\sigma}\right),(4) written Rnˆ(θ)R_{\hat{n}}(\theta) when the axis is a unit vector nˆ\hat{n}. The rotations about the xˆ\hat{x} axis (1,0,0)(1, 0, 0) and the zˆ\hat{z} axis (0,0,1)(0, 0, 1) are Rx(θ)=e−iθX/2R_x(\theta) = e^{-i\theta X/2} and Rz(θ)=e−iθZ/2R_z(\theta) = e^{-i\theta Z/2}.

The gates XX, the quantum NOT, ZZ, the phase flip, and Rx(θ)R_x(\theta) and Rz(θ)R_z(\theta) are the unitaries of the qubit whose matrices in the computational basis are the ones above. The Pauli observable n→⋅σ→\vec{n} \cdot \vec{\sigma} is the observable of the qubit with matrix n→⋅σ→\vec{n} \cdot \vec{\sigma}, and the observable ZZ is the one for nˆ=zˆ\hat{n} = \hat{z}.

Gates on Two Qubits

For a unitary UU of a system SS, the controlled gate C(U)C(U) is the unitary of the composite of a control qubit with the 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 .(5)✦ The controlled ZZ gate is CZ=C(Z)CZ = C(Z) on two qubits, the first the control; its matrix in the computational basis is diag(1,1,1,−1)\mathrm{diag}(1, 1, 1, -1).✦

For a real angle α\alpha, the global phase gate eiαe^{i\alpha} on a system SS is the unitary eiαIe^{i\alpha} I.✦

Oracles and Pulse Sequences

The Grover oracles for x0=0x_0 = 0, 11 and 22 are CZCZ conjugated by XX on the qubits whose bit in x0x_0 is 00, O0=PCZP,P=(X⊗I)(I⊗X),O1=(X⊗I)CZ(X⊗I),O2=(I⊗X)CZ(I⊗X),\begin{aligned} O_0 &= P\, CZ\, P, \qquad P = (X \otimes I)(I \otimes X), \\ O_1 &= (X \otimes I)\, CZ\, (X \otimes I), \\ O_2 &= (I \otimes X)\, CZ\, (I \otimes X), \end{aligned}(6)

The coupling Hamiltonian of the two spins with coupling constant JJ is the observable H=JZ1Z2H = J Z_1 Z_2 of two qubits, the real number JJ times the tensor product Z1Z2=Z⊗ZZ_1 Z_2 = Z \otimes Z of the observable ZZ with itself.✦

For a coupling constant JJ and a time tt, the controlled ZZ pulse sequence is the unitary of two qubits S(J,t)=e−iJtZ1Z2(Rz(−π2)⊗I)(I⊗Rz(−π2)),S(J, t) = e^{-i J t Z_1 Z_2}\, \bigl(R_z(-\tfrac{\pi}{2}) \otimes I\bigr)\bigl(I \otimes R_z(-\tfrac{\pi}{2})\bigr),(7)✦ whose first factor is the propagator (2) of HH from time 00 to time tt, in units with ℏ=1\hbar = 1.

For a coupling constant JJ and a time tt, the pulse sequences N0(J,t)N_0(J, t), N1(J,t)N_1(J, t) and N2(J,t)N_2(J, t) for the three oracles are the unitaries of two qubits that put rotations by π\pi about xx around S(J,t)S(J, t): N0(J,t)=QS(J,t)Q,Q=(Rx(π)⊗I)(I⊗Rx(π)),N1(J,t)=(Rx(π)⊗I)S(J,t)(Rx(π)⊗I),N2(J,t)=(I⊗Rx(π))S(J,t)(I⊗Rx(π)).\begin{aligned} N_0(J, t) &= Q\, S(J, t)\, Q, \qquad Q = \bigl(R_x(\pi) \otimes I\bigr)\bigl(I \otimes R_x(\pi)\bigr), \\ N_1(J, t) &= \bigl(R_x(\pi) \otimes I\bigr)\, S(J, t)\, \bigl(R_x(\pi) \otimes I\bigr), \\ N_2(J, t) &= \bigl(I \otimes R_x(\pi)\bigr)\, S(J, t)\, \bigl(I \otimes R_x(\pi)\bigr). \end{aligned}(8)

The Claim

Theorem 1. Let the coupling constant JJ and the time tt be real numbers with Jt=π/4Jt = \pi/4. Then, with the phases acting as global phase gates, N0(J,t)=e−7πi/4O0,N_0(J, t) = e^{-7\pi i/4}\, O_0 ,(9)✦ N1(J,t)=e−3πi/4O1,N_1(J, t) = e^{-3\pi i/4}\, O_1 ,(10)✦ N2(J,t)=e−3πi/4O2,N_2(J, t) = e^{-3\pi i/4}\, O_2 ,(11)✦ and for every state ρ\rho of two qubits N0(J,t)ρN0(J,t)†=O0ρO0†,N_0(J, t)\, \rho\, N_0(J, t)^\dagger = O_0\, \rho\, O_0^\dagger ,(12)✦ N1(J,t)ρN1(J,t)†=O1ρO1†,N_1(J, t)\, \rho\, N_1(J, t)^\dagger = O_1\, \rho\, O_1^\dagger ,(13)✦ N2(J,t)ρN2(J,t)†=O2ρO2†.N_2(J, t)\, \rho\, N_2(J, t)^\dagger = O_2\, \rho\, O_2^\dagger .(14)✦

What Is Checked

The claim is stated over two families of unitaries of two qubits: the pulse sequences Nx0(J,t)N_{x_0}(J, t) of (8) and the oracles Ox0O_{x_0} of (6).

The library proves that C(U)C(U) is unitary for every unitary UU of a system, which makes CZCZ, and with it each oracle, a unitary of the two qubits.✦ A product and a tensor product of unitaries are unitary, and UρU†U \rho U^\dagger is again a state, so that both sides of (12), (13) and (14) are states of the two qubits.