170 likes | 328 Views
Computability. Examples. Reducibility. NP completeness. Homework: Find other examples of NP complete problems. Homework. Realprime proof? Other problems?. Reprise on P, verifiers & NP. P is the set of problems that can be decided in polynomial time. NP defined in two ways:
E N D
Computability Examples. Reducibility. NP completeness. Homework: Find other examples of NP complete problems
Homework • Realprime proof? • Other problems?
Reprise on P, verifiers & NP • P is the set of problems that can be decided in polynomial time. • NP defined in two ways: • Problems defined by a procedure, possibly non-deterministic (think of guessing among a finite set of choices) in which the guesses that work only take up polynomial time. • Problem in which there is a way to verify the answer, given some extra information, with the verification taking only polynomial time.
Recall: COMPOSITES • COMPOSITES= {x|x = p*q, where p,q>1} • Problem is factoring. Does x have a non-trivial factorization? Is x prime? • Problem is HARD, meaning no polynomial time algorithm has been found BUT • Verifying is easy! If we are given the factoring, we can check it.
Clique • Graph problem: Consider graphs (vertices, simple edges) • A k-clique is a subgraph with k vertices, in which each vertex is connected to every other vertex in the subgraph. • Problem is: Does graph G contain a k-clique? CLIQUE is in NP • Using nondeterminism, keep guessing subgraphs and check each one. • If you have a candidate, check it out. The candidate serves as the information for the verifier.
Satisfiability SAT • Consider Boolean formulas: variables and & and | and NOT operators, along with parentheses. • A Boolean formula is satisfiable if some assignments of TRUE (1) and FALSE (0) makes the formula evaluate to TRUE.
Examples • Find assignment of x, y and z for which the formula is true • (NOTx & y) | (x | NOTz) • (x|y) & (x|NOTy) & (NOTx|y) & (NOTx|NOTy)
SAT • SAT = {formula f | f is satisfiable} • SAT is NP • Can be verified using the information of the assignment of variables
Cook-Levin theorem • SAT is in P if and only if P = NP • Informally, if there is a polynomial algorithm for determining if any particular formula has an assignment that is TRUE, then there is a polynomial algorithm for ALL the problems that are NP. The other direction is automatic: if NP = P, then there is a polynomial algorithm for SAT.
Reducibility • Consider two problems, A and B. • A is reducible to B if there exist a polynomial-time function that translates a problem in A to one in B. • If A can be reduced to B and B can be solved in polynomial time, then so can A.
Aside • The general principle of reducibility • turning one problem into another problem • Is a good technique. • NOT always the most efficient. You may be turning a simpler problem into a more complex problem. • Be aware of adage: if the only tool you have is a hammer, everything looks like a nail.
NP-Complete • A problem (language) B is NP-complete if • B is in NP and • every problem A in NP is polynomial reducible to B.
SAT is NP complete This is equivalent to proving Cook-Levin. • Go back to Turing Machines • Consider a language A for which there is a non-deterministic TM that decides if a string w is in A. • The reduction of A to SAT is to show a method that takes each w and constructs a Boolean formula f that simulates TM acting on w. Show method is polynomial. • w is in A if and only if f is satisfiable.
How to prove anything NP-complete???? • Accept that SAT is NP-complete • For any problem B, show SAT is reducible to B.
NP complete problems • Known set • Added to all the time. • If there is a polynomial solution to any of them, there is a polynomial solution to all of them.
NP complete problems • CLIQUE • HAMPATH • 3SAT • Formulas restricted to special format • literals (single variables or negated single variable) • Conjunctive normal form: clauses connected by ANDs • 3cnf formula is one in CNF in which each clause has exactly 3 literals.
Homework • Find other NP-complete problems!!! • Do it. • Come prepared to explain problem to class.