An internal clock on a work tape #
withClock reserves a last work tape for a unary budget. Each true cell permits one source
instruction, implemented by two target instructions. The first other cell stops the controller.
After the source halts, the controller consumes the remaining budget without changing source
tapes or communication channels. Preparing this tape is a separate computation: a machine does
not receive a polynomial-sized budget for free.
The choice interpreter must commute with mapping and interpret a constant choice as a pure result with unchanged private state. For probabilistic machines, stateless coin draws satisfy these conditions even when controller instructions discard their result. Query programs may modify shared private state.
Main definitions #
Turing.MultiTapeMachine.withClock: consume a budget stored on a fresh work tape.Turing.MultiTapeMachine.Clock.config: embed source data alongside the clock tape and head.
Main results #
Turing.MultiTapeMachine.run_interpret_runConfigFrom_withClock_add: a budget oftcells reproduces the externally clocked source in2 * t + 1instructions, with arbitrary padding.Turing.MultiTapeMachine.withClock_halted: every supported final configuration has halted.
References #
Adapted from MultiTape/Oracle/Clock.lean on the cslib crypto branch at
5ff69ca93402e7c947208dc56396d6d86203ccd8 to the common machine and typed program interface.
A phase bit and the source's optional control state.
Instances For
Leave all source tapes unchanged.
Instances For
Advance the budget head while leaving all source tapes unchanged.
Instances For
Perform one source tape action, then enter the clock-advance phase.
Instances For
Run under a unary budget on the last work tape; its construction is a separate computation.
Instances For
Unfold one controller instruction without unfolding the machine in its continuation.
The clock-advance instruction leaves the source and private interpreter state unchanged.
One available budget cell permits one source instruction and one clock advance.
A bounded simulation advances the clock head once per source instruction.
At the budget's end, halt without another source instruction or oracle call.
A prepared unary budget implements the source's external cutoff with actual halting. All source tapes, channels, and private interpreter state are retained; the source control state is discarded when the controller halts. Constant choices must have no interpreted effect.
Extra time after budget exhaustion cannot change the configuration or private state.
In particular, the output and final private state agree with the original clocked run.
Every supported final configuration is halted when the prepared budget expires.