Documentation

CslibFrontier.Foundations.Data.Code.NearestDecoding

Nearest-codeword decoding #

A decoder chooses a message whose encoded word is closest to the received word in Hamming distance. No injectivity is required; when the encoder is injective this is ordinary decoding of its image code. nearestMessages keeps all minimizers, including ties.

The decoder predicate, existence theorem and left-inverse theorem were extracted unchanged from CslibFrontier.Probability.BitString.BinarySymmetricChannel.

Main definitions #

Main results #

def Cslib.BitString.IsNearestDecoder {ι : Type u_1} {M : Type u_2} [Fintype ι] (E : M → ι → Bool) (D : (ι → Bool) → M) :

D decodes E to a nearest codeword: the codeword of the decoded message is at least as close to the received word as every other codeword.

theorem Cslib.BitString.exists_isNearestDecoder {ι : Type u_1} {M : Type u_2} [Fintype ι] [Finite M] [Nonempty M] (E : M → ι → Bool) :
∃ (D : (ι → Bool) → M), IsNearestDecoder E D

Every code with finitely many messages has a nearest-codeword decoder.

theorem Cslib.BitString.IsNearestDecoder.leftInverse {ι : Type u_1} {M : Type u_2} [Fintype ι] {E : M → ι → Bool} {D : (ι → Bool) → M} (hD : IsNearestDecoder E D) (hE : Function.Injective E) :

A nearest-codeword decoder of an injective code decodes every codeword correctly.

noncomputable def Cslib.BitString.nearestMessages {ι : Type u_1} {M : Type u_2} [Fintype ι] [Fintype M] (E : M → ι → Bool) (y : ι → Bool) :

Messages whose encoded words minimize the distance to the received word.

@[simp]
theorem Cslib.BitString.mem_nearestMessages {ι : Type u_1} {M : Type u_2} [Fintype ι] [Fintype M] {E : M → ι → Bool} {y : ι → Bool} {m : M} :
m ∈ nearestMessages E y ↔ ∀ (m' : M), hammingDist (E m) y ≤ hammingDist (E m') y

Membership means that no encoded message is closer.

theorem Cslib.BitString.IsNearestDecoder.mem_nearestMessages {ι : Type u_1} {M : Type u_2} [Fintype ι] [Fintype M] {E : M → ι → Bool} {D : (ι → Bool) → M} (hD : IsNearestDecoder E D) (y : ι → Bool) :

The deterministic decoder chooses a member of the complete tie set.

theorem Cslib.BitString.hammingDist_eq_of_mem_nearestMessages {ι : Type u_1} {M : Type u_2} [Fintype ι] [Fintype M] {E : M → ι → Bool} {y : ι → Bool} {m m' : M} (hm : m ∈ nearestMessages E y) (hm' : m' ∈ nearestMessages E y) :
hammingDist (E m) y = hammingDist (E m') y

All nearest messages are at the same distance.