Langlib

Langlib.Automata.Turing.DSL.DropUntilFirstSepMachine

DropUntilFirstSep is Block-Realizable #

We prove dropUntilFirstSep sep is block-realizable via a simple TM0 machine that scans right, erasing cells until it finds sep, erases sep, and halts.

The machine has four states:

Key results #

Machine definition #

inductive DUFSState :

State type for the dropUntilFirstSep TM0 machine.

Instances For
    Equations

    Correctness #

    theorem dufs_reaches_halts {Γ : Type} [Inhabited Γ] [DecidableEq Γ] (sep : Γ) (hsep : sep default) (block suffix : List Γ) (hblock : gblock, g default) :
    ∃ (q : DUFSState), Turing.Reaches (Turing.TM0.step (dufsM sep)) (Turing.TM0.init (block ++ default :: suffix)) { q := q, Tape := Turing.Tape.mk₁ (dropUntilFirstSep sep block ++ default :: suffix) } Turing.TM0.step (dufsM sep) { q := q, Tape := Turing.Tape.mk₁ (dropUntilFirstSep sep block ++ default :: suffix) } = none

    Main result #

    theorem tm0_dropUntilFirstSep_block {Γ : Type} [Inhabited Γ] [DecidableEq Γ] [Fintype Γ] (sep : Γ) (hsep : sep default) :

    dropUntilFirstSep sep is block-realizable for any sep ≠ default.

    dropUntilFirstSep sep is strong blank-delimited block-realizable: the machine halts as soon as it reaches sep or the boundary blank, so it never needs any invariant on the suffix after that boundary.

    theorem tm0_dropUntilFirstSep_blockSepAnySuffix {Γ : Type} [Inhabited Γ] [DecidableEq Γ] [Fintype Γ] (sep outerSep : Γ) (hsep : sep default) :

    Separator-bounded dropUntilFirstSep, with an unrestricted suffix after the outer separator.