Strongly cyclic languages
Marie-Pierre Beal1, Olivier Carton2 and Christophe Reutenauer3
1 LITP - Institut Blaise Pascal, Universite Denis Diderot 2 Place Jussieu 75251 Paris cedex 05.[email protected]
2 Institut Gaspard Monge, Universite de Marne-la-Vallee 93166 Noisy le Grand cedex.[email protected]
3 Mathematiques, Universite du Quebec a Montreal C.P. 8888, succ. Centre-Ville, Montreal Canada H3C 3P8.
Abstract. We prove that cyclic languages are the boolean closure of languages called strongly cyclic languages. The result is used to give another proof of the rationality of the zeta function of rational cyclic languages.
1 Introduction
Cyclic languages and strongly cyclic languages are two classes of languages of nite words over a nite alphabet. A cyclic language is conjugation-closed and for any two words having a power in common, if one of them is in the language, then so is the other. A strongly cyclic language is the set of words stabilizing a subset of the set of states of a nite deterministic automaton, the subset stabilized depending on the word stabilizing it. One says that the language stabilizes the automaton. A strongly cyclic language is rational.
We prove that a rational cyclic language is a boolean combination of strongly cyclic languages. More precisely, each rational cyclic language can be written as a chain of strongly cyclic languages. This result allows us to extend the com- putation of the zeta function (and generalized zeta function) of strongly cyclic languages done in [Bea95] to the class of rational cyclic languages. The zeta function of a formal languageLis(L) = exp(Pan znn), wherean is the number of words of lengthninL. The motivations of this denition and the connections with algebraic geometry and symbolic dynamics are discussed in [BR90]. The zeta function of a strongly cyclic languageL is equal to the zeta function of the soc system dened by the nite automaton stabilized byL. The rationality and computability of the zeta function of a soc system have been established in [Bow78] and [Man71]. The formula of computation given in [Bow78] are proved in [Bea95] by the use of a construction on nite automata called external power.
The rationality of the zeta function of a rational cyclic language has been es- tablished in [BR90]. The result we give here leads to another proof and to a dierent computation.
We assume that the reader knows the basics of formal languages (see [Eil72]).
We also assume that the reader is familiar with the elementary notions of semi- group theory. For example, notions like syntactic monoid, Green relations, regu- larD-classes, minimal ideal and 0-minimal ideal are supposed to be known. We refer to [Lal79] and [Pin86] for a presentation of this subject.
The paper is organized as follows. Section 2 and 3 give the basic properties of cyclic languages and strongly cyclic languages. The chain-decomposition of a rational cyclic language in strongly cyclic languages is established in section 4.
The computation of the zeta function and the generalized zeta function is done in the last section.
2 Cyclic languages
In this section, we introduce cyclic languages and give some basic properties. In the following, we denote byAa nite alphabet. In the sequel,Mwill always de- note a nite monoid. Every elementsofMhas a power which is an idempotent.
We denote bys!this idempotent.
Denition1.
A languageLofA is said to be cyclic if it satises8u2A; 8n >0 u2L ,un2L
8u;v2A uv2L,vu2L
A language is cyclic if it is closed under conjugation, power and root. IfLis a submonoid ofA which is cyclic, it is then pure [BP84].
Example 1. IfA =fa;bg, the languageL =AaA=A b of words having at least oneais cyclic.
Example 2. The language
L=fapbn1an2bn2:::ankbnkaq jni0 andp+q=n1g[
fbpan1bn1an2bn2:::ankbq jni0 andp+q=nkg is cyclic but not rational.
We will now only consider rational cyclic languages. Rational cyclic languages have the following straightforward characterization in terms of nite monoids.
Proposition2.
Let LA be a rational language. Let ':A!!M be a mor- phism from A onto a monoidM such that L = ' 1(P). The languageL is cyclic if and only if8s2M; 8n >0 s2P ,sn 2P
8s;t2M st2P , ts2P
From the previous characterization, we deduce some useful facts about the structure of the image of a rational cyclic language onto a nite monoid recog- nizing this language. We also deduce a property of the syntactic monoid of a cyclic language.
Corollary3.
Let ': A!!M be a morphism from A onto a monoidM such thatL=' 1(P). LetH a regularH-class ofM. One hasH P orH\P =;. Proof. Let us suppose h1 2 H belongs to P. For anyh2 2 H, we have h!1 = h!2 =ewhereeis the idempotent ofH. We then haveh!1 =h!2 2P andh22P.Corollary4.
Let ': A!!M be a morphism from A onto a monoidM such thatL=' 1(P). LetH1 andH2 be two regularH-classes of a regularD-class.If one hasH1P, one also has H2P.
Proof. Lete1ande2be the respective idempotents ofH1andH2. As two idem- potents of a sameD-class are conjugated (see [Pin86]), there are two elements x1 andx2 ofM such that x1x2 = e1 and x2x1 = e2. If H1 P, we have e1=x1x22P and thene2=x2x12P and theH-classH2 satisesH2P by the previous corollary.
Corollary5.
The syntactic monoid of a cyclic language has a zero.Proof. LetMbe the syntactic monoid of a rational cyclic language and letDthe minimal ideal ofM. Then D is a completely regularD-class. By the previous corollary, we have D P or D\P = ;. Let s be an element ofD. For any x;y 2 M, we havexsy 2D because D is the minimal ideal ofM. If we have D P, the contexts ofsareMM. If we haveD\P =;, the contexts ofs are ;;. In both cases, all the elements ofD are equivalent for the Nerode congruence, andDhas only one element. The syntactic monoid ofLhas then a zero.
3 Strongly cyclic languages
We now dene the notion of a strongly cyclic language.
Denition6.
LetA= (Q;A;E) be a deterministic nite automaton whereQ is the set of states andE the set of transitions. We say that a wordwstabilizes a subsetP Qof states if we haveP:w=P. This means8p2P p:w2P
8p02P 9p2P p:w=p0
We denote by Stab(A) the set of the wordsw such thatw stabilizes a sub- setP of states in the automatonA. It should be noticed that in this denition the subsetP of states stabilized byw may depend onw. We point out that the empty word"stabilizes the setQand therefore belongs to Stab(A) for any automatonA. We say that a languageLis strongly cyclic if there is an automa- tonAsuch thatL= Stab(A). In this case, we say that the languageLstabilizes the automatonA. The terminology is justied since strongly cyclic languages are cyclic. It could be proved directly but we shall obtain this fact as a consequence of the characterization of strongly cyclic languages.
1
1 2
a b
A
1
A
2 b
Fig.1.AutomataA1 andA2
Example 3. The languages (b+aa)+ (aba)+a andb are respectively the strongly cyclic languages associated with the automataA1andA2 of Figure 1.
The following result gives a characterization of the wordsw stabilizing a subset of states in an automaton.
Proposition7.
LetA= (Q;A;E) be a deterministic nite automaton. A wordw stabilizes a subsetP of states inAif and only if there is some stateqofAsuch that for any integern, the transitionq:wn exists.Proof. Suppose rst that the wordw stabilizes the subsetP of states. By de- nition, for any statep2P, the transitionp:wn exists.
Conversely, suppose all the transitionsq:wnexist for some stateqofA. Since the automaton is nite, there are two integersl < msuch thatq:wl=q:wm. Let P be the setfq:wi jlimg. It is straightforward that the wordwstabilizes the subsetP.
The following theorem gives a characterization of the strongly cyclic lan- guages.
Theorem8.
LetLbe a rational language dierent fromA. The following con- ditions are equivalent.1. The languageL is strongly cyclic.
2. There is a morphism ' from A onto a monoidM having a zero such that L=' 1(fs2M js!6= 0g).
3. The syntactic monoidM(L) ofL has a zero and the image ofLin M(L) is
fs2Mjs!6= 0g.
Proof. Suppose rst that the language stabilizes the automatonA. Let M the transition monoid ofA and ' the canonical morphism from A ontoM. We show then that this monoid has a zero and that the image ofL is equal to
fs2 M j s! 6= 0g. Letw be a word not belonging toL. By Proposition 7, for eachq2Q, there is an integernq such that the transitionq:wnq does not exist.
For n greater than everynq, the transitions q:wn do not exist for anyq. The transition induced bywn is then the empty transition and the element '(wn)
is a zero of the monoidM. This means that '(w)! = 0. On the contrary, for any wordw2L, the transition induced bywn is not the empty transition since there is a state q 2 Q such that the transition q:wn exists. This proves that '(w)!6= 0. We have then proved thatLis equal to' 1(fs2Mjs!6= 0g)
Suppose now there is a morphism'fromAonto a monoidN having a zero such thatL=' 1(ft2N jt!6= 0g). Since the morphism is onto, the syntactic monoidMofLis a quotient ofN: there is morphism :N!!MfromNontoM. The image (0) of the zero ofNis then a zero ofM. Since the zero ofNdoes not belong to the image ofL, the zero ofMdoes not belong to the image ofL. Lett a element ofN such thatt!= 0. We have (t)!= (t!) = 0. On the contrary, if t! 6= 0, the element t! belongs to the image ofL, and so does (t!). This implies (t!)6= 0. Finally, we haveft2N jt!6= 0g= 1(fs2Mjs!6= 0g).
Suppose that the syntactic monoid M ofL has a zero and that the image ofL in M isfs2M j s!6= 0g. We denote by'the canonical morphism from AontoM. We build the following deterministic automatonA= (Q;A;E). The set of states ofA is the setQ=M f0gof the non-zero elements ofM. The transitionq:aisq:a=q'(a) ifq'(a)6= 0 and does not exist otherwise. It can be easily checked that a transitionq:w is q:w=q'(w) if q'(w)6= 0 and does not exist otherwise. We show now that the languageLstabilizes the automatonA. Letw a word inL. For q ='(w), the transitionq:wn is q:wn ='(w)n+1 and exists since'(w)n+1 6= 0. On the contrary, for a wordw not inL, there is an integerm such that '(w)n = 0. The transition q:wn does not exist for anyq. By the previous Proposition, the languageL stabilizes the automatonL. This nishes the proof.
Corollary9.
The previous characterization shows that strongly cyclic languages are cyclic.1
P
*
*b
Fig.2.Structure of the syntactic monoid ofL.
The previous theorem can be used to prove that a given language is not strongly cyclic. Without this characterisation, such results are sometimes hard to obtain.
Example 4. The syntactic monoid of the languageL=AaAis the two elements monoidM =fb= 1;a= 0g. The D-class structure ofM is shown in Figure 2.
The image ofLinM is the singletonf0gand the previous theorem states that the languageLis not strongly cyclic.
4 Decomposition of cyclic languages
In this section, we prove the main result.
By the denition of cyclic languages, a boolean combination of cyclic lan- guages is still a cyclic language. In particular, a boolean combination of strongly cyclic languages is a rational cyclic language. The following result gives some converse.
Theorem10.
Any rational cyclic language is a boolean combination of strongly cyclic languages.The proof of the theorem is based on the following lemma. By a strict quotient ofM, we mean a quotient which is strictly smaller thanM.
Lemma11.
Let L be a rational cyclic language and ' : A!!M a morphism fromAonto a nite monoidMsuch thatL=' 1(P). Let suppose furthermore that the monoidM has a zero and that this zero does not belong toP.Then, eitherLis recognized by a strict quotient ofMor there exists a strongly cyclic languageL0 such thatLL0 and such that the languageL0 Lis recog- nized by a strict quotient ofM.
In both cases, the zero of the quotient does not belong to the image of the language (L in the rst case andL0 Lin the second case).
Proof. Let P the image ofL inM. SupposeD1;:::;Dn are the 0-minimal D- classes ofM. For anys2Diand x;y2M, we havexsy= 0 orxsy2Di.
SupposeD1satisesD1\P =;. For anyx;y2M, we havexsy62P. All the elements ofD1are equivalent to 0 by the Nerode congruence. The languageLis then recognized by the Rees quotientM=I whereI is the idealI =D1[f0g.
We can suppose that everyDi satises Di\P 6=;. There exists then si 2
Di\P. Since si 2 P, the idempotent s!i is not zero and belongs then toDi
because thisD-class is 0-minimal. The elementsi belongs then to a regularH- classHi ofDi. Let s be an element ofDi. If s! = 0, the elements does not belong toP because 0 does not belong toP. On the contrary, If s! 6= 0, the elements belongs to a regular H-classHi0 ofDi. Since Hi \P 6= ;, we have HiP andHi0 P by Corollaries 3 and 4. Finally, we have proved that
Di\P=fs2Dijs!6= 0g
LetP0 be dened byP0 =fs2M j s!6= 0g. By Theorem 8, the language L0 = ' 1(P0) is strongly cyclic. It is straightforward that P P0. Since we haveDi\(P0 P) =;, the languageL0 Lis recognized by the Rees quotient M=I where the ideal is equal tof0g[Sni=1Di. This quotient is strictly smaller thanM and this nishes the proof of the lemma.
The following lemma states that the class of strongly cyclic languages is closed under union and intersection.
Lemma12.
Let L1 and L2 be two strongly cyclic languages. Both languages L1[L2 andL1\L2 are then strongly cyclic.Proof. We suppose that L1 andL2 respectively stabilizes the automata A1 = (Q1;A;E1) and A2 = (Q2;A;E2). We can suppose that Q1 \Q2 = ;. The languageL1[L2stabilizes then the automatonA1[A2. The languageL1\L2 stabilizes the automatonA1A2= (Q1Q2;A;E3) where the transitionE3is dened by (p1;p2):a= (q1;q2) if the transitionsp1:a=q1 andp2:a=q2exist.
We can now complete the proof of the theorem.
Proof. We prove that every cyclic languageL can be written as a chain of strongly cyclic languages. This means that there are strongly cyclic languages L1;:::;Ln satisfyingL1L2Ln such that
L=L1 L2+L3 Ln
We prove the result by induction on the size of a nite monoidM having a zero and recognizing the languageL. We suppose that there is a morphism': A!!MfromAonto a nite monoidMsuch thatL=' 1(P). We also suppose that the monoidM has a zero. By Corollary 5, the syntactic monoid ofL has this property. If the monoidM has only one element, the languageLis either; orAwhich are both strongly cyclic. The empty language;stabilizes the empty automaton. The full language stabilizes the automaton having one state and a transition for each letter from this state to this state.
If the zero ofM belongs to the image ofL inM, we replace L by A L which is also cyclic. It is then sucient to prove the result forA L. Indeed, if the complementA LofLcan be written as a chainA L=L1 L2+Ln, the languageLcan be writtenL=A L1+L2 Lnwhich is also a chain of strongly cyclic languages.
We can now suppose that the zero ofMdoes not belong to the imageP ofL inM. By Lemma 11, either L is recognized by a strict quotient of M and the induction hypothesis immediately applies or there is a strongly cyclic languageL0 such that L0 L is recognized by a strict quotient ofM. By the induction hypothesis, the language L0 L can be written as a chain of strongly cyclic languages, i.e.,L0 L=L2 L3+Ln. The languageLcan be then written as the chainL=L1 L2+Ln where the languageL1is equal toL0[L2 which is strongly cyclic by Lemma 12.
We point out that the zero of the smaller monoid recognizing L0 L does not belong to the image ofL0 L. It is not necessary to replace this language by its complement any more.
We give here an example.
*
*
* a
*
*
*1
ab
bab = 0
P
P’
aab aa b
aba ba
Fig.3.Structure of the syntactic monoid ofL.
Example 5. LetLbe the language (b+aa)+ (aba)+a b. The structure of the syntactic monoid ofLis given on gure 3. The imageP ofLin M(L) is equal toP =fa;aa;aba;aabg.
The subsetP0 dened in the proof is equal toP0 =f1;a;aa;b;aba;aabgand the languageL0 is (b+aa)+ (aba)+a. The languageL0 L is then equal tobwhich is strongly cyclic. The languagesL0andL0 Lstabilize respectively the automataA1 andA2 (see Figure 1 p. 4).
We have directly proved that every rational cyclic language can be written as a chain of strongly cyclic languages. In fact, it is just necessary to prove that rational cyclic languages are boolean combination of strongly cyclic languages.
A general result states that if a classF of sets is closed under union and in- tersection, every set belonging to the boolean closure ofF can be written as a chain of sets ofF. For further details see [Car93] (chapter 3).
5 Zeta function of a cyclic language
We rst give the denitions of generalized zeta function and zeta function of a language of nite words over a nite alphabetA.
If A is a nite alphabet, we note
Z
hhAii (resp.Z
[[A]]) the algebra of non commutative (resp. commutative) formal series with coecients inZ
over thealphabetA. The subset of non commutative polynomials is denoted by
Z
hAi. Wenote' the natural algebra homomorphism from
Z
hhAii toZ
[[A]] which makes the letters commute. For example,'(2ab 3ba) = ab. We notethe morphism fromZ
[[A]] toZ
[[z]] dened by(a) =z for each letteraofA.LetLbe a language of nite words overA, we noteLthe characteristic series ofL. This series belongs to
Z
hhAiiand admits the decomposition:L= X
w2Lw=X
n0Ln; whereLn is the homogeneous part of degreenofL.
Denition13.
The generalized zeta function of a languageLover the alphabet Ais now the following commutative series:Z(L) = exp(X
n1
'(Ln) n ):
Denition14.
The zeta function of a languageL over the alphabet A is the following series :(L) =(Z(L)) = exp(X
n1
anzn n ); wherean is the number of words ofLof lengthn.
It is shown for example in [Bea95] that the generalized zeta function of a strongly cyclic languageLof an automatonAis the generalized zeta function of the soc system dened byA, that is the set of bi-innite words that are labels of bi-innite paths of A. The zeta function of a soc system counts periodic orbits of the symbolic dynamic system. The zeta function of a strongly cyclic language is a rational series. The computation of the generalized zeta function and the zeta function of a strongly cyclic language was done in [Bea95] by using a construction on nite automata called external power.
If A= (Q=f1;2;:::;ng;E;T) is a deterministic automaton, the external power of order k, where 1 k jQj, of the automaton A is the automaton (Q0;E0) labelled in f 1;1gA, where Q0 = f(i1;i2;:::;ik)1i1<i2<<ikng. There exists an edge labelled()afrom (i1;i2;:::;ik) to (j1;j2;:::;jk) if for each lwith 1 l k, there exists one edge in E labelled a going out from il and (j1;j2;:::;jk) is the image of (i1a;:::;ika) by a permutation of signature (). The automatonAis equal to its external power of order 1 by identication of +atoa. The matrix associated to an automaton labelled onf 1;1gAis the square matrix (xij)1i;jn wherexpqis the sum (in
Z
hAi) of the labels of edges fromptoq. The commutative matrix associated is the matrix ('(xij))1i;jn.We denote byQi the commutative matrix associated to the external power of orderiof the automatonA. We then have (see [Bea95])
Z(L) =Yn
i=1(det(I Qi))( 1)i whereI is the identity matrix of the same size asQi.
Computation of the zeta function of a cyclic language
The result of section 4 can be used to extend the previous computation of zeta functions of strongly cyclic languages to all cyclic languages. This gives an other proof of the rationality of the zeta function of a cyclic language established in [BR90]. The computation is the following:
LetL be a cyclic language. By section 4 it can be written as a chain L1 L2++ ( 1)r 1Lr, where Lj+1 Lj for 1 j (r 1) and where all Lj
are strongly cyclic languages. By denition of the generalized zeta function we have:
Z(L) = exp(X
n1
'(Ln) n )
= exp(X
n1 r
X
j=1( 1)j 1'(Ljn) n )
= exp(Xr
j=1( 1)j 1X
n1
'(Ljn) n )
=Yr
j=1exp(X
n1
'(Ljn) n )( 1)j 1
=Yr
j=1(Z(Lj))( 1)j 1:
Example 6. We compute the generalized zeta functionZ(L) and the zeta function (L) of the cyclic language L = (b+aa)+ (aba)+a b introduced in example 5. The languageLadmits the chain-decompositionL=L1 L2where L1= Stab(A1) (see gure 1) andL2= Stab(A2) (see gure 1). We get:
Z(L1) = j1 +aj
1 b a
a 1
Z(L2) = 1
j1 bj Z(L) = Z(L1)
Z(L2) =(1 +a)(1 b)
1 b aa
(L) = 1 z2 1 z z2:
References
[Bea93] Marie-Pierre Beal. Codage symbolique. Masson, 1993.
[Bea95] Marie-Pierre Beal. Puissance exterieure d'un automate deterministe, ap- plication au calcul de la fonction z^eta d'un systeme soque. R.A.I.R.O.- Informatique Theorique et Applications, 29(2):85{103, 1995.
[Bow78] Rufus Bowen. Symbolic dynamics. In On axiom A dieomorphism, num- ber 35 in CBMS Reg. Conf. American Mathematical Society, 1978.
[BP84] Jean Berstel and Dominique Perrin. Theory of codes. Academic Press, 1984.
[BR90] Jean Berstel and Christophe Reutenauer. Zeta functions of formal languages.
Trans. Amer. Math. Soc., 321:533{546, 1990.
[Car93] Olivier Carton. Mots innis, !-semigroupes et topologie. These, Universite Paris 7, 1993. Rapport LITP-TH 93-08.
[Eil72] S. Eilenberg. Automata, languages and machines, volume A. Academic Press, New York, 1972.
[Lal79] Gerard Lallement. Semigroups and combinatorial applications. Wiley, 1979.
[Man71] A. Manning. Axiom A dieomorphisms have rationnal zeta fonctions. Bull.
London Math. Soc., 3:215{220, 1971.
[Pin86] Jean-Eric Pin. Varieties of formal languages. North Oxford, London and Plenum, New-York, 1986. (Traduction deVarietes de langages formels).
This article was processed using the LaTEX macro package with LLNCS style