Documentation

Complexitylib.Models.TuringMachine.Subroutines.WipeLoop

The wipe loop #

TM.forRegTM drives a body an exact number of times off a dedicated unary fuel register. Running TM.wipeStepTM through it, fueled by a register holding v marks unrelated to any targeted tape's content, blanks the leading v cells of every target whatever was there.

Main results #

Wipe-step applied i times to t, in closed form.

Equations
Instances For
    @[simp]
    theorem Complexity.TM.wipedTape_head (t : Tape) (i : ) :
    (wipedTape t i).head = t.head + i

    Wiping advances the head one cell per step.

    theorem Complexity.TM.wipedTape_cells_of_head_one {t : Tape} (hh : t.head = 1) (H j : ) :

    What wiping does. From a head parked at cell 1, wiping H times blanks exactly cells 1 … H and leaves every other cell alone.

    The canonical blank tape's cells, spelled out.

    theorem Complexity.TM.wipedTape_eq_blank {t : Tape} (H : ) (hh : t.head = 1) (h0 : t.cells 0 = Γ.start) (hfar : ∀ (j : ), H < jt.cells j = Γ.blank) :
    wipedTape t H = { head := H + 1, cells := (Tape.init []).cells }

    Wiping really blanks the tape. A tape parked at cell 1 whose content is confined to cells 1 … H becomes literally the blank tape (head at H + 1) after H wipe steps — this is where the content-agnostic wipe pays off: no assumption is made about where inside 1 … H the nonblank cells sit.

    theorem Complexity.TM.wipedTape_parked {t : Tape} (h : Parked t) (i : ) :

    Wiping preserves Parked-ness: the head only advances, and every written or untouched cell beyond the marker stays off .

    A fresh output tape ((Tape.init []).move Dir3.right) is Parked.

    A fresh output tape satisfies the empty output accumulator.

    The only tape satisfying the empty output accumulator is the fresh parked blank tape.

    theorem Complexity.TM.regIterCells_parked (v i : ) :
    Parked { head := i + 2, cells := regCells v }

    The register-shaped tape at iteration i is Parked.

    theorem Complexity.TM.wipeLoop_hoareTime {n : } (targets : List (Fin n)) (r : Fin n) (hr : rtargets) (v : ) (inp₀ : Tape) (work₀ : Fin nTape) (hinp₀ : Parked inp₀) (hother : ∀ (j : Fin n), j rParked (work₀ j)) :
    ((wipeStepTM targets).forRegTM r).HoareTime (fun (inp : Tape) (work : Fin nTape) (out : Tape) => inp = inp₀ work = Function.update work₀ r (regTape v) out = (Tape.init []).move Dir3.right) (fun (inp : Tape) (work : Fin nTape) (out : Tape) => inp = inp₀ work = Function.update (fun (j : Fin n) => if j targets then wipedTape (work₀ j) v else work₀ j) r (regTape v) out = (Tape.init []).move Dir3.right) (v * 3 + (v + 2))

    The wipe loop. Fueled by a register at r holding v marks (r disjoint from targets), forRegTM (wipeStepTM targets) r blanks the leading v cells of every tape in targets, leaving every other tape — including the fuel register itself — exactly as it was.