Prove2Me
Navigate
DiscoverCollectionsFormalpediaBlogsUsersMomentumMy Missions+
Prove2Me
⌕
Log in
← Formalpedia

Every stabilizer code can be put into the standard form (4.3)

Open
QAlgorithms.GottesmanThesis.standardForm_exists

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

gottesman-thesislecture-notesquantum-information

Consider a stabilizer code on n=m+kn=m+kn=m+k qubits encoding kkk qubits, described in the binary language: its m=n−km=n-km=n−k generators M1,…,MmM_1,\dots,M_mM1​,…,Mm​ are the rows of the m×2nm\times 2nm×2n matrix (Hx ∣ Hz)(H_x\,|\,H_z)(Hx​∣Hz​) over F2\mathbb F_2F2​, where HxH_xHx​ records the σx\sigma_xσx​ parts and HzH_zHz​ the σz\sigma_zσz​ parts (a σy\sigma_yσy​ factor contributes (1∣1)(1|1)(1∣1)). Assume the generators commute, i.e. HxHzT+HzHxT=0H_xH_z^{\mathsf T}+H_zH_x^{\mathsf T}=0Hx​HzT​+Hz​HxT​=0, and are independent, i.e. the rows of (Hx ∣ Hz)(H_x\,|\,H_z)(Hx​∣Hz​) are linearly independent over F2\mathbb F_2F2​. Let r=rank⁡Hxr=\operatorname{rank}H_xr=rankHx​.

Then there exist an invertible matrix G∈GLm(F2)G\in GL_m(\mathbb F_2)G∈GLm​(F2​) (a sequence of generator replacements Mi↦MiMjM_i\mapsto M_iM_jMi​↦Mi​Mj​) and a permutation σ\sigmaσ of the nnn qubits (applied to the columns of both halves) such that (GHxPσ ∣ GHzPσ)(GH_xP_\sigma\,|\,GH_zP_\sigma)(GHx​Pσ​∣GHz​Pσ​) is in the standard form

(IA1A2BC1C2000DIE),\left(\begin{array}{ccc|ccc} I & A_1 & A_2 & B & C_1 & C_2\\ 0 & 0 & 0 & D & I & E\end{array}\right),(I0​A1​0​A2​0​BD​C1​I​C2​E​),

where the row blocks have heights rrr and n−k−rn-k-rn−k−r, and the column blocks in each half have widths rrr, n−k−rn-k-rn−k−r and kkk; the blocks A1,A2,B,C1,C2,D,EA_1,A_2,B,C_1,C_2,D,EA1​,A2​,B,C1​,C2​,D,E are arbitrary.

The standard form is the starting point for the construction of the logical operators and of the encoding network in Gottesman's thesis.

Formalization Note Row operations are modelled by an arbitrary invertible GGG (row additions generate GLm(F2)GL_m(\mathbb F_2)GLm​(F2​)), and the qubit rearrangement by Matrix.submatrix id σ, so the reachable set is exactly the page's. The rank parameter is the rank of the original HxH_xHx​, which equals that of the transformed one.

Preamble
import Definitions.Def_QAlgorithms_Defs_BinaryStabilizer
set_option autoImplicit false
Formal statement
namespace QAlgorithms.GottesmanThesis

/-- Gottesman thesis p.39, §4.1 (unnumbered; equations (4.1)–(4.3)): every stabilizer code can
be put into the standard form (4.3). Let `(H_x | H_z)` be the binary generator matrix of `m`
independent commuting generators on `m + k` qubits (rows commute symplectically, eq. (3.23);
rows linearly independent over `F₂`). Then some sequence of generator replacements
`M_i ↦ M_i M_j` (row additions in both halves, i.e. left multiplication by an invertible
`G ∈ GL_m(F₂)`) and some rearrangement of the qubits (the same column permutation `σ` in both
halves) brings it to the standard form (4.3) with `r = rank H_x`: the first `r` rows read
`I A₁ A₂ | B C₁ C₂`, the last `m − r` rows read `0 0 0 | D I E`. -/
theorem standardForm_exists {m k : ℕ} (Hx Hz : Matrix (Fin m) (Fin (m + k)) (ZMod 2))
    (hS : IsBinaryStabilizerMatrix Hx Hz) :
    ∃ G : Matrix.GeneralLinearGroup (Fin m) (ZMod 2), ∃ σ : Equiv.Perm (Fin (m + k)),
      IsStandardForm Hx.rank ((G : Matrix (Fin m) (Fin m) (ZMod 2)) * Hx.submatrix id σ)
        ((G : Matrix (Fin m) (Fin m) (ZMod 2)) * Hz.submatrix id σ) := by
  sorry


