<<

44 NAW 5/19 nr. 1 maart 2018 An introduction to (algorithmic) Rutger Kuyper

Rutger Kuyper School of Mathematics and Victoria University of Wellington, New Zealand [email protected]

Research Stieltjes Prize 2015 An introduction to (algorithmic) randomness

In 2015 Rutger Kuyper has been awarded the Stieltjes Prize, which recognises the best The PhD in Mathematics in the Netherlands. The prize was awarded for his thesis entitled Com- Recall the law of large numbers from prob- putability, and Logic, which he completed at the Radboud University Nijmegen. ability theory: After receiving his PhD he became a research fellow at the Victoria University of Wellington. If we flip a coin infinitely many times, and In this article he describes his research at Victoria, which focuses on computability theory, we denote by h the number of times we with an emphasis on algorithmic randomness. n see heads amongst the firstn flips, then with probability 1, What does it for a sequence to be does not seem to be random any longer. random? You probably have an intuitive So, how do we actually get an exam- hn 1 lim n = 2 . idea of what a random sequence is, but ple of a random sequence? Something that n " 3 how do we formalise this in a mathe- we can write down easily follows a pattern Our standard example of a random se- matically rigorous way? To motivate what and is therefore not random by any rea- quence, x4, was obtained by flipping a coin comes next, let us look at the (initial digits sonable definition of randomness. The key like this. Thus, our sequence x4 will (proba- of) a few infinite sequences of zeroes and to obtaining a random sequence is using a bly) satisfy the following property: ones: probabilistic method to generate it. To ob- tain x , we flipped a coin, denoting heads Definition 1. Given an infinite sequence x = 00000000000000000000f 4 1 by 1 and tails by 0. With a coin flip having x of zeroes and ones, if we let #xnQ be x = 01010101010101010101f 2 an equal probability to land on heads or the number of ones amongst the first n x3 = 11001001000011111101f tails, there should not be any easy way of elements of the sequence, we say that x f x4 = 00100101110101011101 predicting what x4 is going to look like, in satisfies the law of large numbers if the sense that even if we know the first Take a break and consider for a moment: #xnQ 1 37 elements of the sequence, there is no lim = . which of these sequences would you con- n " 3 n 2 sider to be random sequences? way of knowing whether the 38th element is going to be a zero or a one. Thus, x More informally, x satisfies the law of Would you consider x1 to be random? 4 Probably not, since it only contains zeroes, should be considered random. large numbers if, when we look far enough no ones, and therefore does not look very So, we now have three examples of in the sequence, roughly half of the ele- sequences that should not be considered ments are zeroes, and roughly half of the random. What about x2? This time it has both zeroes and ones, but the sequence random, and one example of something elements are ones. Intuitively a random follows a very clear pattern and therefore that should be considered random. Again, sequence should not be biased towards again should not be considered to be a we would like to have a mathematical- zeroes or ones, so a random sequence ly rigorous definition of what exactly it should satisfy the law of large numbers. random sequence. On the other hand, x3 looks much more random, since there does to be random, and we now have We could therefore try to use this as a defi- not seem to be a clear pattern. However, three examples of sequences that should nition of randomness. if we were to write r in binary, we would fail this definition, and one example of Let us go back to our examples at the see that something that should pass it. We will use beginning. The non-random sequence x5 this as a starting point and try to build does not satisfy the law of large numbers, r = 11.001001000011111101f our mathematical definition from the which is a good sign. However, x2 does and if we compare this to x3, suddenly x3 ground up. satisfy it, while we decided this sequence Rutger Kuyper An introduction to (algorithmic) randomness NAW 5/19 nr. 1 maart 2018 45

should not be called random. Thus, we need a stronger definition.

Normal numbers Let us have another look at the sequence

x2 = 01010101010101010101f This sequence satisfies the law of large numbers, because the digits 0 and 1 both appear roughly half the time. Let us con- sider what happens if we consider blocks of two digits in x2. We see that x2 contains the blocks: 01,,,,,,,,10 01 10 01 10 01 10 01,f In other words, we never see the other two blocks of length 2: 00 and 11. Again, thinking about coin flips, if one flips a coin twice and records both the results, then the four possibilities (heads, heads), (tails, tails), (heads, tails) and (tails, heads) 1 all occur with probability 4 . Thus, in a ran- dom sequence we do not just want each digit to occur roughly half the time, but we also want each block of two digits to occur roughly one quarter of the time. Generalis- ing this to blocks of arbitrary length we get to the following definition.

