Shor's code (1995), the first quantum error-correcting code, protects one logical qubit against any single-qubit error by concatenating two 3-qubit repetition codes:
|0⟩_L = (|000⟩+|111⟩)(|000⟩+|111⟩)(|000⟩+|111⟩) / 2√2
|1⟩_L = (|000⟩−|111⟩)(|000⟩−|111⟩)(|000⟩−|111⟩) / 2√2
Inner code — bit-flip (X) protection. Each of the 3 blocks measures Z₁Z₂ and Z₂Z₃ to get a 2-bit syndrome, which names the one qubit (if any) that disagrees with its neighbours; the decoder flips that qubit back. The lattice below lights the syndrome LEDs for each block live.
Degeneracy — verified by direct calculation, not asserted: because X₁X₂X₃ (flipping all 3 qubits of a block at once) maps the block's own two basis kets |000⟩ and |111⟩ into each other, it acts as the identity on the encoded state (up to an unobservable global phase) — this is the textbook example of a degenerate quantum code. We enumerated all 8 possible bit-flip patterns per block by hand-computing the resulting state: every single one — weight 0, 1, 2, or 3 — is corrected back to the original state exactly by the syndrome table above. A simulator that instead fails whenever "2 or more qubits in a block are flipped" (a natural but incorrect classical-repetition-code intuition) is wrong for this code: the logical bit-flip rate is genuinely ≈0% for any pX, which is why that statistic stays flat here.
Outer code — phase-flip (Z) protection. A single Z error anywhere inside a block flips that whole block's relative sign between |000⟩ and |111⟩ (an even number of Z errors in the same block cancels — plain parity, no ambiguity). Comparing the 3 blocks' signs is an ordinary (non-degenerate) 3-qubit repetition code in the X basis: 2 or 3 blocks disagreeing is a genuine, uncorrectable logical phase-flip — including all 3 flipping together, which is exactly the logical ZL operator, not a symmetry.
- pX, pZ sliders — independent per-qubit probability of a bit-flip / phase-flip error on each of the 9 physical qubits this round.
- Inject Errors + Correct — samples one round, runs both decoders, animates the syndrome LEDs and the corrected qubit, and reports the outcome.
- Run Batch Trials — repeats silently to build up the logical error rate chart on the right.
- Lattice view — drag to pan, scroll/pinch to zoom; "Reset View" restores the default framing.