The Exercise
The circuit of Figure 10.25 applies the gate to a data qubit without ever acting on that qubit with . An ancilla is prepared in the state that a Hadamard gate followed by makes from . A controlled NOT gate (CNOT) then acts with the ancilla as control and the data qubit as target, and the data qubit is measured in the computational basis. On outcome the ancilla is left in .✦ On outcome the correction , the bit flip followed by the phase gate , brings it to up to a global phase.
Gates and States
Each gate is a matrix in the computational basis , of . The gate , the phase gate , the Pauli matrix and the Hadamard gate are the complex matrices (1) The correction gate is the product of the phase gate and the Pauli matrix , (2)✦ The ancilla state is the qubit state (3)✦
A vector of two qubits has four amplitudes, on , , and in this order. The tensor product of qubit vectors and is the vector of two qubits (4)✦ The CNOT with the first qubit as control is the matrix that exchanges and and fixes and . The gate on the control qubit is , where is the identity on the second qubit; it is the diagonal matrix (5)✦
For complex numbers and , the state of the circuit after the CNOT is the vector of two qubits (6)✦ with the ancilla as the first qubit and the data qubit as the second. The data qubit reads on the amplitudes and , and on and .
The Claim
Theorem 1. Let and be complex numbers, , and the state (6). The vector the ancilla is left with on outcome of the data qubit is (7)✦ and the correction takes the vector it is left with on outcome to (8)✦
Theorem 2. The Hadamard gate and prepare the ancilla state from : (9)✦ The gate on the control qubit commutes with the CNOT: (10)✦ Conjugation by takes to a multiple of the correction gate, (11)✦ while the product differs from that multiple: (12)✦
What Is Checked
The first theorem is stated over the state (6) after the CNOT and over the gates and . What the library proves about these constructions is the second theorem, (9) to (12).