powerpoint presentationlblum/flac/lectures_pdf/lecture18.pdf · powerpoint presentation author: von...
TRANSCRIPT
![Page 1: PowerPoint Presentationlblum/flac/Lectures_pdf/Lecture18.pdf · PowerPoint Presentation Author: von Ahn and Williams Created Date: 4/4/2014 8:02:53 PM](https://reader033.vdocument.in/reader033/viewer/2022042318/5f077d4f7e708231d41d3cb4/html5/thumbnails/1.jpg)
FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY
15-453
![Page 2: PowerPoint Presentationlblum/flac/Lectures_pdf/Lecture18.pdf · PowerPoint Presentation Author: von Ahn and Williams Created Date: 4/4/2014 8:02:53 PM](https://reader033.vdocument.in/reader033/viewer/2022042318/5f077d4f7e708231d41d3cb4/html5/thumbnails/2.jpg)
NP-COMPLETENESS II Tuesday April 1
![Page 3: PowerPoint Presentationlblum/flac/Lectures_pdf/Lecture18.pdf · PowerPoint Presentation Author: von Ahn and Williams Created Date: 4/4/2014 8:02:53 PM](https://reader033.vdocument.in/reader033/viewer/2022042318/5f077d4f7e708231d41d3cb4/html5/thumbnails/3.jpg)
There are googols of NP-complete languages
![Page 4: PowerPoint Presentationlblum/flac/Lectures_pdf/Lecture18.pdf · PowerPoint Presentation Author: von Ahn and Williams Created Date: 4/4/2014 8:02:53 PM](https://reader033.vdocument.in/reader033/viewer/2022042318/5f077d4f7e708231d41d3cb4/html5/thumbnails/4.jpg)
K-CLIQUE
b
a
e
c
d f
g
k-clique = complete subgraph of k nodes
![Page 5: PowerPoint Presentationlblum/flac/Lectures_pdf/Lecture18.pdf · PowerPoint Presentation Author: von Ahn and Williams Created Date: 4/4/2014 8:02:53 PM](https://reader033.vdocument.in/reader033/viewer/2022042318/5f077d4f7e708231d41d3cb4/html5/thumbnails/5.jpg)
K-CLIQUE
b
a
e
c
d f
g
k-clique = complete subgraph of k nodes
![Page 6: PowerPoint Presentationlblum/flac/Lectures_pdf/Lecture18.pdf · PowerPoint Presentation Author: von Ahn and Williams Created Date: 4/4/2014 8:02:53 PM](https://reader033.vdocument.in/reader033/viewer/2022042318/5f077d4f7e708231d41d3cb4/html5/thumbnails/6.jpg)
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)
![Page 7: PowerPoint Presentationlblum/flac/Lectures_pdf/Lecture18.pdf · PowerPoint Presentation Author: von Ahn and Williams Created Date: 4/4/2014 8:02:53 PM](https://reader033.vdocument.in/reader033/viewer/2022042318/5f077d4f7e708231d41d3cb4/html5/thumbnails/7.jpg)
P NP
CLIQUE
3SAT
CLIQUE is NP-Complete
![Page 8: PowerPoint Presentationlblum/flac/Lectures_pdf/Lecture18.pdf · PowerPoint Presentation Author: von Ahn and Williams Created Date: 4/4/2014 8:02:53 PM](https://reader033.vdocument.in/reader033/viewer/2022042318/5f077d4f7e708231d41d3cb4/html5/thumbnails/8.jpg)
P NP
CLIQUE
3SAT
CLIQUE is NP-Complete
![Page 9: PowerPoint Presentationlblum/flac/Lectures_pdf/Lecture18.pdf · PowerPoint Presentation Author: von Ahn and Williams Created Date: 4/4/2014 8:02:53 PM](https://reader033.vdocument.in/reader033/viewer/2022042318/5f077d4f7e708231d41d3cb4/html5/thumbnails/9.jpg)
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 φ
![Page 10: PowerPoint Presentationlblum/flac/Lectures_pdf/Lecture18.pdf · PowerPoint Presentation Author: von Ahn and Williams Created Date: 4/4/2014 8:02:53 PM](https://reader033.vdocument.in/reader033/viewer/2022042318/5f077d4f7e708231d41d3cb4/html5/thumbnails/10.jpg)
(x1 ∨ x1 ∨ x2) ∧ (¬x1 ∨ ¬x2 ∨ ¬x2) ∧ (¬x1 ∨ x2 ∨ x2)
x1 ¬x1
x1 x2
¬x2 ¬x2
x2 x2
¬x1
k = #clauses
clause
#nodes = 3(# clauses)
![Page 11: PowerPoint Presentationlblum/flac/Lectures_pdf/Lecture18.pdf · PowerPoint Presentation Author: von Ahn and Williams Created Date: 4/4/2014 8:02:53 PM](https://reader033.vdocument.in/reader033/viewer/2022042318/5f077d4f7e708231d41d3cb4/html5/thumbnails/11.jpg)
(x1 ∨ x1 ∨ x2) ∧ (¬x1 ∨ ¬x2 ∨ ¬x2) ∧ (¬x1 ∨ x2 ∨ x2)
x1 ¬x1
x1 x2
¬x2 ¬x2
x2 x2
¬x1
k = #clauses
clause
#nodes = 3(# clauses)
![Page 12: PowerPoint Presentationlblum/flac/Lectures_pdf/Lecture18.pdf · PowerPoint Presentation Author: von Ahn and Williams Created Date: 4/4/2014 8:02:53 PM](https://reader033.vdocument.in/reader033/viewer/2022042318/5f077d4f7e708231d41d3cb4/html5/thumbnails/12.jpg)
(x1 ∨ x1 ∨ x2) ∧ (¬x1 ∨ ¬x2 ∨ ¬x2) ∧ (¬x1 ∨ x2 ∨ x2)
x1 ¬x1
x1 x2
¬x2 ¬x2
x2 x2
¬x1
k = #clauses
clause
#nodes = 3(# clauses)
![Page 13: PowerPoint Presentationlblum/flac/Lectures_pdf/Lecture18.pdf · PowerPoint Presentation Author: von Ahn and Williams Created Date: 4/4/2014 8:02:53 PM](https://reader033.vdocument.in/reader033/viewer/2022042318/5f077d4f7e708231d41d3cb4/html5/thumbnails/13.jpg)
(x1 ∨ x1 ∨ x2) ∧ (¬x1 ∨ ¬x2 ∨ ¬x2) ∧ (¬x1 ∨ x2 ∨ x2)
x1 ¬x1
x1 x2
¬x2 ¬x2
x2 x2
¬x1
k = #clauses
clause
#nodes = 3(# clauses)
![Page 14: PowerPoint Presentationlblum/flac/Lectures_pdf/Lecture18.pdf · PowerPoint Presentation Author: von Ahn and Williams Created Date: 4/4/2014 8:02:53 PM](https://reader033.vdocument.in/reader033/viewer/2022042318/5f077d4f7e708231d41d3cb4/html5/thumbnails/14.jpg)
(x1 ∨ x1 ∨ x2) ∧ (¬x1 ∨ ¬x2 ∨ ¬x2) ∧ (¬x1 ∨ x2 ∨ x2)
x1 ¬x1
x1 x2
¬x2 ¬x2
x2 x2
¬x1
k = #clauses
clause
#nodes = 3(# clauses)
![Page 15: PowerPoint Presentationlblum/flac/Lectures_pdf/Lecture18.pdf · PowerPoint Presentation Author: von Ahn and Williams Created Date: 4/4/2014 8:02:53 PM](https://reader033.vdocument.in/reader033/viewer/2022042318/5f077d4f7e708231d41d3cb4/html5/thumbnails/15.jpg)
(x1 ∨ x1 ∨ x2) ∧ (¬x1 ∨ ¬x2 ∨ ¬x2) ∧ (¬x1 ∨ x2 ∨ x2)
x1 ¬x1
x1 x2
¬x2 ¬x2
x2 x2
¬x1
k = #clauses
clause
#nodes = 3(# clauses)
![Page 16: PowerPoint Presentationlblum/flac/Lectures_pdf/Lecture18.pdf · PowerPoint Presentation Author: von Ahn and Williams Created Date: 4/4/2014 8:02:53 PM](https://reader033.vdocument.in/reader033/viewer/2022042318/5f077d4f7e708231d41d3cb4/html5/thumbnails/16.jpg)
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
The transformation can be done in time that is polynomial in the length of φ
![Page 17: PowerPoint Presentationlblum/flac/Lectures_pdf/Lecture18.pdf · PowerPoint Presentation Author: von Ahn and Williams Created Date: 4/4/2014 8:02:53 PM](https://reader033.vdocument.in/reader033/viewer/2022042318/5f077d4f7e708231d41d3cb4/html5/thumbnails/17.jpg)
(x1 ∨ x1 ∨ x1) ∧ (¬x1 ∨ ¬x1 ∨ x2) ∧ (x2 ∨ x2 ∨ x2) ∧ (¬x2 ∨ ¬x2 ∨ x1)
x1
x1
x2
x2
¬x1 ¬x1
¬x2 ¬x2
x1 x2
x2
x1
![Page 18: PowerPoint Presentationlblum/flac/Lectures_pdf/Lecture18.pdf · PowerPoint Presentation Author: von Ahn and Williams Created Date: 4/4/2014 8:02:53 PM](https://reader033.vdocument.in/reader033/viewer/2022042318/5f077d4f7e708231d41d3cb4/html5/thumbnails/18.jpg)
(x1 ∨ x1 ∨ x1) ∧ (¬x1 ∨ ¬x1 ∨ x2) ∧ (x2 ∨ x2 ∨ x2) ∧ (¬x2 ∨ ¬x2 ∨ x1)
x1
x1
x2
x2
¬x1 ¬x1
¬x2 ¬x2
x1 x2
x2
x1
![Page 19: PowerPoint Presentationlblum/flac/Lectures_pdf/Lecture18.pdf · PowerPoint Presentation Author: von Ahn and Williams Created Date: 4/4/2014 8:02:53 PM](https://reader033.vdocument.in/reader033/viewer/2022042318/5f077d4f7e708231d41d3cb4/html5/thumbnails/19.jpg)
VERTEX COVER
b
a
e
c
d
b
a
e
c
d
vertex cover = set of nodes that cover all edges
![Page 20: PowerPoint Presentationlblum/flac/Lectures_pdf/Lecture18.pdf · PowerPoint Presentation Author: von Ahn and Williams Created Date: 4/4/2014 8:02:53 PM](https://reader033.vdocument.in/reader033/viewer/2022042318/5f077d4f7e708231d41d3cb4/html5/thumbnails/20.jpg)
VERTEX COVER
b
a
e
c
d
b
a
e
c
d
vertex cover = set of nodes that cover all edges
![Page 21: PowerPoint Presentationlblum/flac/Lectures_pdf/Lecture18.pdf · PowerPoint Presentation Author: von Ahn and Williams Created Date: 4/4/2014 8:02:53 PM](https://reader033.vdocument.in/reader033/viewer/2022042318/5f077d4f7e708231d41d3cb4/html5/thumbnails/21.jpg)
VERTEX-COVER = { (G,k) | G is an undirected graph with a k-node vertex cover }
Theorem: VERTEX-COVER is NP-Complete (1) VERTEX-COVER ∈ NP
(2) 3SAT ≤P VERTEX-COVER
![Page 22: PowerPoint Presentationlblum/flac/Lectures_pdf/Lecture18.pdf · PowerPoint Presentation Author: von Ahn and Williams Created Date: 4/4/2014 8:02:53 PM](https://reader033.vdocument.in/reader033/viewer/2022042318/5f077d4f7e708231d41d3cb4/html5/thumbnails/22.jpg)
3SAT ≤P VERTEX-COVER We transform a 3-cnf formula φ into (G,k) such that
φ ∈ 3SAT ⇔ (G,k) ∈ VERTEX-COVER
The transformation can be done in time polynomial in the length of φ
![Page 23: PowerPoint Presentationlblum/flac/Lectures_pdf/Lecture18.pdf · PowerPoint Presentation Author: von Ahn and Williams Created Date: 4/4/2014 8:02:53 PM](https://reader033.vdocument.in/reader033/viewer/2022042318/5f077d4f7e708231d41d3cb4/html5/thumbnails/23.jpg)
(x1 ∨ x1 ∨ x2) ∧ (¬x1 ∨ ¬x2 ∨ ¬x2) ∧ (¬x1 ∨ x2 ∨ x2)
x1
x1 x2
¬x1
x2 x2 ¬x2 ¬x2
¬x1
x1 ¬x1 x2 ¬x2
Variables and negations of variables
clauses
#nodes = 2(#variables) + 3(#clauses)
![Page 24: PowerPoint Presentationlblum/flac/Lectures_pdf/Lecture18.pdf · PowerPoint Presentation Author: von Ahn and Williams Created Date: 4/4/2014 8:02:53 PM](https://reader033.vdocument.in/reader033/viewer/2022042318/5f077d4f7e708231d41d3cb4/html5/thumbnails/24.jpg)
(x1 ∨ x1 ∨ x2) ∧ (¬x1 ∨ ¬x2 ∨ ¬x2) ∧ (¬x1 ∨ x2 ∨ x2)
x1
x1 x2
¬x1
x2 x2 ¬x2 ¬x2
¬x1
x1 ¬x1 x2 ¬x2
Variables and negations of variables
clauses
#nodes = 2(#variables) + 3(#clauses)
![Page 25: PowerPoint Presentationlblum/flac/Lectures_pdf/Lecture18.pdf · PowerPoint Presentation Author: von Ahn and Williams Created Date: 4/4/2014 8:02:53 PM](https://reader033.vdocument.in/reader033/viewer/2022042318/5f077d4f7e708231d41d3cb4/html5/thumbnails/25.jpg)
(x1 ∨ x1 ∨ x2) ∧ (¬x1 ∨ ¬x2 ∨ ¬x2) ∧ (¬x1 ∨ x2 ∨ x2)
x1
x1 x2
¬x1
x2 x2 ¬x2 ¬x2
¬x1
x1 ¬x1 x2 ¬x2
Variables and negations of variables
clauses
#nodes = 2(#variables) + 3(#clauses)
![Page 26: PowerPoint Presentationlblum/flac/Lectures_pdf/Lecture18.pdf · PowerPoint Presentation Author: von Ahn and Williams Created Date: 4/4/2014 8:02:53 PM](https://reader033.vdocument.in/reader033/viewer/2022042318/5f077d4f7e708231d41d3cb4/html5/thumbnails/26.jpg)
(x1 ∨ x1 ∨ x2) ∧ (¬x1 ∨ ¬x2 ∨ ¬x2) ∧ (¬x1 ∨ x2 ∨ x2)
x1
x1 x2
¬x1
x2 x2 ¬x2 ¬x2
¬x1
x1 ¬x1 x2 ¬x2
k = 2(#clauses) + (#variables)
Variables and negations of variables
clauses
![Page 27: PowerPoint Presentationlblum/flac/Lectures_pdf/Lecture18.pdf · PowerPoint Presentation Author: von Ahn and Williams Created Date: 4/4/2014 8:02:53 PM](https://reader033.vdocument.in/reader033/viewer/2022042318/5f077d4f7e708231d41d3cb4/html5/thumbnails/27.jpg)
(x1 ∨ x1 ∨ x2) ∧ (¬x1 ∨ ¬x2 ∨ ¬x2) ∧ (¬x1 ∨ x2 ∨ x2)
x1
x1 x2
¬x1
x2 x2 ¬x2 ¬x2
¬x1
x1 ¬x1 x2 ¬x2
Variables and negations of variables
clauses
φ satisfiable then put “true” literals on top in vertex cover For each clause, pick a true literal and put other 2 in vertex cover
![Page 28: PowerPoint Presentationlblum/flac/Lectures_pdf/Lecture18.pdf · PowerPoint Presentation Author: von Ahn and Williams Created Date: 4/4/2014 8:02:53 PM](https://reader033.vdocument.in/reader033/viewer/2022042318/5f077d4f7e708231d41d3cb4/html5/thumbnails/28.jpg)
(x1 ∨ x1 ∨ x2) ∧ (¬x1 ∨ ¬x2 ∨ ¬x2) ∧ (¬x1 ∨ x2 ∨ x2)
x1
x1 x2
¬x1
x2 x2 ¬x2 ¬x2
¬x1
x1 ¬x1 x2 ¬x2
Variables and negations of variables
clauses
φ satisfiable then put “true” literals on top in vertex cover For each clause, pick a true literal and put other 2 in vertex cover
![Page 29: PowerPoint Presentationlblum/flac/Lectures_pdf/Lecture18.pdf · PowerPoint Presentation Author: von Ahn and Williams Created Date: 4/4/2014 8:02:53 PM](https://reader033.vdocument.in/reader033/viewer/2022042318/5f077d4f7e708231d41d3cb4/html5/thumbnails/29.jpg)
(x1 ∨ x1 ∨ x1) ∧ (¬x1 ∨ ¬x1 ∨ x2) ∧ (x2 ∨ x2 ∨ x2) ∧ (¬x2 ∨ ¬x2 ∨ x1)
![Page 30: PowerPoint Presentationlblum/flac/Lectures_pdf/Lecture18.pdf · PowerPoint Presentation Author: von Ahn and Williams Created Date: 4/4/2014 8:02:53 PM](https://reader033.vdocument.in/reader033/viewer/2022042318/5f077d4f7e708231d41d3cb4/html5/thumbnails/30.jpg)
HAMILTON PATH
s t
![Page 31: PowerPoint Presentationlblum/flac/Lectures_pdf/Lecture18.pdf · PowerPoint Presentation Author: von Ahn and Williams Created Date: 4/4/2014 8:02:53 PM](https://reader033.vdocument.in/reader033/viewer/2022042318/5f077d4f7e708231d41d3cb4/html5/thumbnails/31.jpg)
HAMILTON PATH
s t
![Page 32: PowerPoint Presentationlblum/flac/Lectures_pdf/Lecture18.pdf · PowerPoint Presentation Author: von Ahn and Williams Created Date: 4/4/2014 8:02:53 PM](https://reader033.vdocument.in/reader033/viewer/2022042318/5f077d4f7e708231d41d3cb4/html5/thumbnails/32.jpg)
HAMPATH = { (G,s,t) | G is an directed graph with a Hamilton path from s to t}
Theorem: HAMPATH is NP-Complete (1) HAMPATH ∈ NP
(2) 3SAT ≤P HAMPATH Proof is in Sipser, Chapter 7.5
![Page 33: PowerPoint Presentationlblum/flac/Lectures_pdf/Lecture18.pdf · PowerPoint Presentation Author: von Ahn and Williams Created Date: 4/4/2014 8:02:53 PM](https://reader033.vdocument.in/reader033/viewer/2022042318/5f077d4f7e708231d41d3cb4/html5/thumbnails/33.jpg)
![Page 34: PowerPoint Presentationlblum/flac/Lectures_pdf/Lecture18.pdf · PowerPoint Presentation Author: von Ahn and Williams Created Date: 4/4/2014 8:02:53 PM](https://reader033.vdocument.in/reader033/viewer/2022042318/5f077d4f7e708231d41d3cb4/html5/thumbnails/34.jpg)
![Page 35: PowerPoint Presentationlblum/flac/Lectures_pdf/Lecture18.pdf · PowerPoint Presentation Author: von Ahn and Williams Created Date: 4/4/2014 8:02:53 PM](https://reader033.vdocument.in/reader033/viewer/2022042318/5f077d4f7e708231d41d3cb4/html5/thumbnails/35.jpg)
Case: a2 separator node Only edges entering a2 would be a1 and a3
Case: a3 separator node. Then a1, a2 in same clause pair Only edges entering a2 would be a1, a3, c
If hamiltonian path were not normal:
![Page 36: PowerPoint Presentationlblum/flac/Lectures_pdf/Lecture18.pdf · PowerPoint Presentation Author: von Ahn and Williams Created Date: 4/4/2014 8:02:53 PM](https://reader033.vdocument.in/reader033/viewer/2022042318/5f077d4f7e708231d41d3cb4/html5/thumbnails/36.jpg)
UHAMPATH = { (G,s,t) | G is an undirected graph with a Hamilton path from s to t}
Theorem: UHAMPATH is NP-Complete (1) UHAMPATH ∈ NP
(2) HAMPATH ≤P UHAMPATH
![Page 37: PowerPoint Presentationlblum/flac/Lectures_pdf/Lecture18.pdf · PowerPoint Presentation Author: von Ahn and Williams Created Date: 4/4/2014 8:02:53 PM](https://reader033.vdocument.in/reader033/viewer/2022042318/5f077d4f7e708231d41d3cb4/html5/thumbnails/37.jpg)
![Page 38: PowerPoint Presentationlblum/flac/Lectures_pdf/Lecture18.pdf · PowerPoint Presentation Author: von Ahn and Williams Created Date: 4/4/2014 8:02:53 PM](https://reader033.vdocument.in/reader033/viewer/2022042318/5f077d4f7e708231d41d3cb4/html5/thumbnails/38.jpg)
SUBSETSUM = { (S, t) | S is multiset of integers and for some Y ⊆ S, we have ∑y∈ Y y = t }
Theorem: SUBSETSUM is NP-Complete (1) SUBSETSUM ∈ NP
(2) 3SAT ≤P SUBSETSUM
![Page 39: PowerPoint Presentationlblum/flac/Lectures_pdf/Lecture18.pdf · PowerPoint Presentation Author: von Ahn and Williams Created Date: 4/4/2014 8:02:53 PM](https://reader033.vdocument.in/reader033/viewer/2022042318/5f077d4f7e708231d41d3cb4/html5/thumbnails/39.jpg)
![Page 40: PowerPoint Presentationlblum/flac/Lectures_pdf/Lecture18.pdf · PowerPoint Presentation Author: von Ahn and Williams Created Date: 4/4/2014 8:02:53 PM](https://reader033.vdocument.in/reader033/viewer/2022042318/5f077d4f7e708231d41d3cb4/html5/thumbnails/40.jpg)
HW
Let G denote a graph, and s and t denote nodes. SHORTEST PATH = {(G, s, t, k) | G has a simple path of length < k from s to t } LONGEST PATH = {(G, s, t, k) | G has a simple path of length > k from s to t } WHICH IS EASY? WHICH IS HARD? Justify
![Page 41: PowerPoint Presentationlblum/flac/Lectures_pdf/Lecture18.pdf · PowerPoint Presentation Author: von Ahn and Williams Created Date: 4/4/2014 8:02:53 PM](https://reader033.vdocument.in/reader033/viewer/2022042318/5f077d4f7e708231d41d3cb4/html5/thumbnails/41.jpg)
WWW.FLAC.WS