I will use numbers starting from 00 rather than 11, as I find it much more natural.
Here are two classes of problems we can solve in this way:
Functions in TFNP (i.e., single-valued total NP search problems)
(This generalizes the example with one-way permutations. It includes as a special case decision problems from UP∩coUPUP∩coUP.)
The setup is that we have a polynomial-time predicate R(x,y)R(x,y), and a polynomial p(n)p(n) such that for every xx of length nn, there exists a unique yy of length m=p(n)m=p(n) such that R(x,y)R(x,y) holds. The computational task is, given xx, find yy.
Now, I will assume wlog that mm is even, so that 2m≡1(mod3)2m≡1(mod3). The algorithm is to generate a uniformly random y∈[0,2m)y∈[0,2m), and output
yy (as a solution of the search problem) if R(x,y)R(x,y);
y−y′y−y′ (as a random element of {0,1,2}{0,1,2}) if y−y′∈{1,2}y−y′∈{1,2}, and R(x,y′)R(x,y′);
ymod3ymod3 (as a random element of {0,1,2}{0,1,2}) if no y′∈{y,y−1,y−2}y′∈{y,y−1,y−2} solves R(x,y′)R(x,y′).
If there were no solution of the search problem, the 2m2m random choices would give 11 and 22 (2m−1)/3(2m−1)/3 times, and 00 (2m+2)/3(2m+2)/3 times (one more). However, if yy solves the search problem, we tinkered with the elements y,y+1,y+2y,y+1,y+2 (which hit all three residue classes) so that they only produce residues 11 and 22, which evens out the advantage of 00. (I am assuming here wlog that y<2m−2y<2m−2.)
PPA-33 search problems
A convenient way to define PPA-33 is as NP search problems many-one reducible to the following kind of problems. We have a fixed polynomial-time function f(x,y)f(x,y), and a polynomial p(n)p(n), such that for any input xx of length nn, the induced mapping fx(y)=f(x,y)fx(y)=f(x,y) restricted to inputs yy of length m=p(n)m=p(n) is a function fx:[0,2m)→[0,2m)fx:[0,2m)→[0,2m) satisfying fx(fx(fx(y)))=yfx(fx(fx(y)))=y for every yy. The task is, given xx, find a fixpoint yy of fxfx: fx(y)=yfx(y)=y.
We can solve this in the way in the question as follows: given xx of length nn, we generate a random yy of length m=p(n)m=p(n), and output
yy if it is a fixpoint of fxfx;
otherwise, yy, fx(y)fx(y), and fx(fx(y))fx(fx(y)) are distinct elements. We can label them as {y,fx(y),fx(fx(y))}={y0,y1,y2}{y,fx(y),fx(fx(y))}={y0,y1,y2} with y0<y1<y2y0<y1<y2, and output i∈{0,1,2}i∈{0,1,2} such that y=yiy=yi.
It is clear from the definitions that this gives a uniform distribution on {0,1,2}{0,1,2}, as the non-fixpoint yy's come in triples.
Let me show for the record the equivalence of the problem above with Papadimitriou’s complete problem for PPA-33, as this class is mostly neglected in the literature. The problem is mentioned in Buss, Johnson: “Propositional proofs and reductions between NP search problems”, but they do not state the equivalence. For PPA, a similar problem (LONELY) is given in Beame, Cook, Edmonds, Impagliazzo, and Pitassi: “The relative complexity of NP search problems”. There is nothing special about 33, the argument below works mutatis mutandis for any odd prime.
Proposition: The following NP search problems are poly-time many-one reducible to each other:
Given a circuit representing a bipartite undirected graph (A∪B,E)(A∪B,E), and a vertex u∈A∪Bu∈A∪B whose degree is not divisible by 33, find another such vertex.
Given a circuit representing a directed graph (V,E)(V,E), and a vertex u∈Vu∈V whose degree balance (i.e., out-degree minus in-degree) is not divisible by 33, find another such vertex.
Given a circuit computing a function f:[0,2n)→[0,2n)f:[0,2n)→[0,2n) such that f3=idf3=id, find a fixpoint of ff.
Proof:
1≤p21≤p2 is obvious, as it suffices to direct the edges from left to right.
2≤p12≤p1: First, let us construct a weighted bipartite graph. Let AA and BB be copies of VV: A={xA:x∈V}A={xA:x∈V}, B={xB:x∈V}B={xB:x∈V}. For each original edge x→yx→y, we put in an edge {xA,yB}{xA,yB} of weight 11, and an edge {xB,yA}{xB,yA} of weight −1−1. This makes deg(xA)=−deg(xB)deg(xA)=−deg(xB) equal to the degree balance of xx in the original graph. If uu is the given vertex of balance b≢0(mod3)b≢0(mod3), we add an extra edge {uA,uB}{uA,uB} of weight bb, so that deg(uA)=2b≢0(mod3)deg(uA)=2b≢0(mod3), and deg(uB)=0deg(uB)=0. uAuA will be our chosen vertex.
In order to make the graph a plain unweighted undirected graph, we first reduce all weights modulo 33, and drop all edges of weight 00. This leaves only edges of weights 11 and 22. The latter can be replaced with suitable gadgets. For example, instead of a weight-22 edge {xA,yB}{xA,yB}, we include new vertices wAiwAi, zBizBi for i=0,…,3i=0,…,3, with edges {xA,yB}{xA,yB}, {xA,zBi}{xA,zBi}, {wAi,yB}{wAi,yB}, {wAi,zBi}{wAi,zBi}, {wAi,zB(i+1)mod4}{wAi,zB(i+1)mod4}: this makes deg(wAi)=deg(zBi)=3deg(wAi)=deg(zBi)=3, and contributes 5≡2(mod3)5≡2(mod3) to xAxA and yByB.
3≤p23≤p2: Let me assume for simplicity nn is even so that 2n≡1(mod3). We construct a directed graph on V=[0,2n) as follows:
We include edges 3x+1→3x and 3x+2→3x for each x<2n/3−1.
If x0<x1<x2 is a non-fixpoint orbit of f, we include edges x0→x1 and x0→x2.
The chosen vertex will be u=2n−1. The first clause contributes balance 1 or −2≡1(mod3) to each vertex ≠u. Likewise, the second clause contributes balance −1 or 2≡−1(mod3) to vertices that are not fixpoints. Thus, assuming u is not already a fixpoint, it is indeed unbalanced modulo 3, and any other vertex unbalanced modulo 3 is a fixpoint of f.
1≤p3: We may assume that A=B=[0,2n) with n even, and the given vertex u∈A has degree ≡2(mod3).
We can efficiently label edges incident with a vertex y∈B as (y,j), where j<deg(y). In this way, E becomes a subset of [0,2n)×[0,2n), which we identify with [0,22n). We define a function f on [0,2n)×[0,2n) as follows.
On the complement of E: for each y∈B, and j such that deg(y)≤3j<2n−1, we make f(y,3j)=(y,3j+1), f(y,3j+1)=(y,3j+2), f(y,3j+2)=(y,3j). Also, f(3i,2n−1)=(3i+1,2n−1), f(3i+1,2n−1)=(3i+2,2n−1), f(3i+2,2n−1)=(3i,2n−1) for 3i<2n−1. This leaves out the point (2n−1,2n−1), and 3−(deg(y)mod3) points (y,i) for each y∈B whose degree is not divisible by 3.
On E: for each x∈A, we fix an efficient enumeration of its incident edges (y0,j0),…,(yd−1,jd−1), where d=deg(x). We put f(y3i,j3i)=(y3i+1,j3i+1), f(y3i+1,j3i+1)=(y3i+2,j3i+2), f(y3i+2,j3i+2)=(y3i,j3i) for i<⌊d/3⌋. This leaves out deg(x)mod3 points for each vertex x∈A whose degree is not divisible by 3.
Since deg(u)≡2(mod3), two of its incident edges were left out; we make them into yet another f cycle using (2n−1,2n−1) as the third point. The remaining points are left as fixpoints of f. By construction, any of them will give rise to a solution of (1).