Automata and nested recurrences Jeffrey Shallit School of Computer - - PowerPoint PPT Presentation

automata and nested recurrences
SMART_READER_LITE
LIVE PREVIEW

Automata and nested recurrences Jeffrey Shallit School of Computer - - PowerPoint PPT Presentation

Automata and nested recurrences Jeffrey Shallit School of Computer Science University of Waterloo Waterloo, Ontario N2L 3G1 Canada shallit@cs.uwaterloo.ca http://www.cs.uwaterloo.ca/~shallit Joint work with Jean-Paul Allouche. 1 / 22


slide-1
SLIDE 1

Automata and nested recurrences

Jeffrey Shallit School of Computer Science University of Waterloo Waterloo, Ontario N2L 3G1 Canada shallit@cs.uwaterloo.ca http://www.cs.uwaterloo.ca/~shallit Joint work with Jean-Paul Allouche.

1 / 22

slide-2
SLIDE 2

Hofstadter’s recurrence

Douglas Hofstadter, G¨

  • del, Escher, Bach, 1979:

Q(n) = Q(n − Q(n − 1)) + Q(n − Q(n − 2)) for n ≥ 2 and Q(1) = Q(2) = 1.

2 / 22

slide-3
SLIDE 3

1st differences of Hofstadter’s Q-sequence

Larger and larger hedgehogs

3 / 22

slide-4
SLIDE 4

Hofstadter and Huber

Hofstadter and Huber (1999): Qr,s(n) = Qr,s(n − Qr,s(n − r)) + Qr,s(n − Qr,s(n − s)) for n > s > r. Balamohan, Kuznetsov and Tanny (2007): a nearly complete analysis of the sequence Q1,4 (called V in their paper). It is defined by V (1) = V (2) = V (3) = V (4) = 1, and ∀n > 4, V (n) := V (n − V (n − 1)) + V (n − V (n − 4)).

4 / 22

slide-5
SLIDE 5

The V-sequence

n 1 2 3 4 5 6 7 8 9 10 11 12 13 14 V (n) 1 1 1 1 2 3 4 5 5 6 6 7 8 8

5 / 22

slide-6
SLIDE 6

The V -sequence

◮ is monotone increasing ◮ successive terms differ by 0 or 1 ◮ no number appears more than four times (and only 1 appears

that many)

◮ grows approximately like n/2

V (n) − n/2

6 / 22

slide-7
SLIDE 7

Frequency sequence

n 1 2 3 4 5 6 7 8 9 10 11 12 13 14 V (n) 1 1 1 1 2 3 4 5 5 6 6 7 8 8 Balamohan, Kuznetsov, and Tanny (2007): a precise description of the “frequency” sequence F(n) defined by F(a) := #{n : V (n) = a}. n 1 2 3 4 5 6 7 8 9 10 11 12 13 14 F(n) 4 1 1 1 2 2 1 2 2 1 3 2 1 2

7 / 22

slide-8
SLIDE 8

Explicit description

Theorem (Balamohan, Kuznetsov, Tanny)

There exist two (explicit) maps g, h, with g, h : {1, 2, 3}4 → {1, 2, 3}, such that, for all a > 3 F(2a) = g(F(a − 2), F(a − 1), F(a), F(a + 1)) F(2a + 1) = h(F(a − 2), F(a − 1), F(a), F(a + 1)).

8 / 22

slide-9
SLIDE 9

Corollary of our main result

  • Theorem. (Allouche & JOS, 2012) The sequence (F(n))n≥1 is

2-automatic.

◮ This means that F(n) can be computed “in a simple way”

from the base-2 representation of n.

◮ In particular, it can be computed in O(log n) time. ◮ Furthermore, we can compute the automaton explicitly.

9 / 22

slide-10
SLIDE 10

What is an automatic sequence?

◮ An infinite sequence

a = a0a1a2 · · ·

  • ver a finite alphabet of letters, generated by a finite-state

machine (automaton)

◮ The automaton, given n as input, computes an as follows:

◮ n is represented in some fixed integer base k ≥ 2 ◮ The automaton moves from state to state according to this

input

◮ Each state has an output letter associated with it ◮ The output on input n is the output associated with the last

state reached

10 / 22

slide-11
SLIDE 11

The canonical example: the Thue-Morse automaton

1 1 1 This automaton generates the Thue-Morse sequence t = (tn)n≥0 = 0110100110010110 · · · .

11 / 22

slide-12
SLIDE 12

Why automatic sequences?

◮ A nontrivial class of self-similar sequences ◮ Many “naturally-occurring” sequences are automatic ◮ Halfway between periodic and chaotic ◮ Provide canonical examples for various kinds of avoidance

problems

◮ Statistics like the limiting frequency of occurrence of any

letter are easy to compute

12 / 22

slide-13
SLIDE 13

The main result

