Nondeterministic TM subroutines #
Small NTM building blocks used by NP constructions.
The main definition in this file is NTM.guessBoundedNTM: given a witness
tape and a preloaded unary counter tape, nondeterministically write a witness
whose length is at most the number of counter marks. The counter gives the
guess phase a structural all-paths halting bound, which is essential for
NTIME.
A witness tape while it is being guessed: cells 1..|bits| contain the
guessed bits, the head is at the next cell, and the remaining tail is
blank.
Equations
- One or more equations did not get rendered due to their size.
Instances For
A completed witness tape whose encoded string has length at most B.
Equations
- t.HasBoundedBinaryString B = ∃ (bits : List Bool), bits.length ≤ B ∧ t.HasBinaryString bits
Instances For
A completed witness tape encodes exactly bits as its output string.
A completed binary witness tape with the left marker at cell 0 is
exactly the standard initialized tape for those bits, moved to cell 1.
Bounded completed witness tapes expose exact initialized tape shape for some string whose length satisfies the same bound.
A freshly initialized empty tape, moved right past ▷, is an empty
binary prefix.
Writing the next guessed bit extends a binary prefix by one cell.
Writing the next guessed bit preserves the left-end marker cell.
Rewinding a binary prefix to cell 1 yields a completed witness string.
Control states for guessBoundedNTM.
choose: decide nondeterministically whether to stop or continue.write: write the next guessed bit and consume one counter mark.rewind: rewind the witness tape to cell 1.done: halt.
- choose : GuessBoundedPhase
- write : GuessBoundedPhase
- rewind : GuessBoundedPhase
- done : GuessBoundedPhase
Instances For
GuessBoundedPhase has exactly the four listed control states.
Equations
- One or more equations did not get rendered due to their size.
A bounded nondeterministic witness-guessing subroutine.
The machine uses two work tapes:
witnessIdx: receives the guessed witness bits.counterIdx: is assumed to contain a unary counter. Each guessed bit consumes one counter mark by blanking the current counter cell and moving the counter head right.
At each choose state, choice false stops early; choice true continues
if the counter is not blank. When the counter is blank, the machine must stop.
It then rewinds the witness tape to cell 1 and halts.
Equations
- One or more equations did not get rendered due to their size.
Instances For
One step of guessBoundedNTM leaves the input tape unchanged, provided
the input head is not on the ▷ marker.
Any run of guessBoundedNTM leaves the input tape unchanged, provided
the input head is not on the ▷ marker.
One step of guessBoundedNTM leaves the output tape unchanged, provided
the output head is not on the ▷ marker.
Any run of guessBoundedNTM leaves the output tape unchanged, provided
the output head is not on the ▷ marker.
One step of guessBoundedNTM leaves any work tape other than the witness
and counter tapes unchanged, provided its head is not on ▷.
Any run of guessBoundedNTM leaves any work tape other than the witness
and counter tapes unchanged, provided its head is not on ▷.
In the choose state with a blank counter, one step moves to rewind
regardless of the nondeterministic choice.
In the choose state with a non-blank counter, choosing false stops the
guess phase by moving to rewind.
In the choose state with a non-blank counter, choosing true continues
the guess phase by moving to write.
A continuing choose-step preserves the counter tape while moving to the
write state.
A continuing choose-step preserves the current witness prefix while moving
to the write state.
A continuing choose-step preserves the witness tape's left-end marker.
If the guess phase stops by choice, the choose-step preserves the witness prefix while entering rewind.
If the guess phase stops by choice, the choose-step preserves the witness tape's left-end marker.
If the counter is empty, the choose-step is forced into rewind and preserves the witness prefix.
If the counter is empty, the choose-step preserves the witness tape's left-end marker.
In the write state with a blank counter, one step moves to rewind
without writing a bit.
In the write state with a non-blank counter, one step writes a bit and
returns to the choose state.
In the writing state, if the counter tape has remaining unary marks, one NTM step consumes exactly one mark from the counter.
In the writing state, the witness tape receives the chosen bit and advances to the next blank cell.
In the writing state, writing a bit preserves the witness tape's left-end marker.
The normal two-step continue/write sequence consumes one counter mark. This is the induction step used by bounded guessing proofs.
The normal two-step continue/write sequence returns to the choose state.
The normal two-step continue/write sequence appends the chosen bit to the witness tape.
The normal two-step continue/write sequence preserves the witness tape's left-end marker.
Bundled invariant update for one successful continue/write iteration.
In the rewind state with the witness head on ▷, one step halts by
moving to done.
In the rewind state with the witness head not on ▷, one step stays in
the rewind state.
From the rewind state with a binary prefix on the witness tape, the
machine halts within bits.length + 2 steps with a completed witness
string and the left-end marker intact.
If the counter is already blank in the choose state, the guess phase is forced to stop and then rewind the current witness prefix.
If the first choice from choose is false, the guess phase stops early
and rewinds the current witness prefix.
A simple all-path bound for the bounded guessing loop.
From a prefix of length prefixLen and remaining available counter marks,
the worst case guesses every remaining bit, takes two steps per bit, then
rewinds the final witness string.
Equations
- Complexity.NTM.guessBoundedTime remaining prefixLen = 3 * remaining + prefixLen + 3
Instances For
From any choose configuration with a completed unary counter and a
binary prefix on the witness tape, every path halts within guessBoundedTime
and leaves a completed witness string no longer than the prefix plus the
counter bound.
Hoare-style all-path specification for guessBoundedNTM, starting from an
empty binary prefix and a unary counter of length B.
Stronger Hoare-style specification for guessBoundedNTM that retains the
left-end marker fact needed by later tape consumers.
Hoare-style all-path specification for guessBoundedNTM with the
completed witness tape in exact initialized-tape form.
Framed exact-tape Hoare specification for guessBoundedNTM: besides
producing an exact initialized witness tape, the real input, output, and
every non-witness/non-counter work tape whose head is already past ▷
are preserved unchanged.
Completeness of the bounded guess phase: any suffix within the unary counter bound can be produced by some nondeterministic path.
Exact-tape form of guessBoundedNTM_choose_generates_witness, convenient
for feeding a chosen witness directly into pair construction.