An NP-completeness proof is used to show that a problem is both in NP and NP-hard. These two properties are crucial in establishing that a problem is NP-complete:
A problem is NP-complete if it satisfies both of these properties. Let's break down how we go about proving that a problem is NP-complete.
To prove that a problem is NP-complete, we follow these general steps:
Prove that the problem is in NP:
Prove that the problem is NP-hard:
For any problem to be in NP, we need to show that, given a candidate solution, it can be verified in polynomial time. This step is typically straightforward and involves constructing a verification algorithm that checks if the proposed solution satisfies the conditions of the problem.
Example: For the Subset Sum Problem, given a subset of integers, we need to verify if the sum of the subset equals a given target sum. The verification process involves summing the integers in the subset and checking if the result matches the target. This can clearly be done in polynomial time.
To prove that a problem is NP-hard, we must show that we can reduce an existing NP-complete problem to the given problem . This is typically done in one of the following ways:
Choosing a Known NP-Complete Problem: We start by picking a well-known NP-complete problem that has already been proven to be in NP and NP-hard. Common choices include:
Reducing the Problem: The key step in the proof is the reduction: transforming an instance of the known NP-complete problem into an instance of the problem in polynomial time. The reduction must preserve the solution; in other words, a solution to the transformed problem must correspond to a solution to the original problem.
Proving Correctness of the Reduction: After performing the reduction, we need to show that solving the transformed problem will allow us to solve the original NP-complete problem.
Let’s walk through the proof that 3-SAT is NP-complete as an example.
Prove that 3-SAT is in NP:
Prove that 3-SAT is NP-Hard:
To prove that 3-SAT is NP-hard, we need to reduce a known NP-complete problem to 3-SAT. One of the most common reductions is from SAT (the general satisfiability problem) to 3-SAT.
The SAT problem allows clauses of any size (e.g., a clause could have more than 3 literals). To reduce SAT to 3-SAT, we need to ensure that every clause has exactly 3 literals. We can do this by introducing new variables and transforming larger clauses into a series of smaller clauses, each of which has 3 literals. This is known as a clause transformation.
For example:
Thus, by reducing SAT to 3-SAT in polynomial time, we show that 3-SAT is NP-hard.
Let’s go through a detailed proof of NP-completeness for the Vertex Cover Problem.
Problem: Given a graph and an integer , is there a set of vertices such that every edge in is incident to at least one vertex in the set?
3-SAT Instance: Given a 3-SAT formula with clauses and variables, we want to determine if there is a satisfying assignment to the variables.
Graph Construction: We construct a graph based on the clauses and variables in the 3-SAT formula:
Vertex Cover Construction: The goal is to find a set of vertices such that every edge in the graph is covered by at least one vertex in the set. If we choose , the vertex cover will correspond to choosing a satisfying assignment for the 3-SAT formula.
Why the Reduction Works: The reduction works because if a satisfying assignment exists, there will be a way to select vertices that cover all the edges in the graph, reflecting the assignment’s truth values. Conversely, a valid vertex cover corresponds to a satisfying assignment for the 3-SAT formula.
Thus, by reducing 3-SAT to the Vertex Cover Problem, we prove that Vertex Cover is NP-hard.
To prove that a problem is NP-complete, we need to demonstrate two things:
A typical NP-completeness proof involves selecting an appropriate known NP-complete problem, performing a polynomial-time reduction, and verifying that the solution to the reduced problem corresponds to a solution to the original problem. By following this approach, we can show that a problem is NP-complete and therefore likely does not have an efficient solution unless .
Open this section to load past papers