Documentation

Complexity.Computability.Machines.Turing.TM2.Reverse.Cleanup

Canonical cleanup for the multi-tape to TM2 compiler #

Cleanup discards the input and work stacks, reverses the accumulated output onto the output stack, and resets finite control. Existing output is retained as a suffix.

Main definitions #

Main results #

References #

def StateTransition.EvalsToInTime.cons {α : Type} {f : α → Option α} {a b c : α} {n : ℕ} (hs : f a = some b) (h : EvalsToInTime f b (some c) n) :
EvalsToInTime f a (some c) (n + 1)

Prepend one transition to a bounded execution.

Instances For
    def StateTransition.EvalsToInTime.mono {α : Type} {f : α → Option α} {a c : α} {m n : ℕ} (h : EvalsToInTime f a (some c) m) (hmn : m ≤ n) :

    Increase the clock of a bounded execution.

    Instances For
      @[simp]

      Exactly the stacks other than the two output stacks are discarded.

      Each auxiliary is popped exactly once in a cleanup round.

      def Turing.MultiTapeTM.ToTM2.auxiliaryLength {k : ℕ} (store : (s : Stack k) → List (Alphabet s)) :

      Total auxiliary storage before a cleanup round.

      Instances For

        Total stack storage, counting both output stacks and all auxiliary stacks.

        Instances For

          Every stack contributes exactly once to the storage accounting.

          theorem Turing.MultiTapeTM.ToTM2.auxiliaryLength_eq_zero_iff {k : ℕ} (store : (s : Stack k) → List (Alphabet s)) :
          auxiliaryLength store = 0 ↔ ∀ s ∈ auxiliaries k, store s = []

          Zero auxiliary storage is equivalent to emptiness of every auxiliary stack.

          noncomputable def Turing.MultiTapeTM.ToTM2.cleanupEvals {k : ℕ} {State : Type} [Fintype State] (q₀ : State) (transition : State → Option Bool → (Fin k → Option Bool) → Action k Bool State) (cfg : (machine q₀ transition).Cfg) (hl : cfg.l = some Label.clean) :

          Configuration form of cleanEvals, allowing arbitrary finite control and stack contents.

          Instances For
            theorem Turing.MultiTapeTM.ToTM2.cleanup_stack_bound {k : ℕ} {State : Type} [Fintype State] (q₀ : State) (transition : State → Option Bool → (Fin k → Option Bool) → Action k Bool State) (cfg : (machine q₀ transition).Cfg) (hl : cfg.l = some Label.clean) (i : ℕ) :

            Every cleanup and reversal step, even after halting, uses at most the initial total storage.