Documentation

CslibFrontier.Foundations.Data.Code.Griesmer

Residual codes, the Griesmer bound, and simplex codes #

Given a linear code C : Submodule F (ι → F) over a finite field F of size q = |F| and a codeword c ∈ C, the residual code Cslib.Code.residualLinear C c punctures C to the n - wt(c) coordinates {i : ι // c i = 0} where c vanishes [MWS77]. Summing the Hamming weights of the q translates x - a • c (a : F) gives the identity ∑_{a : F} wt(x - a • c) = q * wt(x|_{c = 0}) + (q - 1) * wt(c), from which both structural properties of residual codes follow:

Applying both properties inductively at a minimum-weight nonzero codeword yields the Griesmer bound (Griesmer 1960; Solomon and Stiffler 1965; [MWS77]): every [n, k, d]_q linear code satisfies ∑_{i < k} d ⌈/⌉ q ^ i ≤ n (Cslib.Code.sum_ceilDiv_pow_le_card). Since d ⌈/⌉ q ^ 0 = d and 1 ≤ d ⌈/⌉ q ^ i for d ≥ 1, the Griesmer sum is at least d + (k - 1) (Cslib.Code.add_sub_one_le_sum_ceilDiv_pow), recovering and refining the linear Singleton bound k + d ≤ n + 1.

Finally, evaluating k-dimensional linear forms x ⬝ᵥ · on the projective representatives Cslib.Code.SimplexPoint F k whose first nonzero coordinate is 1 defines the $q$-ary simplex code Cslib.Code.simplexCode F k of length (q ^ k - 1) / (q - 1) = ∑_{i < k} q ^ i (Cslib.Code.card_simplexPoint), dimension k (Cslib.Code.finrank_simplexCode), constant nonzero codeword weight q ^ (k - 1) (Cslib.Code.hammingNorm_simplexEncode), and minimum distance q ^ (k - 1) (Cslib.Code.minDist_simplexCode), attaining the Griesmer bound with exact equality for every finite field F and every k ≥ 1 (Cslib.Code.sum_ceilDiv_pow_simplexCode).

Main definitions #

Main results #

References #

Residual codes #

def Cslib.Code.residualLinear {ι : Type u_1} {R : Type u_2} {M : Type u_3} [Semiring R] [AddCommMonoid M] [Module R M] (C : Submodule R (ι → M)) (c : ι → M) :
Submodule R ({ i : ι // c i = 0 } → M)

The residual code Res(C, c) of a linear code C with respect to a word c : ι → M: the puncturing of C to the coordinates {i : ι // c i = 0} where c vanishes.

@[simp]
theorem Cslib.Code.mem_residualLinear {ι : Type u_1} {R : Type u_2} {M : Type u_3} [Semiring R] [AddCommMonoid M] [Module R M] {C : Submodule R (ι → M)} {c : ι → M} {y : { i : ι // c i = 0 } → M} :
y ∈ residualLinear C c ↔ ∃ x ∈ C, x ∘ Subtype.val = y
@[simp]
theorem Cslib.Code.coe_residualLinear {ι : Type u_1} {R : Type u_2} {M : Type u_3} [Semiring R] [AddCommMonoid M] [Module R M] (C : Submodule R (ι → M)) (c : ι → M) :
theorem Cslib.Code.le_minDist_residualLinear {ι : Type u_1} {F : Type u_2} [Fintype ι] [Field F] [Fintype F] [DecidableEq F] {C : Submodule F (ι → F)} {c : ι → F} (hc : c ∈ C) {d : ℕ} (hd : ↑d ≤ minDist ↑C) :

Minimum distance of a residual code: if C has minimum distance at least d over a finite field F of size q = |F| and c ∈ C, then ((q * d - (q - 1) * wt(c)) ⌈/⌉ q : ℕ∞) ≤ minDist (residualLinear C c).

theorem Cslib.Code.finrank_residualLinear_add_one {ι : Type u_1} {F : Type u_2} [Fintype ι] [Field F] [Fintype F] [DecidableEq F] {C : Submodule F (ι → F)} {c : ι → F} (hc : c ∈ C) (hc0 : c ≠ 0) {d : ℕ} (hd : ↑d ≤ minDist ↑C) (hw : (Fintype.card F - 1) * hammingNorm c < Fintype.card F * d) :

Dimension of a residual code: if C has minimum distance at least d over a finite field F of size q = |F| and c ∈ C is a nonzero codeword with (q - 1) * wt(c) < q * d, then dim_F (residualLinear C c) + 1 = dim_F C.

The Griesmer bound #

theorem Cslib.Code.sum_ceilDiv_pow_le_card {ι : Type u_1} {F : Type u_2} [Fintype ι] [Field F] [Fintype F] [DecidableEq F] (C : Submodule F (ι → F)) {d : ℕ} (hd : ↑d ≤ minDist ↑C) :

The Griesmer bound (Griesmer 1960; Solomon and Stiffler 1965; [MWS77]): for any linear code C of length n = |ι| and minimum distance at least d over a finite field F of size q = |F|, ∑_{i < dim_F C} d ⌈/⌉ q ^ i ≤ n.

theorem Cslib.Code.add_sub_one_le_sum_ceilDiv_pow {d k q : ℕ} (hd : 1 ≤ d) (hk : 1 ≤ k) (hq : 1 ≤ q) :
d + (k - 1) ≤ ∑ i ∈ Finset.range k, d ⌈/⌉ q ^ i

For 1 ≤ d, 1 ≤ k, and 1 ≤ q, the Griesmer sum ∑_{i < k} d ⌈/⌉ q ^ i is at least d + (k - 1), showing that sum_ceilDiv_pow_le_card refines the linear Singleton bound k + d ≤ n + 1.

`$q$-ary simplex codes and tightness of the Griesmer bound #

@[reducible, inline]
abbrev Cslib.Code.SimplexPoint (F : Type u_1) [Zero F] [One F] (k : ℕ) :
Type u_1

Normalized projective points in Fin k → F: vectors whose first nonzero entry is 1.

Over a finite field F of size q = |F|, there are ∑_{i < k} q ^ i = (q ^ k - 1) / (q - 1) normalized projective points in SimplexPoint F k.

def Cslib.Code.simplexEncode (F : Type u_1) [Field F] (k : ℕ) :
(Fin k → F) →ₗ[F] SimplexPoint F k → F

Linear encoding map of the $q$-ary simplex code: evaluates x : Fin k → F by dot product on each normalized projective point p : SimplexPoint F k.

@[simp]
theorem Cslib.Code.simplexEncode_apply {F : Type u_1} [Field F] {k : ℕ} (x : Fin k → F) (p : SimplexPoint F k) :
(simplexEncode F k) x p = x ⬝ᵥ ↑p
def Cslib.Code.simplexCode (F : Type u_1) [Field F] (k : ℕ) :
Submodule F (SimplexPoint F k → F)

The $q$-ary simplex code of dimension k over F, as a submodule of SimplexPoint F k → F.

@[simp]
theorem Cslib.Code.mem_simplexCode {F : Type u_1} [Field F] {k : ℕ} {w : SimplexPoint F k → F} :
w ∈ simplexCode F k ↔ ∃ (x : Fin k → F), (simplexEncode F k) x = w

simplexEncode F k is injective over every field F.

@[simp]
theorem Cslib.Code.finrank_simplexCode (F : Type u_1) [Field F] (k : ℕ) :

The $q$-ary simplex code simplexCode F k has dimension k.

theorem Cslib.Code.hammingNorm_simplexEncode {F : Type u_1} [Field F] [Fintype F] [DecidableEq F] {k : ℕ} {x : Fin k → F} (hx : x ≠ 0) :

**Constant weight of $q$-ary simplex codewords**: over a finite field Fof sizeq = |F|, every nonzero message x : Fin k → Fencodes to a codeword of Hamming weightq ^ (k - 1)`.

@[simp]
theorem Cslib.Code.minDist_simplexCode {F : Type u_1} [Field F] [Fintype F] [DecidableEq F] {k : ℕ} (hk : 1 ≤ k) :
minDist ↑(simplexCode F k) = ↑(Fintype.card F) ^ (k - 1)

For k ≥ 1, the $q$-ary simplex code simplexCode F k has minimum distance q ^ (k - 1).

Tightness of the Griesmer bound: for every finite field F and every dimension k ≥ 1, simplexCode F k meets sum_ceilDiv_pow_le_card with exact equality.