The probability distribution as a computational resource for randomness testing

When testing a set of data for randomness according to a probability distribution that depends on a parameter, access to this parameter can be considered as a computational resource. We call a randomness test Hippocratic if it is not permitted to access this resource. In these terms, we show that for Bernoulli measures $\mu_p$, $0\le p\le 1$ and the Martin-L\"of randomness model, Hippocratic randomness of a set of data is the same as ordinary randomness. The main idea of the proof is to first show that from Hippocrates-random data one can Turing compute the parameter $p$. However, we show that there is no single Hippocratic randomness test such that passing the test implies computing $p$, and in particular there is no universal Hippocratic randomness test.


Introduction
The fundamental idea of statistics is that by repeated experiment we can learn the underlying distribution of the phenomenon under investigation.In this paper we partially quantify the amount of randomness required to carry out this idea.We first show that ordinary Martin-Löf randomness with respect to the distribution is sufficient.Somewhat surprisingly, however, the picture is more complicated when we consider a weaker form of randomness where the tests are effective, rather than merely effective relative to the distribution.We show that such Hippocratic randomness actually coincides with ordinary randomness in that the same outcomes are random for each notion, but the corresponding test concepts do not coincide: while there is a universal test for ordinary ML-randomness, there is none for Hippocratic ML-randomness.
For concreteness we will focus on the classical Bernoulli experiment, although as the statistical tools we need are limited to Chebyshev's inequality and the strong law of large numbers, our result works also in the general situation of repeated experiments in statistics, where an arbitrary sequence of independent and identically distributed random variables is studied.
When using randomness as a computational resource, the most convenient underlying probability distribution may be that of a fair coin.In many cases, fairness of the proverbial coin may be only approximate.Imagine that an available resource generates randomness with respect to a distribution for which the probability of heads is p = 1/2.
It is natural to assume that p is not a computable number if the coin flips are generated with contributions from a physical process such as the flipping of an actual coin.The non-computability of p matters strongly if an infinite sequence of coin flips is to be performed.In that case, the gold standard of algorithmic randomness is Martin-Löf randomness, which essentially guarantees that no algorithm (using arbitrary resources of time and space) can detect any regularities in the sequence.If p is non-computable, it is possible that p may itself be a valuable resource, and so the question arises whether a "truly random" sequence should look random even to an adversary equipped with the distribution as a resource.In this article we will show that the question is to some extent moot, as these types of randomness coincide.On the other hand, while there is a universal test for randomness in one case, in the other there is not.This article can be seen as a follow-up to Martin-Löf's paper where he introduced his notion of algorithmic randomness and proved results for Bernoulli measures [3].
It might seem that when testing for randomness, it is essential to have access to the distribution we are testing randomness for.On the other hand, perhaps if the results of the experiment are truly random we should be able to use them to discover the distribution for ourselves, and then once we know the distribution, test the results for randomness.However, if the original results are not really random, we may "discover" the wrong distribution.We show that there are tests that can be effectively applied, such that if the results are random then the distribution can be discovered, and the results will then turn out to be random even to someone who knows the distribution.While these tests can individually be effectively applied, they cannot be effectively enumerated as a family.On the other hand, there is a single such test (due to Martin-Löf) that will reveal whether the results are random for some (Bernoulli) distribution, and another (introduced in this paper) that if so will reveal that distribution.
In other words, one can effectively determine whether randomness for some distribution obtains, and if so determine that distribution.There is no need to know the distribution ahead of time to test for randomness with respect to an unknown distribution.If we suspect that a sequence is random with respect to a measure given by the value of a parameter (in an effective family of measures), there is no need to know the value of that parameter, as we can first use Martin-Löf's idea to test for randomness with respect to some value of the parameter, and then use the fundamental idea of statistics to find that parameter.Further effective tests can be applied to compare that parameter q with rational numbers near our target parameter p, leading to the conclusion that if all effective tests for randomness with respect to parameter p are passed, then all tests having access to p as a resource will also be passed.But we need the distribution to know which effective tests to apply.Thus we show that randomness testing with respect to a target distribution p can be done by two agents each having limited knowledge: agent 1 has access to the distribution p, and agent 2 has access to the data X.Agent 1 tells agent 2 which tests to apply to X.
The more specific point is that the information about the distribution p required for randomness testing can be encoded in a set of effective randomness tests; and the encoding is intrinsic in the sense that the ordering of the tests does not matter, and further tests may be added: passing any collection of tests that include these is enough to guarantee randomness.From a syntactic point of view, whereas randomness with respect to p is naturally a Σ 0 2 (p) class, our results show that it is actually an intersection of Σ 0 2 classes.
, where 2 −n may be replaced by any computable function that goes to zero effectively.
A µ p -ML-randomness test is Hippocratic if there is a To explain the terminology: Andrzej Szczeklik, in "Catharsis: on the art of medicine" ( [7], page 18) writes On his native island of Kos, only about three hundred kilometers from Delphi, Hippocrates did not consult the oracle to seek out the harbingers of fate, but looked at his patient's features instead.
In the definition of Hippocratic randomness, like the ancient medic Hippocrates we are not consulting the oracle of Delphi (i.e., an oracle for the real number p) but rather looking for "natural causes".This level of randomness recently arose in the study of randomness extraction from subsets of random sets [1].
We will often write µ p -random instead of µ p -ML-random, as we work in the Martin-Löf mode of randomness throughout, except when discussing a conjecture at the end of this paper.

