0% found this document useful (0 votes)
2 views

22-intractability2

The document discusses polynomial-time reductions and their significance in computational complexity, particularly focusing on the satisfiability problem (SAT) and its variants like 3-SAT and 2-SAT. It explains how problems can be reduced to one another to demonstrate relative hardness and presents a method for constructing independent sets from 3-SAT instances. The lecture emphasizes the importance of these reductions in understanding intractable problems in algorithms.

Uploaded by

Phương Lê Thu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

22-intractability2

The document discusses polynomial-time reductions and their significance in computational complexity, particularly focusing on the satisfiability problem (SAT) and its variants like 3-SAT and 2-SAT. It explains how problems can be reduced to one another to demonstrate relative hardness and presents a method for constructing independent sets from 3-SAT instances. The lecture emphasizes the importance of these reductions in understanding intractable problems in algorithms.

Uploaded by

Phương Lê Thu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 92

COMPSCI 311: Introduction to Algorithms

Lecture 22: Intractability: SAT, NP

Ghazaleh Parvini

University of Massachusetts Amherst


Review: Polynomial-Time Reduction
▶ Y ≤P X: Problem Y is polynomial-time reducible to
Problem X,
solveY(yInput)
Construct xInput // poly-time
foo = solveX(xInput) // poly # of calls
return yes/no based on foo // poly-time
Review: Polynomial-Time Reduction
▶ Y ≤P X: Problem Y is polynomial-time reducible to
Problem X,
solveY(yInput)
Construct xInput // poly-time
foo = solveX(xInput) // poly # of calls
return yes/no based on foo // poly-time

▶ . . . if any instance of Problem Y can be solved using


Review: Polynomial-Time Reduction
▶ Y ≤P X: Problem Y is polynomial-time reducible to
Problem X,
solveY(yInput)
Construct xInput // poly-time
foo = solveX(xInput) // poly # of calls
return yes/no based on foo // poly-time

▶ . . . if any instance of Problem Y can be solved using


1. A polynomial number of standard computational steps
Review: Polynomial-Time Reduction
▶ Y ≤P X: Problem Y is polynomial-time reducible to
Problem X,
solveY(yInput)
Construct xInput // poly-time
foo = solveX(xInput) // poly # of calls
return yes/no based on foo // poly-time

▶ . . . if any instance of Problem Y can be solved using


1. A polynomial number of standard computational steps
2. A polynomial number of calls to a black box that solves
problem X
Review: Polynomial-Time Reduction
▶ Y ≤P X: Problem Y is polynomial-time reducible to
Problem X,
solveY(yInput)
Construct xInput // poly-time
foo = solveX(xInput) // poly # of calls
return yes/no based on foo // poly-time

▶ . . . if any instance of Problem Y can be solved using


1. A polynomial number of standard computational steps
2. A polynomial number of calls to a black box that solves
problem X

▶ Statement about relative hardness


Review: Polynomial-Time Reduction
▶ Y ≤P X: Problem Y is polynomial-time reducible to
Problem X,
solveY(yInput)
Construct xInput // poly-time
foo = solveX(xInput) // poly # of calls
return yes/no based on foo // poly-time

▶ . . . if any instance of Problem Y can be solved using


1. A polynomial number of standard computational steps
2. A polynomial number of calls to a black box that solves
problem X

▶ Statement about relative hardness


1. If Y ≤P X and X ∈ P , then Y ∈ P
Review: Polynomial-Time Reduction
▶ Y ≤P X: Problem Y is polynomial-time reducible to
Problem X,
solveY(yInput)
Construct xInput // poly-time
foo = solveX(xInput) // poly # of calls
return yes/no based on foo // poly-time

▶ . . . if any instance of Problem Y can be solved using


1. A polynomial number of standard computational steps
2. A polynomial number of calls to a black box that solves
problem X

▶ Statement about relative hardness


1. If Y ≤P X and X ∈ P , then Y ∈ P
2. If Y ≤P X and Y ∈
/ P then X ∈ /P
Reduction Strategies

▶ Reduction by equivalence
(Vertex-Cover ≤P Indept-Set and vice versa)

