title: Polynomial-time counting reduction
text: # Polynomial-time counting reduction
  
  In the computational complexity theory of counting problems, a polynomial-time counting reduction is a type of reduction (a transformation from one problem to another) used to define the notion of completeness for the complexity class ♯P. These reductions may also be called polynomial many-one counting reductions or weakly parsimonious reductions; they are analogous to many-one reductions for decision problems and they generalize the parsimonious reductions.
  
  ## Definition
  
  A polynomial-time counting reduction is usually used to transform instances of a known-hard problem $X$ into instances of another problem $Y$ that is to be proven hard. It consists of two functions $f$ and $g$, both of which must be computable in polynomial time. The function $f$ transforms inputs for $X$ into inputs for $Y$, and the function $g$ transforms outputs for $Y$ into outputs for $X$.
  
  These two functions must preserve the correctness of the output. That is, suppose that one transforms an input $x$ for problem $X$ to an input $y=f(x)$ for problem $Y$, and then one solves $y$ to produce an output $z$. It must be the case that the transformed output $g(z)$ is the correct output for the original input $x$. That is, if the input-output relations of $X$ and $Y$ are expressed as functions, then their function composition must obey the identity $X=g\circ Y\circ f$. Alternatively, expressed in terms of algorithms, one possible algorithm for solving $X$ would be to apply $f$ to transform the problem into an instance of $Y$, solve that instance, and then apply $g$ to transform the output of $Y$ into the correct answer for $X$.
  
  ## Relation to other kinds of reduction
  
  As a special case, a parsimonious reduction is a polynomial-time transformation $f$ on the inputs to problems that preserves the exact values of the outputs. Such a reduction can be viewed as a polynomial-time counting reduction, by using the identity function as the function $g$.
  
  ## Applications in complexity theory
  
  A functional problem (specified by its inputs and desired outputs) belongs to the complexity class ♯P if there exists a non-deterministic Turing machine that runs in polynomial time, for which the output to the problem is the number of accepting paths of the Turing machine. Intuitively, such problems count the number of solutions to problems in the complexity class NP. A functional problem $Y$ is said to be ♯P-hard if there exists a polynomial-time counting reduction from every problem $X$ in ♯P to $Y$. If, in addition, $Y$ itself belongs to ♯P, then $Y$ is said to be ♯P-complete. (Sometimes, as in Valiant's original paper proving the completeness of the permanent of 0–1 matrices, a weaker notion of reduction, Turing reduction, is instead used for defining ♯P-completeness.)
  
  The usual method of proving a problem $Y$ in ♯P to be ♯P-complete is to start with a single known ♯P-complete problem $X$ and find a polynomial-time counting reduction from $X$ to $Y$. If this reduction exists, then there exists a reduction from any other problem in ♯P to $Y$, obtained by composing a reduction from the other problem to $X$ with the reduction from $X$ to $Y$.
  
  