36.4-5 Give a polynomial-time algorithm to satisfy Boolean formulas in disjunctive normal form.
Why not use this reduction to give a polynomial-time algorithm for 3-SAT? The DNF formula can become exponentially large and hence the reduction cannot be done in polynomial time.
A Perpetual Point of Confusion
Note carefully the direction of the reduction.
We must transform every instance of a known NP-complete problem to an instance of the problem we are interested in. If we do the reduction the other way, all we get is a slow way to solve x, by using a subroutine which probably will take exponential time.
This always is confusing at first - it seems bass-ackwards. Make sure you understand the direction of reduction now - and think back to this when you get confused.
Integer Programming
Instance: A set v of integer variables, a set of inequalities over these variables, a function f(v) to maximize, and integer B.
Question: Does there exist an assignment of integers to v such that all inequalities are true and ?
Example:
A solution to this is , .
Example:
Since the maximum value of f(v) given the constraints is , there is no solution.
Theorem: Integer Programming is NP-Hard
Proof: By reduction from Satisfiability
Any set instance has boolean variables and clauses. Our Integer programming problem will have twice as many variables as the SAT instance, one for each variable and its compliment, as well as the following inequalities:
For each variable in the set problem, we will add the following constraints:
Both IP variables are restricted to values of 0 or 1, which makes them equivalent to boolean variables restricted to true/false.
Exactly one of the IP variables associated with a given sat variable is 1. This means that exactly one of and are true!
Thus at least one IP variable must be one in each clause! Thus satisfying the constraint is equivalent to satisfying the clause!
Our maximization function and bound are relatively unimportant: B=0.
Clearly this reduction can be done in polynomial time.
We must show:
In any SAT solution, a TRUE literal corresponds to a 1 in the IP, since if the expression is SATISFIED, at least one literal per clause in TRUE, so the sum in the inequality is 1.
Given a solution to this IP instance, all variables will be 0 or 1. Set the literals correspondly to 1 variable TRUE and the 0 to FALSE. No boolean variable and its complement will both be true, so it is a legal assignment with also must satisfy the clauses.
Neat, sweet, and NP-complete!
Things to Notice