Stabilizer states are determined by their generators. If S is abelian,
−I∈/S and S has n independent generators, the
dimension theorem with k=0 says that S
fixes a one-dimensional subspace, so it determines a unique state ∣ψS⟩ up to
phase. Moreover the normalizer equals ⟨iI⟩S: in the binary
representation, the span S of the generators is isotropic of dimension
n, and S⊥s has dimension 2n−n=n and contains S,
so S⊥s=S. Hence a Pauli operator that commutes with all
of S is λs for some s∈S, and since −I∈/S only one of ±s
lies in S.
Initial state. ∣0⟩⊗n is stabilized by Z1,…,Zn.
Gates. If g∣ψ⟩=∣ψ⟩ then
(UgU†)U∣ψ⟩=U∣ψ⟩, so U∣ψ⟩ is the stabilizer state with
generators UgjU†. These are again Pauli operators, independent and commuting
because conjugation is an automorphism. For a gate on at most two qubits, each
UgjU† differs from gj only on those qubits and in its sign, and the new
entries and sign follow from a fixed table (for H, S, CNOT, the table in the
Clifford group record). Updating all n generators
costs O(n).
Measurement of Za, random case. Suppose some generator, say g1, anticommutes
with Za. Multiplying every other generator that anticommutes with Za by g1 gives
a generating set g1,g2′,…,gn′ of the same group in which only g1
anticommutes with Za; this costs O(n) per generator, O(n2) in all. Then
⟨ψ∣Za∣ψ⟩=⟨ψ∣Zag1∣ψ⟩=−⟨ψ∣g1Za∣ψ⟩=−⟨ψ∣Za∣ψ⟩,
so ⟨ψ∣Za∣ψ⟩=0 and each outcome (−1)μ, μ∈{0,1}, has
probability 21. The post-measurement state is proportional to
21(I+(−1)μZa)∣ψ⟩. It is fixed by (−1)μZa and, because
gj′ commutes with Za, by every gj′. These n operators commute, are
independent (the gj′ are independent, and the vector of Za is not in their
span because Za anticommutes with g1 whereas every element of
⟨g2′,…,gn′⟩⊆S commutes with g1), and their group does not contain −I because they fix a nonzero vector. So the
simulator draws a fair random bit μ and replaces g1 by (−1)μZa.
Measurement of Za, deterministic case. Suppose Za commutes with every
generator. By the first paragraph ϵZa∈S for exactly one
ϵ∈{+1,−1}, so Za∣ψ⟩=ϵ∣ψ⟩ and the outcome is
ϵ with certainty; the state does not change. To find ϵ, solve
∑jxjvj=ea over F2 for the binary vector ea of Za by Gaussian
elimination, O(n3) operations, then multiply the generators gj with xj=1 in
order, tracking the overall phase; each product of two Pauli operators and its phase
costs O(n), so this step costs O(n2). The resulting product is ϵZa.
Classical control and sampling. A conditional gate is simulated by evaluating the
condition on the outcomes already sampled and applying the gate update if required.
Processing the operations in order, each measurement outcome is drawn from its exact
conditional distribution given all previous outcomes, so the joint distribution of
the sampled outcomes is the quantum one. The total cost is O(n) per gate and
O(n3) per measurement.
Measuring a general Pauli operator Q reduces to the same two cases with Q in place
of Za: it is random exactly when Q anticommutes with a generator. The argument is
that of Gottesman, presented as in section 10.5 of
Nielsen and Chuang; Aaronson and
Gottesman replace the Gaussian elimination by
maintaining destabilizer generators, which gives O(n2) per measurement.