10.1.1.46.2518 - Automaticity IV: Sequences, Sets, and...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Automaticity IV: Sequences, Sets, and Diversity Je rey Shallit Department of Computer Science University of Waterloo Waterloo, Ontario, Canada N2L 3G1 shallit@graceland.uwaterloo.ca June 9, 1996 This paper studies the descriptional complexity of (i) sequences over a nite alphabet; and (ii) subsets of N (the natural numbers). If (s(i))i 0 is a sequence over a nite alphabet , then we de ne the k-automaticity of s, Ak (n), to be the smallest possible number of states in any deterministic nite s automaton that, for all i with 0 i n, takes i expressed in base-k as input and computes s(i). We give examples of sequences that have high automaticity in all bases k; for example, we show that the characteristic sequence of the primes has kautomaticity Ak (n) = (n1=43) for all k 2, thus making quantitative the classical s theorem of Minsky and Papert that the set of primes expressed in base-2 is not regular. We give examples of sequences with low automaticity in all bases k, and low automaticity in some bases and high in others. We also obtain bounds on the automaticity of certain sequences that are xed points of homomorphisms, such as the Fibonacci and Thue-Morse in nite words. Finally, we de ne a related concept called diversity and give examples of sequences with high diversity. Abstract 1 Introduction and De nitions In this paper, I study the descriptional complexity of (i) sequences over a nite alphabet; and (ii) subsets of N (the natural numbers). In 1972, Cobham 5] introduced the notion of what is now called a k-automatic sequence. (In the literature, one can also nd the terms k-recognizable sequence and uniform tag sequence.) Roughly speaking, a sequence (s(i))i 0 over a nite alphabet is k-automatic if and only if s(i) is a nite-state function of the base-k representation of i. However, most sequences are not k-automatic for any k. Instead of simply saying that a sequence is not k-automatic, we can measure quantitatively how \close" a sequence is to Research supported in part by a grant from NSERC. 1 being k-automatic using the concept of automaticity studied in previous papers of the author and co-authors 26, 27, 20, 10]. In addition to its evident intrinsic interest, automaticity has proved useful in obtaining nontrivial lower bounds in computational complexity theory; see 7, 8, 16, 17]. More formally, de ne a deterministic nite automaton with output (DFAO) M to be a 6-tuple, (Q; ; ; q0; ; ), where Q is a nite set of states, is a nite input alphabet, q0 is the start state, and is a nite output alphabet. The map : Q ! Q is called the transition function, and is extended in the obvious way to a map : Q ! Q. The map : Q ! is the output function. On input w 2 , the machine M outputs the single symbol ( (q0; w)). For more on these concepts, see, for example, 15]. Let k be an integer 2 and de ne k = f0; 1; : : : ; k ? 1g. If w 2 k , then by w]k I mean w evaluated as a base-k integer, that is, if w = w1w2 wr , then w]k = P1 i r wr?i+1ki?1. If n 0 is an integer, then by (n)k I mean the default base-k representation of n | that is, one not containing leading zeroes. Note that (0)k = , the empty string. Suppose (s(i))i 0 is a sequence over the nite alphabet . If there exists a DFAO M such that for all i 0, we have s(i) = ( (q0; wR)) for all w 2 k such that w]k = i, then the sequence (s(i))i 0 is said to be k-automatic. (Here wR is the reverse of the string w.) Note that the slightly awkward de nition results from the problem of \leading zeroes" input, and our convention that the machine M reads the input number starting with the least signi cant digit. Here is one alternate de nition of k-automatic sequences. De ne the k- ber of the sequence (s(i))i 0 at a to be Fk (s; a) = f(n)k : s(n) = ag: Then Fk (s; a) is a regular set for all a 2 if and only if the sequence (s(i))i 0 is k-automatic. Another alternate de nition of k-automatic sequences can be given in terms of a set called the k-kernel. Let (s(n))n 0 be a sequence over a nite alphabet. The k-kernel of (s(n))n 0, which we denote by Ksk , is de ned as follows: Ksk = f(s(kim + a))m 0 : i 0; 0 a < kig: (1) Eilenberg 9, Proposition 3.3, p. 107] proved that a sequence is k-automatic if and only if its k-kernel is nite. Given a sequence (s(i))i 0, we can de ne its k-automaticity Ak (n) as follows: Ak (n) is s s the smallest possible number of states in any DFAO M = (Q; ; ; q0; ; ) such that for all i with 0 i n, we have s(i) = ( (q0; wR)) for all w 2 k with w]k = i. We emphasize that the automaton is fed with the digits of i, starting with the least signi cant digit. This convention is actually important to specify, since it is known that there are languages of low automaticity whose reversal has high automaticity; see 10]. There is another way to de ne k-automaticity. Suppose we de ne the n-truncated kkernel of the sequence s, as follows: Ksk (n) = f(s(kim + a))0 m (n?a)=ki : i 0; 0 a < ki g: The n-truncated k-kernel consists of nite sequences. Call two such sequences v; w 2 Ksk (n) n-dissimilar if there exists a position j for which both v(j ) and w(j ) are de ned and v(j ) 6= 2 w(j ). (Note that under this de nition, if v is a pre x of w, then v and w are similar.) Then Ak (n) is de ned to be the maximum number of pairwise n-dissimilar sequences in Ksk (n). It s is not hard to see that this de nition is identical to the previous one; see 27]. Note that the condition m (n ? a)=ki is equivalent to kim + a n; in other words, the variable that is bounded by n is not m but the \true" variable kim + a. The following basic results on automaticity are easy to prove 27]: Proposition 1 Let (s(i))i be a sequence over a nite alphabet . Then (a) Ak (n) Ak (n + 1) for all n 0; s s (b) Ak (n) = O(1) if and only if s is k-automatic; s (c) There exists an absolute constant c such that if s is not k-automatic, then Ak (n) s c logk n for in nitely many n. (d) For any sequence s we have Ak (n) = O(n= log k n). s 0 As parts (b) and (c) of this theorem show, if a sequence is not k-automatic, then its kautomaticity must be greater than c logk n in nitely often. This suggests studying sequences that are not k-automatic, but which are \as close as possible" to k-automatic. We say that a sequence (s(i))i 0 is k-quasiautomatic if Ak (n) = O(log n). We then have the following s theorem, whose proof is easy and is omitted: Proposition 2 A sequence (s(i))i 0 is k-quasiautomatic if and only if it is ke -quasiautomatic for all e 1. So far we have discussed the k-automaticity of sequences, but the same terminology can be used for sets of non-negative integers. We say a set S N is k-automatic if its characteristic sequence ( S (n))n 0 is k-automatic. Similarly, if S is a set, then by Ak (n) we S mean Ak S (n). 2 Classical sets with high automaticity in all bases In this section, we examine two classical sets (the primes, the squarefree numbers) and show that their characteristic sequences have high k-automaticity (that is, (n ) for some > 0) in all bases k 2. (By f = (g) we mean there exist positive constants c; n0 such that f (n) cg(n) for all n n0.) For the primes, our results can be viewed as making quantitative the classical result of Minsky and Papert 19] that the primes expressed in base 2 cannot be accepted by a nite automaton. Our method is based on the following useful lemma: Lemma 3 Let (s(i))i 0 be a sequence over a nite alphabet , and suppose that there exists a constant d such that for all r; a; b with r 2, 1 a; b < r, a 6= b, and gcd(r; a) = gcd(r; b) = 1, there exists a non-negative integer m = O(rd ) such that s(rm + a) 6= s(rm + b). Then Ak (n) = (n1=(d+1)=(k log log n)) for all k 2, where the implied constant in the big- does s not depend on k. 3 Proof. Since m = O(rd ), there exists a constant c such that m crd ? 1 for all r 2. Let i = b(logk n ? logk c)=(d + 1)c. Then 1 n 1=(d+1) < ki n 1=(d+1): kc c Put r = ki. It follows that there exists m ckid ? 1 such that s(kim + a) 6= s(kim + b). However, kim + a < (ckid ? 1)ki + ki = cki(d+1) c (n=c) = n, and the same bound holds for kim + b. It follows that the two subsequences (s(kit + a))t 0 and (s(kit + b))t 0 are n-dissimilar. Since a; b were arbitrary integers relatively prime to r, we know that there are at least '(ki) pairwise n-dissimilar sequences, where ' is Euler's phi-function. By 21, Theorem 15], we know that '(n) n=(5 log log n) for n 3. Hence '(ki) ki 5 log log ki (1=k)(n=c) = d : 5 log log(n=c) = d 1 ( +1) 1 ( +1) Thus Ak(n) = (n1=(d+1)=(k log log n)). s We rst examine the automaticity of the characteristic sequence of the primes. We need the following lemmas. 2 3 Lemma 4 For all x 1 we have Qx<p x p > ex= , where the product is over primes only. Proof. Let #(x) = Pp x log p, where the sum is over primes only. We know that #(x) < 1:000081x for x > 0 22, p. 360], and #(x) :84x for x 101 21, Theorem 10]. It follows that Px<p 2x log p > 1:68x ? 1:000081x > x=3 for x 101=2. Now it is easily veri ed by computer or hand Q calculation that Px<p 2x log p > x=3 for 1 x < 101=2. It follows that x<p 2x p > ex=3 for all x 1. 11 2 Lemma 5 Given integers k; l 1 with gcd(k; l) = 1, there exists a prime p = km + l with m = O(max(k; l) = Proof. Choose x = max(1; l=k; 3 log l). Then from the previous lemma we have Qx<p x p > l, so there exists a prime q=l with x < q 2x. Now q > l=k, so kq > l, and gcd(kq; l) = j 2 ). The constant in the big-O is independent of k and l. 1. Hence by Heath-Brown's version of Linnik's theorem 14], there exists a prime p l (mod kq) with p = O((kq)11=2). Since q 2x = 2 max(1; l=k; 3 log l), we have p = O(max(l11=2; (k log l)11=2; k11=2)). Hence m = (p?l)=k = O(max(l11=2k?1 ; k9=2(log l)11=2); k9=2), and the result follows. 165 4 Lemma 6 Given integers r; a; b with r 2, gcd(r; a) = gcd(r; b) = 1, 1 a; b < r, and a = b, there exists m = O(r = ) such that rm + a is prime and rm + b is composite. 6 4 Proof. We use a trick suggested by papers of Hartmanis and Shank 12] and Allen 1]. By Heath-Brown's version of Linnik's theorem 14], there exists m0 = O(r9=2) such that p = rm0 + a is a prime. De ne q = rm0 + b. Then q = O(r11=2). If q is composite, we're done, and m0 = O(r9=2). Otherwise, assume q is prime. Now, in Lemma 5, take k = qr and l = qr + p. Then there exists m1 = O((qr + p)11=2) = O(r143=4) such that (qr)m1 + (qr + p) is prime. However, t = (qr)m1 + (qr + q) is composite, since q j t and q < t. Take m = qm1 + q + m0. Then m = O(r165=4). 1 43 integers k 2. Proof. Combine Lemmas 3 and 6. We note that the constant 1=43 in Theorem 7 is not optimal. Indeed, the constant 11=2 in Lemma 5 is almost certainly not optimal. Wagsta 31] has provided a heuristic model that predicts that the least prime congruent to l (mod k) is O('(k)(log k)(log '(k))). If this prediction were true, it would improve the constant 1=43 in Theorem 7 to 1=(2 + ). We now turn to providing a lower bound on the k-automaticity of the squarefree numbers. Recall that a number n is said to be squarefree if t2=n for all integers t > 1. j Lemma 8 Let (si)i 0 be de ned as follows: si = 1;; if i is squarefree; 0 otherwise. Then for all > 0, and r; a; b such that r 2, 1 a < r, and 0 b < r with gcd(a; r) squarefree and a 6= b, there exists an m = O(r13=9+ ) such that rm + a is squarefree and rm + b is not squarefree. Proof. Let q be the least prime not dividing rjb ? aj. Since rjb ? aj < r2, by the prime number theorem we have q = O(log r2) = O(log r). Now rk + b 0 (mod q2) if and only if k = ?br?1 (mod q2). Let c be such that 0 c < q2 and c ?br?1 (mod q2). Consider the arithmetic progression ((rq2)m + (rc + a))m 0: We have gcd(rq2; rc + a) is squarefree, because any prime divisor of rq2 and rc + a must be a divisor of r or q2. But t j r and t j rc + a implies t j a, and we know gcd(r; a) is squarefree by hypothesis. On the other hand, rc + a 0 (mod q) implies that rc ?a (mod q). But rc ?b (mod q), so a b (mod q), a contradiction since q=a ? b. Hence q2= gcd(rq2; rc + a). j j 13=9+ Then, by a result of Heath-Brown 13], there exists an m0 = O(r ) such that (rq2)m0 + (rc + a) is squarefree. Take m = q2m0 + c. Then rm + a is squarefree, but rm + b is divisible by q2. Theorem 7 The set P of prime numbers has k-automaticity Ak (n) = (n = ) for all P k 2. Theorem 9 The set S of squarefree numbers has k-automaticity Ak (n) = (n = ) for all S 25 Proof. Apply Lemma 3 with d = 13=9 + . Again, the constant 2=5 in Theorem 9 is not optimal. 5 3 A set with low automaticity in all bases Theorem 10 De ne a(1) = 1, and a(i + 1) = a(i) + Q b i b b b a i c for i 1. Then the set A = fa(i) : i 1g is not k-automatic, but is k-quasiautomatic for all k 2. 2 +2 1+ log () In this section I give an example of a sequence that is k-quasiautomatic for all k 2. The sequence (a(i)) begins 1; 3; 39; 331815; 114126085737676800331815; : : : Proof. First, we note the following observation. Suppose there exists an in nite string w = w w w over k = f0; 1; : : :; k ? 1g such that all but nitely many members s of a set S have the \pre x property", that is, (s)R is a pre x of w. Then Ak (n) = O(log n). k S To see this, note that in this case we can write S = S S , where S is nite and S has the pre x property. To build an automaton that accepts all the base-k representations of elements of S \ 0; n], we simply create a linear chain of nodes, with transitions between them labeled with the symbols of w. The accepting states correspond to the members of S , and of course we need a single dead state in addition to handle the other transitions. The resulting automaton has log n + O(1) states. Since S is nite, we can accept it with a nite automaton. The result now follows because we can accept S S using a direct product construction. The construction of the sequence (a(i))i should now be clear. For bases k 2, the sequence has the property that (a(i))R is a pre x of (a(i +1))R provided i k ? 1. Hence the k k observation of the previous two paragraphs applies, and the automaticity of A is O(log n) for all k 2. Note, however, that the constant in the big-O depends on k. To show that A is not k-automatic for any k, it su ces to show that limi!1 a(i)=ki = 1. But this follows, since from the recurrence we have a(i) i!. 0 1 2 1 2 1 2 2 2 2 1 1 2 1 4 Automaticity of xed points of homomorphisms Let ' be a homomorphism from for some x 2 , then to 2 . If there is a symbol a 2 3 such that '(a) = ax y = ax'(x)' (x)' (x) = jlim 'j (a) !1 is a xed point of '; that is, '(y) = y. If further ' is nonerasing (i.e., '(b) 6= for all b 2 ), then y is in nite. If j'(b)j = k for all b 2 , then ' is said to be k-uniform. A 1-uniform homomorphism is called a coding. A well-known theorem of Cobham 5] states that (s(i))i 0 is the image (under a coding) of a xed point of a k-uniform homomorphism if and only if (s(i))i 0 is k-automatic. A natural problem is to determine the automaticity of xed points of non-uniform homomorphisms. In particular, are there xed points of homomorphisms which are quasiautomatic, but not automatic? This question was raised by the author in 1992 in the context 6 of the xed point (tn)n 0 of the homomorphism 1 ! 121; 2 ! 12221. The sequence (tn) and its relationship to the classical Thue-Morse sequence was studied by Allouche et al. 2]. Computation strongly suggests that (tn) is 2-quasiautomatic. For example, t16n+1 = t64n+1 for 0 n 1864134, but not for n = 1864135. Although we are not yet able to prove the 2-quasiautomaticity of (tn), it is possible to prove that it is not 2-automatic 24]. (This last result was, according to J.-P. Allouche (personal communication), also proved by M. Mkaouar.) We now give three examples. First, we exhibit a homomorphism whose xed point is 2-quasiautomatic, but not 2-automatic. Next, we give a homomorphism whose xed point is 2-automatic, but not k-quasiautomatic for any odd k. Finally, we use some simple theorems of Diophantine approximation to exhibit a homomorphism whose xed point is not k-quasiautomatic for any k 2. Theorem 11 Let '(c) = cba, '(a) = aa, and '(b) = b. Let (si)i be the xed point of ' beginning with c. Let X = f2j + j : j 0g. Then (a) s = c and si = b if and only if i 2 X ; 0 0 (b) (si )i 0 is not 2-automatic. (c) (si )i 0 is 2-quasiautomatic. Proof. Part (a) follows easily from the observation that 'r (c) = cbaba ba ba ba r? : For part (b), it su ces to show that L = F (s; b) is not a regular set. It is easy to see 2 4 8 2 1 that 2 L = f1 0n?b 2 nc? (n) : n 1g f1g: Now a routine argument using the pumping lemma 15] completes the proof. Finally, for part (c), it su ces to construct an automaton with output with O(log n) states that generates the terms of the sequence (si) correctly for all i n. We sketch the construction of such an automaton, leaving the details to the reader. Let n = i n i. If L is a language, we say that L0 is an nth-order approximation to L if L \ n = L0 \ n . The basic idea of our construction is that it su ces to concentrate on LR = F (s; b)R and create an automaton accepting a (1 + blog nc)th order approximation to LR. This is easy, since strings in LR begin with a short sequence of bits which are followed by many zeroes and then a 1. The state set consists of four parts. The rst part is A = fqw : w 2 (0+1) b 2 2 nc g. This part of the automaton forms a binary tree that can handle all possible strings of length blog log nc + 1. The transitions between states in the rst part are given by (qw ; e) = qwe for jwj blog log nc and e 2 f0; 1g. The output function for the states in A is given by (q ) = c, (qw ) = b if wR] 2 X , and (qw) = a for all other w. The second part of the automaton consists of a linear chain of states, B = fpi : 0 i < blog ncg. The transitions between states in the second part are given by (pi; 0) = pi? for 2 i < blog nc, (p ; 1) = p , and (p ; 0) = p . The output function for these states is (pi) = a for i 6= 0, and (p ) = b. log 1 2 0 2 2 log log +1 2 2 2 2 2 2 1 2 1 0 0 0 0 7 The third part of the state set is C = fp0i : 0 i < blog2 ncg, a copy of B . The output function for these states is (p0i ) = b for all i. The fourth and nal part consists of a single dead state d. We set (d; e) = d for e 2 f0; 1g, and (d) = a. The start state is q . We leave to the reader the task of specifying the connections between the di erent groups of states, observing that transitions (qw; 0) for jwj = blog2 log2 nc + 1 that are not self-loops go to a state in C if wR]2 2 X , and otherwise go to a state in B . As an example, the machine in Figure 1 computes (si) correctly for all i < 28. The total number of states needed is jAj + jB j + jC j + 1 6 log 2 n. q000/c 0 1 q001/a 0 0 q00 /c 0 q0 /c 0 q01 /a 1 qε /c 0 1 0 q1 /b 0 q11 /b 1 q10 /b 1 q010/a 0 p4 /a 1 0 0 p3 /a 0 p2 /a 0 p1 /a 1 0 p0 /b 1 q011/b 0 d/a 0 0,1 q100/b p’ /b 4 q101/a 0 0 q110/b 1 0 p’ /b 3 0 p’ /b 2 0 p’ /b 1 1 p’ /b 0 0 1 1 q111/a 0 Figure 1: Automaton computing s(i) for 0 i < 256. The input is the base-2 expansion of i, starting with the least signi cant bit. The output is s(i). The states are labeled with the name of the state, followed by a slash, followed by the output associated with that state. All unmarked transitions go to the dead state, labeled d=a. Next, we exhibit a homomorphism whose xed point is 2-automatic, but has high kautomaticity for all odd k. De ne '(0) = 01; '(1) = 00, and consider the xed point (p(i))i 0 starting with 0. It is easy to see that p(i) = 2(i + 1) mod 2, where 2(n) is the exponent of the highest power of 2 which divides n. 8 We rst give two simple lemmas: Lemma 12 Let (s(i))i be a sequence over a nite alphabet , and suppose that there exists a constant d such that for all r; a; b with r 2, 0 a; b < r, and a = b, there exists a non6 d ) such that s(rm + a) = s(rm + b). Then Ak (n) = (n = d =k ) negative integer m = O(r 6 s 0 1 ( +1) for all k 2, where the implied constant in the big- does not depend on k. Proof. Exactly the same as the proof of Lemma 3. Lemma 13 Suppose r is odd and 1 a < b r. Then there exists m such that 0 m < 4r and (rm + a) = (rm + b). 6 Proof. Let b ? a = 2c t, where t is odd. Let m (2c ? b)r? (mod 2c ); the de nition 2 2 +1 1 +2 is meaningful since r is odd. Then rm + b 2c+1 (mod 2c+2 ), so 2(rm + b) = c + 1. On the other hand, rm + a 2c+1 + a ? b (mod 2c+2 ) 2c+1 ? 2c t (mod 2c+2 ) 2c (2 ? t) (mod 2c+2 ): Since t is odd, we have 2(rm + a) = c. Now 2c < r, so 2c+2 < 4r, and 0 m < 2c+2 . Now we can state and prove our theorem on the k-automaticity of (p(i))i 0 . Theorem 14 If p(i) = (i + 1), then (p(i))i is 2-automatic. If k Ak (n) = p (n =k). 12 = 2 0 3 is odd, then Proof. The fact that p is 2-automatic follows from the fact that the de ning homomorphism ' is 2-uniform; see 5]. To get the automaticity bound for odd k, simply combine Lemmas 12 and 13. As a corollary, we can obtain a lower bound for the automaticity of the Thue-Morse sequence in all odd bases. Let sk (i) denote the sum of the digits of i when expressed in base k. Then the Thue-Morse sequence (t(i))i is de ned as follows: t(i) = s (i) mod 2. It is easy to see that the Thue-Morse sequence is 2-automatic. However, we have the following 0 2 Theorem 15 Let k 3 be an odd integer. Then Ak (n) = (n = =k = ). t Proof. Our proof is based on the following identity, which is well-known and easily proved 14 12 by considering the base-2 expansion of i + 1: 2 2 s (i + 1) ? s (i) = 1 ? (i + 1): 2 Taking this modulo 2, we obtain t(i + 1) + t(i) + 1 p(i); 9 (2) where p is the function de ned in Theorem 14. Let Mn = (Q; k ; ; q0; ; ) be a DFAO computing t(i) for all i with 0 i n, and assume that Mn has Ak (n) states. Now consider Mn+1 , and create a slightly modi ed t 0 automaton M 0 = (Q0; k ; 0; q0; ; 0) such that on input w with wR]k = i, M 0 computes the shifted sequence t(i + 1) for 0 i n. This can be achieved as follows: de ne Q0 = Q f0; 1g, where the second component of every state denotes a carry to be propagated, 0 and let q0 = q0; 1]. De ne 0( q; 1]; a) = (q; a + 1); 0]; if 0 a < k ? 1 (q; 0); 1]; if a = k ? 1. Also de ne 0( q; 0]) = (q) and 0( q; 1]) = ( (q; 1)). We leave it to the reader to verify that the construction does indeed compute the shifted sequence. Clearly jQ0j = 2jQj. We now implement equation (2) by forming the direct product of the automata Mn and 0 , and using an output function that computes the function p(i) correctly for all i with M 0 i n. It follows that Ak (n) 2Ak (n)Ak (n + 1) 2(Ak (n + 1)) : t t t p 2 Since Ak (n) = (n1=2=k), the desired result follows. p We now turn to the third problem: nding a xed point of a homomorphism of high automaticity in all bases. Our methods are based on the theory of Diophantine approximation 4] and Sturmian words (also called characteristic words or Christo el words). For a survey on Sturmian words, see 3]. First, we introduce some notation. If is a real irrational number, we can expand it uniquely as an in nite continued fraction, = a0; a1; a2; : : :]. The ai are called the partial quotients of . We say the partial quotients of are bounded by B if ai B for all i 1. (For a survey on bounded partial quotients, see 25].) We de ne pn =qn = a0; a1; : : :; an], and call pn =qn the nth convergent to . We de ne a0n, the nth complete quotient, to be an; an+1; : : :]. We de ne f g = ? b c, the fractional part of , and k k = min( ? b c; d e ? ), the distance to the nearest integer. We then have Lemma 16 Let be an irrational real number, 0 < < 1, with partial quotients bounded by B . Let the numbers 0; f g; f2 g; : : : ; ft g; 1 be arranged in ascending order and let them be labeled p0 ; p1 ; p2 ; : : : ; pt+1 . Then min (pi+1 ? pi) 0it 0 1: (B + 2)t Proof. Let (pk =qk )k be the convergents to . It is a consequence of the three-distance theorem (also called Steinhaus' conjecture) that 0 mint(pi+1 ? pi ) kqk?1 k; i 10 where qk?1 t < qk . See, for example, 18, Exercise 6.4.8]. (Also see, for example, 29, 30, 28].) Now we know kqk?1 k = jqk?1 ? pk?1 j by 11; p: 140] = a0 q 1+ q k?2 k k?1 1 (ak + 1)qk?1 + qk?2 = q +1q k k?1 1 = a q +q +q k k?1 k?2 k?1 1 (B + 2)qk?1 1; (B + 2)t and the result follows. Our next lemma is a version of the inhomogeneous approximation theorem. Unlike the traditional versions of this theorem, the requirement that has bounded partial quotients allows us to bound the size of the integers that e ect the desired approximation. Lemma 17 Let be an irrational real number, 0 < < 1, with partial quotients bounded by B . Let 0 < 1 be a real number. Then for all N 1 there exist integers p; q with 1 0 p; jqj (B + 2)N 2 such that jp ? ? qj N . Proof. By Dirichlet's theorem (see, e.g., 4, Theorem I]), there exist integers n; r with 1 n N and 0 r N , such that jn ? rj < 1=N . Choose k such that qk?1 N < qk , where (pk =qk )k 0 are the convergents to . Then, as in the previous theorem, jn ? rj jqk?1 ? pk?1 j (by 4; p: 2; Eq: (4)]) 1: (B + 2)N Without loss of generality, assume n ? r > 0, and set p0 = b =(n ? r)c. Then 0 p0 (B + 2)N , and 0 ? (n ? r)p0 1=N . Hence jp0n ? p0r ? j 1=N . Now set p = p0n, q = p0r; then p; jqj (B + 2)N 2. The next lemma shows that Sturmian sequences corresponding to real numbers with bounded partial quotients have the property that for all pairs of subsequences of the form (sri+c )i 0, (sri+d)i 0 with c 6= d, there is a small witness i = m that shows that these subsequences are di erent. Lemma 18 Let 0 < < 1 be an irrational real number with partial quotients bounded by B . De ne the Sturmian word s1s2s3 by si = b(i + 1) c ? bi c for i 1. Let r 2 be an integer. Then for all integers c; d with 0 c; d < r, c 6= d, there exists an integer m with 0 m 4(B + 2)3r3 such that srm+c 6= srm+d . 11 Proof. We use the \circular representation" for intervals in 0; 1), identifying the point 0 with the point 1, and considering each point modulo 1. Thus, for example, the interval we write as 2=3; 1=3) is really 2=3; 1) 0; 1=3). See, for example, 11, x3.8, x23.2]. It is easy to see that si = 1 () fi g 2 1 ? ; 1). Hence if we could nd m such that f(rm + c) g 2 1 ? ; 1); f(rm + d) g 2 0; 1 ? ); it would follow that srm+c 6= srm+d . Now f(rm + c) g 2 1 ? ; 1) () frm g 2 Ic := ?(c + 1) ; ?c ); f(rm + d) g 2 0; 1 ? ) () frm g 2 Id := ?d ; ?(d + 1) ): We have (Ic)+ (Id ) = 1, where is Lebesgue measure; hence these intervals have nontrivial intersection whenever c 6= d. In fact, the endpoints of these intervals are precisely of the form f?i g for some i with 0 i r. Let p0 ; p1; : : :; pm+1 denote the points 0, f g, f2 g, : : : ; fr g, 1 arranged in increasing order. It follows that (Ic \ Id) min0 i r (pi+1 ? pi), 1 and by Theorem 16, we know this quantity is bounded below by (B+2)r . Now let m0 be the midpoint of the interval Ic \ Id. To nd m with srm+c 6= srm+d, it su ces to nd integers m; t with \ jrm ? m0 ? tj < (Ic 2 Id) < 2(B 1 2)r : + By a folklore result (see, e.g., 23]), since has partial quotients bounded by B , we know that r has partial quotients bounded by r(B + 2). By Theorem 17, it follows that such an m exists with m r(B + 2)(2(B + 2)r)2 = 4(B + 2)3r3. Theorem 19 Let 0 < < 1 be an irrational real number with bounded partial quotients. Let si = b(i + 1) c ? bi c for i 1. Then for all k 2, the k-automaticity of the sequence (si)i 1 is (n1=4=k). It now follows from this result, for example, that the xed point of the homomorphism 1 ! 10, 0 ! 1 is not k-quasiautomatic. p follows because this xed point can be obtained This as a Sturmian sequence by setting = ( 5 ? 1)=2. It is known for which the corresponding Sturmian sequence (si( ))i 1 is the xed point of a homomorphism; see 6]. Proof. Combine Lemmas 12 and 18. 5 Diversity As we have seen in Section 1, a sequence is k-automatic if and only if its k-kernel (de ned in Eq. (1)) is nite. The most spectacular way a sequence can fail to be k-automatic is for 12 all the sequences in the k-kernel to be distinct ; we call such a sequence strongly k-diverse. Results of the previous sections suggest that the property of strong diversity and related properties deserve further study. We make the following de nitions: De nitions 20 A sequence (s(i))i is weakly k-diverse if the '(k) subsequences f(s(ki + a))i : gcd(a; k) = 1; 1 a < kg are all distinct. A sequence is weakly diverse if it is 0 0 weakly k-diverse for all k 2. A sequence (s(i))i 0 is k-diverse if the k subsequences f(s(ki + a))i 0 : 0 a < kg are all distinct. A sequence is diverse if it is k-diverse for all k 2. A sequence (s(i))i 0 is strongly k-diverse if the subsequences f(s(k i j + a))i 0 : 0 a < ki; i 0g are all distinct. A sequence is strongly diverse if it is strongly k-diverse for all k 2. A sequence is maximally diverse if the subsequences f(s(ki + a))i 0 : 0 a < k; k 1g are all distinct. The results of previous sections can now be rephrased in the language of diversity. In Section 2 we showed that the characteristic sequences of the primes and squarefree numbers are weakly diverse. In Section 4 we showed that the sequence ( 2(i + 1))i 0 is k-diverse for all odd k, and we also showed that if is a real number with bounded partial quotients, then (si( ))i 0 is diverse. We now give an example of a sequence that is strongly k-diverse for k = 2. Consider the set X = f2j + j : j 0g introduced in Theorem 11, and let (c(i))i 0 be the characteristic sequence of this set. Then we have the following theorem: Theorem 21 The sequence (c(i))i is strongly 2-diverse. Proof. We must show that, given any four integers j; k; a; b with j; k 0, 0 a < 2j , 0 b < 2k , and (j; a) = (k; b), there exists n 0 with c j n a = c k n b . Without loss of 6 6 j 0 2 + 2 + generality, assume j j k and if j = k, then a < b. Let n0 = 2k+1 and set n = 2n0 2 ?j+a + n0. Then 2j n + a = 2n0 2 +a + n0 2j + a = 2i + i for i = n0 2j + a. Hence c2j n+a = 1. It remains to show c2k n+b = 0. To see this, it su ces to show that 2i + i < 2k n + b < 2i+1 + i + 1 for i = n0 2j + k ? j + a. To prove the rst inequality, it su ces to show that n0 2j + k ? j + a < n0 2k + b: There are three cases to examine. (i) If k = j , then this inequality follows from the assumption that a < b. (ii) If k = j +1, then we must show a?b+1 < n0(2k ?2k?1 ) = n02k?1 . Since a < 2j = 2k?1, it su ces to show 2k?1 < n0(2k ? 2k?1 ) = n02k?1 , which is true since n0 2. (iii) If k j +2, then we must show k ? j +2j < n0(2k ? 2j ). Now k ? j < 2k?j < 2k , and 2j < 2k ? 2 2j provided 2k > 3 2j , which is true since k j + 2. Adding these inequalities, we nd k ? j + 2j < 2(2k ? 2j ) n0(2k ? 2j ), as desired. 13 To prove the second inequality, we must show n (2k ? 2j ) + j ? k + b ? a < 2n0 0 2j + k?j +a + 1: There are two cases to consider. (i) If k = j , we must show b ? a < 2n0 2j +a +1. Since b < 2k , it su ces to show 2k < 2n0 +1 and for this it su ces to take n0 k. (ii) If k > j , then n0(2k ? 2j ) + j ? k + b ? a < n0(2k ? 2j ) + 2k < (n0 + 1)2k . Thus it su ces to show (n0 + 1)2k < 2n0 . Choose n0 2k+1 . Then (n0 + 1)2k (n0 + 1)n0=2 < 2n0 provided n0 2, which it is, since n0 2k+1. We now show the following: Theorem 22 Almost all sequences over f0; 1g are maximally diverse. Proof. Since the set of pairs f(k; a) : 0 a < k; k 1g is countably in nite, it su ces to show that if (k; a) = (l; b), then the set of sequences (s(i))i for which s(ki + a) = s(li + b) 6 0 for all i 0 is of measure zero. Let g = gcd(k; l). If g=b ? a, or if k = l and and a 6= b, then the linear progressions j (ki + a)i 0 and (lj + b)j 0 contain no terms at all in common. Therefore the subsequences (s(ki + a))i 0 and (s(lj + b))j 0 are independent and hence the probability that they are identical is 0. Otherwise, assume k 6= l and g j b ? a. In order that (k=g)i ? (l=g)j = (b ? a)=g, we must have i = (l=g)i0 + i0, and j = (k=g)i0 + j0, for some constants i0; j0. Since k 6= l, at least one of l=g; k=g must be di erent from 1. Without loss of generality, assume it is l=g. Choose a constant i1 6= i0; then the set fk((l=g)i0 + i ) + a : i0 0g 0 contains no terms in common with flj + b : j 0g: Hence the subsequences (s(k((l=g)i0 + i0) + a))i0 0 and (s(l((l=g)i0 + i0) + b))i0 0 are independent, and so the probability that they are identical is zero. Although almost all 0; 1-sequences are maximally diverse, it is not so easy to prove that any individual sequence has the maximally diverse property. We now give some examples of maximally diverse sequences. Let be a real irrational number with 0 < < 1. Recall the de nition of the Sturmian in nite word (si)i 0 from Section 4: si = b(i + 1) c ? bi c: Theorem 23 All Sturmian sequences are maximally diverse. 14 Proof. We must show that given j; k 1, 0 a < j , 0 b < k, and (j; a) 6= (k; b), there exists an n 0 such that sjn a = skn b . 6 It is easy to see that sn = 1 () fn g 2 1 ? ; 1). Hence it su ces to exhibit n such + + that f(jn + a) g 2 1 ? ; 1) f(kn + b) g 2 0; 1 ? ) Now theorem (e.g., 11, Theorem 438]). Second, let us consider the case j 6= k. Without loss of generality, let us assume j < k. De ne p(I ), the projection of an ordinary interval I , to be p(I ) = ffxg : x 2 I g. Thus, for example, p( e; )) = e ? 2; ? 3). Consider Ia, and let its left and right endpoints be t and u respectively. If Ia \wraps around" 0, then choose u 2 1; 2) so that p( t; u)) = Ia. De ne I0 = p( t=j; u=j )), and I1 = p( kt=j; ku=j ). I claim that (I1) > (Ia). For if Ia contained a subinterval of measure j =k, then I1 = 0; 1), and so (I1) = 1 > (Ia). Otherwise, Ia contains no subinterval of measure j =k, so (Ia) < j=k. In this case, (I1) = k=j (Ia) > (Ia). Now (Ia) + (Ib) = 1. Hence (I1) + (Ib) > 1 and so I1 and Ib have nontrivial intersection. Let I2 = I1 \ Ib; then (I2) > 0. By our de nition of I0 and I1, there is an interval I3 I0 such that if I3 = v; w], then kv; kw] I2. Also, since I3 I0, it is clear that j v; jw] Ia. Again, by Kronecker's theorem, we can nd n such that fn g 2 I3. For this n we have fjn g 2 Ia and fkn g 2 I2 Ib, as desired. If a sequence (d(i))i 0 is diverse, then we know that for all r; a; b with 0 a; b < r and a 6= b, there exists an m such that d(rm + a) 6= d(rm + b). If there is a function f such that m = O(f (n)), then f (n) is said to be a diversity measure for d. In a previous section we showed, for example, that the diversity measure for Sturmian sequences corresponding to real numbers with bounded partial quotients is O(r3 ). We now show that the diversity measure for almost all sequences is low: f(jn + a) g 2 1 ? ; 1) () fjn g 2 Ia := ?(a + 1) ; ?a ); f(kn + b) g 2 0; 1 ? ) () fkn g 2 Ib := ?b ; ?(b + 1) ): First, let us consider the case j = k. We have a = b. In this case, we have (Ia)+ (Ib) = 6 1, and since a = b, these intervals must have nontrivial intersection. De ne I = Ia \ Ib; then 6 (I ) > 0. It now su ces to choose n such that fjn g 2 I . Such an n exists by Kronecker's Theorem 24 Almost all binary sequences have the property that for all r 1, and for all a; b with 0 a; b < r and a = b, there exists m = O(log r) such that srm a 6= srm b . 6 Proof. By Theorem 22, we may restrict our attention to sequences that are diverse. + + We have Pr srm+a = srm+b for 0 m < f (r)] = 2?f (r): 15 ? Pr 9 at least one pair (a; b) such that srm+a = srm+b for 0 n < f (r)] = r(r 2 1) 2?f (r): (3) r(r?1) 2?f (r) = (r?2 ). (Here f = (g ) means f = O(g ) Choose f (r) = d4 log 2 re; then 2 ? and g = O(f ).) Then Pr 1 r(r2 1) 2?f (r) converges. Hence by the Borel-Cantelli lemma, with probability 1 at most nitely many of the events of the form (3) occur. That is, with probability 1, the event 8 pairs (a; b) 9m < d4 log re such that srm a 6= srm 2 + + It follows that b occurs all but nitely many times. Hence with probability 1 we have m = O(log r). Interestingly enough, I do not know a single explicit example of a diverse sequence with diversity measure O(log n). 6 Acknowledgments. I thank Mark Turner for suggesting the term \diversity". Drew Vandeth, Eric Bach, and Jean-Paul Allouche read a draft of this paper and made many useful suggestions. I thank the referee for his comments. References 1] D. Allen, Jr. On a characterization of the nonregular set of primes. J. Comput. System Sci. 2 (1968), 464{467. 2] J.-P. Allouche, A. Arnold, J. Berstel, S. Brlek, W. Jockusch, S. Plou e, and B. E. Sagan. A relative of the Thue-Morse sequence. Discrete Math. 139 (1995), 455{461. 3] J. Berstel. Recent results on Sturmian words. To apear, Proc. of DLT '95. Also available at http://www-litp.ibp.fr/berstel/Liaisons/magdeburg.ps.gz. 4] J. W. S. Cassels. An Introduction to Diophantine Approximation. Cambridge University Press, 1957. 5] A. Cobham. Uniform tag sequences. Math. Systems Theory 6 (1972), 164{192. 6] D. Crisp, W. Moran, A. Pollington, and P. Shiue. Substitution invariant cutting sequences. J. Theorie Nombres Bordeaux 5 (1993), 123{137. 7] C. Dwork and L. Stockmeyer. On the power of 2-way probabilistic nite state automata. In Proc. 30th Ann. Symp. Found. Comput. Sci., pages 480{485. IEEE Press, 1989. 8] C. Dwork and L. Stockmeyer. A time complexity gap for two-way probabilistic nite-state automata. SIAM J. Comput. 19 (1990), 1011{1023. 9] S. Eilenberg. Automata, Languages, and Machines, Vol. A. Academic Press, 1974. 16 10] I. Glaister and J. Shallit. Automaticity III: Polynomial automaticity and context-free languages. Submitted, 1996. 11] G. H. Hardy and E. M. Wright. An Introduction to the Theory of Numbers. Oxford University Press, 1989. 12] J. Hartmanis and H. Shank. On the recognition of primes by automata. J. Assoc. Comput. Mach. 15 (1968), 382{389. 13] D. R. Heath-Brown. The least square-free number in an arithmetic progression. J. Reine Angew. Math. 332 (1982), 204{220. 14] D. R. Heath-Brown. Zero-free regions for Dirichlet L-functions and the least prime in an arithmetic progression. Proc. Lond. Math. Soc. 64 (1992), 265{338. 15] J. E. Hopcroft and J. D. Ullman. Introduction to Automata Theory, Languages, and Computation. Addison-Wesley, 1979. 16] J. Kaneps and R. Freivalds. Minimal nontrivial space complexity of probabilistic one-way Turing machines. In B. Rovan, editor, MFCS '90 (Mathematical Foundations of Computer Science), Vol. 452 of Lecture Notes in Computer Science, pages 355{361. Springer-Verlag, 1990. 17] J. Kaneps and R. Freivalds. Running time to recognize nonregular languages by 2-way probabilistic automata. In J. Leach Albert, B. Monien, and M. Rodr guez Artalejo, editors, ICALP '91 (18th International Colloquium on Automata, Languages, and Programming), Vol. 510 of Lecture Notes in Computer Science, pages 174{185. Springer-Verlag, 1991. 18] D. E. Knuth. The Art of Computer Programming, Vol. III: Sorting and Searching. AddisonWesley, 1973. 19] M. Minsky and S. Papert. Unrecognizable sets of numbers. J. Assoc. Comput. Mach. 13 (1966), 281{286. 20] C. Pomerance, J. M. Robson, and J. O. Shallit. Automaticity II: Descriptional complexity in the unary case. To appear, Theoret. Comput. Sci. 21] J. B. Rosser and L. Schoenfeld. Approximate formulas for some functions of prime numbers. Ill. J. Math. 6 (1962), 64{94. 22] L. Schoenfeld. Sharper bounds for the Chebyshev functions (x) and (x). II. Math. Comp. 30 (1976), 337{360. Corrigenda in Math. Comp. 30 (1976), 900. 23] J. Shallit. Some facts about continued fractions that should be better known. Technical Report CS-91-30, University of Waterloo, Department of Computer Science, July 1991. 24] J. Shallit. The xed point of 1 ! 121, 2 ! 12221 is not 2-automatic. Unpublished manuscript, dated September 10, 1992. 25] J. Shallit. Real numbers with bounded partial quotients: a survey. Enseign. Math. 38 (1992), 151{187. 17 26] J. Shallit and Y. Breitbart. Automaticity: Properties of a measure of descriptional complexity. In P. Enjalbert, E. W. Mayr, and K. W. Wagner, editors, STACS 94: 11th Annual Symposium on Theoretical Aspects of Computer Science, Vol. 775 of Lecture Notes in Computer Science, pages 619{630. Springer-Verlag, 1994. 27] J. Shallit and Y. Breitbart. Automaticity I: Properties of a measure of descriptional complexity. To appear, J. Comput. System Sci. 28] N. B. Slater. Gaps and steps for the sequence n mod 1. Proc. Cambridge Phil. Soc. 63 (1967), 1115{1123. 29] V. T. Sos. On the distribution mod 1 of the sequence n . Ann. Univ. Sci. Budapest Eotvos Sect. Math. 1 (1958), 127{134. 30] S. Swierczkowski. On successive settings of an arc on the circumference of a circle. Fundamenta Math. 46 (1958), 187{189. 31] S. S. Wagsta , Jr. Greatest of the least primes in arithmetic progressions having a given modulus. Math. Comp. 33 (1979), 1073{1080. 18 ...
View Full Document

Ask a homework question - tutors are online