Reductions, NP-Completeness & NP-Hardness
How polynomial-time reductions transfer difficulty, how Cook–Levin turns bounded computation into SAT, how to build and audit NP-completeness proofs, and which claims hardness results do not justify.
A reduction is a compiler between decision problems. It converts every instance of problem into an instance of problem while preserving the yes/no answer. If the compiler is efficient, an efficient solver for would yield one for . NP-completeness organizes thousands of apparently different problems around this transferable difficulty—but it supplies conditional evidence, not an unconditional exponential lower bound.
Start with languages and encodings #
A decision problem is represented by a language : strings in are yes-instances. Graphs, formulas, and schedules therefore need explicit encodings. Polynomial time is measured in the encoded length , so a numeric parameter written in binary has length , while unary representation has length . Changing encoding can change whether an algorithm is polynomial; reasonable encodings are polynomially interconvertible, but binary and unary encodings are deliberately not equivalent in that sense.
Recall the class boundary:
- : a deterministic algorithm decides membership in polynomial time.
- : yes-instances have polynomial-size certificates verifiable in deterministic polynomial time; equivalently, a nondeterministic Turing machine decides the language in polynomial time.
- : complements of languages in .
means nondeterministic polynomial time, not "non-polynomial." We know ; whether remains open.
Polynomial-time many-one reduction #
For languages and ,
means that a polynomial-time computable function exists such that, for every input ,
The biconditional is essential: yes-instances map to yes-instances and no-instances to no-instances. The solver composition is
flowchart TD
X["Instance x of A"] -->|"polynomial f"| FX["Instance f(x) of B"]
FX --> SB["Hypothetical solver for B"]
SB --> ANS["Same yes/no answer for A"]
Therefore, if and , then . Read the arrow as is no harder than or is at least as hard as .
Many-one reductions are reflexive and transitive. If via and via , then is polynomial because the length of is polynomially bounded and polynomial compositions remain polynomial.
NP-hard versus NP-complete #
| Classification | Required claims |
|---|---|
| is NP-hard | Every reduces to |
| is NP-complete | is NP-hard and |
NP-hard problems need not be decision problems and need not belong to ; optimization versions are often called NP-hard by reduction from their decision versions. Some undecidable problems are NP-hard as well. NP-complete is the narrower intersection: the hardest decision languages inside under the specified reduction.
The phrase "under the specified reduction" matters. A polynomial-time Turing reduction may ask an oracle several adaptive questions; a many-one reduction produces one instance and preserves its answer directly. Cook's original terminology used an oracle-style reduction, while the modern default definition of NP-completeness uses polynomial-time many-one reductions. Never merge results across these notions without naming the reduction type.
Cook–Levin: bounded computation becomes a formula #
The Cook–Levin theorem establishes that Boolean satisfiability is NP-complete. Membership is immediate: a truth assignment is a polynomial-size certificate, and evaluating a formula is polynomial.
For hardness, take any . A nondeterministic machine decides in time . A complete accepting run on input can be drawn as a tableau:
- each row is one machine configuration;
- the first row encodes the initial configuration on ;
- adjacent rows must obey one transition of ;
- some row is accepting;
- the tableau has polynomially many cells because the time and visited tape region are polynomially bounded.
Introduce Boolean variables describing the symbol, state, and head position in every cell. Add local clauses asserting:
- exactly one compatible symbol/state choice per location;
- the correct initial row;
- at least one accepting state;
- every small window between adjacent rows is a legal transition.
The resulting formula has polynomial size, is constructible in polynomial time, and is satisfiable exactly when has an accepting computation on . The key idea is local checkability: a globally valid computation history is determined by polynomially many constant-size consistency constraints.
Cook's 1971 paper framed the result using tautology and its contemporary reduction terminology; the standard Cook–Levin presentation is the equivalent SAT/CNF many-one formulation.
Worked reduction: 3-SAT to CLIQUE #
Let a 3-CNF formula have clauses . Build a graph:
- Create one vertex for each literal occurrence in each clause.
- Connect two vertices when they come from different clauses and their literals are not contradictory.
- Ask whether the graph contains a clique of size .
Why it works:
- If the formula is satisfiable, choose one true literal from every clause. No two chosen literals contradict, so all chosen vertices are adjacent and form a -clique.
- If a -clique exists, it contains at most one vertex per clause because vertices within a clause are not connected. With clauses it therefore chooses exactly one mutually compatible literal from each. Assign those literals true and extend consistently to the other variables; every clause is satisfied.
For
the occurrences from clause 1, from clause 2, and from clause 3 form a 3-clique. They are pairwise compatible and give a satisfying partial assignment .
The construction has vertices and at most candidate edges, so it is polynomial. Both the size analysis and the reverse implication belong in the proof; a persuasive picture alone is not a reduction.
The reusable proof template #
To prove a decision problem NP-complete:
- Specify an encoding and the exact decision question. Optimization and search variants are not interchangeable with the language.
- Show . Give a certificate, bound its length polynomially, and describe a polynomial-time verifier.
- Choose known NP-complete . Select a source problem whose structure matches .
- Construct . State every generated object and prove its encoded size and construction time are polynomial.
- Prove both directions. Show and .
- Conclude NP-hardness, then combine with membership. Do not call NP-complete after proving only one half.
For reductions involving a numeric threshold, also ensure the threshold itself has polynomial encoded length. Creating an object whose value is exponential can be fine if represented compactly; explicitly writing exponentially many objects is not.
Weak and strong NP-completeness #
An algorithm running in time polynomial in numeric values such as capacity , but not in their bit length , is pseudopolynomial. This distinction motivates:
- weakly NP-complete: hardness may rely on exponentially large numeric values under binary encoding, and a pseudopolynomial algorithm may exist;
- strongly NP-complete: the problem remains NP-complete even when relevant numbers are polynomially bounded (or unary-encoded under the standard formulation).
This terminology is about how numerical magnitude participates in hardness. It does not mean that a weakly NP-complete problem is known to have a polynomial-time algorithm.
What an NP-completeness result licenses #
If any NP-complete language is in , then every language in is in , so . Conversely, if , no NP-complete language is in .
It does not establish:
- that the problem requires exponential time—no such general lower bound follows;
- that every instance is difficult—special cases, parameters, and distributions may be tractable;
- that approximation or heuristics are useless—the reduction concerns exact worst-case decision;
- that is the complement of —the complement class is ;
- that a fast verifier can certify no-instances— only promises certificates for yes-instances;
- that an observed exponential algorithm is optimal.
Auditing a claimed reduction #
Ask these questions in order:
- What are the source and target languages, including encodings?
- Which reduction notion is used—many-one, Turing, randomized, parameterized?
- Is the direction correct for the desired claim?
- Is the transformation total and polynomial in input length?
- Does the biconditional hold, including edge cases and malformed inputs?
- Is membership in separately established before saying NP-complete?
- Does the conclusion remain conditional on , rather than pretending that separation is already known?
This checklist catches most flawed arguments: reversed arrows, one-way constructions, exponential output, optimization/decision drift, and the unjustified leap from "hard in practice" to NP-hard.