DOI:10.1051/ita:2008010 www.rairo-ita.org
FROM BI-IDEALS TO PERIODICITY
J¯ anis Buls
1and Aivars Lorencs
2Abstract. The necessary and sufficient conditions are extracted for periodicity of bi-ideals. They cover infinitely and finitely generated bi-ideals.
Mathematics Subject Classification.68R15, 94A55, 68Q15.
1. Introduction
The periodicities are fundamental objects, due to their primary importance in word combinatorics [8,9] as well as in various applications. The study of periodicities is motivated by the needs of molecular biology [6] and computer science. Particularly, we mention here such fields as string matching algorithms [4], text compression [13] and cryptography [11].
In different areas of mathematics, people consider a lot of hierarchies which are typically used to classify some objects according to their complexity. Here we deal with the hierarchy
B⊃P, where Bis the class of bi-ideals,
Pis the class of periodic words.
This hierarchy comes from combinatorics on words, where these classes are being investigated intensively (cf. [2,8–10]). Bi-ideal sequences have been considered, with different names, by several authors in algebra and combinatorics [1,3,7,12,14].
Every bi-idealx is the limit of some bi-ideal sequence (vi). This bi-ideal se- quence can be represented uniquely by the sequence (ui), where v0 = u0 and
Keywords and phrases.Periodic words, bi-ideals, the sequence generates the bi-ideal, finitely generated bi-ideals.
1 Department of Mathematics, University of Latvia, Rai¸na bulv¯aris 19, R¯ıga, 1586, Latvia;
[email protected]; web site: http://home.lanet.lv/~buls
2 Institute of Electronics and Computer Science, Dz¯erbenes street 14, R¯ıga, 1006, Latvia;
Article published by EDP Sciences c EDP Sciences 2008
∀i≥0vi+1=viui+1vi. We characterize the periodic words through this represen- tation. At first we give an exhaustive description (Th. 3.7) of periodicity for all classes of bi-ideals. Then for periodic bi-ideals we demonstrate if everyui appears infinitely often then every ui is a power of the certain word. This leads to the effective method for finitely generated bi-ideals to check whether the bi-ideals are periodic.
2. Preliminaries
In this section we present most of the notations and terminology used in this paper. Our terminology is more or less standard (cf. [10]) so that a specialist reader may wish to consult this section only if need arise.
LetAbe a finite non-empty set andA∗ the free monoid generated byA. The set Ais also called analphabet, its elementsletters and those of A∗ finite words.
The role of the identity element is performed by theempty wordwhich is denoted byλ. We setA+=A∗\{λ}.
A word w ∈ A+ can be written uniquely as a sequence of letters as w = w1w2. . . wl, with wi∈A, 1≤i≤l, l >0. The integerl is called the lengthofw and denoted|w|. The length of λis 0. We setw0=λand∀i wi+1=wiw;
w+= ∞ i=1
{wi}, w∗ =w+∪ {λ}.
A positive integerpis called aperiodofw=w1w2. . . wlif the following condition is satisfied:
1≤i≤l−p ⇒ wi=wi+p.
We recall the important periodicity theorem due to Fine and Wilf [5]:
Theorem 2.1. Let w be a word having periods pand q and denote by gcd(p, q) the greatest common divisor ofpandq. If|w| ≥p+q−gcd(p, q), thenwhas also the periodgcd(p, q).
The word w ∈ A∗ is called a factor (or subword) of w ∈ A∗ if there exist u, v ∈ A∗ such that w = uwv. The word u (respectively v) is called a prefix (respectively asuffix) ofw. The ordered triple (u, w, v) is called anoccurrenceof w inw. The factorw is called aproperfactor ifw=w. We denote respectively byF(w), Pref(w) and Suff(w) the sets ofwfactors, prefixes and suffixes.
An (indexed) infinite wordxon the alphabet A is any total mapx : N→A. We set for anyi≥0,xi=x(i) and write
x= (xi) =x0x1. . . xn. . . The set of all the infinite words overAis denoted byAω.
The word w ∈ A∗ is a factor of x∈ Aω if there exist u∈ A∗, y ∈ Aω such thatx=uwy. The wordu(respectivelyy) is called aprefix(respectively asuffix)
of x. We denote respectively byF(x), Pref(x) and Suff(x) the sets ofxfactors, prefixes and suffixes. For any 0≤m≤n, bothx[m, n] andx[m, n+ 1) denote a factorxmxm+1. . . xn. The indexed wordx[m, n] is called anoccurrenceofw inx ifw =x[m, n]. The suffixxnxn+1. . . xn+i. . .is denoted byx[n,∞).
Ifv ∈A+ we denote byvω the infinite wordvω =vv . . . v . . .This wordvω is called aperiodic word. The concatenation ofu=u1u2. . . uk ∈A∗ andx∈Aω is the infinite word
ux=u1u2. . . ukx0x1. . . xn. . .
A word xis called ultimately periodic if there exist words u∈A∗, v ∈A+ such thatx=uvω. In this case,|u|and|v|are called, respectively, an anti-periodand aperiodofx.
A sequence of words ofA∗
v0, v1, . . . , vn, . . .
is called a bi-ideal sequence if ∀i ≥ 0 (vi+1 ∈ viA∗vi). The term “a bi-ideal sequence” is due to the fact that ∀i≥0 (viA∗vi) is a bi-ideal ofA∗.
Corollary 2.2. Let (vn)be a bi-ideal sequence. Then vm∈Pref(vn)∩Suff(vn) for allm≤n.
A bi-ideal sequencev0, v1, . . . , vn, . . .is calledproperifv0 =λ. In the following the term bi-ideal sequence will be referred only to proper bi-ideal sequences.
Ifv0, v1, . . . , vn, . . .is a bi-ideal sequence, then there exists a unique sequence of words
u0, u1, . . . , un, . . . such that
v0=u0, ∀i≥0 (vi+1=viui+1vi).
Let us consideru, v∈A∞=A∗∪Aω. Thend(u, v) = 0 ifu=v, otherwise d(u, v) = 2−n,
where
n= max{ |w| |w∈Pref(u)∩Pref(v)}. It is called aprefix metric.
Let v0, v1, . . . , vn. . . be an infinite bi-ideal sequence, where v0 = u0 and
∀i ≥ 0 (vi+1 = viui+1vi). Since for all i ≥ 0 the word vi is a prefix of the next wordvi+1 the sequence (vi) converges, with respect to the prefix metric, to the infinite wordx∈Aω
x=v0(u1v0)(u2v1). . .(unvn−1). . .
This wordxis called abi-ideal. We say the sequence (ui)generatesthe bi-idealx.
Convention. Let x be a bi-ideal generated by (ui), then x = lim
i→∞vi, where v0=u0 andvi+1=viui+1vi. We adopt this notational convention henceforth.
Letxbe an infinite word. A factoruofxis calledrecurrentif it occurs infinitely often inx. The wordxis calledrecurrentwhen any of its factors is recurrent.
Proposition 2.3. (see, e.g., [10]) A word x is recurrent if and only if it is a bi-ideal.
Lemma 2.4. (see, e.g., [10]) Let x∈Aω be an ultimately periodic word. Ifxis recurrent, then xis periodic.
Due to this lemma we can restrict ourselves. Therefore we investigate only the periodicity of bi-ideals and say nothing about ultimate periodicity.
3. The periodicity of bi-ideals
The following three lemmas are very easy, but they turn out to be extremely useful:
Lemma 3.1. If x=wω and T is the minimal period of the word x, then T\|w|, i.e. T divides |w|.
Proof. Letn=T|w|, then bothT and|w|are periods of the wordx[0, n). Hence (Th.2.1)t= gcd(T,|w|) is a period ofx[0, n). Now we have
∀i x[0, n) =x[ni, n(i+ 1)).
Thereforet is a period ofx. Since T is the minimal period of the word x, then t≥T ≥gcd(T,|w|) =t. HenceT = gcd(T,|w|), therebyT\|w|.
Lemma 3.2. If x=wω=uvyand|w|=|v|, thenvy=y=vω.
Proof. Let|w| =t and |u| =k+ 1, then v =xk+1xk+2. . . xk+t, since |v| =|w|.
We have∀i xi+t=xi, therefore
∀j∈1, t∀s xk+j=xk+j+st.
Lemma 3.3. If ∃u∈ A+ ux = x∈ Aω, then a word x is periodic with the minimal periodT\|u|.
Proof. Letu=a1a2. . . at−1, where∀j aj∈A, and y=ux, then
∀i xi=yi+t. Let
y=ux=x . Hence
∀i yi =xi=yi+t.
This means thatyis periodic with a periodt. Sincey=x, thenxis periodic with a period t too. Let T is the minimal period of x, then by Lemma 3.1 T\t, i.e.
T\|u|.
Corollary 3.4. Let |v| be the minimal period ofx=vω. If v=x[k, k+|v|) then |v|\k.
Proof. If, for any k,v=x[k, k+|v|), then (see Lem.3.2) x=x[0, k)vω=x[0, k)x.
Hence by Lemma3.3|v|\|x[0, k)|=k.
Lemma 3.5. If existsn such thatvnu∈v∗ and∀i∈Z+(un+i∈uv∗), then
∀i∈N(vn+i∈v∗vn). Proof. Ifi= 0 thenvn+i=vn=λvn∈v∗vn.
Further, we shall prove the lemma by induction on i, i.e., suppose that vn+i ∈v∗vn, namely,
∃k∈N(vn+i=vkvn). By assumption,vnu∈v∗ andun+i+1∈uv∗,i.e.
∃l∈N(vnu=vl) ∧ ∃m∈N(un+i+1=uvm). Hence
vn+i+1 = vn+iun+i+1vn+i= (vkvn)(uvm)(vkvn)
= vk(vnu)vm+kvn=vkvlvm+kvn∈v∗vn.
We have completed the inductive step.
Lemma 3.6. If tis the period of the bi-ideal xand|vn| ≥t, then
∀i∈Z+un+1x=un+ix .
Proof. We havevn+i=vn+i−1un+ivn+i−1. Hence, ifi∈Z+ then (Cor.2.2)
∀i∈Z+∃vi vn+i =vnvivn. Now, by definition ofx
x = vnun+1vn. . .
x = vn+iun+i+1vn+i. . .=vnvivnun+i+1vn. . . By assumption,xis periodic, therefore
x=vω, where |v|=t .
Sincev∈Pref(vn) then by Lemma3.2
x = vnun+1x , x = vnun+i+1x .
Hence∀i∈Z+x=vnun+ix .Thus∀i∈Z+ un+1x=un+ix . Theorem 3.7. A bi-idealxis periodic if and only if
∃n∈N∃u∃v(vnu∈v∗ ∧ ∀i∈Z+un+i∈uv∗).
Proof. ⇒LetT be the minimal period of the wordx, then∃n∈N|vn| ≥T. Thus by Lemma3.6
∀i∈Z+ un+1x=un+ix . Letube the longest word of the set∞
i=1Pref(un+i) then
∀i∈Z+∃ui(un+i=uui). Particularly,∃k un+k=u. This means that
∀i∈Z+ uuix=un+ix=un+kx=ux . Thus
∀i∈Z+ uix=x . Hence by Lemma3.3
∀i∈Z+ T\|ui|. Thereby
∀i∈Z+ ui∈v∗, wherev=x[0, T). Thus
∀i∈Z+ un+i=uui∈uv∗. Note
x=vnun+1vn. . .=vnuu1vn. . .
Sinceu1 ∈v∗ and v ∈Pref(vn), then [Lemma3.2] x=vnux. Hence [Lem.3.3]
vnu∈v∗.
⇐By Lemma3.5
∀i∈N∃ki∈Nvn+i=vkivn. Since lim
k→∞|vk|=∞then lim
i→∞ki=∞. Thus x= lim
k→∞vk = lim
i→∞vn+i= lim
i→∞vkivn =vω.
4. Powers
Observation. If allui∈w∗ for some wordw =λ, then the bi-ideal generated by (ui) is periodic.
The following example demonstrates the converse is not true in general.
Example 4.1. Letxbe the bi-ideal generated by (ui), where u0 = 0,
u1 = 1,
∀i >1 ui = 00100. Then
v0 = 0, v1 = 010,
v2 = 010 00100 010,
v3 = 01000100010 00100 01000100010, . . .
andx= lim
i→∞vi= (0100)ω. Thusxis periodic.
Nevertheless, if every uj appears infinitely often in (ui), then the converse is valid.
Theorem 4.2. Let(ui)be a sequence of words, which contains everyuj infinitely often. The bi-idealxgenerated by (ui)is periodic if and only if
∃w∀i ui∈w∗.
Proof. ⇒Letxbe a periodic bi-ideal, then by Theorem3.7
∃n∈N∃u∃v(vnu∈v∗ ∧ ∀i∈Z+un+i∈uv∗).
Hence by Lemma3.5 |v|is the period ofx. Therefore we can assume that |v|is the minimal period ofxand|u|<|v|. Since the sequence (ui) contains everyuj
infinitely often then by Theorem3.7 ∀i∈N(ui ∈uv∗).
Now suppose thatui=ufor alli < mbutum=uvk, wherek >0. Then there existα∈Z+ andy such that
x=uαvky . (i) Ifu=λthen∀i ui∈v∗.
(ii) Otherwiseu=λ. Then (Corollary3.4)|v|\α|u|. Hence, there existsβ∈Z+
such thatα|u|=β|v|. Thusx=vω=uω. Contradiction, since|u|<|v|and|v|is the minimal period ofx.
⇐See Observation.
Now we turn our attention to the problem of effectiveness.
Definition 4.3. Assume that (ui) generates a bi-idealx. The bi-idealxis called finitely generatedif
∃m∀i∀j(i≡j(modm)⇒ui =uj).
In this situation, we say that the m–tuple (u0, u1, . . . , um−1) generates the bi- idealx.
Theorem 4.4. A bi-ideal x generated by (u0, u1, . . . , um−1) is periodic if and only if
∃w∀i∈0, m−1 ui∈w∗.
Proof. As a corollary from Definition4.3and Theorem4.2.
This theorem gives a method to generate nonperiodic bi-ideals. Let (u0, u1, . . . , um−1)
be anym-tuple chosen at random. Letv be any shortest word from the set {u0, u1, . . . , um−1}
andw be the shortest prefix of v such thatv ∈w+. If there exists ui such that ui∈/ w∗then the bi-ideal generated by (u0, u1, . . . , um−1) is not periodic. This can be easily checked by a deterministic algorithm.
Acknowledgements. The useful suggestions of two referees are gratefully acknowledged.
References
[1] D.B. Bean, A.E. Ehrenfeucht and G. McNulty. Avoidable patterns in strings of sym- bols.Pacific J. Math.85(1979) 261–294.
[2] J. Berstel, J. Karhum¨aki.Combinatorics on Words — A Tutorial.TUCS Technical Report (No. 530, June) (2003).
[3] M. Coudrain and M.P. Sch¨utzenberger. Une condition de finitude des mono¨ıdes fin- iment engendr´es.C.R. Acad. Sci. Paris, S´er. A262(1966) 1149–1151.
[4] M. Crochemore and W. Rytter. Squares, cubes, and time-space efficient string searchinng.Algorithmica13(1995) 405–425.
[5] N.J. Fine, H.S. Wilf. (1965) Uniqueness theorem for periodic functions.Proc. Amer.
Math. Soc.16(1965) 109–114.
[6] D. Gusfield. Algorithms on Strings, Trees, and Sequences. Cambridge University Press (1997).
[7] N. Jacobson. Structure of Rings. American Mathematical Society, Providence, RI (1964).
[8] M. Lothaire.Combinatorics on Words.Encyclopedia of Mathematics and its Appli- cations, Vol. 17. Addison-Wesley, Reading, Massachusetts (1983).
[9] M. Lothaire.Algebraic Combinatorics on Words.Encyclopedia of Mathematics and its Applications, Vol. 90. Cambridge University Press, Cambridge (2002).
[10] Aldo de Luca, Stefano Varricchio.Finiteness and Regularity in Semigroups and For- mal Languages.Springer-Verlag, Berlin, Heidelberg (1999).
[11] R.A. Rueppel. Analysis and Design of Stream Ciphers. Springer-Verlag, Berlin (1986).
[12] I. Simon. Infinite words and a theorem of Hindman. Rev. Math. Appl. 9 (1988) 97–104.
[13] J.A. Storer. Data compression: methods and theory. Computer Science Press, Rockville, MD (1988).
[14] A.I. Zimin. Blocking sets of terms.Matem. sb.,119, 363–375(Russian) (1982).