Documentation

TCSlib.CodingTheory.LinearCodes

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 #

Main Results #

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) :
(∀ cC, c 0c.weight d) cC, c.weight = 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 α] :
Codeword n α

The uniform distribution on length-n vectors: each vector has probability 1/|α|^n.

Equations
Instances For
    theorem CodingTheory.Codeword.finite_matrix_dist {α : Type u_1} [Fintype α] [Nonempty α] [DecidableEq α] [Field α] (n k : ) (v : Codeword n α) (x : Codeword k α) :
    {G : Matrix (Fin n) (Fin k) α | G.mulVec x = v}.Finite

    The set of matrices G such that G·x = v is finite.

    noncomputable def CodingTheory.Codeword.matrix_dist {α : Type u_1} [Fintype α] [Nonempty α] [DecidableEq α] [Field α] (n k : ) (x : Codeword k α) :
    Codeword n α

    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
    Instances For
      def CodingTheory.Codeword.get_matrix_row {α : Type u_1} (n k : ) (M : Matrix (Fin n) (Fin k) α) (i : Fin n) :
      Matrix (Fin 1) (Fin k) α

      Utility: extract row i of matrix M as a 1×k matrix.

      Equations
      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 αⁿ.