13

If someone ever demonstrates that P=NP, will it give us a polynomial factoring algorithm, or will it only tell us that such an algorithm exists, but we still have to find it?

AleksanderCH
  • 6,511
  • 10
  • 31
  • 64
tyuil
  • 217
  • 2
  • 5

3 Answers3

15

Proving P=NP would not necessarily give you an algorithm, because there are many different methods to prove something (i.e. Direct proof, Proof by contradiction, etc.).

But it is shown that if you were to find a polynomial time algorithm to solve a NP-complete problem that you could modify that algorithm to solve all NP-problems, including the Integer factorization problem.

kasperd
  • 1,387
  • 1
  • 10
  • 23
AleksanderCH
  • 6,511
  • 10
  • 31
  • 64
11

Bill Garsarch just posted about this the other day. The short answer is that there is an explicit algorithm, which is known today, such that if P = NP (or even just FACTORING ∈ P) then the algorithm solves factoring in polynomial time on all instances. However, this algorithm is utterly infeasible for real-world computation because it works by iterating over other algorithms. In a sense, it simply moves the nonconstructivity of the proof into the algorithm itself.

One thing that is interesting is that this result is somewhat specific to factoring. There does not appear to be a known algorithm that would solve SAT in polynomial time correctly, on all inputs, whose correctness proof is conditional only on P = NP. See this followup blog post by Lance Fortnow.

Aaron Rotenberg
  • 211
  • 1
  • 5
2

No, the proof may not give us directly a new algorithm. What immediately we can do is classical problem reduction;

Let $x$ be a problem that proves $\mathbf{NP}=\mathbf{P}$.

We can reduce the factorization problem into Hamiltonian Path Problem ( that is $ \in \mathbf{NP}$-Complete) in the polynomial time as Adleman did in DNA computing. You can find the details of the reduction steps in this answer. So we can reduce our problem to $x$ in polynomial time, solve $x$ and transfer the solutions back to the factorization problem since the reductions are answer-preserving, i.e. backward available.

Note: If the proof of $\mathbf{NP}=\mathbf{P}$ is not performed by showing an $\mathbf{NP}$-Complete problem has a polynomial time solution the reduction will not work until one find one. But in general, if the equality is the case, we expect that one will find a polynomial time algorithm for an $\mathbf{NP}$-Complete problem.

kelalaka
  • 49,797
  • 12
  • 123
  • 211