Reductions to Prove NP Hardness
Nabil Mustafa
Computational Complexity
1 / 121 Cook-Levin: All L NP can be reduced to SAT ∈ I polynomial g( ) such that x L g(x) SAT ∃ · ∈ ⇐⇒ ∈ I Very important to remember the implication goes both ways
Gave a reduction from general CNF SAT to 3-CNF SAT
I 2-CNF SAT is in P through a poly-time algorithm.
3-CNF SAT then becomes a very important problem. Also,
I An elementary problem, very simple to understand I Captures the ‘pure’ combinatorial choices of algorithms
Given 3-CNF SAT , can construct a host of other reductions.
Reductions
The class NP : languages with succinct membership certificates
2 / 121 I Very important to remember the implication goes both ways
Gave a reduction from general CNF SAT to 3-CNF SAT
I 2-CNF SAT is in P through a poly-time algorithm.
3-CNF SAT then becomes a very important problem. Also,
I An elementary problem, very simple to understand I Captures the ‘pure’ combinatorial choices of algorithms
Given 3-CNF SAT , can construct a host of other reductions.
Reductions
The class NP : languages with succinct membership certificates
Cook-Levin: All L NP can be reduced to SAT ∈ I polynomial g( ) such that x L g(x) SAT ∃ · ∈ ⇐⇒ ∈
3 / 121 Gave a reduction from general CNF SAT to 3-CNF SAT
I 2-CNF SAT is in P through a poly-time algorithm.
3-CNF SAT then becomes a very important problem. Also,
I An elementary problem, very simple to understand I Captures the ‘pure’ combinatorial choices of algorithms
Given 3-CNF SAT , can construct a host of other reductions.
Reductions
The class NP : languages with succinct membership certificates
Cook-Levin: All L NP can be reduced to SAT ∈ I polynomial g( ) such that x L g(x) SAT ∃ · ∈ ⇐⇒ ∈ I Very important to remember the implication goes both ways
4 / 121 I 2-CNF SAT is in P through a poly-time algorithm.
3-CNF SAT then becomes a very important problem. Also,
I An elementary problem, very simple to understand I Captures the ‘pure’ combinatorial choices of algorithms
Given 3-CNF SAT , can construct a host of other reductions.
Reductions
The class NP : languages with succinct membership certificates
Cook-Levin: All L NP can be reduced to SAT ∈ I polynomial g( ) such that x L g(x) SAT ∃ · ∈ ⇐⇒ ∈ I Very important to remember the implication goes both ways
Gave a reduction from general CNF SAT to 3-CNF SAT
5 / 121 3-CNF SAT then becomes a very important problem. Also,
I An elementary problem, very simple to understand I Captures the ‘pure’ combinatorial choices of algorithms
Given 3-CNF SAT , can construct a host of other reductions.
Reductions
The class NP : languages with succinct membership certificates
Cook-Levin: All L NP can be reduced to SAT ∈ I polynomial g( ) such that x L g(x) SAT ∃ · ∈ ⇐⇒ ∈ I Very important to remember the implication goes both ways
Gave a reduction from general CNF SAT to 3-CNF SAT
I 2-CNF SAT is in P through a poly-time algorithm.
6 / 121 I An elementary problem, very simple to understand I Captures the ‘pure’ combinatorial choices of algorithms
Given 3-CNF SAT , can construct a host of other reductions.
Reductions
The class NP : languages with succinct membership certificates
Cook-Levin: All L NP can be reduced to SAT ∈ I polynomial g( ) such that x L g(x) SAT ∃ · ∈ ⇐⇒ ∈ I Very important to remember the implication goes both ways
Gave a reduction from general CNF SAT to 3-CNF SAT
I 2-CNF SAT is in P through a poly-time algorithm.
3-CNF SAT then becomes a very important problem. Also,
7 / 121 I Captures the ‘pure’ combinatorial choices of algorithms
Given 3-CNF SAT , can construct a host of other reductions.
Reductions
The class NP : languages with succinct membership certificates
Cook-Levin: All L NP can be reduced to SAT ∈ I polynomial g( ) such that x L g(x) SAT ∃ · ∈ ⇐⇒ ∈ I Very important to remember the implication goes both ways
Gave a reduction from general CNF SAT to 3-CNF SAT
I 2-CNF SAT is in P through a poly-time algorithm.
3-CNF SAT then becomes a very important problem. Also,
I An elementary problem, very simple to understand
8 / 121 Given 3-CNF SAT , can construct a host of other reductions.
Reductions
The class NP : languages with succinct membership certificates
Cook-Levin: All L NP can be reduced to SAT ∈ I polynomial g( ) such that x L g(x) SAT ∃ · ∈ ⇐⇒ ∈ I Very important to remember the implication goes both ways
Gave a reduction from general CNF SAT to 3-CNF SAT
I 2-CNF SAT is in P through a poly-time algorithm.
3-CNF SAT then becomes a very important problem. Also,
I An elementary problem, very simple to understand I Captures the ‘pure’ combinatorial choices of algorithms
9 / 121 Reductions
The class NP : languages with succinct membership certificates
Cook-Levin: All L NP can be reduced to SAT ∈ I polynomial g( ) such that x L g(x) SAT ∃ · ∈ ⇐⇒ ∈ I Very important to remember the implication goes both ways
Gave a reduction from general CNF SAT to 3-CNF SAT
I 2-CNF SAT is in P through a poly-time algorithm.
3-CNF SAT then becomes a very important problem. Also,
I An elementary problem, very simple to understand I Captures the ‘pure’ combinatorial choices of algorithms
Given 3-CNF SAT , can construct a host of other reductions.
10 / 121 i) It is in NP ii) Reduce a NP hard problem to it Show: If one can solve INDSET in polynomial time, then can solve 3-CNF SAT problem in polynomial time as well.
INDSET Claim INDSET : Given a graph G = (V , E) and a parameter k, does G have an independent set of size k? The independent set problem (INDSET ) is NP complete.
11 / 121 ii) Reduce a NP hard problem to it Show: If one can solve INDSET in polynomial time, then can solve 3-CNF SAT problem in polynomial time as well.
INDSET Claim INDSET : Given a graph G = (V , E) and a parameter k, does G have an independent set of size k? The independent set problem (INDSET ) is NP complete.
i) It is in NP
12 / 121 Show: If one can solve INDSET in polynomial time, then can solve 3-CNF SAT problem in polynomial time as well.
INDSET Claim INDSET : Given a graph G = (V , E) and a parameter k, does G have an independent set of size k? The independent set problem (INDSET ) is NP complete.
i) It is in NP ii) Reduce a NP hard problem to it
13 / 121 INDSET Claim INDSET : Given a graph G = (V , E) and a parameter k, does G have an independent set of size k? The independent set problem (INDSET ) is NP complete.
i) It is in NP ii) Reduce a NP hard problem to it Show: If one can solve INDSET in polynomial time, then can solve 3-CNF SAT problem in polynomial time as well.
14 / 121 Construct a graph G = (V , E) as follows: i i I Vertices: Each literal xj i corresponds to the vertex vj . i i 0 i∈ Ci 0 I Edges: (vj , vj0 ) E if xj , xj0 are the same variable negated. ∈ i i i I Add all possible edges between v1, v2 and v3 for all i. (x1 x2 x3) (x1 x3 x4) (x2 x4) ∨ ∨ ∧ ∨ ∨ ∧ ∨
i i i φ = 1 2 ... k , where i = (x x x ) C ∧ C ∧ ∧ C C 1 ∨ 2 ∨ 3
15 / 121 i i I Vertices: Each literal xj i corresponds to the vertex vj . i i 0 i∈ Ci 0 I Edges: (vj , vj0 ) E if xj , xj0 are the same variable negated. ∈ i i i I Add all possible edges between v1, v2 and v3 for all i. (x1 x2 x3) (x1 x3 x4) (x2 x4) ∨ ∨ ∧ ∨ ∨ ∧ ∨
i i i φ = 1 2 ... k , where i = (x x x ) C ∧ C ∧ ∧ C C 1 ∨ 2 ∨ 3 Construct a graph G = (V , E) as follows:
16 / 121 i i 0 i i 0 I Edges: (vj , vj0 ) E if xj , xj0 are the same variable negated. ∈ i i i I Add all possible edges between v1, v2 and v3 for all i. (x1 x2 x3) (x1 x3 x4) (x2 x4) ∨ ∨ ∧ ∨ ∨ ∧ ∨
i i i φ = 1 2 ... k , where i = (x x x ) C ∧ C ∧ ∧ C C 1 ∨ 2 ∨ 3 Construct a graph G = (V , E) as follows: i i I Vertices: Each literal x i corresponds to the vertex v . j ∈ C j
17 / 121 i i i I Add all possible edges between v1, v2 and v3 for all i. (x1 x2 x3) (x1 x3 x4) (x2 x4) ∨ ∨ ∧ ∨ ∨ ∧ ∨
i i i φ = 1 2 ... k , where i = (x x x ) C ∧ C ∧ ∧ C C 1 ∨ 2 ∨ 3 Construct a graph G = (V , E) as follows: i i I Vertices: Each literal xj i corresponds to the vertex vj . i i 0 i∈ Ci 0 I Edges: (v , v 0 ) E if x , x 0 are the same variable negated. j j ∈ j j
18 / 121 (x1 x2 x3) (x1 x3 x4) (x2 x4) ∨ ∨ ∧ ∨ ∨ ∧ ∨
i i i φ = 1 2 ... k , where i = (x x x ) C ∧ C ∧ ∧ C C 1 ∨ 2 ∨ 3 Construct a graph G = (V , E) as follows: i i I Vertices: Each literal xj i corresponds to the vertex vj . i i 0 i∈ Ci 0 I Edges: (vj , vj0 ) E if xj , xj0 are the same variable negated. ∈ i i i I Add all possible edges between v1, v2 and v3 for all i.
19 / 121 i i i φ = 1 2 ... k , where i = (x x x ) C ∧ C ∧ ∧ C C 1 ∨ 2 ∨ 3 Construct a graph G = (V , E) as follows: i i I Vertices: Each literal xj i corresponds to the vertex vj . i i 0 i∈ Ci 0 I Edges: (vj , vj0 ) E if xj , xj0 are the same variable negated. ∈ i i i I Add all possible edges between v1, v2 and v3 for all i. (x1 x2 x3) (x1 x3 x4) (x2 x4) ∨ ∨ ∧ ∨ ∨ ∧ ∨
20 / 121 i i i φ = 1 2 ... k , where i = (x x x ) C ∧ C ∧ ∧ C C 1 ∨ 2 ∨ 3 Construct a graph G = (V , E) as follows: i i I Vertices: Each literal xj i corresponds to the vertex vj . i i 0 i∈ Ci 0 I Edges: (vj , vj0 ) E if xj , xj0 are the same variable negated. ∈ i i i I Add all possible edges between v1, v2 and v3 for all i. (x1 x2 x3) (x1 x3 x4) (x2 x4) ∨ ∨ ∧ ∨ ∨ ∧ ∨
x2
x1 x3 x4
x2
x3 x1
x4
21 / 121 i i i φ = 1 2 ... k , where i = (x x x ) C ∧ C ∧ ∧ C C 1 ∨ 2 ∨ 3 Construct a graph G = (V , E) as follows: i i I Vertices: Each literal xj i corresponds to the vertex vj . i i 0 i∈ Ci 0 I Edges: (vj , vj0 ) E if xj , xj0 are the same variable negated. ∈ i i i I Add all possible edges between v1, v2 and v3 for all i. (x1 x2 x3) (x1 x3 x4) (x2 x4) ∨ ∨ ∧ ∨ ∨ ∧ ∨
x2
x1 x3 x4
x2
x3 x1
x4
22 / 121 i i i φ = 1 2 ... k , where i = (x x x ) C ∧ C ∧ ∧ C C 1 ∨ 2 ∨ 3 Construct a graph G = (V , E) as follows: i i I Vertices: Each literal xj i corresponds to the vertex vj . i i 0 i∈ Ci 0 I Edges: (vj , vj0 ) E if xj , xj0 are the same variable negated. ∈ i i i I Add all possible edges between v1, v2 and v3 for all i. (x1 x2 x3) (x1 x3 x4) (x2 x4) ∨ ∨ ∧ ∨ ∨ ∧ ∨
x2
x1 x3 x4
x2
x3 x1
x4
23 / 121 0 I The independent set, say V , cannot have two vertices from the same clause 0 I Therefore, V has exactly one vertex from each of the k clauses
I No pair maps to literals x and x i i i I If vj corresponds to literal xj = x, set xj = 1 i i i I If vj corresponds to literal xj = x, set xj = 0
I Each clause satisfied, and no variable-setting conflicts between clauses
Claim: If φ is satisfiable, G has an independent set of size k
Reduction for INDSET
Claim: If G has an independent set of size k, φ is satisfiable
24 / 121 0 I Therefore, V has exactly one vertex from each of the k clauses
I No pair maps to literals x and x i i i I If vj corresponds to literal xj = x, set xj = 1 i i i I If vj corresponds to literal xj = x, set xj = 0
I Each clause satisfied, and no variable-setting conflicts between clauses
Claim: If φ is satisfiable, G has an independent set of size k
Reduction for INDSET
Claim: If G has an independent set of size k, φ is satisfiable
0 I The independent set, say V , cannot have two vertices from the same clause
25 / 121 I No pair maps to literals x and x i i i I If vj corresponds to literal xj = x, set xj = 1 i i i I If vj corresponds to literal xj = x, set xj = 0
I Each clause satisfied, and no variable-setting conflicts between clauses
Claim: If φ is satisfiable, G has an independent set of size k
Reduction for INDSET
Claim: If G has an independent set of size k, φ is satisfiable
0 I The independent set, say V , cannot have two vertices from the same clause 0 I Therefore, V has exactly one vertex from each of the k clauses
26 / 121 i i i I If vj corresponds to literal xj = x, set xj = 1 i i i I If vj corresponds to literal xj = x, set xj = 0
I Each clause satisfied, and no variable-setting conflicts between clauses
Claim: If φ is satisfiable, G has an independent set of size k
Reduction for INDSET
Claim: If G has an independent set of size k, φ is satisfiable
0 I The independent set, say V , cannot have two vertices from the same clause 0 I Therefore, V has exactly one vertex from each of the k clauses
I No pair maps to literals x and x
27 / 121 i i i I If vj corresponds to literal xj = x, set xj = 0
I Each clause satisfied, and no variable-setting conflicts between clauses
Claim: If φ is satisfiable, G has an independent set of size k
Reduction for INDSET
Claim: If G has an independent set of size k, φ is satisfiable
0 I The independent set, say V , cannot have two vertices from the same clause 0 I Therefore, V has exactly one vertex from each of the k clauses
I No pair maps to literals x and x i i i I If vj corresponds to literal xj = x, set xj = 1
28 / 121 I Each clause satisfied, and no variable-setting conflicts between clauses
Claim: If φ is satisfiable, G has an independent set of size k
Reduction for INDSET
Claim: If G has an independent set of size k, φ is satisfiable
0 I The independent set, say V , cannot have two vertices from the same clause 0 I Therefore, V has exactly one vertex from each of the k clauses
I No pair maps to literals x and x i i i I If vj corresponds to literal xj = x, set xj = 1 i i i I If vj corresponds to literal xj = x, set xj = 0
29 / 121 Claim: If φ is satisfiable, G has an independent set of size k
Reduction for INDSET
Claim: If G has an independent set of size k, φ is satisfiable
0 I The independent set, say V , cannot have two vertices from the same clause 0 I Therefore, V has exactly one vertex from each of the k clauses
I No pair maps to literals x and x i i i I If vj corresponds to literal xj = x, set xj = 1 i i i I If vj corresponds to literal xj = x, set xj = 0
I Each clause satisfied, and no variable-setting conflicts between clauses
30 / 121 Reduction for INDSET
Claim: If G has an independent set of size k, φ is satisfiable
0 I The independent set, say V , cannot have two vertices from the same clause 0 I Therefore, V has exactly one vertex from each of the k clauses
I No pair maps to literals x and x i i i I If vj corresponds to literal xj = x, set xj = 1 i i i I If vj corresponds to literal xj = x, set xj = 0
I Each clause satisfied, and no variable-setting conflicts between clauses
Claim: If φ is satisfiable, G has an independent set of size k
31 / 121 Reduction from INDSET Given G, consider the complement graph G Claim: G has an indset of size k iff G has clique of size k
v3 v3
v2 v2
v4 v4
v1 v1
v5 v5
CLIQUE Claim CLIQUE : Given a graph G = (V , E) and a parameter k, does G have a clique of size k? The clique problem (CLIQUE ) is NP complete.
32 / 121 Given G, consider the complement graph G Claim: G has an indset of size k iff G has clique of size k
v3 v3
v2 v2
v4 v4
v1 v1
v5 v5
CLIQUE Claim CLIQUE : Given a graph G = (V , E) and a parameter k, does G have a clique of size k? The clique problem (CLIQUE ) is NP complete.
Reduction from INDSET
33 / 121 Claim: G has an indset of size k iff G has clique of size k
v3 v3
v2 v2
v4 v4
v1 v1
v5 v5
CLIQUE Claim CLIQUE : Given a graph G = (V , E) and a parameter k, does G have a clique of size k? The clique problem (CLIQUE ) is NP complete.
Reduction from INDSET Given G, consider the complement graph G
34 / 121 v3 v3
v2 v2
v4 v4
v1 v1
v5 v5
CLIQUE Claim CLIQUE : Given a graph G = (V , E) and a parameter k, does G have a clique of size k? The clique problem (CLIQUE ) is NP complete.
Reduction from INDSET Given G, consider the complement graph G Claim: G has an indset of size k iff G has clique of size k
35 / 121 CLIQUE Claim CLIQUE : Given a graph G = (V , E) and a parameter k, does G have a clique of size k? The clique problem (CLIQUE ) is NP complete.
Reduction from INDSET Given G, consider the complement graph G Claim: G has an indset of size k iff G has clique of size k
v3 v3
v2 v2
v4 v4
v1 v1
v5 v5
36 / 121 Construct a graph G = (V , E) as follows:
I Vertices: Each literal corresponds to a vertex.
I Edges: All vertices are connected with an edge except the vertices of the same clause and vertices with negated literals.
F xi , xj ∈ Ck does not have an edge.
F xi ∈ Ck , x¯i ∈ Cj does not have an edge.
Clique of size k in G iff 3-CNF satisfiable.
Same CLIQUE Reduction ‘Unrolled’
Reduce 3-CNF SAT to CLIQUE
i i i φ = C1 C2 ... Ck , where Ci = (x x x ) ∧ ∧ ∧ 1 ∨ 2 ∨ 3
37 / 121 I Vertices: Each literal corresponds to a vertex.
I Edges: All vertices are connected with an edge except the vertices of the same clause and vertices with negated literals.
F xi , xj ∈ Ck does not have an edge.
F xi ∈ Ck , x¯i ∈ Cj does not have an edge.
Clique of size k in G iff 3-CNF satisfiable.
Same CLIQUE Reduction ‘Unrolled’
Reduce 3-CNF SAT to CLIQUE
i i i φ = C1 C2 ... Ck , where Ci = (x x x ) ∧ ∧ ∧ 1 ∨ 2 ∨ 3
Construct a graph G = (V , E) as follows:
38 / 121 I Edges: All vertices are connected with an edge except the vertices of the same clause and vertices with negated literals.
F xi , xj ∈ Ck does not have an edge.
F xi ∈ Ck , x¯i ∈ Cj does not have an edge.
Clique of size k in G iff 3-CNF satisfiable.
Same CLIQUE Reduction ‘Unrolled’
Reduce 3-CNF SAT to CLIQUE
i i i φ = C1 C2 ... Ck , where Ci = (x x x ) ∧ ∧ ∧ 1 ∨ 2 ∨ 3
Construct a graph G = (V , E) as follows:
I Vertices: Each literal corresponds to a vertex.
39 / 121 F xi , xj ∈ Ck does not have an edge.
F xi ∈ Ck , x¯i ∈ Cj does not have an edge.
Clique of size k in G iff 3-CNF satisfiable.
Same CLIQUE Reduction ‘Unrolled’
Reduce 3-CNF SAT to CLIQUE
i i i φ = C1 C2 ... Ck , where Ci = (x x x ) ∧ ∧ ∧ 1 ∨ 2 ∨ 3
Construct a graph G = (V , E) as follows:
I Vertices: Each literal corresponds to a vertex.
I Edges: All vertices are connected with an edge except the vertices of the same clause and vertices with negated literals.
40 / 121 F xi ∈ Ck , x¯i ∈ Cj does not have an edge.
Clique of size k in G iff 3-CNF satisfiable.
Same CLIQUE Reduction ‘Unrolled’
Reduce 3-CNF SAT to CLIQUE
i i i φ = C1 C2 ... Ck , where Ci = (x x x ) ∧ ∧ ∧ 1 ∨ 2 ∨ 3
Construct a graph G = (V , E) as follows:
I Vertices: Each literal corresponds to a vertex.
I Edges: All vertices are connected with an edge except the vertices of the same clause and vertices with negated literals.
F xi , xj ∈ Ck does not have an edge.
41 / 121 Clique of size k in G iff 3-CNF satisfiable.
Same CLIQUE Reduction ‘Unrolled’
Reduce 3-CNF SAT to CLIQUE
i i i φ = C1 C2 ... Ck , where Ci = (x x x ) ∧ ∧ ∧ 1 ∨ 2 ∨ 3
Construct a graph G = (V , E) as follows:
I Vertices: Each literal corresponds to a vertex.
I Edges: All vertices are connected with an edge except the vertices of the same clause and vertices with negated literals.
F xi , xj ∈ Ck does not have an edge.
F xi ∈ Ck , x¯i ∈ Cj does not have an edge.
42 / 121 Same CLIQUE Reduction ‘Unrolled’
Reduce 3-CNF SAT to CLIQUE
i i i φ = C1 C2 ... Ck , where Ci = (x x x ) ∧ ∧ ∧ 1 ∨ 2 ∨ 3
Construct a graph G = (V , E) as follows:
I Vertices: Each literal corresponds to a vertex.
I Edges: All vertices are connected with an edge except the vertices of the same clause and vertices with negated literals.
F xi , xj ∈ Ck does not have an edge.
F xi ∈ Ck , x¯i ∈ Cj does not have an edge.
Clique of size k in G iff 3-CNF satisfiable.
43 / 121 Example Clique Reduction
φ = (x x x ) (x x x ) (x x ) 1 ∨ 2 ∨ 3 ∧ 1 ∨ 3 ∨ 4 ∧ 2 ∨ 4
x1 x2 x3
x3 x4
x1
x2 x4
44 / 121 Vertex Cover Definition A Vertex Cover of an undirected graph G = (V , E) is a subset V 0 of vertex set V of the vertices of G which contains at least one of the two end points of each edge.
0 0 0 V V : (vi , vj ) E : vi V vj V ⊆ ∀ ∈ ∈ ∨ ∈
45 / 121 Note that VERTEX-COVER is in NP
We reduce 3-CNF SAT to VERTEX-COVER
VERTEX-COVER
Claim VERTEX-COVER : Given a graph G = (V , E) and a parameter k, does G have a vertex cover of size k? The vertex cover problem (VERTEX-COVER ) is NP complete.
46 / 121 We reduce 3-CNF SAT to VERTEX-COVER
VERTEX-COVER
Claim VERTEX-COVER : Given a graph G = (V , E) and a parameter k, does G have a vertex cover of size k? The vertex cover problem (VERTEX-COVER ) is NP complete.
Note that VERTEX-COVER is in NP
47 / 121 VERTEX-COVER
Claim VERTEX-COVER : Given a graph G = (V , E) and a parameter k, does G have a vertex cover of size k? The vertex cover problem (VERTEX-COVER ) is NP complete.
Note that VERTEX-COVER is in NP
We reduce 3-CNF SAT to VERTEX-COVER
48 / 121 Construct a graph G = (V , E) as follows:
1 0 I Variable vertices: Each variable xi creates two vertices vi , vi
I Edge vertices: Each clause j nj creates a set V ( j ) of nj vertices C C 1 0 I Edges: For all xi , (v , v ) E i i ∈ I Edges: Add all possible edges between each set V ( j ) C I Edges: For each literal xi j , connect its vertex in j to the corresponding literal vertex.∈ C C
I k = n + 2m
Question: Does G have a vertex-cover of size k?
Reduction for VERTEX-COVER
i i i φ = 1 2 ... m, where i = (x x x ) C ∧ C ∧ ∧ C C 1 ∨ 2 ∨ 3
49 / 121 1 0 I Variable vertices: Each variable xi creates two vertices vi , vi
I Edge vertices: Each clause j nj creates a set V ( j ) of nj vertices C C 1 0 I Edges: For all xi , (v , v ) E i i ∈ I Edges: Add all possible edges between each set V ( j ) C I Edges: For each literal xi j , connect its vertex in j to the corresponding literal vertex.∈ C C
I k = n + 2m
Question: Does G have a vertex-cover of size k?
Reduction for VERTEX-COVER
i i i φ = 1 2 ... m, where i = (x x x ) C ∧ C ∧ ∧ C C 1 ∨ 2 ∨ 3
Construct a graph G = (V , E) as follows:
50 / 121 I Edge vertices: Each clause j nj creates a set V ( j ) of nj vertices C C 1 0 I Edges: For all xi , (v , v ) E i i ∈ I Edges: Add all possible edges between each set V ( j ) C I Edges: For each literal xi j , connect its vertex in j to the corresponding literal vertex.∈ C C
I k = n + 2m
Question: Does G have a vertex-cover of size k?
Reduction for VERTEX-COVER
i i i φ = 1 2 ... m, where i = (x x x ) C ∧ C ∧ ∧ C C 1 ∨ 2 ∨ 3
Construct a graph G = (V , E) as follows:
1 0 I Variable vertices: Each variable xi creates two vertices vi , vi
51 / 121 1 0 I Edges: For all xi , (v , v ) E i i ∈ I Edges: Add all possible edges between each set V ( j ) C I Edges: For each literal xi j , connect its vertex in j to the corresponding literal vertex.∈ C C
I k = n + 2m
Question: Does G have a vertex-cover of size k?
Reduction for VERTEX-COVER
i i i φ = 1 2 ... m, where i = (x x x ) C ∧ C ∧ ∧ C C 1 ∨ 2 ∨ 3
Construct a graph G = (V , E) as follows:
1 0 I Variable vertices: Each variable xi creates two vertices vi , vi
I Edge vertices: Each clause j nj creates a set V ( j ) of nj vertices C C
52 / 121 I Edges: Add all possible edges between each set V ( j ) C I Edges: For each literal xi j , connect its vertex in j to the corresponding literal vertex.∈ C C
I k = n + 2m
Question: Does G have a vertex-cover of size k?
Reduction for VERTEX-COVER
i i i φ = 1 2 ... m, where i = (x x x ) C ∧ C ∧ ∧ C C 1 ∨ 2 ∨ 3
Construct a graph G = (V , E) as follows:
1 0 I Variable vertices: Each variable xi creates two vertices vi , vi
I Edge vertices: Each clause j nj creates a set V ( j ) of nj vertices C C 1 0 I Edges: For all xi , (v , v ) E i i ∈
53 / 121 I Edges: For each literal xi j , connect its vertex in j to the corresponding literal vertex.∈ C C
I k = n + 2m
Question: Does G have a vertex-cover of size k?
Reduction for VERTEX-COVER
i i i φ = 1 2 ... m, where i = (x x x ) C ∧ C ∧ ∧ C C 1 ∨ 2 ∨ 3
Construct a graph G = (V , E) as follows:
1 0 I Variable vertices: Each variable xi creates two vertices vi , vi
I Edge vertices: Each clause j nj creates a set V ( j ) of nj vertices C C 1 0 I Edges: For all xi , (v , v ) E i i ∈ I Edges: Add all possible edges between each set V ( j ) C
54 / 121 I k = n + 2m
Question: Does G have a vertex-cover of size k?
Reduction for VERTEX-COVER
i i i φ = 1 2 ... m, where i = (x x x ) C ∧ C ∧ ∧ C C 1 ∨ 2 ∨ 3
Construct a graph G = (V , E) as follows:
1 0 I Variable vertices: Each variable xi creates two vertices vi , vi
I Edge vertices: Each clause j nj creates a set V ( j ) of nj vertices C C 1 0 I Edges: For all xi , (v , v ) E i i ∈ I Edges: Add all possible edges between each set V ( j ) C I Edges: For each literal xi j , connect its vertex in j to the corresponding literal vertex.∈ C C
55 / 121 Question: Does G have a vertex-cover of size k?
Reduction for VERTEX-COVER
i i i φ = 1 2 ... m, where i = (x x x ) C ∧ C ∧ ∧ C C 1 ∨ 2 ∨ 3
Construct a graph G = (V , E) as follows:
1 0 I Variable vertices: Each variable xi creates two vertices vi , vi
I Edge vertices: Each clause j nj creates a set V ( j ) of nj vertices C C 1 0 I Edges: For all xi , (v , v ) E i i ∈ I Edges: Add all possible edges between each set V ( j ) C I Edges: For each literal xi j , connect its vertex in j to the corresponding literal vertex.∈ C C
I k = n + 2m
56 / 121 Reduction for VERTEX-COVER
i i i φ = 1 2 ... m, where i = (x x x ) C ∧ C ∧ ∧ C C 1 ∨ 2 ∨ 3
Construct a graph G = (V , E) as follows:
1 0 I Variable vertices: Each variable xi creates two vertices vi , vi
I Edge vertices: Each clause j nj creates a set V ( j ) of nj vertices C C 1 0 I Edges: For all xi , (v , v ) E i i ∈ I Edges: Add all possible edges between each set V ( j ) C I Edges: For each literal xi j , connect its vertex in j to the corresponding literal vertex.∈ C C
I k = n + 2m
Question: Does G have a vertex-cover of size k?
57 / 121 Reduction for VERTEX-COVER
(x1 x2 x3) (x1 x3 x4) (x2 x4 x1), n = 4, m = 3 ∨ ∨ ∧ ∨ ∨ ∧ ∨ ∨
58 / 121 Reduction for VERTEX-COVER
(x1 x2 x3) (x1 x3 x4) (x2 x4 x1), n = 4, m = 3 ∨ ∨ ∧ ∨ ∨ ∧ ∨ ∨
v1 v1 v2 v2 v3 v3 v4 v4
59 / 121 Reduction for VERTEX-COVER
(x1 x2 x3) (x1 x3 x4) (x2 x4 x1), n = 4, m = 3 ∨ ∨ ∧ ∨ ∨ ∧ ∨ ∨
v1 v1 v2 v2 v3 v3 v4 v4
x2 x4 x3 x1 x1 x2 x3 x1 x4
60 / 121 Reduction for VERTEX-COVER
(x1 x2 x3) (x1 x3 x4) (x2 x4 x1), n = 4, m = 3 ∨ ∨ ∧ ∨ ∨ ∧ ∨ ∨
v1 v1 v2 v2 v3 v3 v4 v4
x2 x4 x3 x1 x1 x2 x3 x1 x4
61 / 121 0 If variable xi = 0, pick vi to be in the vertex cover 1 If variable xi = 1, pick vi to be in the vertex cover j Each clause j has at least one literal, say x2, set to true. C j I Don’t pick edge vertex of xi , pick other two edge vertices Claim: The picked vertices cover all the edges of G. Clearly, the number of vertices picked is n + 2m. An edge between two variable vertices is covered
I For each i, exactly one of the variable vertices picked.
For each j , edges to the picked vertices covered. C j Crucial: What about the edges incident upon x2? I Edges within its clause covered by the other two picked vertices j 1 j I Remaining edge of the form: (xi , vi ) if xi is un-negated. 1 I We know that vi is picked, since vi = 1.
Reduction for VERTEX-COVER Claim: If φ is satisfiable, then a vertex cover of size k = n + 2m ∃
62 / 121 1 If variable xi = 1, pick vi to be in the vertex cover j Each clause j has at least one literal, say x2, set to true. C j I Don’t pick edge vertex of xi , pick other two edge vertices Claim: The picked vertices cover all the edges of G. Clearly, the number of vertices picked is n + 2m. An edge between two variable vertices is covered
I For each i, exactly one of the variable vertices picked.
For each j , edges to the picked vertices covered. C j Crucial: What about the edges incident upon x2? I Edges within its clause covered by the other two picked vertices j 1 j I Remaining edge of the form: (xi , vi ) if xi is un-negated. 1 I We know that vi is picked, since vi = 1.
Reduction for VERTEX-COVER Claim: If φ is satisfiable, then a vertex cover of size k = n + 2m 0 ∃ If variable xi = 0, pick vi to be in the vertex cover
63 / 121 j Each clause j has at least one literal, say x2, set to true. C j I Don’t pick edge vertex of xi , pick other two edge vertices Claim: The picked vertices cover all the edges of G. Clearly, the number of vertices picked is n + 2m. An edge between two variable vertices is covered
I For each i, exactly one of the variable vertices picked.
For each j , edges to the picked vertices covered. C j Crucial: What about the edges incident upon x2? I Edges within its clause covered by the other two picked vertices j 1 j I Remaining edge of the form: (xi , vi ) if xi is un-negated. 1 I We know that vi is picked, since vi = 1.
Reduction for VERTEX-COVER Claim: If φ is satisfiable, then a vertex cover of size k = n + 2m 0 ∃ If variable xi = 0, pick vi to be in the vertex cover 1 If variable xi = 1, pick vi to be in the vertex cover
64 / 121 j I Don’t pick edge vertex of xi , pick other two edge vertices Claim: The picked vertices cover all the edges of G. Clearly, the number of vertices picked is n + 2m. An edge between two variable vertices is covered
I For each i, exactly one of the variable vertices picked.
For each j , edges to the picked vertices covered. C j Crucial: What about the edges incident upon x2? I Edges within its clause covered by the other two picked vertices j 1 j I Remaining edge of the form: (xi , vi ) if xi is un-negated. 1 I We know that vi is picked, since vi = 1.
Reduction for VERTEX-COVER Claim: If φ is satisfiable, then a vertex cover of size k = n + 2m 0 ∃ If variable xi = 0, pick vi to be in the vertex cover 1 If variable xi = 1, pick vi to be in the vertex cover j Each clause j has at least one literal, say x , set to true. C 2
65 / 121 Claim: The picked vertices cover all the edges of G. Clearly, the number of vertices picked is n + 2m. An edge between two variable vertices is covered
I For each i, exactly one of the variable vertices picked.
For each j , edges to the picked vertices covered. C j Crucial: What about the edges incident upon x2? I Edges within its clause covered by the other two picked vertices j 1 j I Remaining edge of the form: (xi , vi ) if xi is un-negated. 1 I We know that vi is picked, since vi = 1.
Reduction for VERTEX-COVER Claim: If φ is satisfiable, then a vertex cover of size k = n + 2m 0 ∃ If variable xi = 0, pick vi to be in the vertex cover 1 If variable xi = 1, pick vi to be in the vertex cover j Each clause j has at least one literal, say x2, set to true. C j I Don’t pick edge vertex of xi , pick other two edge vertices
66 / 121 Clearly, the number of vertices picked is n + 2m. An edge between two variable vertices is covered
I For each i, exactly one of the variable vertices picked.
For each j , edges to the picked vertices covered. C j Crucial: What about the edges incident upon x2? I Edges within its clause covered by the other two picked vertices j 1 j I Remaining edge of the form: (xi , vi ) if xi is un-negated. 1 I We know that vi is picked, since vi = 1.
Reduction for VERTEX-COVER Claim: If φ is satisfiable, then a vertex cover of size k = n + 2m 0 ∃ If variable xi = 0, pick vi to be in the vertex cover 1 If variable xi = 1, pick vi to be in the vertex cover j Each clause j has at least one literal, say x2, set to true. C j I Don’t pick edge vertex of xi , pick other two edge vertices Claim: The picked vertices cover all the edges of G.
67 / 121 An edge between two variable vertices is covered
I For each i, exactly one of the variable vertices picked.
For each j , edges to the picked vertices covered. C j Crucial: What about the edges incident upon x2? I Edges within its clause covered by the other two picked vertices j 1 j I Remaining edge of the form: (xi , vi ) if xi is un-negated. 1 I We know that vi is picked, since vi = 1.
Reduction for VERTEX-COVER Claim: If φ is satisfiable, then a vertex cover of size k = n + 2m 0 ∃ If variable xi = 0, pick vi to be in the vertex cover 1 If variable xi = 1, pick vi to be in the vertex cover j Each clause j has at least one literal, say x2, set to true. C j I Don’t pick edge vertex of xi , pick other two edge vertices Claim: The picked vertices cover all the edges of G. Clearly, the number of vertices picked is n + 2m.
68 / 121 I For each i, exactly one of the variable vertices picked.
For each j , edges to the picked vertices covered. C j Crucial: What about the edges incident upon x2? I Edges within its clause covered by the other two picked vertices j 1 j I Remaining edge of the form: (xi , vi ) if xi is un-negated. 1 I We know that vi is picked, since vi = 1.
Reduction for VERTEX-COVER Claim: If φ is satisfiable, then a vertex cover of size k = n + 2m 0 ∃ If variable xi = 0, pick vi to be in the vertex cover 1 If variable xi = 1, pick vi to be in the vertex cover j Each clause j has at least one literal, say x2, set to true. C j I Don’t pick edge vertex of xi , pick other two edge vertices Claim: The picked vertices cover all the edges of G. Clearly, the number of vertices picked is n + 2m. An edge between two variable vertices is covered
69 / 121 For each j , edges to the picked vertices covered. C j Crucial: What about the edges incident upon x2? I Edges within its clause covered by the other two picked vertices j 1 j I Remaining edge of the form: (xi , vi ) if xi is un-negated. 1 I We know that vi is picked, since vi = 1.
Reduction for VERTEX-COVER Claim: If φ is satisfiable, then a vertex cover of size k = n + 2m 0 ∃ If variable xi = 0, pick vi to be in the vertex cover 1 If variable xi = 1, pick vi to be in the vertex cover j Each clause j has at least one literal, say x2, set to true. C j I Don’t pick edge vertex of xi , pick other two edge vertices Claim: The picked vertices cover all the edges of G. Clearly, the number of vertices picked is n + 2m. An edge between two variable vertices is covered
I For each i, exactly one of the variable vertices picked.
70 / 121 j Crucial: What about the edges incident upon x2? I Edges within its clause covered by the other two picked vertices j 1 j I Remaining edge of the form: (xi , vi ) if xi is un-negated. 1 I We know that vi is picked, since vi = 1.
Reduction for VERTEX-COVER Claim: If φ is satisfiable, then a vertex cover of size k = n + 2m 0 ∃ If variable xi = 0, pick vi to be in the vertex cover 1 If variable xi = 1, pick vi to be in the vertex cover j Each clause j has at least one literal, say x2, set to true. C j I Don’t pick edge vertex of xi , pick other two edge vertices Claim: The picked vertices cover all the edges of G. Clearly, the number of vertices picked is n + 2m. An edge between two variable vertices is covered
I For each i, exactly one of the variable vertices picked.
For each j , edges to the picked vertices covered. C
71 / 121 I Edges within its clause covered by the other two picked vertices j 1 j I Remaining edge of the form: (xi , vi ) if xi is un-negated. 1 I We know that vi is picked, since vi = 1.
Reduction for VERTEX-COVER Claim: If φ is satisfiable, then a vertex cover of size k = n + 2m 0 ∃ If variable xi = 0, pick vi to be in the vertex cover 1 If variable xi = 1, pick vi to be in the vertex cover j Each clause j has at least one literal, say x2, set to true. C j I Don’t pick edge vertex of xi , pick other two edge vertices Claim: The picked vertices cover all the edges of G. Clearly, the number of vertices picked is n + 2m. An edge between two variable vertices is covered
I For each i, exactly one of the variable vertices picked.
For each j , edges to the picked vertices covered. C j Crucial: What about the edges incident upon x2?
72 / 121 j 1 j I Remaining edge of the form: (xi , vi ) if xi is un-negated. 1 I We know that vi is picked, since vi = 1.
Reduction for VERTEX-COVER Claim: If φ is satisfiable, then a vertex cover of size k = n + 2m 0 ∃ If variable xi = 0, pick vi to be in the vertex cover 1 If variable xi = 1, pick vi to be in the vertex cover j Each clause j has at least one literal, say x2, set to true. C j I Don’t pick edge vertex of xi , pick other two edge vertices Claim: The picked vertices cover all the edges of G. Clearly, the number of vertices picked is n + 2m. An edge between two variable vertices is covered
I For each i, exactly one of the variable vertices picked.
For each j , edges to the picked vertices covered. C j Crucial: What about the edges incident upon x2? I Edges within its clause covered by the other two picked vertices
73 / 121 1 I We know that vi is picked, since vi = 1.
Reduction for VERTEX-COVER Claim: If φ is satisfiable, then a vertex cover of size k = n + 2m 0 ∃ If variable xi = 0, pick vi to be in the vertex cover 1 If variable xi = 1, pick vi to be in the vertex cover j Each clause j has at least one literal, say x2, set to true. C j I Don’t pick edge vertex of xi , pick other two edge vertices Claim: The picked vertices cover all the edges of G. Clearly, the number of vertices picked is n + 2m. An edge between two variable vertices is covered
I For each i, exactly one of the variable vertices picked.
For each j , edges to the picked vertices covered. C j Crucial: What about the edges incident upon x2? I Edges within its clause covered by the other two picked vertices j 1 j I Remaining edge of the form: (xi , vi ) if xi is un-negated.
74 / 121 Reduction for VERTEX-COVER Claim: If φ is satisfiable, then a vertex cover of size k = n + 2m 0 ∃ If variable xi = 0, pick vi to be in the vertex cover 1 If variable xi = 1, pick vi to be in the vertex cover j Each clause j has at least one literal, say x2, set to true. C j I Don’t pick edge vertex of xi , pick other two edge vertices Claim: The picked vertices cover all the edges of G. Clearly, the number of vertices picked is n + 2m. An edge between two variable vertices is covered
I For each i, exactly one of the variable vertices picked.
For each j , edges to the picked vertices covered. C j Crucial: What about the edges incident upon x2? I Edges within its clause covered by the other two picked vertices j 1 j I Remaining edge of the form: (xi , vi ) if xi is un-negated. 1 I We know that vi is picked, since vi = 1.
75 / 121 For each i, at least one of the variable vertices in vertex cover.
In each set V (Cj ), at least 2 vertices in vertex cover This already makes n + 2m vertices! Exactly one vertex not picked in each clause
Consider the clause (x1 x2 x3) ∨ ∨ Lets say x1 and x2 were picked in vertex cover
The edge (x3, v 3) must be covered
Therefore v 3 must be in the vertex cover.
Then set the boolean variable x3 = 0 Similarly, whichever vertex not picked in cover, set corresponding literal to 1 Thus, setting variables as above, each clause satisfied
Reduction for VERTEX-COVER
Claim: If a vertex cover of size k = n + 2m, then φ satisfiable ∃
76 / 121 In each set V (Cj ), at least 2 vertices in vertex cover This already makes n + 2m vertices! Exactly one vertex not picked in each clause
Consider the clause (x1 x2 x3) ∨ ∨ Lets say x1 and x2 were picked in vertex cover
The edge (x3, v 3) must be covered
Therefore v 3 must be in the vertex cover.
Then set the boolean variable x3 = 0 Similarly, whichever vertex not picked in cover, set corresponding literal to 1 Thus, setting variables as above, each clause satisfied
Reduction for VERTEX-COVER
Claim: If a vertex cover of size k = n + 2m, then φ satisfiable ∃ For each i, at least one of the variable vertices in vertex cover.
77 / 121 This already makes n + 2m vertices! Exactly one vertex not picked in each clause
Consider the clause (x1 x2 x3) ∨ ∨ Lets say x1 and x2 were picked in vertex cover
The edge (x3, v 3) must be covered
Therefore v 3 must be in the vertex cover.
Then set the boolean variable x3 = 0 Similarly, whichever vertex not picked in cover, set corresponding literal to 1 Thus, setting variables as above, each clause satisfied
Reduction for VERTEX-COVER
Claim: If a vertex cover of size k = n + 2m, then φ satisfiable ∃ For each i, at least one of the variable vertices in vertex cover.
In each set V (Cj ), at least 2 vertices in vertex cover
78 / 121 Exactly one vertex not picked in each clause
Consider the clause (x1 x2 x3) ∨ ∨ Lets say x1 and x2 were picked in vertex cover
The edge (x3, v 3) must be covered
Therefore v 3 must be in the vertex cover.
Then set the boolean variable x3 = 0 Similarly, whichever vertex not picked in cover, set corresponding literal to 1 Thus, setting variables as above, each clause satisfied
Reduction for VERTEX-COVER
Claim: If a vertex cover of size k = n + 2m, then φ satisfiable ∃ For each i, at least one of the variable vertices in vertex cover.
In each set V (Cj ), at least 2 vertices in vertex cover This already makes n + 2m vertices!
79 / 121 Consider the clause (x1 x2 x3) ∨ ∨ Lets say x1 and x2 were picked in vertex cover
The edge (x3, v 3) must be covered
Therefore v 3 must be in the vertex cover.
Then set the boolean variable x3 = 0 Similarly, whichever vertex not picked in cover, set corresponding literal to 1 Thus, setting variables as above, each clause satisfied
Reduction for VERTEX-COVER
Claim: If a vertex cover of size k = n + 2m, then φ satisfiable ∃ For each i, at least one of the variable vertices in vertex cover.
In each set V (Cj ), at least 2 vertices in vertex cover This already makes n + 2m vertices! Exactly one vertex not picked in each clause
80 / 121 Lets say x1 and x2 were picked in vertex cover
The edge (x3, v 3) must be covered
Therefore v 3 must be in the vertex cover.
Then set the boolean variable x3 = 0 Similarly, whichever vertex not picked in cover, set corresponding literal to 1 Thus, setting variables as above, each clause satisfied
Reduction for VERTEX-COVER
Claim: If a vertex cover of size k = n + 2m, then φ satisfiable ∃ For each i, at least one of the variable vertices in vertex cover.
In each set V (Cj ), at least 2 vertices in vertex cover This already makes n + 2m vertices! Exactly one vertex not picked in each clause
Consider the clause (x1 x2 x3) ∨ ∨
81 / 121 The edge (x3, v 3) must be covered
Therefore v 3 must be in the vertex cover.
Then set the boolean variable x3 = 0 Similarly, whichever vertex not picked in cover, set corresponding literal to 1 Thus, setting variables as above, each clause satisfied
Reduction for VERTEX-COVER
Claim: If a vertex cover of size k = n + 2m, then φ satisfiable ∃ For each i, at least one of the variable vertices in vertex cover.
In each set V (Cj ), at least 2 vertices in vertex cover This already makes n + 2m vertices! Exactly one vertex not picked in each clause
Consider the clause (x1 x2 x3) ∨ ∨ Lets say x1 and x2 were picked in vertex cover
82 / 121 Therefore v 3 must be in the vertex cover.
Then set the boolean variable x3 = 0 Similarly, whichever vertex not picked in cover, set corresponding literal to 1 Thus, setting variables as above, each clause satisfied
Reduction for VERTEX-COVER
Claim: If a vertex cover of size k = n + 2m, then φ satisfiable ∃ For each i, at least one of the variable vertices in vertex cover.
In each set V (Cj ), at least 2 vertices in vertex cover This already makes n + 2m vertices! Exactly one vertex not picked in each clause
Consider the clause (x1 x2 x3) ∨ ∨ Lets say x1 and x2 were picked in vertex cover
The edge (x3, v 3) must be covered
83 / 121 Then set the boolean variable x3 = 0 Similarly, whichever vertex not picked in cover, set corresponding literal to 1 Thus, setting variables as above, each clause satisfied
Reduction for VERTEX-COVER
Claim: If a vertex cover of size k = n + 2m, then φ satisfiable ∃ For each i, at least one of the variable vertices in vertex cover.
In each set V (Cj ), at least 2 vertices in vertex cover This already makes n + 2m vertices! Exactly one vertex not picked in each clause
Consider the clause (x1 x2 x3) ∨ ∨ Lets say x1 and x2 were picked in vertex cover
The edge (x3, v 3) must be covered
Therefore v 3 must be in the vertex cover.
84 / 121 Similarly, whichever vertex not picked in cover, set corresponding literal to 1 Thus, setting variables as above, each clause satisfied
Reduction for VERTEX-COVER
Claim: If a vertex cover of size k = n + 2m, then φ satisfiable ∃ For each i, at least one of the variable vertices in vertex cover.
In each set V (Cj ), at least 2 vertices in vertex cover This already makes n + 2m vertices! Exactly one vertex not picked in each clause
Consider the clause (x1 x2 x3) ∨ ∨ Lets say x1 and x2 were picked in vertex cover
The edge (x3, v 3) must be covered
Therefore v 3 must be in the vertex cover.
Then set the boolean variable x3 = 0
85 / 121 Thus, setting variables as above, each clause satisfied
Reduction for VERTEX-COVER
Claim: If a vertex cover of size k = n + 2m, then φ satisfiable ∃ For each i, at least one of the variable vertices in vertex cover.
In each set V (Cj ), at least 2 vertices in vertex cover This already makes n + 2m vertices! Exactly one vertex not picked in each clause
Consider the clause (x1 x2 x3) ∨ ∨ Lets say x1 and x2 were picked in vertex cover
The edge (x3, v 3) must be covered
Therefore v 3 must be in the vertex cover.
Then set the boolean variable x3 = 0 Similarly, whichever vertex not picked in cover, set corresponding literal to 1
86 / 121 Reduction for VERTEX-COVER
Claim: If a vertex cover of size k = n + 2m, then φ satisfiable ∃ For each i, at least one of the variable vertices in vertex cover.
In each set V (Cj ), at least 2 vertices in vertex cover This already makes n + 2m vertices! Exactly one vertex not picked in each clause
Consider the clause (x1 x2 x3) ∨ ∨ Lets say x1 and x2 were picked in vertex cover
The edge (x3, v 3) must be covered
Therefore v 3 must be in the vertex cover.
Then set the boolean variable x3 = 0 Similarly, whichever vertex not picked in cover, set corresponding literal to 1 Thus, setting variables as above, each clause satisfied
87 / 121 Let I = v1, v2,..., vn−k be INDSET of size n k { } − I There is no edge in G with both endpoints in I
I So if we pick the remaining k vertices, all edges covered
0 V = v1, v2,..., vk is a vertex cover of size k { } 0 I Each edge in G has at least one endpoint in V
I So the remaining n k vertices form an independent set −
Another reduction for VERTEX-COVER
Claim V 0 is a vertex cover of size k in G = (V , E) iff V V 0 of size (n k) is an independent set. \ −
88 / 121 I There is no edge in G with both endpoints in I
I So if we pick the remaining k vertices, all edges covered
0 V = v1, v2,..., vk is a vertex cover of size k { } 0 I Each edge in G has at least one endpoint in V
I So the remaining n k vertices form an independent set −
Another reduction for VERTEX-COVER
Claim V 0 is a vertex cover of size k in G = (V , E) iff V V 0 of size (n k) is an independent set. \ −
Let I = v1, v2,..., vn−k be INDSET of size n k { } −
89 / 121 I So if we pick the remaining k vertices, all edges covered
0 V = v1, v2,..., vk is a vertex cover of size k { } 0 I Each edge in G has at least one endpoint in V
I So the remaining n k vertices form an independent set −
Another reduction for VERTEX-COVER
Claim V 0 is a vertex cover of size k in G = (V , E) iff V V 0 of size (n k) is an independent set. \ −
Let I = v1, v2,..., vn−k be INDSET of size n k { } − I There is no edge in G with both endpoints in I
90 / 121 0 V = v1, v2,..., vk is a vertex cover of size k { } 0 I Each edge in G has at least one endpoint in V
I So the remaining n k vertices form an independent set −
Another reduction for VERTEX-COVER
Claim V 0 is a vertex cover of size k in G = (V , E) iff V V 0 of size (n k) is an independent set. \ −
Let I = v1, v2,..., vn−k be INDSET of size n k { } − I There is no edge in G with both endpoints in I
I So if we pick the remaining k vertices, all edges covered
91 / 121 0 I Each edge in G has at least one endpoint in V
I So the remaining n k vertices form an independent set −
Another reduction for VERTEX-COVER
Claim V 0 is a vertex cover of size k in G = (V , E) iff V V 0 of size (n k) is an independent set. \ −
Let I = v1, v2,..., vn−k be INDSET of size n k { } − I There is no edge in G with both endpoints in I
I So if we pick the remaining k vertices, all edges covered
0 V = v1, v2,..., vk is a vertex cover of size k { }
92 / 121 I So the remaining n k vertices form an independent set −
Another reduction for VERTEX-COVER
Claim V 0 is a vertex cover of size k in G = (V , E) iff V V 0 of size (n k) is an independent set. \ −
Let I = v1, v2,..., vn−k be INDSET of size n k { } − I There is no edge in G with both endpoints in I
I So if we pick the remaining k vertices, all edges covered
0 V = v1, v2,..., vk is a vertex cover of size k { } 0 I Each edge in G has at least one endpoint in V
93 / 121 Another reduction for VERTEX-COVER
Claim V 0 is a vertex cover of size k in G = (V , E) iff V V 0 of size (n k) is an independent set. \ −
Let I = v1, v2,..., vn−k be INDSET of size n k { } − I There is no edge in G with both endpoints in I
I So if we pick the remaining k vertices, all edges covered
0 V = v1, v2,..., vk is a vertex cover of size k { } 0 I Each edge in G has at least one endpoint in V
I So the remaining n k vertices form an independent set −
94 / 121 S1 S4 8 1 H1 S2 12 7 15
6 9 3 S3 14
10 H2
Reduction from? Consider each set having size two!
HITTING-SET
Claim HITTING-SET : A collection C of subsets of a set V , and parameter k, find a hitting set V 0 V of size k. ⊆ The hitting set problem (HITTING-SET ) is NP complete.
95 / 121 Reduction from? Consider each set having size two!
HITTING-SET
Claim HITTING-SET : A collection C of subsets of a set V , and parameter k, find a hitting set V 0 V of size k. ⊆ The hitting set problem (HITTING-SET ) is NP complete.
S1 S4 8 1 H1 S2 12 7 15
6 9 3 S3 14
10 H2
96 / 121 Consider each set having size two!
HITTING-SET
Claim HITTING-SET : A collection C of subsets of a set V , and parameter k, find a hitting set V 0 V of size k. ⊆ The hitting set problem (HITTING-SET ) is NP complete.
S1 S4 8 1 H1 S2 12 7 15
6 9 3 S3 14
10 H2
Reduction from?
97 / 121 HITTING-SET
Claim HITTING-SET : A collection C of subsets of a set V , and parameter k, find a hitting set V 0 V of size k. ⊆ The hitting set problem (HITTING-SET ) is NP complete.
S1 S4 8 1 H1 S2 12 7 15
6 9 3 S3 14
10 H2
Reduction from? Consider each set having size two!
98 / 121 u1 + 4u2 32u3 34 − ≥ 2u2 2u4 + 7u3 239 − ≤ 43u4 2u1 + 17u2 17 − ≥
Note that INTEGER-PROGRAMMING is in NP Reduction from 3-CNF SAT
INTEGER-PROGRAMMING
Claim INTEGER-PROGRAMMING : Given a set of linear inequalities over variables v1,..., vn, does there exist an satisfying assignment of vi to positive integers The integer programming problem is NP complete.
99 / 121 2u2 2u4 + 7u3 239 − ≤ 43u4 2u1 + 17u2 17 − ≥
Note that INTEGER-PROGRAMMING is in NP Reduction from 3-CNF SAT
INTEGER-PROGRAMMING
Claim INTEGER-PROGRAMMING : Given a set of linear inequalities over variables v1,..., vn, does there exist an satisfying assignment of vi to positive integers The integer programming problem is NP complete.
u1 + 4u2 32u3 34 − ≥
100 / 121 43u4 2u1 + 17u2 17 − ≥
Note that INTEGER-PROGRAMMING is in NP Reduction from 3-CNF SAT
INTEGER-PROGRAMMING
Claim INTEGER-PROGRAMMING : Given a set of linear inequalities over variables v1,..., vn, does there exist an satisfying assignment of vi to positive integers The integer programming problem is NP complete.
u1 + 4u2 32u3 34 − ≥ 2u2 2u4 + 7u3 239 − ≤
101 / 121 Note that INTEGER-PROGRAMMING is in NP Reduction from 3-CNF SAT
INTEGER-PROGRAMMING
Claim INTEGER-PROGRAMMING : Given a set of linear inequalities over variables v1,..., vn, does there exist an satisfying assignment of vi to positive integers The integer programming problem is NP complete.
u1 + 4u2 32u3 34 − ≥ 2u2 2u4 + 7u3 239 − ≤ 43u4 2u1 + 17u2 17 − ≥
102 / 121 Reduction from 3-CNF SAT
INTEGER-PROGRAMMING
Claim INTEGER-PROGRAMMING : Given a set of linear inequalities over variables v1,..., vn, does there exist an satisfying assignment of vi to positive integers The integer programming problem is NP complete.
u1 + 4u2 32u3 34 − ≥ 2u2 2u4 + 7u3 239 − ≤ 43u4 2u1 + 17u2 17 − ≥
Note that INTEGER-PROGRAMMING is in NP
103 / 121 INTEGER-PROGRAMMING
Claim INTEGER-PROGRAMMING : Given a set of linear inequalities over variables v1,..., vn, does there exist an satisfying assignment of vi to positive integers The integer programming problem is NP complete.
u1 + 4u2 32u3 34 − ≥ 2u2 2u4 + 7u3 239 − ≤ 43u4 2u1 + 17u2 17 − ≥
Note that INTEGER-PROGRAMMING is in NP Reduction from 3-CNF SAT
104 / 121 Given φ, construct the set of inequalities as following:
I Each boolean variable xi becomes integer variable vi I Each clause becomes an equation set to be greater than 1:
xi vi , xi (1 vi ), + → → − ∨ →
0 v1 1, 0 v2 1, 0 v3 1, 0 v4 1 ≤ ≤ ≤ ≤ ≤ ≤ ≤ ≤
Reduction for INTEGER-PROGRAMMING
i i i φ = 1 2 ... m, where i = (x x x ) C ∧ C ∧ ∧ C C 1 ∨ 2 ∨ 3
105 / 121 I Each boolean variable xi becomes integer variable vi I Each clause becomes an equation set to be greater than 1:
xi vi , xi (1 vi ), + → → − ∨ →
0 v1 1, 0 v2 1, 0 v3 1, 0 v4 1 ≤ ≤ ≤ ≤ ≤ ≤ ≤ ≤
Reduction for INTEGER-PROGRAMMING
i i i φ = 1 2 ... m, where i = (x x x ) C ∧ C ∧ ∧ C C 1 ∨ 2 ∨ 3
Given φ, construct the set of inequalities as following:
106 / 121 I Each clause becomes an equation set to be greater than 1:
xi vi , xi (1 vi ), + → → − ∨ →
0 v1 1, 0 v2 1, 0 v3 1, 0 v4 1 ≤ ≤ ≤ ≤ ≤ ≤ ≤ ≤
Reduction for INTEGER-PROGRAMMING
i i i φ = 1 2 ... m, where i = (x x x ) C ∧ C ∧ ∧ C C 1 ∨ 2 ∨ 3
Given φ, construct the set of inequalities as following:
I Each boolean variable xi becomes integer variable vi
107 / 121 xi vi , xi (1 vi ), + → → − ∨ →
0 v1 1, 0 v2 1, 0 v3 1, 0 v4 1 ≤ ≤ ≤ ≤ ≤ ≤ ≤ ≤
Reduction for INTEGER-PROGRAMMING
i i i φ = 1 2 ... m, where i = (x x x ) C ∧ C ∧ ∧ C C 1 ∨ 2 ∨ 3
Given φ, construct the set of inequalities as following:
I Each boolean variable xi becomes integer variable vi I Each clause becomes an equation set to be greater than 1:
108 / 121 0 v1 1, 0 v2 1, 0 v3 1, 0 v4 1 ≤ ≤ ≤ ≤ ≤ ≤ ≤ ≤
Reduction for INTEGER-PROGRAMMING
i i i φ = 1 2 ... m, where i = (x x x ) C ∧ C ∧ ∧ C C 1 ∨ 2 ∨ 3
Given φ, construct the set of inequalities as following:
I Each boolean variable xi becomes integer variable vi I Each clause becomes an equation set to be greater than 1:
xi vi , xi (1 vi ), + → → − ∨ →
109 / 121 0 v1 1, 0 v2 1, 0 v3 1, 0 v4 1 ≤ ≤ ≤ ≤ ≤ ≤ ≤ ≤
Reduction for INTEGER-PROGRAMMING
i i i φ = 1 2 ... m, where i = (x x x ) C ∧ C ∧ ∧ C C 1 ∨ 2 ∨ 3
Given φ, construct the set of inequalities as following:
I Each boolean variable xi becomes integer variable vi I Each clause becomes an equation set to be greater than 1:
xi vi , xi (1 vi ), + → → − ∨ →
(x1 x2 x3) ∨ ∨
110 / 121 0 v1 1, 0 v2 1, 0 v3 1, 0 v4 1 ≤ ≤ ≤ ≤ ≤ ≤ ≤ ≤
Reduction for INTEGER-PROGRAMMING
i i i φ = 1 2 ... m, where i = (x x x ) C ∧ C ∧ ∧ C C 1 ∨ 2 ∨ 3
Given φ, construct the set of inequalities as following:
I Each boolean variable xi becomes integer variable vi I Each clause becomes an equation set to be greater than 1:
xi vi , xi (1 vi ), + → → − ∨ →
(x1 x2 x3) ∨ ∨ v1 + v2 + (1 v3) 1 − ≥
111 / 121 0 v1 1, 0 v2 1, 0 v3 1, 0 v4 1 ≤ ≤ ≤ ≤ ≤ ≤ ≤ ≤
Reduction for INTEGER-PROGRAMMING
i i i φ = 1 2 ... m, where i = (x x x ) C ∧ C ∧ ∧ C C 1 ∨ 2 ∨ 3
Given φ, construct the set of inequalities as following:
I Each boolean variable xi becomes integer variable vi I Each clause becomes an equation set to be greater than 1:
xi vi , xi (1 vi ), + → → − ∨ →
(x1 x2 x3) (x1 x3 x4) ∨ ∨ ∧ ∨ ∨
112 / 121 0 v1 1, 0 v2 1, 0 v3 1, 0 v4 1 ≤ ≤ ≤ ≤ ≤ ≤ ≤ ≤
Reduction for INTEGER-PROGRAMMING
i i i φ = 1 2 ... m, where i = (x x x ) C ∧ C ∧ ∧ C C 1 ∨ 2 ∨ 3
Given φ, construct the set of inequalities as following:
I Each boolean variable xi becomes integer variable vi I Each clause becomes an equation set to be greater than 1:
xi vi , xi (1 vi ), + → → − ∨ →
(x1 x2 x3) (x1 x3 x4) ∨ ∨ ∧ ∨ ∨ v1 + v2 + (1 v3) 1, (1 v1) + v3 + (1 v4) 1 − ≥ − − ≥
113 / 121 0 v1 1, 0 v2 1, 0 v3 1, 0 v4 1 ≤ ≤ ≤ ≤ ≤ ≤ ≤ ≤
Reduction for INTEGER-PROGRAMMING
i i i φ = 1 2 ... m, where i = (x x x ) C ∧ C ∧ ∧ C C 1 ∨ 2 ∨ 3
Given φ, construct the set of inequalities as following:
I Each boolean variable xi becomes integer variable vi I Each clause becomes an equation set to be greater than 1:
xi vi , xi (1 vi ), + → → − ∨ →
(x1 x2 x3) (x1 x3 x4) (x2 x4 x1) ∨ ∨ ∧ ∨ ∨ ∧ ∨ ∨
114 / 121 0 v1 1, 0 v2 1, 0 v3 1, 0 v4 1 ≤ ≤ ≤ ≤ ≤ ≤ ≤ ≤
Reduction for INTEGER-PROGRAMMING
i i i φ = 1 2 ... m, where i = (x x x ) C ∧ C ∧ ∧ C C 1 ∨ 2 ∨ 3
Given φ, construct the set of inequalities as following:
I Each boolean variable xi becomes integer variable vi I Each clause becomes an equation set to be greater than 1:
xi vi , xi (1 vi ), + → → − ∨ →
(x1 x2 x3) (x1 x3 x4) (x2 x4 x1) ∨ ∨ ∧ ∨ ∨ ∧ ∨ ∨
v1 + v2 + (1 v3) 1, (1 v1) + v3 + (1 v4) 1, (1 v2) + v4 + v1 1 − ≥ − − ≥ − ≥
115 / 121 0 v1 1, 0 v2 1, 0 v3 1, 0 v4 1 ≤ ≤ ≤ ≤ ≤ ≤ ≤ ≤
Reduction for INTEGER-PROGRAMMING
i i i φ = 1 2 ... m, where i = (x x x ) C ∧ C ∧ ∧ C C 1 ∨ 2 ∨ 3
Given φ, construct the set of inequalities as following:
I Each boolean variable xi becomes integer variable vi I Each clause becomes an equation set to be greater than 1:
xi vi , xi (1 vi ), + → → − ∨ →
(x1 x2 x3) (x1 x3 x4) (x2 x4 x1) ∨ ∨ ∧ ∨ ∨ ∧ ∨ ∨ v1 + v2 + (1 v3) 1, (1 v1) + v3 + (1 v4) 1, (1 v2) + v4 + v1 1 − ≥ − − ≥ − ≥
116 / 121 Reduction for INTEGER-PROGRAMMING
i i i φ = 1 2 ... m, where i = (x x x ) C ∧ C ∧ ∧ C C 1 ∨ 2 ∨ 3
Given φ, construct the set of inequalities as following:
I Each boolean variable xi becomes integer variable vi I Each clause becomes an equation set to be greater than 1:
xi vi , xi (1 vi ), + → → − ∨ →
(x1 x2 x3) (x1 x3 x4) (x2 x4 x1) ∨ ∨ ∧ ∨ ∨ ∧ ∨ ∨ v1 + v2 + (1 v3) 1, (1 v1) + v3 + (1 v4) 1, (1 v2) + v4 + v1 1 − ≥ − − ≥ − ≥
0 v1 1, 0 v2 1, 0 v3 1, 0 v4 1 ≤ ≤ ≤ ≤ ≤ ≤ ≤ ≤
117 / 121 Each vi can be either 0 or 1
A clause Cj satisfied corresponding inequality satisfied ⇐⇒
(x1 x2 x3) = 1 v1 + v2 + (1 v3) 1 ∨ ∨ ⇐⇒ − ≥
Likewise in the other direction, set vi = xi .
Reduction for INTEGER-PROGRAMMING
Claim: Solve INTEGER-PROGRAMMING to get a valid solution. Set boolean variable xi = vi . This satisfies φ.
118 / 121 A clause Cj satisfied corresponding inequality satisfied ⇐⇒
(x1 x2 x3) = 1 v1 + v2 + (1 v3) 1 ∨ ∨ ⇐⇒ − ≥
Likewise in the other direction, set vi = xi .
Reduction for INTEGER-PROGRAMMING
Claim: Solve INTEGER-PROGRAMMING to get a valid solution. Set boolean variable xi = vi . This satisfies φ.
Each vi can be either 0 or 1
119 / 121 Likewise in the other direction, set vi = xi .
Reduction for INTEGER-PROGRAMMING
Claim: Solve INTEGER-PROGRAMMING to get a valid solution. Set boolean variable xi = vi . This satisfies φ.
Each vi can be either 0 or 1
A clause Cj satisfied corresponding inequality satisfied ⇐⇒
(x1 x2 x3) = 1 v1 + v2 + (1 v3) 1 ∨ ∨ ⇐⇒ − ≥
120 / 121 Reduction for INTEGER-PROGRAMMING
Claim: Solve INTEGER-PROGRAMMING to get a valid solution. Set boolean variable xi = vi . This satisfies φ.
Each vi can be either 0 or 1
A clause Cj satisfied corresponding inequality satisfied ⇐⇒
(x1 x2 x3) = 1 v1 + v2 + (1 v3) 1 ∨ ∨ ⇐⇒ − ≥
Likewise in the other direction, set vi = xi .
121 / 121