The bounded-iteration machine's tape layout — proof internals #
The tape layout and phase contracts that
Complexitylib.Classes.P.Cobham.Internal.Iterate assembles into the
bounded-iteration machine: two unary fuel registers (one consumed by the outer
loop, one reused by every reset), one junk tape for the register arithmetic, and
then TM.applyTM's own tapes placed after them. The running value needs no tape
of its own — it lives on applyTM's virtual-input tape, which is exactly where
the next call wants it.
Main results #
Complexity.rfIdx,wfIdx,junkIdx,appIdx,vinIdx,resIdx— the layoutComplexity.placedApply_hoareTime— one embedded application of the iterated functionComplexity.iterPark_hoareTime,iterResetScratch_hoareTime,iterFinish_hoareTime— the phase contracts around it
Where TM.applyTM's tape j sits in the composite layout.
Equations
Instances For
The running value's tape — applyTM's virtual input.
Equations
Instances For
Where one application of the iterated function leaves its result.
Equations
- Complexity.resIdx = Complexity.appIdx (Fin.last (k + 1))
Instances For
One application of the iterated function, in the composite layout.
The bookkeeping tapes are held fixed; applyTM's block goes from its entry
shape for y to a state where the result tape holds G y and every tape of
the block is still confined to cells 1 … H — the two facts
Complexity.resetTapesTM needs to clean up afterwards.
The tapes cleaned between two applications of the iterated function: the witness machine's own scratch together with the virtual-input tape. The result tape is deliberately excluded — it still carries the value being moved.
Equations
- Complexity.resetTargets k = List.map (fun (j : Fin (k + 1)) => Complexity.appIdx j.castSucc) (List.finRange (k + 1))
Instances For
The tape cleaned after the result has been moved back.
Equations
Instances For
Phases 2–3 of the body. δ_right_of_start only constrains a head that
reads ▷, so an arbitrary witness machine may halt with a head parked on
cell 0. One idle step lifts every head to at least cell 1, and one rewind
then brings the result tape's head back to exactly cell 1 — the shape both
Complexity.resetTapesTM (which preserves non-target tapes only when they are
parked) and TM.copyWorkToWorkTM (which wants its source at cell 1)
require.
Phase 4 of the body. Blank the witness machine's scratch tapes and the virtual-input tape, leaving the result tape (which carries the value being moved), both fuel registers, and the junk tape exactly as they were.
Phases 5–6 of the body. Move the freshly computed value from the result
tape onto the virtual-input tape — where the next application will read it —
and then blank the result tape, restoring TM.applyPre's entry shape for the
new value.