Quick viewing(Text Mode)

Arxiv:2103.03971V1 [Math.LO] 5 Mar 2021 Occur with Probability 1/2

Arxiv:2103.03971V1 [Math.LO] 5 Mar 2021 Occur with Probability 1/2

EXTRACTION IN COMPUTABILITY THEORY

DOUGLAS CENZER AND CHRISTOPHER P. PORTER

Abstract. In this article, we study a notion of the extraction rate of Turing functionals that translate between notions of randomness with respect to different underlying probability measures. We analyze several classes of extraction proce- dures: a first class that generalizes von Neumann’s trick for extracting unbiased randomness from the tosses of a biased coin, a second class based on work of gen- erating biased randomness from unbiased randomness by Knuth and Yao, and a third class independently developed by Levin and Kautz that generalizes the data compression technique of arithmetic coding. For the first two classes of extraction procedures, we identify a level of algorithmic randomness for an input that guar- antees that we attain the extraction rate along that input, while for the third class, we calculate the rate attained along sufficiently random input sequences.

1. Introduction The aim of this study is to analyze the rate of the extraction of randomness via various effective procedures using the tools of computability theory and algorithmic randomness. Our starting point is a classic problem posed by von Neumann in [vN51], namely that of extracting unbiased randomness from the tosses of a biased coin. Von Neumann provides an elegant solution to the problem: Toss the biased coin twice. If the outcome is HH or TT , then discard these tosses. Otherwise, if the outcome is HT , then output H, and if the outcome is TH, then output T. Notice in the case that the coin comes up heads with probability p, • the probability of HH is p2, • the probability of TT is (1 − p)2, and • the probability of HT (and that of TH ) is p(1 − p). It follows from the independence of the events H and T that with probability one the derived sequence will be an infinite sequence in which the events H and T each arXiv:2103.03971v1 [math.LO] 5 Mar 2021 occur with probability 1/2. It is well known that von Neumann’s procedure is rather inefficient, since on aver- 1 age p(1−p) biased bits are required to produce one unbiased bit when the biased coin 1 comes up heads with probability p ∈ (0, 1). For instance, in the case that p = 2 , where we are given a fair coin to begin with, four tosses on average yield one bit of

Date: March 9, 2021. 1 2 DOUGLAS CENZER AND CHRISTOPHER P. PORTER output (a rate that is four times the rate attained simply by reading off the tosses of the coin). However, a number of improvements have been found. For instance, in [Per92], Peres studies a sequence of procedures obtained by iterating von Neumann’s procedure and calculates the associated extraction rate of each such procedure. As defined by Peres, given a monotone function φ : 2<ω → 2<ω, the extraction rate of φ with respect to the bias p is defined to be E(|φ(x , x , . . . , x )|) lim sup 1 2 n , n→∞ n where the bits xi are independent and (p, 1−p)-distributed and E stands for expected ω value (with respect to the p-Bernoulli measure on 2 ). Setting (φk)k∈ω to be the sequence of procedures defined by Peres, he proves that, when tossed a coin that comes up heads with probability p ∈ (0, 1) E(|φ (x , x , . . . , x )|) lim lim sup k 1 2 n = H(p), k→∞ n→∞ n where H(p) = −p log(p) − (1 − p) log(1 − p) is the entropy associated with the underlying source. This notion of an extraction rate of an effective procedure has not been thor- oughly studied from the point of view of computability theory (however, see Doty [Dot08] and Toska [Tos14], each of which study a more local notion of rate of certain procedures applied to specific inputs). In this article, we study a definition of the extraction rate for Turing functionals that accept their input with probability one (referred to as almost total functionals). In particular, we can formalize certain ran- domness extraction procedures as Turing functionals and study the behavior of these functionals when applied to algorithmically random sequences. For a number of such functionals, it is known that almost every sequence attains the extraction rate; here we provide a sufficient level of algorithmic randomness that guarantees this result. We consider three main examples here: (1) functionals defined in terms of maps on 2<ω that we call block maps, which generalize von Neumann’s procedure,

(2) functionals derived from certain trees called discrete distribution generating trees (or DDG trees, for short), introduced by Knuth and Yao [KY76] in the study of non-uniform random number generation, and

(3) a procedure independently developed by Levin [LZ70] and Kautz [Kau91] for converting biased random sequences into unbiased random sequences. Notably, our analysis of the extraction rates of these three classes of examples draws upon the machinery of effective ergodic theory, using certain effective versions of RANDOMNESS EXTRACTION IN COMPUTABILITY THEORY 3

Birkhoff’s ergodic theorem (and, in the case of the Levin-Kautz procedure, an effec- tive version of the Shannon-McMillan-Breiman theorem from classical due to Hoyrup [Hoy12]). The remainder of the paper is as follows. In Section2, we lay out the requisite background for this study. Next, in Section3, we formally define the extraction rate of a Turing functional, derive several preliminary results, and introduce several basic examples. We then turn to more general examples: Turing functionals derived from block maps in Section4, Turing functionals derived from computable DDG trees in Section5, and the Levin-Kautz procedure in Section6. We conclude with several open questions in Section7.

2. Background 2.1. Notation. The set of finite binary strings will be written as 2<ω; members of 2<ω will be written as lowercase Greek letters, σ, τ, ρ, and so on. The set of infinite binary sequences will be written as 2ω; members of 2ω will be written as uppercase Roman letters X,Y,Z. For a finite string σ ∈ 2<ω, let |σ| denote the length of n. For two strings σ, τ, say that τ extends σ and write σ  τ if |σ| ≤ |τ| and σ(i) = τ(i) for i < |σ|. For X ∈ 2ω, σ ≺ X means that σ(i) = X(i) for i < |σ|. Let σ_τ denote the concatenation of σ, τ ∈ 2<ω; we similarly define the concatenation σ_X of σ ∈ 2<ω ω and X ∈ 2 . Let Xn denote the string σ ≺ X with |σ| = n. For n < m, X[n, m) denotes the string X(n) ...X(m − 1). The empty string will be written as . Two sequences X,Y ∈ 2ω may be coded together into Z = X ⊕ Y , where Z(2n) = X(n) and Z(2n + 1) = Y (n) for all n. For a finite string σ, let σ denote {X ∈ 2ω : σ ≺ X}. We shall refer to σ as the cylinder determined by σJ.K Each such interval is a clopen set and the clopenJ K sets are just finite unions of intervals.

ω <ω 2.2. Trees. A nonempty closed set P ⊆ 2 may be identified with a tree TP ⊆ 2 where TP = {σ : P ∩ σ 6= ∅}. Note that TP has no dead ends. That is, if σ ∈ TP , _ _ <ω then either σ 0 ∈ TP JorKσ 1 ∈ TP (or both). For an arbitrary tree T ⊆ 2 , let [T ] ω denote the set of infinite paths through T ; that is, [T ] = {X ∈ 2 :(∀n) Xn ∈ T }. It is well-known that P ⊆ 2ω is a closed set if and only if P = [T ] for some tree T . 0 P is a Π1 class, or an effectively closed set, if P = [T ] for some computable tree T . 2.3. Turing functionals. Recall that a continuous function Φ : 2ω → 2ω may be defined from a function φ : 2<ω → 2<ω, which we refer to as a generator of Φ, satisfying the conditions (i) For σ, τ ∈ 2<ω, if σ  τ, then φ(σ)  φ(τ). ω (ii) For all X ∈ 2 , limn→∞ |φ(Xn)| = ∞. Note by the compactness of 2ω, a generator φ for a continuous function Φ satisfies the condition: 4 DOUGLAS CENZER AND CHRISTOPHER P. PORTER

