Documentation

Complexitylib.Models.TuringMachine.Subroutines.ClearWork

Clearing a binary work tape #

This module exposes a literal-frame contract for erasing a canonical Boolean work tape and returning its head to cell one. It also records the one-way-output discipline of the clearing, rewinding, and composite machines.

Main results #

theorem Complexity.TM.clearWorkTM_hoareTime_frame {n : } (idx : Fin n) (bits : List Bool) (inp₀ : Tape) (work₀ : Fin nTape) (out₀ : Tape) (htarget : work₀ idx = (Tape.init (List.map Γ.ofBool bits)).move Dir3.right) (hinp : Parked inp₀) (hother : ∀ (i : Fin n), i idxParked (work₀ i)) (hout : Parked out₀) :
(clearWorkTM idx).HoareTime (fun (inp : Tape) (work : Fin nTape) (out : Tape) => inp = inp₀ work = work₀ out = out₀) (fun (inp : Tape) (work : Fin nTape) (out : Tape) => inp = inp₀ work = Function.update work₀ idx ((Tape.init []).move Dir3.right) out = out₀) (clearWorkTimeBound bits.length)

Clearing a canonical Boolean work tape preserves the input, output, and every unrelated work tape literally, and resets the target to the standard parked blank tape within 2 * bits.length + 5 steps.

theorem Complexity.TM.clearWorkTM_hoareTimeSpace_frame {n : } (idx : Fin n) (bits : List Bool) (inputLength initialSpace : ) (inp₀ : Tape) (work₀ : Fin nTape) (out₀ : Tape) (htarget : work₀ idx = (Tape.init (List.map Γ.ofBool bits)).move Dir3.right) (hinp : Parked inp₀) (hother : ∀ (i : Fin n), i idxParked (work₀ i)) (hout : Parked out₀) (hinitial : { state := (clearWorkTM idx).qstart, input := inp₀, work := work₀, output := out₀ }.WithinAuxSpace inputLength initialSpace) :
(clearWorkTM idx).HoareTimeSpace (fun (inp : Tape) (work : Fin nTape) (out : Tape) => inp = inp₀ work = work₀ out = out₀) (fun (inp : Tape) (work : Fin nTape) (out : Tape) => inp = inp₀ work = Function.update work₀ idx ((Tape.init []).move Dir3.right) out = out₀) (clearWorkTimeBound bits.length) inputLength (initialSpace + clearWorkTimeBound bits.length)

Time-and-space form of clearWorkTM_hoareTime_frame. Starting from an initialSpace budget, one extra cell per possible transition yields an honest all-reachable bound.

Blanking a work tape never moves the output head left.

Rewinding a work tape never moves the output head left.

Clearing and rewinding a work tape never moves the output head left.