Tape head visitation and space-usage lemmas #
This file collects lemmas about the set of positions visited by a work-tape head
(MultiTapeTM.visitedByTapeHead) and the resulting space-usage measures
(MultiTapeTM.spaceUsedByTape, MultiTapeTM.spaceUsed) and how the tape head positions
influence the cells that are modified on a tape.
MultiTapeTM.exists_spaceUsedByTape_max shows that a computation whose space usage is bounded
attains its per-tape space usage at a single step, which makes a bound that holds at every point
in time usable as a bound for the whole run.
If the work tape head is not at position z, then the tape does not change there.
The set of positions visited by a tape head is monotone in the number of steps.
Starting from configuration cfg, every position between the initial head position of tape
i and the one after t steps is part of the "visited set" at step t.
If a work tape cell is changed after t steps, it must have been visited by the tape head.
Every position visited by the head of tape i lies within spaceUsedByTape … i of the
head's starting position.
Every non-blank cell on work tape i lies within spaceUsedByTape … i t of the origin.
The number of cells visited by a single work-tape head grows by at most one each step.
The space used by a single tape is monotone in the number of steps.
A computation whose total space usage stays below a bound reaches a step T at which the space
usage of every tape is maximal. This turns a bound that holds at every point in time into a
bound for the whole run.
Every position the head takes up to step t lies in S, so the whole visited set does. This
is Finset.image_subset_iff for the visited set, and the workhorse behind the space bounds
below.
A set containing every position of a head bounds the space used by its tape.
A run that starts with the head of tape i at cell 0 and uses at most s cells keeps that
head within [-s, s].
A run whose heads all stay within [-σ, σ] uses at most 2 * σ + 1 cells per tape.
A head that never moves uses a single cell.
The cells a run visits are the ones visited by its two halves.
Splitting a run into two phases can only overcount the cells it visits, since the two phases may revisit each other's cells.
Space usage only depends on where the work-tape heads are at each step, so two runs whose head positions agree use the same space. This is what lets a machine be replaced by a simulation of it.
Space of a simulation. If the heads of tm' on the tapes e j follow the heads of tm on
the tapes j, and each remaining tape of tm' visits at most b cells, then tm' uses the space
of tm plus at most b cells per remaining tape.
After the machine has halted the heads no longer move, so the visited set stops growing.
After the machine has halted the heads no longer move, so the space usage stops growing.
A run that never moves a work-tape head visits one cell per tape.
Output already present #
A machine never reads its output tape, so a word already present there is simply carried along by a step.
A word already on the output tape is inert. The run is the run without it, with the word prepended to whatever the machine emits.
A word already on the output tape does not affect the space used.