NP-Completeness
Context: FIT2014_MOC · the hardest languages in — [[Polynomial-Time Reductions|]] finally used to name a summit rather than compare two problems, collapsing the whole -vs- question onto any single one of them
Quick Revision
- 🎯 Objective: is NP-complete iff (a) and (b) ➔ so a polynomial-time decider for one NP-complete language would give one for every language in .
- 📦 Core Components: condition (a) membership ➔ a verifier | condition (b) hardness ➔ universal reducibility | the master theorem ➔ has a poly decider .
- ⚡ Key Constraint: (b) alone is not NP-completeness. A language everything reduces to but which sits outside (e.g. an undecidable one) is NP-hard, not NP-complete — both conditions are marked separately.
📝 How It Works
1. The definition, and the two ways to fail it
Definition. A language is NP-complete if (a) , and (b) every language in is polynomial-time reducible to : .
- (a) fails ➔ lies outside . It does not matter that everything in reduces to it — such an is only NP-hard, and cannot be the summit of because it is not in the set.
- (b) fails ➔ but some has . is then a member, not a maximum — every language in is like this (given ).
- Quantifier discipline ➔ (b) ranges over all of , an infinite set. That is why establishing the first NP-complete language (Cook-Levin Theorem) is hard and every one after it is one reduction away.
2. Why one language decides the whole question
- The collapse ➔ condition (b) makes a universal solver: an efficient algorithm for is, via the reduction, an efficient algorithm for everything in .
- Consequence for practice ➔ proving your problem NP-complete is proving it at least as hard as SATISFIABILITY, HAMILTONIAN CIRCUIT, and 3-COLOURABILITY simultaneously — which is why nobody expects you to then find a fast exact algorithm.
- What it does not settle ➔ NP-completeness is a statement about ‘s position, not its difficulty in absolute terms. Whether that position is inside is the open question itself.
3. The landscape — two possible worlds
| Region | If | If |
|---|---|---|
| In | 2-SAT, EULERIAN CIRCUIT, 2-COLOURABILITY, CONNECTED GRAPHS, SHORTEST PATH, PRIMES, invertible matrices, all regular and all context-free languages | everything below, merged |
| NP-complete | SATISFIABILITY, 3-SAT, HAMILTONIAN CIRCUIT, 3-COLOURABILITY, VERTEX COVER, INDEPENDENT SET | the whole picture is one blob — |
| In , in neither | GRAPH ISOMORPHISM, INTEGER FACTORISATION — not known in , not known NP-complete | region vanishes |
- Instance stock ➔ the named problems and their certificates are catalogued in Standard NP Problems and Certificates; this table only places them.
- The picture is degenerate ➔ under the three regions cannot be distinguished, which is itself the revision exercise the slides pose (see Active Recall).
4. co-NP and the remaining open questions
- co-NP ➔ the complements of languages; co-NPC the complements of the NP-complete ones. sits inside .
- Second open question ➔ does ? Open, and the lecture’s remark is that in practice there does not seem to be much difference.
- Standing assumption for the picture ➔ the two-lobe diagram is drawn under and ; neither is proved.
5. Living with NP-completeness
Proving a language NP-complete does not make it go away — you may still need to ship an algorithm for it. NP-completeness is evidence that no single algorithm is efficient, deterministic, all-cases, and exact at once. So drop exactly one of the four:
| Drop | What you build | What you give up |
|---|---|---|
| efficient | exponential-time exact algorithm | speed |
| deterministic | randomised algorithm | a guaranteed run |
| all cases | algorithm for a special case | generality |
| exact | approximation algorithm | optimality |
- Not a fifth option ➔ the slides raise quantum computers only as a maybe in future, not as a known escape.
🧮 Proof Blueprint — the master theorem
Theorem. Let be any NP-complete language. There is a polynomial-time decider for if and only if .
Strategy ➔ each direction uses exactly one half of the definition — () uses membership (a), () uses hardness (b) plus the [[Polynomial-Time Reductions| transfer theorem]]. Naming which half you are spending is the marked move.
Derivation — ( ) assume
- Key move: condition (a) is doing all the work — without it need not be in at all and the hypothesis says nothing about it.
Derivation — ( ) assume
is already known, so it suffices to show . Let be arbitrary.
- Key move: must be introduced as arbitrary before (b) fires — that is what upgrades one reduction into the set inclusion .
Slide 12 exercises: two characterisations of and of NP-completeness via a fixed NP-complete .
Worked answers Theorem 1. For NP-complete and any : .
- () is condition (b) of ‘s NP-completeness, applied to .
- () is the closure exercise from Polynomial-Time Reductions: and give — run ‘s verifier on and pass the certificate through.
Theorem 2. For NP-complete and any : is NP-complete and .
- () by ‘s condition (b); by ‘s condition (b) — each language’s hardness clause supplies one direction.
- () with gives (condition (a)); with NP-complete gives condition (b) by the inheritance theorem.
- Key move: NP-complete languages are exactly the -equivalence class at the top of — mutual reducibility, not a one-way bound.
⚠️ Common Mistakes
- 💡 Proving only hardness ➔ (b) without (a) is NP-hard. The HALTING PROBLEM is NP-hard and undecidable; calling it NP-complete is a straight error.
- 💡 Reducing in the wrong direction ➔ NP-completeness of needs for arbitrary — reducing to a known-hard problem shows is easy enough, which is the opposite claim.
- 💡 Saying “NP-complete means no algorithm exists” ➔ every NP-complete language is decidable (it is in ). What is doubted is a polynomial-time algorithm, and even that is conditional on .
- 💡 Writing “NP” for “not polynomial” ➔ is nondeterministic polynomial; , so every easy language is in too.
- 💡 Treating the two-lobe diagram as fact ➔ it depicts the conjectured world . State the assumption when you draw it.
🧠 Active Recall
If turned out to be true, which languages would be NP-complete?
Answer
- Short answer: every language in except and .
- Why: the definition survives but stops discriminating ➔ under every is in , and a language in reduces to any with at least one Yes-instance and one No-instance — decide outright, then output a fixed member or non-member of . The two trivial languages are excluded exactly as in Polynomial-Time Reductions, because a constant-valued needs both targets to exist.
- Reading: the three-region picture collapses to one blob, so “NP-complete” would carry no information about difficulty.
Your problem is proved NP-complete the week before shipping. What actually changes about your engineering plan?
Answer
- Short answer: you stop searching for the fast exact algorithm and choose which of the four properties to abandon — efficient, deterministic, all-cases, exact.
- Why: NP-completeness is evidence, not a prohibition ➔ it says the target algorithm would also solve SAT, and no such algorithm is known. The problem still needs solving, so you ship an exponential exact solver, a randomised solver, a special-case solver, or an approximation — and you can also route the instance through a SAT solver, since your problem is by definition (see Reducing to SATISFIABILITY).
Why is establishing the first NP-complete language qualitatively harder than the hundredth?
Answer
- Short answer: condition (b) quantifies over all of , so with no NP-complete language in hand there is nothing to reduce from and the argument must be generic over machines.
- Why: the Cook-Levin Theorem pays that cost once ➔ it reduces an arbitrary polynomial-time verifier’s computation to a CNF formula. Afterwards [[Proving NP-Completeness by Reduction|transitivity of ]] means a single reduction from a known NP-complete language suffices — Karp’s 1972 move.