# The complexity class promise-BPP

## Definition

To even define promise-BPP loosely, we first need to define a promise problem.

The idea behind a promise problem is that sometimes running an algorithm on an input or even asking if some input has a desired property only makes sense if we restrict our attention to certain inputs. If we have an algorithm that does something like marriage matching, we don't really care nor expect a sensible answer if we run our algorithm on something other than a bipartite graph.

Formally, a promise problem is a partition of the set of all strings into three classes. The first class is the set of all strings that have the desired property (we'll denote this class by $\Pi_1$), the second is the set of all strings without the desired property (denoted by $\Pi_0$), and the last is the set of all strings that are considered to neither have nor not have the desired property.

Whereas BPP was a set of problems, promise-BPP is a set of promise problems. Now a promise problem lies in the complexity class promise-BPP if and only if there exists an algorithm $A$ that can take in any string and outputs either 0 or 1 (where we denote the output of our algorithm if we feed it input $x$ with $A(x)$) and has the following properties:

1. $A$ runs in polynomial time for any input
2. If $x \in \Pi_1$, then $Pr[A(x)=1]\geq \frac{2}{3}$
3. If $x \in \Pi_0$, then $Pr[A(x)=0]\geq \frac{2}{3}$

To emphasize, for any $x \notin \Pi_0 \cup \Pi_1$, the probability that $A(x)$ is 1 can be anything, but we know the algorithm always calculates $A(x)$ quickly.

If we restrict our space of words to $\Pi_0 \cup \Pi_1$ (which is called the promise of our promise problem) and restrict our algorithm $A$ to that set, then our new restricted problem lies in BPP. The problem is we can't always just consider this restriction. There might not be an efficient way to determine if a string is actually in the promise $\Pi_0 \cup \Pi_1$. An example would be if we let the set of all strings be the natural numbers, the promise be the set of all semiprimes, and $A$ tries to determine if the difference between the two prime factors in a semiprime is a power of two. We can't efficiently tell if a natural number is semiprime, so even though theoretically we could restrict our attention to just semiprimes and speak in terms of BPP, practically we can't do that so this problem lies more naturally in promise-BPP. Alternatively, every string could be considered to either have or not have some property, but the algorithm might only be reliable for a subset of strings, in which case, again the problem would more naturally be considered in promise-BPP.