NP is nondeterministic polynomial time #
The verifier class Cslib.Complexity.NP consists exactly of the problems decided in polynomial
time by nondeterministic machines with a binary alphabet and finitely many states
Arora and Barak, Theorem 2.6. Guessing a certificate and verifying it gives one
inclusion (Cslib.Complexity.decidableInPolyTime_of_mem_NP). This file proves the converse by
checking an encoded accepting computation.
A computation path is encoded by its choices, as coins of the fixed finite choice table
Turing.MultiTapeNTM.choiceTable: a step taking the permitted action of zero-based index j
costs j + 1 coins, at most M = Nat.card of the action type. If every computation path on
enc a with at least c * ((enc a).length + 1) ^ d steps has halted (stuck paths may be
shorter), accepting computations are encoded within M * c * ((enc a).length + 1) ^ d coins, and
padded to exactly this polynomial length, which a halted table ignores. The verifier
Turing.MultiTapeNTM.checkChoices replays the certificate with the choice table and accepts when
the table emits [true]: then the coins encode a computation path that halts with output
[true]. Every coin list selects permitted actions, except at a stuck configuration, which has
none; there the table rejects. Testing the output of a fixed finite fair-coin table replayed from
encoded coins and input is polynomial-time
(Turing.MultiTapePTM.computableInPolyTime_decide_runClosedCoins), so the verifier needs no
machine built by hand.
Main definitions #
Turing.MultiTapeNTM.checkChoices: the verifier of encoded accepting computations.
Main results #
Turing.MultiTapeNTM.computableInPolyTime_checkChoices: the verifier is polynomial-time.Turing.MultiTapeNTM.DecidesInTime.mem_iff_exists_checkChoices: accepting computations have certificates of every length at least the action count times the time bound.Turing.MultiTapeNTM.DecidesInTime.isVerifier: a machine deciding a problem withinc * ((enc a).length + 1) ^ dsteps yields a verifier with certificates of lengthM * c * ((enc a).length + 1) ^ d.Cslib.Complexity.mem_NP_of_decidableInPolyTime: the converse inclusion.Cslib.Complexity.mem_NP_iff_decidableInPolyTime:NPis nondeterministic polynomial time.
References #
The verifier of encoded accepting computations. It accepts when the certificate, read as
coins of the choice table, replays a computation path on the encoded instance that halts with
output [true].
Instances For
Checking an encoded computation is polynomial-time: it replays a fixed finite fair-coin table.
Accepting computations as certificates of any sufficient length. If ntm decides A
within t, then a ∈ A exactly when some certificate of length L encodes an accepting
computation on enc a, for every L of at least M * t a, for the number M of actions.
Accepting computations as certificates. A machine deciding A within
c * ((enc a).length + 1) ^ d steps (every computation path with at least that many steps has
halted) yields a verifier whose certificates have length exactly
M * c * ((enc a).length + 1) ^ d, for the number M of actions.
Checking accepting computations, the inclusion of nondeterministic polynomial time in
NP Arora and Barak, Theorem 2.6.
NP is nondeterministic polynomial time Arora and Barak, Theorem 2.6:
a problem has a polynomial-time verifier with certificates of polynomial length exactly when a
nondeterministic machine with a binary alphabet and finitely many states decides it in
polynomial time, relative to the same encoding of instances.