(iii) For all σ ∈ 2<ω and m ∈ ω, there exists n ∈ ω such that for every σ ∈ {0, 1}n, |φ(σ)| ≥ m. S ω ω We then have Φ(X) = n φ(Xn). The total Turing functionals Φ : 2 → 2 are those which may be defined in this manner from a computable generator φ : 2<ω → 2<ω. We will sometimes refer to total Turing functionals as tt-functionals. The partial Turing functionals Φ :⊆ 2ω → 2ω are given by those φ : 2<ω → 2<ω which only satisfy condition (i) (we will still refer to such functions as generators). In this S case Φ(X) = n φ(Xn) may be only a finite string. We set dom(Φ) = {X : Φ(X) ∈ 2ω}. For τ ∈ 2<ω we also define Φ−1(τ) = {σ ∈ 2<ω : τ  φ(σ)&(∀σ0 ≺ σ) τ 6 φ(σ0)}. In particular, by our above convention, we have Φ−1() = {}. Similarly, for S ⊆ <ω −1 S −1 ω −1 2 we define Φ (S) = τ∈S Φ (τ). For A ⊆ 2 , we denote by Φ (A) the set {X ∈ dom(Φ) : Φ(X) ∈ A}. Note in particular that Φ−1( τ ) = Φ−1(τ) ∩ dom(Φ). J K J K 2.4. Computable measures on 2ω. Recall that a measure µ on 2ω is computable <ω −i if there is a computable function f : 2 ×ω → Q2 such that |µ( σ )−f(σ, i)| ≤ 2 . For a prefix-free V ⊆ 2<ω (i.e., for σ ∈ V , if σ ≺ τ, then τ∈ / VJ ),K we set µ( V ) = P J K σ∈V µ(σ). Hereafter, we will write µ( σ ) as µ(σ) for strings σ and µ( V ) as µ(V ) for V ⊆ 2<ω. We also denote the LebesgueJ K measure by λ, where λ(σJ) =K 2−|σ| for σ ∈ 2<ω.

2.5. Notions of algorithmic randomness. We assume that the reader is familiar with the basics of algorithmic randomness; see, for instance [Nie09], [DH10], [SUV17], or the more recent [FP20]. Let µ be a computable measure on 2ω. Recall that a ω µ-Martin-L¨oftest is a sequence (Ui)i∈ω of uniformly effectively open subsets of 2 such that for each i, −i µ(Ui) ≤ 2 . ω T Moreover, X ∈ 2 passes the µ-Martin-L¨oftest (Ui)i∈ω if X/∈ i∈ω Ui. Lastly, ω X ∈ 2 is µ-Martin-L¨ofrandom, denoted X ∈ MLRµ, if X passes every µ-Martin- L¨oftest. When µ is the Lebesgue measure λ, we often abbreviate MLRµ by MLR. We can obtain alternative notions of randomness by modifying the definition of a Martin-L¨oftest. We will work with two such alternatives in this paper. Let µ be a computable measure on 2ω and X ∈ 2ω.

(i) X is µ-Schnorr random (written X ∈ SRµ) if and only if X is not contained in any µ-Martin-L¨oftest (Ui)i∈ω with the additional condition that µ(Ui) is computable uniformly in i. (ii) X is µ-Kurtz random (written X ∈ KRµ) if and only if X is not contained in 0 any Π1 class of µ-measure 0 (equivalently, if and only if it is not contained in 0 any Σ2 class of µ-measure 0). RANDOMNESS EXTRACTION IN COMPUTABILITY THEORY 5

Note that MLRµ ⊆ SRµ ⊆ KRµ for every computable measure µ. We are particularly interested in the interaction between Turing functionals and computable measures on 2ω. For computable measure µ on 2ω, a Turing functional Φ : 2ω → 2ω is µ-almost total if µ(dom(Φ)) = 1.

Lemma 1. A Turing functional Φ is µ-almost total if and only if KRµ ⊆ dom(Φ).

Proof. If KRµ ⊆ dom(Φ), then clearly Φ is µ-almost total. For the other direction, 0 ω observe that dom(Φ) is a Π2 subset of 2 . Thus, if Φ is µ-almost total, it follows that ω 0 ω S 2 \ dom(Φ) is a Σ2 µ-nullset, and hence 2 \ dom(Φ) = i∈ω Ui where each Ui is a 0 Π1 µ-nullset. Thus if X/∈ dom(Φ), there is some i such that X ∈ Ui, so X cannot be µ-Kurtz random. 

3. Extraction Rates 3.1. The definition of extraction rate via a generator. We are interested in a version of the use function of a Turing functional Φ which arises from a given generator φ. Let uφ(X, n) be the least m such that |φ(Xm)| ≥ n. Then the extraction rate of the computation of Y = Φ(X) from X is given by the ratio n , uφ(X, n) that is, the relative amount of input from X needed to compute the first n values of Y . There is an alternative definition which is more straightforward. The φ-output/input ratio of σ, OIφ(σ), is defined to be |φ(σ)| OI (σ) = . φ |σ| Lemma 2. For any Turing functional Φ with generator φ and any X ∈ 2ω such that Φ(X) ∈ 2ω, |φ(X n)| m lim  = lim , n→∞ n m→∞ uφ(X, m) provided that both limits exists.

Proof. Fix an input X. Let m0 = 0 and let mk+1 be the least m > mk such that |φ(Xm)| > |φ(Xmk)|. Let nk = |φ(Xmk)|. Then for each k > 0, uφ(X, nk) = mk and hence nk nk OIφ(Xmk) = = , mk uφ(X, nk) so that the two sequences have identical infinite subsequences, and hence the limits must be equal (since they are assumed to exist).  6 DOUGLAS CENZER AND CHRISTOPHER P. PORTER

Let us write OIφ(X) for lim supn→∞ OIφ(Xn); we refer to this as the φ-extraction rate along X. For the specific examples of extraction rates that we calculate in the remaining sections, we will work with specific generators defined from the randomness extraction literature. 3.2. Canonical generators. Suppose that we are given an almost total Turing functional and would like to determine its extraction rate. Which generator should we use? For instance, we would like to say that the extraction rate for a constant function should be very low and should approach 0 in the limit. However, consider the following example. Example 3. Let Φ(X) = 0ω for all X ∈ 2ω and let φ(σ) = 0|σ| for all σ ∈ 2<ω. Then n uφ(X, n) = n for all n and thus limn→∞ = 1 for all X. uφ(X,n) To avoid this problem, we can work with a canonical generator of a Turing func- tional, which may be defined as follows. Definition 4. For any partial continuous function Φ, the canonical generator φ for Φ is defined by letting φ(σ) be the longest common initial segment of all members of {Φ(X): σ ≺ X}. Example 5. (i) The identity function φ on strings is the canonical generator of the identity ω ω function on 2 and thus for X ∈ 2 , the use uφ(X, n) = n for all n ∈ ω, so n that limn→∞ = 1. uφ(X,n) (ii) If Φ(X) = X ⊕ X, then its canonical generator is given by φ(σ) = σ ⊕ σ for σ ∈ 2<ω (where σ ⊕ σ is the finite string defined as in the infinite case). Thus ω n 1 for X ∈ 2 , limn→∞ = . uφ(X,n) 2 Note that if φ is the canonical generator for a constant function Φ(X) = C, then we have φ(σ) = C, an infinite sequence, for every σ. To avoid this unpleasantness, we can further restrict our functions to the non-constant functions. Definition 6. A partial continuous function Φ is nowhere constant if for any string σ, either Φ(X) is undefined (that is, it is a finite string) for some X ∈ σ , or there exist X1 6= X2 in σ such that Φ(X1) 6= Φ(X2). J K J K It is easy to see that if Φ is nowhere constant, then the canonical generator is a well-defined map taking strings to strings and satisfies condition (i) in the definition of a representative of a functional. Moreover, the canonical generator of a functional has the following nice property, which is immediate from the definition. Lemma 7. Let Φ be a partial continuous functional on 2ω with canonical generator φ : 2<ω → 2<ω. Then for all σ such that σ0, σ1 ∈ dom(φ), if φ(σ0)  τ and φ(σ1)  τ, then φ(σ)  τ. RANDOMNESS EXTRACTION IN COMPUTABILITY THEORY 7

