Lean, informalized

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

Exercise 5.4 - The controlled RkR_k gate as two CNOT gates, two zz rotations of the target and a phase on the control

A controlled phase gate from two CNOT gates.

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 circuit acts on two qubits, a control and a target. The gate RkR_k is the phase gate with angle 2π/2k2\pi/2^k: it leaves |0⟩|0\rangle alone and multiplies |1⟩|1\rangle by e2πi/2ke^{2\pi i/2^k}. The controlled RkR_k gate applies RkR_k to the target when the control is |1⟩|1\rangle and leaves the target alone when the control is |0⟩|0\rangle. The exercise is to build this gate from controlled NOT (CNOT) gates, which flip the target when the control is |1⟩|1\rangle, and gates on a single qubit.

The library states one such circuit for every kk, with two CNOT gates, as an equality of unitaries of the two qubits.

A Quantum System

A quantum system SS is a physical system whose state space is a finite dimensional complex Hilbert space.✦ A pure state ψ\psi of SS is a vector of unit norm in the state space of SS, ‖ψ‖=1\lVert\psi\rVert = 1, determined physically up to a global phase.✦ A unitary UU of SS, a closed system evolution of SS, is an operator on the state space of SS with U†U=UU†=1.U^\dagger U = U U^\dagger = 1 .(1)✦ For two unitaries UU and VV of SS, the product UVUV is the unitary of SS that applies VV first and then UU, so a circuit is the product of its gates with the last gate on the left.✦

The Qubit

The qubit is the quantum system whose state space is ℂ2\mathbb{C}^2, the two dimensional complex Euclidean space.✦ The computational basis states |0⟩|0\rangle and |1⟩|1\rangle of the qubit are the pure states whose vectors are the standard basis vectors e0e_0 and e1e_1 of ℂ2\mathbb{C}^2.✦ The Pauli matrices are the complex 2×22 \times 2 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},(2) and 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. For a real vector n→\vec n and a real angle θ\theta, the rotation operator Rn→(θ)R_{\vec n}(\theta) about n→\vec n is the matrix exponential Rn→(θ)=exp⁡(−iθ2n→⋅σ→),R_{\vec n}(\theta) = \exp\left(-\frac{i\theta}{2}\, \vec n \cdot \vec\sigma\right),(3)✦ written Rnˆ(θ)R_{\hat n}(\theta) when the axis is a unit vector nˆ\hat n. About the axis zˆ=(0,0,1)\hat z = (0, 0, 1) it is Rz(θ)=e−iθZ/2R_z(\theta) = e^{-i\theta Z/2}.✦

A gate on the qubit is a unitary of the qubit, read off from its matrix in the computational basis: XX gives the Pauli XX gate, the quantum NOT, and Rz(θ)R_z(\theta) gives the rotation gate Rz(θ)R_z(\theta). For a real angle α\alpha the phase gate P(α)P(\alpha) is diagonal in the computational basis, P(α)=(100eiα).P(\alpha) = \begin{pmatrix} 1 & 0 \\ 0 & e^{i\alpha} \end{pmatrix} .(4)✦ The gate RkR_k of the exercise is P(2π/2k)P(2\pi/2^k).

Two Qubits

The composite system S⊗TS \otimes T of two quantum systems SS and TT is the quantum system whose state space is the tensor product of the state spaces of SS and TT.✦ For unitaries UU of SS and VV of TT, the product unitary U⊗VU \otimes V of S⊗TS \otimes T is the tensor product of the two operators.✦ A gate on SS alone is U⊗1U \otimes 1, with the identity evolution 11 on TT, and a gate on TT alone is 1⊗V1 \otimes V.

For a unitary UU of a system SS, the controlled gate C(U)C(U) is the unitary of qubit⊗S\mathrm{qubit} \otimes S, a control qubit and a target SS, with C(U)=|0⟩⟨0|⊗1+|1⟩⟨1|⊗U,C(U) = |0\rangle\langle 0| \otimes 1 + |1\rangle\langle 1| \otimes U ,(5)✦ where |0⟩⟨0||0\rangle\langle 0| and |1⟩⟨1||1\rangle\langle 1| project onto the basis states of the control. The CNOT gate is C(X)C(X), the controlled NOT on two qubits, and for a real angle φ\varphi the controlled phase gate is C(P(φ))C(P(\varphi)).

The Claim

Theorem 1. For every natural number kk, with φ=2π/2k\varphi = 2\pi/2^k, the controlled RkR_k gate C(P(φ))C(P(\varphi)) on two qubits is the product C(P(φ))=(P(φ/2)⊗1)(1⊗Rz(φ/2))CNOT(1⊗Rz(−φ/2))CNOT.C(P(\varphi)) = \bigl(P(\varphi/2) \otimes 1\bigr)\,\bigl(1 \otimes R_z(\varphi/2)\bigr)\, \mathrm{CNOT}\,\bigl(1 \otimes R_z(-\varphi/2)\bigr)\,\mathrm{CNOT} .(6)✦

What Is Checked

The claim is stated over unitaries of the two qubits, the composite system qubit⊗qubit\mathrm{qubit} \otimes \mathrm{qubit}.

About these constructions the library proves that each is a unitary. The controlled gate (5) satisfies (1) for every unitary UU of every system; P(α)P(\alpha) is unitary because its diagonal entries have unit modulus, and XX and Rz(θ)R_z(\theta) because their matrices are.