Documentation

CslibFrontier.Foundations.Data.Code.Johnson

The Johnson bound #

Let C be a code of length n and minimum distance at least d, and let w be a word. Each codeword c within distance e of w agrees with w on a set of at least a = n - e coordinates, and two distinct codewords agree with each other, hence on the intersection of their sets, on at most t = n - d coordinates. Counting the pairs of such codewords that agree with w at a coordinate, and applying the Cauchy–Schwarz inequality to the numbers of codewords that agree with w at each coordinate, the number L of codewords within distance e satisfies L * (a ^ 2 - n * t) ≤ n * (a - t) (Cslib.Code.card_filter_hammingDist_le_mul_le). When a ^ 2 > n * t, that is when e < n - √(n * (n - d)), a Hamming ball of radius e therefore contains at most n * (d - e) codewords (Cslib.Code.card_filter_hammingDist_le_le), whatever the alphabet: the Johnson bound [Joh62], [GRS19]. Listing the messages whose codewords lie in the ball is then a list decoder up to radius e / n with lists of n * (d - e) messages (Cslib.Code.exists_listCode_listDecodes), in the sense of Cslib.ListCode.ListDecodes; the decoder is chosen noncomputably, and no running time is claimed.

Over an alphabet of q letters the radius improves. If a of the M codewords in the ball agree with w at a coordinate, the other M - a spread over q - 1 letters, so at least a ^ 2 + (M - a) ^ 2 / (q - 1) ordered pairs of them agree there. Combining this with the double counting behind the Plotkin bound (Cslib.Code.sum_sum_hammingDist_add_sum_sum_sum_ite) gives, for q e ≤ (q - 1) n, M ((q - 1) (n - e) ^ 2 + e ^ 2 - (q - 1) n (n - d)) ≤ (q - 1) n d (Cslib.Code.card_filter_hammingDist_le_mul_le_of_mul_le): the q-ary Johnson bound [GuruswamiRudraSudan2019, Theorem 7.3.1], which the source proves for q = 2 and leaves to its Exercise 7.7 for general q. If d ≤ (1 - 1 / q) n, its hypotheses hold exactly when e / n < J_q(d / n), where J_q(δ) = (1 - 1 / q) (1 - √(1 - q δ / (q - 1))); for larger d they hold whenever q e ≤ (q - 1) n. A ball of such a radius then contains at most (q - 1) n d codewords (Cslib.Code.card_filter_hammingDist_le_le_of_mul_le): the radius of Exercise 7.7, with a list size within the q d n of Theorem 7.3.1 (Exercise 7.7 states 2 q n). As q grows, J_q(δ) decreases to the alphabet-free radius 1 - √(1 - δ).

Main results #

References #

