Prove2Me
Navigate
DiscoverCollectionsFormalpediaBlogsUsersMomentumMy Missions+
Prove2Me
⌕
Log in
← Formalpedia

Stabilizer codes: an Abelian S of order 2^a without -1 gives an [[n, n-a, d]] code

Open
QAlgorithms.GottesmanIntro.stabilizerCode_params

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

gottesman-introlecture-notesquantum-information

Let Pn\mathcal P_nPn​ be the nnn-qubit Pauli group: the operators ic σ1⊗⋯⊗σni^c\,\sigma_1\otimes\cdots\otimes\sigma_nicσ1​⊗⋯⊗σn​ with c∈{0,1,2,3}c\in\{0,1,2,3\}c∈{0,1,2,3} and σj∈{I,X,Y,Z}\sigma_j\in\{I,X,Y,Z\}σj​∈{I,X,Y,Z}. The weight wt(Q)\mathrm{wt}(Q)wt(Q) of a Pauli operator is the number of its tensor factors different from III.

Let S≤PnS\le\mathcal P_nS≤Pn​ be an Abelian subgroup of order ∣S∣=2a|S|=2^a∣S∣=2a with −I∉S-I\notin S−I∈/S, and let

T(S)={ ∣ψ⟩:M∣ψ⟩=∣ψ⟩ for all M∈S }T(S)=\{\,|\psi\rangle : M|\psi\rangle=|\psi\rangle\ \text{for all } M\in S\,\}T(S)={∣ψ⟩:M∣ψ⟩=∣ψ⟩ for all M∈S}

be its stabilized space. Let N(S)N(S)N(S) be the set of Pauli operators commuting with every element of SSS (the normalizer of SSS in Pn\mathcal P_nPn​, which equals its centralizer), and suppose

d=min⁡{wt(Q):Q∈N(S), Q∉{icM:M∈S, c∈{0,1,2,3}}}d=\min\{\mathrm{wt}(Q) : Q\in N(S),\ Q\notin\{i^cM : M\in S,\ c\in\{0,1,2,3\}\}\}d=min{wt(Q):Q∈N(S), Q∈/{icM:M∈S, c∈{0,1,2,3}}}

exists (the set is nonempty). Then T(S)T(S)T(S) is an [[n,n−a,d]][[n,n-a,d]][[n,n−a,d]] quantum code:

  1. dim⁡T(S)=2n−a\dim T(S)=2^{n-a}dimT(S)=2n−a;
  2. every operator EEE acting on at most d−1d-1d−1 qubits is detectable, i.e. ⟨ψ∣E∣ψ⟩\langle\psi|E|\psi\rangle⟨ψ∣E∣ψ⟩ takes the same value C(E)C(E)C(E) for every normalized ∣ψ⟩∈T(S)|\psi\rangle\in T(S)∣ψ⟩∈T(S);
  3. some operator acting on at most ddd qubits is not detectable, so the distance is exactly ddd.

This is the basic theorem of the stabilizer formalism: it reads the parameters of a quantum code off a group of commuting Pauli operators.

Formalization Note The source writes N(S)∖SN(S)\setminus SN(S)∖S; taken literally this set always contains −I-I−I (weight 000), so, following the standard convention the source cites, Pauli operators equal to a phase times an element of SSS are removed. The minimum is encoded with IsLeast, which also excludes the case a=na=na=n where the set is empty and the source's ddd is undefined.

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

open Stabilizer

/-- Gottesman intro p.10, Theorem 5: let `S` be an Abelian subgroup of order `2^a` of the
`n`-qubit Pauli group with `−1 ∉ S`, and let `d` be the minimum weight of a Pauli operator in
the normalizer `N(S)` (= the centralizer of `S` in `P_n`, p.10) that is not a phase times an
element of `S`. Then the stabilized space `T(S)` is an `[[n, n − a, d]]` code: it has dimension
`2^(n−a)`, every operator acting on at most `d − 1` qubits satisfies (34) on it, and some
operator acting on `d` qubits does not. The weight of a Pauli operator is the number of
non-identity tensor factors (p.4). The phases `±1, ±i` are removed from `N(S) \ S` since
otherwise `−I` (weight 0) would always lie in it. -/
theorem stabilizerCode_params (n a d : ℕ) (S : Subgroup (Matrix.unitaryGroup (Qubits n) ℂ))
    (hS : IsStabilizerGroup S) (hcard : Nat.card S = 2 ^ a)
    (hd : IsLeast {w : ℕ | ∃ Q ∈ pauliCentralizer S, Q ∉ phaseMultiples S ∧
      ∃ P : PauliString n, (Q : Matrix (Qubits n) (Qubits n) ℂ) = P.toMatrix ∧ P.weight = w} d) :
    IsQCode n (n - a) d (stabilizedSpace S) ∧ HasDistance (stabilizedSpace S) d := by
  sorry


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

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

