Polynomial-Time Reductions and the 3-SAT to Vertex Cover Reduction
This section explains three central ideas in computational complexity:
- What a polynomial-time reduction is.
- How reductions establish that a problem is NP-complete.
- How to transform an instance of 3-SAT into an equivalent instance of Vertex Cover.
The key principle is that a reduction transfers computational difficulty from one problem to another. If problem can be transformed efficiently into problem , then an efficient algorithm for would also yield an efficient algorithm for .
A standard polynomial-time many-one reduction is written
This means that there is a polynomial-time computable function such that, for every input ,
The transformation must preserve the answer exactly: yes-instances map to yes-instances, and no-instances map to no-instances.
Footnotes
-
Cook–Levin theorem - Background on SAT, 3-SAT, and the foundational NP-completeness result. ↩
-
P-time reducibility lecture notes - Definitions of polynomial-time reductions, NP-hardness, and NP-completeness. ↩
Direction of a Reduction
To prove that B is hard, reduce a known hard problem A to B: A ≤p B. The direction matters. Reducing B to A generally shows that A is at least as hard as B, not that B is NP-hard.
(i) What Is Polynomial-Time Reduction?
Consider two decision problems, and . We say that is polynomial-time reducible to , written , if an algorithm can convert every instance of into an instance of in polynomial time, while preserving the answer:
The function is called the reduction function.
Important properties
- Efficient construction: must be computable in polynomial time.
- Answer preservation: and must have the same yes/no answer.
- Single target instance: A many-one reduction creates one instance of .
- Polynomial growth: The output size must be polynomial in the input size.
- Algorithmic implication: If has a polynomial-time algorithm, then also has one.
Suppose , the reduction takes time, and problem can be solved in time on an instance of size . If the reduction produces , then solving through takes at most
Reduction versus ordinary algorithm
A reduction is not necessarily a direct solution to the original problem. Instead, it translates the original problem into another problem whose structure or difficulty is already understood.
For example:
The reduction is useful only if the following equivalence holds:
Footnotes
-
P-time reducibility lecture notes - Definitions of polynomial-time reductions, NP-hardness, and NP-completeness. ↩
How to Verify a Polynomial-Time Reduction
- 1Step 1
Specify precisely what constitutes an instance and a yes-instance for problems A and B.
- 2Step 2
Give an explicit algorithm that maps an arbitrary instance x of A to an instance f(x) of B.
- 3Step 3
Bound the time required to create f(x), and show that the output size is polynomial in |x|.
- 4Step 4
Show that every yes-instance of A becomes a yes-instance of B.
- 5Step 5
Show that every yes-instance of B corresponds to a yes-instance of A. Together, the two directions establish x ∈ A if and only if f(x) ∈ B.
Common Reduction Mistakes
(ii) How Polynomial-Time Reductions Prove NP-Completeness
A decision problem is in NP if a proposed solution, called a certificate, can be checked in polynomial time.
A problem is NP-hard if every problem in NP reduces to it:
A problem is NP-complete exactly when it satisfies both conditions:
Standard proof pattern
To prove that a problem is NP-complete:
- Show that .
- Choose a known NP-complete problem .
- Construct a polynomial-time reduction .
- Prove the equivalence
- Conclude that is NP-hard.
- Combine membership and hardness to conclude that is NP-complete.
The Cook–Levin theorem establishes SAT, and consequently 3-SAT, as a foundational NP-complete problem. Many later NP-completeness proofs use 3-SAT as the source problem.
Why the reduction proves hardness
Assume that is NP-complete and that
If had a polynomial-time algorithm, then an instance of could be solved by:
- Applying the polynomial-time reduction to obtain .
- Running the polynomial-time algorithm for .
- Returning the same answer.
Thus would be in P. Since every problem in NP reduces to , this would imply
Therefore, is at least as difficult as the known NP-complete problem under polynomial-time reductions.
Footnotes
-
Introduction to Theoretical Computer Science: NP, NP Completeness, and the Cook–Levin Theorem - Formal discussion of NP verification and reductions. ↩
-
Cook–Levin theorem - Background on SAT, 3-SAT, and the foundational NP-completeness result. ↩
-
P-time reducibility lecture notes - Definitions of polynomial-time reductions, NP-hardness, and NP-completeness. ↩
Reduction-Based NP-Completeness Workflow
Choose a source problem
Step 1Select a problem already known to be NP-complete, such as 3-SAT."
Define the target instance
Step 2Construct an instance of the target problem from the source instance."
Prove polynomial construction
Step 3Show that the graph, formula, or numerical instance can be created in polynomial time."
Prove yes-direction
Step 4Transform a solution of the source instance into a solution of the target instance."
Prove no-direction
Step 5Show that a target solution would imply a source solution."
Conclude NP-completeness
Step 6Combine NP-hardness from the reduction with membership in NP."
Hardness Does Not Mean Membership
A reduction from 3-SAT proves NP-hardness only. To prove NP-completeness, you must separately show that the target problem belongs to NP.
(iii) Reducing 3-SAT to Vertex Cover
Source problem: 3-SAT
An instance of 3-SAT is a Boolean formula in conjunctive normal form:
where each clause contains exactly three literals. For example,
The question is whether there exists a truth assignment satisfying every clause.
A literal is either or . A clause is satisfied if at least one of its literals is true.
Let:
- be the number of variables;
- be the number of clauses.
Target problem: Vertex Cover
Given an undirected graph and an integer , the Vertex Cover problem asks whether there is a set
such that
and every edge has at least one endpoint in .
The set is a vertex cover.
Vertex Cover is in NP because a certificate is simply a proposed set . We can verify in polynomial time that and that every edge is covered.
Footnotes
-
NP Completeness lecture notes - Definition of Vertex Cover, its membership in NP, and the 3-SAT reduction. ↩ ↩2
Construction of the graph
Given a 3-SAT formula with variables and clauses, construct a graph as follows.
1. Variable gadgets
For every variable , create two vertices:
- one vertex labeled ;
- one vertex labeled .
Connect these two vertices by an edge.
Thus, every variable creates a pair:
Because the pair is connected by an edge, every vertex cover must select at least one of them. Selecting represents setting , while selecting represents setting .
There are variable edges, so any vertex cover must contain at least vertices from the variable gadgets.
2. Clause gadgets
For every clause
create three new vertices:
Connect all three clause vertices to one another, forming a triangle:
Each clause vertex corresponds to one literal in the clause. If corresponds to literal , add an edge between and the variable-literal vertex labeled .
The triangle forces every vertex cover to select at least two of its three vertices. Therefore, the clause gadgets require at least selected vertices.
3. Set the cover bound
Define
The complete reduction is therefore
The graph contains:
- vertices;
- edges if every clause contains three literal-connection edges.
The graph and the parameter are computable in time polynomial in the size of .
Footnotes
-
Sample Proof of NP-Completeness - Construction of variable and clause gadgets for reducing 3-SAT to Vertex Cover. ↩
Size of the Constructed Vertex Cover Instance
For a 3-SAT formula with n variables and m clauses
3-SAT to Vertex Cover Construction
- 1Step 1
Parse φ into n variables and m clauses, with each clause containing three literals.
- 2Step 2
For every variable xi, create vertices xi and ¬xi and connect them with an edge.
- 3Step 3
For each clause, create three vertices and connect every pair, producing a triangle.
- 4Step 4
Connect each clause vertex to the variable-literal vertex representing the corresponding literal.
- 5Step 5
Set k = n + 2m, because a cover must select at least one vertex from each variable pair and at least two from each clause triangle.
- 6Step 6
Return the Vertex Cover instance (Gφ, k).
Correctness Proof
We prove the central equivalence:
Forward direction
Assume that is satisfiable. Let be a satisfying assignment.
Variable gadgets
For every variable , select exactly one of the two vertices and :
- select if ;
- select if .
This selects exactly vertices and covers every variable edge.
Clause gadgets
Because satisfies every clause, each clause has at least one true literal. For a clause triangle, leave unselected a clause vertex corresponding to a true literal. Select the other two clause vertices.
This selects exactly two vertices per clause triangle, for a total of clause vertices.
The unselected clause vertex is connected to a variable-literal vertex representing a true literal. That variable-literal vertex was selected in the variable gadget, so the connecting edge is covered.
All other edges incident to selected clause vertices are automatically covered. Therefore, the resulting set is a vertex cover of size
Hence,
Reverse direction
Assume that has a vertex cover with
Minimum selections forced by gadgets
Each variable pair contains an edge, so must contain at least one vertex from each pair. Therefore, contains at least variable vertices.
Each clause gadget is a triangle. A triangle has three edges, and at least two of its vertices must be selected to cover all three edges. Therefore, contains at least clause vertices.
Thus, every vertex cover has size at least
Since , the cover must contain exactly:
- one vertex from every variable pair;
- two vertices from every clause triangle.
Deriving a truth assignment
Define an assignment by:
- if ;
- if .
Exactly one vertex from each pair is selected, so this assignment is well-defined.
Showing every clause is satisfied
Consider a clause triangle. Exactly two of its vertices are in , so exactly one clause vertex is not in . Let that unselected vertex correspond to literal .
The edge connecting this clause vertex to the variable-literal vertex for must be covered. Since the clause vertex is not selected, its literal vertex must be selected.
By the way the assignment was defined, selecting the vertex for means that is true. Therefore, the clause contains a true literal.
Since this holds for every clause, satisfies .
Hence,
Combining both directions:
Why the Clause Triangle Works
The clause triangle encodes the requirement that at least one literal in each clause must be true.
A triangle requires two selected vertices in every vertex cover. Consequently, exactly one clause vertex can remain unselected when the cover has the minimum allowed size.
That one unselected clause vertex identifies a literal that must be true:
- The unselected clause vertex is connected to its corresponding literal vertex.
- The connecting edge must still be covered.
- Therefore, the corresponding literal vertex must be selected.
- Selection of that literal vertex represents a satisfying truth value.
This is the central gadget invariant:
The construction uses the complement relationship between Vertex Cover and Independent Set as an additional perspective. For any graph ,
This relationship is often useful when designing or checking graph reductions.
Footnotes
-
NP-Complete Problems lecture notes - Relationship among Independent Set, Vertex Cover, and polynomial reductions. ↩
Detailed Questions and Answers
Proof Checklist
For a polished NP-completeness proof, explicitly state: source problem, target construction, output size, polynomial running time, forward implication, reverse implication, and target membership in NP.
Polynomial Reductions and Vertex Cover
Knowledge Check
Which statement correctly defines a polynomial-time many-one reduction A ≤p B?
Explore Related Topics
Greedy Optimization and Prim’s Minimum Spanning Tree Algorithm
Short Notes on Cook's Theorem, Randomized Algorithms, and Bin Packing
The notes cover Cook’s theorem establishing SAT as NP‑complete, the design and analysis of randomized (Las Vegas and Monte Carlo) algorithms, and the NP‑hard bin‑packing problem with its common heuristics and approximation guarantees.
- Cook’s theorem shows every language reduces to SAT via a polynomial‑time function such that , making SAT the first NP‑complete problem.
- Randomized algorithms: Las Vegas algorithms are always correct with expected runtime (e.g., for randomized quicksort); Monte Carlo algorithms run in fixed time with error ≤½, which can be reduced by amplification to after repetitions.
- Bin packing: the decision version is NP‑complete and the optimization version NP‑hard; heuristics like First Fit Decreasing guarantee .
- Together they illustrate three core CS themes: proving hardness via reductions, leveraging randomness for efficient algorithm design, and using heuristics/approximation to tackle intractable optimization problems.