Composing closed probabilistic machines through a buffered word #
The first machine writes to a fresh buffer. A deterministic handoff rewinds the buffer and marks its left boundary. The second machine then reads this word as its input, starting with separate blank work tapes. Preparation costs the intermediate word length plus four transitions.
Main definitions #
Turing.MultiTapePTM.comp: feed one closed machine's output to another.
Main results #
Turing.MultiTapePTM.eval_comp: the compiled output distribution is monadic composition.
References #
Adapted from MultiTape/Oracle/Composition.lean on the cslib crypto branch at
5ff69ca93402e7c947208dc56396d6d86203ccd8, using the common machine compilers. As for upstream
deterministic composition, second.comp first mark executes first and then second.
The shared output-buffer compiler, specialized to fair-coin machines.
Instances For
The shared virtual-input compiler, specialized to fair-coin machines.
Instances For
Rewind and mark the intermediate word before starting the continuation.
Instances For
Buffering the source preserves its complete configuration program.
The consumer preserves the continuation's complete configuration program.
Virtual-input redirection preserves a halting bound.
Once preparation and execution have been paid for, the continuation has its source law.
The handoff and continuation actually halt within the combined bound.
A supported final configuration supplies a supported output word.
Feed first's output to second, with separate work tapes and a charged input handoff.
Instances For
Composition preserves the full configuration distribution and charges the intermediate word.
The first phase takes firstTime, preparation at most firstTime + 4, and the second phase
secondTime. Both source bounds concern actual halting, including random stopping times.
At the output level, the compiled machine realizes ordinary monadic composition.
Every supported execution of the composed machine has halted within the combined bound.