The Class NP
Nabil Mustafa Computability and Complexity
Nabil Mustafa The Class NPChecking solutions efficiently
The class P : set of languages Lf decidable in time O(nc). Function f can be computed in poly-time. What if don’t know how to compute f in poly-time? 3-CNF satisfiability. Not known how to find an assignment. Instead, settle for languages with efficiently verifiable solutions. Define a new class NP : A function f is in NP if There exists a poly-sized solution of f – say u Verify in polynomial time that u is a correct solution for f
Nabil Mustafa The Class NPDefining NP
NP A language L is in NP if for any x ∈ {0, 1}∗, x ∈ L ⇐ ⇒ ∃u ∈ {0, 1}p(|x|) s.t. M(x, u) = 1 where M is a poly-time TM and p(|x|) is a polynomial. u called a certificate for x Note that the implication goes both ways.
Nabil Mustafa The Class NPExamples of Problem in NP
INDSET : Given a graph G and a integer k, decide if G has an independent set (I.S.) of size k. Language L is in NP if for any x ∈ L, x ∈ L ⇐ ⇒ ∃u ∈ {0, 1}p(|x|) s.t. M(x, u) = 1 Language L: set of all graphs with independent set of size k Input x: graph G and integer k Certificate u: V ′ ⊆ V , |V ′| = k, and V ′ is an I.S. p(|x|): binary labels of k vertices, of total size k log n. M(x, u): TM M which verifies in polynomial time if u = V ′ is an independent set of size k
Nabil Mustafa The Class NP