TCS: NP Completeness
NP Completeness
Polynomial-Time Reductions
A polynomial-time many-one reduction is a polynomial-time computable function satisfying
A language is NP-hard when every language in reduces to it. It is NP-complete when it is NP-hard and also belongs to
The direction records which solver would help: means a solver for can solve . To prove a new problem hard, reduce a known hard problem to it
Reductions compose. Consequently, a polynomial-time algorithm for one NP-complete language implies
For each construction, check four things: the output instance, its polynomial construction cost, the forward implication, and the reverse implication
Cook-Levin Theorem
SAT is NP-complete
SAT has a polynomial-time verifier, so the main task is to encode an arbitrary NP computation as a formula
Let be a polynomial-time verifier running for at most steps. Pad its accepting computations so that they remain accepting through step
Computation Tableaux
A configuration records the tape contents, the head location, and the state. During steps, at most polynomially many tape cells are relevant
Introduce Boolean variables for every cell at every time. Use a finite alphabet that records a machine state together with the scanned tape symbol at the head position
The formula enforces three kinds of conditions
- fixes the input portion to , leaves the certificate portion free, and specifies a valid initial configuration
- requires every neighboring pair of rows to follow the transition rules
- requires an accepting final configuration
For a fixed machine, whether a cell in the next row is legal depends on a constant-size neighborhood in the previous row. Each local consistency condition therefore has a constant-size Boolean representation
There are polynomially many rows and columns, so the complete formula is polynomial in . An accepting certificate yields a satisfying tableau, while a satisfying tableau encodes an accepting computation
From SAT to 3-SAT
Introduce a variable for the output of each gate of a Boolean circuit computing the formula. For an AND gate , its behavior is enforced by
An analogous constant-size encoding handles NOT and OR gates. Add a unit clause requiring the output variable to be true
The resulting 3-CNF is satisfiable exactly when the original formula is satisfiable. It is an equisatisfiable encoding with auxiliary variables, rather than an equivalent formula over only the original variables
Vertex Cover, Independent Set and Clique
3-SAT to Vertex Cover
For a formula with variables and clauses of three literal occurrences, construct a graph as follows
- For each variable, add vertices connected by an edge
- For each clause, add a triangle with one vertex for each literal occurrence
- Connect each clause vertex to the variable vertex carrying the same literal
- Set the cover budget to
Every variable edge needs at least one chosen endpoint, and every clause triangle needs at least two. Thus a cover within the budget must spend exactly these amounts
Given a satisfying assignment, choose the true literal vertex from each variable edge. In each clause triangle, leave one true literal occurrence unchosen and choose the other two. Its connecting edge is covered at the true variable vertex, so all edges are covered
Conversely, a cover of size chooses exactly one variable vertex per pair and leaves exactly one clause vertex unchosen. The connecting edge from that unchosen vertex forces its corresponding variable vertex to be chosen. Reading chosen variable vertices as true therefore satisfies every clause
Two Simple Transformations
For a graph ,
An independent set in is a clique in the complement graph . Hence
All three problems have efficiently checkable witnesses, completing their NP-completeness proofs
Not-All-Equal SAT and 3-Coloring
A not-all-equal constraint accepts exactly the Boolean triples containing both a true and a false value
One route from 3-SAT introduces a shared variable and replaces each clause by . Complementing all variable values preserves every NAE constraint, so any satisfying assignment can be oriented to have
Four-input constraints can be split using a fresh variable
When , the first constraint forces , and the second excludes precisely the case . When , the first constraint permits either value of , allowing the second to be satisfied
A Clause Gadget for 3-Coloring
Create a reference triangle with colors named . For each variable, connect its two literal vertices to each other and connect both to the reference vertex . They must receive opposite colors
For each NAE clause, add a fresh triangle and connect to the corresponding literal vertex
If all three literals have the same color, the clause triangle has only two available colors and cannot be colored. If the literals contain both and , assign to a triangle vertex attached to an literal, to one attached to a literal, and to the remaining vertex
Thus the clause triangle is extendibly 3-colorable exactly when the NAE constraint holds. This is a polynomial reduction to 3-COLORING
Hamiltonian Cycles
Hamiltonian cycle has a polynomial certificate: a cyclic ordering of all vertices. Its NP-hardness can be shown by a gadget reduction from vertex cover
The construction replaces each original edge by a gadget whose complete traversals correspond to selecting its left endpoint, its right endpoint, or both. There is no valid traversal representing selection of neither endpoint
Gadget interfaces associated with the same original vertex are linked into a chain. Selector vertices limit the number of such chains used. A small vertex cover supplies a Hamiltonian traversal, while a Hamiltonian cycle must account for every edge gadget and therefore induces a cover
The exact gadget and its allowed traversals are part of the construction; checking only that the graph has polynomial size does not prove the reverse implication. The lecture’s Hamiltonian-cycle section contains the gadget diagram
Hamiltonian path and cycle are closely related. Adding one new vertex adjacent to every original vertex transforms an undirected Hamiltonian-path instance into a Hamiltonian-cycle instance: remove the new vertex from a cycle to recover the path
In the other direction, split a chosen cycle vertex into two copies with its original neighbors and attach a fresh leaf to each copy. A Hamiltonian path must run between the leaves, and identifying the split copies recovers a Hamiltonian cycle
MAX-CUT from NAE-3-SAT
A triangle contributes two cut edges exactly when its three vertices are not all on the same side
Construct a weighted multigraph with a vertex for each literal. Give each pair an edge of positive integer weight , and add the three unit-weight edges of a triangle for each clause, retaining multiplicities
The sum of the separate upper bounds is
A satisfying NAE assignment reaches by separating opposite literals and cutting each clause triangle twice. Conversely, reaching requires every variable edge and every triangle to attain its individual upper bound, giving a consistent NAE assignment
To obtain a simple unweighted graph, replace each unit of edge weight by a three-edge path with fresh internal vertices. Such a path contributes at most three cut edges when its endpoints differ and at most two when they agree; both bounds are achievable independently
If the total edge weight is , this transforms the cut threshold into . The construction stays polynomial for polynomially bounded weights, so the usual unweighted MAX-CUT decision problem is NP-complete as well
NP-Intermediate Languages
Ladner’s theorem: if , there exists a language in that belongs neither to nor to the NP-complete languages
The idea is delayed diagonalization. Pad SAT instances by an amount that grows carefully: enough to obstruct every proposed polynomial reduction making the padded language complete, but slowly enough to defeat every proposed polynomial-time decider
The padding schedule is part of the effective construction. Arbitrarily choosing a large padding function does not automatically prove either property
The theorem establishes the existence of intermediate languages under . It does not classify a particular natural problem such as graph isomorphism