Linear Codes and the Uniformity Lemma #
This file develops the theory of linear codes and a key probabilistic tool used in the Gilbert–Varshamov existence argument.
Main Definitions #
uniform_vector_dist n α: the uniform distribution on length-nvectors overα.matrix_dist n k x: the distribution on length-noutput vectors induced by a uniformly random generator matrixGapplied to a fixed nonzero messagex ∈ αᵏ.get_matrix_row: utility to extract rowiof a matrix as a1×kmatrix.
Main Results #
Linear_Code_dist_eq_min_weight: for a linear code, minimum distance equals minimum nonzero weight.finite_matrix_dist: the set{G | G·x = v}is finite.uniformity_lemma: for any nonzerox ∈ αᵏ, the outputG·xis uniformly distributed overαⁿwhenGis a uniformly randomn×kmatrix overα.
theorem
CodingTheory.Codeword.Linear_Code_dist_eq_min_weight
{α : Type u_1}
[Fintype α]
[Nonempty α]
[DecidableEq α]
[Field α]
{n m d : ℕ}
(C : Code n α)
(h_linear : Linear_Code' C m)
(h : distance C d)
:
For a linear code, minimum distance equals minimum nonzero Hamming weight.
noncomputable def
CodingTheory.Codeword.uniform_vector_dist
(n : ℕ)
(α : Type u_2)
[Fintype α]
[DecidableEq α]
:
The uniform distribution on length-n vectors: each vector has probability 1/|α|^n.
Equations
- CodingTheory.Codeword.uniform_vector_dist n α x✝ = 1 / ↑(Fintype.card α) ^ n
Instances For
noncomputable def
CodingTheory.Codeword.matrix_dist
{α : Type u_1}
[Fintype α]
[Nonempty α]
[DecidableEq α]
[Field α]
(n k : ℕ)
(x : Codeword k α)
:
The distribution on αⁿ induced by applying a uniformly random n×k matrix to x:
matrix_dist n k x v = |{G | G·x = v}| / |α|^(n·k).
Equations
- CodingTheory.Codeword.matrix_dist n k x v = ↑⋯.toFinset.card / ↑(Fintype.card α) ^ (n * k)
Instances For
theorem
CodingTheory.Codeword.uniformity_lemma
{α : Type u_1}
[Fintype α]
[Nonempty α]
[DecidableEq α]
[Field α]
(n k : ℕ)
(x : Codeword k α)
(h_x : x ≠ zero)
(h_k : k ≥ 1)
:
Uniformity Lemma: for any nonzero x ∈ αᵏ, applying a uniformly random n×k matrix
over α to x yields the uniform distribution over αⁿ.