▶ Reduction to a more general case


(Vertex-Cover ≤P Set-Cover)

▶ Reduction by "gadgets"
Reduction by Gadgets: Satisfiability

▶ Can we determine if a Boolean formula has a satisfying


assignment?

(x1 ∨ x̄2 ) ∧(x̄1 ∨ x2 ∨ x̄3 ) ∧ (x2 ∨ x̄3 )


| {z }
"clause"

▶ Terminology
Reduction by Gadgets: Satisfiability

▶ Can we determine if a Boolean formula has a satisfying


assignment?

(x1 ∨ x̄2 ) ∧(x̄1 ∨ x2 ∨ x̄3 ) ∧ (x2 ∨ x̄3 )


| {z }
"clause"

▶ Terminology

Variables x1 , . . . , x n
Reduction by Gadgets: Satisfiability

▶ Can we determine if a Boolean formula has a satisfying


assignment?

(x1 ∨ x̄2 ) ∧(x̄1 ∨ x2 ∨ x̄3 ) ∧ (x2 ∨ x̄3 )


| {z }
"clause"

▶ Terminology

Variables x1 , . . . , x n
Term xi or x̄i variable or its negation
Reduction by Gadgets: Satisfiability

▶ Can we determine if a Boolean formula has a satisfying


assignment?

(x1 ∨ x̄2 ) ∧(x̄1 ∨ x2 ∨ x̄3 ) ∧ (x2 ∨ x̄3 )


| {z }
"clause"

▶ Terminology

Variables x1 , . . . , x n
Term xi or x̄i variable or its negation
Clause C = x̄1 ∨ x2 ∨ x̄3 “or” of terms
Reduction by Gadgets: Satisfiability

▶ Can we determine if a Boolean formula has a satisfying


assignment?

(x1 ∨ x̄2 ) ∧(x̄1 ∨ x2 ∨ x̄3 ) ∧ (x2 ∨ x̄3 )


| {z }
"clause"

▶ Terminology

Variables x1 , . . . , x n
Term xi or x̄i variable or its negation
Clause C = x̄1 ∨ x2 ∨ x̄3 “or” of terms
Formula C1 ∧ C2 ∧ . . . ∧ Ck “and” of clauses
Reduction by Gadgets: Satisfiability

▶ Can we determine if a Boolean formula has a satisfying


assignment?

(x1 ∨ x̄2 ) ∧(x̄1 ∨ x2 ∨ x̄3 ) ∧ (x2 ∨ x̄3 )


| {z }
"clause"

▶ Terminology

Variables x1 , . . . , x n
Term xi or x̄i variable or its negation
Clause C = x̄1 ∨ x2 ∨ x̄3 “or” of terms
Formula C1 ∧ C2 ∧ . . . ∧ Ck “and” of clauses
Assignment (x1 , x2 , x3 ) = (1, 0, 1) assign 0/1 to each variable
Reduction by Gadgets: Satisfiability

▶ Can we determine if a Boolean formula has a satisfying


assignment?

(x1 ∨ x̄2 ) ∧(x̄1 ∨ x2 ∨ x̄3 ) ∧ (x2 ∨ x̄3 )


| {z }
"clause"

▶ Terminology

Variables x1 , . . . , x n
Term xi or x̄i variable or its negation
Clause C = x̄1 ∨ x2 ∨ x̄3 “or” of terms
Formula C1 ∧ C2 ∧ . . . ∧ Ck “and” of clauses
Assignment (x1 , x2 , x3 ) = (1, 0, 1) assign 0/1 to each variable
Satisfying assigment (x1 , x2 , x3 ) = (1, 1, 0) all clauses are “true”
Reduction by Gadgets: Satisfiability

▶ Can we determine if a Boolean formula has a satisfying


assignment?

(x1 ∨ x̄2 ) ∧(x̄1 ∨ x2 ∨ x̄3 ) ∧ (x2 ∨ x̄3 )


| {z }
"clause"

▶ Terminology