theorem Cslib.Code.card_mul_sub_le_of_le_card_of_card_inter_le {ι : Type u_1} [Fintype ι] {κ : Type u_3} [DecidableEq ι] (L : Finset κ) (S : κ → Finset ι) {a t : ℕ} (ha : ∀ c ∈ L, a ≤ (S c).card) (ht : ∀ c ∈ L, ∀ c' ∈ L, c ≠ c' → (S c ∩ S c').card ≤ t) :
L.card * (a ^ 2 - Fintype.card ι * t) ≤ Fintype.card ι * (a - t)

Double counting for agreement sets. If each c ∈ L has a set S c ⊆ ι of size at least a, and distinct members of L meet in at most t elements, then #L * (a ^ 2 - |ι| * t) ≤ |ι| * (a - t).

theorem Cslib.Code.card_mul_le_two_mul_of_le_card_of_card_inter_le {ι : Type u_1} [Fintype ι] {κ : Type u_3} [DecidableEq ι] (L : Finset κ) (S : κ → Finset ι) {a t : ℕ} (ha : ∀ c ∈ L, a ≤ (S c).card) (ht : ∀ c ∈ L, ∀ c' ∈ L, c ≠ c' → (S c ∩ S c').card ≤ t) (h2 : 2 * Fintype.card ι * t ≤ a ^ 2) :

Double counting for agreement sets, 2 * |ι| / a form. If each c ∈ L has a set S c ⊆ ι of size at least a, distinct members of L meet in at most t elements, and 2 * |ι| * t ≤ a ^ 2, then #L * a ≤ 2 * |ι|.

theorem Cslib.Code.card_filter_hammingDist_le_mul_le {ι : Type u_1} {α : Type u_2} [Fintype ι] [DecidableEq α] {C : Finset (ι → α)} {d : ℕ} (hd : ↑d ≤ minDist ↑C) (w : ι → α) (e : ℕ) :
{c ∈ C | hammingDist c w ≤ e}.card * ((Fintype.card ι - e) ^ 2 - Fintype.card ι * (Fintype.card ι - d)) ≤ Fintype.card ι * (d - e)

The Johnson bound, in agreement form: for a code of length n and minimum distance at least d, the number L of codewords within distance e of a word w satisfies L * ((n - e) ^ 2 - n * (n - d)) ≤ n * (d - e). It bounds L when n * (n - d) < (n - e) ^ 2 and says nothing otherwise.

theorem Cslib.Code.card_filter_hammingDist_le_le {ι : Type u_1} {α : Type u_2} [Fintype ι] [DecidableEq α] {C : Finset (ι → α)} {d e : ℕ} (hd : ↑d ≤ minDist ↑C) (h : Fintype.card ι * (Fintype.card ι - d) < (Fintype.card ι - e) ^ 2) (w : ι → α) :
{c ∈ C | hammingDist c w ≤ e}.card ≤ Fintype.card ι * (d - e)

The Johnson bound [Joh62]: if n * (n - d) < (n - e) ^ 2, that is if e < n - √(n * (n - d)), a Hamming ball of radius e contains at most n * (d - e) codewords of a code of length n and minimum distance at least d, whatever the alphabet.

theorem Cslib.Code.card_filter_hammingDist_le_mul_le_two_mul {ι : Type u_1} {α : Type u_2} [Fintype ι] [DecidableEq α] {C : Finset (ι → α)} {d e : ℕ} (hd : ↑d ≤ minDist ↑C) (h : 2 * Fintype.card ι * (Fintype.card ι - d) ≤ (Fintype.card ι - e) ^ 2) (w : ι → α) :
{c ∈ C | hammingDist c w ≤ e}.card * (Fintype.card ι - e) ≤ 2 * Fintype.card ι

The Johnson bound, 2 * n / (n - e) form: if 2 * n * (n - d) ≤ (n - e) ^ 2, the number L of codewords within distance e of a word w satisfies L * (n - e) ≤ 2 * n.

theorem Cslib.Code.exists_listCode_listDecodes {ι : Type u_1} {α : Type u_2} [Fintype ι] [DecidableEq α] {M : Type u_3} [Finite M] [Nonempty M] {enc : M → ι → α} (henc : Function.Injective enc) {d e : ℕ} (hd : ↑d ≤ minDist (Set.range enc)) (h : Fintype.card ι * (Fintype.card ι - d) < (Fintype.card ι - e) ^ 2) :
∃ (C : ListCode M ι α (Fintype.card ι * (d - e))), C.encode = enc ∧ C.ListDecodes (↑e / ↑(Fintype.card ι))

List decoding up to the Johnson radius. Let enc be an injective encoding of a finite nonempty set of messages whose codewords have minimum distance at least d. If n * (n - d) < (n - e) ^ 2, some list decoder with lists of n * (d - e) messages list decodes enc up to radius e / n: it lists the messages whose codewords are within distance e of the received word.

The q-ary Johnson bound #

theorem Cslib.Code.card_filter_hammingDist_le_mul_le_of_mul_le {ι : Type u_1} {α : Type u_2} [Fintype ι] [DecidableEq α] [Fintype α] [Nonempty α] {C : Finset (ι → α)} {d : ℕ} (hd : ↑d ≤ minDist ↑C) (w : ι → α) {e : ℕ} (he : Fintype.card α * e ≤ (Fintype.card α - 1) * Fintype.card ι) :
{c ∈ C | hammingDist c w ≤ e}.card * ((Fintype.card α - 1) * (Fintype.card ι - e) ^ 2 + e ^ 2 - (Fintype.card α - 1) * Fintype.card ι * (Fintype.card ι - d)) ≤ (Fintype.card α - 1) * Fintype.card ι * d

The q-ary Johnson bound, in agreement form [GuruswamiRudraSudan2019, Theorem 7.3.1, at the radius of Exercise 7.7 for general q]: for a code of length n and minimum distance at least d over q letters, and a radius e with q e ≤ (q - 1) n, the number M of codewords within distance e of a word w satisfies M ((q - 1) (n - e) ^ 2 + e ^ 2 - (q - 1) n (n - d)) ≤ (q - 1) n d. It bounds M when (q - 1) n (n - d) < (q - 1) (n - e) ^ 2 + e ^ 2 and says nothing otherwise. The hypothesis q e ≤ (q - 1) n cannot be dropped: for q = 2 and e = d = n the ball is the whole space.

theorem Cslib.Code.card_filter_hammingDist_le_le_of_mul_le {ι : Type u_1} {α : Type u_2} [Fintype ι] [DecidableEq α] [Fintype α] [Nonempty α] {C : Finset (ι → α)} {d e : ℕ} (hd : ↑d ≤ minDist ↑C) (he : Fintype.card α * e ≤ (Fintype.card α - 1) * Fintype.card ι) (h : (Fintype.card α - 1) * Fintype.card ι * (Fintype.card ι - d) < (Fintype.card α - 1) * (Fintype.card ι - e) ^ 2 + e ^ 2) (w : ι → α) :
{c ∈ C | hammingDist c w ≤ e}.card ≤ (Fintype.card α - 1) * Fintype.card ι * d

The q-ary Johnson bound on list sizes [GuruswamiRudraSudan2019, Theorem 7.3.1, at the radius of Exercise 7.7 for general q]: if q e ≤ (q - 1) n and (q - 1) n (n - d) < (q - 1) (n - e) ^ 2 + e ^ 2, that is if e / n < J_q(d / n) when d ≤ (1 - 1 / q) n, a Hamming ball of radius e contains at most (q - 1) n d codewords of a code of length n and minimum distance at least d over q letters. The list size (q - 1) n d is within the q d n of Theorem 7.3.1 (Exercise 7.7 states 2 q n).