Definition 2. Let x be an infinite sequence of zeroes and ones. We say that x is nor- mal (in base 2) if for every positive nat- ural number k, and every block b of k many zeroes or ones, if we let Nx(,bn,) be the number of times the block occurs b Rutger Kuyper in New Zealand amongst the firstn digits of x, then

Nx(,bn,) 1 There is a pattern in this sequence that sitions at which we know for sure the digit lim n = b . n " 3 2 might not be immediately obvious: we write is a one. In particular, if we were to restrict the natural numbers 0123,,,,f in binary, x to W, i.e. we throw away all the digits (The notion of normality — in arbitrary bas- 5 and form the sequence x by concate- at positions not in W, we get a sequence es — was introduced by Borel, when we 5 nating all these binary numbers together that only contains ones and therefore talk about normality we mean the special in order. The sequence x we obtain this no longer even satisfies the law of large case of normality in base 2.) 5 way is called Champernowne’s sequence. numbers. Because x does not satisfy the law of 1 This sequence is known to be normal, so Again, if we think about a sequence of large numbers it is certainly not normal, and would be random if we took normality as coin tosses, if we were, for example, to x is not normal either as argued above. 2 our definition of randomness. However, it ignore all the even coin tosses and only re- What about x ? Perhaps surprisingly, it is 3 does not seem very reasonable to consider cord the odd ones, the resulting sequence not known whether the sequence x , which 3 x to be random. After all, it was generated should still satisfy the law of large num- we obtained from the binary expansion of 5 using such an easy pattern and therefore it bers. Thus, we would like to say that a r, is normal, so we do not know wheth- is very easy to compute the digits of this sequence is random if every infinite sub- er this definition is able to determine the sequence. sequence, that is a sequence obtained by nonrandomness of x . On the other hand, 3 removing all but infinitely many digits, sat- the sequence x obtained by flipping coins 4 Church stochasticity isfies the law of large numbers. is (with probability 1) normal. Going back to Champernowne’s sequence Unfortunately, that is too strong a prop- Does this mean we are done? Let us x , why exactly is it non-random? We no- erty: such sequences do not exist. Indeed, consider the following sequence: 5 ticed that it is very easy to reconstruct the every infinite sequence contains either

x5 = 01110 110010111011110001001 pattern used to definex 5. In particular, it is infinitely many zeroes or infinitely many 101010111100f very easy to give an infinite setW of po- ones, so we can always find an infinite 46 NAW 5/19 nr. 1 maart 2018 An introduction to (algorithmic) randomness Rutger Kuyper

