Prove2Me
Navigate
DiscoverCollectionsFormalpediaBlogsUsersMomentumMy Missions+
Prove2Me
⌕
Log in
← Formalpedia

Quantum Gilbert–Varshamov, quantum Hamming, and asymptotic rate bounds

Open
QAlgorithms.GottesmanIntro.codeBounds

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

gottesman-introlecture-notesquantum-information

An [[n,k,d]][[n,k,d]][[n,k,d]] code is a subspace CCC of (C2)⊗n(\mathbb C^2)^{\otimes n}(C2)⊗n of dimension 2k2^k2k such that every operator EEE acting on at most d−1d-1d−1 qubits satisfies ⟨ψ∣E∣ψ⟩=c′(E)\langle\psi|E|\psi\rangle=c'(E)⟨ψ∣E∣ψ⟩=c′(E) for all unit vectors ∣ψ⟩∈C|\psi\rangle\in C∣ψ⟩∈C, with c′(E)c'(E)c′(E) independent of ∣ψ⟩|\psi\rangle∣ψ⟩ (eq. (34)); that is, CCC has distance at least ddd. Put t=⌊(d−1)/2⌋t=\lfloor (d-1)/2\rfloort=⌊(d−1)/2⌋. The code is nondegenerate if, for every unit vector ∣ψ⟩∈C|\psi\rangle\in C∣ψ⟩∈C, the Gram matrix (⟨ψ∣Pa†Pb∣ψ⟩)a,b\big(\langle\psi|P_a^\dagger P_b|\psi\rangle\big)_{a,b}(⟨ψ∣Pa†​Pb​∣ψ⟩)a,b​ over the phase-free Pauli operators PaP_aPa​ of weight at most ttt is nonsingular. Let H(x)=−xlog⁡2x−(1−x)log⁡2(1−x)H(x)=-x\log_2x-(1-x)\log_2(1-x)H(x)=−xlog2​x−(1−x)log2​(1−x).

  1. (Quantum Gilbert–Varshamov bound.) If d≥1d\ge1d≥1 and
(∑j=0d−13j(nj))2k≤2n,\Big(\sum_{j=0}^{d-1}3^j\binom nj\Big)2^k\le 2^n,(j=0∑d−1​3j(jn​))2k≤2n,

then an [[n,k,d]][[n,k,d]][[n,k,d]] code exists. 2. (Quantum Hamming bound.) Every nondegenerate [[n,k,d]][[n,k,d]][[n,k,d]] code satisfies

(∑j=0t3j(nj))2k≤2n.\Big(\sum_{j=0}^{t}3^j\binom nj\Big)2^k\le 2^n.(j=0∑t​3j(jn​))2k≤2n.
  1. (Asymptotic rates.) Let 0<p<1/20<p<1/20<p<1/2 and ε>0\varepsilon>0ε>0. There is NNN such that for every n≥Nn\ge Nn≥N:
    • every nondegenerate [[n,k,d]][[n,k,d]][[n,k,d]] code with d≥2pnd\ge 2pnd≥2pn has k/n≤1−plog⁡23−H(p)+εk/n\le 1-p\log_2 3-H(p)+\varepsilonk/n≤1−plog2​3−H(p)+ε;
    • if 1−2plog⁡23−H(2p)>01-2p\log_2 3-H(2p)>01−2plog2​3−H(2p)>0, there is a nondegenerate [[n,k,d]][[n,k,d]][[n,k,d]] code with d≥2pnd\ge 2pnd≥2pn and k/n≥1−2plog⁡23−H(2p)−εk/n\ge 1-2p\log_2 3-H(2p)-\varepsilonk/n≥1−2plog2​3−H(2p)−ε.

The first two bounds are counting arguments. The third gives the rate window, eq. (37), between which the best nondegenerate codes lie.

Formalization Note The source's 'distance ddd' is read as distance at least ddd, so existence is meaningful also for k=0k=0k=0. The hypothesis d≥1d\ge1d≥1 excludes d=0d=0d=0, where (36) is an empty sum and the claim would demand a 2k2^k2k-dimensional code for every kkk. The asymptotic clause is read as an ε\varepsilonε–NNN statement. The lower rate bound is asserted only when it is positive.

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

open scoped Matrix

open QAlgorithms Stabilizer




