In computational complexity theory, P, also known as PTIME or DTIME(n^{O(1)}), is one of the most fundamental complexity classes. It contains all decision problems that can be solved by a deterministic Turing machine using a polynomial amount of computation time, or polynomial time.
Cobham's thesis holds that P is the class of computational problems that are "efficiently solvable" or "tractable"; in practice, some problems not known to be in P have practical solutions, and some that are in P do not, but this is a useful rule of thumb.
Definition
A language L is in P if and only if there exists a deterministic Turing machine M, such that
 M runs for polynomial time on all inputs
 For all x in L, M outputs 1
 For all x not in L, M outputs 0
P can also be viewed as a uniform family of boolean circuits. A language L is in P if and only if there exists a polynomialtime uniform family of boolean circuits $\backslash \{C\_n:n\; \backslash in\; \backslash mathbb\{N\}\backslash \}$, such that
 For all $n\; \backslash in\; \backslash mathbb\{N\}$, $C\_n$ takes n bits as input and outputs 1 bit
 For all x in L, $C\_\{x\}(x)=1$
 For all x not in L, $C\_\{x\}(x)=0$
The circuit definition can be weakened to use only a logspace uniform family without changing the complexity class.
Notable problems in P
P is known to contain many natural problems, including the decision versions of linear programming, calculating the greatest common divisor, and finding a maximum matching. In 2002, it was shown that the problem of determining if a number is prime is in P.^{[1]} The related class of function problems is FP.
Several natural problems are complete for P, including stconnectivity (or reachability) on alternating graphs.^{[2]} The article on Pcomplete problems lists further relevant problems in P.
Relationships to other classes
A generalization of P is NP, which is the class of decision problems decidable by a nondeterministic Turing machine that runs in polynomial time. Equivalently, it is the class of decision problems where each "yes" instance has a polynomial size certificate, and certificates can be checked by a polynomial time deterministic Turing machine. The class of problems for which this is true for the "no" instances is called coNP. P is trivially a subset of NP and of coNP; most experts believe it is a strict subset,^{[3]} although this (the P ≠ NP hypothesis) remains unproven. Another open problem is whether NP = coNP (a negative answer would imply P ≠ NP).
P is also known to be at least as large as L, the class of problems decidable in a logarithmic amount of memory space. A decider using $O(\backslash log\; n)$ space cannot use more than $2^\{O(\backslash log\; n)\}\; =\; n^\{O(1)\}$ time, because this is the total number of possible configurations; thus, L is a subset of P. Another important problem is whether L = P. We do know that P = AL, the set of problems solvable in logarithmic memory by alternating Turing machines. P is also known to be no larger than PSPACE, the class of problems decidable in polynomial space. Again, whether P = PSPACE is an open problem. To summarize:
 $\backslash mbox\{L\}\; \backslash subseteq\; \backslash mbox\{AL\}\; =\; \backslash mbox\{P\}\; \backslash subseteq\; \backslash mbox\{NP\}\; \backslash subseteq\; \backslash mbox\{PSPACE\}\; \backslash subseteq\; \backslash mbox\{EXPTIME\}.$
Here, EXPTIME is the class of problems solvable in exponential time. Of all the classes shown above, only two strict containments are known:
 P is strictly contained in EXPTIME. Consequently, all EXPTIMEhard problems lie outside P, and at least one of the containments to the right of P above is strict (in fact, it is widely believed that all three are strict).
 L is strictly contained in PSPACE.
The most difficult problems in P are Pcomplete problems.
Another generalization of P is P/poly, or Nonuniform PolynomialTime. If a problem is in P/poly, then it can be solved in deterministic polynomial time provided that an advice string is given that depends only on the length of the input. Unlike for NP, however, the polynomialtime machine doesn't need to detect fraudulent advice strings; it is not a verifier. P/poly is a large class containing nearly all practical problems, including all of BPP. If it contains NP, then the polynomial hierarchy collapses to the second level. On the other hand, it also contains some impractical problems, including some undecidable problems such as the unary version of any undecidable problem.
In 1999, JinYi Cai and D. Sivakumar, building on work by Mitsunori Ogihara, showed that if there exists a sparse language that is Pcomplete, then L = P.^{[4]}
Properties
Polynomialtime algorithms are closed under composition. Intuitively, this says that if one writes a function that is polynomialtime assuming that function calls are constanttime, and if those called functions themselves require polynomial time, then the entire algorithm takes polynomial time. One consequence of this is that P is low for itself. This is also one of the main reasons that P is considered to be a machineindependent class; any machine "feature", such as random access, that can be simulated in polynomial time can simply be composed with the main polynomialtime algorithm to reduce it to a polynomialtime algorithm on a more basic machine.
Pure existence proofs of polynomialtime algorithms
Some problems are known to be solvable in polynomialtime, but no concrete algorithm is known for solving them. For example, the Robertson–Seymour theorem guarantees that there is a finite list of forbidden minors that characterizes (for example) the set of graphs that can be embedded on a torus; moreover, Robertson and Seymour showed that there is an O(n^{3}) algorithm for determining whether a graph has a given graph as a minor. This yields a nonconstructive proof that there is a polynomialtime algorithm for determining if a given graph can be embedded on a torus, despite the fact that no concrete algorithm is known for this problem.
Alternative characterizations
In descriptive complexity, P can be described as the problems expressible in FO(LFP), the firstorder logic with a least fixed point operator added to it, on ordered structures. In Immerman's 1999 textbook on descriptive complexity,^{[5]} Immerman ascribes this result to Vardi^{[6]} and to Immerman.^{[7]}
History
Kozen^{[8]} states that Cobham and Edmonds are "generally credited with the invention of the notion of polynomial time." Cobham invented the class as a robust way of characterizing efficient algorithms, leading to Cobham's thesis. However, H. C. Pocklington, in a 1910 paper,^{[9]}^{[10]} analyzed two algorithms for solving quadratic congruences, and observed that one took time "proportional to a power of the logarithm of the modulus" and contrasted this with one that took time proportional "to the modulus itself or its square root", thus explicitly drawing a distinction between an algorithm that ran in polynomial time versus one that did not.
Notes
References
External links


 Considered feasible  

 Suspected infeasible  

 Considered infeasible  

 Class hierarchies  

 Families of classes  


This article was sourced from Creative Commons AttributionShareAlike License; additional terms may apply. World Heritage Encyclopedia content is assembled from numerous content providers, Open Access Publishing, and in compliance with The Fair Access to Science and Technology Research Act (FASTR), Wikimedia Foundation, Inc., Public Library of Science, The Encyclopedia of Life, Open Book Publishers (OBP), PubMed, U.S. National Library of Medicine, National Center for Biotechnology Information, U.S. National Library of Medicine, National Institutes of Health (NIH), U.S. Department of Health & Human Services, and USA.gov, which sources content from all federal, state, local, tribal, and territorial government publication portals (.gov, .mil, .edu). Funding for USA.gov and content contributors is made possible from the U.S. Congress, EGovernment Act of 2002.
Crowd sourced content that is contributed to World Heritage Encyclopedia is peer reviewed and edited by our editorial staff to ensure quality scholarly research articles.
By using this site, you agree to the Terms of Use and Privacy Policy. World Heritage Encyclopedia™ is a registered trademark of the World Public Library Association, a nonprofit organization.