When I was thinking about various types of pseudo-randomness, the following question struck me:
Suppose that a sequence $a_n \in \{0,1\}$ is given. Is there a way to check if it is genuinely random?
More concretely, suppose that we know in advance that $a_n$ are either:
- all chosen at random, according to the same distribution, and indenpendently, or
- produced by some, unknown, algorithm (i.e. there exists a deterministic Turing machine which, given $n$ as input produces $a_n$ on output.)
Assume additionally that the distribution is not too close to degenerate (say, $.001 < Pr(a_n = 1) <.999$).
Does there exist an algorithm which gets the (infinite) sequence $a_n$ on input (i.e. is given access to a ``black box'' which produces $a_n$ given $n$) such that:
- if the sequence $a_n$ is random, then the algorithm keeps going indefinitely with probability $>1 - \varepsilon$,
- if the sequence is deterministic, the algorithm outputs YES in finite time, always.
Note that the restriction that the distribution is not too degenerate is necessary, else in 2. we don't know when to output YES for the constant sequence $0,0,0\dots$. Also, obviously, in 2. there is no hope of determining the Turing machine which produces $a_n$. The question only makes sense if the sequence $a_n$ is infinite, else every sequence is deterministic (as pointed out in the comments).
There is a related question, but it asks for practical test. What I am interested in is what the situation is ``in principle''. It seems to me that such algorithm should exist, but I am wondering if I am missing something.