- P = NP problem
The relationship between the

is an unsolved question incomplexity class es P and NPtheoretical computer science . It is considered to be the most important problem in the field – theClay Mathematics Institute has offered a $1 million US prize for the first correct proof.cite web|title=Millennium Prize Problems|url=http://www.claymath.org/millennium/|date=2000-05-24|accessdate=2008-01-12]In essence, the question

**P**=**NP**? asks: if 'yes'-answers to a 'yes'-or-'no'-question can be "verified" "quickly" (inpolynomial time ), can the answers themselves also be "computed" quickly?Consider, for instance, the subset-sum problem, an example of a problem which is "easy" to verify, but whose answer is "believed" (but not proven) to be "difficult" to compute. Given a set of

integer s, does some nonemptysubset of them sum to 0? For instance, does a subset of the set nowrap| {−2, −3, 15, 14, 7, −10} add up to 0? The answer "yes, because nowrap| {−2, −3, −10, 15} add up to zero", can be quickly verified with a few additions. However, finding such a subset in the first place could take much longer. The information needed to verify a positive answer is also called a "certificate". Given the right certificates, "yes" answers to our problem can be verified in polynomial time, so this problem is in**NP**.An answer to the

**P**=**NP**question would determine whether problems like the subset-sum problem are as "easy" to compute as to verify. If it turned out**P**does not equal**NP**, it would mean that some**NP**problems are substantially "harder" to compute than to verify.The restriction to yes/no problems is unimportant; the resulting problem when more complicated answers are allowed (whether

**FP**=**FNP**) is equivalent. [*Scott Aaronson. Complexity Zoo: FP. "FP = FNP if and only if P = NP". http://qwiki.stanford.edu/wiki/Complexity_Zoo#fp*]**Context of the problem**The relation between the

is studied incomplexity class es P and NPcomputational complexity theory , the part of thetheory 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). As of 2008, these assumptions are satisfied by all practical computers yet devised, even those featuring

parallel computing .Fact|date=January 2008In this theory, the class

**P**consists of all those "decision problem s" (defined below) that can be solved on a deterministic sequential machine in an amount of time that ispolynomial in the size of the input; the class**NP**consists of all those decision problems whose positive solutions can be verified inpolynomial time given the right information, or equivalently, whose solution can be found in polynomial time on a non-deterministic machine. [*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.*] Arguably, the biggest open question intheoretical computer science concerns the relationship between those two classes::Is**P**equal to**NP**?In a 2002 poll of 100 researchers, 61 believed the answer is no, 9 believed the answer is yes, 22 were unsure, and 8 believed the question may be independent of the currently accepted axioms, and so impossible to prove or disprove.cite journal|author=William I. Gasarch|title=The P=?NP poll.|journal=SIGACT News|volume=33|issue=2|pages=34–47|month=June | year=2002|url=http://www.cs.umd.edu/~gasarch/papers/poll.pdf|doi=10.1145/1052796.1052804|format=PDF]**Formal definitions for P and NP**Conceptually, a "decision problem" is a problem that takes as input some string, and outputs "yes" or "no". If there is an

algorithm (say aTuring machine , or a computer program with unbounded memory) which is able to produce the correct answer for any input string of length $n$ in at most $c\; cdot\; n^k$ 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 defined as the set of all languages which can be decided by a deterministic polynomial-time Turing machine. That is,**P**= $\{\; L\; :\; L=L(M)\; ext\{\; for\; some\; deterministic\; polynomial-time\; Turing\; machine\; \}\; M\; \}$where $L(M)\; =\; \{\; winSigma^\{*\}:\; M\; ext\{\; accepts\; \}\; w\; \}$

and a deterministic polynomial-time Turing machine is a deterministic Turing machine $M$ which satisfies the following two conditions:

#$M\; ext\{\; halts\; on\; all\; input\; \}\; w$; and

