NP Problems
P Problems
NP Complete
3 HARDER PROBLEMS
an instance of the Boolean satisability problem in polynomial time. The Boolean satisability problem is one of
many such NP-complete problems. If any NP-complete
Is P equal to NP?
problem is in P, then it would follow that P = NP. However, many important problems have been shown to be
In a 2002 poll of 100 researchers, 61 believed the an- NP-complete, and no fast algorithm for any of them is
swer to be no, 9 believed the answer is yes, and 22 were known.
unsure; 8 believed the question may be independent of
the currently accepted axioms and therefore impossible Based on the denition alone it is not obvious that NPcomplete problems exist; however, a trivial and conto prove or disprove.[6]
trived NP-complete problem can be formulated as folIn 2012, 10 years later, the same poll was repeated. lows: given a description of a Turing machine M guarThe number of researchers who answered was 151: 126 anteed to halt in polynomial time, does there exist a
(83%) believed the answer to be no, 12 (9%) believed polynomial-size input that M will accept?[8] It is in NP
the answer is yes, 5 (3%) believed the question may be because (given an input) it is simple to check whether M
independent of the currently accepted axioms and there- accepts the input by simulating M; it is NP-complete before impossible to prove or disprove, 8 (5%) said either cause the verier for any particular instance of a problem
don't know or don't care or don't want the answer to be in NP can be encoded as a polynomial-time machine M
yes nor the problem to be resolved.[7]
that takes the solution to be veried as input. Then the
question of whether the instance is a yes or no instance is
determined by whether a valid input exists.
NP-complete
NP-Hard
NP-Hard
NP-Complete
P = NP =
NP-Complete
P
P NP
Complexity
NP
P = NP
3 Harder problems
Euler diagram for P, NP, NP-complete, and NP-hard set of
problems
Although it is unknown whether P = NP, problems outside of P are known. A number of succinct problems
(problems that operate not on normal input, but on a
computational description of the input) 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 signicantly less
than exponential time. Examples include nding a perfect strategy for chess (on an N N board)[9] and some
other board games.[10]
3
problem. They cannot be completely solved by any algo- doesn't say much about where the problem lies with rerithm, in the sense that for any particular algorithm there spect to non-quantum complexity classes.
is at least one input for which that algorithm will not produce the right answer; it will either produce the wrong
answer, nish without giving a conclusive answer, or oth- 5 Does P mean easy"?
erwise run forever without producing any answer at all.
6 Reasons to believe P NP
According to polls,[6][17] many computer scientists beto factor an n-bit integer. However, the best known lieve that P NP. A key reason for this belief is that
quantum algorithm for this problem, Shors algorithm, after decades of studying these problems no one has been
does run in polynomial time. Unfortunately, this fact able to nd a polynomial-time algorithm for any of more
CONSEQUENCES OF SOLUTION
7.1 P = NP
A proof that P = NP could have stunning practical consequences, if the proof leads to ecient methods for solving
some of the important problems in NP. It is also possible
that a proof would not lead directly to ecient methods,
perhaps if the proof is non-constructive, or the size of the
bounding polynomial is too big to be ecient in practice.
The consequences, both positive and negative, arise since
various NP-complete problems are fundamental in many
It is also intuitively argued that the existence of problems
elds.
that are hard to solve but for which the solutions are easy
Cryptography, for example, relies on certain probto verify matches real-world experience.[18]
lems being dicult.
A constructive and ecient
[Note 1]
to
an
NP-complete
problem such as 3-SAT
solution
If P = NP, then the world would be a
would
break
most
existing
cryptosystems
including:
profoundly dierent place than we usually
assume it to be. There would be no special
value in creative leaps, no fundamental gap
public-key cryptography,[19] a foundation for many
between solving a problem and recognizing
modern security applications such as secure nancial
the solution once its found.
transactions over the Internet; and
Scott Aaronson, MIT
symmetric ciphers such as AES or 3DES,[20] used
for the encryption of communications data.
On the other hand, some researchers believe that there is
overcondence in believing P NP and that researchers
should explore proofs of P = NP as well. For example, in
2002 these statements were made:[6]
The main argument in favor of P NP
is the total lack of fundamental progress in
the area of exhaustive search. This is, in my
opinion, a very weak argument. The space
of algorithms is very large and we are only
at the beginning of its exploration. [...] The
resolution of Fermats Last Theorem also
shows that very simple questions may be
settled only by very deep theories.
Moshe Y. Vardi, Rice University
Consequences of solution
One of the reasons the problem attracts so much attention is the consequences of the answer. Either direction
of resolution would advance theory enormously, and perhaps have huge practical consequences as well.
5
mental work of a mathematician concerning
Yes-or-No questions could be completely replaced by a machine. After all, one would simply have to choose the natural number n so
large that when the machine does not deliver
a result, it makes no sense to think more about
the problem.
all instances, to Cryptomania, where P NP and generating hard instances of problems outside P is easy, with
three intermediate possibilities reecting dierent possible distributions of diculty over instances of NP-hard
problems. The world where P NP but all problems in
NP are tractable in the average case is called Heuristica
in the paper. A Princeton University workshop in 2009
studied the status of the ve worlds.[30]
7.2
P NP
A proof that showed that P NP would lack the practical computational benets of a proof that P = NP, but
would nevertheless represent a very signicant advance
in computational complexity theory and provide guidance
for future research. It would allow one to show in a formal
way that many common problems cannot be solved eciently, so that the attention of researchers can be focused
on partial solutions or solutions to other problems. Due
to widespread belief in P NP, much of this focusing of
research has already taken place.[28]
Also P NP still leaves open the average-case complexity of hard problems in NP. For example, it is possible that SAT requires exponential time in the worst case,
but that almost all randomly selected instances of it are
eciently solvable. Russell Impagliazzo has described
ve hypothetical worlds that could result from dierent possible resolutions to the average-case complexity
question.[29] These range from Algorithmica, where P
= NP and problems like SAT can be solved eciently in
12 FORMAL DEFINITIONS
Claimed solutions
10
Logical characterizations
11 Polynomial-time algorithms
No algorithm for any NP-complete problem is known to
run in polynomial time. However, there are algorithms
for NP-complete problems with the property that if P =
NP, then the algorithm runs in polynomial time (although
with enormous constants, making the algorithm impractical). The following algorithm, due to Levin (without
any citation), is such an example below. It correctly accepts the NP-complete language SUBSET-SUM. It runs
in polynomial time if and only if P = NP:
// Algorithm that accepts the NP-complete language
SUBSET-SUM. // // this is a polynomial-time algorithm
if and only if P = NP. // // Polynomial-time means it returns yes in polynomial time when // the answer should
be yes, and runs forever when it is no. // // Input: S
= a nite set of integers // Output: yes if any subset of
S adds up to 0. // Runs forever with no output otherwise.
// Note: Program number P is the program obtained by
// writing the integer P in binary, then // considering that
string of bits to be a // program. Every possible program
can be // generated this way, though most do nothing //
because of syntax errors.
FOR N = 1... FOR P = 1...N Run program number P
for N steps with input S IF the program outputs a list of
distinct integers AND the integers are all in S AND the
integers sum to 0
THEN OUTPUT yes and HALT
12.1 P and NP
Conceptually speaking, a decision problem is a problem
that takes as input some string w over an alphabet , and
outputs yes or no. If there is an algorithm (say a
Turing machine, or a computer program with unbounded
memory) that can produce the correct answer for any input string of length n in at most cnk steps, where k and c
are constants independent of the input string, then we say
that the problem can be solved in polynomial time and we
place it in the class P. Formally, P is dened as the set
of all languages that can be decided by a deterministic
polynomial-time Turing machine. That is,
12.2
NP-completeness
7
{
}
Clearly, thesome
question
of}whether a given x is a composite
P = {L : L = L(M ) machine Turing polynomial-time deterministic
for M
is equivalent to the question of whether x is a member
of COMPOSITE. It can be shown that COMPOSITE
where
NP by verifying that it satises the above denition (if
we identify natural numbers with their binary representations).
L(M ) = {w : M accepts w}
COMPOSITE also happens to be in P.[45][46]
and a deterministic polynomial-time Turing machine is a
deterministic Turing machine M that satises the follow12.2 NP-completeness
ing two conditions:
1. M halts on all input w and
2. there exists k N such that TM (n) O(nk ) , Let L be a language over a nite alphabet .
where O refers to the big O notation and
L is NP-complete if, and only if, the following two conditions are satised:
TM (n) = max{tM (w) : w , |w| = n}
tM (w) = steps of number M input on halt to takes w.
NP can be dened similarly using nondeterministic Turing machines (the traditional way). However, a modern
approach to dene NP is to use the concept of certicate
and verier. Formally, NP is dened as the set of languages over a nite alphabet that have a verier that runs
in polynomial time, where the notion of verier is dened as follows.
Let L be a language over a nite alphabet, .
L NP if, and only if, there exists a binary relation R
and a positive integer k such that the following
two conditions are satised:
1. For all x , x L y such that (x, y)
R and |y| O(|x|k ) ; and
2. the language LR = {x#y : (x, y) R} over
{#} is decidable by a Turing machine in polynomial
time.
1. L NP; and
2. any L in NP is polynomial-time-reducible to L
(written as L p L ), where L p L if, and only
if, the following two conditions are satised:
(a) There exists f : * * such that for all w in
* we have: (w L f (w) L) ; and
(b) there exists a polynomial-time Turing machine
that halts with f(w) on its tape on any input w.
13 Popular culture
The lm Travelling Salesman, by director Timothy Lanzone, is the story of four mathematicians
hired by the US government to solve the P vs. NP
problem.[47]
14 See also
Game complexity
15 Notes
12.1.1
Example
Let
16
16
References
[1] R. E. Ladner On the structure of polynomial time reducibility, Journal of the ACM, 22, pp. 151171, 1975.
Corollary 1.1. ACM site.
[2] Hartmanis, Juris. Gdel, von Neumann, and the P = NP
problem (PDF). Bulletin of the European Association for
Theoretical Computer Science 38: 101107.
[3] Cook, Stephen (1971). The complexity of theorem proving procedures. Proceedings of the Third Annual ACM
Symposium on Theory of Computing. pp. 151158.
[4] Fortnow, Lance (2009). The status of the P versus NP
problem (PDF). Communications of the ACM 52 (9): 78
86. doi:10.1145/1562164.1562186.
[5] Sipser, Michael: Introduction to the Theory of Computation, Second Edition, International Edition, page 270.
Thomson Course Technology, 2006. Denition 7.19 and
Theorem 7.20.
[6] William I. Gasarch (June 2002).
The P=?NP
poll. (PDF). SIGACT News 33 (2):
3447.
doi:10.1145/1052796.1052804.
Retrieved 29 December 2008.
[7] William I. Gasarch. The Second P=?NP poll (PDF).
SIGACT News 74.
[8] Scott Aaronson. PHYS771 Lecture 6: P, NP, and
Friends. Retrieved 27 August 2007.
[9] Aviezri Fraenkel and D. Lichtenstein (1981). Computing
a perfect strategy for nn chess requires time exponential
in n. J. Comb. Th. A (31): 199214.
REFERENCES
[11] Arvind, Vikraman; Kurur, Piyush P. (2006). Graph isomorphism is in SPP. Information and Computation 204
(5): 835852. doi:10.1016/j.ic.2006.02.002.
[12] Schning, Uwe. Graph isomorphism is in the low hierarchy. Proceedings of the 4th Annual Symposium on
Theoretical Aspects of Computer Science 1987: 114124.
doi:10.1007/bfb0039599.
Garey, Michael; Johnson, David (1979). Computers and Intractability: A Guide to the Theory of NPCompleteness. San Francisco: W. H. Freeman and
Company. ISBN 0-7167-1045-5.
Goldreich, Oded (2010).
P, Np, and NpCompleteness. Cambridge: Cambridge University
Press. ISBN 978-0-521-12254-2. Online drafts
Immerman, N. (1987). Languages which capture
complexity classes. SIAM Journal of Computing 16
(4): 760778. doi:10.1137/0216051.
Cormen, Thomas (2001). Introduction to Algorithms. Cambridge: MIT Press. ISBN 0-26203293-7.
Papadimitriou, Christos (1994). Computational
Complexity. Boston: Addison-Wesley. ISBN 0-20153082-1.
17
Further reading
18 External links
The Clay Mathematics Institute Millennium Prize
Problems
The Clay Math Institute Ocial Problem Description PDF (118 KB)
Gerhard J. Woeginger. The P-versus-NP page. A
list of links to a number of purported solutions to
the problem. Some of these links state that P equals
NP, some of them state the opposite. It is probable
that all these alleged solutions are incorrect.
Scott Aaronson 's Shtetl Optimized blog: Reasons
to believe, a list of justications for the belief that P
NP
10
19
19
19.1
19.2
Images
https://upload.wikimedia.org/wikipedia/commons/1/18/En-P_versus_NP_problem.ogg
LGPL Contributors:
19.3
Content license
11
19.3
Content license