Counter-building TM subroutines #
Deterministic helper machines for materializing unary counters on work tapes.
The SAT-specific NP construction only needs a linear witness bound:
assignment.length ≤ input.length + 1. This file defines a small machine
that writes exactly |input| + 1 unary marks to a designated counter tape.
A counter tape while it is being built: cells 1..used contain unary
marks, the head is at cell used + 1, and the tail from that cell onward
is blank.
Equations
Instances For
An empty tape moved one cell right has the empty unary prefix: the head is
at cell 1 and every cell after ▷ is blank.
Writing one mark at the current head and moving right extends a unary prefix by one cell.
Writing the next unary mark preserves the left-end marker cell.
A unary prefix never contains ▷ after the left-end marker.
A unary counter tape positioned at its first data cell.
HasUnaryCounter t B means cells 1..B contain 1, cell B+1 is blank,
and the head is at cell 1.
Equations
- t.HasUnaryCounter B = (t.head = 1 ∧ (∀ i < B, t.cells (i + 1) = Complexity.Γ.one) ∧ t.cells (B + 1) = Complexity.Γ.blank)
Instances For
Rewinding a built unary prefix to cell 1 yields the public counter shape.
A tape holding a zero-length unary counter reads blank at its head.
A tape holding a positive-length unary counter reads 1 at its head.
Counter shape after used marks have already been consumed. The head is
at the next unconsumed counter cell, previous cells are blanked, remaining
marks are 1, and the first cell after the total bound is blank.
Equations
- One or more equations did not get rendered due to their size.
Instances For
A fresh unary counter is exactly a counter remainder with zero marks consumed.
Once all counter marks are consumed, the head reads blank.
While counter marks remain unconsumed, the head reads 1.
Blanking the current counter mark and moving right advances the unary counter remainder by one.
Writing back the currently read non-start symbol and idling preserves a tape. This is the basic preservation fact for non-active tapes in the counter and guessing machines.
Control states for inputLengthPlusOneCounterTM.
- scan : LinearCounterPhase
- rewind : LinearCounterPhase
- done : LinearCounterPhase
Instances For
LinearCounterPhase has exactly the three states scan, rewind,
done.
Equations
- One or more equations did not get rendered due to their size.
Write a unary counter of length |input| + 1 to counterIdx.
Starting with the input head on ▷ and an empty counter tape, the scan
phase skips the input start cell, writes one counter mark per input bit,
then writes one extra mark when the input head reaches blank. The rewind
phase rewinds the counter tape to cell 1 and halts.
The machine does not try to restore the input head; later composition layers can rewind or retarget input as needed.
Equations
- One or more equations did not get rendered due to their size.
Instances For
In the scan phase, reading ▷ on the input keeps the machine in
scan.
The start-skip step positions an initially empty counter tape at cell 1, giving the zero-length unary-prefix invariant.
In the scan phase, reading blank on the input moves the machine to the
rewind phase.
In the scan phase, reading an input bit (neither ▷ nor blank) keeps
the machine in scan.
Scanning an input bit writes one unary mark and advances the counter prefix by one.
Scanning the input blank writes the final extra unary mark and enters the rewind phase.
In the rewind phase, reading ▷ on the counter tape moves the machine
to done.
In the rewind phase, a counter-tape read other than ▷ keeps the
machine in rewind.
One NTM trace step of the lifted counter machine leaves a non-counter work tape unchanged when that tape is the started blank tape.
One NTM trace step of the lifted counter machine (in a non-halted state)
moves a fresh blank non-counter work tape past its ▷ marker, turning it
into the started blank tape.
One NTM trace step of the lifted counter machine leaves a started blank output tape unchanged.
One NTM trace step of the lifted counter machine (in a non-halted state)
moves a fresh blank output tape past its ▷ marker, turning it into the
started blank tape.
A convenient linear upper bound for inputLengthPlusOneCounterTM.
Equations
- Complexity.TM.inputLengthPlusOneCounterTime xLen = 3 * xLen + 10
Instances For
inputLengthPlusOneCounterTM materializes a unary counter of length
|x| + 1 on the designated work tape and rewinds it to cell 1.
Started-tape variant of inputLengthPlusOneCounterTM_hoareTime: if the
input is already positioned at cell 1 and the counter tape is the started
blank tape, the machine still builds a unary counter of length |x| + 1.
The postcondition also exposes the structural fact that the resulting counter
tape has no ▷ markers beyond cell 0.
Started-tape variant of the unary counter builder that also records the final input position. The input cells are unchanged, and the input head ends at the first blank after the scanned Boolean string.
Started-tape variant of the unary counter builder that also records the final input position and preserves one passive started Boolean work tape exactly.
Nondeterministic form of inputLengthPlusOneCounterTM_hoareTime, for use
inside NTM constructions after lifting the deterministic setup machine.