(a) Invariant. After the first gates, claim that with invertible over and . Initially , . Write for row of , so wire currently holds the parity ; the rows are linearly independent and hence nonzero.
- A CNOT with control and target replaces row by . This is an invertible row operation, so is invertible; the phase is unchanged.
- on wire multiplies by , so , i.e. ; is unchanged.
Induction over the gates gives (a), with the coefficients obtained by summing the powers applied whenever a wire carried each parity.
(b) Counting. By the construction in (a), the final coefficient is the sum of the powers of the gates applied while some wire carried parity . If is odd, at least one of those powers is odd. Distinct with odd therefore need distinct odd-power gates, so there are at most of them.
For the converse, let be the parities with , of which have odd coefficient. For each in turn: choose a wire such that has a 1 in position ; apply CNOTs from every other wire with onto , so wire holds ; apply to wire ; then undo the CNOTs in reverse order. Each block contributes exactly to the phase and leaves the wires as they were. Finally apply a CNOT circuit implementing (any invertible matrix over is a product of elementary row operations, each a CNOT, possibly after reordering wires, and a wire permutation is a product of SWAPs, each three CNOTs). The resulting circuit implements with exactly one gate for each nonzero , of which exactly have odd ; the others are , or , which are Clifford. This is the representation used by Amy, Maslov and Mosca.