/-- Gottesman intro p.7–8, Theorem 4. (1) Quantum Gilbert–Varshamov: if
`(∑_{j=0}^{d-1} 3^j C(n,j)) 2^k ≤ 2^n` (eq. (36)) and `d ≥ 1`, an `[[n, k, d]]` code exists.
(2) Quantum Hamming bound: every nondegenerate `[[n, k, d]]` code satisfies
`(∑_{j=0}^{t} 3^j C(n,j)) 2^k ≤ 2^n` (eq. (35)), `t = ⌊(d-1)/2⌋`. (3) Asymptotics (eq. (37)):
for fixed `p ∈ (0, 1/2)` and every `ε > 0`, for all large `n`, every nondegenerate `[[n, k, d]]`
code with `d ≥ 2pn` has `k/n ≤ 1 - p log₂ 3 - H(p) + ε`, and, when `1 - 2p log₂ 3 - H(2p) > 0`,
some nondegenerate `[[n, k, d]]` code with `d ≥ 2pn` has `k/n ≥ 1 - 2p log₂ 3 - H(2p) - ε`. -/
theorem codeBounds :
    (∀ n k d : ℕ, 1 ≤ d →
      (∑ j ∈ Finset.range d, 3 ^ j * n.choose j) * 2 ^ k ≤ 2 ^ n →
      ∃ C : Submodule ℂ (EuclideanSpace ℂ (Qubits n)), IsQCode n k d C) ∧
    (∀ (n k d : ℕ) (C : Submodule ℂ (EuclideanSpace ℂ (Qubits n))), IsQCode n k d C →
      IsNondegenerate C ((d - 1) / 2) →
      (∑ j ∈ Finset.range ((d - 1) / 2 + 1), 3 ^ j * n.choose j) * 2 ^ k ≤ 2 ^ n) ∧
    ∀ p : ℝ, 0 < p → p < 1 / 2 → ∀ ε : ℝ, 0 < ε → ∃ N : ℕ, ∀ n ≥ N,
      (∀ (k d : ℕ) (C : Submodule ℂ (EuclideanSpace ℂ (Qubits n))), IsQCode n k d C →
        IsNondegenerate C ((d - 1) / 2) → 2 * p * n ≤ d →
        (k : ℝ) / n ≤ 1 - p * Real.logb 2 3 - binEntropy2 p + ε) ∧
      (0 < 1 - 2 * p * Real.logb 2 3 - binEntropy2 (2 * p) →
        ∃ (k d : ℕ) (C : Submodule ℂ (EuclideanSpace ℂ (Qubits n))), IsQCode n k d C ∧
          IsNondegenerate C ((d - 1) / 2) ∧ 2 * p * n ≤ d ∧
          1 - 2 * p * Real.logb 2 3 - binEntropy2 (2 * p) - ε ≤ (k : ℝ) / n) := by
  sorry

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

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

Codes. For n,k,d∈Nn,k,d\in\mathbb{N}n,k,d∈N, "CCC is an [[n,k,d]][[n,k,d]][[n,k,d]] code" means CCC is a complex subspace of the nnn-qubit space C{0,1}n\mathbb{C}^{\{0,1\}^n}C{0,1}n satisfying two conditions.

  • dim⁡CC=2k\dim_{\mathbb{C}}C=2^kdimC​C=2k.
  • Every complex matrix EEE acting on at most d−1d-1d−1 qubits is detectable, i.e. there is a constant c∈Cc\in\mathbb{C}c∈C with ⟨ψ,Eψ⟩=c\langle\psi,E\psi\rangle=c⟨ψ,Eψ⟩=c for all unit ψ∈C\psi\in Cψ∈C.

Two clarifications:

  • Acting on few qubits. "EEE acts on at most sss qubits" means E=M⊗IE=M\otimes IE=M⊗I for an arbitrary matrix MMM placed on some set of at most sss wires, as in the previous entry.
  • Truncated subtraction. d−1d-1d−1 is truncated, so d=0d=0d=0 behaves like d=1d=1d=1. In that case only scalar multiples of the identity must be detected, which always holds.

The condition says "distance at least ddd". It does not say the distance is exactly ddd.

Nondegeneracy. Write Pt\mathcal{P}_tPt​ for the phase-free Pauli products σ1⊗⋯⊗σn\sigma_1\otimes\cdots\otimes\sigma_nσ1​⊗⋯⊗σn​ (σq∈{I,X,Y,Z}\sigma_q\in\{I,X,Y,Z\}σq​∈{I,X,Y,Z}) with at most ttt non-identity factors. "CCC is nondegenerate at ttt" means: for every unit ψ∈C\psi\in Cψ∈C, the Gram matrix