Variables x1 , . . . , x n
Term xi or x̄i variable or its negation
Clause C = x̄1 ∨ x2 ∨ x̄3 “or” of terms
Formula C1 ∧ C2 ∧ . . . ∧ Ck “and” of clauses
Assignment (x1 , x2 , x3 ) = (1, 0, 1) assign 0/1 to each variable
Satisfying assigment (x1 , x2 , x3 ) = (1, 1, 0) all clauses are “true”
Reduction by Gadgets: Satisfiability

SAT – Given boolean formula C1 ∧ C2 . . . ∧ Cm over variables


x1 , . . . , xn , does there exist a satisfying assignment?
Reduction by Gadgets: Satisfiability

SAT – Given boolean formula C1 ∧ C2 . . . ∧ Cm over variables


x1 , . . . , xn , does there exist a satisfying assignment?

3-SAT – Same, but each Ci has exactly three terms


Reduction by Gadgets: Satisfiability

SAT – Given boolean formula C1 ∧ C2 . . . ∧ Cm over variables


x1 , . . . , xn , does there exist a satisfying assignment?

3-SAT – Same, but each Ci has exactly three terms


2-SAT — each Ci has exactly two terms
Reduction by Gadgets: Satisfiability

SAT – Given boolean formula C1 ∧ C2 . . . ∧ Cm over variables


x1 , . . . , xn , does there exist a satisfying assignment?

3-SAT – Same, but each Ci has exactly three terms


2-SAT — each Ci has exactly two terms

Clicker. What is the strongest statement below that follows easily


from the definitions above?
A. 2-SAT ≤P 3-SAT ≤P SAT
B. 2-SAT ≤P SAT and 3-SAT ≤P SAT
C. SAT ≤P 3-SAT ≤P 2-SAT
Reduction by Gadgets: Satisfiability

Claim: 3-SAT ≤P IndependentSet.


Reduction by Gadgets: Satisfiability

Claim: 3-SAT ≤P IndependentSet.

Reduction:
▶ Given 3-SAT instance Φ = ⟨C1 , . . . , Cm ⟩, we will construct an
independent set instance ⟨G, m⟩ such that G has an
independent set of size m iff Φ is satisfiable
▶ Return Yes if solveIS(⟨G, m⟩) = Yes
Reduction

▶ Idea: construct graph G where independent set will select one


term per clause to be true

(x̄1 ∨ x2 ∨ x3 ) ∧ (x1 ∨ x̄2 ∨ x3 ) ∧ (x̄1 ∨ x̄2 ∨ x̄3 )

x̅ 1 x1 x̅ 1

x2 x3 x̅ 2 x3 x̅ 2 x̅ 3
Reduction

▶ Idea: construct graph G where independent set will select one


term per clause to be true

(x̄1 ∨ x2 ∨ x3 ) ∧ (x1 ∨ x̄2 ∨ x3 ) ∧ (x̄1 ∨ x̄2 ∨ x̄3 )

x̅ 1 x1 x̅ 1

x2 x3 x̅ 2 x3 x̅ 2 x̅ 3

▶ One node per term


Reduction

▶ Idea: construct graph G where independent set will select one


term per clause to be true

(x̄1 ∨ x2 ∨ x3 ) ∧ (x1 ∨ x̄2 ∨ x3 ) ∧ (x̄1 ∨ x̄2 ∨ x̄3 )

x̅ 1 x1 x̅ 1

x2 x3 x̅ 2 x3 x̅ 2 x̅ 3

▶ One node per term


▶ Edges between all terms in same clause (select at most one)
Reduction

▶ Idea: construct graph G where independent set will select one


term per clause to be true

(x̄1 ∨ x2 ∨ x3 ) ∧ (x1 ∨ x̄2 ∨ x3 ) ∧ (x̄1 ∨ x̄2 ∨ x̄3 )

x̅ 1 x1 x̅ 1

x2 x3 x̅ 2 x3 x̅ 2 x̅ 3

▶ One node per term


▶ Edges between all terms in same clause (select at most one)
▶ Edges between a literal and all of its negations (consistent
truth assignment)
Correctness

