Documentation

Complexitylib.Encoding.FiniteAlphabet.Defs

Explicit binary codes for finite alphabets #

An enumeration assigns index i to the palindromic codeword false, true^i, false. Concatenation encodes words, including the empty word. Decoding rejects missing delimiters and indices outside the enumeration. Reversing an encoding therefore reverses its letters without changing their codes.

An explicit enumeration of an alphabet, including an empty alphabet.

  • size : ℕ

    Number of letters.

  • index : α ≃ Fin self.size

    Chosen numbering of the letters.

Instances For

    Choose a code from a finite-alphabet instance.

    Equations
    Instances For

      A delimited unary symbol code, identical to its reversal.

      Equations
      Instances For

        Concatenate the symbol codes of a word.

        Equations
        Instances For

          Decode a suffix while waiting for an opening delimiter or counting an open codeword.

          Equations
          Instances For

            Decode an entire word, rejecting every malformed code.

            Equations
            Instances For
              def Complexity.FiniteAlphabetCode.map {α β : Type} (input : FiniteAlphabetCode α) (output : FiniteAlphabetCode β) (f : List α → List β) (bits : List Bool) :

              Encode a function's result on valid inputs and return empty output on invalid codes.

              Equations
              Instances For