The Exercise
On qubits with computational basis , , the gate applies the NOT gate to a target qubit under control qubits: it flips the target between and exactly when every control is in . The exercise is to build it on its own qubits, with no work qubits, from Toffoli gates (NOT gates with two controls), controlled NOT (CNOT) gates and single qubit gates, their number growing no faster than .
Qubits and Gates
A quantum system is a physical system whose state space is a finite dimensional complex Hilbert space.✦ Two quantum systems and form the composite system , whose state space is the tensor product of the state spaces of and .✦ A pure state of a quantum system is a unit vector in the state space of , determined physically up to a global phase.✦ A unitary of a quantum system , an evolution of as a closed system, is an operator on the state space of with .✦
The qubit is the two level system whose state space is .✦ For a bit , the basis state of the qubit is the pure state whose vector is the standard basis vector of .✦ The Pauli , the quantum NOT, is the unitary of the qubit whose matrix in this basis is (1)✦
Controlled Gates
For a unitary of a system , the controlled gate is the unitary of the composite system of a control qubit and the target with operator (2)✦ The CNOT is .
For a system , the register of control qubits on is the system , with and .✦ For a unitary of , the gate with controls is the unitary of given by the recursion (3)✦ It applies to when all controls are in and acts as the identity otherwise. The NOT with controls of the exercise is the gate , that is further controls on a CNOT, acting on the qubits of .
Counting Gates
A unitary of a system has elementary gate budget when, after identifying with a register of qubits by an isomorphism of systems, that is, an identification of their state spaces, is a circuit of at most NOT gates with at most two controls and at most single qubit gates, each of the latter acting alone or under one control.✦
A classical block on qubits is a unitary of a register of qubits that acts on the computational basis as a list of NOT gates, each with at most two controls and its target outside them, run as a classical reversible circuit: (4) for every string of bits, where is the output of the list on . Its budget is .
A single qubit gate has budget , on its own or on one qubit beside idle ones, and so do the controlled gates and , with idle qubits before the control and between the control and the target. Budgets add under composition. If and have budgets and , the circuit followed by , the unitary , has budget . A budget is kept when a unitary of is carried along an isomorphism of with another system , and a budget may be raised to any with and .
The Claim
Theorem 1. Let be an integer. The NOT with controls is built within an elementary gate budget, (5)✦ and the total number of gates in this budget grows no faster than : (6)✦
What Is Checked
The claim is stated over the gate , made by the recursion (3) from the controlled gate (2) and the Pauli of (1) on the register , and over the elementary gate budget with its classical blocks (4).
About these constructions the library proves that is unitary for every unitary of a system , on the state space of , and that the matrix (1) is unitary, so that , and through (3) every , is a unitary of its system.