#there exists $k\; in\; N$ such that $T\_\{M\}(n)in;$"O"$(n^\{k\})$,::where $T\_\{M\}(n)\; =\; max\{\; t\_\{M\}(w)\; :\; winSigma^\{*\},\; left|w\; ight|\; =\; n\; \}$::and $t\_\{M\}(w)\; =\; ext\{\; number\; of\; steps\; M\; takes\; to\; halt\; on\; input\; \}\; w.$**NP**can be defined similarly using nondeterministic Turing machines (the traditional way). However, a modern approach to define**NP**is to use the concept of "certificate" and "verifier". Formally,**NP**is defined as the set of languages over a finite alphabet that have a verifier that runs in polynomial time, where the notion of "verifier" is defined as follows.Let $L$ be a language over a finite alphabet, $Sigma$.

$Linmathbf\{NP\}$ if, and only if, there exists a binary relation $RsubsetSigma^\{*\}\; imesSigma^\{*\}$ and a positive integer $k$ such that the following two conditions are satisfied:

#For all $xinSigma^\{*\}$, $xin\; L\; Leftrightarrowexists\; yinSigma^\{*\}$ such that $(x,y)in\; R;$ and $left|y\; ight|in;$"O"$(left|x\; ight|^\{k\})$; and

#the language $L\_\{R\}\; =\; \{\; x\#\; y:(x,y)in\; R\}$ over $Sigmacup\{\#\}$ is decidable by a Turing machine.A Turing machine that decides $L\_\{R\}$ is called a "verifier" for $L$ and a $y$ such that $(x,y)in\; R$ is called a "certificate of membership" of $x$ in $L$.

In general, a verifier does not have to be polynomial-time. However, for $L$ to be in

**NP**, there must be a verifier that runs in polynomial time.**Example**Let $mathit\{COMPOSITE\}\; =\; \{xin\; N:x=pq\; ;\; ext\{for\; integers\};\; p,\; q\; >\; 1\; \}$ and $R\; =\; \{(x,y)in\; N\; imes\; N:\; 1sqrt\; x;\; ;\; ;y;\; ext\{divides\};\; x\}\; math>.$

Clearly, the question of whether a given $x$ is a composite is equivalent to the question of whether $x$ is a member of $mathit\{COMPOSITE\}$. It can be shown that $mathit\{COMPOSITE\}inmathbf\{NP\}$ by verifying that $mathit\{COMPOSITE\}$ satisfies the above definition.

$mathit\{COMPOSITE\}$ also happens to be in

**P**cite web|author=M. Agrawal, N. Kayal, N. Saxena|title=Primes is in P|url=http://www.cse.iitk.ac.in/users/manindra/algebra/primality_v6.pdf] [] .AKS primality test **NP-complete**To attack the

**P**=**NP**question, the concept of**NP**-completeness is very useful. Informally, the**NP**-complete problems are the "toughest" problems in**NP**in the sense that they are the ones most likely not to be in**P**.**NP**-complete problems are those**NP**-hard problems which are in**NP**, where**NP**-hard problems are those to which "any" problem in**NP**can be reduced in polynomial time. For instance, the decision problem version of thetraveling salesman problem is**NP**-complete, so "any" instance of "any" problem in**NP**can be transformed mechanically into an instance of the traveling salesman problem, in polynomial time. The traveling salesman problem is one of many such**NP**-complete problems. If any**NP**-complete problem is in**P**, then it would follow that**P**=**NP**. Unfortunately, many important problems have been shown to be**NP**-complete and as of 2008, not a single fast algorithm for any of them is known.Based on the definition alone, it's not obvious that

**NP**-complete problems exist. A trivial and contrived**NP**-complete problem can be formulated as: given a description of a Turing machine M guaranteed to halt in polynomial time, does there exist a polynomial-size input that M will accept?cite web|author=Scott Aaronson|title=PHYS771 Lecture 6: P, NP, and Friends|url=http://www.scottaaronson.com/democritus/lec6.html |accessdate=2007-08-27] It is in**NP**because, given an input, it is simple to check whether or not M accepts the input by simulating M; it is**NP**-hard 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 theBoolean satisfiability problem . This resultcame to be known asCook–Levin theorem ; itsproof 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 in this class. Thus, a vast class of seemingly unrelated problems are all reducible to one another, and are in a sense the "same problem".**Formal definition for NP-completeness**Although there are many equivalent ways of describing

