Putting every head back where a stage expects it #
A simulated machine leaves its heads wherever its run ended — possibly on the left marker, since a machine may halt immediately after stepping left onto it. Everything downstream wants heads parked past the marker, and the tapes a stage will read again want them back at cell one.
TM.parkRewindTM does both: one parking step for every tape, then a rewind of the input tape and
of each named work tape. It is the stage that separates a simulation from whatever reads its
results.
Main results #
TM.parkRewindTM— park everything, then rewind the input and the named work tapesTM.parkRewindTM_hoareTime— its contract, through fully pinned tape statesTM.parkRewindWorkTM,TM.parkRewindWorkTM_hoareTime— the same for the work tapes alone, leaving the input head where the stage left it
The cleanup stage's contract. Every head ends parked; the input tape and the named work
tapes end at cell one, with their contents untouched. Only Tape.StartInvariant is asked of the
starting tapes — a head may still be sitting on the marker, which is exactly the state a halted
simulation can leave behind.
Park every head past the marker, then rewind only the named work tapes. The input tape keeps its head — a stage whose input head is itself part of the state being simulated cannot afford to have it rewound.
Equations
Instances For
The work-only cleanup stage's contract. The named work tapes end at cell one with their contents untouched; every other head ends merely parked.