# Function problem

In computational complexity theory, a function problem is a computational problem where a single output (of a total function) is expected for every input, but the output is more complex than that of a decision problem. For function problems, the output is not simply 'yes' or 'no'.

## Formal definition

A functional problem ${\displaystyle P}$ is defined as a relation ${\displaystyle R}$ over strings of an arbitrary alphabet ${\displaystyle \Sigma }$:

${\displaystyle R\subseteq \Sigma ^{*}\times \Sigma ^{*}}$

An algorithm solves ${\displaystyle P}$ if for every input ${\displaystyle x}$ such that there exists a ${\displaystyle y}$ satisfying ${\displaystyle (x,y)\in R}$, the algorithm produces one such ${\displaystyle y}$.

## Examples

A well-known function problem is given by the Functional Boolean Satisfiability Problem, FSAT for short. The problem, which is closely related to the SAT decision problem, can be formulated as follows:

Given a boolean formula ${\displaystyle \varphi }$ with variables ${\displaystyle x_{1},\ldots ,x_{n}}$, find an assignment ${\displaystyle x_{i}\rightarrow \{{\text{TRUE}},{\text{FALSE}}\}}$ such that ${\displaystyle \varphi }$ evaluates to ${\displaystyle {\text{TRUE}}}$ or decide that no such assignment exists.

In this case the relation ${\displaystyle R}$ is given by tuples of suitably encoded boolean formulas and satisfying assignments. While a SAT algorithm, fed with a formula ${\displaystyle \varphi }$, only needs to return "unsatisfiable" or "satisfiable", an FSAT algorithm needs to return some satisfying assignment in the latter case.

Other notable examples include the travelling salesman problem, which asks for the route taken by the salesman, and the integer factorization problem, which asks for the list of factors.

## Relationship to other complexity classes

Consider an arbitrary decision problem L in the class NP. By the definition of NP, each problem instance x that is answered ‘yes’ has a polynomial-size certificate y which serves as a proof for the ‘yes’ answer. Thus, the set of these tuples (x,y) forms a relation, representing the function problem “given x in L, find a certificate y for x”. This function problem is called the function variant of L; it belongs to the class FNP.

FNP can be thought of as the function class analogue of NP, in that solutions of FNP problems can be efficiently verified (i.e., in polynomial time in terms of the length of the input on a deterministic Turing machine), but not necessarily efficiently found. In contrast, the class FP, which can be thought of as the function class analogue of P, consists of function problems whose solutions can be constructed in polynomial time.

## Self-reducibility

Observe that the problem FSAT introduced above can be solved using only polynomially many calls to a subroutine which decides the SAT problem: An algorithm can first ask whether the formula ${\displaystyle \varphi }$ is satisfiable. After that the algorithm can fix variable ${\displaystyle x_{1}}$ to TRUE and ask again. If the resulting formula is still satisfiable the algorithm keeps ${\displaystyle x_{1}}$ fixed to TRUE and continues to fix ${\displaystyle x_{2}}$, otherwise it decides that ${\displaystyle x_{1}}$ has to be FALSE and continues. Thus, FSAT is solvable in polynomial time using an oracle deciding SAT. In general, a problem in NP is called self-reducible if its function variant can be solved in polynomial time using an oracle deciding the original problem. Every NP-complete problem is self-reducible. It is conjectured that the integer factorization problem is not self-reducible.

## Reductions and complete problems

Function problems can be reduced much like decision problems: Given function problems ${\displaystyle \Pi _{R}}$ and ${\displaystyle \Pi _{S}}$ we say that ${\displaystyle \Pi _{R}}$ reduces to ${\displaystyle \Pi _{S}}$ if there exists polynomially-time computable functions ${\displaystyle f}$ and ${\displaystyle g}$ such that for all instances ${\displaystyle x}$ of ${\displaystyle R}$ and possible solutions ${\displaystyle y}$ of ${\displaystyle S}$, it holds that

• If ${\displaystyle x}$ has an ${\displaystyle R}$-solution, then ${\displaystyle f(x)}$ has an ${\displaystyle S}$-solution.
• ${\displaystyle (f(x),y)\in S\implies (x,g(x,y))\in R.}$

It is therefore possible to define FNP-complete problems analogous to the NP-complete problem:

A problem ${\displaystyle \Pi _{R}}$ is FNP-complete if every problem in FNP can be reduced to ${\displaystyle \Pi _{R}}$. The complexity class of FNP-complete problems is denoted by FNP-C or FNPC. Hence the problem FSAT is also an FNP-complete problem, and it holds that ${\displaystyle \mathbf {P} =\mathbf {NP} }$ if and only if ${\displaystyle \mathbf {FP} =\mathbf {FNP} }$.

## Total function problems

The relation ${\displaystyle R(x,y)}$ used to define function problems has the drawback of being incomplete: Not every input ${\displaystyle x}$ has a counterpart ${\displaystyle y}$ such that ${\displaystyle (x,y)\in R}$. Therefore the question of computability of proofs is not separated from the question of their existence. To overcome this problem it is convenient to consider the restriction of function problems to total relations yielding the class TFNP as a subclass of FNP. This class contains problems such as the computation of pure Nash equilibria in certain strategic games where a solution is guaranteed to exist. In addition, if TFNP contains any FNP-complete problem it follows that ${\displaystyle \mathbf {NP} ={\textbf {co-NP}}}$.