subsequence which only contains zeroes This notion, called Martin-Löf randomness, mathematically rigorous way? Of course or ones! How do we resolve this? was originally introduced by Martin-Löf as that is an informal statement that cannot Until now, we have been talking about an abstracting of the computable selection be formalised, let alone proven. However, randomness without talking about algo- functions defined above. One of the things the fact that we do not know of any coun- rithmic randomness, and this is the point that makes this definition so robust is that terexamples and have many equivalent at which the algorithmic part of the title there are many equivalent definitions of definitions of Martin-Löf randomness seem comes into play. In algorithmic random- it, of which we will here discuss the three to show that this is the definition we were ness, one uses tools from computability most important ones. looking for. theory to define and work with random- ness. To do so, one needs a rigorous defi- Measure-theoretic definition Definition using betting nition of what it means to be computa- First, let us introduce Martin-Löf random- This time, let us consider a fair casino, in ble, which was given by Turing. Instead of ness using measure theory, as originally which we are betting on the digits of a giving the rigorous definition here, think done by Martin-Löf. This definition requires fixed infinite sequence of zeroes and ones about a f : NN" as being com- more mathematical prerequisites than the x ! 2N, which is known by the casino but putable if there is a procedure such that alternatives down below, and the remain- not by us. Our goal is to make as much any capable human could, given enough der of this article can be understood with- money as possible. The rules of the casino paper and time, work out f(n) given any out understanding this section. are as follows. number n ! N. Equivalently, such a func- The standard topology on 2N is generat- –– We initially start with one unit of money. tion f is computable if it can be imple- ed by the basic open sets –– We then split all our money between mented using your favourite programming N betting on 0 or 1. language. v = {}xx!;2 extends v , !+ –– The first bit ofx is then revealed to us. Using the notion of a computable func- where v is any finite sequence of zeroes If this is a 0, the casino pays out twice tion, we can now restrict to certain nice, < N and ones (we denote this set by 2 ). our bet on 0. If it is 1, the casino pays easy subsequences, which are selected In other words, the open sets are the out twice our bet on 1. in a computable way using the technical ones that can be written as a union of –– We again split our (new) money be- notion of a computable selection function such basic open sets. Given any open set tween betting on 0 and 1. (we omit the exact definition). Now, we v U = 'v ! , we say that X is prefix-free –– The second bit of x is now revealed to say that a sequence is Church stochastic X ! + if for any two vx, ! X, v is not an exten- us. If this is a 0, the casino pays out if every subsequence selected by a com- sion of x. We may assume without loss of twice our bet on 0. If it is 1, the casino putable selection function satisfies the law generality that X is prefix-free. Then the pays out twice our bet on 1. of large numbers. It is known that every n -length()v measure ()U is /v ! X 2 . –– We keep playing for as long as we like. Church stochastic sequence is normal, so Intuitively, a random x should not be in this is a strengthening of our previous no- any ‘easy’ set of measure 0, and the col- If the sequence x has a clear pattern on tion of randomness. Champernowne’s se- lection of random x should have measure it, we would like to play in this casino, quence is not Church stochastic, but our 1. This motivates the following definition. because it would be very easy for us to sequence x4 obtained using coin flips is predict the next digit and make a lot of (with probability 1). 0 money this way. On the other hand, if Definition 3. A Gd (or P2) set is a set of So, does that mean that Church stochas- the sequence is truly random, for exam- the form VU= ( ! N n, where each Un ticity is the definition of randomness we n ple if the casino was just flipping a coin is open. We say that V is effectively Gd were looking for? Unfortunately not. Ville 0 to generate the digits of x, we have no (or P2) if there is a computable function showed that there is an infinite sequence f : NN# " 2< N such that way of predicting the outcome and would x6 which is Church stochastic, but for every therefore not expect to be able to make positive natural number n, if we look at the V = ( ' fn(,m) . large profits (unless we got really lucky). first n digits in the sequence, there are al- n ! N m ! N", This brings us to our second definition of ways more zeroes than ones (even though Martin-Löf randomness. 1 the ratio converges to 2 ). Again, thinking A Martin-Löf test is an effective Gd set N about what happens when you repeatedly V as above such that n(' ! N fn(,m) ) # 1 (Schnorr). A sequence x ! 2 m ", flip a coin, if you occasionally take a break 2-n. Finally, we say that x ! 2N is Martin-Löf is Martin-Löf random if and only if there when you get tired, sometimes you will random if x is not in any Martin-Löf test. is no semi-effective betting strategy which have seen more heads than tails up until How does this connect to the previous guarantees arbitrarily large profits when then, and sometimes you will have seen section? It turns out that every Martin-Löf betting on x if we keep playing as long more tails than heads. Thus, the sequence random x is Church stochastic. Further- as we want. x6 should not be considered random. more, Ville’s sequence x6 is not Martin-Löf random. While this is the easiest definition of Martin-Löf randomness Thus, we strengthened our notion of Martin-Löf randomness to explain, the fact We now take our last step towards our randomness, and got rid of our bad exam- that we need to talk about semi-effective- definition of randomness, finally arriving ple x6. Does this mean we have reached ness is perhaps not very satisfying. We will at a notion that is fit to be called random. our goal and defined randomness in a not go into the technical details here, but Rutger Kuyper An introduction to (algorithmic) randomness NAW 5/19 nr. 1 maart 2018 47

