Documentation

Complexity.Computability.Machines.Turing.MultiTape.Encodings.Decoder

Total decoders #

A decoder for an encoding enc : α ↪ List Bool (Turing.MultiTapeTM.Decoder) is a function on all words that inverts enc on its image and is computable within independent fixed degrees. On a malformed word it still returns a value, whose encoding has polynomial length.

Decoders are built along the structure of an encoding: unary numbers by their length, binary numbers by reading their digits up to the last true (Turing.MultiTapeTM.ofBits), Booleans by their first symbol, options by testing for the empty word, pairs by reading the framed first component (Turing.MultiTapeTM.unframe) and what follows it (Turing.MultiTapeTM.dropFrame), and lists by splitting a word into framed words (Turing.MultiTapeTM.frames) and decoding each. The splitting is done by a finite-state transducer that closes a final incomplete frame, so that every word yields a valid encoded list, and the framed words of an encoded list are its encoded elements.

Main definitions #

Main results #

Framed words one after another #

Dropping a frame does not lengthen a word.

Dropping a frame shortens a nonempty word.

@[irreducible]

The words framed one after another in w. A final incomplete frame is closed.

Instances For

    A framed word followed by another word.

    theorem Turing.MultiTapeTM.frames_encList {α : Type u_1} (enc : α ↪ List Bool) (l : List α) :
    frames ((encList enc) l) = List.map (⇑enc) l

    The framed words of an encoded list are its encoded elements.

    The states of the transducer splitting a word into framed words: between frames, inside a frame after a marker, and inside a frame after a symbol.

    Instances For

      Splits a word into framed words, closing a final incomplete frame.

      Instances For
        @[simp]
        theorem Turing.MultiTapeTM.framesT_final (x✝ : FramesState) :
        framesT.final x✝ = match x✝ with | FramesState.between => [] | x => [false]

        Inside a frame, the transducer completes the frame at the start of its input and continues with what follows.

        The transducer emits the encoded list of framed words.

        Splitting a word into framed words is linear.

        Decoders #

        def Turing.MultiTapeTM.Decoder.list {α : Type} {enc : α ↪ List Bool} (D : Decoder enc) :

        Lists are decoded element by element from the framed words of a word.

        Instances For