Lecture 26
Lecture 26
Lecture 26
Sarmad Abbasi
B ≤p A.
Theorem
If A is NP-complete and A is in NP then
P = NP.
φ ∧ ψ, φ ∨ ψ and φ
Definition
A formula φ is satisfiable if there exists an assignment τ such that
φ|τ = 1.
Let us define
SAT = {hφi : φ is satisfiable}.
It is easy to see that
Theorem
SAT is in NP
We can give an easy verification algorithm. The algorithm takes a
formula φ and assignment τ and checks if τ satisfies φ.
1 On input hφ, τ i.
2 Substitute the variables using of φ using τ .
3 evaluate the resulting formula with constants.
4 IF the formula evaluates to 1 accept.
This is a verification algorithm for SAT.
Theorem (Cook-Levin)
SAT is NP-complete.
Theorem (Cook-Levin)
P = NP if and only if SAT ∈ P.
Each vertex has been colored and you can check to see if it is a proper
coloring.
It is easy to see that this graph is not three colorable. Since, it has four
vertices all connected to each other therefore we need at least four
colors to color it properly.
It is not easy to see that we cannot properly color it by three colors. You
can exhaustively check at home that this is not a three colorable graph.
Theorem
3Color ≤p SAT .
Lets first try to understand what this means! We do not want to do any
of the following:
1 Design an algorithm to solve SAT.
2 Design an algorithm to solve 3Color .
We want to know the relationship between 3Color and SAT .
(x1 ∨ x2 )
This formula is true if and only if x1 or x2 is true. Now, let us try to
come up with a formula that is true if exactly one of the variables out of
x1 and x2 is set to true.
(x1 ∨ x2 ) ∧ (x1 ∧ x2 )
Now, let us go a bit further. Let us come up with a formula which is true
if and only if exactly one out of the there variables x1 , x2 , x3 is true. A
little thought shows that that formula is
Suppose I have three variables for the first vertex a. Let us say they are
Ra , Ba , Ga .
So the formula is
Now, let us consider an edge e = {a, b}. How can we find a formula
that is true if a and b are given different colors. Well that is easy
!
^
φG = (Rv ∨ Bv ∨ Gv ) ∧ Rv ∧ Bv ) ∧ (Rv ∧ Gv ) ∧ (Bv ∧ Gv )
v ∈V
^
^
(Ra ∧ Rb ) ∧ (Ba ∧ Bb ) ∧ (Ga ∧ Gb )
{a,b}∈E
A ≤p SAT .