From Surf Wiki (app.surf) — the open knowledge base
♯P
Complexity class
Complexity class
In computational complexity theory, the complexity class #P (pronounced "sharp P" or, sometimes "number P" or "hash P") is the set of the counting problems associated with the decision problems in the set NP. More formally, #P is the class of function problems of the form "compute f(x)", where f is the number of accepting paths of a nondeterministic Turing machine running in polynomial time. Unlike most well-known complexity classes, it is not a class of decision problems but a class of function problems. The most difficult, representative problems of this class are #P-complete.
Relation to decision problems
An NP decision problem can often be stated in the form "Are there any solutions that satisfy certain constraints?" For example:
- Are there any subsets of a list of integers that add up to zero? (subset sum problem)
- Are there any Hamiltonian cycles in a given graph with cost less than 100? (traveling salesman problem)
- Are there any variable assignments that satisfy a given CNF (conjunctive normal form) formula? (Boolean satisfiability problem or SAT)
- Does a univariate real polynomial have any positive roots? (root finding)
Corresponding #P function problems ask "how many" rather than "are there any". For example:
- How many subsets of a list of integers add up to zero?
- How many Hamiltonian cycles in a given graph have cost less than 100?
- How many variable assignments satisfy a given CNF formula?
- How many roots of a univariate real polynomial are positive?
Formal definitions
#P is formally defined as follows: : #P is the set of all functions f:{0,1}^* \to \mathbb{N} such that there is a polynomial-time nondeterministic Turing machine M such that for all x \in {0,1}^*, f(x) equals the number of accepting branches in M's computation graph on x.
#P can also be equivalently defined in terms of a verifer. A decision problem is in NP if there exists a polynomial-time checkable certificate to a given problem instance—that is, NP asks whether there exists a proof of membership for the input that can be checked for correctness in polynomial time. Questions in #P ask how many certificates there exist for a problem instance that can be checked for correctness in polynomial time. In this context, #P is defined as follows: : #P is the set of functions f: {0,1}^* \to \mathbb{N} such that there exists a polynomial p: \mathbb{N} \to \mathbb{N} and a polynomial-time deterministic Turing machine V, called the verifier, such that for every x \in {0,1}^*, f(x)=\Big| \big {y \in {0,1}^{p(|x|)} : V(x,y)=1 \big } \Big| . (In other words, f(x) equals the size of the set containing all of the polynomial-size certificates).
History
The complexity class #P was first defined by Leslie Valiant in a 1979 article on the computation of the permanent of a square matrix, in which he proved that permanent is #P-complete.{{cite journal
Larry Stockmeyer has proved that for every #P problem P there exists a randomized algorithm using an oracle for SAT, which given an instance a of P and \epsilon 0 returns with high probability a number x such that (1-\epsilon) P(a) \leq x \leq (1+\epsilon) P(a). The runtime of the algorithm is polynomial in a and 1/ \epsilon. The algorithm is based on the leftover hash lemma.
References
References
- (Spring 2006). "Complexity of counting". Princeton University.
- (2009). "Computational Complexity: A Modern Approach". Cambridge University Press.
- (November 1985). "On Approximation Algorithms for #P". [[SIAM Journal on Computing]].
This article was imported from Wikipedia and is available under the Creative Commons Attribution-ShareAlike 4.0 License. Content has been adapted to SurfDoc format. Original contributors can be found on the article history page.
Ask Mako anything about ♯P — get instant answers, deeper analysis, and related topics.
Research with MakoFree with your Surf account
Create a free account to save articles, ask Mako questions, and organize your research.
Sign up freeThis content may have been generated or modified by AI. CloudSurf Software LLC is not responsible for the accuracy, completeness, or reliability of AI-generated content. Always verify important information from primary sources.
Report