Langlib

Langlib.Automata.Turing.DSL.TM0MapBlankfree

TM0 Blank-Free Map Machine #

This file provides the TM0 machine that maps a function over a blank-free input block and rewinds to the left edge.

Main results #

States for the map machine #

inductive TM0BB.MState :
Instances For
    Equations

    Machine Definition #

    Step lemmas #

    @[simp]
    theorem TM0BB.mapM_start_nondefault {Γ : Type} [Inhabited Γ] [DecidableEq Γ] (f : ΓΓ) (a : Γ) (ha : a default) :
    @[simp]
    theorem TM0BB.mapM_start_default {Γ : Type} [Inhabited Γ] [DecidableEq Γ] (f : ΓΓ) :
    @[simp]
    @[simp]
    theorem TM0BB.mapM_done {Γ : Type} [Inhabited Γ] [DecidableEq Γ] (f : ΓΓ) (a : Γ) :

    Forward phase helper #

    theorem TM0BB.readNext_process_one {Γ : Type} [Inhabited Γ] [DecidableEq Γ] (f : ΓΓ) (a : Γ) (ha : a default) (L R : Turing.ListBlank Γ) :
    Turing.Reaches (Turing.TM0.step (mapM f)) { q := MState.readNext, Tape := { head := a, left := L, right := R } } { q := MState.readNext, Tape := { head := R.head, left := Turing.ListBlank.cons (f a) L, right := R.tail } }
    theorem TM0BB.forward_phase_cons {Γ : Type} [Inhabited Γ] [DecidableEq Γ] (f : ΓΓ) (a : Γ) (rest : List Γ) (ha : a default) (hrest : xrest, x default) :

    ListBlank helpers #

    Rewind phase #

    theorem TM0BB.rewind_loop {Γ : Type} [Inhabited Γ] [DecidableEq Γ] (f : ΓΓ) (L : List Γ) (hL : xL, x default) (acc : List Γ) :
    Turing.Reaches (Turing.TM0.step (mapM f)) { q := MState.rewind, Tape := { head := L.headI, left := Turing.ListBlank.mk L.tail, right := Turing.ListBlank.mk acc } } { q := MState.rewind, Tape := { head := default, left := Turing.ListBlank.mk [], right := Turing.ListBlank.mk (L.reverse ++ acc) } }
    theorem TM0BB.rewind_phase {Γ : Type} [Inhabited Γ] [DecidableEq Γ] (f : ΓΓ) (rev_list : List Γ) (hm : xrev_list, x default) :

    Main theorem #

    theorem TM0BB.tm0_map_blankfree {Γ : Type} [Inhabited Γ] [DecidableEq Γ] [Fintype Γ] (f : ΓΓ) (_hf : f default = default) (hf_noblank : ∀ (a : Γ), a defaultf a default) :
    ∃ (Λ : Type) (x : Inhabited Λ) (x_1 : Fintype Λ) (M : Turing.TM0.Machine Γ Λ), ∀ (l : List Γ), (∀ xl, x default)(TM0Seq.evalCfg M l).Dom ∀ (h : (TM0Seq.evalCfg M l).Dom), ((TM0Seq.evalCfg M l).get h).Tape = Turing.Tape.mk₁ (List.map f l)