Tape-layout combinators: extra work tapes and output retargeting #
Two DTM combinators that change a machine's tape layout without changing its behavior:
TM.liftTM tm m— padtm : TM nwithmnever-used work tapes, giving aTM (n + m)that decides/computes exactly astmdoes, in the same time bound. The extra tapes bounce off▷on the first step (respectingδ_right_of_start) and then park at cell 1 forever, writing□over the□already there.TM.retargetOutput tm— redirect the output actions oftm : TM nto a fresh work tapen(theFin.last ntape), giving aTM (n + 1)whose real output tape is idled. Used to "compute a value onto a work tape", e.g. materializing a clock value for downstream composition.
Correspondence proofs #
Both combinators are proved correct by a step-commutation lemma through a
configuration embedding (liftCfg / retargetCfg): one step of the
derived machine on an embedded configuration equals one step of tm,
embedded. The embeddings park the dummy tapes at cell 1 with blank cells;
the initial configuration instead has dummy heads at cell 0 (on ▷), so
the step lemma is stated for any dummy tape with cells = Tape.init [] and
head ≤ 1 — covering both the initial bounce and the parked steady state
(mirroring NTM.pad0).
The time bounds are preserved exactly (no + 1): the dummy-tape bounce
happens during the simulated machine's own first step.
Pad tm : TM n with m never-used work tapes. Work tapes 0..n-1
(indexed by Fin.castAdd m i) behave exactly as tm's; the extra
tapes n..n+m-1 write back what they read (readBackWrite) and idle
(idleDir): they bounce off ▷ at the first step and then park at
cell 1 forever. Input and output behavior is unchanged.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Embed a configuration of tm : TM n into one of tm.liftTM m:
work tapes i < n are c's, the extras are the canonical parked
blank tape (head 1, blank cells). State, input, and output are
shared.
Equations
- One or more equations did not get rendered due to their size.
Instances For
A positive-length run of a lifted machine from genuine initialization has
the exact liftCfg endpoint of the underlying run. The positivity hypothesis
excludes the sole mismatch at time zero, when the extra tapes have not yet
bounced from cell 0 to their canonical parked position at cell 1.
Lifting preserves deciding, with the same time bound. The extra
work tapes never interfere: the lifted machine's run tracks tm's run
step for step.
Lifting preserves function computation, with the same time bound.
Lifting preserves space bounds up to the parked cell. The extra
work tapes' heads never move past cell 1, so tm.liftTM m decides L
in space max (S ·) 1.
Redirect tm's output actions to a fresh work tape. retargetOutput tm : TM (n + 1) behaves like tm, except that the output write and
direction are applied to work tape n (the Fin.last n tape), whose
read is fed to tm.δ as the virtual output head; the real output tape
is idled (readBackWrite/idleDir). Work tapes 0..n-1 (indexed by
Fin.castSucc i) and the input tape behave as before.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Embed a configuration of tm : TM n into one of tm.retargetOutput:
work tapes i < n are c's, work tape n is c's output tape, and
the real output tape is the canonical parked blank tape.
Equations
- One or more equations did not get rendered due to their size.
Instances For
retargetCfg leaves the state unchanged.
retargetCfg leaves the input tape unchanged.
retargetCfg maps the last work tape to c's output tape.
Step commutation on embedded configurations: once the real output
tape is parked, tm.retargetOutput steps exactly as tm does through
retargetCfg.
Redirecting output to a fresh work tape preserves every exact run through the canonical configuration embedding.
A run of an output-retargeted machine leaves the virtual output on the last work tape and keeps the real output blank with its head at cell zero or one. A subsequent combinator transition therefore parks it at cell one.
Output retargeting preserves computation, with the same time
bound. If tm computes f within time T, then retargetOutput tm halts within T(|x|) steps with f x written on work tape n
(the Fin.last n tape). This is the form needed to compose "compute a
clock value onto a work tape".
Padding by unused work tapes preserves one-way output behavior.
Redirecting output to a work tape leaves the real output direction idle, so the resulting machine is always a one-way-output transducer.