Documentation

Complexity.Computability.Machines.Turing.MultiTape.Encodings.Basic

Word operations for encodings #

The building blocks of concrete encodings of pairs, options and lists, and their tidy computability in linear time and space (Turing.MultiTapeTM.ComputableTidilyInLinearTimeAndSpace).

A word w is framed by writing each symbol b as [true, b] and appending [false]. A framed word marks its own end, so it can be followed by any word and still be read back.

Main definitions #

Main results #

Framed words #

Each symbol b of w as [true, b], followed by [false].

Instances For

    The word framed at the start of v, see Turing.MultiTapeTM.frame.

    Instances For

      What follows the frame at the start of v, see Turing.MultiTapeTM.frame.

      Instances For
        @[simp]
        theorem Turing.MultiTapeTM.frame_append_inj {w w' u u' : List Bool} (h : frame w ++ u = frame w' ++ u') :
        w = w' ∧ u = u'

        A framed word followed by another word determines both.

        Transducers for the word operations #

        def Turing.MultiTapeTM.encOfEquiv {α : Type u_1} {β : Type u_2} (e : α ≃ β) (enc : β ↪ List Bool) :

        The encoding of α through an equivalence with β, such as that of a structure with the tuple of its fields.

        Instances For
          @[simp]
          theorem Turing.MultiTapeTM.encOfEquiv_apply {α : Type u_1} {β : Type u_2} (e : α ≃ β) (enc : β ↪ List Bool) (a : α) :
          (encOfEquiv e enc) a = enc (e a)
          theorem Turing.MultiTapeTM.ComputableTidilyInLinearTimeAndSpace.of_frame {α : Type u_1} {β : Type u_2} {encIn : α ↪ List Bool} {encOut : β ↪ List Bool} {f : α → β} (h : ∀ (a : α), encOut (f a) = frame (encIn a)) :

          Framing an encoded value.

          theorem Turing.MultiTapeTM.ComputableTidilyInLinearTimeAndSpace.of_unframe {α : Type u_1} {β : Type u_2} {encIn : α ↪ List Bool} {encOut : β ↪ List Bool} {f : α → β} (h : ∀ (a : α), encOut (f a) = unframe (encIn a)) :

          Reading the word framed at the start of an encoded value.

          theorem Turing.MultiTapeTM.ComputableTidilyInLinearTimeAndSpace.of_dropFrame {α : Type u_1} {β : Type u_2} {encIn : α ↪ List Bool} {encOut : β ↪ List Bool} {f : α → β} (h : ∀ (a : α), encOut (f a) = dropFrame (encIn a)) :

          Dropping the frame at the start of an encoded value.

          theorem Turing.MultiTapeTM.ComputableTidilyInLinearTimeAndSpace.of_cons_true {α : Type u_1} {β : Type u_2} {encIn : α ↪ List Bool} {encOut : β ↪ List Bool} {f : α → β} (h : ∀ (a : α), encOut (f a) = true :: encIn a) :

          Prepending true to an encoded value.

          theorem Turing.MultiTapeTM.ComputableTidilyInLinearTimeAndSpace.of_tail {α : Type u_1} {β : Type u_2} {encIn : α ↪ List Bool} {encOut : β ↪ List Bool} {f : α → β} (h : ∀ (a : α), encOut (f a) = (encIn a).tail) :

          Dropping the first symbol of an encoded value.

          theorem Turing.MultiTapeTM.ComputableTidilyInLinearTimeAndSpace.of_take_one {α : Type u_1} {β : Type u_2} {encIn : α ↪ List Bool} {encOut : β ↪ List Bool} {f : α → β} (h : ∀ (a : α), encOut (f a) = List.take 1 (encIn a)) :

          Keeping just the first symbol of an encoded value.

          theorem Turing.MultiTapeTM.ComputableTidilyInLinearTimeAndSpace.of_isEmpty {α : Type u_1} {encIn : α ↪ List Bool} {f : α → Bool} (h : ∀ (a : α), f a = (encIn a).isEmpty) :

          Testing an encoded value for emptiness.

          theorem Turing.MultiTapeTM.ComputableTidilyInLinearTimeAndSpace.of_isEmpty_ite {α : Type u_1} {β : Type u_2} {encIn : α ↪ List Bool} {encOut : β ↪ List Bool} {f : α → β} (d : β) (hd : ∀ (a : α), encIn a = [] → f a = d) (h : ComputableTidilyInLinearTimeAndSpace (f ∘ Subtype.val) ((Function.Embedding.subtype fun (a : α) => (encIn a).isEmpty = false).trans encIn) encOut) :

          A function with a fixed value d on the input encoded by the empty word, and tidily computable in linear time and space on the other inputs.