---------------------------------------------------------------------
CS 577 (Intro to Algorithms)
Lec 23 (11/28/06) Shuchi Chawla
---------------------------------------------------------------------
In these lecture notes we will prove that the Max-2-SAT problem is
NP-complete.
Max-2-SAT is defined as follows. We are given a 2-CNF formula and a
bound k, and asked to find an assignment to the variables that
satisfies at least k of the clauses.
For example, suppose the formula is
(x V y) A (not y V x) A (not x V not y) A (not x)
then, if k=3, this is a Yes instance, because we can satisfy the first
three clauses by setting x=True and y=False. But if k=4, then this is
a No instance because no assignment will make all of the clauses true.
Max-2-SAT is closely related to the 2-SAT problem, where we are
supposed to find an assignment for a 2-CNF formula that satisfies
*all* of the clauses. Recall that 2-SAT is in P, that is, there is a
polynomial time algorithm for it. On the other hand we will show that
Max-2-SAT is NP-complete.
Theorem: Max-2-SAT is NP-complete
Proof:
First we will show that Max-2-SAT is in NP. This is easy. A proof for
a Yes instance of the problem is simply an assignment to the
variables. In polynomial time we can verify that this assignment does
indeed satisfy at least k of the clauses.
In order to prove NP-hardness, we will reduce the 3-SAT problem to
Max-2-SAT.
Recall that in 3-SAT we are given a 3-CNF formula and asked to find a
satisfying assignment for it. We will convert this formula into a
2-CNF formula clause by clause.
So consider a clause (x V y V z) in the given 3-CNF formula. We
introduce a new variable for this clause, call it w. We then replace
this clause by the following 10 clauses:
(x) (y) (z) (w)
(not x V not y) (not y V not z) (not x V not z)
(x V not w) (y V not w) (z V not w)
We replace each clause in the 3-CNF formula by 10 clauses in this
manner, introducing a fresh variable w for every clause. Suppose that
the original formular has m clauses, then we end up with a 2-CNF
formula with 10m clauses.
We now claim that:
1. If an assignment satisfies (x V y V z), then there is an assignment
for w, that together with the assignment for x, y and z, satisfies
exactly 7 of the 10 clauses above.
2. If an assignment does not satisfy (x V y V z), then every
assignment for w, together with the assignment for x, y and z,
satisfies at most 6 of the 10 clauses above.
These claims imply that if there is a satisfying assignment for the
original 3-CNF formula, then there is an assignment for the new 2-CNF
formula that satisfies at least 7m of the clauses. On the other hand,
if no assignment satisfies the 3-CNF formula, then at least for one of
the original clauses, we will only be able to satisfy 6 of the 10 new
clauses, and therefore, the number of clauses satisfied in the 2-CNF
formula is strictly less than 7m. Therefore, we can decided whether or
not the given 3-CNF formula is satisfiable by determining whether or
not it is possible to satisfy 7m of the clauses in the 2-CNF formula.
It remains to prove the above claims. We do this by case analysis.
Case 1: x=y=z=True. Then by setting w=True, we can satisfy the entire
first and third rows, or 7 clauses in all.
Case 2: x=y=True z=False. Then by setting w=True, we can satisfy three
clauses from the first row, two from the second row, and two
from the third row, or 7 clauses in all.
Case 3: x=True, y=z=False. Then by setting w=False, we can satisfy one
clause on the first row, and the entire second and third rows,
which is again 7 clauses in all.
Case 4: x=y=z=False. Note that (x V y V z) is not satisfied. If we set
w=True, this only satisfies one clause on the first row, and
all clauses on the second row; a total of 4 clauses. On the
other hand if we set w=False, then we only satisfy all clauses
on the second and third rows, a total of 6 clauses.
Other cases are analogous to the above.
QED.
---------------------------------------------------------------------