(⟨Pψ, Qψ⟩)P,Q∈Pt\big(\langle P\psi,\,Q\psi\rangle\big)_{P,Q\in\mathcal{P}_t}(⟨Pψ,Qψ⟩)P,Q∈Pt​​

has nonzero determinant. Equivalently, the vectors PψP\psiPψ, P∈PtP\in\mathcal{P}_tP∈Pt​, are linearly independent.

Notation.

  • H2(p)=−pln⁡p−(1−p)ln⁡(1−p)ln⁡2H_2(p)=\dfrac{-p\ln p-(1-p)\ln(1-p)}{\ln 2}H2​(p)=ln2−plnp−(1−p)ln(1−p)​ is the binary entropy in bits.
  • ⌊(d−1)/2⌋\lfloor (d-1)/2\rfloor⌊(d−1)/2⌋ uses truncated subtraction and floor division of natural numbers.

The theorem is a conjunction of three statements.

  1. Existence (Gilbert–Varshamov form). Let n,k,d∈Nn,k,d\in\mathbb{N}n,k,d∈N with d≥1d\ge 1d≥1. If
(∑j=0d−13j(nj))⋅2k≤2n,\Big(\sum_{j=0}^{d-1}3^j\binom{n}{j}\Big)\cdot 2^k\le 2^n,(j=0∑d−1​3j(jn​))⋅2k≤2n,

then some subspace CCC is an [[n,k,d]][[n,k,d]][[n,k,d]] code.

  1. Hamming bound. Let n,k,d∈Nn,k,d\in\mathbb{N}n,k,d∈N and t=⌊(d−1)/2⌋t=\lfloor(d-1)/2\rfloort=⌊(d−1)/2⌋. Every [[n,k,d]][[n,k,d]][[n,k,d]] code CCC that is nondegenerate at ttt satisfies
(∑j=0t3j(nj))⋅2k≤2n.\Big(\sum_{j=0}^{t}3^j\binom{n}{j}\Big)\cdot 2^k\le 2^n.(j=0∑t​3j(jn​))⋅2k≤2n.
  1. Asymptotic rates. For every real ppp with 0<p<120<p<\tfrac120<p<21​ and every real ε>0\varepsilon>0ε>0, there exists N∈NN\in\mathbb{N}N∈N such that every n≥Nn\ge Nn≥N satisfies both (i) and (ii).

    (i) Upper bound. For all k,dk,dk,d and every [[n,k,d]][[n,k,d]][[n,k,d]] code CCC that is nondegenerate at ⌊(d−1)/2⌋\lfloor(d-1)/2\rfloor⌊(d−1)/2⌋ and has 2pn≤d2pn\le d2pn≤d:

kn≤1−plog⁡23−H2(p)+ε.\frac{k}{n}\le 1-p\log_2 3-H_2(p)+\varepsilon.nk​≤1−plog2​3−H2​(p)+ε.

(ii) Achievability. Suppose

1−2plog⁡23−H2(2p)>0.1-2p\log_2 3-H_2(2p)>0.1−2plog2​3−H2​(2p)>0.

Then there exist k,dk,dk,d and an [[n,k,d]][[n,k,d]][[n,k,d]] code CCC that is nondegenerate at ⌊(d−1)/2⌋\lfloor(d-1)/2\rfloor⌊(d−1)/2⌋, has 2pn≤d2pn\le d2pn≤d, and satisfies

1−2plog⁡23−H2(2p)−ε≤kn.1-2p\log_2 3-H_2(2p)-\varepsilon\le\frac{k}{n}.1−2plog2​3−H2​(2p)−ε≤nk​.

Here k/nk/nk/n is real division. If n=0n=0n=0 were allowed (i.e. N=0N=0N=0), k/0k/0k/0 evaluates to 000.

When 2p≥12p\ge 12p≥1, the term H2(2p)H_2(2p)H2​(2p) is evaluated by the same total formula: H2(1)=0H_2(1)=0H2​(1)=0 and, for 2p>12p>12p>1, logarithms of negative arguments are taken as ln⁡∣x∣\ln|x|ln∣x∣. However, 2p<12p<12p<1 holds here because p<12p<\tfrac12p<21​.

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