Documentation

TauCeti.InformationTheory.Coding.Binary.Basic

Even and doubly-even binary codes #

Binary Hamming weights detect Euclidean orthogonality: the dot product is the parity of the intersection of supports, and the weight of a sum subtracts twice that intersection. Consequently, a binary linear code whose weights are all divisible by four is self-orthogonal.

An even code is characterized by membership of the all-ones word in its dual. In particular, a binary self-dual code is even and contains the all-ones word. These facts supply the elementary parity constraints used in the study of doubly-even self-dual codes.

The conventions and weight-intersection argument follow Huffman and Pless, Fundamentals of Error-Correcting Codes, Chapters 1 and 9.

theorem TauCeti.hammingNorm_add_add_two_mul_card_support_inter {ι : Type u_1} [Fintype ι] (x y : ι → ZMod 2) :
hammingNorm (x + y) + 2 * {i : ι | x i ≠ 0 ∧ y i ≠ 0}.card = hammingNorm x + hammingNorm y

For binary words, the weight of a sum plus twice the size of the support intersection is the sum of the weights.

theorem TauCeti.dotProduct_eq_card_support_inter {ι : Type u_1} [Fintype ι] (x y : ι → ZMod 2) :
x ⬝ᵥ y = ↑{i : ι | x i ≠ 0 ∧ y i ≠ 0}.card

The binary dot product is the cardinality of the support intersection, reduced modulo two.

@[simp]
theorem TauCeti.dotProduct_self_eq_hammingNorm {ι : Type u_1} [Fintype ι] (x : ι → ZMod 2) :
x ⬝ᵥ x = ↑(hammingNorm x)

A binary word has self-dot-product equal to its weight modulo two.

@[simp]
theorem TauCeti.dotProduct_one_eq_hammingNorm {ι : Type u_1} [Fintype ι] (x : ι → ZMod 2) :
x ⬝ᵥ 1 = ↑(hammingNorm x)

Pairing a binary word with the all-ones word gives its weight modulo two.

theorem TauCeti.sum_val_eq_hammingNorm {ι : Type u_1} [Fintype ι] (x : ι → ZMod 2) :
∑ i : ι, (x i).val = hammingNorm x

The coordinates of the 0/1 lift of a binary word sum to its weight.

@[simp]
theorem TauCeti.four_dvd_hammingNorm_add_iff {ι : Type u_1} [Fintype ι] {x y : ι → ZMod 2} (hx : 4 ∣ hammingNorm x) (hy : 4 ∣ hammingNorm y) :
4 ∣ hammingNorm (x + y) ↔ x ⬝ᵥ y = 0

The sum of two binary words of weights divisible by four again has weight divisible by four exactly when the two words are orthogonal.

def TauCeti.BinaryCode.IsEven {ι : Type u_1} [Fintype ι] (C : LinearCode (ZMod 2) ι) :

A binary code is even if all its words have even Hamming weight.

Instances For

    A binary code is doubly even if all its Hamming weights are divisible by four.

    Instances For
      theorem TauCeti.BinaryCode.isEven_iff {ι : Type u_1} [Fintype ι] {C : LinearCode (ZMod 2) ι} :
      IsEven C ↔ ∀ x ∈ C, Even (hammingNorm x)

      Evenness can be checked word by word.

      theorem TauCeti.BinaryCode.isDoublyEven_iff {ι : Type u_1} [Fintype ι] {C : LinearCode (ZMod 2) ι} :
      IsDoublyEven C ↔ ∀ x ∈ C, 4 ∣ hammingNorm x

      Double evenness can be checked by divisibility of the weight of each word by four.

      theorem TauCeti.BinaryCode.IsDoublyEven.isEven {ι : Type u_1} [Fintype ι] {C : LinearCode (ZMod 2) ι} (hC : IsDoublyEven C) :

      Every doubly-even code is even.

      theorem TauCeti.BinaryCode.IsEven.mono {ι : Type u_1} [Fintype ι] {C D : LinearCode (ZMod 2) ι} (hD : IsEven D) (hCD : C ≤ D) :

      Evenness passes to subcodes.

      theorem TauCeti.BinaryCode.IsDoublyEven.mono {ι : Type u_1} [Fintype ι] {C D : LinearCode (ZMod 2) ι} (hD : IsDoublyEven D) (hCD : C ≤ D) :

      Double evenness passes to subcodes.

      An even binary code is precisely one whose dual contains the all-ones word.

      For binary codes, evenness is exactly containment in the single-parity-check code.

      Every self-orthogonal binary code is even.

      A doubly-even binary linear code is self-orthogonal.

      A self-dual binary code contains the all-ones word.