Morphic words, Beatty sequences and integer images of the Fibonacci language

Morphic words are letter-to-letter images of fixed points $x$ of morphisms on finite alphabets. There are situations where these letter-to-letter maps do not occur naturally, but have to be replaced by a morphism. We call this a decoration of $x$. Theoretically, decorations of morphic words are again morphic words, but in several problems the idea of decorating the fixed point of a morphism is useful. We present two of such problems. The first considers the so called $AA$ sequences, where $\alpha$ is a quadratic irrational, $A$ is the Beatty sequence defined by $A(n)=\lfloor \alpha n\rfloor$, and $AA$ is the sequence $(A(A(n)))$. The second example considers homomorphic embeddings of the Fibonacci language into the integers, which turns out to lead to generalized Beatty sequences with terms of the form $V(n)=p\lfloor \alpha n\rfloor+qn+r$, where $p,q$ and $r$ are integers.


Introduction
A Beatty sequence is a sequence A = (A(n)) n≥1 , with A(n) = ⌊nα⌋ for n ≥ 1, where α is a positive real number, and ⌊·⌋ denotes the floor function. What Beatty observed is that when B = (B(n)) n≥1 is the sequence defined by B(n) = ⌊nβ⌋, with α and β satisfying is the golden ratio, this gives that the sequences (⌊nϕ⌋) n≥1 and (⌊nϕ 2 ⌋) n≥1 are complementary.
However, no expression for AA is given. 1 In fact, one can prove that there do not exist integers p, q and r such that AA = pA + qId + r. This follows from Lemma 7 in [2] , since the first order difference sequence of AA takes more than 2 values. Still, expressions for AA are known involving the sequence ⌊ √ 2{n √ 2}⌋, see Theorem 1 in [12], and see [4]. Our Theorem 1 in Section 2 clarifies the situation.
We next show in Section 2 that for an infinite collection of α's the difference sequence of AA, as a word, can be represented as a decoration of the fixed point of a morphism. We determine this for the Fraenkel family, also known as the metallic means. These are the solutions to x 2 + (t − 2)x = t, where the natural number t is the parameter. For t = 1 one obtains the golden mean, for t = 2 the silver mean √ 2. Recall that the class of decorations of fixed points of morphisms is equal to the class of morphic words, see, e.g., Corollary 7.7.5 in [1]. In Corollary 4 we give the difference sequence of AA for α = ( √ 13 − 1)/2 as a morphic word.
In Section 3 we present our second example. We solve the Frobenius problem for homomorphic embeddings of the Fibonacci language, which means that we give a precise description of the complement of this embedding. Although the two examples are seemingly unrelated, generalizations of Beatty sequences do appear again.
In the appendix we give a different proof that the iterated Beatty sequence AA with A(n) = ⌊n √ 2⌋ is a morphic word. This leads to a morphic word on an alphabet of size 4. We conjecture that this is the smallest size possible, which is equivalent to the conjecture that AA is not a fixed point of a morphism.
For some general results for a special class of decorations of fixed points of morphisms see [14]. In [14] the decorations are so called marked morphisms, which in some sense are the opposite of the decorations that one will encounter in the present paper. We mention also that decorations of morphisms are closely connected to HD0L-systems. See [18] for some recent results on these in the context of Beatty sequences, which in some sense are also opposite to our results.

