Parsimonious binary guessing #
One fixed machine scans its input, choosing and emitting one bit per symbol, then takes a singleton halting instruction. Its occurrence-labelled terminal traces are in bijection with Boolean words of the input length. The final instruction makes no discarded binary choice.
Main definitions #
Turing.MultiTapeCTM.guessMachine: the zero-work-tape binary scanner.Turing.MultiTapeCTM.GuessMachine.trace: the unique occurrence trace for a witness.
Main results #
Turing.MultiTapeCTM.GuessMachine.haltsWithin: every branch halts inn + 1steps.Turing.MultiTapeCTM.GuessMachine.runBranch_halted_iff: exact terminal trace and output.Turing.MultiTapeCTM.GuessMachine.trace_bijOn: one terminal branch per length-nword.Turing.MultiTapeCTM.GuessMachine.branchCount_eq: preserve every output-predicate count.Turing.MultiTapeCTM.GuessMachine.count_interpret_output: the shared FreeM/List program generates each length-nword once.
The scanner is used by the parsimonious guess/verify construction in MultiTape.Counting.Verifier
and the #P characterization in Classes.SharpP.Characterization. Balanced signed routing in
Classes.SharpP.GapMachine gives the reverse GapP construction and characterization.
References #
The witness-guessing construction is standard in counting complexity [Val79b]. The scanner
and its configuration invariant adapt MultiTape.Probabilistic.Sampling, credited there to the
cslib crypto branch at 5ff69ca93402e7c947208dc56396d6d86203ccd8. Here the List choice interface
and the singleton halt preserve exact branch multiplicity, rather than only the output law.
The final instruction emits nothing and halts without moving the input head.
Instances For
Emit one independently chosen bit per input symbol, then take a single halting occurrence.
Instances For
Every scanner local view has two bit occurrences or one final halt occurrence.
Every branch halts in n + 1 transitions, with a nonempty choice list at every live node.
Every terminal branch has exactly one instruction per input symbol and one final halt.
The same bijection, enumerated by the existing fixed-width bit-string type.
There are exactly 2 ^ n terminal branches, including one when the input is empty.
Counting any output predicate is exactly counting witnesses satisfying that predicate.
List interpretation of the shared program returns each word once, in scanner enumeration order. The existing bit-string enumeration can use a different order, so the result is a permutation.
The shared FreeM program generates each word of the input length with multiplicity one.