The steps involved in proving that a problem is NP-Complete are fairly straightforward to follow, it's the logic behind why the proof is valid that's really throwing me for a loop. Okay so an easy one: we are showing that 3SAT is NP-Complete. There are 2 things that must be shown. First we show that 3SAT is in NP and then we must show that it is NP-Hard. To show that 3SAT is NP we just show that a given solution can be verified in polynomial time. Now say we show 3SAT is NP-Hard using Circuit SAT. We find a polynomial time reduction from Circuit SAT to 3SAT. Then we show that an arbitrary solution to Circuit SAT gives us a corresponding solution for 3SAT and also show that if we're given the solution to a 3SAT problem that was generated by our polynomial time algorithm that we can also derive the solution to the corresponding Circuit SAT problem. That all seems fairly straightforward, but why does doing this allow us to conclude that 3SAT is NP-Hard and thus is NP-Complete?
- There is no contradiction
- NP-hard means that the problem is "harder than" all problems in NP.
- We know that Circuit Sat is NP-complete.
We know that Circuit Sat is harder than all problems in NP. If 3SAT is harder than Circuit Sat, then 3SAT must also be "harder than" all problems in NP.
NP-complete is defined as NP membership and NP-hardness. You prove both, hence you've proved NP-completeness.
If you're still uncertain, go back to the definitions of NP and polynomial time reductions.
Check also the reference question What is the definition of P, NP, NP-complete and NP-hard?
What is NP
A problem is in NP if, with a polynomial-length "magically provided" proof string for any given problem instance whose answer is "yes", can verify the answer is "yes". Equivalently, if you make a NDTM that accepts problems whose answer is "yes" in polynomial time. These are equivalent; the "proof string" can be treated as the set of choices the NDTM would take to reach the accept state. The "magically provided" bit because the NDTM tries every path, and if any one path accepts, we record that "proof string". A deterministic turning machine could take the description of the NDTM and the "proof string" and verify that the problem is accepted by the NDTM.
What is NP-hard
A problem is in NP-hard if, given a polynomial time solution for it, you could solve all NP problems in polynomial time. In fact, it means you can "reduce" all NP problems to a problem in your NP-hard problem set in polynomial time. This means map the NP problem to an instance of your NP-hard problem in such a way that a solution to your NP-hard problem gives you the answer to your NP problem.
Now, once you have found one NP-hard problem X, you can "reduce" others to it. A reduction is when you take your problem set Y, and show that any problem in X can be mapped to a problem in Y in polynomial time in such a way that solving the Y problem implies the solution to the X problem.
If we have such a reduction, then any arbitrary NP problem into an X problem, then reduce that to a Y problem, and thus a P-time solution to Y problems is sufficient to solve any arbitrary NP problem in P-time.
What is NP complete
NP complete is when something is both NP-hard and in NP. There are problems that are NP-hard but we know (or strongly suspect) are much harder than NP.
Now, almost all of the time when you prove something NP-complete, we reduce it to another problem.
At the base of all of this is some problem we proved to be NP-hard and in NP without reducing it to another problem.
The trick is we can carefully pick such a problem so that the proof is pretty much by definition. We defined membership in NP as either acceptance by an NDTM or by effectively a proof-checker ("certificate verifier" if you don't want to talk about proofs). Proving those two are equivalent isn't that hard.
All we have to do is take some more amenable and show it can solve a sufficiently powerful certificate verifying system in polynomial time.
What you end up with is a web of known NP-complete problems. Some of them are reduced with clever tricks, some of them are cleverly designed to be easy to reduce to. And instead of having to go all the way back to the definition of NP to show something is NP-hard, you can just reduce one of a library of known NP-complete ones to it to pull it off.
Take as given the following:
- Circuit SAT is NP-Complete (which means it is also NP-Hard)
- A problem is NP-Hard if and only if, for every problem in NP, there exists a polynomial time algorithm that converts it into the NP-Hard problem. This is the definition of NP-Hard.
Now, in your proof, you demonstrate that there exists a polynomial time algorithm that converts any Circuit SAT problem into a 3SAT problem. Consider the following algorithm:
- Start with any problem in NP.
- Convert the problem into Circuit SAT in polynomial time. This is guaranteed to be possible because Circuit SAT is known to be NP-Complete.
- Use your polynomial time conversion algorithm to convert it from Circuit SAT into a 3SAT problem.
Doing two polynomial time algorithms in sequence takes polynomial time, so this algorithm runs in polynomial time. It also converts any problem in NP into a 3SAT problem. The ability to do that in polynomial time is the definition of NP-Hard, therefore 3SAT is NP-Hard.