7.4 NP-Complete Polynomial-Time Reducibility What's a Polynomial-Time Computable Function? if some polynomial-time TM M, on every input w, halts with f(w) on its tape then f is polynomial-time computable function What does it mean to say language A is Polynomial-Time-Mapping-Reducible to language B? if there is a polynomial-time computable function f, where for every w, w is in A if and only if f(w) is in B then language A is polynomial-time-mapping-reducible to language B What notation is used to indicate A is polynomial-time reducible to B? If A polynomial-time reduces to B and B is in P, what do you know about A? How can you use a polynomial-time reduction to show a problem is in P? give a polynomial-time reduction TO a problem known to be in P How do you build a polynomial-time decider for A, given a polynomial-time decider for B and a polynomial-time reduction from A to B? M is polynomial-time decider for B f is polynomial-time reduction from A to B N is a polynomial-time decider for A N = "On input w: 1. Compute f(w). 2. Run M on input f(w) and output what M outputs." The Class NP-Hard What's the class NP-Hard? a language B is NP-Hard if every language A in NP is polynomial-time reducible to B If A polynomial-time reduces to B and A is NP-hard, what do you know about B? How can you use a mapping reduction to show a problem is NP-hard? give a polynomial-time reduction FROM a known NP-hard problem The Class NP-Complete What's the class NP-Complete? the hardest problems in the class NP What's a formal definition of the class NP-Complete? a language B is NP-Complete if it satisfies two conditions: 1. B is in NP 2. B is NP-Hard How do you show a problem B is NP-Complete? 1. show B is in NP 2. show some A in NP-Complete polynomial-time reduces to B The Satisfiability Problem (SAT) What's a Satisfiable Boolean Formula? Is the formula Satisfiable? (x or y) and (not y or not z) (not x) and (x or y) and (not y or x) What's the Satisfiability (SAT) Problem? SAT = { | F is a satisfiable Boolean formula } Classwork You may work with a partner. Show that SAT is in NP. The 3SAT Problem What's a Literal? a Boolean variable or a negated Boolean variable (x, not x) What's a Clause? literals connected with ORs (x or not y or z) What's Conjunctive Normal Form (CNF)? clauses connected with ANDs (not x or y) and (x or z) What's a 3CNF-Formula? all clauses have 3 literals Is the 3CNF-formula Satisfiable? (x or not y or not z) and (x or y or z) and (not x or not y or z) What's the 3SAT problem? 3SAT = { | F is a satisfiable 3CNF-formula } Is 3SAT in NP? 3SAT Reduces To CLIQUE How do you show 3SAT polynomial-time-reduces to CLIQUE? 3SAT = { | F is a satisfiable 3CNF-formula } CLIQUE = { | G is an undirected graph with a k-clique } Describe a polynomial-time reduction from 3SAT to CLIQUE. Given a 3SAT instance : F is a formula with k clauses. F = (a1 OR b1 OR c1) AND ... AND (ak OR bk OR ck) Create a CLIQUE instance : (note k is number of clauses in F) In G, make k groups of three nodes called triples. Label each node with the literal it represents. (Nodes in triples correspond to literals in clauses.) Connect every pair of nodes in G with an edge, except: Don't connect nodes in same triple. Don't connect nodes with conflicting labels. Construct the graph for the formula F. F = (not a or b or not c)(a or c or d)(not b or c or not d) How do you show the construction is polynomial-time? If the 3SAT formula has v variables and c clauses, how many nodes and edges are created in the graph? What's the correct value of k for the CLIQUE instance? If F is satisfiable, how do you conclude G has a k-clique? Since F is satisfiable, every clause of F has a true literal. Select a node in each triple corresponding to a true literal. The selected nodes form a k-clique: The number of nodes is k. Each pair of nodes is connected by an edge: The nodes are not from the same triple. The node labels don't conflict. If G has a k-clique, how do you conclude F is satisfiable? Since nodes in a triple are not connected, no two clique nodes can be in the same triple. So each triple contains one of the k-clique nodes. Make each literal corresponding to a clique-node true. None of these literals will conflict because conflicting literals are not connected by edges. Each clause has a true literal so F is satisfied. If 3SAT is NP-Hard, what do you know about CLIQUE? Classwork You may work with a partner. Describe a polynomial-time reduction from CNF-SAT to 3SAT. Given a CNF-SAT instance , create a 3SAT instance . Examples of clauses in CNF-SAT: (a) (a + b) (a + b + c) (a + b + c + d) (a + b + c + d + e) Thinking About NP-Complete If you could find a polynomial algorithm to solve one of the problems in NP-Complete, what would you have accomplished? If B is NP-Complete and B is in P, what do you know about P and NP? if B is NP-Complete and B is in P, P = NP What are the Theoretical Benefits of knowing which problems are NP-Complete? when looking at the P equals NP question research can focus on NP-Complete problems What are the Practical Benefits of knowing which problems are NP-Complete? you don't waste time looking for a polynomial-time algorithm The First NP-Complete Problem Can you use a single reduction to show a problem is NP-Complete if you don't already have a known NP-Complete problem? no, to use one reduction you need a known NP-Complete problem How do you obtain the first NP-Complete problem? How do you show every A in NP polynomial-time reduces to SAT?