let us mention that if we restricted our- concepts of computability theory. A more are ‘small’. There is another way to talk selves to computable betting strategies we recent direction of study has been to con- about the smallness or largeness of sets, would get a notion of randomness called sider how randomness interacts with usu- using category. Recall that a set is mea- computable randomness, which is strictly al mathematical about ‘almost gre if it is contained in a countable un- weaker than Martin-Löf randomness but everywhere’ theorems. Consider, for exam- ion of closed nowhere dense sets. We interesting in its own right. ple, the following theorem of Lebesgue: would like to say that a set is ‘random’ if it is not in any effective closed nowhere Compression and randomness Theorem 3 (Lebesgue). Let f :[01,]" R be dense set, which is done in the following Finally, let us discuss how Martin-Löf ran- a function of bounded variation. Then f is definition. domness relates to compressibility. Consid- differentiable . N 0 er your favourite compression . Definition 4. A closed set V 3 2 is a P1 How good is it at compressing these two So far, we have been talking about -class if there is a computable function finite sequences? computable functions on the natural num- f : N " 2< N such that V = 2N \' fn(). n ! N " , bers, and randomness of infinite binary We say that x ! 2N is 1-generic if for every 01010101010101010101 0 sequences. There is a natural and robust P1-class V we have that xVz \Int()V . 00100101110101011101 way to extend and adapt these concepts The first one is easy to compress: it can to real numbers. So, we can talk about Thus, 1-genericity is another way of be described by saying that 01 should be computable functions f of bounded vari- talking about ‘random’ points, but using repeated ten times. The second sequence ation, and Martin-Löf random elements of category instead of measure. Many theo- on the other hand, again obtained by flip- the unit interval. If a theorem holds at al- rems about Martin-Löf random reals have ping a coin, does not have a clear pattern most every point, that should be a strong analogues in terms of 1-generics, although and hence can only be described by giv- indication that it holds for a random point. this is not always the case. ing the full sequence. In other words, if Furthermore, if we are lucky the converse It is easy to adapt this definition to the one looks at any initial segment of a ran- might even hold and therefore give us an real numbers, and hence we can talk about dom sequence, one should be unable to equivalent definition of Martin-Löf random- generic elements of [,01] as well. Just as compress that segment, or in other words ness. This is, in fact, true for the theorem in the previous section, we wonder how should be unable to give a short descrip- just given. this notion interacts with category almost tion of it. And indeed, this gives us another everywhere theorems. In fact, there is a characterisation of Martin-Löf randomness. Theorem 4 (Brattka, Miller and Nies [2]). nice analogue of the differentiability char- Let x ! [,01]. The following are equivalent: acterisation of Martin-Löf randomness giv- Theorem 2 (Schnorr). A sequence x is Mar- 1. x is Martin-Löf random. en above, obtained by studying a theorem tin-Löf random if and only if its initial seg- 2. Every computable f :[01,]" R of bound- of Bruckner and Leonard. ments cannot be nontrivially compressed ed variation is differentiable at x. by a (partial) computable compression Theorem 5 (Kuyper and Terwijn [4]). Let algorithm. Another interesting direction is to look x ! [,01]. The following are equivalent: at Brownian motion. It turns out that Mar- 1. x is 1-generic. (For technical reasons, one needs to restrict tin-Löf randomness is also the right notion 2. Every differentiable computable func- to prefix-free compression , but to talk about many theorems tion f :[01,]" R has continuous deriv- we will not go into further details here.) about Brownian motion, as studied by Al- ative at x. len, Bienvenu and Slaman [1]. Applications of randomness Further reading Now that we know what randomness means A different approach: Baire category The standard reference works on algorith- mathematically, what can we do with this? As we saw above, one way of defining mic randomness are Downey and Hirsch­ In the field of algorithmic randomness, one Martin-Löf randomness is by using ef- feldt [3] and Nies [5]. There is also the excel- way of studying randomness is to consider fective measure 0 sets. Sets which have lent nontechnical (and significantly shorter) how it interacts with the usual tools and measure 0 can be seen as sets which account by Terwijn [6]. s

References 1 K. Allen, L. Bienvenu and T. Slaman, On ze- 3 R. G. Downey and D. R. Hirschfeldt, Algorith- 6 S. A. Terwijn, The Mathematical Foundations ros of Martin-Löf random Brownian motion, mic Randomness and Complexity, Springer, of Randomness, The Challenge of Chance, Journal of Logic and Analysis 6(9) (2014), 2010. N. P. Landsman and E. van Wolde, eds., 1–34. 4 R. Kuyper and S. A. Terwijn, Effective gener- Springer, 2016, pp. 49–66. 2 R. Brattka, J. S. Miller and A. Nies, Random- icity and differentiability, Journal of Logic ness and differentiability, Transactions of and Analysis 6(4) (2014), 1–14. the American Mathematical Society 368(1) 5 A. Nies, Computability and Randomness, (2016), 581–605. Oxford University Press, 2008.