Shadowing the work tapes of a machine #
shadow m₀ m₁ tm runs tm on its first k work tapes, while work tape k + i shadows work
tape i: its head moves with the head of tape i and marks every cell it reads, the start cell
with m₀ and the other cells with m₁ (shadowTape). When tm halts, the marks record the cells
the head of tape i visited before the halting step; only the cell under the head after the
halting step may be unmarked. A machine cannot tell these cells from the tape of tm alone, since
tm may leave blanks among the cells it wrote, but a machine that cleans up after tm can sweep
the marked cells (Turing.MultiTapeTM.clearShadowed).
The first step of shadow m₀ m₁ tm marks the start cells; after it, the machine mirrors tm step
by step (Shadow.runFrom_cfg), and if tm first halts at step u it has halted at step u + 1
(runFrom_shadow).
Main definitions #
Turing.MultiTapeTM.shadowTape: the marks of a set of cells.Turing.MultiTapeTM.shadow: the shadowing machine.
Main results #
Turing.MultiTapeTM.runFrom_shadow: the configuration ofshadow m₀ m₁ tmwhentmhas halted.Turing.MultiTapeTM.space_shadow:shadow m₀ m₁ tmuses twice the space oftm.
pairIdx_natAdd in simp normal form, since Fin.natAdd k i simplifies to i.addNat k.
The shadowing machine #
Recording one more cell marks it, unless it is marked already.
tm on the first k of k + k work tapes, with tape k + i shadowing tape i. The state
none marks the start cells of the shadow tapes with m₀; in state some q the machine runs tm
in state q and marks the cells under the shadow heads that are not yet marked with m₁.
Instances For
The cells visited by the head of work tape i in the first n steps from c, not counting
the cell it is on after them.
Instances For
One more step visits the cell the head was on.
The cells visited up to step n are the cells visited before step n and the cell the head is
on at step n.
The configuration of shadow m₀ m₁ tm mirroring the configuration c of tm, with shadow
tape i marking the cells V i.
Instances For
The first step marks the start cells.
A live step of tm is mirrored by one step of shadow m₀ m₁ tm, which marks the cells under
the heads.
While tm runs, shadow m₀ m₁ tm mirrors it, marking the visited cells.
After its first step, shadow m₀ m₁ tm mirrors the run of tm until tm halts.
If tm has not halted before step u, then after u + 1 steps shadow m₀ m₁ tm holds the
configuration of tm after u steps, and shadow tape i marks the cells visited by the head of
tape i before step u. In particular, if tm halts at step u, so has shadow m₀ m₁ tm at
step u + 1.