Documentation

CslibFrontier.Foundations.Data.Code.Interleaved

Interleaved linear codes and random-linear-combination proximity bounds #

Given a linear code C : Submodule R (ι → M) of length |ι| over alphabet M and a row-index type κ, the κ-interleaved linear code Cslib.Code.interleavedLinear κ C consists of the column-indexed words W : ι → κ → M whose rows i ↦ W i r (r : κ) all belong to C. Viewing words column-wise over the block alphabet κ → M reuses Mathlib's hammingDist and Cslib.Code.minDist directly: the Hamming distance between W, V : ι → κ → M counts the columns i : ι on which at least one row disagrees, so proximity hammingDist W V ≤ e to interleavedLinear κ C is equivalent to correlated agreement of the rows on a shared coordinate subset D' : Finset ι of size at least |ι| - e (Cslib.Code.exists_mem_interleavedLinear_hammingDist_le_iff), and interleaving over a nonempty row set preserves minimum distance (Cslib.Code.minDist_interleavedLinear).

For random row linear combinations i ↦ ∑ r : Fin m, z r • W i r with uniform weights z : Fin m → F over a finite field F, this module proves two complementary proximity bounds:

  1. Universal linear-code d / 3 bound (3 * (e : ℕ∞) < minDist C, step toward #643 and #5968 after Ames, Hazay, Ishai, and Venkitasubramaniam [AHIV17]; locator not re-verified against primary PDF): an elementary characteristic-free 1D affine-line argument shows that if more than e + 1 points on u₀ + z • u₁ lie within distance e of C, then u₀ and u₁ share correlated agreement on at least |ι| - e coordinates (Cslib.Code.exists_correlatedAgreement_of_three_mul_lt_minDist). Lifting through Cslib.Code.exists_weighted_correlatedAgreement_affine_of_line bounds the probability that a uniform row combination of an e-far word lands within distance e of C by (e + 1) / |F| uniformly for all m : ℕ (Cslib.Code.toOuterMeasure_sum_smul_close_le_of_three_mul_lt_minDist), with unique-codeword extraction above (e + 1) / |F| (Cslib.Code.exists_unique_mem_interleavedLinear_of_three_mul_lt_minDist).
  2. Reed–Solomon unique-decoding d / 2 bound (2 * e + k ≤ |ι|, derived from [BenSassonCarmonIshaiKoppartySaraf2020, Theorem 1.6 / eq. (1.2)] via Cslib.Code.exists_uniqueMaximal_correlatedAgreement_affine_unique): for Cslib.Code.reedSolomon α k with distinct evaluation points α : ι → F, an e-far column-word W : ι → Fin m → F produces an e-close uniform row linear combination with probability at most |ι| / |F| uniformly for all m : ℕ (Cslib.Code.toOuterMeasure_sum_smul_reedSolomon_close_le), and exceeding |ι| / |F| uniquely determines the nearest interleaved codeword V ∈ interleavedLinear (Fin m) (reedSolomon α k) (Cslib.Code.exists_unique_mem_interleavedLinear_reedSolomon).

Main definitions #

Main results #

References #

Interleaved linear codes, minimum distance, and correlated agreement #

def Cslib.Code.interleavedLinear (κ : Type u_1) {ι : Type u_2} {R : Type u_3} {M : Type u_4} [Semiring R] [AddCommMonoid M] [Module R M] (C : Submodule R (ι → M)) :
Submodule R (ι → κ → M)

The κ-interleaved linear code of C : Submodule R (ι → M) over column alphabet κ → M: a column-indexed word W : ι → κ → M belongs to interleavedLinear κ C iff every row i ↦ W i r (r : κ) belongs to C.

@[simp]
theorem Cslib.Code.mem_interleavedLinear {κ : Type u_1} {ι : Type u_2} {R : Type u_3} {M : Type u_4} [Semiring R] [AddCommMonoid M] [Module R M] {C : Submodule R (ι → M)} {W : ι → κ → M} :
W ∈ interleavedLinear κ C ↔ ∀ (r : κ), (fun (i : ι) => W i r) ∈ C

Membership in interleavedLinear κ C means every row belongs to C.

theorem Cslib.Code.sum_smul_mem_of_mem_interleavedLinear {κ : Type u_1} {ι : Type u_2} {R : Type u_3} {M : Type u_4} [Fintype κ] [Semiring R] [AddCommMonoid M] [Module R M] {C : Submodule R (ι → M)} {W : ι → κ → M} (hW : W ∈ interleavedLinear κ C) (z : κ → R) :
(fun (i : ι) => ∑ r : κ, z r • W i r) ∈ C

Any linear combination of the rows of a codeword W ∈ interleavedLinear κ C belongs to C.

theorem Cslib.Code.hammingDist_sum_smul_le {κ : Type u_1} {ι : Type u_2} {R : Type u_3} {M : Type u_4} [Fintype κ] [Fintype ι] [Semiring R] [AddCommMonoid M] [Module R M] [DecidableEq M] (z : κ → R) (W₁ W₂ : ι → κ → M) :
(hammingDist (fun (i : ι) => ∑ r : κ, z r • W₁ i r) fun (i : ι) => ∑ r : κ, z r • W₂ i r) ≤ hammingDist W₁ W₂

Taking a row linear combination cannot increase column Hamming distance.

theorem Cslib.Code.minDist_interleavedLinear (κ : Type u_1) {ι : Type u_2} {R : Type u_3} {M : Type u_4} [Fintype κ] [Nonempty κ] [Fintype ι] [Ring R] [AddCommGroup M] [Module R M] [DecidableEq M] (C : Submodule R (ι → M)) :

Minimum distance of an interleaved linear code: when the row index κ is nonempty, interleaving preserves Cslib.Code.minDist.

theorem Cslib.Code.exists_mem_interleavedLinear_hammingDist_le_iff {κ : Type u_1} {ι : Type u_2} {R : Type u_3} {M : Type u_4} [Fintype κ] [Fintype ι] [Semiring R] [AddCommMonoid M] [Module R M] [DecidableEq M] {C : Submodule R (ι → M)} {W : ι → κ → M} {e : ℕ} :
(∃ V ∈ interleavedLinear κ C, hammingDist W V ≤ e) ↔ ∃ (D' : Finset ι), Fintype.card ι - e ≤ D'.card ∧ ∃ (v : κ → ι → M), (∀ (r : κ), v r ∈ C) ∧ ∀ i ∈ D', ∀ (r : κ), W i r = v r i

Interleaved proximity iff correlated agreement: W : ι → κ → M lies within column-Hamming distance e of interleavedLinear κ C if and only if its rows share a single agreement set D' : Finset ι of size at least |ι| - e with codewords v r ∈ C.

Universal linear-code d / 3 correlated agreement and interleaved proximity #

theorem Cslib.Code.exists_correlatedAgreement_of_three_mul_lt_minDist {F : Type u_1} {ι : Type u_2} [Field F] [DecidableEq F] [Fintype ι] {C : Submodule F (ι → F)} {e : ℕ} (hmin : 3 * ↑e < minDist ↑C) (u₀ u₁ : ι → F) (S : Finset F) (hS : e + 1 < S.card) (hclose : ∀ z ∈ S, ∃ c ∈ C, hammingDist (u₀ + z • u₁) c ≤ e) :
∃ (D' : Finset ι), Fintype.card ι - e ≤ D'.card ∧ ∃ v₀ ∈ C, ∃ v₁ ∈ C, ∀ i ∈ D', u₀ i = v₀ i ∧ u₁ i = v₁ i

1D affine-line correlated agreement within one-third the minimum distance: over an arbitrary field F, if C : Submodule F (ι → F) satisfies 3 * (e : ℕ∞) < minDist C and strictly more than e + 1 scalars z ∈ S satisfy that u₀ + z • u₁ lies within Hamming distance e of C, then u₀ and u₁ agree with codewords v₀, v₁ ∈ C on a shared coordinate subset D' : Finset ι of size at least |ι| - e.

theorem Cslib.Code.toOuterMeasure_sum_smul_close_le_of_three_mul_lt_minDist {F : Type u_1} {ι : Type u_2} [Field F] [Fintype F] [DecidableEq F] [Fintype ι] {C : Submodule F (ι → F)} {e m : ℕ} (hmin : 3 * ↑e < minDist ↑C) {W : ι → Fin m → F} (hfar : ∀ V ∈ interleavedLinear (Fin m) C, e < hammingDist W V) :
(Probability.PMF.uniformOfFintype (Fin m → F)).toOuterMeasure {z : Fin m → F | ∃ c ∈ C, hammingDist (fun (i : ι) => ∑ r : Fin m, z r • W i r) c ≤ e} ≤ ↑(e + 1) / ↑(Fintype.card F)

Step toward #643 and #5968 after [AHIV17] (locator not re-verified against primary PDF; universal linear-code d / 3 interleaved proximity bound): over a finite field F, if 3 * (e : ℕ∞) < minDist C and W : ι → Fin m → F has column-Hamming distance strictly greater than e from every codeword of interleavedLinear (Fin m) C, then a uniformly random row linear combination i ↦ ∑ r, z r • W i r lies within Hamming distance e of C with probability at most (e + 1) / |F|, uniformly for all m : ℕ.

theorem Cslib.Code.exists_unique_mem_interleavedLinear_of_three_mul_lt_minDist {F : Type u_1} {ι : Type u_2} [Field F] [Fintype F] [DecidableEq F] [Fintype ι] {C : Submodule F (ι → F)} {e m : ℕ} (hmin : 3 * ↑e < minDist ↑C) {W : ι → Fin m → F} (hprob : ↑(e + 1) / ↑(Fintype.card F) < (Probability.PMF.uniformOfFintype (Fin m → F)).toOuterMeasure {z : Fin m → F | ∃ c ∈ C, hammingDist (fun (i : ι) => ∑ r : Fin m, z r • W i r) c ≤ e}) :
∃! V : ι → Fin m → F, V ∈ interleavedLinear (Fin m) C ∧ hammingDist W V ≤ e

Unique-decoding extraction for linear codes within d / 3: if 3 * (e : ℕ∞) < minDist C and a uniform row linear combination of W : ι → Fin m → F lies within Hamming distance e of C with probability strictly greater than (e + 1) / |F|, then there exists a unique interleaved codeword V ∈ interleavedLinear (Fin m) C within column-Hamming distance e of W.

Reed–Solomon unique-decoding d / 2 interleaved proximity bound #

theorem Cslib.Code.toOuterMeasure_sum_smul_reedSolomon_close_le {F : Type u_1} {ι : Type u_2} [Field F] [Fintype F] [DecidableEq F] [Fintype ι] {α : ι → F} (hα : Function.Injective α) {e k m : ℕ} (hunique : 2 * e + k ≤ Fintype.card ι) {W : ι → Fin m → F} (hfar : ∀ V ∈ interleavedLinear (Fin m) (reedSolomon α k), e < hammingDist W V) :
(Probability.PMF.uniformOfFintype (Fin m → F)).toOuterMeasure {z : Fin m → F | ∃ c ∈ reedSolomon α k, hammingDist (fun (i : ι) => ∑ r : Fin m, z r • W i r) c ≤ e} ≤ ↑(Fintype.card ι) / ↑(Fintype.card F)

Reed–Solomon interleaved proximity bound in the unique-decoding regime (2 * e + k ≤ |ι|, derived from [BenSassonCarmonIshaiKoppartySaraf2020, Theorem 1.6 / eq. (1.2)]): over a finite field F with distinct evaluation points α : ι → F, if W : ι → Fin m → F has column-Hamming distance strictly greater than e from interleavedLinear (Fin m) (reedSolomon α k), then a uniformly random row linear combination i ↦ ∑ r, z r • W i r lies within Hamming distance e of reedSolomon α k with probability at most |ι| / |F|, uniformly for all m : ℕ.

theorem Cslib.Code.exists_unique_mem_interleavedLinear_reedSolomon {F : Type u_1} {ι : Type u_2} [Field F] [Fintype F] [DecidableEq F] [Fintype ι] {α : ι → F} (hα : Function.Injective α) {e k m : ℕ} (hunique : 2 * e + k ≤ Fintype.card ι) {W : ι → Fin m → F} (hprob : ↑(Fintype.card ι) / ↑(Fintype.card F) < (Probability.PMF.uniformOfFintype (Fin m → F)).toOuterMeasure {z : Fin m → F | ∃ c ∈ reedSolomon α k, hammingDist (fun (i : ι) => ∑ r : Fin m, z r • W i r) c ≤ e}) :
∃! V : ι → Fin m → F, V ∈ interleavedLinear (Fin m) (reedSolomon α k) ∧ hammingDist W V ≤ e

Reed–Solomon interleaved correlated agreement and unique-codeword extraction in the unique-decoding regime (2 * e + k ≤ |ι|): if a uniform row linear combination of W : ι → Fin m → F lies within Hamming distance e of reedSolomon α k with probability strictly greater than |ι| / |F|, then there exists a unique interleaved codeword V ∈ interleavedLinear (Fin m) (reedSolomon α k) within column-Hamming distance e of W (equivalently, unique Reed–Solomon row codewords agreeing with W on at least |ι| - e shared columns).