Theorem. If a sequence F satisfies a recurrence “like” F(2a) = g(F(a − 2), F(a − 1), F(a), F(a + 1)) F(2a + 1) = h(F(a − 2), F(a − 1), F(a), F(a + 1)). then F is 2-automatic. Proof idea. Find a finite class of sequences of which F is a member, and which is closed under the transformations n → 2n; n → 2n + 1. The proof is explicit, but the automaton it constructs in our case is too large to deal with.

13 / 22

slide-14
SLIDE 14

Constructing the automaton

We constructed the automaton by “guessing” it and checking it. The states are named by binary strings. We guess that x and y correspond to the same state if F([xz]) and F([yz]) are the same for all the z we can reasonably test (say |z| ≤ 20). Actually, this is not quite good enough; we actually deal with the 4-tuple (F([x] − 2), F([x] − 1), F([x]), F([x] + 1)). This gives us a 33-state automaton that we can now verify by a very tedious induction on |x|, using the recurrence we know. Now, throwing away all but the 3rd of 4 outputs for each state, we get a smaller automaton by minimization.

14 / 22

slide-15
SLIDE 15

A conjecture

  • Conjecture. V ′, the first difference sequence of V (n), is also

2-automatic. For example, up to the limit we have checked (tens of thousands of terms) V ′([10110x]) = V ′([10001x]) V ′([11000x]) = V ′([10011x]) V ′([100011x]) = V ′([11110x]) V ′([101010x]) = V ′([100000x]) V ′([101011x]) = V ′([100001x]) V ′([101110x]) = V ′([100100x]) V ′([101111x]) = V ′([100101x]) However, if it is 2-automatic, then the smallest automaton (msd first) has at least 900 states.

15 / 22

slide-16
SLIDE 16

Morphic sequences: a generalization of automatic sequences

A morphism is a map h from a finite alphabet Σ∗ → ∆∗ satisfying h(xy) = h(x)h(y) for all strings x, y. If Σ = ∆ we can iterate h. If h(a) = ax for a letter a then hω(a) = a x h(x) h2(x) . . . . Note that hω(a) is a fixed point of h. If a sequence arises by applying a coding (a renaming of the letters) to hω(a) then it is called morphic.

16 / 22

slide-17
SLIDE 17

Slow sequences

Recently Allouche has proposed studying “slow” sequences, that is, sequences of natural numbers where the first differences are either 0 or 1.

  • Theorem. Let x = (xn)n≥1 be a slow sequence. Then the

corresponding frequency sequence F(x) is bounded and morphic iff the the first difference sequence ∆x is morphic and 1’s appear there with bounded gaps. Corollary The first difference sequence of V is morphic.

17 / 22

slide-18
SLIDE 18

Proof of the theorem

  • Proof. Apply the morphism that sends i to 1

i−1

  • 0 0 · · · 0 to the

frequency sequence. Example: original sequence x is 1 1 1 1 2 3 4 5 5 6 6 78 8 9 9 10 11 11 11 · · · Frequency sequence is 41112212213 · · · Apply morphism to that to get 10001111010110101100 · · · , which, except for the first term, is ∆x.

18 / 22

slide-19
SLIDE 19

Proof of the other direction

For the other direction, apply a finite-state transducer that measures the distance between consecutive 1’s: Example: if the first difference sequence is (1)00011110101101011001 · · · , then the transducer outputs 41112212213 · · · . However, these implications need not hold for k-automatic sequences...

19 / 22

slide-20
SLIDE 20

Example 1

Suppose the frequency sequence F(x) = (f (n))n≥1 is given by f (n) =

  • 2,

if n is one less than a power of 2; 1,

  • therwise.

So (f (n))n≥1 is 21211121111111211111111111111121 · · · Then x is 1 1 2 3 3 4 5 6 7 7 8 9 10 11 12 13 14 15 15 16 17 · · · and the first difference of this is 01101111011111111011111111111111 · · · with 0’s in positions 1 4 9 18 35 68 · · · and generally in positions 2n + n − 2. This is not 2-automatic.

20 / 22

slide-21
SLIDE 21

Example 2

On the other hand if we define the first difference sequence by g(n) =

  • 0,

if n is a power of 2; 1,

  • therwise.

Then (g(n))n≥1 is automatic and equals 00101110111111101111 · · · so the original sequence is 1 1 1 2 2 3 4 5 5 6 7 8 9 10 11 12 12 13 14 15 16 17 18 19 · · · and the corresponding frequency sequence is 321121111112111111111111112 · · · with 2’s in positions 2 5 12 27 58 · · · and in general 2n − n, so this is not automatic either.

21 / 22

slide-22
SLIDE 22

For further reading

  • 1. J.-P. Allouche and J. Shallit, A variant of Hofstadter’s

sequence and finite automata, J. Aust. Math. Soc. 93 (2012), 1–8.

  • 2. B. Balamohan, A. Kuznetsov, and S. Tanny, On the behavior
  • f a variant of Hofstadter’s Q-sequence, J. Integer Seq. 10

(2007) Article 07.7.1.

  • 3. K. Pinn, Order and chaos in Hofstadter’s Q(n) sequence,

Complexity 4 (1999), 41–46.

22 / 22