Iterated Beatty sequences
Let α be an irrational number larger than 1, and let A defined by A(n) = ⌊nα⌋ for n ≥ 1 be the Beatty sequence of α.
The iterated Beatty sequence AA given by AA(n) = ⌊⌊nα⌋α⌋ has been studied by many authors. See, among others, [6], [7], [12], [3], [4]. The main effort in these papers has been to express AA as a linear combination of A, Id and the constant function. Following [2] we call any sequence V of the form V (n) = pA(n) + qn + r for n ≥ 1 where p, q, r are integers, a generalized Beatty sequence, for short a GBS.
Theorem 1 Let α > 1 be a quadratic irrational with minimal polynomial in Z[x]. The sequence AA is a generalized Beatty sequence if and only if |α| < 1.
1 Neither for BA. The sequence BA has about the same complexity as AA, since BA = AA + 2A, as implied by B(n) = A(n) + 2n for all n ≥ 1.
If S is a sequence, we denote its sequence of first order differences as ∆S, i.e., ∆S is defined by ∆S(n) = S(n + 1) − S(n), for n = 1, 2 . . .
As in the proof of Theorem 1 one computes that A(A(n)) = 2A(n) + n − 1. An application of Lemma 7 from [2] then gives that the difference sequence ∆AA given by ∆AA(n) = AA(n + 1) − AA(n) is pure morphic: it is fixed point of the morphism 5 → 57, 7 → 575 on the alphabet {5, 7}.
What is the structure of AA if |α| > 1? We determine this for the Fraenkel family, also known as the metallic means, which are the positive solutions to x 2 + (t − 2)x = t, where the natural number t is the parameter. For t ≥ 4 the morphism τ is given 2 For t ≥ 4 the morphism δ is given by In the proof of this theorem we need the combinatorial Lemma 3. We know that ∆A is fixed point of the morphism σ on the alphabet {1, 2} given by as can be found in Crisp et al [9], or Allouche and Shallit [1]. Here one uses that α has a very simple continued fraction expansion: α = [1; t, t, t, . . . ].
We also use repeatedly which can be proved by induction: We then have For v and w one derives: Proof of Theorem 2: In view of the complexity of the proof we first give the proof for the case t = 3, i.e., the case α = ( √ 13 − 1)/2, the bronze mean. We then have to show that ∆AA is a decoration δ of a fixed point of a morphism τ , both defined on the alphabet {1, 2, 3, 4}, where τ is given by Let L be the map that assigns to any word its length, so, e.g., L(u 1 ) = 4, L(v) = 5.
CLAIM: 1) The word ∆A can be written as ∆A = x 1 x 2 . . . where each x i is an element from {u 1 , u 2 , v, w}.
Proof of part 1) of the claim: we know that ∆A is the unique fixed point of the morphism σ = σ 1,2 given by 1 → 112, 2 → 1121. Since 1121 = u 1 is prefix of ∆A, also σ n (u 1 ) is prefix of ∆A for all n ≥ 1. So with Lemma 3 this proves the CLAIM, part 1). Part 2) of the claim then follows from L(u 1 ) = L(u 2 ) = 4, L(v) = L(w) = 5, which induces the morphism σ 4,5 for the infinite word r of lengths.
How do we obtain ∆AA from ∆A? Since A(N) = AA(N) ∪ AB(N), a disjoint union, one obtains AA from A by removing the integers AB(n), which, of course, have index B(n) in the sequence A. The difference sequence ∆B of this sequence is the unique fixed point of the morphism σ 4,5 , since β = α + 3. It follows then from the CLAIM that the integers AB(n) occur at positions with correspond to the third letter in the word x i . Here it is the third letter, because the first term of the sequence (A(B(n)) = 5, 10, 15, 22, . . . occurs at position 4 in the sequence (A(n)) = 1, 2, 3, 5, . . . . Removal of the AB(n) is then performed by adding the third and the fourth letter in the x i . This operation turns u 1 = 1121 into δ(1) = 1 t−1 3,, u 2 = 1211 into δ(2) = 122, v = 21112 into δ(3) = 2122, and w = 12112 into δ(4) = 1222. The conclusion is that this decoration δ turns the fixed point of τ into ∆AA. This ends the proof for the case t = 3.
For general t, the coding An analogous claim as for the t = 3 case holds, and now the map L satisfies which induces the morphism σ t+1,t+2 for the infinite word r of lengths. One continues in the same way, using now that β = α + t. This time, the integers AB(n) occur at positions in A with correspond to the t th letter in the words Here it is the t th letter, because the first term of the sequence (A(B(n)) occurs at position B(1) = t + 1 in the sequence (A(n)). Here B(1) = ⌊β⌋ = ⌊α + t⌋ = t + 1, since a simple computation shows that 1 < α < 2 for all t.
Removal of the AB(n) is then performed by adding the t th and the (t + 1) th letter in the x i . This operation turns The conclusion is that this decoration δ maps the fixed point of τ to the first differences ∆AA.
Corollary 4 is derived from Theorem 1 by using the natural algorithm given, for example, in [15], Lemma 4. Honkala's requirement of 'cyclicity' in that lemma is not necessary.
Fraenkel's theorem with the 'defect' function D = D(n) suggests that the ∆AA sequences can take many values. This is not the case. Remark Once more, let α = √ 2. The differences x 2,k := (AB) k −(BA) k , where k ≥ 1, are the 'commutator' functions. They are extensively studied in [8]. They are all similar to x 2,1 , which is equal to x 2,1 = AB−BA = 2Id − AA. One can derive from this that all commutator functions are morphic words.

Embeddings of the Fibonacci language into the integers
Let L be a language, i.e., a sub-semigroup of the free semigroup generated by a finite alphabet under the concatenation operation. A homomorphism of L into the natural numbers is a map S : L → N satisfying S(vw) = S(v) + S(w), for all v, w ∈ L.
Let x F be the Fibonacci word, i.e., the infinite word fixed by the morphism 0 → 01, 1 → 0. Let L F be the Fibonacci language, i.e., the set of all words occurring in x F . Recall that ϕ = (1 + √ 5)/2. The key ingredient in this section is the lower Wythoff sequence (⌊nϕ⌋) n≥1 = 1, 3,4,6,8,9,11,12,14,16,17,19, . . .. The following result is proved in [11]. The goal of this section is to determine the complement of the set S(L F ) in N. We shall show that the corresponding infinite word is always a morphic word, by representing it as a decoration of a fixed point of a morphism. It appears that this is a matter of a complicated bookkeeping, especially when the two values S(0) and S(1) are small.
There are three morphisms f, g and h that play an important role in this section, where it is convenient to look at a and b both as integers and as abstract letters. The morphisms are given by Here is a result that gives an idea of the proof in general for the case S(0) > S(1).
Then the first differences of the complement N \ S(L F ) of S(L F ) is the word obtained by decorating the fixed point x H of the morphism h by the morphism δ given by Proof: The sequence of first differences of a generalized Beatty sequence p⌊nϕ⌋ + qn + r) is the fixed point of the Fibonacci morphism f on the alphabet {2p + q, p + q}. See Lemma 8 in [2]. So the two generalized Beatty sequences G 1 := (a − b)⌊nϕ⌋ + (2b − a)n and G 2 , given by G 2 (n) = G 1 (n) + a − b in Theorem 6 have the property that ∆G 1 = ∆G 2 is the fixed point x F of the Fibonacci morphism on the alphabet with symbols 2(a − b) + 2b − a = a and a − b + 2b − a = b. We illustrate the proof by first considering the case a = 8, b = 5. In this case we have Here we put G 2 (0) = 0. As a consequence, Card( a a b a a b . . . is the fixed point of h. The reason that the directive sequence is x H instead of x F is that the last element of each V i is equal to G 2 (i) for i = 1, 2, . . . . 3  1  2  3  4  5  6  7  8  9  10  11  12  13  14  15  16  17  18  19  20  21  22  23 In the table above, the integers in G 1 (N) are marked with ⊡, those in G 2 (N) with ⊞, and those in the complement with a ▽. By construction, all the V i with cardinality 8 have the same pattern ▽▽▽▽⊡▽▽⊞ for their members. Also all V i with cardinality 5 have the same pattern ▽⊡▽▽⊞. Note that the last two symbols are ▽⊞, for both size 5 and size 8 V i 's, and their first symbols are ▽ for both. This implies that if we glue the patterns together, then the infinite sequence of differences of the positions of ▽ in the infinite pattern yields first differences of the sequence of elements in N \ (G 1 (N) ∪ G 2 (N)). For V i of size 8 these differences (including the 'jump over' last value 2) are given by 1,1,1,2,1,2, and for V i of size 5 by 2,1,2. It follows that the first differences are obtained by decorating the fixed point x H by the morphism δ given by For the general case one considers sets V i of consecutive integers of size a or size b, where the order is again dictated by the fixed point x H of h. The corresponding patterns have exactly one symbol ⊞ at the end, and exactly one symbol ⊡ positioned a − b places before the end. It follows again that over the V i 's the first differences of the complement set end in 2 (the 'jump over' value), are preceded by a − b − 2 1's, which is preceded by a 2. The first differences start with a number of 1's, which is (a This yields the decoration δ stated in the theorem. We now give an example of the difficulties one encounters when S(0) or S(1) are (relatively) small.  a a b a b a a . . . is the fixed point of h. 10  1  2  3  4  5  6  7  8  9  10  11  12  13  14  15  16  17  18  19  20  21  22  23 24 There are at least two things wrong with this: [E1 ] The V i 's of length 3 do not all have the same pattern, [E2 ] There are patterns that do not contain a ▽.
To counter these problems, we go from the letters a = 3, b = 1 to the words h(3), h(1), yielding a partition with W i 's of length 7 and 4. The table we obtain is 4  1  2  3  4  5  6  7  8  9  10  11  12  13  14  15  16  17  18  19  20  21  22  23 24 is caused by the fact that V i 's of length 3 have different patterns depending on whether they are followed by a V i of length 1 or of length 3. Problem [E1] is now solved with the W i 's, since 33 can only occur as a prefix of h(1) = 331, and 31 can only occur as a suffix of either h(1) or h(3). However, [E2] is not yet solved, since W 3 does not contain a ▽. The way to tackle this is to pass to the square of h, i.e., take the W ′ i 's of length 18 and 11 corresponding to h 2 (1) = 33133131 and h 2 (3) = 33131. It is obvious from the corresponding patterns, that the differences of the complement N \ S(L F ) are given by the decoration W ′ 1 → 7, 11, W ′ 3 → 11 of the W ′ i 's. But since h 2 (x H ) = x H , this is the same as decorating the letters a → 7, 11, and b → 11 in x H . Remark 10 Theorem 9 gives essentially the same result as Theorem 25 in [2]. The proof given here is completely different.
We let C be the increasing sequence of integers in the complement of S(L F ), so C(N) = N \ S(L F ).
, mentioned in the proof of Theorem 9, is more severe in this case, as the pattern of the V i 's of length a depends both on V i−1 and V i+1 . If these have both length 1, then the distance to the next element in V i+1 with symbol ▽ is 5, otherwise it is 4. To make the process context free, we choose the W i corresponding to the two words v := h 2 (a) = aa1aa1a1, w := h 2 (1) = aa1a1.
Context-freeness now occurs because 1a1 occurs uniquely inside v and w. One checks that the decoration δ is then given by Since v and w start and end with the same words, this decoration yields ∆C, when applied to x H on the alphabet {v, w}.
Case 2: a = 1, b ≥ 5. This 3 is a variant of Case 1. The sequence ∆G 1 is fixed point of the Fibonacci morphism on the alphabet {1, b}, and so b ∆G 1 is fixed point of g on {1, b}. Problem [E1] is now that the 'jump over' from b11 to b1b is 6, but the 'jump over' from b11 to b11 equals 7. The adequate partition elements W i correspond to the words v or w: The decoration δ is given by  a a b a a b . . . is the fixed point of h. To get rid of problem [E1], we coarsen the partition to blocks W i corresponding to the words h(a) = aab and h(b) = ab. The problem disappears because aa uniquely occurs as a prefix of aab, and ab uniquely as a suffix of aab or ab. Problem [E2] will not occur, since any 5 consecutive integers will contain an element of C (as b ≥ 2, and no bb occurs in x H ), and the smallest cardinality of a W i is a + b ≥ 5. Also, since both aab and ab start with a, and both end in b, the patterns of the W i will concatenate consistently, so that the the decoration δ obtained form the patterns of the W i acting as a morphism on x H , will yield the difference sequence of C.
The partition elements are defined as V i = {G 1 (i − 1) + 1, . . . , G 1 (i)}, where we put G 1 (0) = 0. This gives Card a b a a b . . . is the fixed point of g. The rest of the proof follows Case 3, replacing h by g (noting that this time aa uniquely occurs as a suffix of g(a), and ab only occurs split over a suffix of g(ℓ) and a prefix of g(ℓ ′ ), for ℓ, ℓ ′ = a, b).
We illustrate Case 4 with the following example.
Finally we mention another way in which the representation in Theorem 11 is not unique. In fact, one can show that every ∆C is a decoration of the single word x G . Letf be the time reversal of the Fibonacci morphism f , i.e.,f is defind byf (0) = 10,f (1) = 0. One verifies that g =f f, h = ff . This leads tof , since x G is the unique fixed point of g. As a corollary one obtains that if z is a decoration of x H by δ, then z is also a decoration of x G : replace δ by δ ′ =f δ.
This relation between x H and x G is also useful in establishing the connection mentioned in Remark 10.

Appendix
In this section we give an alternative proof of Theorem 2, when t = 2, i.e., the case α = √ 2.
Note that γ = πγ E , where π(1) = π(2) = 1, and π(3) = π(4) = 2. We define y = 1, 3, 2, 4, 1, 2, 4, 1, 3, 2, 1, 3, . . ., the fixed point of γ E with y 1 = 1. We claim that y has the property that the letters 1 and 2 alternate in y. Indeed, the words 132 and 12 are the only words in y with prefix 1 and suffix 2 containing no 1's or 2's, and these are mapped to γ E (12) = 1324, γ E (132) = 1324124, in which 1's and 2's alternate, and similarly the words 241 and 21 are mapped to 2413213 and 2413 in which 2's and 1's alternate. Since in the first case the first occurring letter is 1 and the last is 2, and in the second case the first occurring letter is 2 and the last is 1, it follows by induction that the letters 1 and 2 in γ n E (1) alternate for all n.
Thus we found that the 2's in y exactly occur at the Beatty complement B of A.
How do we obtain ∆AA from ∆A? Since A(N) = AA(N) ∪ AB(N), a disjoint union, one obtains AA from A by removing the integers AB(n), which, of course, have index B(n) in the sequence A. In Step 1 we showed that this sequence of indices corresponds to the positions of 2's in y. Now if such a 2 occurs in w 1 = 132, then the differences x k , x k+1 , x k+2 = 1, 2, 1 in x turn into differences 1,3 in ∆AA, since the second 1 disappears because of the removal of the A-number corresponding to x k+2 , and this 1 must be added to x k+1 = 2. The other possibility is that such a 2 occurs in w 3 = 124, and now the removal of the A-number corresponding to x k+1 leads to differences 2,2 in ∆AA. The conclusion is that the decoration δ given by δ(1) = 13, δ(2) = 2 and δ(3) = 22 turns the fixed point of σ into ∆AA.

Acknowledgement
I am grateful to Jean-Paul Allouche for reading a draft of this paper, and suggesting that the α = √ 2 case for the iterated Beatty sequences might be generalized to all metallic means.