Practice Problem: Almost-SAT
1. Problem Statement
Consider the Almost-SAT problem defined as following:
Input: A CNF formula with variables and clauses.
Output: An assignment that satisfies exactly clauses, or NO if no such assignment exists.
Now, our aim is to prove that Almost-SAT problem is NP-Complete.
2. Attack Plan
In order to prove that Almost-SAT NP-Complete, we need to show two things:
- First of all, we need to make sure that Almost-SAT is a search (or decision) problem, i.e. Almost-SAT
- Second, we want to make sure that Almost-Sat is NP-Hard (at least as hard as any of NP-Complete problems).
3. Proof
3.1 Almost-SAT NP
Being a search/decision problem, means we have a polynomial time algorithm that can verify validity of a solution.
Thus, given input for Almost-SAT and an assignment (which is a proposed solution):
in we can verify that any particular clause is satisfied or not
we have clauses, so time to check that exactly clauses are satisfied
3.2 SAT Almost-SAT
Consider some problem which is NP-Complete. Being NP-Complete means That’s is as hard as any problems in NP.
From this, notice that
This means, given a known NP-Complete problem ( above), it is enough to reduce that problem to Almost-SAT, to prove that Almost-SAT is NP-Complete too.
By Cook-Levin Theorem we know that SAT is NP-Complete.
Let’s reduce SAT to Almost-SAT, to complete the proof.
- Consider input for SAT problem: a CNF formula of variables and clauses.
- Create a new variable , and use it to define a new formula .
- Note that (where is number of clauses in , and is number of clauses in )
Claim: is satisfiable has an assignment satisfying clauses
Forward implication: take any satisfying assignment for , then set , implication follows immediately.
Reverse implication: for a given satisfying assignment of , only one of clauses or can be satisfied. So, in the whole formula , clauses are satisfiable at most. Now, given such an assignemnt, drop variable from it, and we have satisfactory assignment for .
Since, both transforming to and transforming satisfying assignment for to that of takes polynomial time, SAT Almost-SAT.