Replaying nondeterministic choices with fair coins #
A nondeterministic machine with finitely many states and a binary alphabet has finitely many
actions. Its choice table Turing.MultiTapeNTM.choiceTable is one fixed finite fair-coin table
that replays a computation path from a list of coins. At a running configuration it scans the
permitted actions in a fixed order (Turing.MultiTapeNTM.actions), one coin per candidate: the
coin true takes the current candidate, the coin false moves on, and the last candidate is
taken under either coin. A step of the nondeterministic machine choosing the candidate of
(zero-based) index j therefore costs the coins false^j true, at most Nat.card of the action
type. Every coin list thus selects permitted actions, except at a stuck configuration, which has
none; there the table rejects: it halts without output.
The table emits nothing while it simulates. It records in its finite control whether the
simulated output is empty, exactly [true] or something else
(Turing.MultiTapeNTM.ChoiceTable.OutputTrack), and when the simulated machine halts it emits
true exactly when the simulated output is [true].
So a running prefix of output [true] is never mistaken for acceptance. A halted table ignores
the remaining coins, which allows padding.
Main definitions #
Turing.MultiTapeNTM.actions: the permitted actions, in a fixed order.Turing.MultiTapeNTM.choiceTable: the fair-coin table replaying choices. Its statesTuring.MultiTapeNTM.ChoiceTable.ScanStaterecord the simulated state, the candidate index and the trackTuring.MultiTapeNTM.ChoiceTable.OutputTrackof the simulated output.
Main results #
Turing.MultiTapeNTM.accepts_of_runClosedCoins_choiceTable: a coin list on which the table emits[true]encodes an accepting computation path.Turing.MultiTapeNTM.exists_runClosedCoins_choiceTable: a computation path oftsteps ending halted with output[true]is encoded by at mostNat.card (Action k Bool State) * tcoins, followed by arbitrary padding.
Whether an emitted word is empty, exactly [true], or something else.
- empty : OutputTrack
Nothing has been emitted.
- accept : OutputTrack
Exactly
[true]has been emitted. - other : OutputTrack
Something else has been emitted.
Instances For
The track of a word.
Instances For
The track after emitting one more symbol, if any.
Instances For
The states of the choice table: the simulated state, the index of the candidate action, and the track of the simulated output.
Instances For
Take a simulated action. Its output is recorded in the track instead of being emitted; when
it halts, true is emitted exactly when the simulated output is [true].
Instances For
One instruction of the choice table: take or skip the candidate j, or reject if there is
no such candidate.
Instances For
The choice table. A fixed finite fair-coin table replaying the choices of ntm, one coin
per candidate action.
Instances For
A running instruction of the choice table applies scan.
The table starts by simulating the initial configuration.
Skipping a candidate that is not the last moves to the next candidate.
Taking a candidate, under the coin true or as the last candidate, simulates its step.
Without a candidate j, the table rejects: it halts without output.
Soundness #
The configurations reachable by replaying coins: simulating a reachable running configuration, rejected, or accepted after an accepting computation path.
Instances For
Every coin preserves replayability.
Completeness #
One step of a running configuration is replayed by at most Nat.card coins.
A run path is replayed from the simulation of its head by at most Nat.card coins per step.
Halted steps need no coins.
Soundness. A coin list on which the choice table emits [true] encodes an accepting
computation path.
Completeness. A computation path of t steps ending halted with output [true] is
encoded by at most Nat.card (Action k Bool State) * t coins, after which any padding is
ignored.