Bit-flip repetition code Created 2026-09-28 Updated 2026-10-14
The -qubit bit-flip repetition code stores one logical qubit in and . Its stabilizer generators are for , and its logical operators are and . Interchanging the Pauli X gate and Pauli Z gate gives the phase-flip repetition code. For odd , majority-vote decoding of a repetition code corrects up to physical Pauli X gate errors, assuming ideal operations and a noise family containing only these bit flips.
For , prepare two quantum ancillas in and apply controlled-NOT gates from the input qubit to each of them. By linearity, encoding sends
This does not produce , which would contain cross terms. For example, encoding produces , whereas three independent copies would have eight equal computational basis amplitudes. The encoding creates quantum entanglement when both coefficients are nonzero and respects the no-cloning theorem.
The three-qubit bit-flip syndrome table corrects the family and its entire linear span, as specified by the Knill--Laflamme condition. It cannot correct arbitrary errors on one physical qubit: the phase flip
commutes with both checks and acts as logical . In particular, it takes the encoded to the orthogonal encoded with error syndrome . Thus its full quantum code distance is one, despite correcting one error of the restricted Pauli X gate type. The Shor code, Steane code and five-qubit error correcting code provide protection against arbitrary one-qubit errors.
Error syndrome Created 2026-09-24 Updated 2026-10-14
An error syndrome is the list of outcomes obtained by measuring a chosen ordered family of stabilizer generators. Write for eigenvalue and for eigenvalue . For a definite Pauli error on a code state, the rule is
The commuting checks admit joint orthogonal projectors
For density operator , the Born rule gives outcome probability and conditional state when that probability is nonzero. A definite Pauli error has one deterministic error syndrome independent of the encoded amplitudes. A coherent linear combination of Pauli errors may occupy several sectors, so measuring the error syndrome selects a sector; recovery preserves the logical qubit when the entire error family is jointly correctable. [ref].
An error syndrome locates an error only relative to an assumed family and a recovery rule. Two Pauli errors differing by a logical operator can share an error syndrome; see stabilizer-syndrome coset. In the three-qubit bit-flip syndrome table, and both give . Recovering with corrects the first but converts the second into the logical operator . Likewise, has error syndrome yet changes the encoded relative phase.
The four commuting independent stabilizer generators define a two-dimensional stabilizer code. The identity and fifteen single-site Pauli errors have sixteen distinct four-bit error syndromes, so their two-dimensional images form an orthogonal direct sum of the physical space. This proves nondegenerate single-site correction and the perfect quantum error-correcting code property. The operators and commute with the stabilizer and anticommute with each other. Multiplying by gives, up to phase, , a nontrivial weight-three logical operator, proving distance exactly three.
Use binary linear codes , with dimensions . For each coset in , define
Representatives of one coset give the same vector, and distinct cosets have disjoint computational supports, so these vectors are orthonormal. Their span is the CSS code , encoding .
For , write and . The code is stabilized by for , because it permutes the sum, and by for , because . These Pauli operators commute: . There are independent stabilizer generators, so their common positive eigenspace has dimension ; it is exactly the span above.
The commuting check measurements separate the two types of error. A bit error changes the signs of the checks by , giving the ordinary syndrome of for . A phase error changes the checks by , giving the syndrome of for the dual code . If corrects bit errors and corrects bit errors, these checks identify the respective patterns, and inverse Pauli operations recover the state without revealing the logical coset. This is the nested-code CSS syndrome recovery procedure.
The sharper distances account for harmless stabilizer errors. A Pauli commutes with every check precisely when and . Among these, it acts as a stabilizer, up to a phase, precisely when and . To justify the latter assertion, with permutes distinct logical cosets, while with has unequal signs on two such cosets. Neither can act as a scalar, and a combined operator has the same nontrivial permutation or phase distinction. For positive logical dimension set
The quantum code distance is : a nontrivial logical Pauli has at least one nonstabilizer component of weight at least the corresponding distance, while a pure or pure logical operator attains the minimum. The weight of counts the union of its supports, so this argument also includes errors.
Here is the correction proof for coherent errors, not only a classical decoding argument. Let be the code projector and let have bit-component weights at most and phase-component weights at most . If and , the corresponding components of have weights below . If this product anticommutes with a stabilizer , then , using . If it commutes with all stabilizers, the weight bounds force its two components into and , so its code compression is a scalar multiple of . Thus the Knill--Laflamme condition holds for the entire error family.
To see directly why this gives a common recovery, diagonalize its positive Gram matrix and form the corresponding error combinations . Their restrictions obey . For , is an isometry onto a syndrome subspace, and the different images are orthogonal. Measure these subspaces and apply the inverse isometry; zero- combinations annihilate the code. This recovers every quantum channel whose Kraus operators lie in the error span. Arbitrary operators supported on at most qubits expand in Pauli operators with the same support. Consequently the CSS code corrects all errors on up to qubits, and more generally the asymmetric family just described. The sufficient classical bound is obtained by replacing by the minimum distances of and , respectively; degeneracy can improve it.
Use the normalized three-qubit states . The Shor code has logical basis
It encodes as , preserving the unknown amplitudes by a linear isometry. It concatenates a three-block phase-flip repetition code with the three-qubit bit-flip repetition code inside each block. Six stabilizer generators, , test bit errors inside the blocks. The other two stabilizer generators are
All eight commute and have eigenvalue on both logical basis states. They define the stabilizer code. The inner checks identify single bit flips, and the outer checks identify a block phase flip; combined they also correct a Pauli Y gate error, since .
For the requested phase flip, a on any one qubit interchanges and in its block. It commutes with the six -pair checks. It anticommutes with or exactly when its block is contained in that check. The Shor-code phase-flip syndrome is therefore
A projective measurement of the two commuting checks yields the displayed error syndrome without learning or : both logical components have the same check eigenvalues after the error. Applying the indicated Pauli Z gate restores every encoded quantum state.
The correction is genuinely degenerate. For in the same block, fixes both and , so and consequently . In particular and are distinct physical errors but have identical action on every code state; their image subspaces coincide, not merely their observed syndrome labels. In the Knill--Laflamme condition for , the error Gram matrix has , , and
The zero overlaps between different blocks follow because a phase flip changes a different pattern of orthogonal factors; cross-logical overlaps also vanish. Thus consists of one block and three all-ones blocks and has rank four, not ten. This both proves correctability of the entire single-phase-error span and exhibits its degeneracy. A coherent sum of phase errors in one block has the same logical action with its coefficients summed, so inability to locate the individual qubit loses no logical information. The two block checks suffice to correct every single phase flip, even though the within-block errors are indistinguishable.
For an -qubit quantum code with projector , the quantum code distance is
Here the weight counts nonidentity tensor factors. Thus every error supported on fewer than qubits is detectable, by the Pauli expansion of a quantum error. A scalar action on the code, including a nonidentity stabilizer, is harmless and does not reduce this distance. For a stabilizer code, the equivalent definition minimizes weight among Pauli operators which commute with every stabilizer generator but act nontrivially on the logical information. The Knill--Laflamme condition then guarantees correction of all errors of weight at most , since each pairwise product has weight at most .
Suppose the code encodes logical qubits and is nondegenerate for all errors through weight . There are
distinct Pauli errors modulo phase: choose the affected positions and choose or at each. Each error is unitary, so its image of the code has dimension . Nondegeneracy makes these images mutually orthogonal, equivalently the combined vectors are orthonormal. They all lie in the physical Hilbert space of dimension . Counting dimensions proves the quantum Hamming bound
This dimension argument requires nondegeneracy. For a degenerate code, different errors can share an image, as in the Shor code, and this counting proof cannot be applied unchanged.
For a binary classical code of words, the Hamming bound is : disjoint Hamming balls around the words must fit into all binary strings. The quantum factor is needed because at each erroneous qubit there are three linearly independent nonidentity Pauli operators, not just a classical bit flip. A phase flip is invisible to a computational-basis classical record but changes a quantum superposition. A error combines bit and phase effects, and the identity with spans every one-qubit operator. Quantum correction must protect amplitudes and coherences, and consequently count whole orthogonal logical subspaces rather than just classical words.
For parameters , , and
Thus a nondegenerate such code saturates the bound: the sixteen two-dimensional error images exhaust the physical space. It is a perfect quantum error-correcting code for single-qubit errors. It also has the smallest possible length for nondegenerate single-error protection of one logical qubit: for , the required inequality fails.
Here is an explicit realization and its five-qubit stabilizer syndrome table. Write tensor products without multiplication symbols and use
Each pair has an even number of anticommuting single-site factors, so the four stabilizer generators commute. Their binary Pauli labels are independent: no nonempty product has identity label. For example, the -support at site three fixes the exponent of in such a product to zero, site five then fixes that of , site one fixes that of , and site two fixes that of . Thus their group has sixteen elements and excludes . The common eigenspace has projector and dimension , since all nonidentity Pauli strings have zero trace.
Record a syndrome bit as one when an error anticommutes with the corresponding generator, in order . Direct local commutation gives
These are all fifteen nonzero four-bit error syndromes; the identity has . Distinct errors in this list have a product with nonzero syndrome, so it anticommutes with some . Inserting on both sides gives . The diagonal product is the identity. Hence the Knill--Laflamme condition is exactly , proving nondegenerate correction. Measure the four commuting checks, apply the unique indicated Pauli error again, and every logical state is recovered. The Pauli expansion of a quantum error extends this recovery to an arbitrary one-qubit noise channel, not just the fifteen discrete errors.
The table also proves that every Pauli operator of weight one or two has nonzero syndrome: a weight-two operator is the product of distinct single-site errors, whose syndromes differ. Therefore the distance is at least three. The operators and commute with all four generators and anticommute with each other. They are nontrivial logical Pauli operators. Multiplication of by gives , a weight-three operator with the same logical action; it cannot be scalar on the code because it anticommutes with the invertible logical operator . This proves exactly.
The code consequently detects every two-qubit error and corrects two known-location erasures by the quantum erasure correction criterion, but it cannot correct all two-qubit errors of unknown location. A nontrivial weight-three logical operator can be split into a weight-one and a weight-two error, whose pairwise product violates the correction condition. It also saturates the quantum Singleton bound, since . These properties distinguish single-error perfectness from unrestricted protection against larger errors.
Over a finite field , a linear code of length and dimension is a -dimensional subspace . A full-row-rank generator matrix gives , using row-vector messages. A full-row-rank parity-check matrix gives . The dual code is , of dimension . Thus the rows of span , and
Conversely the rank conditions and imply that the row space of equals the kernel of , by inclusion and equality of dimensions.
For a CSS code, specialize to binary linear codes , of dimensions . Define orthonormal encoded states
Different cosets have disjoint computational-basis support. Their span has dimension , so it encodes logical qubits. For binary vectors write and . The stabilizer generators are for a basis of , and for a basis of . They fix each encoded state: the former permute its coset terms and the latter contribute phases . Their commutation relation is , so the classical dual inclusion makes them commute. There are independent checks, giving precisely this encoded space.
For a Pauli error , the Z checks give bit-error syndrome , where checks , and the X checks give phase-error syndrome , where generates and hence checks . Classical decoders therefore correct up to bit flips and phase flips if and . A Y error has both components; it is not omitted from this correction scheme.
For the precise quantum code distance, harmless stabilizer errors must be excluded. A pure-X error preserves the code exactly when , and is a stabilizer when ; a pure-Z error preserves it when , and is a stabilizer when . Consequently, for ,
A mixed Pauli error has weight equal to the size of the union of its X and Z supports. If it is a nontrivial logical operator, at least one component is nontrivial, so its weight is at least ; pure-X or pure-Z operators attain that minimum. Thus arbitrary-qubit errors are correctable: products of two such Pauli errors have weight below and act scalarly on the code, or take it to an orthogonal syndrome sector. This is the Knill--Laflamme condition. Expanding arbitrary errors in the Pauli basis extends correction to their coherent linear span.
An explicit example is the Steane code. Take to be the binary Hamming code with
The distinct nonzero columns show that has no weight-one or weight-two word, while three dependent columns give a weight-three word. Hence its classical distance is three. Direct multiplication gives , proving . Every nonzero word of has weight four, so the logical X and Z distances are both three. Its six stabilizer checks are the X and Z strings given by the three rows of . A logical basis is the uniform superposition over and over , since . The resulting CSS code corrects every single-qubit error.
Let , and write for any odd-weight word . The parity functional on the four-dimensional binary linear code is nonzero, so its kernel has dimension three and its other fibre is the coset . For example belongs to the standard length-seven Hamming code and has odd Hamming weight. Denote the two logical basis states by and , corresponding to these two cosets. The eight computational orthonormal basis vectors in each sum are distinct, so both logical states have norm one; their disjoint supports make them orthogonal.
For a binary vector , define the product of Pauli Z gates
where the dot product is computed modulo two. The key diagonal overlap, with and , is
If , every summand is one. If , choose with . Translation permutes and negates every summand. The sum must then be zero. Thus
Off-diagonal logical overlaps vanish for every :
because a diagonal Pauli operator cannot move a computational basis word from one coset to the disjoint other coset.
The possible errors are and for . Set . Each phase flip is its own adjoint and inverse, so
If , the vector is nonzero and has Hamming weight one or two. By the given dual code identity and the minimum Hamming distance three of the Hamming code, it cannot belong to . Hence all its diagonal logical overlaps vanish. If , the product is the identity and its logical overlaps are . Combining both cases gives
This proves the Knill--Laflamme condition with an identity error-overlap matrix, not merely a possibly degenerate scalar matrix. In particular the eight two-dimensional error subspaces are mutually orthogonal. This is precisely nondegenerate phase-flip correction in the Steane code.
To exhibit recovery rather than only the criterion, let be the orthogonal projector onto the code and . The projective measurement consisting of these eight mutually orthogonal projectors, completed by , determines which error occurred. For an arbitrary encoded pure state affected by , outcome occurs with certainty and leaves unchanged. Applying again recovers . The outcome gives the error syndrome and does not reveal or , so recovery preserves logical quantum superpositions.
An equivalent explicit error syndrome uses three commuting X-type stabilizer generators. Choose a parity-check matrix for with the seven different nonzero binary columns:
Its rows span . For a row , the operator permutes each of and , and therefore has eigenvalue on both logical states. A phase flip at position changes its eigenvalue to , since . Measuring the three commuting stabilizer generators gives the th column of as a binary syndrome; no error gives the zero column. All eight outcomes are different, and applying the identified restores the code state. Measuring these stabilizer generators never distinguishes the two logical states.
Finally, if a noise Kraus operator is a coherent linear combination , the same syndrome measurement separates its mutually orthogonal components . Conditional recovery returns in every nonzero branch. Linearity then also corrects any quantum channel whose Kraus operators lie in this span. The argument therefore corrects arbitrary unknown single-site phase flips nondegenerately, including coherent phase-error amplitudes, rather than only a known error on a basis codeword.
Let be the bit string with one in position and zero elsewhere, and use the standard convention . On the computational basis, the single-site Pauli operators act as
The identity leaves the basis state unchanged. A tensor-product Pauli operator applies these actions at each occupied site; operators at different sites commute. Their linear span is the full operator algebra, so correcting their span handles coherent combinations as well as random Pauli errors.
Let project onto the code , with orthonormal logical basis . A set is correctable exactly when the Knill--Laflamme condition holds:
for a matrix independent of the logical indices. A set is detectable when
These conditions extend by linearity to the corresponding operator spans. Detection allows an error to act as a harmless scalar on the code; it need not assign a distinct syndrome to such an error.
For distinct Pauli representatives modulo phase, a nondegenerate quantum error-correcting code has orthogonal error-image subspaces, giving because each Pauli is unitary. In the usual nondegenerate, or pure, detection convention, every nonidentity detectable Pauli has , while . More generally a nonsingular error-overlap matrix can be diagonalized and the resulting error operators rescaled to obtain orthogonal syndrome spaces; a singular overlap matrix expresses degeneracy of the specified independent error family.
For an code, the quantum code distance is the smallest Pauli weight for which scalar compression fails. Hence every Pauli of weight at most is detectable. If each have weight at most , their product has weight at most . When , its compression is scalar, so the Knill--Laflamme condition proves simultaneous correction of all such errors. Therefore
The integer part is understood when the printed half-distance is not an integer. Arbitrary operators on such subsets are covered by their Pauli expansion.
For errors confined to a known set of positions, every pairwise product is still supported on that same set and has weight at most , rather than . Thus supplies quantum erasure correction, with maximum guaranteed number
This guarantee cannot hold for every set of positions: a minimum-weight undetectable Pauli has support in such a set, and the pair consisting of it and the identity violates the Knill--Laflamme condition. Particular larger location sets can sometimes be correctable; is the maximum uniform guarantee over all possible known sets.
For the Shor code, write . The logical codewords are and . A phase flip in one block interchanges and in that block, independently of its position within the block. Let , , . Measure the two commuting stabilizer generators and . Both are on the entire logical code space. The Shor-code phase-flip syndrome is
These parity measurements reveal the erroneous block without revealing the logical amplitudes, so they preserve arbitrary superpositions of the two codewords. Applying the listed representative phase flip restores the state.
For any two physical positions in the same block, acts as on both and , and hence on the code. Therefore and even when . Their error spaces coincide, and the error-overlap matrix has a nonzero off-diagonal entry. The correction is degenerate because different within-block phase errors have exactly the same action on every logical state.
The physical space of qubits is . An error operator is a linear operator on this space, for example one Kraus operator of a noise quantum channel. The usual channel description assumes initially uncorrelated system and environment, with the environment subsequently ignored; more general initial correlations need not define a channel on arbitrary system inputs. Finite dimension and the tensor decomposition into identifiable qubits allow an exact Pauli expansion of a quantum error. No independence between errors on different qubits is assumed by this expansion.
The tensor products of form an orthogonal basis of the operator space under the Hilbert-Schmidt inner product. Equivalently, absorbing phases into coefficients, every error has an expansion
For a computational basis vector labelled by , this gives
where addition and the dot product in the exponent are modulo two. Thus changes a bit, changes its phase, and performs both up to a scalar phase. A general error is a coherent linear combination of such actions; it need not be a classical random choice of Pauli operators. A restriction to at most faulty qubits is an additional locality assumption, expressed by the span of Pauli operators of weight at most .
The weight of a Pauli operator is the number of tensor factors different from , ignoring global phase. Let be the orthogonal projector onto a -dimensional code . Quantum error detection means
Indeed, a projective measurement of flags departure from the code, while its code-space outcome acts as the scalar on every encoded state and hence does not change logical information. Harmless scalar actions are included in this criterion. The quantum code distance is
Thus every Pauli operator of weight at most is detectable. The condition is linear in , so it holds for any error in their span. This proves detection of arbitrary errors affecting at most qubits, including coherent errors.
For correction, put and take all phase-free Pauli operators of weight at most . Their pairwise products satisfy
These are the Knill--Laflamme conditions. Here is their recovery construction, rather than merely using the criterion's name. For any normalized code state , the matrix is a Gram matrix, since , and is therefore positive semidefinite. Choose linear combinations of the errors diagonalizing this matrix, so that
For , the operators are isometries from the code into mutually orthogonal error-image subspaces: . Measure the projectors and, on outcome , apply . Complete this recovery arbitrarily on the remaining orthogonal subspace to make a trace-preserving quantum channel.
For an error and any encoded density operator , the recovered contribution is
Terms with annihilate the code. For a physical noise channel whose Kraus operators belong to this span, summing the displayed scalar over those operators gives one by trace preservation. The resulting recovered state is exactly . This proves the constructive recovery from the Knill-Laflamme condition and the requested guarantee
This argument allows degenerate codes; distinct physical errors may have identical actions on the code.
For the Shor code, define . Its two normalized basis codewords are
Six stabilizer generators are ; the two phase checks are
All eight have eigenvalue on both basis codewords. A phase error commutes with the six checks and anticommutes with both and . Their projective measurements therefore return
The two negative phase checks identify the middle three-qubit block. Apply the Pauli Z gate to restore the state, since . This procedure acts identically on every logical superposition, and the checks reveal no logical amplitudes. The syndrome cannot distinguish from or , but all three have the same action on the code: their pairwise products lie in the stabilizer group. Correcting with any one of them is sufficient. Thus the degeneracy in the syndrome is harmless.
The -qubit Pauli group is
A stabilizer group is an abelian subgroup of excluding . Its associated stabilizer code is the common positive eigenspace
The exclusion of is necessary for a nonzero code, since no nonzero vector has eigenvalue under .
Every is a signed Hermitian tensor product of Pauli matrices. An imaginary-phase Pauli element would have , contradicting closure of and exclusion of ; hence and . If , it cannot be a nontrivial scalar Pauli element, and at least one of its local factors is or . Each of these has trace zero. Using gives .
The spectral theorem for Hermitian operators and show that all eigenvalues are or . If their multiplicities are and , then
Thus the balanced spectrum of a nonidentity stabilizer is
This concerns a nonidentity stabilizer acting on the entire physical space; on the code every stabilizer acts with eigenvalue .
Because all elements commute and square to , is a vector space over under multiplication. Its independent stabilizer generators satisfy that no nonempty product is ; all products are distinct. The stabilizer-projector formula is
To verify it, group multiplication gives , Hermiticity gives , and for every . Conversely every code vector is fixed by this average, so its range is exactly . All nonidentity stabilizers have trace zero by the preceding proof. Therefore
For a code of dimension , the number of independent generators is consequently . One can list additional redundant generators, but an independent generating set has exactly this size.
For a correctable Pauli error , define the syndrome bit to be zero when commutes with and one when it anticommutes. On an encoded state,
Measure the commuting stabilizer generators; their eigenvalues reveal the error syndrome without revealing logical amplitudes. In a nondegenerate quantum code, the distinct specified correctable errors have orthogonal images of the code and distinct syndromes. A syndrome therefore identifies the error representative, and applying the inverse Pauli operator restores the encoded state.
If an actual error operator is a coherent linear combination of the specified errors, its state is a sum of these orthogonal syndrome components. Syndrome measurement selects one component, followed by the same inverse operation. The linearity of coherent quantum error correction ensures the logical state is recovered in every outcome. The same procedure handles noise Kraus operators in that error span; it does not require a probabilistic Pauli-noise assumption.
A Pauli error commuting with every stabilizer has the all-zero syndrome and preserves the code space. If it is a stabilizer up to global phase, this silent action is harmless. If it lies in the centralizer of a stabilizer group but is not a stabilizer up to phase, it acts as a nontrivial logical operator, and syndrome measurements cannot detect it. More generally, a non-scalar component of an error is an undetectable logical action. This distinguishes harmful undetected errors from scalar actions that satisfy quantum error detection algebraically.
The three-qubit bit-flip repetition code has basis and generators
A single phase flip commutes with both and has zero syndrome, but
It is a nontrivial logical phase operation. In particular, is not scalar, so the error set violates the Knill--Laflamme condition and cannot be corrected. Thus the code corrects single bit flips but not single phase flips; its distance against arbitrary quantum errors is one.
Shor code 2026-10-14
The nine-qubit Shor code encodes one logical qubit with basis vectors and , where . Six adjacent -pair stabilizer generators locate a single bit flip within a block, while and diagnose which block has had its relative phase changed. Together they correct every single-qubit Pauli operator, hence every single-qubit error by the Pauli expansion of a quantum error.
A Pauli Z gate on qubit four has phase-check eigenvalues and leaves all six -pair checks positive. Applying restores the state. The same phase syndrome arises from or ; these have the same action on the code since their pairwise products are stabilizers. This is a degeneracy, not a failure of correction.
Group the nine physical qubits into three blocks and write for the product of three Pauli X gates in block . The commuting stabilizer generators and have eigenvalue on both logical codewords. A Pauli Z gate in blocks one, two or three gives syndromes , or respectively. Apply a Z gate to any one qubit of the indicated block to recover the logical state. Z errors at distinct locations within a block act identically on the code, so this correction is degenerate.
Stabilizer code Created 2026-09-24 Updated 2026-10-14
A stabilizer code is the common eigenspace of a stabilizer group , an abelian subgroup of the Pauli group excluding . Choose independent stabilizer generators on physical qubits. They are commuting Hermitian operators, each squaring to . The stabilizer subspace and its orthogonal projector are
The stabilizer-projector formula gives , so logical qubits remain. Independent here means that no nonempty product of the chosen stabilizer generators is . Excluding is necessary: a vector cannot simultaneously be fixed by and unless it is zero.
For the three-qubit bit-flip repetition code, take and , with the Pauli Z gate on site and identities elsewhere. The stabilizer group is . Both stabilizer generators have eigenvalue exactly on the span of and , giving dimensions for one logical qubit. A projective measurement of these checks distinguishes four orthogonal two-dimensional sectors rather than eight individual computational basis states.
A Pauli error that anticommutes with a stabilizer generator changes that check's sign, producing an error syndrome. A Pauli operator commuting with every check can still act on the logical qubits; the centralizer of a stabilizer group describes these possibilities. Thus the number of checks determines the encoded dimension, while the quantum code distance determines protection against arbitrary local errors. The five-qubit error correcting code, for instance, has four stabilizer generators and quantum code distance three; the three-qubit bit-flip repetition code has two checks but quantum code distance one because a single phase flip is unflagged. [ref].