(x̄1 ∨ x2 ∨ x3 ) ∧ (x1 ∨ x̄2 ∨ x3 ) ∧ (x̄1 ∨ x̄2 ∨ x̄3 )

x̅ 1 x1 x̅ 1

x2 x3 x̅ 2 x3 x̅ 2 x̅ 3

Claim: if G has an independent set of size m, then ⟨C1 , . . . , Cm ⟩ is


satisfiable
Correctness

(x̄1 ∨ x2 ∨ x3 ) ∧ (x1 ∨ x̄2 ∨ x3 ) ∧ (x̄1 ∨ x̄2 ∨ x̄3 )

x̅ 1 x1 x̅ 1

x2 x3 x̅ 2 x3 x̅ 2 x̅ 3

Claim: if G has an independent set of size m, then ⟨C1 , . . . , Cm ⟩ is


satisfiable
▶ Suppose S is an independent set of size m
Correctness

(x̄1 ∨ x2 ∨ x3 ) ∧ (x1 ∨ x̄2 ∨ x3 ) ∧ (x̄1 ∨ x̄2 ∨ x̄3 )

x̅ 1 x1 x̅ 1

x2 x3 x̅ 2 x3 x̅ 2 x̅ 3

Claim: if G has an independent set of size m, then ⟨C1 , . . . , Cm ⟩ is


satisfiable
▶ Suppose S is an independent set of size m
▶ Assign variables so selected literals are true. Edges from terms
to negations ensure non-conflicting assignment.
Correctness

(x̄1 ∨ x2 ∨ x3 ) ∧ (x1 ∨ x̄2 ∨ x3 ) ∧ (x̄1 ∨ x̄2 ∨ x̄3 )

x̅ 1 x1 x̅ 1

x2 x3 x̅ 2 x3 x̅ 2 x̅ 3

Claim: if G has an independent set of size m, then ⟨C1 , . . . , Cm ⟩ is


satisfiable
▶ Suppose S is an independent set of size m
▶ Assign variables so selected literals are true. Edges from terms
to negations ensure non-conflicting assignment.
▶ Set any remaining variables arbitrarily
Correctness

(x̄1 ∨ x2 ∨ x3 ) ∧ (x1 ∨ x̄2 ∨ x3 ) ∧ (x̄1 ∨ x̄2 ∨ x̄3 )

x̅ 1 x1 x̅ 1

x2 x3 x̅ 2 x3 x̅ 2 x̅ 3

Claim: if G has an independent set of size m, then ⟨C1 , . . . , Cm ⟩ is


satisfiable
▶ Suppose S is an independent set of size m
▶ Assign variables so selected literals are true. Edges from terms
to negations ensure non-conflicting assignment.
▶ Set any remaining variables arbitrarily
▶ At most one term per clause is selected. Since m are selected,
every clause is satisfied.
Correctness

(x̄1 ∨ x2 ∨ x3 ) ∧ (x1 ∨ x̄2 ∨ x3 ) ∧ (x̄1 ∨ x̄2 ∨ x̄3 )

x̅ 1 x1 x̅ 1

x2 x3 x̅ 2 x3 x̅ 2 x̅ 3

Claim: if ⟨C1 , . . . , Cm ⟩ is satisfiable, then G has an independent


set of size m
Correctness

(x̄1 ∨ x2 ∨ x3 ) ∧ (x1 ∨ x̄2 ∨ x3 ) ∧ (x̄1 ∨ x̄2 ∨ x̄3 )

x̅ 1 x1 x̅ 1

x2 x3 x̅ 2 x3 x̅ 2 x̅ 3

Claim: if ⟨C1 , . . . , Cm ⟩ is satisfiable, then G has an independent


set of size m
▶ Consider any satsifying assignment of ⟨C1 , . . . , Cm ⟩
Correctness

(x̄1 ∨ x2 ∨ x3 ) ∧ (x1 ∨ x̄2 ∨ x3 ) ∧ (x̄1 ∨ x̄2 ∨ x̄3 )

x̅ 1 x1 x̅ 1

x2 x3 x̅ 2 x3 x̅ 2 x̅ 3

