P versus NP problem explained

The P versus NP problem is a major unsolved problem in theoretical computer science. Informally, it asks whether every problem whose solution can be quickly verified can also be quickly solved.

Here, quickly means an algorithm that solves the task and runs in polynomial time exists, meaning the task completion time varies as a polynomial function on the size of the input to the algorithm (as opposed to, say, exponential time). The general class of questions that some algorithm can answer in polynomial time is "P" or "class P". For some questions, there is no known way to find an answer quickly, but if provided with an answer, it can be verified quickly. The class of questions where an answer can be verified in polynomial time is NP, standing for "nondeterministic polynomial time".[1]

An answer to the P versus NP question would determine whether problems that can be verified in polynomial time can also be solved in polynomial time. If P ≠ NP, which is widely believed, it would mean that there are problems in NP that are harder to compute than to verify: they could not be solved in polynomial time, but the answer could be verified in polynomial time.

The problem has been called the most important open problem in computer science.[2] Aside from being an important problem in computational theory, a proof either way would have profound implications for mathematics, cryptography, algorithm research, artificial intelligence, game theory, multimedia processing, philosophy, economics and many other fields.[3]

It is one of the seven Millennium Prize Problems selected by the Clay Mathematics Institute, each of which carries a US$1,000,000 prize for the first correct solution.

Example

In the game Sudoku, the player begins with a partially filled-in grid of numbers and attempts to complete the grid following the game's rules. Given an incomplete Sudoku grid, of any size, is there at least one legal solution? Proposed solutions are easily verified, and the time to check a solution grows slowly (polynomially) as the grid gets bigger. However, all known algorithms for finding solutions take, for difficult examples, time that grows exponentially as the grid gets bigger. So, Sudoku is in NP (quickly checkable) but does not seem to be in P (quickly solvable). Thousands of other problems seem similarly fast to check but slow to solve. Researchers have shown that many of the problems in NP have the extra property that a fast solution to any one of them could be used to build a quick solution to any other problem in NP, a property called NP-completeness. Decades of searching have not produced a fast solution to any of these problems, so most scientists suspect that these problems cannot be solved quickly; however, this is unproven.

History

The precise statement of the P versus NP problem was introduced in 1971 by Stephen Cook in his seminal paper "The complexity of theorem proving procedures"[4] (and independently by Leonid Levin in 1973[5]).

Although the P versus NP problem was formally defined in 1971, there were previous inklings of the problems involved, the difficulty of proof, and the potential consequences. In 1955, mathematician John Nash wrote a letter to the NSA, speculating that cracking a sufficiently complex code would require time exponential in the length of the key.[6] If proved (and Nash was suitably skeptical), this would imply what is now called P ≠ NP, since a proposed key can be verified in polynomial time. Another mention of the underlying problem occurred in a 1956 letter written by Kurt Gödel to John von Neumann. Gödel asked whether theorem-proving (now known to be co-NP-complete) could be solved in quadratic or linear time,[7] and pointed out one of the most important consequences - that if so, then the discovery of mathematical proofs could be automated.

Context

The relation between the complexity classes P and NP is studied in computational complexity theory, the part of the theory of computation dealing with the resources required during computation to solve a given problem. The most common resources are time (how many steps it takes to solve a problem) and space (how much memory it takes to solve a problem).