**NP**-completeness, in the context of the**P**vs**NP**question, it is best to define**NP**-complete problems in terms of**NP**problems.Fact|date=January 2008Let $L$ be a language over a finite alphabet $Sigma$.

$L$ is

**NP**-complete if, and only if, the following two conditions are satisfied:#$Linmathbf\{NP\}$; and

#any $L^\{\text{'}\}inmathbf\{NP\}$ is polynomial time reducible to $L$ (written as $L^\{\text{'}\}leq\_\{p\}\; L$), where $L^\{\text{'}\}leq\_\{p\}\; L$ if, and only if, the following two conditions are satisfied:

##There exists $f\; :\; Sigma^\{*\}\; ightarrowSigma^\{*\}$ such that $forall\; winSigma^\{*\}(win\; L^\{\text{'}\}Leftrightarrow\; f(w)in\; L)$; and

##there exists a polynomial time Turing machine which halts with $f(w)$ on its tape on any input $w$.**till harder problems**Although it is unknown whether

**P**=**NP**, problems outside of**P**are known. A number ofsuccinct problem s, that is, problems which 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**$subsetneq$, these problems are outsideEXPTIME **P**, and so require more than polynomial time. In fact, by thetime hierarchy theorem , they cannot be solved in significantly less than exponential time.Fact|date=January 2008The problem of deciding the truth of a statement in

