Documentation

CsdLean4.Empirical.QM.QEC.SteaneRecovery

The Steane code corrects every single-qubit Pauli error #

Category: 3-Local (QM-validity). BACKLOG #14(b).

Steane.lean exhibits the code space and the distance mechanism (single-qubit errors have nonzero, pairwise-distinct syndromes); Mathlib/QuantumInfo/StabilizerRecovery.lean turns a detected Pauli error family on a stabiliser code into a recovery channel through the Knill–Laflamme theorem. This file instantiates it:

Honest scope #

⚠️ Pauli errors here; the extension to an arbitrary operator on one qubit (its Pauli expansion, ErrorDiscretization.lean's three-qubit pattern on seven qubits) is SteaneArbitrary.lean (BACKLOG #61, 2026-09-26). No two-qubit error is corrected, at any level (the Steane code does not correct them). The recovery is the channel the Knill–Laflamme construction produces, not the syndrome-measurement circuit; the Σ-side twin (a Σ-flow whose environment marginal is the single-qubit Pauli channel, as Empirical/CSD/QEC/RegisterFlow.lean does for three qubits) is Empirical/CSD/QEC/SteaneFlow.lean (BACKLOG #53, 2026-09-27).

References: A. Steane, Error correcting codes in quantum theory, PRL 77 (1996) 793; Nielsen–Chuang §10.4.2; Empirical/QM/QEC/Steane.lean; Mathlib/QuantumInfo/StabilizerRecovery.lean; specs/steane-plan.md; specs/BACKLOG.md #14.

The single-qubit Paulis and the code projector #

@[reducible, inline]

The single-qubit Pauli errors on seven qubits: none is the identity, some (j, 0) the X on qubit j, some (j, 1) the Z, some (j, 2) the XZ (proportional to Y).

Equations
Instances For
    noncomputable def CSD.Empirical.QM.QEC.Steane.steaneProj :
    Matrix (Fin 7 → Fin 2) (Fin 7 → Fin 2) ℂ

    The Steane code projector as a matrix on the register's coordinates.

    Equations
    Instances For

      The X-type generator X^{hammingRow r} as a label of the family.

      Equations
      Instances For

        The Z-type generator Z^{hammingRow r} as a label of the family.

        Equations
        Instances For

          The distance mechanism for pairs #

          ★ Two distinct single-qubit Paulis are told apart by the syndromes: the product's X-part or its Z-part has a nonzero syndrome. A 𝔽₂ computation over the 22 × 22 pairs.

          A nonzero syndrome names a row pairing to 1.

          Detection as anticommutation: for distinct single-qubit Paulis, some generator pairs to 1 with the product's labels — the hypothesis of stabMat_knillLaflamme.

          Knill–Laflamme and the recovery #

          ★★ The Steane code satisfies Knill–Laflamme with c = 1 for the single-qubit Paulis: P Eᵢᴴ Eⱼ P = δᵢⱼ P.

          theorem CSD.Empirical.QM.QEC.Steane.exists_steane_recovery :
          ∃ (R : QuantumInfo.Channel (Fin 7 → Fin 2) (Fin 7 → Fin 2) (Option SingleErr)), ∀ (ρ : Matrix (Fin 7 → Fin 2) (Fin 7 → Fin 2) ℂ), ρ = steaneProj * ρ * steaneProj → ∀ (i : SingleErr), R.apply (QuantumInfo.pauliMat (errA i) (errB i) * ρ * (QuantumInfo.pauliMat (errA i) (errB i)).conjTranspose) = ρ

          ★★★ The Steane code corrects every single-qubit Pauli error: one recovery channel R undoes each of the twenty-two errors on every code state.

          The logical states are code states #

          The group average fixes a state fixed by every generator.

          noncomputable def CSD.Empirical.QM.QEC.Steane.logicalVec (a b : ℂ) :
          (Fin 7 → Fin 2) → ℂ

          The encoded qubit a|0̄⟩ + b|1̄⟩, as a coordinate vector.

          Equations
          Instances For

            The density operator of the encoded qubit is a code state: ρ = P ρ P.

            ★★★ Every single-qubit Pauli error on an encoded qubit is undone: for |ψ̄⟩ = a|0̄⟩ + b|1̄⟩ and every single-qubit Pauli E, the recovery channel returns |ψ̄⟩⟨ψ̄| from E |ψ̄⟩⟨ψ̄| Eᴴ.