CS21 Decidability and Tractability

Slides:



Advertisements
Similar presentations
Theory of Computing Lecture 18 MAS 714 Hartmut Klauck.
Advertisements

Lecture 23. Subset Sum is NPC
FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY
Lecture 21 NP-complete problems
The Theory of NP-Completeness
INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011.
CSC5160 Topics in Algorithms Tutorial 2 Introduction to NP-Complete Problems Feb Jerry Le
Complexity 11-1 Complexity Andrei Bulatov NP-Completeness.
NP-completeness Sipser 7.4 (pages 271 – 283). CS 311 Mount Holyoke College 2 The classes P and NP NP = ∪ k NTIME(n k ) P = ∪ k TIME(n k )
NP-completeness Sipser 7.4 (pages 271 – 283). CS 311 Fall The classes P and NP NP = ∪ k NTIME(n k ) P = ∪ k TIME(n k )
March 2, 2015CS21 Lecture 231 CS21 Decidability and Tractability Lecture 23 March 2, 2015.
February 23, 2015CS21 Lecture 201 CS21 Decidability and Tractability Lecture 20 February 23, 2015.
Computability and Complexity 15-1 Computability and Complexity Andrei Bulatov NP-Completeness.
Graphs 4/16/2017 8:41 PM NP-Completeness.
NP-Completeness CS 51 Summer 2008 TexPoint fonts used in EMF. Read the TexPoint manual before you delete this box.: A AA A A AAA.
Computability and Complexity 16-1 Computability and Complexity Andrei Bulatov NP-Completeness.
1 CSE 417: Algorithms and Computational Complexity Winter 2001 Lecture 23 Instructor: Paul Beame.
Last class Decision/Optimization 3-SAT  Independent-Set Independent-Set  3-SAT P, NP Cook’s Theorem NP-hard, NP-complete 3-SAT  Clique, Subset-Sum,
NP-Completeness (2) NP-Completeness Graphs 4/17/2017 6:25 AM x x x x x
1 CSE 417: Algorithms and Computational Complexity Winter 2001 Lecture 24 Instructor: Paul Beame.
CS Master – Introduction to the Theory of Computation Jan Maluszynski - HT Lecture NP-Completeness Jan Maluszynski, IDA, 2007
Clique Cover Cook’s Theorem 3SAT and Independent Set
February 25, 2015CS21 Lecture 211 CS21 Decidability and Tractability Lecture 21 February 25, 2015.
February 20, 2015CS21 Lecture 191 CS21 Decidability and Tractability Lecture 19 February 20, 2015.
Theory of Computing Lecture 19 MAS 714 Hartmut Klauck.
The Theory of NP-Completeness 1. Nondeterministic algorithms A nondeterminstic algorithm consists of phase 1: guessing phase 2: checking If the checking.
The Theory of NP-Completeness 1. What is NP-completeness? Consider the circuit satisfiability problem Difficult to answer the decision problem in polynomial.
February 18, 2015CS21 Lecture 181 CS21 Decidability and Tractability Lecture 18 February 18, 2015.
Lecture 22 More NPC problems
INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011.
Prabhas Chongstitvatana1 NP-complete proofs The circuit satisfiability proof of NP- completeness relies on a direct proof that L  p CIRCUIT-SAT for every.
CSCI 2670 Introduction to Theory of Computing November 29, 2005.
Week 10Complexity of Algorithms1 Hard Computational Problems Some computational problems are hard Despite a numerous attempts we do not know any efficient.
CSE 024: Design & Analysis of Algorithms Chapter 9: NP Completeness Sedgewick Chp:40 David Luebke’s Course Notes / University of Virginia, Computer Science.
EMIS 8373: Integer Programming NP-Complete Problems updated 21 April 2009.
CSC401 – Analysis of Algorithms Chapter 13 NP-Completeness Objectives: Introduce the definitions of P and NP problems Introduce the definitions of NP-hard.
Additional NP-complete problems
1 P P := the class of decision problems (languages) decided by a Turing machine so that for some polynomial p and all x, the machine terminates after at.
NP-Complete Problems. Running Time v.s. Input Size Concern with problems whose complexity may be described by exponential functions. Tractable problems.
CS 3343: Analysis of Algorithms Lecture 25: P and NP Some slides courtesy of Carola Wenk.
CSCI 3130: Formal languages and automata theory Andrej Bogdanov The Chinese University of Hong Kong The Cook-Levin.
CS6045: Advanced Algorithms NP Completeness. NP-Completeness Some problems are intractable: as they grow large, we are unable to solve them in reasonable.
NPC.
NP-Completeness Note. Some illustrations are taken from (KT) Kleinberg and Tardos. Algorithm Design (DPV)Dasgupta, Papadimitriou, and Vazirani. Algorithms.
Complexity ©D.Moshkovits 1 2-Satisfiability NOTE: These slides were created by Muli Safra, from OPICS/sat/)
CSCI 2670 Introduction to Theory of Computing December 2, 2004.
CSCI 2670 Introduction to Theory of Computing December 7, 2005.
CSE 421 Algorithms Richard Anderson Lecture 27 NP-Completeness Proofs.
CSC 3130: Automata theory and formal languages Andrej Bogdanov The Chinese University of Hong Kong NP-complete.
Prof. Busch - LSU1 Busch Complexity Lectures: More NP-complete Problems.
SUBSET-SUM Instance: A set of numbers denoted S and a target number t.
The NP class. NP-completeness Lecture2. The NP-class The NP class is a class that contains all the problems that can be decided by a Non-Deterministic.
1 SAT SAT: Given a Boolean function in CNF representation, is there a way to assign truth values to the variables so that the function evaluates to true?
 2005 SDU Lecture15 P,NP,NP-complete.  2005 SDU 2 The PATH problem PATH = { | G is a directed graph that has a directed path from s to t} s t
