Lean, informalized

Nielsen & Chuang · Chapter 4, Quantum circuits · p. 179

Exercise 4.17 - The controlled NOT as a controlled Z gate between two Hadamard gates on the target

A CNOT from a controlled Z and two Hadamards.

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

Two qubits are given, a control and a target. The controlled NOT (CNOT) gate flips the target exactly when the control is |1⟩\lvert 1 \rangle; the controlled ZZ gate applies the phase flip ZZ to the target exactly when the control is |1⟩\lvert 1 \rangle. The exercise asks for a CNOT gate made of one controlled ZZ gate and two Hadamard gates, with the control and the target qubits specified. The library’s answer is an equality of two unitaries of a pair of qubits.

Two Qubits

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, fixed physically up to a global phase.✦ 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 their state spaces.✦

The qubit is the two level quantum system whose state space is ℂ2\mathbb{C}^2.✦ The basis states |0⟩\lvert 0 \rangle and |1⟩\lvert 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 exercise takes place on the composite system of two qubits, the first factor the control and the second the target.

Unitaries and Gates

A unitary UU of a quantum system SS is an operator on the state space of SS with U†U=UU†=1U^\dagger U = U U^\dagger = 1, a closed system evolution of SS.✦ The identity evolution of SS is the unitary whose operator is 11.✦ Two unitaries UU and VV of SS compose to the unitary UU after VV, whose operator is UVUV: first VV acts, then UU.✦ When UU is a unitary of SS and VV one of a second system TT, the product unitary U⊗VU \otimes V is the unitary of S⊗TS \otimes T whose operator is the tensor product of the two operators.✦ Taking the identity evolution for the first factor gives the gate 1⊗V1 \otimes V on the last factor, which applies VV to TT and leaves SS alone.✦

The Hadamard gate HH, the Pauli XX or quantum NOT, and the Pauli ZZ or phase flip are the unitaries of the qubit whose operators, in the basis |0⟩,|1⟩\lvert 0 \rangle, \lvert 1 \rangle, are the matrices H=12(111−1),X=(0110),Z=(100−1).H = \frac{1}{\sqrt{2}} \begin{pmatrix} 1 & 1 \\ 1 & -1 \end{pmatrix}, \qquad X = \begin{pmatrix} 0 & 1 \\ 1 & 0 \end{pmatrix}, \qquad Z = \begin{pmatrix} 1 & 0 \\ 0 & -1 \end{pmatrix}.(1)

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 the target SS with operator C(U)=|0⟩⟨0|⊗1+|1⟩⟨1|⊗U.C(U) = \lvert 0 \rangle\langle 0 \rvert \otimes 1 + \lvert 1 \rangle\langle 1 \rvert \otimes U .(2)✦ The CNOT gate is C(X)C(X), and the controlled ZZ gate, written CZ\mathrm{CZ}, is C(Z)C(Z); both are unitaries of two qubits.

The Claim

Theorem 1. On two qubits, a Hadamard gate on the target, then the controlled ZZ gate, then a second Hadamard gate on the target make up the CNOT gate: CNOT=(1⊗H)CZ(1⊗H).\mathrm{CNOT} = (1 \otimes H)\, \mathrm{CZ}\, (1 \otimes H).(3)✦

What Is Checked

The claim is stated over the controlled gate (2) with target XX on the left and target ZZ on the right, and over the gate 1⊗H1 \otimes H on the target, composed one after another.

The library proves that the operator (2) is unitary for every unitary UU of every system, C(U)†C(U)=C(U)C(U)†=1C(U)^\dagger C(U) = C(U) C(U)^\dagger = 1.✦ It proves as well that a unitary after a unitary is unitary, that the tensor product of two unitaries is unitary, and that the three matrices of (1) are unitary.