end QAlgorithms.GottesmanThesis
Source
Daniel Gottesman, Stabilizer Codes and Quantum Error Correction, 1997 thesis, downloaded arXiv v1 PDF; PDF title page now prints 2024, PDF p. 39, §4.1. https://arxiv.org/pdf/quant-ph/9705052v1
Read-back

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

Setting. Fix natural numbers mmm and kkk. Let HxH_xHx​ and HzH_zHz​ be m×(m+k)m \times (m+k)m×(m+k) matrices over the field F2\mathbb{F}_2F2​. Rows are indexed by 0,…,m−10,\dots,m-10,…,m−1 and columns by 0,…,m+k−10,\dots,m+k-10,…,m+k−1.

Hypothesis. (Hx∣Hz)(H_x \mid H_z)(Hx​∣Hz​) is a binary stabilizer matrix. This means two things:

  1. Symplectic commutation: over F2\mathbb{F}_2F2​,
HxHzT+HzHxT=0.H_x H_z^{\mathsf T} + H_z H_x^{\mathsf T} = 0.Hx​HzT​+Hz​HxT​=0.
  1. Independence: the mmm rows of the m×2(m+k)m \times 2(m+k)m×2(m+k) matrix [ Hx∣Hz ][\,H_x \mid H_z\,][Hx​∣Hz​] (columns of HxH_xHx​ followed by columns of HzH_zHz​) are linearly independent over F2\mathbb{F}_2F2​.

Conclusion. Let r=rank⁡(Hx)r = \operatorname{rank}(H_x)r=rank(Hx​), the rank over F2\mathbb{F}_2F2​ of the original HxH_xHx​. There exist an invertible m×mm\times mm×m matrix GGG over F2\mathbb{F}_2F2​ and a permutation σ\sigmaσ of the column indices {0,…,m+k−1}\{0,\dots,m+k-1\}{0,…,m+k−1} with the following property. Define

Hx′=G Hxσ,Hz′=G Hzσ,(Hσ)ij=Hi,σ(j).H_x' = G\,H_x^{\sigma}, \qquad H_z' = G\,H_z^{\sigma}, \qquad (H^{\sigma})_{ij} = H_{i,\sigma(j)}.Hx′​=GHxσ​,Hz′​=GHzσ​,(Hσ)ij​=Hi,σ(j)​.

The same σ\sigmaσ permutes the columns of both matrices. Then (Hx′,Hz′)(H_x', H_z')(Hx′​,Hz′​) is in standard form with parameter rrr, which means all of the following hold:

  • r≤mr \le mr≤m;
  • for i<ri < ri<r and j<rj < rj<r: (Hx′)ij=δij(H_x')_{ij} = \delta_{ij}(Hx′​)ij​=δij​;
  • for every row i≥ri \ge ri≥r and every column jjj: (Hx′)ij=0(H_x')_{ij} = 0(Hx′​)ij​=0;
  • for i≥ri \ge ri≥r and r≤j<mr \le j < mr≤j<m: (Hz′)ij=δij(H_z')_{ij} = \delta_{ij}(Hz′​)ij​=δij​.

What standard form leaves free. No condition is placed on:

  • the entries (Hx′)ij(H_x')_{ij}(Hx′​)ij​ with i<ri<ri<r and j≥rj \ge rj≥r;
  • any row i<ri<ri<r of Hz′H_z'Hz′​;
  • the entries of rows i≥ri \ge ri≥r of Hz′H_z'Hz′​ in columns j<rj<rj<r or j≥mj \ge mj≥m.

Degenerate case. When m=0m = 0m=0 there are no rows, and the conditions reduce to r=0≤0r = 0 \le 0r=0≤0.

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