Next we consider the computability of the canonical represenation. Proposition 8. If Φ is a total, nowhere constant Turing functional, then the canon- ical generator φ of Φ is computable. Proof. Let Φ : 2ω → 2ω be a total, nowhere constant Turing functional and let ψ : 2<ω → 2<ω be some computable generator of Φ. Then we can compute, for each m, a value nm such that |ψ(σ)| ≥ m for all strings σ of length ≥ nm. Now let a string σ be given. Since Φ is nowhere constant, we can compute a least value m such that there exist τ0, τ1  σ such that |ψ(τi)| ≥ m for i ∈ {0, 1} and ψ(τ0) 6= ψ(τ1). Then the value φ(σ) of the canonical generator can be computed by letting φ(σ) be 0 0 the common initial segment ψ(σ )m for all σ of length nm extending σ.  On the other hand, if Φ is only a partial computable, nowhere constant function, then the canonical generator of Φ need not be computable. Example 9. Let E be some noncomputable c.e. set and define Φ(0n1X) = X if n ∈ E and undefined otherwise. Then for the canonical generator φ of Φ, we have φ(0n1σ) = σ if n ∈ E and φ(0n1σ) = , otherwise. We can modify this to get an almost total functional by letting Φ(0n1X) = X if either n ∈ E or if X(i) = 1 for some i. In this case, for each k ∈ ω, we have φ(0n10k) = 0k if n ∈ E and equals  otherwise. Proposition 10. For any partial computable Turing functional Φ, the canonical generator φ is computable in ∅0. Proof. Let ψ be some computable generator of Φ. Then for the canonical generator φ, we have φ(σ) = τ if and only if • (∃n)(∀σ0 ∈ {0, 1}n)[σ ≺ σ0 =⇒ τ  ψ(σ0)], and • for i = 0, 1, ¬(∃n)(∀σ0 ∈ {0, 1}n)[σ ≺ σ0 =⇒ τ _i  ψ(σ0)]. 0 Thus the graph of ψ is a Σ2 set and in fact is a difference of c.e. sets.  Lastly, we can define the output/input ratio of a Turing functional given in terms of its canonical generator. Definition 11. Let Φ be a partial Turing functional with canonical generator φ. The Φ-output/input ratio given by σ, OIΦ(σ), is defined to be |φ(σ)| OI (σ) = . Φ |σ| ω Similarly, for X ∈ 2 we define OIΦ(X) to be |φ(X n)| lim sup  . n→∞ n

We refer to OIΦ(X) as the Φ-extraction rate along X. 8 DOUGLAS CENZER AND CHRISTOPHER P. PORTER

3.3. Average output/input ratios. For a given generator φ of a Turing functional Φ, we would like to define the average φ-output/input ratio. However, such an average depends on an underlying probability measure on 2ω. Since we are interested, at least in part, in Turing functionals that extract unbiased randomness from biased random inputs, we need to consider average φ-output/input ratios parametrized by an underlying measure. Definition 12. Given φ : 2<ω → 2<ω, the average φ-output/input ratio for strings of length n with respect to µ, denoted Avg(φ, µ, n), is defined to be X Avg(φ, µ, n) = µ(σ)OIφ(σ). σ∈2n Equivalently, we have 1 X Avg(φ, µ, n) = µ(σ)|φ(σ)|. n σ∈2n ω Note that this is the µ-average value of OIφ(Xn) over the space 2 , since this function is constant on each interval σ . That is, if we fix n and let Fn(X) = J K ω OIφ(Xn), then Fn is a computable map from 2 to R and the average value of Fn on 2ω is given by Z Fn(X)dµ(X). 2ω We consider the behavior of this average in the limit, which leads to the following definition (which is adapted from one provided by Peres in [Per92]). Definition 13. For a function φ : 2<ω → 2<ω, the µ-extraction rate of φ, denoted Rate(φ, µ), is defined to be Rate(φ, µ) = lim sup Avg(φ, µ, n). n→∞ In the case that φ is the canonical generator of a functional Φ, we further define Rate(Φ, µ) = Rate(φ, µ). Example 14. Let Φ(X) = X ⊕ X, with a generator given by φ(σ) = σ ⊕ σ (which, as noted above, is the canonical generator of Φ). Then |φ(σ)| = 2|σ| and hence OIφ(σ) = 2 for all strings σ. Thus the average output/input φ ratio is 2. Certainly _ uφ(X, 2n) = n but at the same time uφ((σ ⊕ σ) i) = i + 1, so that uφ(X, 2n − 1) = n and hence 2n−1 = 2 − 1 . Thus these rates agree in the limit but not at each uφ(X,2n−1) n level. Since OIφ(Xn) = 2 for all n, we have the limit OIφ(X) = 2 for all X and hence the average output input ratio over all X ∈ 2ω is Z Rate(Φ, µ) = Rate(φ, µ) = OIφ(X)dµ = 2, 2ω RANDOMNESS EXTRACTION IN COMPUTABILITY THEORY 9

n where the limit exists. Moreover, limn→∞ = 2 as well. uφ(X,n)

An interesting problem is to determine for which Turing functionals the lim sup in the definition of extraction rate can be replaced with a limit. The following is an example where the limit does not exist.

Example 15. Given a fixed function α : ω → ω \{0}, define the total functional α(i) Φα(X) for any input X to be the infinite concatenation of the strings X(i) . Thus if α(n) = 2 for all n, then Φα(X) = X ⊕ X. If α(n) = n + 1, then

Φα(X) = X(0)X(1)X(1)X(2)X(2)X(2)X(3) .... ∗ P Now let α (n) = i

For the limn→∞ Avg(φ, µ, n) to exist, the function φ must be regular in the relative amount of input needed for a given amount of output. The authors have studied some families of functions for which this is the case. First, there are the so-called online continuous (or computable) functions, which compute exactly one bit of output for each bit of input (see [CR18]). On the other hand, there are the random continuous functions which produce regularity in a probabilistic sense. For example, the random continuous functions as defined by Barmpalias et al. [BBC+08] produce outputs 2 which are roughly 3 as long, on the average, as the inputs. See also [CP15]. Another example for which the limsup in the definition of rate is actually a limit is given by the following result.

Lemma 16. Suppose there exists some c ∈ ω such that |φ(σ)| ≤ c|σ| for all σ ∈ 2<ω and that there is some r ∈ R such that |φ(X n)| lim  = r n→∞ n for µ-almost every X ∈ 2ω. Then Rate(φ, µ) = r. 10 DOUGLAS CENZER AND CHRISTOPHER P. PORTER |φ(X n)| Proof. Since there is some c such that  ≤ c for all X ∈ 2ω, by the dominated n convergence theorem, Z |φ(X n)| Z |φ(X n)| r = lim  dµ(X) = lim  dµ(X) = 2ω n→∞ n n→∞ 2ω n = lim Avg(φ, µ, n) = Rate(φ, µ). n→∞  In the next three sections, we consider several examples of Turing functionals Φ given by generators φ for which the following two conditions hold:

(i) limn→∞ Avg(φ, µ, n) exists (for an appropriate choice of the measure µ), and (ii)OI φ(X) = limn→∞ OIφ(Xn) = Rate(φ, µ) for all sufficiently µ-random se- quences X. That is, the extraction rate of φ is attained along sufficiently random inputs of Φ.