TU/e Algorithms (2IL15) – Lecture 10 1 NP-Completeness, II.
NP-Completeness (2) NP-Completeness Graphs 4/13/2018 5:22 AM x x x x x
Richard Anderson Lecture 26 NP-Completeness
NP-Completeness (2) NP-Completeness Graphs 7/23/ :02 PM x x x x
NP-Completeness (2) NP-Completeness Graphs 7/23/ :02 PM x x x x
NP-Completeness Proofs
Richard Anderson Lecture 26 NP-Completeness
(xy)(yz)(xz)(zy)
CS21 Decidability and Tractability
CS21 Decidability and Tractability
NP-Completeness (2) NP-Completeness Graphs 11/23/2018 2:12 PM x x x x
CS21 Decidability and Tractability
CS21 Decidability and Tractability
NP-Completeness Yin Tat Lee
CS21 Decidability and Tractability
NP-Completeness (2) NP-Completeness Graphs 7/9/2019 6:12 AM x x x x x
Presentation transcript:

CS21 Decidability and Tractability Lecture 22 February 27, 2015 February 27, 2015 CS21 Lecture 22

Outline the class NP the class co-NP the class NP Å coNP NP-complete problems: subset sum NP-complete problems: NAE-3-SAT, max-cut the class co-NP the class NP Å coNP February 27, 2015 CS21 Lecture 22

Subset Sum A language (decision problem): example: SUBSET-SUM = {(S = {a1, a2, a3, …, ak}, B) : there is a subset of S that sums to B} example: S = {1, 7, 28, 3, 2, 5, 9, 32, 41, 11, 8} B = 30 30 = 7 + 3 + 9 + 11. yes. February 27, 2015 CS21 Lecture 22

Subset Sum Is this problem NP-complete? in P? SUBSET-SUM = {(S = {a1, a2, a3, …, ak}, B) : there is a subset of S that sums to B} Is this problem NP-complete? in P? Problem set: in TIME(B ¢ poly(k)) February 27, 2015 CS21 Lecture 22

SUBSET-SUM is NP-complete Theorem: the following language is NP-complete: SUBSET-SUM = {(S = {a1, a2, a3, …, ak}, B) : there is a subset of S that sums to B} Proof: Part 1: SUBSET-SUM  NP. Proof? Part 2: SUBSET-SUM is NP-hard. reduce from? our reduction had better produce super-polynomially large B (unless we want to prove P=NP) February 27, 2015 CS21 Lecture 22

SUBSET-SUM is NP-complete We are reducing from the language: 3SAT = { φ : φ is a 3-CNF formula that has a satisfying assignment } to the language: SUBSET-SUM = {(S = {a1, a2, a3, …, ak}, B) : there is a subset of S that sums to B} February 27, 2015 CS21 Lecture 22

SUBSET-SUM is NP-complete φ = (x1 x2x3)  (x1x4x3)  …  (…) Need integers to play the role of truth assignments For each variable xi include two integers in our set S: xiTRUE and xiFALSE set B so that exactly one must be in sum February 27, 2015 CS21 Lecture 22

SUBSET-SUM is NP-complete every choice of one from each (xiTRUE,xiFALSE) pair sums to B every subset that sums to B must choose one from each (xiTRUE,xiFALSE) pair x1TRUE = 1 0 0 0 … 0 x1FALSE = 1 0 0 0 … 0 x2TRUE = 0 1 0 0 … 0 x2FALSE = 0 1 0 0 … 0 … xmTRUE = 0 0 0 0 … 1 xmFALSE = 0 0 0 0 … 1 B = 1 1 1 1 … 1 February 27, 2015 CS21 Lecture 22