In such analysis, a model of the computer for which time must be analyzed is required. Typically such models assume that the computer is deterministic (given the computer's present state and any inputs, there is only one possible action that the computer might take) and sequential (it performs actions one after the other).

In this theory, the class P consists of all decision problems (defined below) solvable on a deterministic sequential machine in a duration polynomial in the size of the input; the class NP consists of all decision problems whose positive solutions are verifiable in polynomial time given the right information, or equivalently, whose solution can be found in polynomial time on a non-deterministic machine.[8] Clearly, P ⊆ NP. Arguably, the biggest open question in theoretical computer science concerns the relationship between those two classes:

Is P equal to NP?

Since 2002, William Gasarch has conducted three polls of researchers concerning this and related questions.[9] [10] [11] Confidence that P ≠ NP has been increasing – in 2019, 88% believed P ≠ NP, as opposed to 83% in 2012 and 61% in 2002. When restricted to experts, the 2019 answers became 99% believed P ≠ NP. These polls do not imply whether P = NP, Gasarch himself stated: "This does not bring us any closer to solving P=?NP or to knowing when it will be solved, but it attempts to be an objective report on the subjective opinion of this era."

NP-completeness

See main article: article and NP-completeness. To attack the P = NP question, the concept of NP-completeness is very useful. NP-complete problems are problems that any other NP problem is reducible to in polynomial time and whose solution is still verifiable in polynomial time. That is, any NP problem can be transformed into any NP-complete problem. Informally, an NP-complete problem is an NP problem that is at least as "tough" as any other problem in NP.

NP-hard problems are those at least as hard as NP problems; i.e., all NP problems can be reduced (in polynomial time) to them. NP-hard problems need not be in NP; i.e., they need not have solutions verifiable in polynomial time.

For instance, the Boolean satisfiability problem is NP-complete by the Cook–Levin theorem, so any instance of any problem in NP can be transformed mechanically into a Boolean satisfiability problem in polynomial time. The Boolean satisfiability problem is one of many NP-complete problems. If any NP-complete problem is in P, then it would follow that P = NP. However, many important problems are NP-complete, and no fast algorithm for any of them is known.

From the definition alone it is unintuitive that NP-complete problems exist; however, a trivial NP-complete problem can be formulated as follows: given a Turing machine M guaranteed to halt in polynomial time, does a polynomial-size input that M will accept exist?[12] It is in NP because (given an input) it is simple to check whether M accepts the input by simulating M; it is NP-complete because the verifier for any particular instance of a problem in NP can be encoded as a polynomial-time machine M that takes the solution to be verified as input. Then the question of whether the instance is a yes or no instance is determined by whether a valid input exists.

The first natural problem proven to be NP-complete was the Boolean satisfiability problem, also known as SAT. As noted above, this is the Cook–Levin theorem; its proof that satisfiability is NP-complete contains technical details about Turing machines as they relate to the definition of NP. However, after this problem was proved to be NP-complete, proof by reduction provided a simpler way to show that many other problems are also NP-complete, including the game Sudoku discussed earlier. In this case, the proof shows that a solution of Sudoku in polynomial time could also be used to complete Latin squares in polynomial time.[13] This in turn gives a solution to the problem of partitioning tri-partite graphs into triangles,[14] which could then be used to find solutions for the special case of SAT known as 3-SAT,[15] which then provides a solution for general Boolean satisfiability. So a polynomial-time solution to Sudoku leads, by a series of mechanical transformations, to a polynomial time solution of satisfiability, which in turn can be used to solve any other NP-problem in polynomial time. Using transformations like this, a vast class of seemingly unrelated problems are all reducible to one another, and are in a sense "the same problem".

Harder problems

See also: Complexity class.

Although it is unknown whether P = NP, problems outside of P are known. Just as the class P is defined in terms of polynomial running time, the class EXPTIME is the set of all decision problems that have exponential running time. In other words, any problem in EXPTIME is solvable by a deterministic Turing machine in O(2p(n)) time, where p(n) is a polynomial function of n. A decision problem is EXPTIME-complete if it is in EXPTIME, and every problem in EXPTIME has a polynomial-time many-one reduction to it. A number of problems are known to be EXPTIME-complete. Because it can be shown that P ≠ EXPTIME, these problems are outside P, and so require more than polynomial time. In fact, by the time hierarchy theorem, they cannot be solved in significantly less than exponential time. Examples include finding a perfect strategy for chess positions on an N × N board[16] and similar problems for other board games.[17]

The problem of deciding the truth of a statement in Presburger arithmetic requires even more time. Fischer and Rabin proved in 1974[18] that every algorithm that decides the truth of Presburger statements of length n has a runtime of at least

2cn
2
for some constant c. Hence, the problem is known to need more than exponential run time. Even more difficult are the undecidable problems, such as the halting problem. They cannot be completely solved by any algorithm, in the sense that for any particular algorithm there is at least one input for which that algorithm will not produce the right answer; it will either produce the wrong answer, finish without giving a conclusive answer, or otherwise run forever without producing any answer at all.

It is also possible to consider questions other than decision problems. One such class, consisting of counting problems, is called

  1. P
: whereas an NP problem asks "Are there any solutions?", the corresponding #P problem asks "How many solutions are there?". Clearly, a #P problem must be at least as hard as the corresponding NP problem, since a count of solutions immediately tells if at least one solution exists, if the count is greater than zero. Surprisingly, some #P problems that are believed to be difficult correspond to easy (for example linear-time) P problems.[19] For these problems, it is very easy to tell whether solutions exist, but thought to be very hard to tell how many. Many of these problems are
  1. P-complete
, and hence among the hardest problems in #P, since a polynomial time solution to any of them would allow a polynomial time solution to all other #P problems.

Problems in NP not known to be in P or NP-complete

See main article: NP-intermediate and NP-intermediate. In 1975, Richard E. Ladner showed that if P ≠ NP, then there exist problems in NP that are neither in P nor NP-complete. Such problems are called NP-intermediate problems. The graph isomorphism problem, the discrete logarithm problem, and the integer factorization problem are examples of problems believed to be NP-intermediate. They are some of the very few NP problems not known to be in P or to be NP-complete.

The graph isomorphism problem is the computational problem of determining whether two finite graphs are isomorphic. An important unsolved problem in complexity theory is whether the graph isomorphism problem is in P, NP-complete, or NP-intermediate. The answer is not known, but it is believed that the problem is at least not NP-complete.[20] If graph isomorphism is NP-complete, the polynomial time hierarchy collapses to its second level.[21] Since it is widely believed that the polynomial hierarchy does not collapse to any finite level, it is believed that graph isomorphism is not NP-complete. The best algorithm for this problem, due to László Babai, runs in quasi-polynomial time.[22]

The integer factorization problem is the computational problem of determining the prime factorization of a given integer. Phrased as a decision problem, it is the problem of deciding whether the input has a factor less than k. No efficient integer factorization algorithm is known, and this fact forms the basis of several modern cryptographic systems, such as the RSA algorithm. The integer factorization problem is in NP and in co-NP (and even in UP and co-UP[23]). If the problem is NP-complete, the polynomial time hierarchy will collapse to its first level (i.e., NP = co-NP). The most efficient known algorithm for integer factorization is the general number field sieve, which takes expected time

O\left(\exp\left(\left(\tfrac{64n}{9}log(2)\right

1
3
)

\left(log(nlog(2))\right

2
3
)

\right)\right)

to factor an n-bit integer. The best known quantum algorithm for this problem, Shor's algorithm, runs in polynomial time, although this does not indicate where the problem lies with respect to non-quantum complexity classes.

Does P mean "easy"?

All of the above discussion has assumed that P means "easy" and "not in P" means "difficult", an assumption known as Cobham's thesis. It is a common assumption in complexity theory; but there are caveats.

First, it can be false in practice. A theoretical polynomial algorithm may have extremely large constant factors or exponents, rendering it impractical. For example, the problem of deciding whether a graph G contains H as a minor, where H is fixed, can be solved in a running time of O(n2),[24] where n is the number of vertices in G. However, the big O notation hides a constant that depends superexponentially on H. The constant is greater than

2\uparrow\uparrow(2\uparrow\uparrow(2\uparrow\uparrow(h/2)))

(using Knuth's up-arrow notation), and where h is the number of vertices in H.[25]

On the other hand, even if a problem is shown to be NP-complete, and even if P ≠ NP, there may still be effective approaches to the problem in practice. There are algorithms for many NP-complete problems, such as the knapsack problem, the traveling salesman problem, and the Boolean satisfiability problem, that can solve to optimality many real-world instances in reasonable time. The empirical average-case complexity (time vs. problem size) of such algorithms can be surprisingly low. An example is the simplex algorithm in linear programming, which works surprisingly well in practice; despite having exponential worst-case time complexity, it runs on par with the best known polynomial-time algorithms.[26]

Finally, there are types of computations which do not conform to the Turing machine model on which P and NP are defined, such as quantum computation and randomized algorithms.

Reasons to believe P ≠ NP or P = NP

Cook provides a restatement of the problem in The P Versus NP Problem as "Does P = NP?" According to polls,[9] [27] most computer scientists believe that P ≠ NP. A key reason for this belief is that after decades of studying these problems no one has been able to find a polynomial-time algorithm for any of more than 3000 important known NP-complete problems (see List of NP-complete problems). These algorithms were sought long before the concept of NP-completeness was even defined (Karp's 21 NP-complete problems, among the first found, were all well-known existing problems at the time they were shown to be NP-complete). Furthermore, the result P = NP would imply many other startling results that are currently believed to be false, such as NP = co-NP and P = PH.

It is also intuitively argued that the existence of problems that are hard to solve but for which the solutions are easy to verify matches real-world experience.[28]

Notes and References

  1. A nondeterministic Turing machine can move to a state that is not determined by the previous state. Such a machine could solve an NP problem in polynomial time by falling into the correct answer state (by luck), then conventionally verifying it. Such machines are not practical for solving realistic problems but can be used as theoretical models.
  2. Fortnow . Lance . Lance Fortnow . 2009 . The status of the P versus NP problem . Communications of the ACM . 52 . 9 . 78–86 . 10.1145/1562164.1562186 . 10.1.1.156.767 . 5969255 . 26 January 2010 . https://wayback.archive-it.org/all/20110224135332/http://www.cs.uchicago.edu/~fortnow/papers/pnp-cacm.pdf . 24 February 2011 .
  3. Book: Fortnow, Lance. The Golden Ticket: P, NP, and the Search for the Impossible. Princeton University Press. 2013. 9780691156491. Princeton, NJ.
  4. Book: Cook, Stephen. Stephen Cook. 1971. The complexity of theorem proving procedures. http://portal.acm.org/citation.cfm?coll=GUIDE&dl=GUIDE&id=805047. Proceedings of the Third Annual ACM Symposium on Theory of Computing. 151–158. 10.1145/800157.805047. 9781450374644. 7573663.
  5. L. A. Levin . http://www.mathnet.ru/php/archive.phtml?wshow=paper&jrnid=ppi&paperid=914&option_lang=rus . ru:Универсальные задачи перебора . Problems of Information Transmission . Пробл. передачи информ . 1973 . 9 . 3 . 115–116 . ru.
  6. Web site: Letters from John Nash . https://web.archive.org/web/20181109234811/https://www.nsa.gov/Portals/70/documents/news-features/declassified-documents/nash-letters/nash_letters1.pdf . 2018-11-09 . live . NSA . 2012.
  7. Hartmanis . Juris . Gödel, von Neumann, and the P = NP problem . Bulletin of the European Association for Theoretical Computer Science . 38 . 101–107 .
  8. Sipser, Michael: Introduction to the Theory of Computation, Second Edition, International Edition, page 270. Thomson Course Technology, 2006. Definition 7.19 and Theorem 7.20.
  9. William I. Gasarch. William Gasarch . The P=?NP poll.. SIGACT News. 33. 2. 34–47. June 2002. https://web.archive.org/web/20070615132837/http://www.cs.umd.edu/~gasarch/papers/poll.pdf . 2007-06-15 . live. 10.1145/564585.564599. 10.1.1.172.1005 . 36828694 .
  10. William I. Gasarch. William Gasarch . The Second P=?NP poll. SIGACT News. 74. https://web.archive.org/web/20140124031930/http://www.cs.umd.edu/~gasarch/papers/poll2012.pdf . 2014-01-24 . live.
  11. Web site: Guest Column: The Third P =? NP Poll1. https://web.archive.org/web/20190331023850/https://www.cs.umd.edu/users/gasarch/BLOGPAPERS/pollpaper3.pdf . 2019-03-31 . live. 25 May 2020.
  12. Web site: Scott Aaronson. PHYS771 Lecture 6: P, NP, and Friends. 27 August 2007.
  13. Web site: MSc course: Foundations of Computer Science. www.cs.ox.ac.uk. 25 May 2020.
  14. Colbourn, Charles J. . The complexity of completing partial Latin squares . Discrete Applied Mathematics . 8 . 1 . 1984 . 25–30 . 10.1016/0166-218X(84)90075-1 . free .
  15. I. Holyer . The NP-completeness of some edge-partition problems . SIAM J. Comput. . 10 . 1981 . 4 . 713 - 717. 10.1137/0210054 .
  16. Aviezri Fraenkel and D. Lichtenstein. Computing a perfect strategy for n × n chess requires time exponential in n. . Series A . 31. 2. 1981. 199–214 . 10.1016/0097-3165(81)90016-9.
  17. Web site: Computational Complexity of Games and Puzzles . David Eppstein.
  18. Michael J. . Fischer . Michael J. Fischer . Michael O. . Rabin . Michael O. Rabin . 1974 . Super-Exponential Complexity of Presburger Arithmetic . Proceedings of the SIAM-AMS Symposium in Applied Mathematics . 7 . 27–41. 15 October 2017 . https://web.archive.org/web/20060915010325/http://www.lcs.mit.edu/publications/pubs/ps/MIT-LCS-TM-043.ps . 15 September 2006 .
  19. Valiant, Leslie G. . The complexity of enumeration and reliability problems . SIAM Journal on Computing . 8 . 3 . 1979 . 410–421 . 10.1137/0208032.
  20. Vikraman . Arvind . Piyush P. . Kurur . Graph isomorphism is in SPP . Information and Computation . 204 . 5 . 2006 . 835–852 . 10.1016/j.ic.2006.02.002 .
  21. Schöning . Uwe . Uwe Schöning . 1988 . Graph isomorphism is in the low hierarchy . Journal of Computer and System Sciences . 37 . 3. 312–323 . 10.1016/0022-0000(88)90010-4.
  22. Babai. László. Group, graphs, algorithms: the graph isomorphism problem. 3966534. 3319–3336. World Sci. Publ., Hackensack, NJ. Proceedings of the International Congress of Mathematicians—Rio de Janeiro 2018. Vol. IV. Invited lectures. 2018.
  23. [Lance Fortnow]
  24. Kawarabayashi . Ken-ichi . Kobayashi . Yusuke . Reed . Bruce . Bruce Reed (mathematician) . 2012 . The disjoint paths problem in quadratic time . . Series B . 102 . 2 . 424–435. 10.1016/j.jctb.2011.07.004 . free .
  25. Johnson, David S. . The NP-completeness column: An ongoing guide (edition 19) . Journal of Algorithms . 8 . 2 . 1987 . 285–303 . 10.1.1.114.3864 . 10.1016/0196-6774(87)90043-5 .
  26. Book: Gondzio. Jacek. Terlaky. Tamás. 3 A computational view of interior point methods . 1438311 . Advances in linear and integer programming. 103–144. J. E. Beasley. New York. Oxford University Press. 1996. Oxford Lecture Series in Mathematics and its Applications . 4 . http://www.maths.ed.ac.uk/~gondzio/CV/oxford.ps. Postscript file at website of Gondzio and at McMaster University website of Terlaky.
  27. P vs. NP poll results . Communications of the ACM . May 2012 . 55 . 5 . 10 . Jack. Rosenberger .
  28. Web site: Reasons to believe . Scott Aaronson . 4 September 2006 ., point 9.