\mathcal {NP}-completeness [00WT]
- December 4, 2026
Definition \mathcal {NP}-complete [00WS]
- December 4, 2026
A decision problem X is \mathcal {NP}-complete if both X \in \mathcal {NP} and X is \mathcal {NP}-hard.
Remark [00WU]
- December 4, 2026
It is not at all clear that any such problems exist at all! We could just as easily imagine a situation where there are just a bunch of problems in \mathcal {NP} which are “maximally hard”—that is, no other problems in \mathcal {NP} are harder—but are still not harder than everything in \mathcal {NP}. Or we could imagine that the only problems harder than everything in \mathcal {NP} are themselves so hard that they are not in \mathcal {NP}.
Proposition \mathcal {NP}-completeness and \mathcal {P} vs \mathcal {NP} [00WV]
- December 4, 2026
If a decision problem X is \mathcal {NP}-complete, then X is solvable in polynomial time if and only if \mathcal {P} = \mathcal {NP}.
Proof.
- December 4, 2026
(\Longrightarrow ) If X is solvable in polynomial time, then by a previous lemma, any Y with Y \leq _P X is also solvable in polynomial time. But if X is \mathcal {NP}-complete then by definition it is \mathcal {NP}-hard, meaning that every problem in \mathcal {NP} is reducible to X and hence solvable in polynomial time.
(\Longleftarrow ) If X is \mathcal {NP}-complete then by definition X \in \mathcal {NP}, so if \mathcal {P} = \mathcal {NP} then X \in \mathcal {P}.
Corollary [00WW]
- December 4, 2026
If you come up with a polynomial-time algorithm to solve an \mathcal {NP}-complete problem, you win $1 million.
Remark [00WX]
- December 4, 2026
Good luck. Note that this is not just theoretical; it turns out that there are a great many \mathcal {NP}-complete problems that people actually care about on a practical level. So lots of smart people have been trying hard for a long time to develop good algorithms to solve them, but no one has ever come up with any polynomial-time algorithms for any of them.
The first \mathcal {NP}-complete problem [00WY]
- December 4, 2026
Definition Boolean circuit [00WZ]
- December 4, 2026
A boolean circuit is a directed, acyclic graph G such that:
- Each indegree-0 vertex (“input”) is labelled with either \mathsf {T}, \mathsf {F}, or a distinct variable.
- All other vertices have indegree 1 or 2, and are labelled with either \neg (if indegree 1) or \lor or \land (if indegree 2).
- Only one vertex has outdegree 0, which we call the “output”.
(Note this is not really a “circuit” as we would usually conceive it, since in particular there are no loops!)
Remark [00X2]
- December 4, 2026
Given a truth assignment for the variables labelling the inputs, we think of a Boolean circuit as resulting in a \mathsf {T} / \mathsf {F} value in the obvious way: each edge corresponds to a wire which carries a single \mathsf {T} / \mathsf {F} value to the input of the next logic gate. Boolean circuits come with a natural decision problem.
Problem CIRCUIT-SAT [00X0]
- December 4, 2026
Given a boolean circuit, is there an assignment of the input variables such that the circuit outputs \mathsf {T}?
Theorem CIRCUIT-SAT is \mathcal {NP}-complete [00X1]
- December 4, 2026
Around 1971, Stephen Cook and Leonid Levin independently proved that \mathcal {NP}-complete problems exist, although their proofs were a bit different than the one presented here.
Proof.
- December 4, 2026
First, it is easy to see that CIRCUIT-SAT \in \mathcal {NP}: a certificate is a truth assignment; to verify it in polynomial time we can just run the circuit and check that it outputs \mathsf {T}.
Now we must show CIRCUIT-SAT is \mathcal {NP}-hard. Suppose X \in \mathcal {NP}, i.e. X has a polynomial-time certifier B. We must show X \leq _P CIRCUIT-SAT.
Since B is an algorithm, it can be encoded as a boolean circuit (proof: computers exist, and any boolean function can be encoded using \land , \lor , \neg ). Well, except for one problem: our boolean circuits have no loops. But we can circumvent that by simply “unrolling” any loops, by making a whole bunch of copies of a circuit that computes a single step. If the algorithm only runs for a polynomial amount of time then we need at most a polynomial number of copies to make this work. So, intuitively, we can build a polynomial-sized boolean circuit that simulates the algorithm B. Given an input s, we fix the inputs corresponding to s, and leave as variables the inputs corresponding to t. Now we ask whether the resulting circuit is satisfiable. If it is, that means there is some t such that B(s,t) = \mathsf {T}, that is, s \in X. If it is not satisfiable, then there is no such t, so s \notin X. Hence X \leq _P CIRCUIT-SAT.
Now that we know there is one \mathcal {NP}-hard problem, finding others is a lot simpler!
Theorem [00X3]
- December 4, 2026
Corollary [00X4]
- December 4, 2026
SAT, IND-SET, and Vertex cover are all \mathcal {NP}-complete.
Proof.
- December 4, 2026
Remark [00X5]
- December 4, 2026
This is amazing. Just by looking at the definitions it wasn’t at all clear whether we would be able to find a single problem which was \mathcal {NP}-complete, and now we have found five. In fact, it turns out that we currently know of hundreds of “natural” problems which are \mathcal {NP}-complete. Richard Karp got this all started with his 1979 paper proving 21 different \mathcal {NP}-hard problems.
So, the “reason” CIRCUIT-SAT is \mathcal {NP}-hard is that we can use it to model arbitrary computation, by essentially building a little computer. But think about what this transitive chain of reductions is then showing us: we can take a circuit modelling a computer and reduce it to a 3-SAT instance which models the same computer. But we can then in turn take that 3-SAT instance modelling a computer and reduce it to a graph, such that finding an independent set of a certain size in the graph models the same computation! Computation is sneaky like that; you end up finding it in places you would not expect. Who would have guessed that finding independent sets in a graph turns out to be equivalent to doing arbitrary computation? But in some sense \mathcal {NP}-complete problems are like this, and this gives us some intuition as to why they are so hard to analyze: because you can smuggle arbitrary computation into them!
Super Mario Bros is \mathcal {NP}-hard [00X6]
- December 4, 2026
See this 2012 paper by Aloupis et al. showing that Super Mario Bros (and a bunch of other classic video games) are \mathcal {NP}-hard, in the sense that it is hard to decide whether a given level can be beaten or not. The proof is by reduction from 3-SAT.