160 likes | 181 Views
Explore NP-completeness & formal languages theory at The Chinese University of Hong Kong Fall 2008 course CSC 3130 by Andrej Bogdanov. Understand P vs. NP, NP languages, their verification, and polynomial-time reductions. Dive deep into problems like CLIQUE, SAT, IS, VC and their equivalence. Discover the importance of polynomial-time algorithms and reductions in solving complex computational challenges. Gain insights on the Cook-Levin theorem and the implications for NP complexity classes.
E N D
Fall 2008 The Chinese University of Hong Kong CSC 3130: Automata theory and formal languages NP-completeness Andrej Bogdanov http://www.cse.cuhk.edu.hk/~andrejb/csc3130
P and NP P = languages that can be decided on a TM with polynomial running time (problems that admit efficient algorithms) languages decidable on a nondeterministic TM with polynomial running time NP = (solutions can be checked efficiently) decidable We believe that NP is bigger than P, but we are not 100% sure NP P
Evidence that NP is bigger than P • These (and many others) are in NP • Their solutions, once found, are easy to verify • But no efficient algorithms are known for any of them • The fastest known algorithms take time ≈2n CLIQUE = {(G, k): G is a graph with a clique of k vertices} IS = {(G, k): G is a graph with an independent set of k vertices} VC = {(G, k): G is a graph with a vertex cover of k vertices} SAT = {f: f is a satisfiable Boolean formula}
Equivalence of certain NP languages • We strongly suspect that problems like CLIQUE, SAT, etc. require time ≈2n to solve • We do not know how to prove this, but what we can prove is that If any one of them is tractable (by a polynomial- time algorithm), then all of them are tractable
Equivalence of certain NP languages • All these problems are as hard as one another • Moreover, they are at the “frontier” of NP • They are at least as hard as any problem in NP NP clique independent set vertex-cover P satisfiability
Polynomial-time reductions • What do we mean when we say, for example, • We mean that • Or, we can convert an imaginary poly-time algorithm for IS into one for CLIQUE “CLIQUE is at least as hard as IS” If CLIQUE has a polynomial-time algorithm, so does IS
Polynomial-time reductions • Theorem CLIQUE = {(G, k): G is a graph with a clique of k vertices} IS = {(G, k): G is a graph with an independent set of k vertices} 2 1 If CLIQUE has a polynomial-time algorithm, so does IS 4 3 {1, 4}, {2, 3, 4}, {1} are cliques {1, 2}, {1, 3}, {4} are independent sets
Polynomial-time reductions • Proof: Suppose CLIQUE has an algorithm A • We want to use it to solve IS If CLIQUE has a polynomial-time algorithm, so does IS A accept ifG has IS of size k G’, k’ G, k reject if not accept ifG’ has clique of size k reject if not
Reducing IS to CLIQUE • We look for a polynomial-time transformation s.t.: If G’ has a clique of size k’, then G has an IS of size k R G, k G’, k’ If G’ does not have a clique of size k’, then G has no IS of size k 2 2 1 1 flip all edges G G’ 4 4 3 3 set k’ = k ISs of size k cliques of size k’
Reducing IS to CLIQUE On input (G, k) Construct G’ by flipping all edges of G Set k’ = k Output (G’, k’) R G, k G’, k’ independent sets in G cliques in G’ If G’ has a clique of size k’, then G has an IS of size k ✓ If G’ does not have a clique of size k’, then G has no IS of size k ✓
Reduction recap • We showed thatby converting an imaginary algorithm for CLIQUE into one for IS • To do this, we came up with a reduction that transforms instances of IS into ones for CLIQUE If CLIQUE has a polynomial-time algorithm, so does IS
Polynomial-time reductions • Language Lpolynomial-time reduces to L’ if there exists a polynomial-time computable map R that takes an instance x of L into instance y of L’ s.t. x ∈ L if and only if y ∈ L’ L (IS) L’ (CLIQUE) R (G, k) x y (G’, k’) x ∈ L y ∈ L’ (G has IS of size k) (G’ has clique of size k’)
Meaning of poly-time reductions • Saying L reduces to L’ means L is easier than L’ • In other words, if we can solve L’, then we can also solve L • Theorem • Proof If Lreduces toL’and L’∈P, then L∈P acc R algorithm for L’ x y rej x ∈ L y ∈ L’ algorithm accepts
Notes about reductions • The direction of the reduction is very important • This makes sense, because “A is easier than B” and “B is easier than A” mean different things • However, it is possible that L reduces to L’ and L’ reduces to L • This means that L and L’ are as hard as one another • For example, IS and CLIQUE reduce to one another
The Cook-Levin Theorem • So every problem in NP is easier than SAT • But SAT itself is in NP, so SAT must be the “hardest problem” in NP: Every L∈NP reduces to SAT SAT = {f: f is a satisfiable Boolean formula} If SAT∈P, then P = NP
Interpretation of Cook-Levin Theorem • Optimistic view: • Pessimistic view: If we manage to solve SAT, then wecan also solve CLIQUE, scheduling, and almost anything Since we do not believe P = NP, it is unlikely that we will ever have a fast algorithm for SAT