Reductions and Completeness
Polynomial many-one reductions and the logic of hardness and completeness proofs.
Goals
- Construct polynomial many-one reductions with the correct direction, totality, and encoding analysis.
- Use transitivity and downward closure to transfer algorithms and class membership.
- Distinguish NP-hardness from NP-completeness and derive the consequence correctly.
- Understand Cook–Levin as an explicit polynomial-size tableau construction.
- Prove both directions of the standard reduction .
1. A reduction is an instance compiler
For languages ,
means that a total, polynomial-time computable function satisfies
for every string . The same output instance must preserve both yes and no answers; this is why the biconditional is indispensable.
Suppose a polynomial algorithm decides . Then decides . The arrow therefore points from the problem whose difficulty we already understand to the problem whose hardness we want to establish:
Reducing to only shows that access to an solver helps with ; it gives no evidence that is hard.
NP-complete reduction chain
Totality and malformed inputs
The definition quantifies over strings, not only well-formed formulas or graphs. A clean construction first tests whether encodes a legal source instance. On malformed input it emits one fixed legal no-instance of . This convention must agree with the source language’s malformed-input convention.
A polynomial-time transducer can print only polynomially many symbols, so its output length is polynomially bounded. Nevertheless, a proof should state the bound explicitly, especially when numbers are binary encoded.
2. Transitivity, closure, and algorithm transfer
Transitivity. If via and via , then via .
Correctness.
Complexity. Suppose runs in time and in time . Then up to a harmless constant, because writing output costs time. Hence
a polynomial. Saying merely “a composition of polynomial algorithms is polynomial” hides this essential output-length bridge.
Downward closure. If and , then . The same statement holds with NP or coNP in place of P.
For NP, let verify . Verify by computing and running . The certificate bound remains polynomial because is polynomial in . For coNP, apply the same argument to complements: the biconditional gives
This closure fact explains why a single reduction can move an upper bound backward along its arrow.
3. Hardness, completeness, and the P=NP consequence
A language is NP-hard if
It is NP-complete if additionally . The membership proof is usually a verifier; the hardness proof usually starts from an already NP-complete problem. An NP-hard language need not even be decidable, so hardness alone never establishes completeness.
Theorem. If an NP-complete language belongs to P, then .
Proof. Let . Hardness gives . Since , downward closure gives . Therefore . The reverse containment is standard, so equality follows.
The contrapositive is also useful but conditional: if , then no NP-complete language is in P. We do not currently know the premise.
4. Cook–Levin: computation becomes a formula
Cook–Levin proves SAT NP-complete. SAT is in NP because an assignment can be evaluated in polynomial time. Hardness is the deeper part: for every and input , construct a Boolean formula satisfiable exactly when an NTM has an accepting computation on .
Assume every branch of halts within steps. During that time the head can visit only tape cells. Pad shorter accepting runs with a self-looping accept state, so every relevant history has exactly rows. A tableau is a grid, , whose row is the complete configuration at time .
Cook–Levin tableau
Tableau variables
Let the finite alphabet
contain ordinary tape symbols and marked symbols meaning “the head is here, the state is , and the scanned symbol is .” Introduce
for , , and . Its intended meaning is that cell of row contains symbol .
There are variables because is fixed and is constant.
Uniqueness constraints
Every tableau location contains exactly one symbol:
enforces at least one, while for every ,
enforces at most one. Across cells this contributes clauses for a fixed machine alphabet. Exactly one marked state/head symbol per row can be imposed similarly, or derived from a carefully chosen local-rule system plus the valid start row.
Start constraints
Unit clauses fix row to the initial configuration: state scans the first input symbol, the remaining input symbols occupy their cells, and all unused cells contain blanks. Because is known while constructing the formula, these are literal constants encoded by unit clauses.
Acceptance constraints
Require an accepting marked symbol somewhere:
With the padded accepting self-loop, one may instead require in the final row. Either convention works, but the transition constraints and boundary treatment must match it.
Local transition constraints
A Turing transition changes only the scanned cell, the state marker, and possibly a neighboring cell receiving the head. Therefore whether a small window in row legally follows row depends on a constant-size window—commonly a or neighborhood.
For each position and each forbidden local pattern , add a clause forbidding all its literals simultaneously:
The window size and alphabet are constants, so there are only constantly many pattern types per . Boundary cells use endmarkers or separate fixed rules. These clauses enforce that unchanged distant cells stay unchanged and that the head/state update follows one legal nondeterministic transition.
Correctness: the two directions
If accepts , choose an accepting branch, write its configurations as a padded tableau, and assign each according to the grid. Every uniqueness, start, acceptance, and local-transition clause is then true.
Conversely, if is satisfiable, uniqueness decodes one symbol per location. Start clauses make row the real initial configuration. Local clauses ensure each next row is a legal successor, not merely a visually plausible row. Acceptance clauses ensure the decoded branch accepts. Therefore
Polynomial size and construction time
There are cells. Each receives constantly many uniqueness clauses; each space-time position receives constantly many local clauses; start and accept portions are at most polynomial. Thus under the fixed-machine encoding, or another fixed polynomial under alternative encodings. Enumerating the clauses takes polynomial time. This size argument is what turns the tableau idea into a reduction rather than a handwave.
The usual final step converts a general formula to CNF and then to 3CNF with auxiliary variables while preserving satisfiability and polynomial size.
What a local window actually checks
Suppose the upper row contains
and permits the move “write , move right, enter state .” The corresponding lower-row neighborhood must be
For a left move, the state marker moves onto the left symbol instead. If the head lies outside a window, the lower middle symbol must equal the upper middle symbol. The finite list of allowed windows contains these cases for every transition in , together with ordinary copy windows.
To encode “this window is one of the allowed ones” in CNF, it is convenient to enumerate every forbidden assignment to its constant number of positions. If a forbidden assignment sets literals true, the clause
excludes precisely that assignment. Here is a machine-dependent constant. Overlapping windows are crucial: agreement on their shared cells stitches local legality into one globally legal successor configuration. Without overlap, unrelated legal fragments could be combined into an impossible row.
For explicit accounting, write . Location constraints use clauses of width for “at least one” and binary clauses for “at most one.” Start constraints use unit clauses. A final-row acceptance condition has width at most . If is the constant number of forbidden window patterns, transitions use at most constant-width clauses. Since depend on , not on , the total symbol count is , apart from the acceptance clause’s still-polynomial width. Converting a width- clause to 3CNF introduces only variables and clauses, so polynomial size survives.
5. Full reduction: 3SAT to Independent Set
Let
be a 3CNF formula, allowing repeated literals if the chosen 3SAT definition does. Build a graph :
- Create one vertex for each literal occurrence in clause .
- Connect every pair of vertices belonging to the same clause. Each clause gadget is a triangle (or a clique for clauses represented with fewer distinct occurrences).
- Connect two vertices from different clauses whenever their literals are complementary, and .
- Output .
The graph has vertices and at most edges, so it is polynomial to construct.
3SAT → Independent Set
Forward direction
Assume is satisfiable under assignment . In each clause choose one occurrence made true by , and put its vertex in . Exactly one is chosen from each clause, hence . No two chosen vertices lie in one clause, so no clause edge joins them. Nor can two chosen literals be complementary: one assignment cannot make both and true. Therefore is independent.
Reverse direction
Assume has an independent set of size . Since every clause gadget is a clique, contains at most one vertex from each clause. There are exactly clauses and selected vertices, so it contains exactly one from every clause.
No selected pair is connected by a conflict edge, so the selected literals contain no complementary pair. Define a partial assignment making each selected literal true. It is consistent: no variable is forced both ways. Extend arbitrarily to unmentioned variables. Each clause contains its selected true literal, so every clause—and therefore —is satisfied.
Thus
IS is in NP: list distinct vertices and test every pair for nonadjacency. Since 3SAT is NP-hard, this proves IS NP-complete.
Mini-example
For
create three triangles, one per clause, and set . Add conflict edges between the first occurrence of and the second occurrence of ; between every occurrence and the third clause’s ; and any other complementary pair that appears. Repeated positive occurrences such as are not conflicts with one another.
The assignment satisfies the formula. One resulting independent set chooses from , from , and from . These vertices lie in different triangles and no selected literals are complementary.
Now start from an arbitrary independent set of size three. It cannot choose two vertices from one triangle. Because there are three triangles, it chooses one per clause. It cannot, for example, choose from and from , because those vertices have a conflict edge. Thus its three chosen literals form a consistent partial assignment and certify all three clauses simultaneously.
This example also shows why selecting merely two nonconflicting vertices would not suffice: two clauses could be represented while the third remained unsatisfied. The threshold is part of the reduction’s logic, not a cosmetic parameter.
6. A reduction-proof checklist
Before declaring a reduction complete, verify five separate obligations:
- Input and output. State the exact decision-language encodings and parameters.
- Construction. Describe on legal and malformed source strings.
- Forward implication. Transform every source witness into a target witness.
- Reverse implication. Decode every target solution meeting the threshold into a source solution.
- Resources. Bound output objects, bit lengths, and construction time in the encoded source length.
For 3SAT→IS, these become: occurrence vertices; clause and conflict edges; one true occurrence per clause in the forward direction; one consistent occurrence per clause in the reverse direction; and output size. Keeping the obligations separate prevents a persuasive gadget drawing from replacing the formal proof.
7. Direction tested with a hypothetical solver
A reliable direction test is to write the algorithm that would follow from the reduction. Suppose the goal is to show a new problem is hard and SAT is the known-hard source. Given a SAT formula , compute , call a hypothetical solver for once, and return that answer. This algorithm exists precisely when
Thus the required statement is . If the construction instead starts from a instance and calls a SAT solver, it proves —an upper-bound style result that every NP language already has after Cook–Levin.
Reductions also compose into a network. From
transitivity gives . There is no need to rebuild the Cook–Levin tableau inside the graph reduction. This modularity is the practical value of completeness: after one universal source is established, later proofs can begin from whichever complete problem best matches the target structure.
Finally, a reduction does not compare the running times of the best algorithms in both directions. From , a fast algorithm gives a fast algorithm up to polynomial overhead. A fast algorithm says nothing about , and the reduction alone does not prove that is strictly harder.
Common mistakes
- Reversing the hardness arrow.
- Proving only “yes maps to yes” rather than an iff.
- Ignoring malformed strings or claiming a partial mapping.
- Measuring numeric runtime in value rather than binary length.
- Declaring NP-completeness after hardness without proving membership.
- Saying “Cook–Levin records a computation” without variables, constraints, correctness, and size.
- In 3SAT→IS, forgetting clause edges or complementary-literal edges.
- In the reverse proof, failing to explain why size forces one choice per clause.
Exercises
Exercise 1 — Direction of hardness
Let . Prove: if then . Explain what flows backward and what flows forward along the reduction arrow.
Solution
If with polynomial-time, a decider for yields one for by composition. Algorithms/membership in downward-closed classes flow from to (backward along hardness). Hardness flows from to (forward): if is hard and then is at least as hard as .
Exercise 2 — Two obligations for completeness
Define NP-completeness. Prove why NP membership alone or hardness alone is insufficient.
Solution
is NP-complete if (1) and (2) for every , . Without (1), might be hard outside . Without (2), membership does not equate it to the whole class.
Exercise 3 — Local windows in Cook–Levin
Explain why local-window constraints on the computation tableau suffice to enforce a legal TM computation.
Solution
A deterministic step changes only an -size neighborhood around the head. Consistency of all overlapping windows across time forces legal transitions from the input to an accepting configuration. Variable/clause counts are polynomial in the tableau size.
Exercise 4 — in 3SAT→IS
In the standard reduction from 3SAT to Independent Set with parameter (number of clauses), prove why choosing breaks equivalence.
Solution
The construction places a group per clause with conflict edges between opposite literals. forces selecting a vertex from every clause — matching a satisfying assignment. If , one may pick vertices from fewer clauses and ignore an unsatisfied clause, breaking the equivalence.
Exercise 5 — Transitivity and output size
Prove is transitive, emphasizing why must be polynomial.
Solution
If reduces to and reduces to in polynomial time, then is polynomial-time because , so runs in . Without an output-size bound, composition may leave polynomial time.
Summary
A reduction is an instance compiler with a direction. Completeness needs membership and hardness; direction and size mistakes are classic exam traps.
Guided practice
Task 1 — Refute a wrong direction
A student “proves” is hard via a reduction where is easy. What is wrong?
Solution
with implies — so is easy, not hard. To transfer hardness from to one needs .
Task 2 — Partial reduction writeup
In a graph reduction only “if the formula is satisfiable then an independent set exists” is proved. Which parts are missing?
Solution
Missing: the converse (IS satisfiable formula), malformed-input handling, time/size bounds for , and target NP membership if completeness is claimed.
Task 3 — From Cook–Levin to 3SAT-completeness
Outline how one passes from SAT to 3SAT while preserving NP-completeness (gadget idea, not a full proof).
Solution
Long clauses are split into 3-literal clauses with helper variables so satisfiability is preserved. The reduction is polynomial; with and SAT-hardness one obtains 3SAT-completeness.
Sources
Course evidence
- Current Semester A transcript 9: polynomial many-one reductions, direction, transitivity, and closure.
- Current Semester A transcript 10: NP-hardness, NP-completeness, and the consequences of a polynomial algorithm for a complete problem.
- Current Semester A transcripts 12–13: the Cook–Levin computation tableau, local consistency, acceptance, and polynomial-size accounting.
- Current Semester A transcript 14: SAT/3SAT graph gadgets, including the independent-set construction.
- Merged course summary, pp. 43–49: polynomial reductions and completeness; pp. 50–54: Cook–Levin only; pp. 55–57, 64–66, and 72–75: the graph-problem family and graph reductions. No broader topic coverage is attributed to these ranges.
Textbook verification
- Sipser, Introduction to the Theory of Computation, 3rd ed., §§7.4–7.5, pp. 300–325: polynomial reducibility, Cook–Levin, and 3SAT.
- Arora–Barak, Computational Complexity: A Modern Approach (draft), §2.3, pp. 45–58: universality of tableau/Cook–Levin encodings and NP-completeness.
- Papadimitriou, Computational Complexity, Chs. 8–9: reductions, NP-completeness, and the tableau proof. Textbooks verify the standard theorem; notation and teaching order here follow the course.
The pages this was written from
3 pages
These pages were chosen by word overlap between the text here and the page's transcription — nobody has verified them. Treat them as a lead to check, not a citation.
Lecture 7 · page 4משפט קוק-לויןShared wordsהראשונה · שורה · מעליו · המשתנה · מצב · יחידה
Lecture 13 · page 5המשך בעיות NP קשותShared wordsסותרות · מחזירים · ביניהם · השמות · יכולה · הבחנה
Lecture 14 · page 2coC, ההיררכיה הפולינומיאליתShared wordsמסגירות · הפולינומיאלית · בדומה · CoNP · מקרה · שלמה