Documentation

TCSlib.ErrorCorrectingCodes.Basic

Error-Correcting Codes — Core Definitions #

This file provides the foundational definitions for coding theory over a finite alphabet α.

Main Definitions #

Main Results #

@[reducible, inline]
abbrev ErrorCorrectingCodes.Codeword (n : ) (α : Type u_2) [Fintype α] [DecidableEq α] :
Type u_2

A codeword of block-length n over alphabet α. Concretely, a function Fin n → α.

Equations
Instances For
    def ErrorCorrectingCodes.Codeword.add {α : Type u_1} [Fintype α] [DecidableEq α] [Field α] {n : } (c₁ c₂ : Codeword n α) :

    Pointwise addition of two codewords.

    Equations
    • c₁.add c₂ i = c₁ i + c₂ i
    Instances For
      def ErrorCorrectingCodes.Codeword.sub {α : Type u_1} [Fintype α] [DecidableEq α] [Field α] {n : } (c₁ c₂ : Codeword n α) :

      Pointwise subtraction of two codewords.

      Equations
      • c₁.sub c₂ i = c₁ i - c₂ i
      Instances For
        def ErrorCorrectingCodes.Codeword.zero {α : Type u_1} [Fintype α] [DecidableEq α] [Field α] {n : } :

        The all-zeros codeword.

        Equations
        Instances For
          @[reducible, inline]
          abbrev ErrorCorrectingCodes.Codeword.Code (n : ) (α : Type u_2) [Fintype α] [DecidableEq α] :
          Type u_2

          A code of block-length n over α: a finite set of codewords.

          Equations
          Instances For
            def ErrorCorrectingCodes.Codeword.Linear_Code {α : Type u_1} [Fintype α] [DecidableEq α] [Field α] {n m : } (C : Code n α) (G : Matrix (Fin n) (Fin m) α) :

            A code C is linear with generator matrix G : Fin n × Fin m → α if C is exactly the image of the linear map G · -.

            Equations
            Instances For
              def ErrorCorrectingCodes.Codeword.Linear_Code' {α : Type u_1} [Fintype α] [DecidableEq α] [Field α] {n : } (C : Code n α) (m : ) :

              Existential variant of Linear_Code: C is the image of some n×m generator matrix.

              Equations
              • One or more equations did not get rendered due to their size.
              Instances For
                noncomputable def ErrorCorrectingCodes.Codeword.qaryEntropy (q : ) (p : ) :

                The q-ary entropy function H_q(p) = p·log_q(q-1) - p·log_q(p) - (1-p)·log_q(1-p).

                Equations
                Instances For

                  If q ≥ 2, then q is positive as a real number.

                  If q ≥ 2, then q > 1 as a real number.

                  If q ≥ 2, then q - 1 is nonnegative as a real number.

                  If q ≥ 2, then q - 1 is positive as a real number.

                  If q ≥ 2, then q ≠ 1 as a real number.

                  If p < 1, then 1 - p is positive.

                  If p ≤ 1, then 1 - p is nonnegative.

                  theorem ErrorCorrectingCodes.Codeword.mul_one_sub_pos {p : } (hp : 0 < p) (hp' : p < 1) :
                  0 < p * (1 - p)

                  If 0 < p < 1, then p (1 - p) is positive.

                  theorem ErrorCorrectingCodes.Codeword.lt_one_of_le_one_sub_inv {q p : } (hq : 0 < q) (hp : p 1 - 1 / q) :
                  p < 1

                  If q > 0 and p ≤ 1 - 1/q, then p < 1.

                  theorem ErrorCorrectingCodes.Codeword.one_sub_pos_of_le_one_sub_inv {q p : } (hq : 0 < q) (hp : p 1 - 1 / q) :
                  0 < 1 - p

                  If q > 0 and p ≤ 1 - 1/q, then 1 - p is positive.

                  The Hamming distance between two codewords.

                  Equations
                  Instances For
                    def ErrorCorrectingCodes.Codeword.distance {α : Type u_1} [Fintype α] [DecidableEq α] {n : } (C : Code n α) (d : ) :

                    distance C d holds when d is the minimum Hamming distance of code C: there exist two distinct codewords at distance exactly d, and no two distinct codewords are closer.

                    Equations
                    Instances For
                      noncomputable def ErrorCorrectingCodes.Codeword.rate {α : Type u_1} [Fintype α] [DecidableEq α] {n : } (C : Code n α) :

                      The rate of a code: log_{|α|}(|C|) / n.

                      Equations
                      Instances For
                        def ErrorCorrectingCodes.Codeword.weight {α : Type u_1} [Fintype α] [DecidableEq α] [Field α] {n : } (c : Codeword n α) :

                        The Hamming weight of a codeword: its distance from the all-zeros word.

                        Equations
                        Instances For

                          max_size n d A asserts that A is the maximum size of any code of block-length n and minimum distance d.

                          Equations
                          • One or more equations did not get rendered due to their size.
                          Instances For
                            theorem ErrorCorrectingCodes.Codeword.dist_le_length {α : Type u_1} [Fintype α] [Nonempty α] [DecidableEq α] [Field α] {n : } (C : Code n α) (d : ) (h : distance C d) :
                            d n

                            The minimum distance of a code is at most the block length.

                            def ErrorCorrectingCodes.Codeword.hamming_ball {α : Type u_1} [Fintype α] [DecidableEq α] {n : } (l : ) (c : Codeword n α) :

                            The Hamming ball of radius l centred at codeword c: the set of codewords within Hamming distance l of c.

                            Equations
                            Instances For