Sub topic 16
Between P and NP-Complete: NP-Intermediate Problems
This chapter assumes you already know the definitions of P, NP, polynomial-time reductions, and NP-completeness from earlier chapters. It also assumes you have seen the P vs NP question. Here we ask whether every problem in NP must be either easy (in P) or as hard as possible (NP-complete).
The Question
Suppose P ≠ NP. Then P and the NP-complete problems are disjoint parts of NP. A natural guess is that they cover all of NP, so every NP problem would fall on one side or the other. An NP problem that is neither in P nor NP-complete is called NP-intermediate.
Ladner's Theorem
In 1975 Richard Ladner proved the following:
If P ≠ NP, then NP-intermediate problems exist.
The proof constructs an artificial problem. It starts from SAT and "pads" it carefully, so the result is too hard to be in P but too sparse to be NP-complete. The theorem says nothing about natural problems. It only shows that the gap cannot be empty unless P = NP.
Natural Candidates
No natural problem has been proven NP-intermediate, because such a proof would also prove P ≠ NP. Researchers do have strong suspects:
| Problem | Why it looks intermediate |
|---|---|
| Integer factoring (decision version) | No polynomial algorithm is known, and it lies in NP ∩ co-NP, so if it were NP-complete then NP = co-NP |
| Graph isomorphism | Babai (2015) gave a quasi-polynomial algorithm, which is very unlikely for an NP-complete problem |
| Discrete logarithm | Like factoring, it is in NP ∩ co-NP, and cryptography relies on its hardness |
The decision version of factoring asks: "Does n have a factor d with 1 < d ≤ k?" A yes-certificate is just the factor:
def verify_has_small_factor(n, k, d):
"""Certificate d proves n has a nontrivial factor at most k."""
return 1 < d <= k and d < n and n % d == 0
print(verify_has_small_factor(91, 10, 7)) # True: 7 divides 91
print(verify_has_small_factor(97, 10, 7)) # FalseA no-answer can also be checked efficiently. The certificate is the full prime factorization, and primality can be tested in polynomial time. That puts the problem in co-NP as well.
A Cautionary Example
Primality testing was once a candidate too. It was known to be in NP ∩ co-NP but had no known polynomial algorithm. In 2002 the AKS algorithm put it in P. Being a suspect means only that we lack an efficient algorithm, not that one cannot exist.
Exercise
Why does proving that a specific natural problem is NP-intermediate amount to proving P ≠ NP?
Show answer
Being NP-intermediate means the problem is in NP but not in P. Such a problem shows directly that NP contains something outside P, so P ≠ NP.
Exercise
Graph isomorphism has a quasi-polynomial algorithm. Why does this make researchers doubt it is NP-complete?
Show answer
If it were NP-complete, every NP problem, SAT included, would reduce to it in polynomial time and gain a quasi-polynomial algorithm. That contradicts the widely believed hypothesis that SAT needs exponential time.