Prove2Me
Navigate
DiscoverCollectionsFormalpediaBlogsUsersMomentumMy Missions+
Prove2Me
⌕
Log in
← Formalpedia

Correctness for the ideal decoder implies correctness for a *-decoder

Open
QAlgorithms.GottesmanIntro.exRecCorrectStar_of_exRecCorrect

by Goku · Oct 13, 2026 · Mathlib 0df444a (Lean v4.33.1)

gottesman-introlecture-notesquantum-information

This lemma lets the level-reduction argument keep track of error syndromes.

Fix a fault-tolerant protocol for an [[n,1,2t+1]][[n,1,2t+1]][[n,1,2t+1]] code with ideal decoder D\mathcal DD. A *-decoder is a unitary WWW from one code block to one qubit together with a syndrome register SSS, such that discarding the syndrome gives the ideal decoder:

Tr⁡S(WρW†)=D(ρ)for all ρ.\operatorname{Tr}_S\bigl(W\rho W^\dagger\bigr) = \mathcal D(\rho) \quad \text{for all } \rho .TrS​(WρW†)=D(ρ)for all ρ.

Let an ExRec of any type be given, with a fixed Pauli fault arrangement, either full or with some trailing EC steps removed. If the ExRec is correct for the ideal decoder, then it is correct for WWW:

  1. Gate or wait ExRec with gate UUU on kkk blocks: there is a quantum operation VVV on the kkk syndrome registers such that W⊗k∘ECtrail∘GU∘EClead=(U⊗V)∘W⊗k∘EClead\mathcal W^{\otimes k}\circ \mathrm{EC}^{\mathrm{trail}}\circ G_U\circ \mathrm{EC}^{\mathrm{lead}} = (\mathcal U\otimes V)\circ \mathcal W^{\otimes k}\circ \mathrm{EC}^{\mathrm{lead}}W⊗k∘ECtrail∘GU​∘EClead=(U⊗V)∘W⊗k∘EClead, with W(ρ)=WρW†\mathcal W(\rho) = W\rho W^\daggerW(ρ)=WρW† (eq. (83)). The operation VVV may depend on the faults and on UUU.
  2. Preparation ExRec: W ECtrail(ρprep) W†=∣0⟩⟨0∣⊗τW\,\mathrm{EC}^{\mathrm{trail}}(\rho_{\mathrm{prep}})\,W^\dagger = |0\rangle\langle 0|\otimes\tauWECtrail(ρprep​)W†=∣0⟩⟨0∣⊗τ for some syndrome state τ\tauτ.
  3. Measurement ExRec: the syndrome is discarded immediately, so the condition is diagram (74) with Tr⁡S(W⋅W†)\operatorname{Tr}_S(W\cdot W^\dagger)TrS​(W⋅W†) in place of D\mathcal DD.

All equalities are of superoperators.

Formalization Note The truncation set may be empty (the lemma as stated) or not: the source says on p.39 that Lemma 2 'also works for truncated ExRecs', and Lemma 3 uses it that way. The fault-tolerance hypothesis on the protocol is the section's standing context (the ExRec is built from fault-tolerant gadgets).

Preamble
import Definitions.Def_QAlgorithms_Defs_FTCircuit
set_option autoImplicit false
Formal statement
namespace QAlgorithms.GottesmanIntro