Claim: if ⟨C1 , . . . , Cm ⟩ is satisfiable, then G has an independent


set of size m
▶ Consider any satsifying assignment of ⟨C1 , . . . , Cm ⟩
▶ Let S consist of one node per triangle corresponding to true
literal in that clause. Then |S| = m.
Correctness

(x̄1 ∨ x2 ∨ x3 ) ∧ (x1 ∨ x̄2 ∨ x3 ) ∧ (x̄1 ∨ x̄2 ∨ x̄3 )

x̅ 1 x1 x̅ 1

x2 x3 x̅ 2 x3 x̅ 2 x̅ 3

Claim: if ⟨C1 , . . . , Cm ⟩ is satisfiable, then G has an independent


set of size m
▶ Consider any satsifying assignment of ⟨C1 , . . . , Cm ⟩
▶ Let S consist of one node per triangle corresponding to true
literal in that clause. Then |S| = m.
▶ For (u, v) within clause, at most one endpoint is selected
Correctness

(x̄1 ∨ x2 ∨ x3 ) ∧ (x1 ∨ x̄2 ∨ x3 ) ∧ (x̄1 ∨ x̄2 ∨ x̄3 )

x̅ 1 x1 x̅ 1

x2 x3 x̅ 2 x3 x̅ 2 x̅ 3

Claim: if ⟨C1 , . . . , Cm ⟩ is satisfiable, then G has an independent


set of size m
▶ Consider any satsifying assignment of ⟨C1 , . . . , Cm ⟩
▶ Let S consist of one node per triangle corresponding to true
literal in that clause. Then |S| = m.
▶ For (u, v) within clause, at most one endpoint is selected
▶ For edge (xi , x̄i ) between clauses, at most one endpoint is
selected, because xi = 1 or x̄i = 1, but not both
Correctness

(x̄1 ∨ x2 ∨ x3 ) ∧ (x1 ∨ x̄2 ∨ x3 ) ∧ (x̄1 ∨ x̄2 ∨ x̄3 )

x̅ 1 x1 x̅ 1

x2 x3 x̅ 2 x3 x̅ 2 x̅ 3

Claim: if ⟨C1 , . . . , Cm ⟩ is satisfiable, then G has an independent


set of size m
▶ Consider any satsifying assignment of ⟨C1 , . . . , Cm ⟩
▶ Let S consist of one node per triangle corresponding to true
literal in that clause. Then |S| = m.
▶ For (u, v) within clause, at most one endpoint is selected
▶ For edge (xi , x̄i ) between clauses, at most one endpoint is
selected, because xi = 1 or x̄i = 1, but not both
▶ Therefore S is an independent set
Reductions So Far

Partial map of problems we can use to solve others in polynomial


time, through transitivity of reductions:

3-SAT

Indept-Set SAT ▶ Y X
means Y ≤P X.
Vertex-Cover

Set-Cover
Toward a Definition of NP

Remember our problem hierarchy:

EXP

NP

What is special about the mystery problems (NP)?


P and NP

Intuition. For many “hard” decision problems, at least one thing is


“easy”:
P and NP

Intuition. For many “hard” decision problems, at least one thing is


“easy”: if the correct answer is Yes, there is an easy proof
P and NP

Intuition. For many “hard” decision problems, at least one thing is


“easy”: if the correct answer is Yes, there is an easy proof
▶ Independent set: show an independent set of size at least k
P and NP

Intuition. For many “hard” decision problems, at least one thing is


“easy”: if the correct answer is Yes, there is an easy proof
▶ Independent set: show an independent set of size at least k
▶ SAT: show a satisfying assignment
P and NP

Intuition. For many “hard” decision problems, at least one thing is


“easy”: if the correct answer is Yes, there is an easy proof
▶ Independent set: show an independent set of size at least k
▶ SAT: show a satisfying assignment
Problem classes
P and NP

Intuition. For many “hard” decision problems, at least one thing is


“easy”: if the correct answer is Yes, there is an easy proof
▶ Independent set: show an independent set of size at least k
▶ SAT: show a satisfying assignment
Problem classes
▶ P: Decision problems for which there is a polynomial time
algorithm.
P and NP

