Bounty: 50
Let $f(lambda):(0,1)$ → $(0,1)$ be a continuous function. Given a coin with unknown probability of heads of $lambda$, sample the probability $f(lambda)$. One way to do so is to build randomized upper and lower bounds that converge to $f(lambda)$ on average. These bounds serve as an unbiased estimator of $f(lambda)$; the algorithm returns 1 with probability equal to the estimate, and 0 otherwise.
Part of the reversetime martingale algorithm of Łatuszyński et al. (2009/2011) (see "General Factory Functions") to simulate a factory function $f(lambda)$ is as follows. For each n starting with 1:

Flip the input coin, and compute the n^{th} upper and lower bounds of f given the number of heads so far, call them L and U.

Compute the $(n1)$th upper and lower bounds of f given the number of heads so far, call them L* and U*. (These bounds must be the same regardless of the outcomes of future coin flips, and the interval [L*, U*] must equal or entirely contain the interval [L, U].)
More technically (Algorithm 4):
 obtain $L_n$ and $U_n$ given $F_{0, n1}$,
 compute $L^*_n = mathbb{E}[L_{n1}  F_n]$ and $U^*_n = mathbb{E}[U_{n1}  F_n]$,
where $F_n$ is a filtration that depends on $L_n$ and $U_n$.
Though the paper as well as the section on general factory functions that I linked to above shows how this algorithm can be implemented for polynomials, these parts of the algorithm appear to work for any two sequences of functions that converge to $f$, where $L$ or $L^*$ and $U$ or $U^*$ are their lower and upper bound approximations. An example for polynomials follows:
 Given the number of heads $H_n$, $L_n$ is the $H_n$th Bernstein coefficient of the $n$th lower approximating polynomial, and $U_n$ is the $H_n$th Bernstein coefficient of the $n$th upper approximating polynomial.
 $L^*_n$ is the $H_n$th Bernstein coefficient of the $(n1)$th lower approximating polynomial, and $U^*_n$ is the $H_n$th Bernstein coefficient of the $(n1)$th upper approximating polynomial, after elevating both polynomials to degree $n$.
But how do these steps work when the approximating functions (the functions that converge to f) are other than polynomials? Specifically, what if the approximating functions are—
 rational functions with integer coefficients?
 rational functions with rational coefficients?
 arbitrary approximating functions?
REFERENCES:
 Łatuszyński, K., Kosmidis, I., Papaspiliopoulos, O., Roberts, G.O., "Simulating events of unknown probabilities via reverse time martingales", arXiv:0907.4018v2 [stat.CO], 2009/2011.