The Exercise
The controlled Z gate acts on two qubits, a control and a target. When the control is in the target is left alone; when it is in the target undergoes the phase flip . The exercise is to show that the two qubits play the same part: the gate with the second qubit as control and the first as target is the same gate as the one with the first qubit as control.
A Quantum System
A quantum system is a physical object whose state space is a finite dimensional complex Hilbert space.✦ A pure state of is a vector of unit norm in the state space of , , determined physically up to a global phase.✦ The composite system of two quantum systems and is the quantum system whose state space is the tensor product of the state spaces of and .✦
The qubit is the two level quantum system with state space .✦ For a bit , the basis state of the qubit is the pure state whose vector is the standard basis vector of , and and are the computational basis states.✦ Two qubits form the composite system .
Unitary Gates
A unitary of a quantum system is a closed evolution of : an operator on the state space of with (1)✦ For two unitaries and of the same system , the unitary after is the composite , which applies first and then .✦
The Pauli , the phase flip, is the unitary of the qubit whose matrix in the computational basis is (2)✦
For a unitary of a system , the controlled gate is the unitary of the composite system of a control qubit and the target whose operator is (3)✦ with and the projectors onto the basis states of the control and the identity on the state space of . The controlled Z gate is , with the Pauli matrix (2), a unitary of .✦
For a system , the swap is the unitary of that exchanges the two factors, so that for pure states and of : (4)✦ On it exchanges the two qubits.
The Claim
Exchanging the roles of the two qubits amounts to swapping them before the gate and swapping them back after it: the control then sits on the second qubit and the phase flip acts on the first.
Theorem 1. Let be the controlled Z gate of two qubits and the swap of . Then (5)✦
What Is Checked
The claim (5) is stated over two unitaries of the two qubit system , the controlled Z gate of (3) and the swap (4), and over their product , a composite of unitaries of .
The library proves that the operator (3) satisfies (1) for every unitary of every system , so that is a unitary, and that after is a unitary whenever and are, being a product of unitaries.