Intuition. For many “hard” decision problems, at least one thing is


“easy”: if the correct answer is Yes, there is an easy proof
▶ Independent set: show an independent set of size at least k
▶ SAT: show a satisfying assignment
Problem classes
▶ P: Decision problems for which there is a polynomial time
algorithm.

▶ NP: Decision problems for which there is a polynomial time


certifier.
P and NP

Intuition. For many “hard” decision problems, at least one thing is


“easy”: if the correct answer is Yes, there is an easy proof
▶ Independent set: show an independent set of size at least k
▶ SAT: show a satisfying assignment
Problem classes
▶ P: Decision problems for which there is a polynomial time
algorithm.

▶ NP: Decision problems for which there is a polynomial time


certifier.
▶ A solution can be “certified” in polynomial time.
P and NP

Intuition. For many “hard” decision problems, at least one thing is


“easy”: if the correct answer is Yes, there is an easy proof
▶ Independent set: show an independent set of size at least k
▶ SAT: show a satisfying assignment
Problem classes
▶ P: Decision problems for which there is a polynomial time
algorithm.

▶ NP: Decision problems for which there is a polynomial time


certifier.
▶ A solution can be “certified” in polynomial time.
▶ NP = “non-deterministic polynomial time”
Solver vs. Certifier
Let X be a decision problem and s be problem instance
(e.g., s = ⟨G, k⟩ for Independent Set)
Solver vs. Certifier
Let X be a decision problem and s be problem instance
(e.g., s = ⟨G, k⟩ for Independent Set)

Poly-time solver. Algorithm A(s) such that A(s) = Yes iff correct
answer is Yes, and running time polynomial time in |s|
yes/no

s
Instance
Solver vs. Certifier
Let X be a decision problem and s be problem instance
(e.g., s = ⟨G, k⟩ for Independent Set)

Poly-time solver. Algorithm A(s) such that A(s) = Yes iff correct
answer is Yes, and running time polynomial time in |s|
yes/no yes/no

A C

s s t
Instance Instance Hint

Poly-time certifier. Algorithm C(s, t) such that for every instance s,


there is some t such that C(s, t) = Yes iff correct answer is Yes,
and running time is polynomial in |s|.
Solver vs. Certifier
Let X be a decision problem and s be problem instance
(e.g., s = ⟨G, k⟩ for Independent Set)

Poly-time solver. Algorithm A(s) such that A(s) = Yes iff correct
answer is Yes, and running time polynomial time in |s|
yes/no yes/no

A C

s s t
Instance Instance Hint

Poly-time certifier. Algorithm C(s, t) such that for every instance s,


there is some t such that C(s, t) = Yes iff correct answer is Yes,
and running time is polynomial in |s|.
▶ t is the “certificate” or hint; size must also be polynomial in |s|
Certifier Example: Independent Set

Input s = ⟨G, k⟩.


Problem: Does G have an independent set of size at least k?
Idea: Certificate t = an independent set of size k
Certifier Example: Independent Set

Input s = ⟨G, k⟩.


Problem: Does G have an independent set of size at least k?
Idea: Certificate t = an independent set of size k

CertifyIS( ⟨G, k⟩, t)


if |t| < k return No
for each edge e = (u, v) ∈ E do
if u ∈ t and v ∈ t return No
Return Yes
Certifier Example: Independent Set

Input s = ⟨G, k⟩.


Problem: Does G have an independent set of size at least k?
Idea: Certificate t = an independent set of size k

CertifyIS( ⟨G, k⟩, t)


if |t| < k return No
for each edge e = (u, v) ∈ E do
if u ∈ t and v ∈ t return No
Return Yes

Polynomial time?
Certifier Example: Independent Set

Input s = ⟨G, k⟩.


Problem: Does G have an independent set of size at least k?
Idea: Certificate t = an independent set of size k

CertifyIS( ⟨G, k⟩, t)


if |t| < k return No
for each edge e = (u, v) ∈ E do
if u ∈ t and v ∈ t return No
Return Yes