Chebyshev's inequality
We develop this basic inequality from scratch here, in order to emphasize how generally it holds.For an event A in a probability space, we let 1 A , the indicator function of A, equal 1 if A occurs, and 0 otherwise.The expectation of a discrete random variable X is where the sum is over all outcomes in the sample space.Thus E(X) is the average value of X over repeated experiments.It is immediate that Next we observe that the random variable that is equal to a when a nonnegative random variable X satisfies X a and 0 otherwise, is always dominated by X.That is, Therefore, taking expectations of both sides, In particular, for any random variable X with E(X) = ξ ∈ R we have Let σ 2 denote variance: If we let k ∈ ω and replace a by kσ, then This is Chebyshev's inequality, which in words says that the probability that we exceed the mean ξ by k many standard deviations σ is rather small.

Results for ordinary randomness
We first prove a version of the phenomenon that for samples of sufficiently fast growing size, the sample averages almost surely converge quickly to the mean.
Let N(b) = 2 3b−1 and let The idea of the proof is to use Chebyshev's inequality and the fact that the variance of a Bernoulli(p) random variable is bounded (in fact, bounded by 1/4).
Proof.The fact that U p d is Σ 0 1 (p) is immediate, so we prove the bound on its µ pmeasure.We have where σ 2 = p(1 − p) 1/4 is the variance of Y 0 and σ 2 (Y n ) denotes the variance of Y n .Thus σ 1/2, and Let b be defined by 2 n by taking n large enough as a function of b:

Brief review of computability-theory
More details can be found in standard textbooks such as Nies [4] and Soare [6] but we provide some information here.Uppercase Greek letters such as Φ will be used for Turing functionals, which are partial functions B → Φ B from 2 ω to 2 ω computed by oracle Turing machines.We write A = Φ B if A ∈ 2 ω is computed from the oracle B ∈ 2 ω using the Turing functional Φ.Then A(n) = Φ B (n) is the n th bit of A. An oracle Turing machine may, or may not, halt with oracle B on an input n; this is written Φ B (n) ↓, and Φ B (n) ↑, respectively.The Turing jump A ′ is the halting set (the set of solutions to the halting problem) for oracle machines with A on the oracle tape.In terms of Turing reducibility T , the relativized halting problem remains undecidable in the sense that A ′ T A (in fact A < T A ′ ).The Turing jump is not injective, even on Turing degrees (equivalence classes of the intersection ≡ T of the relations T and T ).Indeed, there are noncomputable sets A (so C < T A for computable sets C) such that A ′ ≡ T C ′ .It is customary to pick the computable set ∅ for the notation here and simply write A ′ T ∅ ′ .Such sets A are called low.
The low basis theorem of Jockusch and Soare asserts that each nonempty Π 0 1 class (meaning, subset of 2 ω that is Π 0 1 definable in arithmetic) has a low element.There is similarly a hyperimmune-free basis theorem which asserts that each nonempty Π 0 1 class contains an element A such that each function f ∈ ω ω computable from A is dominated by some computable function in ω ω .
These basis theorems cannot be combined, as on the one hand each low hyperimmunefree set is computable, and on the other hand there are Π 0 1 classes without computable elements (such as the set of all completions of Peano Arithmetic, or the set complement of a component U n of a Martin-Löf randomness test).These facts will be used in Theorem 5.4.
We are now ready for a result which in a sense sums up the essence of statistics.Proof.We may assume p is not computable, else there is nothing to prove; in particular we may assume p is not a dyadic rational.
Then for all b d, we have where If the real number p is represented as a member of 2 ω via in binary notation, then we have to define a Turing functional where as usual 1 k denotes a string of k ones.Since p is not a dyadic rational, such a b exists.Then by (1) it must be that the bits y 0 • • • y n are the first n + 1 bits of p.In particular, y n = p n .So we let Ψ Y d (n) = y n .

