FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY 15-453.

Slides:



Advertisements
Similar presentations
NP-Hard Nattee Niparnan.
Advertisements

Theory of Computing Lecture 18 MAS 714 Hartmut Klauck.
Polynomial-time reductions We have seen several reductions:
1 NP-completeness Lecture 2: Jan P The class of problems that can be solved in polynomial time. e.g. gcd, shortest path, prime, etc. There are many.
NP-Completeness: Reductions
The class NP Section 7.3 Giorgi Japaridze Theory of Computability.
Department of Computer Science & Engineering
NP-Completeness Lecture for CS 302. Traveling Salesperson Problem You have to visit n cities You want to make the shortest trip How could you do this?
1 NP-Complete Problems. 2 We discuss some hard problems:  how hard? (computational complexity)  what makes them hard?  any solutions? Definitions 
INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011.
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 )
Computability and Complexity 15-1 Computability and Complexity Andrei Bulatov NP-Completeness.
FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY Read sections 7.1 – 7.3 of the book for next time.
Transitivity of  poly Theorem: Let ,  ’, and  ’’ be three decision problems such that   poly  ’ and  ’  poly  ’’. Then  poly  ’’. Proof:
NP-Complete Problems Reading Material: Chapter 10 Sections 1, 2, 3, and 4 only.
1 Polynomial Time Reductions Polynomial Computable function : For any computes in polynomial time.
NP-Complete Problems Problems in Computer Science are classified into
1 CSE 417: Algorithms and Computational Complexity Winter 2001 Lecture 23 Instructor: Paul Beame.
Analysis of Algorithms CS 477/677
Time Complexity.
NP-Completeness (2) NP-Completeness Graphs 4/17/2017 6:25 AM x x x x x
CSE 421 Algorithms Richard Anderson Lecture 27 NP Completeness.
CS Master – Introduction to the Theory of Computation Jan Maluszynski - HT Lecture NP-Completeness Jan Maluszynski, IDA, 2007
Toward NP-Completeness: Introduction Almost all the algorithms we studies so far were bounded by some polynomial in the size of the input, so we call them.
Clique Cover Cook’s Theorem 3SAT and Independent Set
February 20, 2015CS21 Lecture 191 CS21 Decidability and Tractability Lecture 19 February 20, 2015.
INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011.
INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011.
The Theory of NP-Completeness 1. Nondeterministic algorithms A nondeterminstic algorithm consists of phase 1: guessing phase 2: checking If the checking.
Nattee Niparnan. Easy & Hard Problem What is “difficulty” of problem? Difficult for computer scientist to derive algorithm for the problem? Difficult.
Lecture 22 More NPC problems
INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011.
NP-complete Problems SAT 3SAT Independent Set Hamiltonian Cycle
CSCI 2670 Introduction to Theory of Computing November 29, 2005.
CSE 024: Design & Analysis of Algorithms Chapter 9: NP Completeness Sedgewick Chp:40 David Luebke’s Course Notes / University of Virginia, Computer Science.
Complexity 25-1 Complexity Andrei Bulatov Counting Problems.
CSCI 3160 Design and Analysis of Algorithms Tutorial 10 Chengyu Lin.
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.
CS6045: Advanced Algorithms NP Completeness. NP-Completeness Some problems are intractable: as they grow large, we are unable to solve them in reasonable.
CSE 6311 – Spring 2009 ADVANCED COMPUTATIONAL MODELS AND ALGORITHMS Lecture Notes – Feb. 3, 2009 Instructor: Dr. Gautam Das notes by Walter Wilson.
Chapter 11 Introduction to Computational Complexity Copyright © 2011 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1.
NPC.
CSC 413/513: Intro to Algorithms
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.
COSC 3101A - Design and Analysis of Algorithms 14 NP-Completeness.
Computability Examples. Reducibility. NP completeness. Homework: Find other examples of NP complete problems.
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.
 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
CSE 332: NP Completeness, Part II Richard Anderson Spring 2016.
ICS 353: Design and Analysis of Algorithms NP-Complete Problems King Fahd University of Petroleum & Minerals Information & Computer Science Department.
NP-Completeness A problem is NP-complete if: It is in NP
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
NP-Completeness Yin Tat Lee
CS154, Lecture 16: More NP-Complete Problems; PCPs
ICS 353: Design and Analysis of Algorithms
NP-Completeness (2) NP-Completeness Graphs 11/23/2018 2:12 PM x x x x
More NP-complete Problems
CS154, Lecture 13: P vs NP.
NP-Completeness Yin Tat Lee
CS154, Lecture 16: More NP-Complete Problems; PCPs
Theory of Computability
NP-Completeness (2) NP-Completeness Graphs 7/9/2019 6:12 AM x x x x x
Presentation transcript:

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

NP = NTIME(n k )  k  N

Theorem: L  NP  if there exists a poly-time Turing machine V(erifier) with L = { x |  y (witness ) |y| = poly(|x|) and V(x,y) accepts } Proof: (1) If L = { x |  y |y| = poly(|x|) and V(x,y) accepts } then L  NP Because we can guess y and then run V (2) If L  NP then L = { x |  y |y| = poly(|x|) and V(x,y) accepts } Let N be a non-deterministic poly-time TM that decides L and define V(x,y) to accept if y is an accepting computation history of N on x

A language is in NP if and only if there exist polynomial-length certificates for membership to the language SAT is in NP because a satisfying assignment is a polynomial-length certificate that a formula is satisfiable