4. The Rate of Block Functionals For fixed n ∈ ω, an n-block map is a function φ : 2<ω → 2<ω satisfying the <ω _ _ _ following property: Given σ ∈ 2 , we first write σ = σ1 ... σk τ, where |σi| = n for i = 1, . . . , k and |τ| < k. Then we have _ _ φ(σ) = φ(σ1) ... φ(σk). That is, the behavior of φ is completely determined by its values of strings of length n (and is undefined on all strings of length k < n). An n-block functional is a Turing functional Φ that has an n-block map φ as its canonical generator. In this case we refer to φ as the n-block map associated to Φ. (Note that every n-block map can be extended to an nk-block map for k ∈ ω that induces the same functional. Thus, the requirement that an n-block functional has an n-block map as a canonical generator ensures that an n-block functional isn’t also an nk-block functional for every k ∈ ω.) We say that an n-block map φ : 2<ω → 2<ω is non-trivial if |φ(σ)| > 0 for some σ ∈ 2n. Block maps show up in the literature on randomness extraction, where typically one attempts to extract a sequence of unbiased random bits from a biased source. For example, the 2-block map φ : 2<ω → 2<ω defined by setting • φ(10) = 0, • φ(01) = 1, and • φ(00) = φ(11) =  is precisely von Neumann’s procedure. Other examples of block maps in the random- ness extraction literature are the randomizing functions studied by Elias in [Eli72], RANDOMNESS EXTRACTION IN COMPUTABILITY THEORY 11 the iterations of von Neumann’s procedure studied by Peres in [Per92], and extracting procedures studied by Pae in [Pae16]. We will determine the extraction rate of a n-block function with respect to a certain class of measures. An n-step Bernoulli measure is a Bernoulli measure on (2n)ω. That is, an n-step Bernoulli measure is obtained by taking an infinite product of copies of some fixed measure on the set 2n. Clearly, an n-step Bernoulli measure extends naturally to a measure on 2ω. Hereafter, we will use the term n-step Bernoulli measure to refer to this extension. Recall that a measure µ on 2ω is positive if µ(σ) > 0 for all σ ∈ 2<ω.

Proposition 17. Let n ∈ ω. Suppose that µ is a positive n-step Bernoulli measure on 2ω and φ : 2<ω → 2<ω is a non-trivial n-block map with associated n-block functional Φ. Then Φ is µ-almost total.

Proof. Let S = {τ ∈ 2n : φ(τ) = }, which is not equal to 2n since φ is non-trivial. Let U = Sω, the set of all infinite sequences built up by concatenating members n P of S. Since µ is positive and S 6= 2 , τ∈S µ(τ) < 1, from which it follows that µ(U) = 0. Next, for each σ ∈ (2n)<ω such that |σ| = nk for some k ∈ ω, let _ Uσ = {σ X : X ∈ U}. Clearly µ(Uσ) = µ(σ) · µ(U) = 0, since µ is an n-step ω S Bernoulli measure. Then dom(Φ) = 2 \ σ∈(2n)<ω Uσ, from which it follows that µ(dom(Φ)) = 1. 

Theorem 18. Let µ be a positive n-step Bernoulli measure on 2ω and φ : 2n → 2<ω a non-trivial n-block map with associated n-block functional Φ. Then Rate(Φ, µ) = Rate(φ, µ) = Avg(φ, µ, n)

Proof. We first note that if we consider the bits τ(0), . . . , τ(n − 1) of τ ∈ 2n as a sequence of random variables, then the expected value of |φ(τ)| is X E|φ(τ(0), . . . , τ(n − 1))| = µ(σ)|φ(σ)|, σ∈2n from which it follows that 1 Avg(φ, µ, n) = E|φ(τ(0), . . . , τ(n − 1))|. n _ _ For k ∈ ω, given a string of length τ = τ1 ··· τk of length nk (where |τi| = n for i = 1, . . . , k), since µ is an n-step Bernoulli measure, the blocks τ1, . . . , τk are independent. Thus, the µ-expected number of output bits for a string of length nk 12 DOUGLAS CENZER AND CHRISTOPHER P. PORTER is k  X E |φ(τ(0), . . . , τ(nk − 1))| = E |φ(τi(0), . . . , τi(n − 1))|) i=1 k X = n · Avg(φ, µ, n) = nk · Avg(φ, µ, n). i=1 Thus 1 Avg(φ, µ, nk) = E|φ(τ(0), . . . , τ(nk − 1))| = Avg(φ, µ, n). nk For k ∈ ω and i < n, we have Avg(φ, µ, nk + i) ≤ Avg(φ, µ, nk), since the expected number of output bits of strings for inputs of length nk + i is equal to the expected number of output bits for inputs of length nk. It thus follows that Rate(Φ, µ) = Rate(φ, µ) = lim sup Avg(φ, µ, k) = lim Avg(φ, µ, nk) = Avg(φ, µ, n). k→∞ k→∞  Theorem 19. Given n ∈ ω, let µ be a computable, positive n-step Bernoulli measure on 2ω, and let X ∈ 2ω be µ-Schnorr random. Then for every non-trivial n-block map φ : 2<ω → 2<ω with associated n-block functional Φ,