Setting. Fix natural numbers n,a,dn, a, dn,a,d. Let Un\mathcal U_nUn​ be the group of unitary 2n×2n2^n\times 2^n2n×2n complex matrices, with rows and columns indexed by bit strings {0,1}n\{0,1\}^n{0,1}n. Let S≤UnS \le \mathcal U_nS≤Un​ be a subgroup.

Pauli strings, weight, Pauli group. A Pauli string PPP consists of:

  • a phase c∈Z/4c \in \mathbb Z/4c∈Z/4;
  • factors P1,…,Pn∈{I,X,Y,Z}P_1,\dots,P_n \in \{I,X,Y,Z\}P1​,…,Pn​∈{I,X,Y,Z}, where
X=(0110),Y=(0−ii0),Z=(100−1).X=\begin{pmatrix}0&1\\1&0\end{pmatrix},\quad Y=\begin{pmatrix}0&-i\\ i&0\end{pmatrix},\quad Z=\begin{pmatrix}1&0\\0&-1\end{pmatrix}.X=(01​10​),Y=(0i​−i0​),Z=(10​0−1​).

Its matrix is ic P1⊗⋯⊗Pni^{c}\,P_1\otimes\cdots\otimes P_nicP1​⊗⋯⊗Pn​, with factor qqq acting on qubit qqq. Its weight is the number of positions qqq with Pq≠IP_q \ne IPq​=I; the phase is ignored.

The Pauli group Pn≤Un\mathcal P_n \le \mathcal U_nPn​≤Un​ is the subgroup generated by all unitaries that equal the matrix of some Pauli string.

Hypotheses.

  1. SSS is a stabilizer group.

    • S≤PnS \le \mathcal P_nS≤Pn​.
    • SSS is abelian.
    • No element of SSS equals the matrix −I-I−I.
  2. Size of SSS. The cardinality of SSS is 2a2^a2a. Here the cardinality is a natural number, which would be 000 for an infinite set; this hypothesis forces SSS to be finite.

  3. Definition of ddd. ddd is the least element of the set WWW of all w∈Nw \in \mathbb Nw∈N for which there is some QQQ with:

    • Q∈PnQ \in \mathcal P_nQ∈Pn​ and QQQ commutes with every element of SSS, i.e. QQQ lies in the Pauli group intersected with the centralizer of SSS in Un\mathcal U_nUn​;
    • QQQ is not of the form icMi^{c} MicM with c∈Z/4c \in \mathbb Z/4c∈Z/4 and M∈SM \in SM∈S;
    • QQQ equals the matrix of some Pauli string PPP of weight exactly www.

    "Least element" means d∈Wd \in Wd∈W and d≤wd \le wd≤w for all w∈Ww \in Ww∈W. In particular, if WWW is empty this hypothesis cannot be satisfied, and the theorem is vacuous.

The code space. Let

C={ψ∈C2n:Mψ=ψ for all M∈S},C = \{\psi \in \mathbb C^{2^n} : M\psi = \psi \text{ for all } M\in S\},C={ψ∈C2n:Mψ=ψ for all M∈S},

the common +1+1+1 eigenspace of SSS.

Supporting notions.

  • Acts on at most ttt qubits. A matrix EEE on nnn qubits does this if there is a set FFF of at most ttt wires, and an injective listing www of kkk wires all lying in FFF, together with an arbitrary 2k×2k2^k\times 2^k2k×2k complex matrix MMM, such that
Ey,z={My∘w,  z∘wif y,z agree outside the image of w,0otherwise.E_{y,z} = \begin{cases} M_{y\circ w,\; z\circ w} & \text{if } y,z \text{ agree outside the image of } w,\\ 0 & \text{otherwise.}\end{cases}Ey,z​={My∘w,z∘w​0​if y,z agree outside the image of w,otherwise.​

In other words, EEE is MMM on those wires tensored with the identity elsewhere. MMM need not be unitary.

  • Detectable. EEE is detectable on CCC if there is one constant c∈Cc\in\mathbb Cc∈C with ⟨ψ,Eψ⟩=ψ†Eψ=c\langle \psi, E\psi\rangle = \psi^\dagger E\psi = c⟨ψ,Eψ⟩=ψ†Eψ=c for every unit vector ψ∈C\psi \in Cψ∈C.

Conclusion. Both of the following hold.

  1. CCC is an [[n, n−a, d]][[n,\, n-a,\, d]][[n,n−a,d]] code in the following sense:
    • dim⁡CC=2 n−a\dim_{\mathbb C} C = 2^{\,n-a}dimC​C=2n−a, where n−an-an−a is truncated subtraction, so it is 000 if a>na > na>n;
    • every matrix acting on at most d−1d-1d−1 qubits is detectable on CCC, again with truncated subtraction, so d−1=0d-1=0d−1=0 when d=0d=0d=0.
  2. CCC has distance ddd:
    • every matrix acting on at most d−1d-1d−1 qubits is detectable on CCC;
    • there exists a matrix acting on at most ddd qubits that is not detectable on CCC.
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