Polynomial time? Yes, linear in |E|.


Example: Independent Set

▶ Independent Set ∈ P?
Example: Independent Set

▶ Independent Set ∈ P?
▶ Unknown. No known polynomial time algorithm.
Example: Independent Set

▶ Independent Set ∈ P?
▶ Unknown. No known polynomial time algorithm.

▶ Independent Set ∈ NP?


Example: Independent Set

▶ Independent Set ∈ P?
▶ Unknown. No known polynomial time algorithm.

▶ Independent Set ∈ NP?


▶ Yes. Easy to certify solution in polynomial time.
Example: 3-SAT

Input: formula Φ on n variables.


Problem: Is Φ satisfiable?
Idea: Certificate t = the satisfying assignment
Example: 3-SAT

Input: formula Φ on n variables.


Problem: Is Φ satisfiable?
Idea: Certificate t = the satisfying assignment

Certify3SAT( ⟨Φ⟩, t)
▷ Check if t makes Φ true
P, NP, EXP

EXP

NP

▶ 3SAT and Independent Set are in NP, as are many other


problems that are hard to solve, but easy to certify!
P, NP, EXP

EXP

NP

▶ 3SAT and Independent Set are in NP, as are many other


problems that are hard to solve, but easy to certify!
▶ Claim: P ⊆ NP
▶ Claim: NP ⊆ EXP
▶ Both straightforward to prove, but not critical right now.
NP-Complete

NP-
complete
NP

▶ NP-complete = a problem Y ∈ NP with the property that


X ≤P Y for every problem X ∈ NP!
NP-Complete

CIRCUIT-SAT

3-SAT SAT VC SC .... IS

▶ Cook-Levin Theorem: In 1971, Cook and Levin independently


showed that particular problems were NP-Complete.
▶ We’ll look at Circuit-SAT as canonical NP-Complete
problem.
Circuit-SAT

Problem: Given a circuit built of And, Or, and Not gates with
some hard-coded inputs, is there a way to set remaining inputs so
the output is 1?
Circuit-SAT

Problem: Given a circuit built of And, Or, and Not gates with
some hard-coded inputs, is there a way to set remaining inputs so
the output is 1?

Satisfiable? Yes. Set inputs: 1, 1, 0.


Circuit-SAT

Cook-Levin Theorem Circuit-SAT is NP-Complete.


Circuit-SAT

Cook-Levin Theorem Circuit-SAT is NP-Complete.

Proof Idea: encode arbitrary certifier C(s, t) as a circuit


Circuit-SAT

Cook-Levin Theorem Circuit-SAT is NP-Complete.

Proof Idea: encode arbitrary certifier C(s, t) as a circuit


▶ If X ∈ NP, then X has a poly-time certifier C(s, t):
yes/no

s t
Instance Hint
Circuit-SAT

Cook-Levin Theorem Circuit-SAT is NP-Complete.

Proof Idea: encode arbitrary certifier C(s, t) as a circuit


▶ If X ∈ NP, then X has a poly-time certifier C(s, t):
yes/no

s t
Instance Hint
Circuit-SAT

Cook-Levin Theorem Circuit-SAT is NP-Complete.

Proof Idea: encode arbitrary certifier C(s, t) as a circuit


▶ If X ∈ NP, then X has a poly-time certifier C(s, t):
yes/no

s t
Instance Hint

▶ s is Yes instance ⇔ ∃ t such that C(s, t) outputs Yes


Circuit-SAT

Cook-Levin Theorem Circuit-SAT is NP-Complete.

Proof Idea: encode arbitrary certifier C(s, t) as a circuit


▶ If X ∈ NP, then X has a poly-time certifier C(s, t):
yes/no

s t
Instance Hint

▶ s is Yes instance ⇔ ∃ t such that C(s, t) outputs Yes


▶ Construct a circuit where s is hard-coded, and circuit is
satsifiable iff ∃ t that causes C(s, t) to output Yes
Circuit-SAT

Cook-Levin Theorem Circuit-SAT is NP-Complete.

Proof Idea: encode arbitrary certifier C(s, t) as a circuit