OIΦ(X) = Rate(Φ, µ). To prove Theorem 19, we first need to develop some background. Let T : 2ω → 2ω be the n-shift operator; that is, for X ∈ 2ω and σ ∈ 2n, T (σ_X) = X. For an n-step Bernoulli measure µ on 2ω, T is µ-invariant, i.e., for any τ ∈ 2<ω, µ(τ) = µ(T −1( τ )). Indeed, for any cylinder τ , J K J K [ T −1( τ ) = {στ : σ ∈ 2n} . J K J K Thus, X X µ T −1( τ ) = µ(στ) = µ(τ) µ(σ) = µ(τ). J K σ∈2n σ∈2n Recall that a µ-invariant transformation T : 2ω → 2ω is ergodic if for any A ⊆ 2ω such that T −1(A) = A, we have µ(A) = 0 or µ(A) = 1. The following lemma is a useful characterization of ergodic transformations on 2ω (see [Sil08, Theorem 5.1.5, Theorem 6.3.4(1)]). Lemma 20. Let µ be a measure on 2ω and let T : 2ω → 2ω be µ-invariant. Then T is ergodic if and only if n−1 1 X lim µ(T −i σ ∩ τ ) = µ(σ)µ(τ) n→∞ n i=0 J K J K RANDOMNESS EXTRACTION IN COMPUTABILITY THEORY 13 for all σ, τ ∈ 2<ω.

The following result is straightforward, but we include it here for the sake of completeness.

Lemma 21. The n-shift on 2ω is ergodic with respect to an n-step Bernoulli measure.

Proof. We apply Lemma 20. Let σ, τ ∈ 2<ω be given. Then there is some k ∈ ω and m with 0 ≤ m < n such that |τ| = nk + m. Then for j = 2n−m, there are Sj −(k+1) strings τ1, . . . τj of length n(k + 1) such that τ = i=1 τi . Then T ( σ ) = S {ρσ : ρ ∈ 2n(k+1)} . Note that for ρ ∈ 2n(k+1)J ,K J K J K J K µ T −(k+1)( σ ) ∩ ρ  = µ(σ)µ(ρ) (1) J K J K Then we have j −(k+1) [ −(k+1) T ( σ ) ∩ τ = (T ( σ ) ∩ τi ) J K J K i=1 J K J K and hence j −(k+1)  X −(k+1)  µ T ( σ ) ∩ τ = µ T ( σ ) ∩ τi J K J K i=1 J K J K j X = µ(σ)µ(τi) by (1) i=1 = µ(σ)µ(τ) A similar argument shows that µ T −k0( σ ) ∩ τ  = µ(σ)µ(τ) for all k0 ≥ k + 1. It follows that J K J K n−1 1 X lim µ(T −i σ ∩ τ ) = µ(σ)µ(τ), n→∞ n i=0 J K J K and hence by Lemma 20, T is ergodic. 

The last ingredient we will use in the proof of Theorem 19 is the following effective version of Birkhoff’s Ergodic Theorem due to Franklin and Towsner:

Theorem 22 (Franklin-Towsner [FT14]). Let µ be a computable measure on 2ω and let T : 2ω → 2ω be a computable, µ-invariant, ergodic transformation. Then for any bounded computable function F and any µ-Schnorr random X ∈ 2ω, k−1 1 X Z lim F (T i(X)) = F dµ. k→∞ k i=0 14 DOUGLAS CENZER AND CHRISTOPHER P. PORTER

Proof of Theorem 19. Let X ∈ SRµ. Given n ∈ ω, let µ be an n-step Bernoulli |φ(X n)| measure on 2ω and let T be the n-shift. We define F (X) =  . Then n Z X |φ(σ)| F dµ = µ(σ) = Avg(φ, µ, n) = Rate(φ, µ), n σ∈2n where the last equality holds by Theorem 18. Next, for any µ-Schnorr random sequence X ∈ 2ω,

k−1 k−1 i k−1 1 X i 1 X |φ(T (X)n)| 1 X  |φ(Xnk)| F (T (X)) = = φ X [ni, n(i + 1) = , k k n nk  nk i=0 i=0 i=0 where the last equality follows from the fact that φ is an n-block map. Then k−1 |φ(Xn)| |φ(Xnk)| 1 X i OIΦ(X) = lim = lim = lim F (T (X)) n→∞ n k→∞ nk k→∞ k i=0 Z = F dµ = Rate(φ, µ) = Rate(Φ, µ), where the third equality follows from Theorem 22, as the function F is bounded. 

5. The Rate of Functionals Induced by DDG-Trees The next example we consider is given in terms of DDG-trees (discrete distribution generating trees), first introduced by Knuth and Yao in [KY76]. A DDG-tree is a tree S ⊆ 2<ω with terminal nodes that can be used with unbiased random bits to induce a discrete probability distribution on a set A = {a1, ··· , ak}. The terminal nodes of S, the set of which is denoted by D(S), are labelled with values from A. We define a labelling function `S : D(S) → A such that for all τ ∈ D(S), `S(τ) ∈ A is the label assigned to τ. To ensure we have a probability distribution on A, the labels on S must satisfy the following condition: For i = 1, . . . , k, if we set X −|τ| pi = 2 ,

`S (τ)=ai then k X pi = 1. i=1 The distribution {p1, p2, . . . , pk} on A is induced by the following process: • For each branching node in the tree, we use the toss of an unbiased coin to determine which direction we will take. RANDOMNESS EXTRACTION IN COMPUTABILITY THEORY 15

• If we arrive at a terminal node τ, the process outputs `S(τ). A DDG-tree T defines a function from 2ω to A as follows: For X ∈ 2ω, the output determined by X is the unique element a ∈ A such that for some n ∈ ω, Xn is a terminal node in T labelled with a, if it exists; otherwise, the output is the empty string . That is, we look for the first n such that Xn ∈ D(S), and if such an n exists, we output the value `S(Xn). Knuth and Yao define the average running time of randomness extraction by a DDG-tree S to be X AvgRT (S) = i · λ( D(S) ∩ 2i ). i∈ω J K That is, AvgRT (S) is the average number of input bits needed to produce a single output bit. Hereafter we will restrict our attention to computable DDG-trees, where a DDG- tree S is computable if the set D(S) is a computable set and the function `S : D(S) → A is computable (which together imply that the values p1, . . . , pk assigned to members of A are computable). We can use a computable DDG-tree S to define a Turing functional as follows. <ω First, for every σ ∈ D(S), we set φS(σ) = `S(σ). Then for any σ ∈ 2 , if σ does not extend any τ ∈ D(S), then we set φS(σ) = . However, if σ extends some τ ∈ D(S), _ _ then we can write σ = σ1 ... σk, where σ1, . . . , σk−1 ∈ D(S) and σk 6∈ D(S) (and is possibly empty). Note that this decomposition is unique, as D(S) is prefix-free. Then we set ______φS(σ) = φS(σ1) ... φS(σk−1) φS(σk) = `S(σ1) ... `S(σk−1) . ω ω ω We next extend φS to a Turing functional ΦS : 2 → A . For X ∈ 2 , we define a possibly finite sequence n0, n1,... inductively as follows: • n0 is the unique n such that `S(Xn) ∈ D(S), if it exists; otherwise n0 is undefined. • Suppose n0, . . . , nk have been defined. Then nk+1 is the unique n such that `T (X[nk, n)) ∈ D(S); otherwise nk+1 is undefined. Hereafter we will refer to the sequence of strings (X[nk, nk+1))k∈ω as the S-blocks of X. ω If, for a given X ∈ 2 , the corresponding infinite sequence (ni)i∈ω is defined, then we set _ _ _ _ ΦS(X) = `S(Xn0) `S(X[n0, n1)) ··· `S(X[nk, nk+1)) ···

In the case that the corresponding sequence of block lengths is finite, then ΦS(X) is undefined. The issue of determining the canonical generator of a Turing functional defined in terms of a DDG-tree is a delicate one. Knuth and Yao spend a considerable portion of 16 DOUGLAS CENZER AND CHRISTOPHER P. PORTER their study [KY76] on the identification of the DDG-tree that most efficiently induces a distribution on a set A (as well as more general distributions), where this efficiency is given in terms of extraction rate. Hereafter, we will restrict our attention to DDG- trees S that are minimal with respect to extraction rate, which amounts to assuming <ω that the corresponding map φS on 2 is the canonical generator of the associated Turing functional ΦS. Let us refer to such DDG-trees as minimal DDG-trees.

Proposition 23. If S is a computable DDG-tree, then the Turing functional ΦS is almost total. Proof. First, observe that collection of cylinders determined by the elements of D(S) yields a set of Lebesgue measure one. Indeed, k k X X −|τ| X λ( D(S) ) = 2 = pi = 1. J K i=1 `S (τ)=ai i=1 ω 0 It then follows that the set P = {X ∈ 2 :(∀n) φS(Xn) = } is a Π1 class of _ Lebesgue measure zero. As in the proof of Proposition 17, if we set Pσ = {σ X : X ∈ ω S P}, then we have λ(Pσ) = λ(σ) · λ(P) = 0. Then dom(ΦS) = 2 \ σ∈(D(S))<ω Pσ, and so we have λ(dom(ΦS)) = 1. 

We would like to calculate the extraction rate for a Turing functional ΦS induced by a minimal DDG-tree S. To do so, we will first prove the following: Theorem 24. Let X ∈ 2ω be Schnorr random. Then for every computable, minimal DDG-tree S, we have 1 OI (X) = . ΦS AvgRT (S) To prove Theorem 24, we would like to mimic the proof of Theorem 19. In partic- ular, we need to find an appropriate effective version of Birkhoff’s ergodic theorem to derive the result. However, to do so, we need to define the appropriate measure- preserving transformation.

<ω ω Definition 25. Let S ⊆ 2 be a tree with λ( D(S) ) = 1. The tree-shift TS : 2 → ω _ 2 is defined by setting TS(X) = Y , where XJ= σ KY and σ ∈ D(S). Moreover, in the case that Xn∈ / D(S) for all n ∈ ω, TS(X) is undefined.

Note that if S is a computable DDG-tree, then the associated tree-shift TS is computable by an almost total Turing functional, as TS is defined on D(S) . J K Lemma 26. If S is a tree with λ( D(S) ) = 1, then the tree-shift TS is λ-invariant and ergodic. J K RANDOMNESS EXTRACTION IN COMPUTABILITY THEORY 17

Proof. First, we show λ-invariance. For τ ∈ 2<ω, we have −1 [ TS ( τ ) = {ρτ : ρ ∈ D(S)} . J K J K Then −1 X X X λ(TS ( τ )) = λ(στ) = λ(σ)λ(τ) = λ(τ) λ(σ) = λ(τ). J K σ∈D(S) σ∈D(S) σ∈D(S)

Next, we prove that TS is ergodic. Towards this end, we claim that for every <ω −n  σ, τ ∈ 2 and n ∈ ω, λ TS ( σ ) ∩ τ = λ(σ)λ(τ). We show this by induction on n. For the case in which Jn K= 1,J givenK σ, τ ∈ 2<ω, there is a prefix-free set S {τi}i∈ω ⊆ D(S) such that i∈ω τi ⊆ τ and J K J KX λ(τ) = λ(τi); i∈ω S that is, τ = i∈ω τi up to a set of λ-measure zero. Then J K J K −1 [ TS ( σ ) ∩ τ = τiσ J K J K i∈ωJ K and hence −1  X X λ TS ( σ ) ∩ τ = λ(τiσ) = λ(σ) λ(τi) = λ(σ)λ(τ). J K J K i∈ω i∈ω −n  Next, suppose that λ TS ( σ ) ∩ τ = λ(σ)λ(τ). Then J K J K −(n+1) −n −1 −n [  [ −n TS ( σ ) = TS (TS ( σ )) = TS {ρσ : ρ ∈ D(S)} = TS ( ρσ ). J K J K J K ρ∈D(S) J K Then  −(n+1)  X −n  λ TS ( σ ) ∩ τ = λ TS ( ρσ ) ∩ τ J K J K ρ∈D(S) J K J K X X = λ(ρσ)λ(τ) = λ(σ)λ(τ) λ(ρ) = λ(σ)λ(τ), ρ∈D(S) ρ∈D(S) where the second equality follows from the inductive hypothesis. It follows that n−1 1 X lim λ(T −i σ ∩ τ ) = λ(σ)λ(τ), n→∞ n S i=0 J K J K and thus, by Lemma 20, TS is ergodic.  The effective version of the ergodic theorem that we will use in the proof of The- orem 24 requires us to introduce some additional notions. First, a function is a.e. 0 computable if it is computable on a Π2 set of Lebesgue measure 1. As noted above, 18 DOUGLAS CENZER AND CHRISTOPHER P. PORTER

0 TS is computable on D(S) , which is a Σ1 class of measure 1, and so it is a.e. computable. J K Next, a function F : 2ω → R is effective integrable (also L1-computable) if there is a computable sequence of rational step functions (sn)n∈ω such that F (X) = R −n limn→∞ sn(X) (whenever F (X)↓) and for all n ∈ ω, |sn − sn−1|dλ ≤ 2 ; see, e.g. [Rut20] or [Miy13]. We now can formulate the relevant effective version of Birkhoff’s ergodic theo- rem, due to G´acs,Hoyrup, and Rojas [GHR11] (as observed by Rute [Rut20], G´acs, Hoyrup, and Rojas prove a slightly different result, but the proof of their result establishes the following).

Theorem 27 (Effective Birkhoff’s Ergodic Theorem, version 2 [GHR11]). Let µ be a computable measure on 2ω and let T : 2ω → 2ω be an a.e. computable, µ-invariant, ergodic transformation. Then for any a.e. computable function F that is effectively integrable and any Schnorr random X ∈ 2ω, k−1 1 X Z lim F (T i(X)) = F dµ. k→∞ k i=0

Proof of Theorem 24. Let X ∈ 2ω be Schnorr random. We define F : 2ω → ω so that F (X) is the unique n such that Xn ∈ D(S); that is, F counts the number of input bits of a given sequence X needed to generate one bit of output using the DDG-tree S. Clearly F is also computable on D(S) and is thus a.e. computable. To see that f is effectively integrable,J K we define a sequence sn of rational step functions on 2ω as follows:  F (X) if (∃k ≤ n)F (X)↓ = k s (X) = . n n otherwise

Observe that sn+1(X) ≤ sn(X)+1, and sn(X) = sn+1(X) if and only if there is some k ≤ n such that Xk ∈ D(S). For n ∈ ω, let us set D(S)n = {σ ∈ D(S): |σ| ≤ n}. Z Z |sn − sn−1|dλ = sn − sn−1 dλ

ω   = 1 · λ 2 \ D(S)(n − 1) } + 0 · λ D(S)(n − 1) } ω J K J K = λ 2 \ D(S)(n − 1) } . J K ω  Since λ( D(S) ) = 1 and D(S) is a computable set, the sequence λ 2 \ D(S)n n∈ω is uniformlyJ computableK and converges to 0. Thus by choosing an appropriateJ sub-K sequence of the functions (sn)n∈ω, it follows that F is effectively integrable. RANDOMNESS EXTRACTION IN COMPUTABILITY THEORY 19

Next, observe that Z Z X X −i i F dλ = F dλ = i · 2 · {σ : σ ∈ D(S) ∩ 2 } σ i∈ω σ∈D(S) J K X = i · λ( D(S) ∩ 2i ) (2) i∈ω J K = AvgRT (S). ω Given a Schnorr random X ∈ 2 , if we repeatedly apply the tree-shift TS to X followed by the function F , we have k−1 k−1 X i X F (TS(X)) = n0 + [ni, ni+1) = nk (3) i=0 i=0 where (ni)i∈ω is the sequence determined by the S-blocks of X. Then it follows from (3) that k−1 1 X i nk lim F (TS(X)) = lim . (4) k→∞ k k→∞ k i=0 Thus, k−1 Z nk 1 X i lim = lim F (TS(X)) = F dλ = AvgRT (S), k→∞ k k→∞ k i=0 where the first equality is (4), the second equality follows from Theorem 27, and the third equality comes from (2). Lastly, we consider the values |φS(Xn)| n for n ∈ ω. Fix n ∈ ω, if (ni)i∈ω is the sequence determined by the S-blocks of X, then for the maximum value k such that nk ≤ n, |φ (X n)| k S  = . n n Then k |φ (X n)| k < S  ≤ . nk+1 n nk Since k k + 1 1 = − , nk+1 nk+1 nk+1 we have k + 1 1  |φ (X n)| k lim − < lim S  ≤ lim . k→∞ nk+1 nk+1 n→∞ n k→∞ nk 20 DOUGLAS CENZER AND CHRISTOPHER P. PORTER

It thus follows that |φS(Xn)| k 1 OIΦS (X) = lim = lim = . n→∞ n k→∞ nk AvgRT (S)  1 Corollary 28. Rate(Φ , λ) = . S AvgRT (S) |φ (σ)| Proof. We apply Lemma 16. First, we have S ≤ 1 for every σ ∈ 2<ω. By |σ| Theorem 24, |φS(Xn)| 1 lim = OIΦ (X) = n→∞ n S AvgRT (S) for every Schnorr random sequence. The conclusion immediately follows from Lemma 16. 

6. The Extraction Rate of the Levin-Kautz Conversion Procedure We now calculate the extraction rate of a general procedure due independently to Levin [LZ70], Kautz [Kau91], Schnorr and Fuchs in [SF77], and Knuth and Yao [KY76]. In addition, this procedure has been studied in the randomness extraction literature under the label of the interval algorithm (see, for instance, [HH97]) and is the main idea behind the data compression technique known as arithmetic coding (see [Say17, Chapter 4]). Following [BM12], we will refer to this procedure as the Levin-Kautz conversion procedure. Here we prioritize Levin and Kautz, as they both used this procedure to study the conversion of Martin-L¨ofrandom sequences with respect to one measure into Martin-L¨ofrandom sequences with respect to another measure. In particular, Levin and Kautz use the procedure to prove the following: Theorem 29 (Levin [LZ70], Kautz [Kau91]). For every computable µ, ν ∈ P(2ω), if X ∈ MLRµ and X is not computable (and in particular, µ({X}) = 0), then there is some Y ∈ MLRν such that X ≡T Y . We will give the basic idea of Levin-Kautz conversion procedure using the succinct approach due to Schnorr and Fuchs [SF77] in the context of converting biased ran- domness into unbiased randomness (i.e., randomness with respect to the Lebesgue measure). For computable µ ∈ P(2ω) and σ ∈ 2<ω, we define two subintervals of [0, 1]:  |σ| |σ|  X −i X −i −|σ| (σ)λ =  2 σ(i), 2 σ(i) + 2  i=1 i=1 RANDOMNESS EXTRACTION IN COMPUTABILITY THEORY 21 and   X X (σ)µ =  µ(τ), µ(τ)

τ

(here ≤lex defines the lexicographic ordering on strings of a fixed length). We define <ω a Turing functional Φµ→λ as follows: For σ, τ ∈ 2 , enumerate (σ, τ) into SΦµ→λ if (σ)µ ⊆ (τ)λ. Thus, given a µ-random sequence X as input, Φµ→λ treats X as the representation of some r ∈ [0, 1] the bit values of which are determined by the values of the measure µ. For instance, the first bit of r is a 0 if r < µ(0) and a 1 if r > µ(0) (and the procedure is undefined if r = µ(0)). Φµ→λ then outputs the standard binary generator of the real number r. One can verify that the resulting Turing functional ω Φµ→λ is µ-almost total and induces the Lebesgue measure on 2 . More generally, for computable measures µ, ν, one can similarly define an almost total functional Φµ→ν that transforms µ-randomness into ν-randomness. Moreover, one can verify that, for non-computable X ∈ MLRµ and Y ∈ MLRν such that Φµ→ν(X) = Y ,

(i)(Φ µ→ν ◦ Φν→µ)(X) = X, and (ii)(Φ ν→µ ◦ Φµ→ν)(Y ) = Y .

Thus, given such a pair X and Y , we clearly have X ≡T Y . We will consider this result in the context of strongly positive measures. A measure ω 1 <ω µ on 2 is strongly positive if there is some δ ∈ (0, 2 ) such that for every σ ∈ 2 , µ(σ0 | σ) ∈ [δ, 1 − δ]; that is, all of the conditional probabilities associated with µ are bounded away from 0 and 1 by a fixed distance. The main theorem we will prove in this section is an effective, pointwise version of a result due to Uyematsu and Kanaya [UK00], who studied the extraction rate of the interval algorithm with respect to a general class of measures, namely the ergodic, shift-invariant ergodic measures. Recall that for an ergodic, shift-invariant measure µ on 2ω, the entropy of µ is defined to be 1 X h(µ) = lim − µ(σ) log µ(σ). n→∞ n |σ|=n

Theorem 30. Let µ and ν be computable, shift-invariant, ergodic measures that are strongly positive. Then for every non-computable A ∈ MLRµ, h(µ) OI (A) = . Φµ→ν h(ν)

In particular, in the case that ν = λ, we have OIΦµ→λ (A) = h(µ). 22 DOUGLAS CENZER AND CHRISTOPHER P. PORTER

Several remarks are in order. First, by the Shannon source coding theorem [CT12, h(µ) Section 5.10], h(ν) is the optimal rate for converting between µ-randomness and ν- randomness. Second, Han and Hoshi [HH97] showed that in the case that µ and h(µ) ν are Bernoulli measures, Rate(Φµ→ν, µ) = h(ν) , but in the case that µ and ν are shift-invariant and ergodic, this is appears to be open (see [WH19, Remark 14]). As a first step towards proving Theorem 30, we define an auxiliary function. Given A ∈ MLRµ and B = Φµ→ν(A), let φµ→ν be the canonical generator of Φµ→ν and set

g(n) = max{k : φµ→ν(An)  Bk}. Equivalently, g(n) is the maximum value k such that (An)µ ⊆ (Bk)ν. It follows that the Φµ→ν-extraction rate of the computation Φµ→ν(A) = B is OIΦµ→ν (A) = g(n) lim supn→∞ n .

We now calculate OIΦµ→ν (A) for each A ∈ MLRµ. We will make use of two addi- tional results. First, we use the following lemma due to Kautz: Lemma 31 (Kautz [Kau97]). Suppose that µ and ν are computable and strongly 1 positive, and let δ ∈ (0, 2 ) satisfy the condition that µ(σ0 | σ), ν(σ0 | σ) ∈ [δ, 1 − δ] <ω ω for every σ ∈ 2 . Suppose further that for A, B ∈ 2 we have Φµ→ν(A) = B. (i) For every n ∈ ω, µ(An) ≤ ν(Bg(n)). (ii) There exists infinitely many n ∈ ω such that 2 δ · ν(Bg(n)) ≤ µ(An). Next, we use an effective version of the Shannon-McMillan-Breimann theorem due to Hoyrup [Hoy12]. Theorem 32 (Hoyrup [Hoy12]). Let µ be a computable, shift-invariant, ergodic mea- sure on 2ω. Then for every µ-Martin-L¨ofrandom sequence X ∈ 2ω, K(X n) − log µ(X n) lim  = lim  = h(µ). n→∞ n n→∞ n With these pieces, we now turn to the proof of our theorem.

Proof of Theorem 30. Let Φµ→ν(A) = B for A ∈ MLRµ. By Theorem 29, we have 1 B ∈ MLRν. Since µ and ν are strongly positive, choose δ ∈ (0, 2 ) such that µ(σ0 | σ), ν(σ0 | σ) ∈ [δ, 1 − δ] for every σ ∈ 2<ω. By part (i) of Lemma 31, we have µ(An) ≤ ν(Bg(n)) for all n ∈ ω. Applying the negative logarithm to both sides and dividing through by n yields − log ν(B g(n)) − log µ(A n)  ≤  n n RANDOMNESS EXTRACTION IN COMPUTABILITY THEORY 23 for all n ∈ ω. It thus follows that − log ν(B g(n)) − log µ(A n) lim sup  ≤ lim sup  (5) n→∞ n n→∞ n for all n ∈ ω. Next, by part (ii) of Lemma 31, we have 2 δ · ν(Bg(n)) ≤ µ(An) for infinitely many n ∈ ω. Again, applying the negative logarithm to both sides and dividing through by n yields, for some c ∈ ω − log µ(A n) − log ν(B g(n)) + c  ≤  . n n for infinitely n ∈ ω. It thus follows that − log µ(A n) − log ν(B g(n)) + c lim inf  ≤ lim sup  n→∞ n n→∞ n − log ν(B g(n)) c ≤ lim sup  + lim sup n→∞ n n→∞ n − log ν(B g(n)) = lim sup  . n→∞ n Combining this inequality with (5), we thus have − log µ(A n) − log ν(B g(n)) − log µ(A n) lim inf  ≤ lim sup  ≤ lim sup  . (6) n→∞ n n→∞ n n→∞ n

By Theorem 32, since A ∈ MLRµ, it follows from our assumptions on µ that − log µ(A n) − log µ(A n) − log µ(A n) lim inf  = lim sup  = lim  = h(µ). (7) n→∞ n n→∞ n n→∞ n Combining (6) and (7), we conclude − log ν(B g(n)) lim sup  = h(µ). (8) n→∞ n

Next, we use the fact that for positive sequences (an)n∈ω and (bn)n∈ω such that limn→∞ an exists,

lim sup(an · bn) = (lim sup an)(lim sup bn) n→∞ n→∞ n→∞ along with Equation (8) and the fact that − log ν(B g(n)) lim  = h(ν), n→∞ g(n) which follows from Theorem 32, to derive the following: 24 DOUGLAS CENZER AND CHRISTOPHER P. PORTER

− log ν(B g(n)) − log ν(B g(n)) g(n) h(µ) = lim sup  = lim sup  n→∞ n n→∞ g(n) n − log ν(B g(n)) g(n) = lim sup  lim sup n→∞ g(n) n→∞ n − log ν(B g(n)) g(n) = lim  lim sup n→∞ g(n) n→∞ n

= h(ν) · OIΦµ→ν (A). From this we can conclude that h(µ) OI (A) = . Φµ→ν h(ν) 

As noted above after the statement of Theorem 30, determining Rate(Φµ→ν, µ) appears to be an open question in the randomness extraction literature. Essentially, this problem boils down to finding a uniform bound of the sequence of functions |φ (X n)| given by µ→ν  to apply the dominated convergence theorem to calculate n Rate(Φµ→ν, µ). 7. Open questions We conclude with several open questions. First, there is a general question about generalizing the results from Sections4,5, and6 to apply to a broader class of Turing functionals: Question 33. What features of an almost total Turing functional Φ guarantee that

OIΦ(X) = Rate(Φ, µ) for the appropriate choice of measure µ and all sufficiently µ-random sequences X? Next, the results we have established in showing the level of randomness that is sufficient for a sequence to witness the extraction rate of a Turing functional do not tell us what level of randomness is necessary for this to hold. Thus we can ask: Question 34. For each of the classes of Turing functionals that we have discussed, what is the level of randomness necessary for a sequence to witness the associated extraction rate?

References [BBC+08] George Barmpalias, Katie Brodhead, Douglas Cenzer, Jeffrey B. Remmel, and Rebecca Weber. Algorithmic randomness of continuous functions. Arch. Math. Logic, 46(7-8):533– 546, 2008.9 RANDOMNESS EXTRACTION IN COMPUTABILITY THEORY 25

[BM12] Laurent Bienvenu and BenoˆıtMonin. Von Neumann’s biased coin revisited. In 2012 27th Annual IEEE Symposium on Logic in Computer Science, pages 145–154. IEEE, 2012. 20 [CP15] Douglas Cenzer and Christopher P. Porter. Algorithmically random functions and effec- tive capacities. In Theory and Methods of Computation (TAMC 2015), Lecture Notes in Computer Science 9076, pages 22–37. Springer Verlag, 2015.9 [CR18] Douglas Cenzer and Diego A. Rojas. Online computability and differentiation in the Cantor space. In Sailing routes in the world of computation, volume 10936 of Lecture Notes in Comput. Sci., pages 136–145. Springer, Cham, 2018.9 [CT12] Thomas M. Cover and Joy A. Thomas. Elements of information theory. John Wiley & Sons, 2012. 22 [DH10] Rodney G. Downey and Denis R. Hirschfeldt. Algorithmic randomness and complexity. Springer, 2010.4 [Dot08] David Doty. Dimension extractors and optimal decompression. Theory Comput. Syst., 43:425–463, 2008.2 [Eli72] Peter Elias. The efficient construction of an unbiased random sequence. Ann. Math. Statist., 43:865–870, 1972. 10 [FP20] Johanna N.Y. Franklin and Christopher P. Porter. Key developments in algorithmic randomness. In Johanna N.Y. Franklin and Christopher P. Porter, editors, Algorithmic Randomness: Progress and Prospects, volume 50 of Lecture Notes in Logic. Cambridge University Press, 2020.4 [FT14] Johanna N.Y. Franklin and Henry Towsner. Randomness and non-ergodic systems. Moscow Mathematical Journal, 14(4):711–744, 2014. 13 [GHR11] Peter G´acs,Mathieu Hoyrup, and Crist´obalRojas. Randomness on computable proba- bility spaces—a dynamical point of view. Theory of Systems, 48(3):465–485, 2011. 18 [HH97] Te Sun Han and Mamoru Hoshi. Interval algorithm for random number generation. IEEE Transactions on Information Theory, 43(2):599–611, 1997. 20, 22 [Hoy12] Mathieu Hoyrup. The dimension of ergodic random sequences. In 29th International Symposium on Theoretical Aspects of Computer Science, volume 14 of LIPIcs. Leibniz Int. Proc. Inform., pages 567–576. Schloss Dagstuhl. Leibniz-Zent. Inform., Wadern, 2012.3, 22 [Kau91] Steven M. Kautz. Degrees of random sets. ProQuest LLC, Ann Arbor, MI, 1991. Thesis (Ph.D.)–Cornell University.2, 20 [Kau97] Steven M. Kautz. Resource-bounded randomness and compressibility with respect to nonuniform measures. In Proceedings of the International Workshop on Randomization and Approximation Techniques in Computer Science, pages 197–211. Springer-Verlag, 1997. 22 [KY76] Donald E. Knuth and Andrew C. Yao. The complexity of nonuniform random num- ber generation. In Algorithms and complexity (Proc. Sympos., Carnegie-Mellon Univ., Pittsburgh, Pa., 1976), pages 357–428, 1976.2, 14, 16, 20 [LZ70] Leonid Levin and Alexander K. Zvonkin. The complexity of finite objects and the de- velopment of the concepts of information and randomness of means of the theory of algorithms. Uspekhi Mat. Nauk, 25:85–127, 1970.2, 20 [Miy13] Kenshi Miyabe. L1-computability, layerwise computability and Solovay reducibility. Computability, 2(1):15–29, 2013. 18 26 DOUGLAS CENZER AND CHRISTOPHER P. PORTER

[Nie09] Andr´eNies. Computability and randomness, volume 51 of Oxford Logic Guides. Oxford University Press, 2009.4 [Pae16] Sung-il Pae. Binarizations in random number generation. In 2016 IEEE International Symposium on Information Theory (ISIT), pages 2923–2927. IEEE, 2016. 11 [Per92] Yuval Peres. Iterating von neumann’s procedure for extracting random bits. Ann. Statist., 20:590–597, 1992.2,8, 11 [Rut20] Jason Rute. Algorithmic randomness and constructive/computable measure theory. In Johanna N.Y. Franklin and Christopher P. Porter, editors, Algorithmic Randomness: Progress and Prospects, volume 50 of Lecture Notes in Logic. Cambridge University Press, 2020. 18 [Say17] Khalid Sayood. Introduction to data compression. Morgan Kaufmann, 2017. 20 [SF77] Claus-Peter Schnorr and Hans-Peter Fuchs. General random sequences and learnable sequences. The Journal of Symbolic Logic, 42(3):329–340, 1977. 20 [Sil08] C´esarErnesto Silva. Invitation to ergodic theory, volume 42. American Mathematical Soc., 2008. 12 [SUV17] Alexander Shen, Vladimir A Uspensky, and Nikolay Vereshchagin. Kolmogorov com- plexity and algorithmic randomness, volume 220. American Mathematical Soc., 2017. 4 [Tos14] Ferit Toska. Strict process machine complexity. Arch. Math. Logic, 53:525–538, 2014.2 [UK00] Tomohiko Uyematsu and Fumio Kanaya. Almost sure convergence theorems of rate of coin tosses for random number generation by interval algorithm. In 2000 IEEE Interna- tional Symposium on Information Theory, page 457. IEEE, 2000. 21 [vN51] John von Neumann. Various techniques used in connection with random digits. Applied Math Series, pages 36–38, 1951.1 [WH19] Shun Watanabe and Te Sun Han. Interval algorithm for random number generation: Information spectrum approach. IEEE Transactions on Information Theory, 2019. 22