SUBSET-SUM is NP-complete φ = (x1 x2x3)  (x1x4x3)  …  (…) Need to force subset to “choose” at least one true literal from each clause Idea: add more digits one digit for each clause set B to force each clause to be satisfied. February 27, 2015 CS21 Lecture 22

SUBSET-SUM is NP-complete φ = (x1 x2x3)  (x1x4x3)  …  (…) x1TRUE = 1 0 0 0 … 0 1 x1FALSE = 1 0 0 0 … 0 0 x2TRUE = 0 1 0 0 … 0 1 x2FALSE = 0 1 0 0 … 0 0 x3TRUE = 0 0 1 0 … 0 0 x3FALSE = 0 0 1 0 … 0 1 … : B = 1 1 1 1 … 1 ? ? ? ? clause 1 … clause 2 clause 3 : clause k … February 27, 2015 CS21 Lecture 22

SUBSET-SUM is NP-complete if clause i is satisfied sum might be 1, 2, or 3 in corresponding column. want ? to “mean”  1 solution: set ? = 3 add two “filler” elements for each clause i: FILL1i = 0 0 0 0 ... 0 0 ... 0 1 0 ... 0 FILL2i = 0 0 0 0 ... 0 0 ... 0 1 0 ... 0 column for clause i February 27, 2015 CS21 Lecture 22

SUBSET-SUM is NP-complete Reduction: m variables, k clauses for each variable xi: xiTRUE has ones in positions k + i and {j : clause j includes literal xi} xiFALSE has ones in positions k + i and {j : clause j includes literal xi} for each clause i: FILL1i and FILL2i have one in position i bound B has 3 in positions 1…k and 1 in positions k+1…k+m February 27, 2015 CS21 Lecture 22

SUBSET-SUM is NP-complete Reduction computable in poly-time? YES maps to YES? choose one from each (xiTRUE,xiFALSE) pair corresponding to a satisfying assignment choose 0, 1, or 2 of filler elements for each clause i depending on whether it has 3, 2, or 1 true literals first m digits add to 1; last k digits add to 3 February 27, 2015 CS21 Lecture 22

SUBSET-SUM is NP-complete NO maps to NO? at most 5 ones in each column, so no carries to worry about first m digits of B force subset to choose exactly one from each (xiTRUE,xiFALSE) pair last k digits of B require at least one true literal per clause, since can only sum to 2 using filler elements resulting assignment must satisfy φ February 27, 2015 CS21 Lecture 22

(x1 x2x3)  (x1x4x3)  …  (…) Not-All-Equal 3SAT (x1 x2x3)  (x1x4x3)  …  (…) Theorem: the following language is NP-complete: NAE3SAT = {φ : φ is a 3-CNF formula for which there exists a truth assignment in which every clause has at least 1 true literal and at least 1 false literal} Proof: Part 1: NAE3SAT  NP. Proof? Part 2: NAE3SAT is NP-hard. Reduce from? February 27, 2015 CS21 Lecture 22

NAE3SAT is NP-complete We are reducing from the language: CIRCUIT-SAT = {C : C is a Boolean circuit for which there exists a satisfying truth assignment} to the language: NAE3SAT = {φ : φ is a 3-CNF formula for which there exists a truth assignment in which every clause has at least 1 true literal and at least 1 false literal} February 27, 2015 CS21 Lecture 22

NAE3SAT is NP-complete Recall reduction to 3SAT variables x1, x2, …,xn, gates g1, g2, …, gm produce clauses: not all true in a satisfying assignment not all true in a satisfying assignment  (z1  gi) (z2  gi) (gi  z1  z2) gi  gi (gi  z) (z  gi) z1 z2 z  (gi  z1) (gi  z2) (z1  z2  gi) gi output gate gm: (gm) z1 z2 February 27, 2015 CS21 Lecture 22

NAE3SAT is NP-complete modified reduction to NAE3SAT variables x1, x2, …,xn, gates g1, g2, …, gm produce clauses:  (z1  gi  w) (z2  gi  w) (gi  z1  z2) gi  gi (gi  z  w) (z  gi  w) z1 z2 z  (gi  z1  w) (gi  z2  w) (z1  z2  gi) gi output gate gm: (gm  w) z1 z2 February 27, 2015 CS21 Lecture 22

NAE3SAT is NP-complete Does the reduction run in polynomial time? YES maps to YES already know how to get a satisfying assignment to the BLUE variables set w = FALSE (z1  gi  w) (z2  gi  w) (gi  z1  z2) (gi  z1  w) (gi  z2  w) (z1  z2  gi) (gi  z  w) (z  gi  w) (gm  w) February 27, 2015 CS21 Lecture 22