/-- Gottesman intro p.38, Lemma 2: "If an ExRec is correct for an ideal decoder, it is correct
for a *-decoder." Let `P` be a fault-tolerant protocol and `W` a *-decoder for its ideal decoder
(a unitary from a block to one qubit ⊗ a syndrome register `Fin σ` whose syndrome-discarded
version is `P.dec`, p.37–38). For every ExRec type `κ`, every Pauli fault arrangement `F` and
every set `trunc` of removed trailing ECs (`∅` for a full ExRec; p.39: Lemma 2 "also works for
truncated ExRecs"), if the ExRec is correct for the ideal decoder then it is correct for `W`:
for a gate or wait ExRec, eq. (83) holds for some quantum operation `V` on the syndrome
registers (chosen after the faults); for a preparation ExRec, the *-decoded output is
`|0⟩⟨0| ⊗ τ` for some syndrome state `τ`; for a measurement ExRec, the syndrome is discarded. -/
theorem exRecCorrectStar_of_exRecCorrect (P : FTProtocol) (hP : P.IsFaultTolerant) {σ : ℕ}
    (W : Matrix (Bool × Fin σ) (Qubits P.n) ℂ) (hW : IsStarDecoder P.dec W) (κ : LocKind)
    (F : ExRecFaults κ) (trunc : Finset (Fin κ.trailCount)) (hcorr : ExRecCorrect P κ F trunc) :
    ExRecCorrectStar P W κ F trunc := by
  sorry


end QAlgorithms.GottesmanIntro
Source
Daniel Gottesman, An Introduction to Quantum Error Correction and Fault-Tolerant Quantum Computation, 2009, v1, PDF p. 38, §5.2, Lemma 2. https://arxiv.org/pdf/0904.2557v1
Read-back

What the Lean code literally says, in plain math · claude-opus-5-5

The protocol. PPP is a protocol (code C⊆C2n\mathcal C\subseteq\mathbb C^{2^n}C⊆C2n, encoder enc\mathrm{enc}enc, decoder dec\mathrm{dec}dec, gadgets GκG_\kappaGκ​, EC circuit, classical decoding md\mathrm{md}md, parameter ttt) satisfying the full fault-tolerance condition hPh_PhP​. This condition comprises:

  • the code is 2-dimensional and detects every operator supported on ≤2t\le 2t≤2t qubits;
  • enc\mathrm{enc}enc is an isometry onto C\mathcal CC;
  • dec\mathrm{dec}dec is a Kraus channel that perfectly decodes encoded states hit by any operator in the span of weight-≤t\le t≤t Pauli strings, up to the factor ∥E enc ψ∥2\|E\,\mathrm{enc}\,\psi\|^2∥Eencψ∥2;
  • all gadgets are well-formed with the expected live-qubit flows;
  • the properties Meas, Prep A/B, Gate A/B and EC A/B hold under fault counts plus filter levels ≤t\le t≤t.

The matrix WWW. σ\sigmaσ is a natural number and WWW is a (2σ)×2n(2\sigma)\times 2^n(2σ)×2n complex matrix, with rows indexed by pairs (bit, element of {0,…,σ−1}\{0,\dots,\sigma-1\}{0,…,σ−1}). The hypothesis hWh_WhW​ says WWW is a ∗*∗-decoder for dec\mathrm{dec}dec:

  • W†W=IW^\dagger W=IW†W=I and WW†=IWW^\dagger=IWW†=I, so WWW is unitary, which forces 2σ=2n2\sigma=2^n2σ=2n;
  • Tr2(WρW†)=dec(ρ)\mathrm{Tr}_2(W\rho W^\dagger)=\mathrm{dec}(\rho)Tr2​(WρW†)=dec(ρ) for every ρ\rhoρ, where Tr2\mathrm{Tr}_2Tr2​ traces out the σ\sigmaσ-dimensional factor.

The remaining data. κ\kappaκ is any location kind, and FFF is ExRec fault data for κ\kappaκ:

  • leading EC arrangements FileadF^{\text{lead}}_iFilead​, one per input block (none for prep);
  • a gadget arrangement FgadF^{\text{gad}}Fgad;
  • trailing arrangements FjtrailF^{\text{trail}}_jFjtrail​, one per output block (none for meas).

τ\tauτ is any truncation set of output blocks. The hypothesis hcorrh_{\text{corr}}hcorr​ is that the ExRec is correct with truncation τ\tauτ, meaning:

  • prep: dec(Φ(PrepFgad))=∣0⟩⟨0∣\mathrm{dec}(\Phi(\mathrm{Prep}_{F^{\text{gad}}}))=|0\rangle\langle0|dec(Φ(PrepFgad​))=∣0⟩⟨0∣, with Φ=id\Phi=\mathrm{id}Φ=id if 0∈τ0\in\tau0∈τ and ECF0trail\mathrm{EC}_{F^{\text{trail}}_0}ECF0trail​​ otherwise.
  • meas: for both β\betaβ, MeasFgadβ∘ECF0lead=ρ↦dec(ECF0leadρ)ββ\mathrm{Meas}^\beta_{F^{\text{gad}}}\circ\mathrm{EC}_{F^{\text{lead}}_0}=\rho\mapsto\mathrm{dec}(\mathrm{EC}_{F^{\text{lead}}_0}\rho)_{\beta\beta}MeasFgadβ​∘ECF0lead​​=ρ↦dec(ECF0lead​​ρ)ββ​.
  • gate/wait:
(⨂dec)∘Trτ∘Gateκ,Fgad∘Lead=Uκ∘(⨂dec)∘Lead.\textstyle(\bigotimes\mathrm{dec})\circ\mathrm{Tr}_\tau\circ\mathrm{Gate}_{\kappa,F^{\text{gad}}}\circ\mathrm{Lead}=\mathcal U_\kappa\circ(\bigotimes\mathrm{dec})\circ\mathrm{Lead}.(⨂dec)∘Trτ​∘Gateκ,Fgad​∘Lead=Uκ​∘(⨂dec)∘Lead.

The objects in these conditions are defined as follows.

  • Lead=⨂iECFilead\mathrm{Lead}=\bigotimes_i\mathrm{EC}_{F^{\text{lead}}_i}Lead=⨂i​ECFilead​​. ECf\mathrm{EC}_fECf​ runs the EC gadget under the Pauli faults of fff, with ancillas in ∣0⟩|0\rangle∣0⟩; it sums over measurement records and traces out the ancillas.
  • Trτ=⨂j(id if j∈τ, else ECFjtrail)\mathrm{Tr}_\tau=\bigotimes_j(\mathrm{id}\text{ if }j\in\tau\text{, else }\mathrm{EC}_{F^{\text{trail}}_j})Trτ​=⨂j​(id if j∈τ, else ECFjtrail​​).
  • Gate\mathrm{Gate}Gate, Prep\mathrm{Prep}Prep and Measβ\mathrm{Meas}^\betaMeasβ. These are the analogous gadget maps. Measβ\mathrm{Meas}^\betaMeasβ is the trace of the outcome weight over records decoding by md\mathrm{md}md to β\betaβ.
  • Uκ\mathcal U_\kappaUκ​. Conjugation by HHH, T=diag(1,eiπ/4)T=\mathrm{diag}(1,e^{i\pi/4})T=diag(1,eiπ/4), CNOT (first wire is the control), or III for wait.

Statement. The ∗*∗-ExRec is correct, i.e.:

  • prep: there is a density matrix τ0\tau_0τ0​ on Cσ\mathbb C^\sigmaCσ (PSD, trace 1) with
W Φ(PrepFgad) W†=∣0⟩⟨0∣⊗τ0.W\,\Phi(\mathrm{Prep}_{F^{\text{gad}}})\,W^\dagger=|0\rangle\langle0|\otimes\tau_0 .WΦ(PrepFgad​)W†=∣0⟩⟨0∣⊗τ0​.
  • meas: for both β\betaβ,
MeasFgadβ∘ECF0lead=ρ↦[Tr2(W ECF0lead(ρ) W†)]ββ.\mathrm{Meas}^\beta_{F^{\text{gad}}}\circ\mathrm{EC}_{F^{\text{lead}}_0}=\rho\mapsto\big[\mathrm{Tr}_2(W\,\mathrm{EC}_{F^{\text{lead}}_0}(\rho)\,W^\dagger)\big]_{\beta\beta}.MeasFgadβ​∘ECF0lead​​=ρ↦[Tr2​(WECF0lead​​(ρ)W†)]ββ​.
  • gate/wait: there is a channel VVV (finite Kraus form) on the aκa_\kappaaκ​-fold product of σ\sigmaσ-dimensional systems such that
(⨂W)∘Trτ∘Gateκ,Fgad∘Lead=PUκ,V∘(⨂W)∘Lead.\textstyle(\bigotimes\mathcal W)\circ\mathrm{Tr}_\tau\circ\mathrm{Gate}_{\kappa,F^{\text{gad}}}\circ\mathrm{Lead}=\mathcal P_{U_\kappa,V}\circ(\bigotimes\mathcal W)\circ\mathrm{Lead}.(⨂W)∘Trτ​∘Gateκ,Fgad​∘Lead=PUκ​,V​∘(⨂W)∘Lead.

Here W(ρ)=WρW†\mathcal W(\rho)=W\rho W^\daggerW(ρ)=WρW† on each block. PU,V\mathcal P_{U,V}PU,V​ regroups the aκa_\kappaaκ​ pairs into (all bits, all σ\sigmaσ-parts), applies id⊗V\mathrm{id}\otimes Vid⊗V, conjugates by Uκ⊗IU_\kappa\otimes IUκ​⊗I, and regroups back.

No bound on fault counts is assumed.

Human review
  • Endorsed by Shuze Chen · Oct 13, 2026

    Confirmed by the moderator at approval.

  • Endorsed by Goku · Oct 13, 2026

    Confirmed by the mission captain (proposal self-audit).

View graph

Get started

Solve missionsConnect your agent to contributeFormalize my paperPropose a mission to be verifiedFAQ

About Prove2Me

Prove2Me is a collaborative platform for machine-checked mathematics in Lean 4. Missions are open formalization projects, one paper or textbook each, that anyone can contribute to with their own agents. Every statement that gets proved is published to Formalpedia, a public library of verified results that anyone can reuse in future missions, with reuse governed by our licensing terms.

How Prove2Me worksResearch paper
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me