▶ If X ∈ NP, then X has a poly-time certifier C(s, t):
yes/no

s t
Instance Hint

▶ s is Yes instance ⇔ ∃ t such that C(s, t) outputs Yes


▶ Construct a circuit where s is hard-coded, and circuit is
satsifiable iff ∃ t that causes C(s, t) to output Yes
▶ s is Yes instance ⇔ circuit is satisfiable
Circuit-SAT

Cook-Levin Theorem Circuit-SAT is NP-Complete.

Proof Idea: encode arbitrary certifier C(s, t) as a circuit


▶ If X ∈ NP, then X has a poly-time certifier C(s, t):
yes/no

s t
Instance Hint

▶ s is Yes instance ⇔ ∃ t such that C(s, t) outputs Yes


▶ Construct a circuit where s is hard-coded, and circuit is
satsifiable iff ∃ t that causes C(s, t) to output Yes
▶ s is Yes instance ⇔ circuit is satisfiable
▶ Algorithm for Circuit-Sat implies an algorithm for X
A Circuit-SAT reduction

See Independent Set example in other slides


A Circuit-SAT reduction
▶ Vertex Cover – Does G have VC of size at most k? (Counting
gadget is an example for v3 , v4 only)

v3 v4

v1 v2
A Circuit-SAT reduction
▶ Vertex Cover – Does G have VC of size at most k? (Counting
gadget is an example for v3 , v4 only)

v3 v4
2?
v1 v2
v4 ∧ ¬ ∧ 1?

v3 ∨ ¬ 0?

v2 ∨ ∧

v1 ∨ ∧ Cover?

∨ ∧


Proving New Problems NP-Complete

Fact: If Y is NP-complete and Y ≤P X, then X is NP-complete.


Proving New Problems NP-Complete

Fact: If Y is NP-complete and Y ≤P X, then X is NP-complete.

Want to prove problem X is NP-complete


Proving New Problems NP-Complete

Fact: If Y is NP-complete and Y ≤P X, then X is NP-complete.

Want to prove problem X is NP-complete


▶ Check X ∈ NP.
Proving New Problems NP-Complete

Fact: If Y is NP-complete and Y ≤P X, then X is NP-complete.

Want to prove problem X is NP-complete


▶ Check X ∈ NP.
▶ Choose known NP-complete problem Y .
Proving New Problems NP-Complete

Fact: If Y is NP-complete and Y ≤P X, then X is NP-complete.

Want to prove problem X is NP-complete


▶ Check X ∈ NP.
▶ Choose known NP-complete problem Y .
▶ Prove Y ≤P X.
Proving New Problems NP-Complete

Fact: If Y is NP-complete and Y ≤P X, then X is NP-complete.

Want to prove problem X is NP-complete


▶ Check X ∈ NP.
▶ Choose known NP-complete problem Y .
▶ Prove Y ≤P X.
Clicker

It’s easy to show that 3-SAT ≤P Circuit-SAT. What can we


conclude from this?
A. 3-SAT is NP-complete.
B. 3-SAT is in NP.
C. If 3-SAT is NP-complete, then Circuit-SAT is also
NP-complete.
Proving New Problems NP-Complete

Theorem: 3-SAT is NP-Complete.


Proving New Problems NP-Complete

Theorem: 3-SAT is NP-Complete.


▶ In NP?
Proving New Problems NP-Complete

Theorem: 3-SAT is NP-Complete.


▶ In NP? Yes, check satisfying assignment in poly-time.
Proving New Problems NP-Complete

Theorem: 3-SAT is NP-Complete.


▶ In NP? Yes, check satisfying assignment in poly-time.
▶ Can show that Circuit-SAT ≤P 3-SAT (next time)
NP-Complete Problems: Preview

Circuit-SAT

Constraint satisfaction
3-SAT

Packing
Indept-Set Ham-Cycle Graph-Coloring
Subset-Sum
Ham-Path
Partitioning
Vertex-Cover Traveling-Salesperson 0-1 Knapsack

Sequencing Numerical
Set-Cover

Covering

You might also like