NAE3SAT is NP-complete NO maps to NO given NAE assignment A complement A’ is a NAE assignment A or A’ has w = FALSE must have TRUE BLUE variable in every clause we know this implies C satisfiable (z1  gi  w) (z2  gi  w) (gi  z1  z2) (gi  z1  w) (gi  z2  w) (z1  z2  gi) (gi  z  w) (z  gi  w) (gm  w) February 27, 2015 CS21 Lecture 22

find cut maximizing number of edges crossing the cut MAX CUT Given graph G = (V, E) a cut is a subset S  V an edge (x, y) crosses the cut if x  S and y  V – S or x  V – S and y  S search problem: find cut maximizing number of edges crossing the cut February 27, 2015 CS21 Lecture 22

find cut maximizing number of edges crossing the cut MAX CUT Given graph G = (V, E) a cut is a subset S  V an edge (x, y) crosses the cut if x  S and y  V – S or x  V – S and y  S search problem: find cut maximizing number of edges crossing the cut February 27, 2015 CS21 Lecture 22

MAX CUT Theorem: the following language is NP-complete: Proof: MAX CUT = {(G = (V, E), k) : there is a cut S  V with at least k edges crossing it} Proof: Part 1: MAX CUT  NP. Proof? Part 2: MAX CUT is NP-hard. reduce from? February 27, 2015 CS21 Lecture 22

MAX CUT is NP-complete We are reducing from the language: NAE3SAT = {φ : φ is a 3-CNF formula for which there exists a truth assignment in which every clause has at least 1 true literal and at least 1 false literal} to the language: MAX CUT = {(G = (V, E), k) : there is a cut S  V with at least k edges crossing it} February 27, 2015 CS21 Lecture 22

(x1 x2x3)  (x1x4 x5)  …  (x2x3 x3 ) MAX CUT is NP-complete The reduction: given instance of NAE3SAT (n nodes, m clauses): (x1 x2x3)  (x1x4 x5)  …  (x2x3 x3 ) produce graph G = (V, E) with node for each literal x3 x4 x4 triangle for each 3-clause parallel edges for each 2-clause x2 x1 x5 x1 x2 x5 x3 February 27, 2015 CS21 Lecture 22

(repeat variable in 2-clause to make 3-clause for this calculation) MAX CUT is NP-complete x3 x4 x4 triangle for each 3-clause parallel edges for each 2-clause x2 x1 x5 x1 x2 x5 x3 if cut selects TRUE literals, each clause contributes 2 if NAE, and < 2 otherwise need to penalize cuts that correspond to inconsistent truth assignments add ni parallel edges from xi to xi (ni = # occurrences) (repeat variable in 2-clause to make 3-clause for this calculation) February 27, 2015 CS21 Lecture 22

MAX CUT is NP-complete YES maps to YES triangle for each 3-clause parallel edges for each 2-clause ni parallel edges from xi to xi set k = 5m x3 x4 x4 x2 x1 x5 x1 x2 x5 x3 YES maps to YES take cut to be TRUE literals in a NAE truth assignment contribution from clause gadgets: 2m contribution from (xi, xi) parallel edges: 3m February 27, 2015 CS21 Lecture 22

MAX CUT is NP-complete NO maps to NO triangle for each 3-clause parallel edges for each 2-clause ni parallel edges from xi to xi set k = 5m x4 x2 x1 x5 x1 x2 x3 x5 NO maps to NO Claim: if cut has xi, xi on same side, then can move one to opposite side without decreasing # edges crossing cut contribution from (xi, xi) parallel edges: 3m contribution from clause gadgets must be 2m conclude: there is a NAE assignment February 27, 2015 CS21 Lecture 22

MAX CUT is NP-complete Claim: if cut has xi, xi on same side, then can move one to opposite side without decreasing # edges crossing cut Proof: xi a + ni a edges ... xi xi ni edges a+b ≤ 2ni xi ... b + ni xi ... b edges a + ni ≥ a + b or b + ni ≥ a + b xi February 27, 2015 CS21 Lecture 22

coNP Is NP closed under complement? Can we transform this machine: x  L Can we transform this machine: x  L x  L x  L qaccept qreject into this machine? qaccept qreject February 27, 2015 CS21 Lecture 22

coNP language L is in coNP iff its complement (co-L) is in NP it is believed that NP ≠ coNP note: P = NP implies NP = coNP proving NP ≠ coNP would prove P ≠ NP another major open problem… February 27, 2015 CS21 Lecture 22

UNSAT = {φ : φ is an unsatisfiable 3-CNF formula} coNP canonical coNP-complete language: UNSAT = {φ : φ is an unsatisfiable 3-CNF formula} proof? February 27, 2015 CS21 Lecture 22