Hippocratic results
In the last section we made it too easy for ourselves; now we will obtain the same results assuming only Hippocratic randomness.

Theorem 5.1.
There is a Hippocratic µ p -test such that if Y passes this test then Y computes an accumulation point q of the sequence of sample averages Proof.The point is that the usual proof that each convergent sequence is Cauchy gives a Σ 0 1 class that has small µ p -measure for all p simultaneously.Namely, let if we define Θ d as Ψ d in the proof of Theorem 4.2 except with N(•) replaced by N(• + 1), then q n = Θ Y d (n), and so Y computes q using the Turing reduction Θ d .
To argue that the accumulation point q of Theorem 5.1 is actually equal to p under the weak assumption of Hippocratic randomness, we need:

An analysis of the strong law of large numbers.
We say that the strong law of large numbers (SLLN) is satisfied by X ∈ 2 ω for the parameter p ∈ [0, 1] if lim n→∞ X n /n = p.The strong law of large numbers is then the statement that the set of those X that do not satisfy the SLLN for p has µ p -measure zero.
Let {X n } n∈ω be independent and identically distributed random variables with mean 0, and let S n = n i=0 X i .Then S 4 n will be a linear combination (with binomial coefficients as coefficients) of the terms Since E(X i ) = 0, and E(X a i X b j ) = E(X a i )E(X b j ) by independence, and each X i is identically distributed with X 1 and X 2 , we get surely, so (as in the proof of Chebyshev's inequality) Proof.Let q 1 , q 2 be rational numbers with q 1 < p < q 2 .Let W N := {Y : ∃n N Y n q 1 } ∪ {Y : ∃n N Y n q 2 }.
Then {W N } N∈ω is uniformly Σ 0 1 , and µ p (W N ) → 0 effectively: Thus if Y is Hippocrates µ p -random then Y ∈ ∩ n W n , i.e., Y n is eventually always in the interval (q 1 , q 2 ).Proof.By Theorem 5.1, Y computes the limit of a subsequence {Y N(b) } b∈ω .By Theorem 5.2, this limit must be p.
Note that the randomness test in the proof of Theorem 5.2 depends on the pair (q 1 , q 2 ), so we actually needed infinitely many tests to guarantee that Y computes p.This is no coincidence.Let Y T p abbreviate the statement that Y Turing computes p, i.e., p is Turing reducible to Y.

Proposition 4 . 1 .
Consider a sequence Y = {Y n } n∈ω of independent Bernoulli(p) random variables, with the sample average

Theorem 4 . 2 .
If Y is µ p -ML-random then Y Turing computes p.

V
d := {Y : ∃a, b d |Y N(a) − Y N(b) | 2 −a + 2 −b }, where N(b) = 2 3b−1 .Then {V d } d∈ω is uniformly Σ 0 1 .Recall from Proposition 4.1 that we defined U p d = {Y : ∃b d |Y N(b) − p| 2 −b }.If there is a p such that |Y N(b) − p| < 2 −b for all b d, then |Y N(a) − Y N(b) | |Y N(a) − p| + |p − Y N(b) | < 2 −a + 2 −b for all a, b d; thus we have V d ⊆ ∩ p U p d and therefore µ p (V d ) µ p (U p d ) 2 −d for all p.Thus if Y is Hippocrates µ p -random then Y ∈ V d for some d.We next note that for any numbers c > b, |Y N(b) − Y N(c) | < 2 −b + 2 −c < 2 −(b−1) , so {Y N(c) } c d will remain within 2 −(b−1) of Y N(b) for all c > b.Thus {Y N(n) } n d is a Cauchy sequence and q

a 4 •Theorem 5 . 2 .
P(S 4 n /n 4 a 4 ), givingP(X n = S n /n a) 3K n 2 a 4 .We now apply this to X n = Y n − E(Y n ) = Y n − p (so that K p := K depends on p).Note that (writing p = 1 − p) K p = E[(Y 1 − p) 4 ] = p 4 • p + p 4 • p = pp(p 3 + p 3 ) ∃n N |Y n − p|a) is bounded by to obtain our desired result: If Y is Hippocrates µ p -random then Y satisfies the strong law of large numbers for p.

Corollary 5 . 3 .
If Y is Hippocrates µ p -random then Y Turing computes p.