Palindromic prefixes and episturmian words
Stéphane Fischler
Équipe d’Arithmétique et de Géométrie Algébrique, Bâtiment 425, Université Paris-Sud, 91405 Orsay Cedex, France Received 14 March 2005
Available online 27 December 2005
Abstract
Letwbe an infinite word on an alphabetA. We denote by(ni)i1the increasing sequence (assumed to be infinite) of all lengths of palindromic prefixes ofw. In this text, we give an explicit construction of all wordswsuch thatni+12ni+1 for alli, and study these words. Special examples include characteristic Sturmian words, and more generally standard episturmian words. As an application, we study the values taken by the quantity lim supni+1/ni, and prove that it is minimal (among all nonperiodic words) for the Fibonacci word.
©2005 Elsevier Inc. All rights reserved.
Keywords:Palindrome; Prefix; Sturmian word; Episturmian word; Fibonacci word
1. Introduction
The purpose of this text is to study infinite words (on an arbitrary, not necessarily finite, al- phabet A) which have “sufficiently many” palindromic prefixes. The motivation comes from diophantine approximation (see below), though this question is also related to physics, namely to the spectral theory of discrete one-dimensional Schrödinger operators. Words with many palin- dromic factors can be used in this setting [11], corresponding to the combinatorial notion of
“palindrome complexity” (see, for instance, [1]). On the other hand, replacing “whole-line meth- ods” by “half-line methods” in connection with this problem leads [4] to the use of words with many palindromic prefixes, like the ones studied below.
In precise terms, given an infinite wordw, we shall denote (in this Introduction) by(ni)i1 the increasing sequence of all lengths of palindromic prefixes ofw, withn1=0 corresponding
E-mail address:[email protected].
0097-3165/$ – see front matter ©2005 Elsevier Inc. All rights reserved.
doi:10.1016/j.jcta.2005.12.001
to the empty prefix. The words studied here always have infinitely many palindromic prefixes, so we assume the sequence(ni)i1to be infinite.
A trivial example of such a wordwis any periodic word with a palindromic period. A more interesting example is the Fibonacci wordw=babbababbabba . . .on the two-letter alphabet {a, b}, for which the sequence(ni)=(0,1,3,6,11, . . .)is given byni=Fi+1−2 (whereFi is theith Fibonacci number); this follows from [6, Theorem 5]. More generally, any characteristic Sturmian word satisfiesni+12ni+1 for anyi, and denoting by[0, s1, s2, . . . ,]the continued fraction expansion of its slope we have (see Section 3.1):
lim supni+1
ni =lim sup[1,1, sk, sk−1, . . . , s1]. (1) In particular, ifwis the Fibonacci word then lim supni+1/niis the golden ratioγ=(1+√
5)/2.
A generalization of characteristic Sturmian words to an arbitrary alphabet has been given by Droubay, Justin and Pirillo [8]: these are standard episturmian words. They also satisfyni+1 2ni+1 for anyi, but there is no easy equation like (1) to compute lim supni+1/ni.
In this text, we study the wordswwith abundant palindromic prefixes in the following sense:
Definition 1.1.An infinite wordwis said to haveabundant palindromic prefixesif the sequence (ni)i1of all lengths of its palindromic prefixes is infinite and satisfiesni+12ni+1 for any i1.
A completely explicit construction of all words with abundant palindromic prefixes is given, which generalizes one of the constructions [12] of standard episturmian words. This is a strict generalization, i.e., there are words with abundant palindromic prefixes which are not standard episturmian. Moreover, our results extend to words such thatni+12ni+1 for any sufficiently large integeri; in particular, a general construction of all such words is given.
For any wordw, we let δ(w)=lim supni+1 ni
ifwadmits infinitely many palindromic prefixes, andδ(w)= ∞otherwise. Then 1/δ(w)mea- sures the “density” of palindromic prefixes inw. We letDbe the set of real numbers that can be writtenδ(w)for some wordw (on a suitable alphabet). Moreover, we letD0be the set of all numbersδ(w) obtained from words w with abundant palindromic prefixes. The inclusion D0⊂D∩ [1,2]trivially holds, and it is not difficult to prove (see Section 2.2) that(2,+∞] ⊂D.
Denoting bythe union of two disjoint sets, the following result holds.
Theorem 1.2.We haveD=D0(2,+∞].
Actually, for any wordwsuch thatδ(w) <2, there is a wordw with abundant palindromic prefixes such that the palindromic prefixes ofw satisfy the same recurrence relation as those ofw(see Proposition 6.1) and, therefore,δ(w)=δ(w).
The easiest examples of words with abundant palindromic prefixes are periodic words (with a palindromic period) and characteristic Sturmian words (for whichδ(w)can be computed thanks to Eq. (1)). Denote by D the set of numbers δ(w), for these words w. Obviously we have D⊂D0, and the following theorem shows that this inclusion is an equality if we restrict to words with “sufficiently many” palindromic prefixes.
Theorem 1.3.We haveD∩ [1,√
3] =D0∩ [1,√
3] =D∩ [1,√ 3].
For a periodic wordwwith a palindromic period, we have triviallyδ(w)=1. For a charac- teristic Sturmian wordwwith slope[0, s1, s2, . . . ,], Eq. (1) allows one to computeδ(w). From this it is easy to deduce that the characteristic Sturmian wordwwith minimal value ofδ(w)is the Fibonacci word. This shows that 1 and the golden ratioγ=(1+√
5)/2 are the two smallest elements inD. Cassaigne studied [3, Corollary 1 and Theorem 2] the next elements, and his result (together with Theorem 1.3) yields:
Theorem 1.4.The smallest elements inD0(respectively inD)make up an increasing sequence (σn)n0withσ0=1andσ1=γ, converging to the smallest accumulation pointσ∞ofD0(re- spectively ofD).
In more precise terms, this statement means thatD0∩[1, σ∞)= {σn, n0}. Moreover, allσn, andσ∞=1.721. . ., are given in an explicit way in terms of their continued fraction expansion.
For instance, writingm¯ for the periodic repetition mmm . . .=mω of a finite sequence m, we have:
σ2=1+√
2/2=1.707. . .= [1,1,2¯] and
σ3= 2+√
10
/3=1.720. . .= [1,1,2,1,1].
As a corollary, we see that the Fibonacci word has maximal “palindromic prefix density”
among nonperiodic words.
Corollary 1.5.Letwbe an infinite word withδ(w) < γ. Thenwis periodic.
For a characteristic Sturmian wordw with slope [0, s1, s2, . . . ,], Morse and Hedlund have computed [14] the recurrence function ofw. This gives (see [3, Corollary 1]) a formula for the recurrence quotient(w)ofw, namely(w)=2+lim sup[sk, sk−1, . . . , s1]. Therefore Eq. (1) gives in this case:
δ(w)=2(w)−3 (w)−1 ,
hence (as above) the Fibonacci word has minimal recurrence quotient (equal to(5+√ 5)/2) among all characteristic Sturmian words. Rauzy has conjectured [16] that it has minimal recur- rence quotient among all nonperiodic words. Corollary 1.5 is an analogue of this conjecture.
The motivation for this text comes from diophantine approximation. Actually D0\ {1} is equal [9] to the set denoted byS0∩ [1,2]in [10], defined in terms of an exponent that measures the simultaneous approximation to a real number and its square by rational numbers with the same denominator. In particular, Theorem 2.1 in [10] follows from this equality and Theorem 1.3 stated above.
This connection between palindromic prefixes and diophantine approximation is due to Roy [17]. It allows one to get a purely number-theoretical proof of Corollary 1.5 stated above, by applying Davenport–Schmidt’s theorem [5] on simultaneous approximation toξ andξ2to the real numberξ obtained (as in [17]) from an infinite wordw.
The structure of this text is as follows. We first explain the notation (Section 2.1), and prove that for anyα >2 there is a wordwsuch thatδ(w)=α(Section 2.2). This explains why the rest of the text is devoted only to wordswsuch thatδ(w)2.
Then we recall how characteristic Sturmian words (Section 3.1) and standard episturmian words (Section 3.2) are constructed, with a special emphasis on their palindromic prefixes. In Section 4, we construct all words with abundant palindromic prefixes (Section 4.1). To study these words, the key definition is the one of reduced functions, which allows us to state (Sec- tion 4.2) the main results on words with abundant palindromic prefixes. Moreover, we explain (Section 4.3) how to computeδ(w)for such a wordw, using the associated reduced functionψ.
The proof of the results stated in Section 4 is given in Section 5, using general lemmas (Sec- tions 5.1 and 5.2) that might be of independent interest.
Next we briefly explain how to generalize the results of Section 4 to words that satisfy ni+12ni+1 for any sufficiently largei (Section 6.1). This allows to prove (in Section 6.2) Theorem 1.2 stated above.
Theorem 1.3 is proved in Section 7.1, and the setD0(respectivelyD) is studied near√ 3 in Section 7.3 (respectively in Section 7.4); this implies that Theorem 1.3 is optimal. We also define A-strict words with abundant palindromic prefixes in Section 7.2, and prove that anyA-strict standard episturmian wordwsuch thatδ(w) <√
3 is either periodic or characteristic Sturmian.
Section 8 contains questions and open problems about words with abundant palindromic pre- fixes. At last, Appendix A is devoted to the proof of two technical results: Proposition 6.2 (stated in Section 6.2) and Lemma 7.1 (stated in Section 7.1). These statements concern asymptotic properties of the sequence(ni)associated with a word w such that δ(w) <2. They are also useful for the diophantine analogue [9] of this text.
2. Notation and a peculiar construction
2.1. Notation
Throughout the text, we consider a (finite or infinite) alphabetA, which we assume to be disjoint fromN∗= {1,2,3, . . .}. Of course, this is not a serious restriction; it allows us to consider AN∗as a disjoint union.
We denote by|u| the length of a finite wordu, that is the number of letters inu, and byε the empty word (which has length zero). Given a finite wordu=u1. . . up withui∈Afor any i∈ {1, . . . , p}, we denote byu˜its mirror imageup. . . u1, in such a way thatuis a palindrome if, and only if,u= ˜u. We setε˜=ε, so thatεis considered a palindrome. We say that a word u=u1. . . up is a prefix ofuifppanduj=uj for anyjp, that is if there is a wordu such thatu=uu. We extend this definition to the case whereuis an infinite1wordu1u2u3. . .. In particular,εis a palindromic prefix of any (finite or infinite) word.
In the same way, a worduis a suffix ofuif, and only if, there is a finite wordusuch that u=uu. If this happens then either bothuanduare finite, or bothuanduare infinite.
Ifw andw are finite words such thatw is a prefix ofw, we denote byw −1w the word w such thatw=ww. In the same way, ifw=ww, we writew=ww −1. An important special case is the following: ifwandware palindromes andwis a prefix ofw, thenwis also
1 In this text, we consider only right infinite words. In particular, all palindromes are assumed to be finite.
a suffix ofw andww −1w is again a palindrome (of whichwis a prefix). In this situation, if w=wwthen we haveww −1w=ww2(see Lemma 5.1 below).
Remark 2.1.Letwbe a word on the (finite or infinite) alphabetA, such thatni+12nifor any i sufficiently large (with the sequence(ni)i1defined in the Introduction). Then only finitely many letters of Aoccur in w; this follows from Proposition 6.1 proved below. Therefore the interesting case, throughout this paper, is whenAis finite.
2.2. Words with scarce palindromic prefixes
In this section, we prove that(2,+∞] ⊂D. This result explains why all wordswstudied in the rest of this text are such thatδ(w)2.
Obviously there are wordswwith only a finite number of palindromic prefixes; they satisfy δ(w)= ∞hence∞ ∈D. Now letαbe a real number greater than 2, and chooseε >0 such that 2+ε < α. Denote by(pk)k0a sequence of positive integers such that10pkk tends toα, with
pk
10k >2 for anyk. We define an increasing sequence(ni)i1in the following way. We letn1=0, n2=1 and ifi2 is even we letvi+1be the maximal integer such that there exists a multiple of 10vi+1, denoted byni+1, with 2ni< ni+1< (2+ε)ni+1. Ifi3 is odd, we letni+1=pvi10nivi. With this definition, we haveni+12ni+1 for anyi1, andvi (which is defined only wheni is odd) tends to infinity asitends to infinity. This implies lim supnni+1
i =α.
Now let us construct a wordw such that (ni)i1 is exactly the sequence of all lengths of palindromic prefixes ofw. We consider an alphabetA= {δk, k∈N}withδi=δj wheni=j. We define finite palindromesπi, of lengthni, byπ1=εand, fori1:
πi+1=πiδiδ0ni+1−2ni−2δiπi ifni+12ni+2, πi+1=πiδiπi ifni+1=2ni+1.
Then for anyi1,πi is a palindrome written on the alphabet{δ0, . . . , δi−1}. It is also a prefix ofπi+1, and all palindromic prefixes ofπi+1(exceptπi+1itself) are prefixes ofπi. The infinite wordwdefined as the limit ofπi asitends to infinity satisfies the required property: its palin- dromic prefixes are exactly theπi’s, withni= |πi|. Thereforeα=lim supnin+1
i =δ(w)∈D.
This proves the desired result, namely(2,+∞] ⊂D.
3. Sturmian and episturmian words
In this section, we recall how to construct characteristic, or standard, Sturmian (Section 3.1) and standard episturmian (Section 3.2) words, with a focus on the properties of their palindromic prefixes.
3.1. Characteristic Sturmian words
In this section, we recall a construction of characteristic Sturmian words (see [13, Chapter 2]) and properties of their palindromic prefixes.
We consider the two-letter alphabet A= {a, b}. Let s1, s2, . . ., be an infinite sequence of positive integers. Defineσ0=a,σ1=as1−1band, by induction,σn=σnsn−1σn−2for anyn2.
In the terminology of [13, p. 75],(σn)is the standard sequence associated with(s1−1, s2, s3, . . .).
For anyn1,σn is a prefix ofσn+1; therefore the wordsσn tend to an infinite wordcα, called thecharacteristic Sturmian wordwith slopeα= [0, s1, s2, . . .].
Forn2 and 1psn, the wordσnp−1σn−2is a prefix ofσn=σnsn−1σn−2(sinceσn−2is a prefix ofσn−1), hence ofcα. Moreover, it ends withbaifnis even, and withabifnis odd. As it is a standard word, there exists a palindromeπˆn,psuch that
σnp−1σn−2= ˆπn,pba ifnis even,
σnp−1σn−2= ˆπn,pab ifnis odd. (2)
Actuallyπˆn,p is even a central word, so it can be writtenπ abπ for some palindromesπ,π (see [7]). However, in what follows, we shall use only the fact that the wordsπˆn,pdefined in this way are palindromes. This fact can be proved directly (see, for instance, [2, Lemma 5.3]).
We shall now define a sequence(πi)i1of palindromic prefixes ofcα. First, for anyk1 we lettk=s1+ · · · +sk. Now observe that for anyis1there is exactly one pair(n, p)withn2 and 1psnsuch thati=tn−1+p−1. Therefore the equality
ˆ
πn,p=πtn−1+p−1 forn2 and 1psn
definesπi in a unique way foris1(andπtk−1= ˆπk,sk is obtained fromσk by removing the last two letters). Ifs12, we letπi =ai−1 for anyi∈ {1, . . . , s1−1}. Thenπi is defined for anyi1; we haveπ1=εand eachπi is a prefix ofπi+1. Moreover, allπi’s are palindromic prefixes ofcα.
Actually theπi’s are the only palindromic prefixes ofcα. This follows from de Luca’s result ([6, Theorem 5]; see also [8, §3]) thatπi+1is the right palindromic closure ofπiδi, whereδi∈A is the letter inπi+1that comes right afterπi(see Section 3.2 below). Another proof of this result can be obtained by applying Theorem 4.12 proved in this text (see Example 4.6).
Since the πi’s are exactly the palindromic prefixes of cα, we have the equality δ(cα)= lim sup|πi+1|/|πi|. It is not difficult to deduce Eq. (1) from this (see [2, Proposition 7.1]).
Letk3. It is not difficult to prove the relation
πtk+=σk+1πtk−1−1 for any∈ {0, . . . , sk+1} (3) using (for the case=sk+1) the identity σk−1πtk−1=σkπtk−1−1 (see, for instance, [2, Lem- ma 5.1]). From Eq. (3) immediately follows
πtk+1=πtkπt−1
k−1−1πtk, πtk++1=πtk+πt−1
k+−1πtk+ for any∈ {1, . . . , sk+1−1}. (4) We are going now to define a mapψ:N∗→N∗Ain such a way that, for anyi1:
πi+1=πiπψ(i)−1 πi ifψ (i)∈N∗,
πi+1=πiψ (i)πi ifψ (i)∈A. (5)
The possibility to define inductively, in this way, the palindromic prefixes ofcα usingψwill be the crucial point in the construction of Section 4.
Fork3 we let ψ (tk)=tk−1−1, and ifi > t3is not among thetk’s we letψ (i)=i−1.
Then Eq. (4) shows that (5) holds for anyit3. To define the valuesψ (i) for 1i < t3, we distinguish between two cases.
First, let us assumes1=1. Thenπ=b−1 for 1t2andπt2+=(bs2a)bs2 for any 0s3. We let ψ (1)=b,ψ (t2)=a andψ (i)=i−1 for i∈ {2, . . . , t3−1} \ {t2}. Then Eq. (5) holds for anyi1.
Now let us assumes12. Thenπ=a−1for 1t1andπt1+=(as1−1b)as1−1for any 0s2. Moreover, Eq. (3) holds also fork=2. We letψ (1)=a,ψ (t1)=b,ψ (t2)=t1−1 andψ (i)=i−1 fori∈ {2, . . . , t3−1} \ {t1, t2}. Then Eq. (5) holds for anyi1.
3.2. Standard episturmian words
Denote byw(+) the (right) palindromic closure of a finite wordw, that is the shortest palin- drome of whichwis a prefix. LetΔ=δ1δ2. . .be an infinite word on an alphabetA. Droubay, Justin and Pirillo gave [8] the following definition (see [12, Corollary 2.2]):
Definition 3.1.The standard episturmian word with directive wordΔis the limit of the sequence (πi)i1defined byπ1=εandπi+1=(πiδi)(+)fori1.
The important point here (which will be generalized in Section 4.1) is that a standard epistur- mian word can be constructed as a limit of an infinite sequence of its palindromic prefixes.
GivenΔ, define a functionψ:N∗→N∗Aas follows. Forn1, letψ (n)=δnif the letter δn occurs for the first time inΔat the nth position. Otherwise, letψ (n)=n wheren is the greatest integer such that 1nn−1 andδn=δn. Then for anyi1 we have [12, p. 287]:
πi+1=πiπψ(i)−1 πi ifψ (i)∈N∗ and
πi+1=πiψ (i)πi ifψ (i)∈A.
The crucial remark in what follows is that these equalities could have been taken as a definition of the sequence(πi), and therefore of standard episturmian words.
Example 3.2.Lets1, s2, . . . be a sequence of positive integers, andA= {a, b}be a two-letter alphabet. The standard episturmian word with directive word Δ=as1−1bs2as3bs4. . . is the characteristic Sturmian word with slope[0, s1, s2, . . .]. This follows from Section 3.1 (see also [6, proof of Theorem 5]).
Example 3.3.LetA= {a, b, c}andΔ=(abc)ω=abcabcabc . . .. Then the standard epistur- mian wordwwith directive wordΔis [12, Example 2.1] the Tribonacci (or Rauzy [15]) word (that is, the fixed pointabacabaabacabab . . .of the morphism defined bya→ab,b→acand c→a). The corresponding functionψ is given byψ (n)=n−3 forn4, andψ (n)=δnfor 1n3.
4. Words with abundant palindromic prefixes
In this section, we give a general construction (Section 4.1) of all words with abundant palin- dromic prefixes, using functions ψ. Then we define (Section 4.2) reducedfunctions ψ; this definition allows us to state the main results about words with abundant palindromic prefixes, namely Theorems 4.12 and 4.14. At last, we explain in Section 4.3 how to computeδ(w)(for a wordwwith abundant palindromic prefixes) using the associated reduced functionψ.
4.1. A general construction
Letψ:N∗→N∗Abe any map such that, for eachn1:
either ψ (n)∈A or 1ψ (n)n−1.
Defineπ1=εand, fori1:
πi+1=πiπψ(i)−1 πi ifψ (i)∈N∗ and
πi+1=πiψ (i)πi ifψ (i)∈A.
It is not difficult to prove by induction that allπi’s are palindromes, and thatπiis a prefix ofπi+1
(for instance, ifψ (i)∈N∗, writingπi=πψ(i)bi= ˜biπψ(i)yieldsπi+1= ˜biπψ(i)bi=πψ(i)b2i; the easy Lemma 5.1 stated below can also be used). However, in general there is no letterδi∈A such thatπi+1be the palindromic closure ofπiδi.
Definition 4.1.We callword with abundant palindromic prefixesassociated withψ, and denote bywψ, the limit of the sequence(πi).
This definition is consistent with the one given in the Introduction since the following result holds (it is proved in Section 5 as a consequence of Theorem 4.14 stated below).
Theorem 4.2.Letwbe an infinite word, and(ni)i1be the increasing sequence(assumed to be infinite)of the lengths of its palindromic prefixes(withn1=0). Then the following statements are equivalent:
(i) We haveni+12ni+1for anyi1 (i.e.,whas abundant palindromic prefixes).
(ii) For some function ψ, we have w=wψ (i.e., w is the word with abundant palindromic prefixes associated withψ).
Let us study in more details the word with abundant palindromic prefixes associated with a mapψ. First, let us consider the letterδi inπi+1that comes right afterπi. This is the first letter of πi−1πi+1, the one such that πiδi is a prefix of πi+1. We haveδi =ψ (i) if ψ (i)∈A, and δi=δψ(i)otherwise. This explains the following definition.
Definition 4.3.We callword of first lettersassociated withψthe wordΔ=δ1δ2. . .defined (for eachn1) byδn=ψ (n)ifψ (n)∈A, andδn=δψ(n)otherwise.
The assumptions on ψ imply ψ (1)∈A and π2 =ψ (1)=δ1. For ψ (2) there are two possibilities: either ψ (2)∈A (thenπ3=ψ (1)ψ (2)ψ (1) andδ2=ψ (2)), orψ (2)=1 (then π3=ψ (1)ψ (1)andδ2=ψ (1)).
Already from this example we can see that several functionsψ may lead to the same word of first lettersΔ: for instance, takingψ (2)=ψ (1)∈Ayields the same value of δ2 as taking ψ (2)=1∈N∗, but not the same value ofπ3. Using this example it is not difficult to produce functionsψandψwith the same word of first letters but such thatwψ=wψ. Therefore a word wψ with abundant palindromic prefixes is not given just by its word of first lettersΔ, but by a richer structure: the function2ψ. To be precise,ψ is given exactly by the wordΔ=δ1δ2. . . together with the choice, for anyn1, of an integern∈ {0, . . . , n−1}that satisfies either n=0 orδn=δn. If we fixΔ, then a special choice ofψis obtained by taking fornthe greatest
2 Actually one may restrict to reduced functions, see Section 4.2 below.
integern< nsuch thatδn=δn(andn=0 if there is no such integer, i.e., if the letterδnoccurs for the first time inΔ at thenth position). For this functionψ, the word wψ is the standard episturmian word with directive word Δ(see Section 3.2). Therefore Definitions 4.1 and 4.3 generalize Definition 3.1 of standard episturmian words.
Remark 4.4.Two distinct functionsψ andψalways lead to distinct sequences(πi)and(πi), but may lead to the same wordwψ=wψ(see Example 4.8 below).
Example 4.5.If ψ (n)=n−1 for anynN then πN+=πNω for any 0, withω= πN−1−1πN. Therefore in this casewψ is ultimately periodic, hence periodic with a palindromic period (see Lemma 5.6 below).
Example 4.6.Let A= {a, b}be a two-letter alphabet, and(sk)k1 be a sequence of positive integers. For any k1, let tk=s1+ · · · +sk if s12 and tk =s1+ · · · +sk+1 if s1=1.
In both cases, lett0=1. Moreover, let ψ (i)=i−1 if i1 is not amongt0, t1, t2, . . ., and ψ (tk)=tk−1−1 for anyk2. Ifs12, letψ (1)=aandψ (t1)=b; ifs1=1, letψ (1)=b andψ (t1)=a. Then the wordwψ associated withψ is the characteristic Sturmian word with slope[0, s1, s2, . . .]. The function ψ, the palindromesπi and the sequence(tk)are exactly the same as in Section 3.1 (except that the indexkintkis shifted ifs1=1).
Example 4.7.In the previous example, ifsk=1 for anyk1 then ψ (1)=b,ψ (2)=a and ψ (i)=i−2 for anyi3. The wordwψ=babbab . . .is the Fibonacci word.
4.2. Reduced functions
Two problems immediately arise from the construction of words with abundant palindromic prefixes. First, are there other palindromic prefixes ofwψthan theπi’s? Second, can two distinct functionsψandψlead to the same wordw?
In general, the answers to both questions are positive, as shown in the following example.
This is the reason whyreducedfunctions are studied below.
Example 4.8.Letψbe a function, andi2 be a integer, such thatψ (i+1)=ψ (i)=i−1. Let bibe the finite nonempty word such thatπi=πi−1bi. Thenπi+1=πi−1b2i andπi+2=πi−1bi4. Now Lemma 5.1 stated below shows thatπi−1b3i is a palindromic prefix ofπi+2(hence ofwψ), of length strictly between those ofπi+1andπi+2. This gives a palindromic prefix ofwψwhich is not among theπn’s constructed fromψ. To avoid this problem, consider a functionψsuch that ψ(n)=ψ (n)forni,ψ(i+1)=iandψ(i+2)=i+1. Denoting by(πn)the sequence of finite palindromes associated withψ, we haveπn=πnforni+1,πi+2=πi−1b3i andπi+3= πi−1b4i. Forni+3, we letψ(n)=ψ (n−1)ifψ (n−1)i+1, andψ(n)=ψ (n−1)+1 otherwise. Then we haveπn =πn−1for anyni+3, andwψ=wψ. In this way the functions ψandψdefine the same word, but the family of finite palindromes associated withψcontains the “missing” palindromeπi−1bi3.
Letψ:N∗→N∗Abe any function (in the sequel we always assume that, for eachn1, eitherψ (n)∈Aor 1ψ (n)n−1).
Denote by(tk)k0the family of all indexesn(in increasing order) such that either 1ψ (n) n−2 or ψ (n)∈A. This family can be either finite or infinite. We always havet0=1, since ψ (1)∈A.
Definition 4.9.A functionψ is said to bereducedif the associated sequence(tk)satisfies, for anyk1, the following two conditions:
• ψ (tk)=ψ (tk−1).
• Eitherψ (tk)∈Aorψ (tk) < tk−1.
In the special case where the family(tk)is finite (i.e.,ψ (n)=n−1 fornsufficiently large, see Example 4.5), we assume in this definition that both properties hold for anyk such thattk
exists.
Remark 4.10.The functionψin Example 4.6 is reduced, and the definition of(tk)given there is consistent with the one introduced here.
Remark 4.11.The functionψ in Example 4.8 is not reduced. In fact there is an integerksuch thati+1=tk, and we havetk−1i−1=ψ (tk).
In the situation of Example 4.8, we have seen thatψis not reduced, and that theπi’s are not the only palindromic prefixes ofwψ. Actually both phenomena are equivalent:
Theorem 4.12.Letψ:N∗→N∗Abe a function such that, for eachn1, eitherψ (n)∈Aor 1ψ (n)n−1. Then the following assertions are equivalent:
• The functionψis reduced.
• The palindromic prefixes ofwψare exactly theπi’s constructed fromψ.
This theorem will be proved in the next section (Section 5.3). It is not difficult to deduce the following corollary (see Example 4.5 and Lemma 5.6).
Corollary 4.13.Letψbe a reduced function. Thenwψ is periodic if, and only if,ψ (n)=n−1 for any sufficiently large integern.
Letψbe a reduced function, and(πi)be the associated sequence of finite palindromes (that is, thanks to Theorem 4.12, the sequence of all palindromic prefixes ofwψ). Then the following assertions are easily seen to be equivalent:
• For any sufficiently largeiwe haveψ (i)∈N∗.
• For any sufficiently largeiwe have|πi+1|2|πi|.
If these assertions hold thenwψ can be written on a finite alphabet.
In addition to Theorem 4.12, another important property of reduced functions is the following generalization of Theorem 4.2, proved in Section 5 below.
Theorem 4.14.Letwbe an infinite word, and(ni)i1be the increasing sequence(assumed to be infinite)of the lengths of its palindromic prefixes(withn1=0). Then the following statements are equivalent:
(i) We haveni+12ni+1for anyi1 (i.e.,whas abundant palindromic prefixes).
(ii) There exists a functionψsuch thatw=wψ.
(iii) There exists a reduced functionψsuch thatw=wψ. Moreover, the reduced functionψin(iii)is unique.
It is possible to write down a “reduction” algorithm (generalizing Example 4.8) that allows one to obtain, from any functionψ, the reduced functionψsuch thatwψ=wψ. In this situation, the construction of Section 4.1 applied withψgives a sequence(πi)of palindromic prefixes ofwψ; withψ, it gives another sequence(πi). Theorem 4.12 shows that(πi)is a sub-sequence of(πi).
Again, the “reduction” algorithm allows one to obtain explicitly the full sequence(πi)from the sub-sequence(πi). This algorithm is partly used in [9], but in the present text we shall not need it; the crucial point here is just the uniqueness of the reduced functionψcorresponding toψ.
Definition 4.15.Letwbe a word with abundant palindromic prefixes. The reduced functionψ in Theorem 4.14 is called thedirective functionofw.
Remark 4.16. The uniqueness assertion in Theorem 4.14 immediately follows from Theo- rem 4.12 and Remark 4.4.
Now we can put Definitions 4.3 and 4.15 together in the following way:
Definition 4.17.Letwbe a word with abundant palindromic prefixes. We callword of first letters associated withwthe word of first letters associated with the directive function ofw.
The following property holds: if(πi)is the sequence of all palindromic prefixes of a wordw with abundant palindromic prefixes, andΔ=δ1δ2. . .is the associated word of first letters, then πiδi is a prefix ofπi+1for anyi1.
4.3. Computation ofδ(w)using reduced functions
Definition 4.18.With any reduced functionψwe associate the increasing sequence of nonnega- tive integers(ni)i1defined byn1=0 and, for alli1:
ni+1=2ni−nψ(i) ifψ (i)∈N∗ and
ni+1=2ni+1 ifψ (i)∈A.
Theorem 4.12 shows thatni is the length of theith palindromic prefix ofwψ. In the same way, we introduce the following definition so thatδ(ψ )=δ(wψ):
Definition 4.19.For any reduced functionψwe letδ(ψ )=lim supnin+1
i , where(ni)is associated withψas in Definition 4.18.
This definition ofδ(ψ )is completely elementary. It is useful because of the following fact:
for a wordwwith abundant palindromic prefixes, we haveδ(w)=δ(ψ )whereψis the directive function ofw(see Definition 4.15).
5. Proof of the main results
5.1. General lemmas about palindromic prefixes
The first lemma is very easy, and sufficient to prove half of Theorem 4.12 (see Section 5.3 below).
Lemma 5.1.Let p andu be two words, such thatp and puare palindromes. Thenpu2 is a palindrome(and so is, by induction, the word pun for anyn2). Similarly, ifp andup are palindromes thenunpis a palindrome for anyn0.
Proof. Ifpandpuare palindromes then we havep˜=pandup˜ =puhence pu2= ˜uup˜ = ˜upu=pu2.
The case where p and up are palindromes is analogous. This concludes the proof of Lemma 5.1. 2
In particular, in this situationpuandpu2are palindromes, one is a prefix of the other, and the quotient of their lengths is less than 2 (or equal to 2 whenpis empty). The following lemma gives a kind of converse to this phenomenon (at least in the casen=n).
Lemma 5.2.Letwbe an infinite word, andn,n,nbe integers such thatnnn+n. We assume that the prefixes ofwwith lengthsn,n,nare palindromes, denoted bya,aand a, respectively. Leta0be the prefix ofwof lengthn+n−n. Then the following holds:
• There is a wordbsuch thata=a0banda=ab.
• Ifnn−nthena0is a palindrome.
Remark 5.3.This lemma will be used only whennn−n, and in this case the first property will be written
a=aa0−1a
sincea0 is both a suffix ofa and a prefix ofa. Moreover, an important special case is when n=n. The lemma then reads: if a anda are palindromes, withnn2n, thena0 is a palindrome and we havea=a0banda=a0b2.
Proof of Lemma 5.2. Asais a prefix ofa, there exists a wordbsuch thata=ab. The word bis a suffix ofa, therefore its mirror imageb˜is a prefix ofa(hence also ofw) sincea is a palindrome. Nowb˜has lengthn−nn, thereforeb˜is a prefix ofa. Asais a palindrome,b is a suffix ofa: there exists a wordcsuch thata=cb. It is clear thatc=a0is the prefix ofwof lengthn+n−n.
Assume nownn−n, and let us show thata0is a palindrome. Let 1i(n+n−n)/2;
then we haveinhence:
wn+n−n+1−i=wn−n+i=wn+1−i=wi,
by using successively that a, a and a are palindromes. This concludes the proof of Lemma 5.2. 2
Lemma 5.4.Letwbe an infinite word. Letn< nbe two consecutive lengths of palindromic prefixes ofw;let us denote byπand π the corresponding prefixes, withπ=πωfor some wordω. Then any palindromic prefixπ ofwsuch thatn|π|n+ncan be writtenπωt witht0.
Proof. Assume there is a prefix π of w, of length n, which contradicts the lemma and has minimal length. Asnandnare consecutive, we haven > n. Lemma 5.2 gives a palindromic prefixπ0ofwof lengthn− |ω|> n, such thatπ=π0ω. This contradicts the minimality ofπ, and concludes the proof. 2
Lemma 5.5.Letwbe an infinite word. Letn0< n1< n2be three consecutive lengths of palin- dromic prefixes ofw;let us denote byπ0,π1andπ2the corresponding prefixes. Then:
• eitherπ2=π1π0−1π1,
• orn2> n0+n1.
Proof. If n2n0+n1, one may apply Lemma 5.2 withn=n2,n=n0 andn=n1. Then n2+n0−n1is the length of a palindromic prefix ofw; but this length is strictly betweenn0
andn2, therefore it isn1. We get in this wayπ2=π1π0−1π1, which concludes the proof of the lemma. 2
5.2. Ultimately periodic words
Lemma 5.6.Letwbe an infinite ultimately periodic word, infinitely many prefixes of which are palindromic. Thenwis periodic with a palindromic period. Moreover, ifd denotes the smallest length of a period ofwthen there existsr∈ {1, . . . , d}with the following property. For anynd, the prefix ofwof lengthnis a palindrome if, and only if,n≡rmodd.
Proof. Ifwwere ultimately periodic but not periodic, there would exist two nonempty wordsπ0 andπ such thatw=π0π π π . . ., and such that the last letter ofπ0be different from that ofπ.
But this contradicts the assumption thatwhas arbitrary long palindromic prefixes. In fact, if we denote byz1. . . zd the wordπ and byz0=zd the last letter ofπ0, then this assumption implies that the wordzd−1. . . z0appears infinitely many times inw, and is therefore a cyclic permutation of the periodz1. . . zd. Asz0=zd, this is impossible.
Thereforewis periodic, and can be writtenw=π π π . . .with a periodπof minimal lengthd. Let nd be the length of a palindromic prefix of w. Then we have wi =wn+1−i for all i∈ {1, . . . , d}. Ifn is another such integer, not congruent ton modd, we obtain wi =wi+ε for all i∈ {1, . . . , d}with 1εd −1; this contradicts the minimality of d. Therefore all