Documentation

Mathlib.Computability.Encoding

Encodings #

This file contains the definition of a (finite) encoding, a map from a type to strings in an alphabet, used in defining computability by Turing machines. It also contains several examples:

Examples #

structure Computability.Encoding (α : Type u) :
Type (max u (v + 1))

An encoding of a type in a certain alphabet, together with a decoding.

  • Γ : Type v

    The alphabet of the encoding

  • encode : αList self.Γ

    The encoding function

  • decode : List self.ΓOption α

    The decoding function

  • decode_encode (x : α) : self.decode (self.encode x) = some x

    Decoding and encoding are inverses of each other.

Instances For
    theorem Computability.Encoding.encode_injective {α : Type u} (e : Encoding α) :
    Function.Injective e.encode
    structure Computability.FinEncoding (α : Type u) extends Computability.Encoding α :
    Type (max 1 u)

    An Encoding plus a guarantee of finiteness of the alphabet.

    Instances For
      @[implicit_reducible]
      instance Computability.Γ.fintype {α : Type u} (e : FinEncoding α) :

      A standard Turing machine alphabet, consisting of blank,bit0,bit1,bra,ket,comma.

      Instances For
        def Computability.instDecidableEqΓ'.decEq (x✝ x✝¹ : Γ') :
        Decidable (x✝ = x✝¹)
        Instances For
          @[implicit_reducible]
          @[implicit_reducible]
          instance Computability.inhabitedΓ' :
          Inhabited Γ'

          The natural inclusion of Bool in Γ'.

          Instances For

            An arbitrary section of the natural inclusion of Bool in Γ'.

            Instances For

              An encoding function of the positive binary numbers in Bool.

              Instances For
                def Computability.encodeNum :
                NumList Bool

                An encoding function of the binary numbers in Bool.

                Instances For
                  def Computability.encodeNat (n : ) :
                  List Bool

                  An encoding function of in Bool.

                  Instances For

                    A decoding function from List Bool to the positive binary numbers.

                    Instances For
                      def Computability.decodeNum :
                      List BoolNum

                      A decoding function from List Bool to the binary numbers.

                      Instances For
                        def Computability.decodeNat :
                        List Bool

                        A decoding function from List Bool to .

                        Instances For

                          A binary Encoding of in Bool.

                          Instances For

                            A binary encoding of in Bool, as a FinEncoding.

                            Instances For

                              A binary Encoding of in Γ'.

                              Instances For
                                def Computability.unaryEncodeNat :
                                List Bool

                                A unary encoding function of in Bool.

                                Instances For
                                  def Computability.unaryDecodeNat :
                                  List Bool

                                  A unary decoding function from List Bool to .

                                  Instances For
                                    def Computability.encodeBool :
                                    BoolList Bool

                                    An encoding function of Bool in Bool.

                                    Instances For
                                      def Computability.decodeBool :
                                      List BoolBool

                                      A decoding function from List Bool to Bool.

                                      Instances For
                                        @[implicit_reducible]
                                        @[implicit_reducible]
                                        instance Computability.inhabitedEncoding :
                                        Inhabited (Encoding Bool)

                                        A FinEncoding of a List α in (finite) alphabet α, encoded directly.

                                        Instances For
                                          def Computability.finEncodingPair {α : Type u_1} {β : Type u_2} (ea : FinEncoding α) (eb : FinEncoding β) :
                                          FinEncoding (α × β)

                                          Given FinEncoding of α and β, constructs a FinEncoding of α × β by concatenating the encodings, mapping the symbols from the first encoding with Sum.inl and those from the second with Sum.inr.

                                          Instances For