retargetInput simulation — proof internals #
This file contains the simulation lemmas for retargetInput M, showing
that retargetInput M on a configuration where work tape k holds the
"virtual input" z faithfully simulates M on input z.
Key definitions and lemmas #
retargetWrap— embed a config ofM : TM kinto a config ofretargetInput M : TM (k+1), given a choice of real-input tape.retargetInput_step_commute— one step ofMcorresponds to one step ofretargetInput Munder the wrap (assuming a structural invariant onc.input: cells ≥ 1 are neverΓ.start).retargetInput_reachesIn_of_reachesIn— multi-step simulation lifting.retargetInput_reachesIn_halted_of_decidesInTime— user-facing: ifMdecidesLin timeT, thenretargetInput Mstarted withzon work tapekreaches a halting configuration withinT(|z|)steps with the correct output.
The startedCfg family #
For phase-composed machines, the interesting entry point is not initCfg
but the configuration reached after M's forced first move off the ▷
cells. startedCfg M z hne names that configuration (well-defined once
qstart ≠ qhalt, which qstart_ne_qhalt_of_decidesInTime guarantees for
any deciding machine), and the startedCfg_* lemmas pin down each field:
state, work, and output are input-independent, while every tape sits one
cell right of ▷. retargetInput_decidesVirtual_started restates the
user-facing simulation from this post-start configuration.
Hoare liftings #
retargetInput_hoareTime— aHoareTimetriple forMlifts to a triple forretargetInput Min which the precondition readsM's input off work tapekand the postcondition existentially recoversM's final tapes.retargetInput_copyInputToWorkTM_started_hoareTime,retargetInput_inputLengthPlusOneCounterTM_started_hoareTime,retargetInput_inputLengthPlusOneCounterTM_started_tracksInput_hoareTime— virtual-input instantiations of the corresponding subroutine triples.
The structural invariant #
Because retargetInput M writes back the read symbol on work tape k
(to preserve cells), the simulation only goes through cleanly when the
current write is a no-op. This requires:
head = 0 OR read ≠ Γ.start
The second disjunct is equivalent to "cells at positions ≥ 1 never
contain Γ.start". This is a structural invariant of any DTM run
(since δ writes only Γw, which excludes Γ.start, and writes at
cell 0 are no-ops) — captured by Tape.StartInvariant below and preserved
across TM.step by Tape.StartInvariant.step.
Embed a Cfg k M.Q into Cfg (k+1) (retargetInput M).Q by:
- putting
realInputon the real input tape (ignored by the machine), - putting
c.work ion work tapeifori < k, - putting
c.inputon work tapek(the virtual input). State and output are shared.
Equations
Instances For
One step of M corresponds to one step of retargetInput M through
retargetWrap. The real-input tape drifts by move (idleDir · ).
Requires the structural invariant on c.input (cells ≥ 1 ≠ start).
Multi-step version: if M reaches c' in t steps, then
retargetInput M reaches some config (differing from retargetWrap
only in the real-input tape drift) in the same t steps.
Initial configuration for retargetInput M with virtual input z on
work tape k and an arbitrary realInput on the (ignored) real
input tape. Work tapes 0..k-1 are empty; output is empty.
Equations
- One or more equations did not get rendered due to their size.
Instances For
retargetInitCfg M z realInput is exactly the retargetWrap of M's
ordinary initial configuration on input z.
User-facing simulation: if M decides L in time T, then
retargetInput M started with z on work tape k reaches a halted
configuration within T(|z|) steps whose output cell 1 indicates
membership of z in L.
The verifier configuration after its forced first move off the start cells.
For a deciding machine this is well-defined by qstart_ne_qhalt_of_decidesInTime.
Equations
- M.startedCfg z hne = (M.step (M.initCfg z)).get ⋯
Instances For
startedCfg is the result of one deterministic verifier step from
M.initCfg z.
User-facing simulation from the post-start verifier configuration.
If M decides L, then retargetInput M can start from retargetWrap
of the verifier state immediately after M's first step on z, and it
reaches the same accepting/rejecting output. This is the form needed by
phase-composed machines whose earlier phases have already moved every
tape off ▷.
Hoare lifting for retargetInput: if a deterministic TM satisfies a
Hoare triple on its ordinary input tape, then retargetInput satisfies
the corresponding triple when that input is supplied on the last work
tape. The real input tape is ignored.
Virtual-input version of copyInputToWorkTM_started_hoareTime: if the
virtual input is a Boolean string at head 1 and work tape idx is a blank
started tape, then retargetInput (copyInputToWorkTM idx) copies that virtual
input onto work tape idx within |x| + 1 steps.
Virtual-input version of inputLengthPlusOneCounterTM_started_hoareTime:
if the virtual input is a started Boolean string and work tape counterIdx
is a started blank tape, then retargetInput (inputLengthPlusOneCounterTM counterIdx) materializes a unary counter of length |x| + 1 on that tape.
Virtual-input version of
inputLengthPlusOneCounterTM_started_tracksInput_hoareTime: besides building
the unary counter on work tape counterIdx, the postcondition also records
the final cells and head of the virtual-input tape itself.