Buffering an effectful machine's output #
The output is redirected to a fresh last work tape, whose head remains at the write frontier. The real output stays empty. All choices and oracle interactions are preserved as a typed program, so this construction also retains state shared by coin and query interpreters.
The configuration map reuses upstream's outCfg. No budget or already computed output is
supplied to the machine: an initially blank buffer is filled one source instruction at a time.
Main definitions #
Turing.MultiTapeMachine.outputToTape: buffer the source output without adding instructions.Turing.MultiTapeMachine.OutputToTape.config: retain source data and communication channels.
Main results #
Turing.MultiTapeMachine.runConfigFrom_outputToTape: preserve the whole clocked program.Turing.MultiTapeMachine.toTM_outputToTape: agree exactly with upstream's deterministic compiler.
References #
Adapted from MultiTape/Oracle/OutputToTape.lean on the cslib crypto branch at
5ff69ca93402e7c947208dc56396d6d86203ccd8, using the common machine and upstream output redirection
by Christian Reitwiessner and Samuel Schlesinger.
Redirect an emitted symbol to the fresh work tape and advance its write frontier.
Instances For
A source output write appends exactly one cell at the buffer's write frontier.
Buffer output on a fresh work tape, retaining the source's oracle interactions.
Instances For
Unfold a single redirected transition without unfolding its machine in continuations.
Output buffering preserves the complete program, including the source's communication state.
Output buffering starts with a blank work tape, without a precomputed output word.
Effect-free deterministic output redirection is exactly upstream's compiler.