NP = all the problems for which once you have the answer it is easy (i.e. efficient) to verify

P = NP?

If P = NP… Cryptography as we know it would not be possible (e.g. RSA) Mathematicians would be out of a job AI program become perfect as exhaustive search is efficient

If P = NP… Writing symphonies is as easy as listening to them. Being a chef is as easy as eating. Writing Shakespeare is as easy as recognizing Shakespeare. Generation is as easy as recognition:

POLY-TIME REDUCIBILITY A language A is polynomial time reducible to language B, written A  P B, if there is a polynomial time computable function f : Σ*  Σ*, where for every w, w  A  f(w)  B f is called a polynomial time reduction of A to B

NP Complete Problem: hardest problem in NP Intuitively, L is harder than L’ if L’ is polynomial reducible to L. NP Complete Problem: If such a problem has an efficient algorithm (in P), then every other problem also has efficient algorithm.

Theorem (Cook-Levin): SAT is NP-complete Corollary: SAT  P if and only if P = NP

P NP SAT Any thing in NP  P 3SAT You can think of -> as “easier than”. SAT is the hardest problem in NP.

NP-Complete Problems 3SAT k-Clique Vertex Cover Independent Set

3SAT Problem: Given a CNF where each clause has 3 variables, decide whether it is satisfiable or not. (x 1  x 1  x 2 )  (  x 1   x 2   x 2 )  (  x 1  x 2  x 2 )

3SAT = {  |  y such that y is a satisfying assigment to  and  is in 3cnf } 3SAT is NP Complete How about 2SAT?

P NP 3SAT SAT What we want to prove?

How to prove? 1.We can convert (in polynomial time) a given SAT instance S into a 3SAT instance S’ such that If S is satisfiable, then S’ is satisfiable. If S’ is satisfiable, then S is satisfiable.

Key Observation x 1  x 2  x 3  x 4  x 5 is satisfiable if and only if (x 1  x 2  z 1 )  (  z 1  x 3  z 2 )  (  z 2  x 4  z 3 )  (  z 3  x 4  x 5 ) is satisfiable.

Polynomial Time Reduction Clause in SAT x 1 x 1   x 2 x 1  x 2  x 3 x 1  x 2  x 3  x 4 x 1  x 2  x 3  x 4  x 5 Clauses in 3SAT x 1  x 1  x 1 x 1  x 1   x 2 x 1  x 2  x 3 (x 1  x 2  z 1 )  (  z 1  x 3  x 4 ) (x 1  x 2  z 1 )  (  z 1  x 3  z 2 )  (  z 2  x 4  z 3 )  (  z 3  x 4  x 5 )

CLIQUE b a e c d f g k-clique = complete subgraph of k nodes

K-Cliques A K-clique is a set of K nodes with all K(K- 1)/2 possible edges between them This graph contains a 4-clique

CLIQUE = { (G,k) | G is an undirected graph with a k-clique } Theorem: CLIQUE is NP-Complete (1) CLIQUE  NP (2) 3SAT  P CLIQUE Assume a reasonable encoding of graphs (example: the adjacency matrix is reasonable) Brute Force Algorithm: Try out all {n choose k} possible locations for the k clique

P NP CLIQUE 3SAT CLIQUE is NP-Complete

3SAT  P CLIQUE We transform a 3-cnf formula  into (G,k) such that   3SAT  (G,k)  CLIQUE The transformation can be done in time that is polynomial in the length of 

3SAT  P CLIQUE We transform a 3-cnf formula  into (G,k) such that   3SAT  (G,k)  CLIQUE If  has m clauses, we create a graph with m clusters of 3 nodes each, and set k=m Each cluster corresponds to a clause. Each node in a cluster is labeled with a literal from the clause. We do not connect any nodes in the same cluster We connect nodes in different clusters whenever they are not contradictory

(x 1  x 1  x 2 )  (  x 1   x 2   x 2 )  (  x 1  x 2  x 2 ) x1x1 x1x1 x1x1 x2x2 x2x2 x2x2 x2x2 x2x2 x1x1 k = #clauses clauseclause #nodes = 3(# clauses)

(x 1  x 1  x 1 )  (  x 1   x 1  x 2 )  (x 2  x 2  x 2 )  (  x 2   x 2  x 1 ) x1x1 x1x1 x2x2 x2x2 x1x1 x1x1 x2x2 x2x2 x1x1 x2x2 x2x2 x1x1

This graph contains an independent set of size 3 Independent Set An independent set is a set of nodes with no edges between them

Independent Set G(V,E) Problem: Given a graph G and k, is there a size k independent set?

Complement of G Given a graph G, let G*, the complement of G, be the graph such that two nodes are connected in G* if and only if the corresponding nodes are not connected in G G G*

Key Observation For a graph G, vertex set S is an independent set if and only if S is clique in G*.

Let G be an n-node graph Is there size clique in G? Is there size k independent set in G*?

VERTEX COVER b a e c d b a e c d vertex cover = set of nodes that cover all edges

Vertex Cover is NP Complete Given a Graph G(V,E), decide if there is k vertex such that every edge is covered by one of them?

K-Indep Set  P Vertex Cover

Key Observation For a graph G(V,E), S is a independent set if and only if V-S is a vertex cover.

Other NP-Complete Problems Travelling Salesman Problem Hamiltonian Path Max Cut Subset Sum Integer Programming ….

Other Problems in NP Graph Isomorphism Factoring Number We don’t know if they are NP Complete or not.