Open In App

Prove Max2SAT is NP-Complete by Generalisation

Prerequisites: NP-Completeness, NP Class, Max2SAT, 3SAT

Problem: Given a 2-CNF (Conjunctive Normal Form) Boolean expression (with m clauses, n variables) and an integer k, Decide if there is an assignment satisfying at least ‘k’ of the total clauses and then prove Max2SAT belongs to NP-Complete



Explanation:

In the maximum-2-satisfiability problem (MAX-2-SAT), the input is a formula in conjunctive normal form with two literals per clause, and the task is to determine the maximum number of clauses that can be simultaneously satisfied by an assignment. MAX2SAT is a generalisation of 2SAT since the latter is a special case of the former where k is equal to the number of clauses



We will prove Max2SAT as NP-Complete using the 3SAT problem which is a known NP-Complete Problem.

In the 3SAT, the input is a formula in conjunctive normal form with three literals per clause, and the task is to determine the maximum number of clauses that can be simultaneously satisfied by an assignment.

Proof:

1. Input Conversion: To show the conversion, we will convert the input from 3SAT to Max2SAT.

If one of a clause in 3SAT is  c= (x ∨ y ∨ z) then this would be converted into Max2SAT input such that all the clauses would have at most 2 literals. An extra literal d which can be 0 or 1 is added such that  d does not interfere with the satisfiability of x, y and z since we add clauses “q ∨ ¬d “ for all q ∈ {x, y, z} and the final input conversion would be as:

(x)∧(y)∧(z)∧(d)∧(¬x ∨ ¬y)∧(¬y ∨ ¬z)∧(¬x ∨ ¬z)∧(x ∨ ¬d)∧(y ∨ ¬d)∧(z ∨ ¬d)

c = (x ∨ y ∨ z)  
⇒ (x)∧(y)∧(z)∧(d)∧(¬x ∨ ¬y)∧(¬y ∨ ¬z)∧(¬x ∨ ¬z)∧(x ∨ ¬d)∧(y ∨ ¬d)∧(z ∨ ¬d)

So 1 clause in 3SAT would be converted into 10 clauses in Max2SAT. So for 3SAT if there were m clauses then Max2SAT will have 10m clauses.

2. Output Conversion: We need to convert the solution from Max2SAT to the solution for the 3SAT. 

So, assigning values to n literals takes O(n) time. So output conversion is polynomial in time.

3. Correctness: Now let’s check the assignment for the converted input. 

For this, we will group the above converted input into 3 groups.

  1. (x)∧(y)∧(z)∧(d)
  2. (¬x ∨ ¬y)∧(¬y ∨ ¬z)∧(¬x ∨ ¬z)
  3. (x ∨ ¬d)∧(y ∨ ¬d)∧(z ∨ ¬d)

We will check by testing some truth value assignments.

From the above testing, we can make the following conclusion: 

Any assignment that satisfies the 3SAT formula must satisfy all m clauses. Satisfying 1 clause in 3SAT(where at least one of x, y, and z is satisfied) satisfies exactly 7 clauses in the corresponding 10 clauses of Max2SAT.

Hence, satisfying all m clauses in 3SAT means satisfying exactly 7m clauses in Max2SAT. So, set k = 7m in the Max2SAT problem.

Conclusion:

So, since we know 3SAT is NP-Complete, this means that unless P = NP, that Max2SAT must also be NP-Complete.

Article Tags :