Solution (source code)

= Solution

For an $n$-qubit <quantum code> with projector $P$, the <quantum code distance> is
$$
\boxed{d=\min\{\operatorname{wt}(F):F\text{ is a Pauli operator and }PFP\notin\mathbb CP\}.}
$$
Here the weight counts nonidentity tensor factors. Thus every error supported on fewer than $d$ 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 $t=\lfloor(d-1)/2\rfloor$, since each pairwise product has weight at most $2t<d$.

Suppose the code encodes $k$ logical <qubits> and is nondegenerate for all errors through weight $t$. There are
$$
N_t=\sum_{j=0}^t3^j\binom nj
$$
distinct <Pauli errors> modulo phase: choose the $j$ affected positions and choose $X,Y$ or $Z$ at each. Each error is unitary, so its image of the code has dimension $2^k$. Nondegeneracy makes these images mutually orthogonal, equivalently the combined vectors $E_a|i_L\rangle$ are orthonormal. They all lie in the physical <Hilbert space> of dimension $2^n$. Counting dimensions proves the <quantum Hamming bound>
$$
\boxed{2^k\sum_{j=0}^t3^j\binom nj\leq2^n.}
$$
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 $M$ words, the <Hamming bound> is $M\sum_{j=0}^t\binom nj\leq2^n$: disjoint <Hamming balls> around the words must fit into all binary strings. The quantum factor $3^j$ 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 $Y$ error combines bit and phase effects, and the identity with $X,Y,Z$ 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 $[[5,1,3]]$, $t=1$, and
$$
2^1\left(1+3\binom51\right)=2\cdot16=32=2^5.
$$
Thus a nondegenerate such code saturates the bound: the sixteen two-dimensional error images exhaust the physical space. \b[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 $1\leq n\leq4$, the required inequality $1+3n\leq2^{n-1}$ fails.

Here is an explicit realization and its <five-qubit stabilizer syndrome table>. Write tensor products without multiplication symbols and use
$$
g_1=XZZXI,\qquad g_2=IXZZX,\qquad g_3=XIXZZ,\qquad g_4=ZXIXZ.
$$
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 $X$-support at site three fixes the exponent of $g_3$ in such a product to zero, site five then fixes that of $g_2$, site one fixes that of $g_1$, and site two fixes that of $g_4$. Thus their group has sixteen elements and excludes $-I$. The common $+1$ eigenspace has projector $P=\prod_{a=1}^4(I+g_a)/16$ and dimension $\operatorname{Tr}P=32/16=2$, since all nonidentity Pauli strings have zero trace.

Record a syndrome bit as one when an error anticommutes with the corresponding generator, in order $g_1,g_2,g_3,g_4$. Direct local commutation gives
$$
\begin{array}{c|c|c|c}
\text{site}&X&Y&Z\\\hline
1&0001&1011&1010\\
2&1000&1101&0101\\
3&1100&1110&0010\\
4&0110&1111&1001\\
5&0011&0111&0100
\end{array}
$$
These are all fifteen nonzero four-bit <error syndromes>; the identity has $0000$. Distinct errors in this list have a product with nonzero syndrome, so it anticommutes with some $g_a$. Inserting $g_aP=P$ on both sides gives $PE_b^\dagger E_cP=-PE_b^\dagger E_cP=0$. The diagonal product is the identity. Hence the <Knill--Laflamme condition> is exactly $C_{bc}=\delta_{bc}$, 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 $\overline X=X^{\otimes5}$ and $\overline Z=Z^{\otimes5}$ commute with all four generators and anticommute with each other. They are nontrivial logical <Pauli operators>. Multiplication of $\overline X$ by $g_1$ gives $-IYYIX$, a weight-three operator with the same logical action; it cannot be scalar on the code because it anticommutes with the invertible logical operator $\overline Z$. This proves $d=3$ 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 $n-k=4=2(d-1)$. These properties distinguish single-error perfectness from unrestricted protection against larger errors.