Presburger arithmetic requires even more time. Fischer and Rabin proved in1974 that every algorithm which decides the truth of Presburger statements has a runtime of at least $2^\{2^\{cn$ for some constant "c". Here, "n" is the length of the Presburger statement. Hence, the problem is known to need more than exponential run time. Even more difficult are the undecidable problems, such as thehalting 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.**Is P really practical?**All of the above discussion has assumed that

**P**means "easy" and "not in**P**" means "hard". While this is a common and reasonably accurate assumption in complexity theory, it is not always true in practice. SeeCobham's thesis for an in-depth discussion of this point, but the main arguments are:

*It ignores the size of the exponents. In fields where practical problems have millions of variables (such asOperations Research orElectronic Design Automation ), even O(n^{3}) algorithms are often impractical.

*It ignores constant factors, which can be arbitrarily large and important in practice.

*It only considers worst-case times. Thesimplex algorithm often (or even usually) solves problem instances in time $n$, but on very rare occasions takes time $2^\{n\}$. Since the worst case time is exponential, the algorithm is not polynomial time, but still very practical.

*It only considers deterministic solutions. There might be a problem that can be solved quickly if a tiny error probability is acceptable, but is much harder to solve exactly.

*Advances in technology may make exponential-time algorithms efficient for practical ranges of problem sizes.**Why do many computer scientists think P ≠ NP?**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 the more than 3000**NP**-complete problems (seeList of NP-complete problems ). These algorithms were sought long before the concept of**NP**-completeness was even known (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**=andco-NP **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.Fact|date=January 2008

On the other hand, some researchers believe that we are overconfident in

**P**≠**NP**and should explore proofs of**P**=**NP**as well. For example, in 2002 these statements were made:**Consequences of proof**One of the reasons the problem attracts so much attention is the consequences of the answer.

A proof of

**P**=**NP**could have stunning practical consequences, if the proof leads to efficient methods for solving some of the important problems in NP. Various NP-complete problems are fundamental in many fields. There are enormous positive consequences that would follow from rendering tractable many currently mathematically intractable problems. For instance, many problems inoperations research are NP-complete, such as some types ofinteger programming , and thetravelling salesman problem , to name two of the most famous examples. Efficient solutions to these problems would have enormous implications forlogistics . Many other important problems, such as some problems inProtein structure prediction are also**NP**-complete;cite journal |author=Berger B, Leighton T |title=Protein folding in the hydrophobic-hydrophilic (HP) model is NP-complete |journal=J. Comput. Biol. |volume=5 |issue=1 |pages=27–40 |year=1998 |pmid=9541869 |doi=10.1145/1052796.1052804] if these problems were solvable efficiently it could spur considerable advances in biology.But such changes may pale in significance compared to the revolution an efficient method for solving NP-complete problems would cause in mathematics itself. According to

Stephen Cook ,cite web|author=Stephen Cook|title=The P versus NP Problem|url=http://www.claymath.org/millennium/P_vs_NP/Official_Problem_Description.pdf|accessdate=2007-08-27|format=PDF]Research mathematicians spend their careers trying to prove theorems, and some proofs have taken decades or even centuries to find after problems have been stated – for instance,

Fermat's Last Theorem took over three centuries to prove. A method that is guaranteed to find proofs to theorems, should one exist of a "reasonable" size, would essentially end this struggle.A proof that showed that

**P**≠**NP**, while lacking the practical computational benefits of a proof that**P**=**NP**, would also represent a massive 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 efficiently, 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. [*cite journal |title=The Heuristic Problem-Solving Approach |author=L. R. Foulds |journal=The Journal of the Operational Research Society |volume=34 |issue=10 |month=October | year=1983 |pages=pp. 927–934 |url=http://www.jstor.org/pss/2580891 |doi=10.2307/2580891*]**Results about difficulty of proof**The Clay Mathematics Institute million-dollars prize and a huge amount of dedicated research with no substantial results suggest that the problem is difficult. In fact, some of the most fruitful research related to the

**P**=**NP**problem has been in showing that existing proof techniques are not powerful enough to answer the question, thus suggesting that novel technical approaches are probably required.Essentially all known proof techniques in

computational complexity theory fall into one of the following classifications, each of which is known to be insufficient to prove that**P**≠**NP**:*

**Relativizing proofs:**Imagine a world where every algorithm is allowed to make queries to some fixed subroutine called an oracle, and the running time of the oracle is not counted against the running time of the algorithm. Most proofs, especially classical ones, apply uniformly in a world with oracles, regardless of what the oracle does. These proofs are called "relativizing". In 1975, Baker, Gill, and Solovay showed that**P**=**NP**with respect to some oracles, while**P**≠**NP**for other oracles. [*T. P. Baker, J. Gill, R. Solovay. "Relativizations of the P =? NP Question".*] Since relativizing proofs can only prove statements that are uniformly true with respect to all possible oracles, this showed that relativizing techniques cannot resolveSIAM Journal on Computing , 4(4): 431-442 (1975)**P**=**NP**.*

**Natural proofs:**In 1993,Alexander Razborov andSteven Rudich defined a general class of proof techniques for circuit complexity lower bounds, called "natural proof s". At the time, all previously known circuit lower bounds were natural, and circuit complexity was considered a very promising approach for resolving**P**=**NP**. However, Razborov and Rudich showed that in order to prove**P**≠**NP**using a natural proof, one necessarily must also prove an even stronger statement, which is believed to be false. Thus it is unlikely that natural proofs alone can resolve**P**=**NP**.*

**Algebrizing proofs:**After the Baker-Gill-Solovay result, new non-relativizing proof techniques were successfully used to prove that IP =PSPACE . However, in 2008, Aaronson and Wigderson showed that the main new technical tool used in the**IP**=**PSPACE**proof, which they called "algebrization", was also insufficient to resolve**P**=**NP**. [*S. Aaronson and A. Wigderson. Algebrization: A New Barrier in Complexity Theory, in Proceedings of ACM STOC'2008, pp. 731-740.*]These barriers are another reason why

**NP**-complete problems are useful: if a polynomial-time algorithm can be demonstrated for an**NP**-complete problem, this would solve the**P**=**NP**problem in a way which is not excluded by the above results.**Polynomial-time algorithms**No one knows whether polynomial-time algorithms exist for

**NP**-complete languages. But if such algorithms do exist, some of them are already known. For example, the following algorithm (due to Levin) correctly accepts an**NP**-complete language, but as of 2008, it is unknown how long it takes in general.// 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 finite 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...infinity 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 HALTIf, and only if,

**P**=**NP**, then this is a polynomial-time algorithm accepting an**NP**-complete language. "Accepting" means it gives "yes" answers in polynomial time, but is allowed to run forever when the answer is "no".Perhaps we want to "solve" the SUBSET-SUM problem, rather than just "accept" the SUBSET-SUM language. That means we want the algorithm to always halt and return a "yes" or "no" answer.

As of 2008 , it is unknown whether an algorithm exists that does this in polynomial time. But if there is an algorithm that provably does this in polynomial time, then so does the algorithm that is obtained by replacing the IF statement in the above algorithm with this:IF the program outputs a complete math proof AND each step of the proof is legal AND the conclusion is that S does (or does not) have a subset summing to 0 THEN OUTPUT "yes" (or "no") and HALT

**Logical characterizations**The

**P**=**NP**problem can be restated in terms of the expressibility of certain classes of logical statements, as a result of work indescriptive complexity . All languages (of finite structures with a fixed signature including alinear order relation) in**P**can be expressed infirst-order logic with the addition of a suitableleast fixed point operator (effectively, this, in combination with the order, allows the definition of recursive functions); indeed, (as long as the signature contains at least one predicate or function in addition to the distinguished order relation [so that the amount of space taken to store such finite structures is actually polynomial in the number of elements in the structure] ), this precisely characterizes**P**. Similarly,**NP**is the set of languages expressible in existentialsecond-order logic — that is, second-order logic restricted to excludeuniversal quantification over relations, functions, and subsets. The languages in thepolynomial hierarchy ,**PH**, correspond to all ofsecond-order logic . Thus, the question "is**P**a proper subset of**NP**" can be reformulated as "is existential second-order logic able to describe languages (of finite linearly ordered structures with nontrivial signature) that first-order logic with least fixed point cannot?". The word "existential" can even be dropped from the previous characterization, since**P**=**NP**if and only if**P**=**PH**(as the former would establish that**NP**=**co-NP**, which in turn would imply that**NP**=**PH**).**ee also***

**P**(complexity)

***NP**(complexity)

***NP**-complete

*Game complexity

*Cobham's thesis

*List of open problems in computer science

*Unsolved problems in mathematics **References****Further reading*** A. S. Fraenkel and D. Lichtenstein, Computing a perfect strategy for n*n chess requires time exponential in n, Proc. 8th Int. Coll. "Automata, Languages, and Programming", Springer LNCS 115 (1981) 278–293 and "J. Comb. Th. A" 31 (1981) 199–214.

* E. Berlekamp and D. Wolfe, Mathematical Go: Chilling Gets the Last Point, A. K. Peters, 1994. D. Wolfe, Go endgames are hard, MSRI Combinatorial Game Theory Research Worksh., 2000.

*Neil Immerman . Languages Which Capture Complexity Classes. "15th ACM STOC Symposium", pp.347–354. 1983.

*

***External links*** [

*http://www.claymath.org/millennium/ The Clay Mathematics Institute Millennium Prize Problems*]

*

* [*http://www.claymath.org/Popular_Lectures/Minesweeper/ Ian Stewart on Minesweeper as*]**NP**-complete at The Clay Math Institute

* Gerhard J. Woeginger. [*http://www.win.tue.nl/~gwoegi/P-versus-NP.htm 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.

* [*http://www.ics.uci.edu/~eppstein/cgt/hard.html Computational Complexity of Games and Puzzles*]

* Scott Aaronson's Complexity Zoo: [*http://qwiki.caltech.edu/wiki/Complexity_Zoo#p P*] , [*http://qwiki.caltech.edu/wiki/Complexity_Zoo#np NP*]

* [*http://www.qeden.com/ Qeden*] , a wiki that aims to solve the Millennium Prize Problems ("down for maintenance" as of 15th of July 2008)

* [*http://scottaaronson.com/blog/?p=122 Scott Aaronson's Shtetl Optimized blog: Reasons to believe*] , a list of justifications for the belief that P ≠ NPzh:P/NP问题

*Wikimedia Foundation.
2010.*