Prove 3-SAT is NP Complete: Suffices to show that CIRCUIT-SAT ≤P 3-SAT since 3-SAT is in NP
Let K be any circuit.
We associate a variable xv with each node v of the circuit
If node v is labeled with ¬, and its only entering edge is from node u : we add two clauses (xv∨xu), and (xv∨xu).
If node v is labeled with ∨, and its two entering edges are from nodes u and w, we add the following clauses: (xv∨xu),(xv∨xw), and (xv∨xu∨xw),
If node v is labeled with ∧, and its two entering edges are from nodes u and w : we add the following clauses: (xv∨xu),(xv∨xw), and (xv∨xu∨xw).
For a source v that has been labeled with a constant value, we add a clause with the single variable xv or xv
For the output node o, we add the single-variable clause xo
example of reduction: (0∨a)∧(¬b)=1
Create an instance of 3-SAT with 6 variables: x0,x1,x2,x3,x4,x5, corresponding to 6 circuit elements
Final step: turn clauses of length <3 into clauses of length exactly 3
Suppose that the given circuit K is satisfiable. The satisfying assignment to the circuit inputs can be propagated to create values at all nodes in K. This set of values clearly satisfies the constructed 3-SAT instance.
Suppose that the constructed 3-SAT instance is satisfiable, with a satisfying. Look at the values of the variables corresponding to the circuit K’s inputs, and claim that these values constitute a satisfying assignment for the circuit K. This is because the 3-SAT clauses ensure that the values assigned to all nodes of K are the same as what the circuit computes for these nodes.
Given an NP-complete problem, how to prove that a problem Y is NP-complete.
Step 1. Show that Y is in NP.
Step 2. Choose an NP-complete problem X.
Step 3. Prove that X≤PY
Justification. If X is an NP-complete problem, and Y is a problem in NP with the property that X≤PY then Y is NP-complete.
Proof. Let W be any problem in NP. Then W≤PX≤PY
By transitivity, W≤PY. Hence Y is NP-complete
Refined strategy:
Step 1: Prove that X ∈ NP.
Step 2. Choose a problem Y that is known to be NP-complete.
Step 3. Consider an arbitrary instance s(Y) of problem Y, and show how to construct, in polynomial time, an instance s(X) of problem X that satisfies the following properties:
(a) If s(Y) is a YES-instance of Y, then s(X) is a YES-instance of X.
(b) If s(X) is a YES-instance of X, then s(Y) is a YES-instance of Y