HAL Id: hal-00619203
https://hal-upec-upem.archives-ouvertes.fr/hal-00619203
Submitted on 5 Sep 2011
HAL is a multi-disciplinary open access
archive for the deposit and dissemination of
sci-entific research documents, whether they are
pub-lished or not. The documents may come from
teaching and research institutions in France or
L’archive ouverte pluridisciplinaire HAL, est
destinée au dépôt et à la diffusion de documents
scientifiques de niveau recherche, publiés ou non,
émanant des établissements d’enseignement et de
recherche français ou étrangers, des laboratoires
Determinization of transducers over finite and infinite
words
Marie-Pierre Béal, Olivier Carton
To cite this version:
Marie-Pierre Béal, Olivier Carton. Determinization of transducers over finite and infinite words.
Theoretical Computer Science, Elsevier, 2002, 289 (1), pp.225-251. �hal-00619203�
over nite and innite words
Marie-Pierre B
eal InstitutGaspardMonge, UniversitedeMarne-la-Vallee http://www-igm.univ-mlv.fr/~bea l/
Olivier Carton InstitutGaspardMongeandCNRS
UniversitedeMarne-la-Vallee http://www-igm.univ-mlv.fr/ ~ art on/
Mar h 27,2001
Abstra t
We studythe determinization of transdu ers over niteand innite words. Therstpartofthepaperisdevotedtonitewords. Were allthe hara terizationofsubsequentialfun tionsduetoChorut. Wedes ribe hereaknownalgorithmtodeterminizeatransdu er.
In the ase of innite words, we onsider transdu ers with all their statesnal. Wegiveanee tive hara terization ofsequentialfun tions overinnitewords. Wedes ribeanalgorithmtodeterminizetransdu ers overinnitewords. Thispart ontainsthemainnovelresultsofthepaper.
1 Introdu tion
The aim of this paper is the study of determinization of transdu ers, that is ofma hines realizingrational transdu tions. A transdu eris anitestate au-tomaton(or anitestate ma hine) whoseedges arelabeledby pairsofwords takenin nite alphabets. Therst omponent ofea hpair is alled theinput label. These ondonetheoutputlabel. Thetransdu ersthatwe onsiderhave a epting(ornal)states. Su htransdu ersaresometimes alleda-transdu ers (a for a epting). The rational relation dened by a transdu er is the set of pairs of words whi h are labels of an a epting path in the transdu er. We assumethat the relationsdened by ourtransdu ers are fun tions. This is a de idableproperty.
The study of transdu ers has many appli ations. Transdu ers are used to model oding s hemes ( ompression s hemes, onvolutional oding s hemes,
omputerarithmeti [17℄and innaturallanguagepro essing[25℄. Transdu ers arealsousedin programsanalysis [14℄. Thedeterminizationofatransdu eris the onstru tionofanothertransdu erwhi hdenesthesamefun tionandhas adeterministi (orrightresolving)inputautomaton. Su htransdu ersallowa sequentialen odingandthusare alledsequentialtransdu ers.
Intherstpartofthepaper,wepresentashortsurveyofthe determiniza-tionoftransdu ers realizingfun tions overnite words. Ourtransdu ers may havenalstates. Wepresentsomeknownresultsaboutsubsequentialfun tions, thatisfun tions that anberealizedbytransdu erswithadeterministi input butthat mayhaveanoutputfun tion dened onstates. Thenotionof subse-quential fun tions has beenintrodu ed by S hutzenberger [28℄. We re all the hara terizationofsubsequentialfun tions obtainedbyChorut [11,12℄. This hara terizationgivesade isionpro edureforthesubsequentialityoffun tions denedbyatransdu er. Ithasbeenprovedin[30,31℄thatthis anbede ided inpolynomialtime. Wegiveanotherproofofthisresultwhi hisa onsequen e ofthede idability in polynomialtime of fun tionality overinnitewords[10℄. Anotherproofofthesameresultisgivenin[4℄. Thede idabilityoffun tionality wasalreadyprovedbyGire[18℄. Wealsodes ribethealgorithmtodeterminize atransdu er. Thisalgorithmtakesareal-timetransdu erwhi hrealizesa sub-sequentialfun tion and outputsasubsequentialtransdu er. This algorithmis a tually ontainedin the proof of Chorut [11, 12℄ (see also [5, p. 109{110℄). This algorithm has also beendes ribed byMohri [22℄ and Ro he and Shabes [25,p.223{233℄.
The determinization of a transdu er realizing a subsequential fun tion f provides a subsequentialtransdu er realizing f. If the fun tion is sequential, this subsequentialtransdu er anbe transformedinto asequentialone. This anbeobtained by thenormalization of atransdu er introdu ed by Chorut [12, 13℄. EÆ ient algorithmsthat ompute thenormalizationhavebeengiven in[21,23℄, [8,9℄and[2℄.
Inthese ondpartofthepaper,we onsidertransdu ersandfun tionsover innitewordsandourtransdu ershavealltheirstatesnal. Thereasonwhywe assumethatallstatesarenal isthat the aseof transdu erswithnal states seemstobemu hmore omplex. Indeed,thedeterminizationofautomataover innitewordsisalreadyverydiÆ ult[26℄. Inparti ular,itisnottruethatany rationalset of innitewords is re ognized by adeterministi automatonwith nal states. Other a epting onditions, asthe Muller onditionfor instan e, mustbeused.
Werstgiveanee tive hara terizationofsequentialfun tionsoverinnite words. This hara terization extends to innite words the twinning property introdu ed by Chorut [11℄. We prove that a fun tion is sequential if it is a ontinuous map whose domain an be re ognized by a deterministi Bu hi automaton,andsu hthatthetransdu erobtainedafterremovingsomespe ial states has the twinning property. These onditions an be simplied in the asewherethetransdu erhasno y lingpathwithanemptyoutputlabel. We usethis hara terization todes ribean algorithm he kingwhether afun tion
thetransdu erhasno y lingpathwithanemptyoutputlabel. Finally,wegive analgorithmtodeterminizeareal-timetransdu er. Thealgorithm anbeeasily adaptedtothe asewhenthetransdu erisnotreal-time. Thealgorithmismu h more omplexthaninthe aseofnitewords. Itisthemainresultofthepaper. Thesedeterminizationsdonotpreservethedynami propertiesofthe trans-du ersas the lo ality of itsoutput. We mentionthat in [19℄, an algorithm is giventodeterminizetransdu ersoverbi-innitewordsthathavearight losing input (or that are n-deterministi or deterministi with a nite delay in the input)and a lo al output (see also[20, p. 143℄ and [1, p. 110{115℄). This al-gorithmpreservesthelo ality oftheoutput. These features areimportantfor odingappli ations.
Thepaperis organizedasfollows. Se tion2isdevotedto transdu ersover nite words. Basi notions of transdu ers of rationalfun tions are dened at thebeginning of this se tion. The hara terizationof subsequential fun tions isre alledinSe tion2.1whilethealgorithmfordeterminizationoftransdu ers isdes ribedinSe tion 2.2. The hara terizationofsequentialfun tionsamong subsequentialonesisre alledinSe tion2.3. Se tion3isdevotedtotransdu ers over innite words. We give in Se tion 3.1 a hara terization of sequential fun tions while the algorithm for determinization of transdu ers is des ribed in Se tion 3.2. In both asesof nite and innite words, wegiveexamplesof determinizationoftransdu ers.
Part of the results of the present paper was presented at the onferen e ICALP'2000[3℄.
2 Transdu ers over nite words
Inthesequel,Aand B denote nitealphabets. ThefreemonoidA
is theset ofnite wordsor sequen es ofletters of A. Theempty word isdenoted by". Wedenotethefa t thataniteworduis aprexof anite wordv byuv. Therelation isapartial order. Ifuis aprex ofv, wedenote by u
1 v the uniquewordwsu hthatv=uw.
A transdu er overthemonoid A
B
is omposed of asetQ ofstates, a set E QA
B
Qof edges andtwosets I;F Q of initial and nal states. An edgee=(p;u;v;q)from pto q isdenoted by p
ujv
!q. Thestatep istheorigin, uistheinputlabel,v is theoutputlabel,and qisthe end. Thus, atransdu eris thesameobje tasanautomaton,ex eptthatthelabelsof the edgesarepairsofwordsinsteadofletters.
Atransdu erisoftendenotedbyA=(Q;E;I;F),oralsoby(Q;E;I)ifall statesarenal,i.e., Q=F.
Apath inthetransdu erT isasequen e
p 0 u 0 jv 0 !p 1 u 1 jv 1 ! u n jv n !p n of onse utiveedges. Its input label is the word u = u
1 u 2 u n whereas its output label is theword v = v
1 v
2 v
n
. The path leaves p 0
and ends in p n
p 0 ujv !p n :
Apathissu essful ifitleavesaninitialstateandendsinanalstate. Theset re ognized bythetransdu eristhesetoflabelsofitssu essfulpaths,whi his a tuallyarelationRA
B
. Thetransdu er omputesafun tionifforany wordu2A
, there existsat mostone wordv 2B
su h that (u;v)2 R . We allit the fun tion realized by the transdu er. A transdu er whi h realizes a fun tion issometimes alledsingle-valued intheliterature. Thusatransdu er anbe seen asa ma hine omputing nondeterministi allyoutput words from inputwords. Wedenotebydom(f)thedomainof thefun tion f.
A transdu erisnite ifitsset ofstatesanditsset oftransitions arenite. Itis a onsequen eof Kleene's theoremthat asubsetof A
B
is arational relationifandonlyifitistheset re ognizedbyanitetransdu er.
0 1 2 3 4 ajb aj ajb ajb aj aj
Figure1: Atransdu erfortherelation(a 2 ;b 2 ) [(a 2 ; 2 ) (a; ).
Example1 (from[5℄)TheautomatonofFigure1re ognizestherelation(a 2 ;b 2 ) [ (a 2 ; 2 )
(a; )overthealphabetsA=fagandB=fb; g. Thisrelationis a tu-allythefun tion whi hmapsa
n tob n ifnisevenandto n ifnisodd.
Let T bea transdu er. Theunderlying inputautomaton (respe tively un-derlying output automaton) ofT is obtainedbyomittingtheoutputlabel (re-spe tivelyinputlabel)ofea hedge.
Atransdu erissaidtobereal-timeifitislabeledinAB
. It anbeproved that anyrational fun tion anberealizedbya real-timetransdu er. Further-more,fromanytransdu errealizingafun tion anbe omputedinpolynomial timeanequivalentreal-timetransdu er(seeforinstan e[31,Prop.1.1℄). Wesay thatatransdu erT issequential ifitisreal-timeandifthefollowing onditions aresatised.
These onditionsensurethat forea hwordu2A
, thereis atmostoneword v 2 B
su h that (u;v) is re ognized by T. Thus, the relation omputed by T is a partial fun tion from A
into B
. A fun tion is sequential if it anbe realizedbyasequentialtransdu er.
Remark2 In[16,p.299℄,[5℄and[6℄,itisassumedthatallstatesofa sequen-tial transdu er are nal. We follow the denition of Chorut [11, 12℄ where sequentialtransdu ermayhavenalstates. Thus,some hara terizationsthat wegivebelowdierfromthosepresentedin[5℄forthisreason. Whenallstates arenal,thedomainofasequentialfun tionisprex losed,i.e., ifuv belongs tothedomainthenualsobelongstothedomain. Asourdenitionallowsnal states,thedomainofasequentialfun tionisnotne essarilyprex losed.
0 1
aja aja
bjb
bja
Figure2: A sequentialtransdu er.
Example3 LetA=B =fa;bgbethe inputandthe outputalphabets. The transdu er ofFigure 2, whose initial stateis 0, issequential. It repla es bya thoseb's whi h appear after an oddnumberof b. Onthe ontrary,the trans-du erofExample1is notsequential. A tually, thefun tion omputedbythis transdu erisnotsequential. Indeed,onemayverifythatiff issequential,and ifuandv aretwowordsofdom(f)su hthat uv,thenf(u)f(v).
Remark4 If f isa sequentialfun tion and if f(")is dened,then f(")=". Toremovethisrestri tion,itispossibletoadd aninitial word asso iatedwith theinitialstate. Thiswordisoutputbeforeany omputation. Thisinitialword isne essarytogettheuni ityofaminimalsequentialtransdu er[28,12℄.
A subsequential transdu er (A;) over A
B
is a pair omposed of a sequential transdu er A over A
B
with F as set of nal states, and of a fun tion:F !B
. Thefun tionf omputed by(A;)isdenedasfollows. LetubeawordinA
. Thevaluef(u)isdened ifandonlyifthereis apath i
ujv
!q in A with inputlabel u, from theinitial state i to anal stateq. In this ase,onehasf(u)=v(q). Thus,thefun tionisusedtoappendaword to theoutput atthe end ofthe omputation. Afun tion issubsequential ifit anberealizedbyasubsequentialtransdu er.
fun tionsu hthat(q)="foranynal stateq. 0 1 a b aja aja bjb bjb
Figure3: A subsequentialtransdu er.
Example6 Thefun tion f realizedbythe subsequentialtransdu erpi tured in Figure3appends to ea h wordits lastletter. Theworduis mappedto ua ifit endswithanaanditismappedtoubifitendswithab. This fun tionis subsequentialbutit is notsequential. Indeed,for any wordw, f(wa)is nota prexoff(wab).
2.1 Subsequential fun tions
Inthis se tion, wepresentsomeknownresults aboutsubsequential fun tions. Were allthe hara terizationofsubsequentialfun tions obtainedbyChorut [11, 12℄. It is known that it is de idable whether a fun tion realized by a transdu er is subsequential. It has been proved in [30, 31℄ that this an be de ided in polynomial time. We givehere another proof of this result whi h is a onsequen e of the de idability in polynomial time of fun tionality over innitewords[10℄. Wealso des ribe thealgorithm to determinize areal-time transdu er. This algorithm takes atransdu er whi h realizes a subsequential fun tion and outputs a subsequential transdu er. This algorithm is a tually ontainedintheproofofChorut[11,12℄and[5,p.109{110℄. Ithasalsobeen des ribedbyMohri[21,23℄andRo heandShabes[25,p.223{233℄.
Ifthefun tion isa tuallysequential,thissubsequentialtransdu erisagain transformedinasequentialtransdu erbythealgorithmdes ribedinSe tion2.3. We give below two hara terizations of subsequential fun tions that have beenobtainedbyChorut(see[11,12℄and[5,p. 105℄). Therst hara teriza-tionisintrinsi tothefun tion. Itisbasedonmetri propertiesofthefun tion. These ond hara terizationis ee tive. It isbasedonaproperty alled twin-ning propertyof atransdu er realizing thefun tion. As ithas been shown in [30,31℄,thisproperty anbede idedin polynomialtime.
Somenotationisneededtostatethe hara terizationofsubsequential fun -tions. We rst introdu e adistan e d on nite words. Let u;v be two nite words,wedenotebydthedistan esu hthat
Apartialfun tion f :A
!B
hasboundedvariation ifandonlyif:
8k09K08u;v2dom(f) d(u;v)k)d(f(u);f(v))K :
Thede idabilityofthesubsequentialityisessentiallybasedonthefollowing notionintrodu edby Chorut [12, p. 133℄(see also[5, p. 128℄). Twostatesq andq
0
ofatransdu eraresaidto betwinned iforanypairofpaths
i uju 0 !q vjv 0 !q i 0 uju 0 0 !q 0 vjv 0 0 !q 0 where i and i 0
are two initial states, the output labels satisfy the following property. Either v
0 =v
00
= " orthere exists a nite word w su h that either u 00 = u 0 w and wv 0 0 = v 0 w, or u 0 = u 00 w and wv 0 = v 00
w. The latter ase is equivalenttothefollowingtwo onditions:
(i) jv 0 j=jv 00 j, (ii) u 0 v 0 ! =u 00 v 0 0 !
Atransdu erhasthetwinning property ifanytwostatesaretwinned.
Proposition 7 (Choffrut) Let f : A
! B
be a partial fun tion realized byatransdu erT. The followingthreepropositions areequivalent.
The fun tionf issubsequential. The fun tionf hasboundedvariation. The transdu erT has thetwinning property.
The equivalen ebetweenthe rst twostatements is an intrinsi hara teriza-tionofsubsequentialfun tionsamongrationalfun tions. Ita tuallysuÆ esto supposethattheinverseimagebyf ofanyrationalsetisstillrationalandthat f hasboundedvariationto insurethat f issubsequential. However,weare in hispaperinterestedinee tivemattersandwealwayssupposethatafun tion onwordsis given bya transdu er whi h realizes it. The equivalen ebetween thelast twostatements allowsus tode ide thesubsequentiality. The proofof thisequivalen eisessentiallytheproofofLemma16below.
We mention here another hara terization of the subsequentiality. For a partialfun tion f :A
!B
,denetheright ongruen eonA
byuu 0
i therearetwowordsnitewordsvandv
0
su hthatthefollowingtwoproperties holdforanynite wordw. First,theworduw is in thedomainof f iu
0 wis inthedomainoff. Se ond,ifuwandu
0
wareinthedomain,thenv 1
f(uw)= v
0 1
f(vw). Thefun tion f isthensubsequentialitheright ongruen ehas niteindex. Inthat ase,the ongruen eallowsoneto onstru tdire tly a subsequentialtransdu errealizingf. Furthermore,thissequentialtransdu eris minimalinthesensethatanyothersubsequentialtransdu errealizingf anbe proje tedontothis one. The algorithm presentedin Se tion 2.2 allowsoneto omputeee tivelytheright ongruen e.
Example8 WehavealreadymentionedinExample3thatthefun tion(a ;b ) [ (a 2 ; 2 )
(a; )ofExample1isnotsequential. A tually,thisrelationisnot sub-sequentialas it anbeeasily shown with Proposition 7. Indeed, the fun tion doesnothaveboundedvariation. Foranyintegern, onehas
d(a 2n ;a 2n+1 )=1 while d(b 2n ; 2n+1 )=4n+1:
Wenowgivetwode idabilityresultsaboutrationalrelations. Therstone isdue toS hutzenberger[27℄ (seealso[7℄). These ond oneis dueto Chorut [11,12℄(seealso[5,p.128℄).
Proposition 9 (S h
utzenberger) LetT be atransdu er over A
B
. It isde idable whether the relationdenedbyT is afun tion.
Chorutalsoprovedthede idabilityofthesubsequentiality. Heshowedthat itsuÆ esto he kthetwinningpropertywhenthelengthsofthewordsuandv areboundedbythesquareof thenumberof states[12,p. 133℄and [5,p.128℄. However,thisalgorithmdoesnotseemtobepolynomial.
Proposition 10(Choffrut) LetT beatransdu erlabeledinA
B
whi h realizes afun tion f,then thesubsequentialityof f isde idable.
Thefollowingresultisdue toWeberandKlemm[30, 31℄.
Proposition 11 Letf bethe fun tionrealizedbyatransdu er labeledinA
B
. Itisde idable inpolynomialtimewhether f issubsequential.
The proof of the proposition followsdire tly from Proposition 7 and from thefollowinglemma. Wegivebelowanotherproofbasedonthede idabilityin polynomialtimeofthefun tionalityoverinnitewords. A thirdproofisgiven in[4℄.
Lemma12 The twinning property of a transdu er is de idable in polynomial time.
Proof LetT =(Q;E;I;F)beatransdu er. Wede idethetwinningproperty ofT intwosteps. Werstde ideinpolynomialtimethe ondition(i)andthen the ondition(ii).
We dene an automaton A whose statesare the pairs of states of T and whoseedgesarelabeledbyintegers. Thereisanedge (p;p
0 ) n !(q;q 0 )ithere aretwoedgesp
aju !q andp 0 aju 0 !q 0 in Asu hthat n=ju 0
j juj. Thelabel ofapathin Aisthesumofthelabelsoftheedgesofthepath. We laimthat thetransdu erT satises ondition(i) ithelabel ofany y learound apair (q;q
0
)a essiblefrom somepair(i;i 0
)fortwoinitialstatesiandi 0
,isequalto zero. This anbedonebyadepth-rstsear h.
Weassumethatthetransdu eralreadysatises ondition(i). Thisrst on-ditioninsuresthattheoutputlabelv
0
isemptyiv 0 0
isempty. The ondition(ii) isthen equivalentto thefun tionalityofthe relationoninnitewordsdened
relationdenedbyT isafun tion,thenanytwostatesaretwinned. Conversely, ifthis relation is nota fun tion, there exist twoinnite paths labeled by xjy andxjy 0 withy6=y 0 . Letp 0 p 1 p 2 ::: andp 0 0 p 0 1 p 0 2
::: bethestatesvisitedbythe twopaths. Letk anindex su h that y
k 6=y
0 k
. Thereexist indi es m>nsu h that (p m ;p 0 m )=(p n ;p 0 n
). Moreover,nmay be hosengreat enoughsu h that theoutputs alongthe pathsfrom the initial stateto p
n and p
0 n
havea length greaterthank. Thenthestatesp
m andp
0 m
arenottwinned.
Itisde idableinpolynomialtimewhether arelationoninnitewords real-izedbyatransdu erisafun tion [10℄.
2.2 Determinization of transdu ers over nite words
Inthis se tion,wedes ribeanalgorithm whi hdeterminizesareal-time trans-du erwhi h hasthetwinning property. Thisalgorithm provesthat the ondi-tionsofProposition7aresuÆ ient.
Let T =(Q;E;I;F) be areal-time transdu er, that islabeledin AB
, realizingafun tion whi hissubsequential. Wegivebelowanalgorithm to de-terminizethetransdu erT,that is,whi hprodu esasubsequentialtransdu er realizing f. The algorithm is exponentialin the numberof states of T. The determinizationofanautomatonisalreadyexponential.
Wedene asubsequentialtransdu er Dasfollows. A stateP ofD isaset ofpairs(q;w)whereqisastateofT andwisawordoverB. Wenowdes ribe thetransitions ofT. LetP bestateofDandletabealetter. Thepair(P;a) determinesasetRdened by
R=f(q 0
;wu)jthereexist(q;w)2P andq aju
!q 0
2Eg:
IfR isempty, thereisno transitionfrom P input labeledbya. Otherwise, let vbethelongest ommonprexofthewordswufor(q
0 ;wu)2Rand P 0 =f(q 0 ;w 0 )j(q 0 ;vw 0 )2R g:
ThereisthenatransitionP ajv
!P 0
. TheinitialstateofDisthesetJ =f(i;")j i 2 Ig where I is the set of initial statesof T. It follows from the denition ofthetransitionsof Dthat ifP isastatea essiblefrom theinitialstate, the longest ommon prex of thewordsw for (q;w)2 P is theempty word. We onlykeepin Dthea essiblepartfromtheinitialstate. Thetransdu erDhas adeterministi inputautomaton.
Thefollowinglemmastatesthemain propertyofthetransitionsofD.
Lemma13 Let ube anite word. LetJ ujv
!P be the unique path inD with inputlabelufromthe initial state. Then, thestateP isequalto
P =f(q;w)jthere existsapath i ujvw
onsiderthefollowingpathinD J ujv !P ajt !P 0
where a is a letter. Let (q 0
;w 0
) be a pair in P 0
. By the denition of the transitionsofD,thereisapair(q;w)inP andatransitionq
ajt 0 !q 0 in T su h that tw 0 =wt 0
. Bythe indu tion hypothesis, there is apath i ujvw
!q in T. Finally,onehasvtw
0 =vwt
0 .
The pre eding lemma has the following onsequen e. If both pairs (q;w) and(q
0 ;w
0
)belong toastateP whi h isa essiblefrom theinitialstateand if bothqand q
0
arenal statesin T,thentheequalityw=w 0
ne essarilyholds. Otherwise,therelationrealizedbyT isnotafun tion. This remarkallowsus todene thesetofnal statesofDandthefun tion . A stateP isnalifit ontainsasleast onepair (q;w) where q is anal state of T. Thefun tion mapssu hanalstateP to thewordw.
0 1 2 3 4 5 ajb ajba ajba aj" aj" aj" aj" bja aja
Figure4: Transdu erofExample14
Example14 Consider the transdu er pi tured in Figure 4. If the algorithm for determinization is applied to this transdu er, one gets the subsequential transdu erpi tured in Figure5. This subsequentialtransdu eris transformed intoasequentialtransdu erin Examples19.
Thisdenesasubsequentialtransdu erwhi hmayhaveaninnitenumber ofstates. However,we laimthattheboundedvariationpropertyofT implies thatthelengthsofthewordsinstatesofDare bounded. Thus thenumberof statesofDisa tuallynite.
Lemma15 Let v 1 , v 2 ,v 0 1 andv 0 2
befour nite wordssu hthat jv 2 j=jv 0 2 jand v 1 v ! 2 =v 0 1 v 0 2 !
. Forany wordsv 3 andv 0 3 , d(v 1 v 2 v 3 ;v 0 1 v 0 2 v 0 3 )=d(v 1 v 3 ;v 0 1 v 0 3 ):
0;" A B 1;" 2;a 3;a C 1;a 2;" 4;a a 5;" D ajb aj" aj" aja bjaa bja
Figure5: Determinizationofthetransdu erofFigure4
Proof Bysymmetry, we may suppose that jv 1
j jv 0 1
j. There is then anite wordwsu h thatv
0 1 =v 1 w andwv 0 2 =v 2
w. Thusthewordv 0 1 v 0 2 v 0 3 isequalto v 1 v 2 wv 0 3 . It followsthat d(v 1 v 2 v 3 ;v 0 1 v 0 2 v 0 3 )=d(v 3 ;wv 0 3 )=d(v 1 v 3 ;v 0 1 v 0 3 ):
Thefollowinglemmastatesthatifatransdu erT hasthetwinningproperty, then the outputs labels of two paths with the same input label have a long ommonprex. Itprovesthat iftherelationrealizedbyT isafun tion,ithas boundedvariation. Theproofisvery losetotheproofofProposition6.4in[5℄ but we do not assume that the relation realized by T is a fun tion. This is usefulwhentransdu ersrealizingrelationsoninnitewordsare onsidered.
Lemma16 LetT beatransdu erwhi h has the twinningproperty. Thereis a onstantK su hthat the outputsof twopaths i
ujv !q andi 0 ujv 0 !q 0 from two initial statesiandi
0 satisfy
d(v;v 0
)K :
ProofLetKbeequalto2n 2
Mwherenisthenumberofstatesofthetransdu er and M is the maximal length of the output label of a transition. We prove d(v;v
0
)K by indu tion on thelength ofu. If jujn 2
, theresult holdsby denitionofK. Otherwise,bothpaths anbefa torized
i u1jv1 !p u2jv2 !p u3jv3 !q i 0 u1jv 0 1 !p 0 u2jv 0 2 !p 0 u3jv 0 3 !q 0 where u 1 u 2 u 3 = u, v 1 v 2 v 3 = v, v 0 1 v 0 2 v 0 3 = v 0 and ju 2 j > 0. By the twinning property,onehasd(v
1 v 2 v 3 ;v 0 1 v 0 2 v 0 3 )=d(v 1 v 3 ;v 0 1 v 0 3
) andtheresultfollowsfrom theindu tion hypothesis.
(q;w) in thestatesof D arebounded. This impliesthat thenumberof states ofDisnite.
Lemma17 There is a onstant K su h that for any pair (q;w) in a state P ofD,onehas jwjK.
Proof Let J ujv
! P be a path in D. Let (q;w) be a pair in some state P. Bydenition of the transitions of D, there is another pair (q
0 ;w 0 ) in D su h that w and w 0
have no ommon prex. By Lemma 13, there are twopaths, i ujvw !qandi 0 ujvw 0 !q 0
in T. ByLemma16,there isa onstantK su hthat d(vw;vw
0
)KandthusjwjK.
Thefollowingpropositionnallystatesthatthesubsequentialtransdu erD isequivalentto the transdu erT. It followsdire tly from Lemma 13 and the denitionofthefun tion.
Proposition18 The sequential transdu er D realizes the same fun tion f as the transdu erT.
We have already mentioned in Proposition 11 that it an be de ided in polynomial timewhether afun tion realized by atransdu er is subsequential. Thealgorithm des ribedaboveis exponentialbut it providesanother de ision pro edure.Indeed,Lemma17givesaupperboundofthelengthsofwordswhi h anappearinstatesofD. ByLemma16,thisupperboundis2n
2
M wherenis thenumberofstatesofT andM isthemaximallengthoftheoutputlabelofa transitionofT. LetT beatransdu er realizingafun tion f. Ifthealgorithm is applied to T, either it stops and gives a subsequential transdu er D or it reatesa stateP ontaining apair(q;w) su h that the lengthof w isgreater than 2n
2
M. In the former ase, the subsequentialtransdu er D is equivalent to T and thefun tion f issubsequential. Inthelatter ase,the fun tion f is notsubsequential.
2.3 Sequential fun tions
Thedeterminization of atransdu er realizing a subsequentialfun tion f pro-videsasubsequentialtransdu errealizingf. Evenifthefun tionfissequential, thealgorithmdoesnotgiveasequentialtransdu erbutthissubsequential trans-du er an betransformedintoasequentialone.
Thistransformationis basedonanormalizationofsubsequential transdu -ersintrodu ed byChorut [12, 13℄. This normalization onsists in pushingas mu h aspossiblethe output labels from nal states towardsthe initial state. Algorithms omputingthenormalizedtransdu eraregivenin[21,23℄,[8,9℄and [2℄. Thealgorithmsgivenin[21,23℄and[2℄runintimeO(jEjP)whereEisthe setof transitionsof thetransdu er, andwhere P isthemaximal lengthof the greatest ommonprex oftheoutput labelsof pathsleaving ea h stateof the transdu er. If the normalizationis applied to asubsequentialtransdu er, the
ization an beperformedin polynomialtime, it anbe he kedin polynomial timewhetherafun tionrealizedbyasubsequentialtransdu erissequential. It anbeshownthatafun tionrealizedbyasubsequentialtransdu erissequential iitpreservesprexes. Thiswasalready provedin [30,31℄ that thisproperty anbe he kedin polynomialtime.
Inordertotransformasubsequentialtransdu erintoasequentialone,itis notne essaryto push asmu h aspossiblethe output labels from nal states towards the initial state, as the normalization does. It suÆ es to push these outputlabelsuntiltheoutputofallstatesareempty. Therefore,thealgorithm givenin [2℄ anbeadapted to meet thisrequirements. Thisgivesatime om-plexity of O(jEjL) instead of O(jEjP) where L is the maximal length of the outputwords. A B C D ajba aj" aj" aja bja bj
Figure6: Sequentialtransdu erofExample19
Example19 Consider the transdu er pi tured in Figure 5 where the states havebeenrenamedA,B,CandD. Ifthenormalizationisappliedtothis sub-sequentialtransdu er,onegetsthesequentialtransdu er pi turedin Figure6.
3 Transdu ers over innite words
Inthisse tion,we onsidertransdu ersoverinnitewordswithallstatesbeing nal. Werstgiveanee tive hara terizationofsequentialfun tions over in-nitewords. This hara terizationextendstoinnitewordsthetwinning prop-ertyintrodu ed byChorut [11, 12℄. We usethis hara terizationto des ribe analgorithmto he kwhetherafun tionrealizedbyatransdu erissequential. Finally,wegiveanalgorithmtodeterminizeatransdu er.
In this se tion, we denote by A !
the set of all (right-)innite words over thealphabet A. We onsidertransdu ersoverinnitewords. Theedgesof the transdu ersare stilllabeledin A
B
. Thetransdu er hasinitial statesbut wesupposethat all statesare nal. Thus weomitthe set F of nal statesin thenotation. Aninnitepathisthensu essful ifitleavesaninitialstate. The relationoverinnitewordsdened by thetransdu er istheset R A
! B
innitewordsx su h that there issomeinnite wordy su h that (x;y)labels asu essful pathin thetransdu er. Whenthe transdu er realizesafun tion, its domain is also the domain of the fun tion. A fun tion from A
! to B
! is sequential if it is realized by asequential transdu er. We point out that the notionofsubsequentialfun tion isirrelevantinthe aseofinnitewords.
3.1 Chara terization of sequential fun tions
Inthisse tion,we hara terizefun tionsrealizedbytransdu erswithallstates nalthat an berealizedbysequentialtransdu ers. This hara terizationuses topologi alpropertiesofthefun tionandsometwinningpropertyofthe trans-du er. Inthisse tion,weassumethatallstatesoftransdu ersarenal.
We rst introdu e a denition. We dene a subset of states whi h play aparti ular role in the sequel. We say that a state q of atransdu er is non onstant iftherearetwopathsleavingqlabelledbytwopairs(x;y)and(x
0 ;y
0 ) ofinnitewordssu hthaty6=y
0
. Ifastateqis onstant,eitherthereisnopath leavingqlabelledbyapairofinnitewordsorthereisaninnitewordy
q alled the onstantofqsu h thatforanypair(x;y)ofinnitewordslabellingapath leavingq,then y=y
q
. Intheformer ase,thestateq anberemovedsin eit annoto urin ana eptingpath labelled bya pairof innitewords. In the sequel,wealwaysassumethatsu hstateshavebeenremoved. The onstanty
q is anultimately periodi word. It should be noti ed that anystate a essible from a onstant state is also onstant. We now state the hara terization of sequentialfun tions.
Proposition 20 Let f beafun tion realizedby atransdu er T withall states nal. LetT
0
bethetransdu erobtainedbyremovingfromT all onstantstates. Then thefun tion f issequentialithe following threepropertieshold:
the domainof f an bere ognizedbyadeterministi B u hiautomaton, the fun tion f is ontinuous,
the transdu er T 0
has the twinningproperty.
Sin ethefun tionf isrealizedbyatransdu er,thedomainoff isrational. However,itis nottruethat anyrational set ofinnite wordsis re ognizedby a deterministi Bu hi automaton. Landweber's theorem states that a set of innitewordsisre ognizedbyadeterministi Bu hiautomatoniitisrational and G
Æ
[29℄. Re all that a set is said to be G Æ
is it is equal to a ountable interse tionofopensetsfortheusualtopologyofA
! .
Itisworthpointingoutthatthedomainofafun tionrealizedbyatransdu er maybeanyrationalsetalthoughitissupposedthatallstatesofthetransdu er arenal. ThenalstatesofaBu hiautomaton anbeen odedintheoutputsof atransdu erinthefollowingway. LetA=(Q;E;I;F)beaBu hi automaton. We onstru t atransdu er T by adding an output to anytransition of A. A transitionp
a
!qof Abe omesp ajv
inniteithepathgoesinnitelyoftenthroughanalstate. Thusthedomain of the transdu er T is the set re ognized by A. For instan e, the domain of atransdu er maybe notre ognizable by adeterministi Bu hi automaton as in the following example. It is howevertrue that the domain is losed if the transdu erhasno y lingpathwithanemptyoutput.
0 1
aj"
bj"
bjb
bjb
Figure7: Transdu erofExample21
Example21 Thedomain ofthefun tion f realizedbythetransdu erof Fig-ure7istheset(a+b)
b
!
ofwordshavinganitenumberofa. Thefun tionf annotberealizedbyasequentialtransdu ersin eitsdomain isnotaG
Æ set.
Itmustbealsopointedoutthatafun tionrealizedbyatransdu ermaybe not ontinuousalthoughitissupposedthatallstatesofthetransdu erarenal asitisshownin thefollowingexample.
0 1
aja
bj"
bjb
bjb
Figure8: Transdu erofExample22
Example22 The image of an innite word x by the fun tion f realized by the transdu er of Figure 8is f(x) =a
!
f(x)=a b ifthenumberofainxisn. Thefun tionf isnot ontinuous. For instan e,thesequen ex
n =b n ab ! onvergestob ! whilef(x n )=ab ! doesnot onvergetof(b ! )=b ! .
Proof Werst explainwhythe abovethree onditionsof theproposition are ne essary. Thefa tthatthe onditionsaresuÆ ientfollowsfromthealgorithm thatwedes ribeinSe tion 3.2.
If the fun tion f is realized by a sequential transdu er D, adeterministi Bu hi automatonre ognizing thedomain of f an bededu ed from theinput automatonofDinthefollowingway. Ea hstateqisrstsplitintwostatesq
1 andq
2
. Wedistributethentheedgesarrivinginqbetweenq 1
andq 2
a ording totheemptinessoftheiroutput. Edgeswithanemptyoutputarriveinq
1 while edgeswithanonemptyoutputarriveinq
2
. Thestateq 2
isthennal andq 1
is not. Ifqwasinitial,exa tlyoneamongq
1 andq
2
istheninitial. Alledgesgoing outof qaredupli atedin edgesgoingoutofq
1 andq
2
. Insymboli dynami s, su h a transformation is alled an input state splitting. It is lear that this deterministi Bu hiautomatonre ognizesthedomainoff. Itisalso learthat anysequentialfun tionis ontinuous.
We now prove that the third ondition is ne essary. We suppose that we havethefollowingpi turerepresentingpathsinT.
0 1 2 3 uju 0 uju 00 vjv 0 vjv 0 0
where 0and 1are initial states, u, u 0 , u 00 , v, v 0 and v 0 0
are nite words. Let Dbeasequentialtransdu errealizingthesamefun tion asT. There areinD paths 4 5 uv l jw v k jw 0
where0istheinitial state,wand w 0
arenite words. Byprolongingthepath inT from0to2(respe tivelyfrom1to3)withliterationsofthepatharound2 (respe tively around 3), we anassume withoutloss of generality that l = 0. Byrepla ing the y ling patharound2(respe tivelyaround3)byk iterations ofthispath,we anassumethatk=1.
We laim that if the state 2 is not onstant, then the equality jwj = jv 0
j holds. Sin estates2and3arenot onstant,thenifv="thenv
0 =v
00
thetwinningpropertyissatised. Wenowassumethatvisnotempty. Letxjx andyjy
0
betheinnitelabelsoftwoinnitepathsleaving2su h that x 0
6=y 0
. Thereare inD twoinnitepaths labeledbyxjx
0 0
and yjy 00
leavingthestate5 su hthat u 0 v 0 n x 0 =ww 0 n x 0 0 u 0 v 0 n y 0 =ww 0 n y 00 : Ifjv 0 j <jw 0 j, thewordsx 0 andy 0
havea ommonprex oflength jwj ju 0 j+ n(jw 0 j jv 0
j)foranylargen. Thisleadstothe ontradi tionthatx 0 =y 0 . Ifjv 0 j> jw 0 j,thewordsx 00 andy 00
havea ommonprexoflengthjuj jwj+n(jv 0
j jw 0
j) foranylargen. Thisleadstothe ontradi tionthatx
00 =y 00 andx 0 =y 0 . By symmetry, if the state3 is not either onstant, then the equality also jwj=jv
0 0
jholdsandthereforejv 0 j=jv 0 0 j. Ifbothwordsv 0 andv 0 0
arenonempty,thenf(uv ! )=u 0 v 0 ! =u 00 v 0 0 ! .
Beforedes ribingthealgorithmfordeterminization,werststudya parti -ular ase. Itturnsoutthatthersttwo onditionsofthepropositionaredueto thefa t thatthe transdu erT mayhave y lingpathswith anemptyoutput. If the transdu er T has no y ling path with an empty output, the previous proposition an bestatedinthefollowingway.
Proposition23 Let f beafun tion realizedby atransdu er T withall states nal. Suppose also that T has no y ling path with an empty output. Let T
0 be the transdu er obtained by removing from T all onstant states. Then the fun tionf issequential ithetransdu erT
0
has thetwinning property.
Ifthetransdu erT hasno y lingpathwithanemptyoutput,anyinnite pathhasaninniteoutput. Thus,aninnitewordxbelongstothedomainoff iitistheinputlabelofaninnitepathinT. Thedomainoff isthena losed set. Itis thenre ognizedby adeterministi Bu hiautomatonwhose allstates are nal. This automaton an be obtained by the usual subset onstru tion ontheinputautomatonofT. Furthermore,ifthetransdu erT hasno y ling pathwithanemptyoutput,thefun tionf isne essarily ontinuous. This ould beproveddire tlybutitfollowsfrom Lemma31.
Wenowstudy thede idabilityofthe onditionsofPropositions 20and23. Wehavethefollowingresults.
Proposition24 Itis de idable if afun tion f given by a transdu er with all states nal is sequential. Furthermore, if the transdu er has no y ling path withan emptyoutput,this anbede idedin polynomial time.
Notethat theresultdoesnotholdifitisnotsupposed thatthetransdu er hasno y ling path with an empty output. Inthe general ase, the problem is NP-hard. For any Bu hi automaton, onsider the transdu er obtained by repla ingea htransitionp
a
!qoftheBu hiautomatonbyatransitionp aj"
!q ifp is not nal and by p
ajb
mapsanyinnitewordtob anditsdomainisexa ltythesetofinnitewords re ognizedby theBu hi automaton. This fun tion is sequentiali itsdomain isdeterministi . Sin etestingwhetherthesetofinnitewordsre ognizedbya givennondeterministi Bu hi automatonisdeterministi is anNP-hard prob-lem,testingwhetherafun tionis sequentialisalsoNP-hard.
ProofAsexplainedintheproofofProposition20,aBu hiautomaton re ogniz-ingthedomainofthefun tion anbeeasilydedu edfromthetransdu er. Itis thende idableifthisset anbere ognizedbyadeterministi Bu hiautomaton [29,Thm5.3℄.
It isde idable in polynomialtime ifafun tion givenbya transdu erwith nalstatesis ontinuous[24℄.
Wenowshowthat the third ondition ofProposition20 anbede ided in polynomialtime. Sin ewehavealreadyprovedinLemma12thatthetwinning property an be de ided in a polynomial time, it suÆ es to prove that the transdu er T
0
anbe omputed in polynomial time. We laimthat it an be de idedinpolynomialtimewhether agivenstateis onstant.
LetAbetheoutputautomatonofthetransdu er. Byadepthrstsear h,it anbefoundtwonitewordsuandvsu hthatjuj+jvjnandsu hthatuv
! labelsapathleavingq. One onstru tsa ompletedeterministi automatonB re ognizinguv
!
with asinkstate0whi h isthe onlynona eptingstate. We then onsider the syn hronized produ t automaton of A and B. There is a transitionfrom (p;r)to(p
0 ;r
0
)labelled by anite wordw(perhapsempty)i thereisatransitionfromptop
0
inAandapathfromrtor 0
inB. Theinnite worduv
!
isthelabelofallpathsleavingqinostate(q 0 ;0)isa essiblefrom (q;i B )wherei B
istheinitialofB. Thisnaivealgorithmrunsinquadrati time forea hstateq. Thereforethe onstantstatesofatransdu er anbe omputed in ubi time. Itturnsoutthatthey anbe omputedin lineartime[10℄.
3.2 Determinization of transdu ers over innite words
Inthis se tion,wedes ribeanalgorithmto determinizeareal-timetransdu er whi h satises the properties of Proposition 20. This algorithm an easily be adaptedtothe asewhenthetransdu erisnotreal-time. Thisalgorithmproves thatthe onditionsoftheproposition aresuÆ ient.
Let T = (Q;E;I) be a transdu er and let T 0
bethe transdu er obtained byremovingfrom T all onstantstates. Weassumethat T
0
hasthetwinning property. WedenotebySthesetof onstantstates. ForastateqofS,wedenote byy
q
,thesingleoutputofqwhi hisanultimatelyperiodi word. Wesuppose that the domain of f is re ognized by the deterministi Bu hi automaton A. Thisautomatonisusedinthe onstru tedtransdu ertoinsurethattheoutput isinniteonlywhentheinputbelongsto thedomain ofthefun tion.
Wedes ribethedeterministi transdu erDrealizingthefun tionf. Astate ofDisapair(p;P)wherepisastateofAandP isaset ontainingtwokinds ofpairs. Therstkindarepairs(q;z)whereqbelongto QnS andzisanite word over B. The se ond kind are pairs(q;z) where q belongs to S and z is anultimately periodi innitewordoverB. Wenowdes ribethe transitions
denedas follows R=f(q 0 ;zw)jq 0 = 2S and9(q;z)2P; q2=S andq ajw !q 0 2Eg [f(q 0 ;zwy q 0 )jq 0 2S and9(q;z)2P; q2=S andq ajw !q 0 2Eg [f(q 0 ;z)jq 0 2S and 9(q;z)2P; q2S andq ajw !q 0 2Eg:
Wenow denethe transitionfrom the state(p;P) inputlabeledbya. IfR is empty, there is no transition from (p;P) input labeled by a. Otherwise, the output of this transition is the word v dened as follows. Letp
a !p
0 be the transitioninAfromplabeledbya. Ifp
0
isnotanalstateofA,wedenevas theemptyword. Ifp
0
isanalstate,wedenev astherstletterofthewords z ifR only ontainspairs(q
0
;z)withq 0
2S andifall theinnitewordsz are equal. Otherwise,wedenev asthelongest ommonprex ofallthenite or innitewordsz for(q
0
;z)2R . ThestateP 0
isthendenedasfollows
P 0 =f(q 0 ;z)j(q 0 ;vz)2R g:
There is then a transition (p;P) ajv
! (p 0
;P 0
) in D. The initial state of D is thepair (i
A
;J) where i A
is the initial state of A and where J = f(i;")j i 2 I andi 2= Sg[f(i;y
i
)ji2 I andi 2Sg. Ifthe statep 0
is notnal in A, the outputofthetransition from(p;P)to (p
0 ;P
0
)is emptyandthewordszof the pairs(q;z)inP,mayhaveanonempty ommonprex. Weonlykeepin Dthe a essiblepartfromtheinitialstate. Thetransdu erDhasadeterministi input automaton. It turns outthat the transdu er Dhas anite number ofstates. ThiswillbeprovedinLemma33. Itwillbealsoprovedin Proposition34that thetransdu erDrealizesthesamefun tion asT.
0 1 aja bjb aj" aj" jaa
Figure9: Transdu erofExample25
Example25 Consider the transdu er pi tured in Figure 9. A deterministi Bu hi automatonre ognizing thedomainispi tured inFigure 10. Ifthe algo-rithmfordeterminizationisapplied tothistransdu er,onegetsthetransdu er pi turedinFigure11.
A B C D a b a
Figure10: A deterministi Bu hiautomatonforthedomain
A 0;" B 0;" 1;a ! C 1;a ! D 1;a ! aja aja aj" aj" bjb bjb ja ja ja
Figure11: Determinizationofthetransdu erofFigure9
Lemma26 Let u be a nite word. Let (i A
;J) ujv
! (p;P) be the unique path in D with input label u from the initial state. Then, the statep is the unique stateofAsu hthat i
A u
!pisapathin Aandthe setP isequal to
P =f(q;z)j9i ujv 0 !qin T su hthatv 0 =vz if q2=S v 0 y q =vz if q2Sg:
Proof The proof of the lemma is by indu tion on the length of u. Let us onsiderthefollowingpathinD
(i A ;J) ujv !(p;P) ajt !(p 0 ;P 0 )
wherea isaletter. Let (q 0 ;z 0 )beapairin P 0 . If q 0 = 2S, there isapair(q;z) in P and a transition q ajt 0 ! q 0
in T. If both states q and q 0
do not belong toS, the proofis similar tothe proofof Lemma 13. If q2=S andq
0 2S, one hastz 0 =zt 0 y q 0
. By theindu tion hypothesis, there is apath i ujvz
! q in T. Onenally gets vtz
0 =vzt 0 y q 0 . If q2 S and q 0 2S, one hastz 0 =z. By the indu tionhypothesis, thereis apath i
ujv 0 !qin T su hthat v 0 y q =vz. Sin e y q =t 0 y q 0
,onenallygetsvtz 0 =v 0 t 0 y q 0 .
Thepreviouslemma hasthe orollarywhi h statesthat ea h stateqis the rst omponentofatmostonepair(q;z)inthese ond omponentP ofastate (p;P)ofD.
Corollary27 LetqbeastateofT andlet(p;P)beastateofD. ThesubsetP ontainsatmostonepair (q;z).
Proof Let(i A
;J) ! (p;P)bea pathin D and let(q;z)and (q;z 0
) betwo pairsin P.
We rst suppose that q is not onstant. Let xjy and x 0
jy 0
be two pairs of innite words whi h label two paths leaving q su h that y 6= y
0
. By the previouslemma, there are two pathsi
ujvz ! q and i 0 ujvz 0 ! q in T. One has f(ux)=vzy=vz 0 yandf(ux 0 )=vzy 0 =vz 0 y 0 . Ifz6=z 0 ,itmaybeassumedby symmetrythat jz 0 j>jzjand that z 0
=zw forsomenite word w. This leads tothe ontradi tiony=y
0 =w
! .
Wenowsupposethatqis onstant. Letxjybeapairofinnitewordswhi h labelsa pathleaving q. Bythe previouslemma, there are twopathsi
ujw !q and i 0 ujw 0
! q in T su h that wy =vz and w 0
y =vz 0
. Furthermore,one has f(ux)=wy=w
0
y andthusz=z 0
.
Wenowintrodu esomete hni alpropertyofthepathsofatransdu er. This propertyis akindof twinning propertywhen theoutput ofone of the y ling pathsisempty. Itsturns outthat thispropertyisequivalentto the ontinuity ofthefun tion realizedbythetransdu erwhenitisalreadysupposedthat the transdu erhasthetwinningproperty. LetT beatransdu erandletSbeitsset of onstantstates. Thetransdu erT issaidtohavethe"- ompatibilityproperty iforanypairofpaths
i uju 0 !q vjv 0 !q i 0 uju 00 !q 0 vj" !q 0
su hthat iandi 0
aretwoinitialstatesandv 0
isanonemptyword,thestateq 0 is onstantandits onstanty
q 0 satisesu 00 y q 0 =u 0 v 0 !
. Ifthestatesqandq 0
are twinned,there annotbeapairof su hpaths. If theoutputalong these ond y ling path is empty, the output along the rst y ling path should also be empty. The above onditions add some ompatibility of the outputs when q andq
0
arenottwinned.
Thefollowinglemmastatesthatifthefun tionrealizedbythetransdu eris ontinuous,thenthetransdu erhasthe"- ompatibilityproperty. The onverse isestablishedin Lemma31.
Lemma28 LetT betransdu er realizing afun tion f oninnite words. If the fun tionf is ontinuous,thenthetransdu erT hasthe"- ompatibilityproperty.
Proof Letxjy be apair of innitewordswhi h labelsapath leaving q 0
. For any integern, onehas f(uv
n x) = u 00 y and f(uv ! )= u 00 y by ontinuity of f. Sin e f(uv ! ) = u 0 v 0 ! , the state q 0
is onstant and its onstant y q 0 satises u 00 y q 0 =u 0 v 0 ! .
Foranitewordwandaninnitewordx,wedenotebyd(w;x)theinteger jwj jw^xjwherew^xisthelongest ommonprexofwandx. Remarkthat disnotadistan e butLemma15stillholds whenv
0 3
ertyandthatT 0
has thetwinningproperty. Thereisa onstantKsu hthatfor anytwopaths i
ujv !qandi 0 ujv 0 !q 0 whereiandi 0
areinitial states,q2=Sand q 0 2S,onehas d(v;v 0 y q 0 )K :
ProofLetKbeequalton 2
Mwherenisthenumberofstatesofthetransdu er and M is the maximal length of the output label of a transition. We prove d(v;v
0 y
q
0)K byindu tiononthelengthofu. Ifjujn 2
,theresultholdsby denitionofK. Otherwise,bothpaths anbefa torized
i u 1 jv 1 !p u 2 jv 2 !p u 3 jv 3 !q i 0 u 1 jv 0 1 !p 0 u 2 jv 0 2 !p 0 u 3 jv 0 3 !q 0 : where ju 2 j > 0and ju 3 j n 2 . If both wordsv 2 and v 0 2
are empty, the result followsdire tlyfromtheindu tion hypothesis. Thus, wemayassumethat one thewordsv
2 orv
0 2
isnotempty. Sin eqdoesnotbelongtoS,pdoesnotbelong toSeither. The"- ompatibilitypropertyimpliesthenthatv
2
annotbeempty. We rst suppose that p
0 =
2 S. Bythe twinning property, Lemma 15 and theaboveremark,onehasd(v
1 v 2 v 3 ;v 0 1 v 0 2 v 0 3 y q 0) =d(v 1 v 3 ;v 0 1 v 0 3 y q 0
)andtheresult followsfromtheindu tionhypothesis.
Wenowsupposethat p 0
2S andwe laimthat v 0 1 v 0 2 v 0 3 y q 0 =v 1 v ! 2 . Sin e p 0 is onstant,y p 0 =v 0 3 y q 0 . If theword v 0 2
is empty, the"- ompatibilityproperty impliesthatv 0 1 y p 0 =v 1 v ! 2 . Ifv 0 2 isnonempty,y p 0 =v 0 2 ! . Sin ef(u 1 u ! 2 )=v 1 v ! 2 = v 0 1 v 0 2 !
,the laimedequalityholds. Inboth ases,onehasd(v 1 v 2 v 3 ;v 0 1 v 0 2 v 0 3 y q 0 )= d(v 1 v 2 v 3 ;v 1 v ! 2 )jv 3 jK.
Thefollowinglemmastatessomete hni al onsequen eofthe"- ompatibility property.
Lemma30 LetT beatransdu erwhi hhasthe "- ompatibilitypropertyandlet f thefun tionrealizedbyT. Then ifxisinthedomainof f andx isthe input label of a path entirely out of S,the output of this path is innite and isthus equal tothe image ofx by f.
Proof Suppose that x is theinputlabelof twopaths and 0
. Suppose also that all states of do not belong to S and the output along
0
is an innite word. Sin ethenumberofstatesisnite,bothpaths and
0 anbefa torized =i u0jv0 !q u1jv1 !q u2jv2 !q 0 =i 0 u0jv 0 0 !q 0 u1jv 0 1 !q 0 u2jv 0 2 !q 0
Furthermore,it anbeassumedthatea hv 0 k isnonemptysin ev 0 0 v 0 1 v 0 2 ::: isan inniteword. Byhypothesis,thisimpliesthat ea hv
k
parti ularthatifatransdu erT hasno y lingpathwithanemptyoutputand ifT
0
hasthetwinning property,thenthefun tion realizedbyT is ontinuous. Ifx andy aretwoinnitewords,d(x;y) denotestheusualdistan e betweenx andy whi hmakesthesetA
!
ofallinnitewordsa ompa tspa e.
Lemma31 Let T be atransdu er whi h has the "- ompatibility andsu h that T
0
has the twinningproperty. Then thefun tion realizedby T is ontinuous.
Proof Let f be the fun tion realized by the transdu er T and let x be an innitewordin the domainof f. We laimthat for any integerm there isan integerksu hthatforanyinnitewordx
0
alsointhedomainf,theinequality d(x;x
0 )2
k
impliestheinequalityd(f(x);f(x 0
))2 m
. Lety=f(x)bethe imageof x. Let beapath labeled byxjy and leti bethe initial stateof . Let 0 beapathlabelledby(x 0 ;y 0 )wherey 0 =f(x 0
). A ordingtotheprevious lemma,it anbeassumedthat eitherthere isapathentirelyoutofS whi his labeledbyxjyorthat xisnottheinputlabelof apathentirelyoutofS.
Werstsupposethat thepath isentirelyoutofS. ByLemma15, there is a onstant K su h that ifi
ujv ! q andi 0 ujv 0 ! q 0
are twopathswith q 2= S andq
0 =
2S, thenonehasd(v;v 0
)K. ByLemmas28and29,thereisanother onstant K 0 su h that ifi ujv !q andi 0 ujv 0 !q 0
aretwopaths withq2= S and q
0
2 S, then onehas d(v;v 0
y q
0
) K. Let k be hosen su h that the output along the rst k transitions of has a length greater then m+max(K ;K
0 ). Letqbethestateof rea hedafter ktransitionsandletv betheoutputof
0 alongtherstk transitions. Supposethat x
0 satises d(x;x 0 )k and that 0 is apath labeled byx 0 jy 0 where y 0 = f(x 0 ). Let i 0
the initial state of 0 and letq 0 bethestateof 0
rea hed afterk transitions. Ifq 0
doesnotbelongto S, onehasd(v;v 0 )K wherev 0 isthe outputof 0
alongthe rstk transitions. Sin ejvjm+K, onehasjv^v
0
jmand thusd(y;y 0 )2 m . Ifq 0 belongs toS,onehasd(v;y 0 )K 0 . Sin ejvjm+K 0 , onehasjv^y 0 jmandthus d(y;y 0 )2 m .
We now suppose that x is notthe input label of apath entirely outof S. ThereisthenanintegerK su hthatanypathinputlabeledbyaprexofxof lengthgreaterthanKendsinastateofS. LetkbeequaltoK+K
0
whereK 0 isthelengthofpartof inside S whi h ontainsat leastn
2 transitions witha nonemptyoutput. Ifd(x;x 0 )2 k
, bothpaths and 0 anbefa torized =i u 0 jv 0 !q u 1 jv 1 !q u 2 jv 2 ! 0 =i 0 u 0 jv 0 0 !q 0 u 1 jv 0 1 !q 0 u 0 2 jv 0 2 ! whereu 0 u 1 u 2 =x,u 0 u 1 u 0 2 =x 0 ,v 1
is nonemptyandqandq 0 belong toS. We laim that y = y 0 . One has y = v 0 y q and y 0 = v 0 0 y q 0 . Sin e v 1 is nonempty, onealsohasy
q =v ! 1 . Ifv 0 1
isalso nonempty,one hasy q 0 =v 0 1 ! andf(u 0 u ! 1 )= v 0 v ! 1 = v 0 0 v 0 1 ! and thus y = y 0 . If the word v 0 1
is empty, the "- ompatibility propertyimpliesv 0 y q =v 0 0 y q 0 andy=y 0 .
Thefun tion f isthen ontinuous.
Thefollowinglemmastatesthatthelengthsofthewordszofthepairs(q;z) in thestatesof D arebounded. It is essentiallydue to the twinning property ofT
0 .
Lemma32 Thereis a onstant K su hthat for any pair (q;z)in P ofa state (p;P) ofDwhere q2=S andz isanite word, onehas jzjK.
ProofLetmandnbetherespe tivenumbersofstatesofAandT. ByLemma 16and 29, there isa onstant K
0 su h that if i ujv !q and i 0 ujv 0 ! q 0 are two pathssu h that q2=S, thenonehasd(v;v
0 )K 0 ifq 0 = 2S ord(v;v 0 y q 0)K 0 ifq 0 2 S. LetK =K 0
+mnM where M is themaximal lengthof theoutput labelofatransitionin T. Let(p;P)beastateofDand onsiderapath
(i A ;J) u 0 jv 0 !(p 0 ;P 0 ) ujv !(p;P) wherep 0
is anal stateofA. If there isno pathfrom (i A
;J)to (p;P)whi h goes througha state(p
0 ;P
0
) with p 0
nal, weassume that (p 0 ;P 0 ) is a tually (i A
;J). The proof is by indu tion on thelength of u. If juj = 0,the state p isa tuallyanalstate ofA. Inthe asewherepisnal, thelongest ommon prexof thewordsz ofthe pairs(q;z) in P isempty. Lemmas 16, 26 and29 imply that jzj K
0
. We now suppose that p is not nal. If juj mn, the resultfollowsfrom thedenition ofthetransitionsofD. Wenowsupposethat juj>mnandthat(p
0 ;P
0
)isthelaststatealongthepathfrom(i A
;J)to(p;P) su h thatp
0
isanal stateof A. Let(q;z)beapairinP su h thatq2=S and z is anite word. Bydenition of thetransitions of D, there isapair (q
0 ;z 0 ) inP 0 andapathq 0 ujw !qinT su hthatz 0
w=vz. Thereisalsoapathp 0
u !p inA. Sin ejuj>mn,bothpaths anbefa torized
p 0 u1 ! p 00 u2 ! p 00 u3 ! p q 0 u1jw1 !q 00 u2jw2 !q 00 u3jw3 !q where u 1 u 2 u 3 =u and w 1 w 2 w 3
= w. Sin e the y ling path p 00
u2 ! p
00 in A does not ontain any nal state, the innite word u
0 u 1 u ! 2
doesnot belong to thedomainoff. Thisimpliesthatthewordw
2
isempty. Wethen onsiderthe path (p 0 ;P 0 ) u1u3jv 00 !(p;P 00 ) inD. ThesubsetP 00 ontainsapair(q;z 00
)forsomenitewordz 00
. We laim that z
00
= z. Indeed, one has z 0 w 1 w 2 w 3 = z 0 w 1 w 3 = vz = v 00 z 00 . As both pathsp 0 u 1 u 2 u 3 !pandp 0 u 1 u 3
!pinA ontainnoothernalstatethanp,both outputsv andv
0 0
alongthe orrespondingpathsinDareempty. Thusonegets z=z
00
. Bytheindu tion hypothesis, onehasjzj=jz 00
states. However,thenumberofstatesofD anbeexponentialasinthe aseof nitewords.
Lemma33 The numberof statesofD isnite.
Proof We haveproved in the pre eding lemma that thelengths of the nite words z are bounded. It remains to show that there is a nite number of dierentinnitewordsz whi h anappearinsomepair(q;z). Bydenitionof thetransitions, anyinnitewordz ofapairisthesuÆxofz
0 wy q where(q 0 ;z 0 ) is apairsu h that q
0 =
2 S and z 0
is nite and where q 2S and q 0
ajw ! q is a transition of T. Sin e the lengthof z
0
is bounded, the numberof su h words z
0 wy
q
isniteandtheyareultimatelyperiodi . Therearethenanitenumber ofsuÆxesofsu hwords.
Thefollowingproposition nallystatesthat thesequentialtransdu er Dis equivalenttothetransdu erT. Bothtransdu ersrealizethesamefun tionover innitewords.
Proposition34 The sequential transdu er D realizes the same fun tion f as the transdu erT.
Proof Werespe tivelydenotebyf andf 0
thefun tions realizedbythe trans-du erT andD. Werstprovethatifaninnitewordxbelongstothedomain off,italsobelongsto thedomainoff
0 andf(x)=f 0 (x). Letx =a 0 a 1 a 2
::: be aninnitewordwhi his in thedomain of f. Let beapath =i a 0 jv 0 !q 1 a 1 jv 1 !q 2 a 2 jv 2 ! (1)
be apath in T input labeled by x and whose output v 0 v 1 v 2 ::: is an innite word. Considertheuniquepath in Dinputlabeledbyx
=(i A ;J) a0jv 0 0 !(p 1 ;P 1 ) a1jv 0 1 !(p 2 ;P 2 ) a2jv 0 2 ! (2)
ByLemma26, ea hstateP n ontainsapair(q n ;z n ).
We rst suppose that x input labels a path in T entirely out of S. By Lemma30,it anbeassumedthatea hstateq
n
doesnotbelongtoS andthat ea h z
n
is nite. By Lemma 26, the equality v 0 :::v n =v 0 0 :::v 0 n z n holds for any integern. ByLemma 32, thelengths ofthe words z
n
are bounded. This impliestheequalityv
0 v 1 v 2 :::=v 0 0 v 0 1 v 0 2
::: ofthetwooutputs.
We now suppose that x is notthe input label of apath entirely outof S. There is then an integern su h that for any m n, P
m
only ontains pairs (q;z)withq2S andz innite. Both path and anbefa torized
=i u 0 jv 0 !q u 1 jv 1 !q u 2 jv 2 !q =(i A ;J) u0jv 0 0 !(p;P) u1jv 0 1 !(p;P) u2jv 0 2 !(p;P)
n p
u k
!pinA ontainsanalstateofA. Thesingleoutputofthestateq isv ! 1 . ByLemma26, thesubsetP ontainsapair(q;z)andv
0 y q =v 0 v ! 1 =v 0 0 z. Let(q 0 ;z 0
)beanotherpairinP. BydenitionofthetransitionsofD,there isasequen e(q
n )
n0
ofstatessu hthatthepairs(q n ;v 0 1 n z 0 )belongtoP. Sin e there is a nite number of states, there are n < m su h that q
n = q
m . This impliesthatthereisinT a y lingpatharoundq
n inputlabeledbyu m n 1 . Let q 00 =q n =q m . Werst laimthat v 0 1 n z 0 =z 0 . Ifthewordv 0 1 isempty, thisis obvious. Otherwise, Corollary27 implies that v
0 1 n z 0 =v 0 1 m z 0 . Thus z 0 = v 0 1 ! and theequality v
0 1 n z 0 =z 0
also holds. The subsetP ontainsa pair(q 0 0
;z 0
). ByLemma 26, there is apath i
u 0 jv 00 ! q 00 in T su h that v 0 0 z 0 = v 00 y q 00. By onstru tion,thereisalsoa y lingpatharoundq
0 0
inputlabeledbyu m n 1
. We supposethattheoutputlabelofthis y lingpathisthewordw. Ifthewordw isempty, Lemma 28,statesthat v
0 0 y q 0 0 =v 0 v ! 1
. Thus,onehasv 0 0 z 0 =v 0 0 y q 00 = v 0 v ! 1 = v 0 0 z and z = z 0
. If the word w is nonempty, one has y q 0 0 = w ! and f(u 0 u ! 1 )=v 00 w ! =v 0 v ! 1 . Thisimpliesz=z 0 .
Sin ewehaveprovedthatallpairs(q;z)inP sharethesameinnitewordz andsin eea hpathp
ui
!p ontainsanalstate,ea hwordv 0 i
isnonemptyby denition of the transitions of D and the equality v
0 1 v 0 2 v 0 3 ::: =z holds. This lastequalityimpliesthatv
0 y q =v 0 0 z=v 0 0 v 0 1 v 0 2 ::: and thatf(x)=f 0 (x). Conversely, the denition of the transitions of D implies that the domain off
0
is ontainedin thedomain of f. Thus bothfun tions f and f 0
have the samedomainandf =f
0 .
WehavealreadymentionedinProposition24thatit anbede idedwhether afun tion overinnite words realized by atransdu er with all states nal is sequential. Asinthe aseofnitewords,thealgorithmdes ribedaboveprovides anotherde isionpro edure. Indeed,Lemma32givesanupperbound Kof the lengthsofnite wordswhi h anappearin statesof D. LetT beatransdu er with all states nal realizing afun tion f. If the algorithm is applied to T, either it stops and givesasequentialtransdu er D orit reates astate (p;P) ontaining a pair (q;z) su h that the length of z is greater than K. In the former ase,thesequentialtransdu erDisequivalentto T and thefun tionf issequential. Inthelatter ase,thefun tionf isnotsequential.
A knowledgments
Theauthorswouldliketo thankJean Berstelforveryhelpfulsuggestionsand ChristianChorut for his relevant omments on apreliminary versionof this paper.
Referen es
[1℄ B
[2℄ eal, M.-P., andCarton, O. Computing theprexofan automaton. Te h.Rep.2000{08,InstitutGaspardMonge,2000.
[3℄ B
eal,M.-P.,andCarton, O. Determinizationoftransdu ersover in-nitewords. InICALP'2000 (2000),U.Montanariet al.,Eds.,vol.1853of Le t. NotesinComput.S i., pp.561{570.
[4℄ B
eal,M.-P.,Carton,O.,Prieur,C.,andSakarovit h,J.Squaring transdu ers: An eÆ ientpro edure forde idingfun tionalityand sequen-tiality. InLATIN'2000 (2000),G.Gonnet,D.Panario,andA.Viola,Eds., vol.1776ofLe t. NotesinComput.S i., pp.397{406.
[5℄ Berstel, J. Transdu tions and Context-Free Languages. B.G.Teubner, 1979.
[6℄ Berstel, J., and Perrin, D. Finite and innite words. In Algebrai Combinatori s on Words,M.Lothaire, Ed.Cambridge,1999. toappear.
[7℄ Blattner,M., andHead,T. Singledvalueda-transdu ers. J.Comput. System S i.15 (1977),310{327.
[8℄ Breslauer, D. ThesuÆxtreeofatreeandminimizingsequential trans-du ers. In CPM'96 (1996), vol. 1075 of Le t. Notes in Comput. S i., Springer-Verlag,pp.116{129.
[9℄ Breslauer,D. ThesuÆxtreeofatreeandminimizingsequential trans-du ers. Theoret. Comput.S i., 191(1998),131{144.
[10℄ Carton, O., Choffrut, C., and Prieur, C. Howto de ide fun tion-alityofrationalrelationsoninnitewords. Preprint.
[11℄ Choffrut,C. Une ara terisationdesfon tionssequentiellesetdes fon -tionssous-sequentiellesentantquerelationsrationnelles.Theoret.Comput. S i. 5 (1977),325{338.
[12℄ Choffrut, C. Contribution a l'etude de quelques familles remarquables de fon tions rationnelles. Thesed'
Etat,UniversiteParisVII,1978.
[13℄ Choffrut, C. A generalizationofGinsburg andRose's hara terization of gsmmappings. InICALP'79 (1979),vol.71ofLe t. NotesinComput. S i., pp.88{103.
[14℄ Cohen, A.,andCollard, J.-F. Instan e-wiserea hingdenition anal-ysis forre ursiveprogramsusing ontext-free transdu tions. InPACT'98 (1998).
[15℄ Cormen, T.H.,Leiserson,C.E., andRivest, R.L. Introdu tion to Algorithms. MITPress,1990.
[16℄ Eilenberg, S. Automata, Languages and Ma hines, vol. A. A ademi Press,NewYork,1972.
M.Lothaire,Ed.Cambridge,1999. toappear.
[18℄ Gire, F. Two de idability problems for innite words. Inform. Pro . Letters22 (1986),135{140.
[19℄ Kit hens, B. Continuity properties of fa tor maps in ergodi theory. Ph.D.thesis,UniversityofNorthCarolina,ChapelHill,1981.
[20℄ Lind, D., and Mar us, B. An Introdu tion to Symboli Dynami s and Coding. CambridgeUniversityPress,1995.
[21℄ Mohri, M. Minimization of sequentialtransdu ers. In CPM'94 (1994), M. Cro hemoreandD. Guseld, Eds.,vol.807of Le t. NotesinComput. S i., Springer-Verlag,pp.151{163.
[22℄ Mohri,M.Onsomeappli ationsofnite-stateautomatatheorytonatural languagespro essing. Journalof Natural LanguageEngineering 2 (1996), 1{20.
[23℄ Mohri, M. Minimizationalgorithmsfor sequentialtransdu ers. Theoret. Comput.S i., 234(2000),177{201.
[24℄ Prieur, C. How to de ide ontinuity of rational fun tions on innite words. Theoret.Comput.S i. (1999).
[25℄ Ro he, E., and S habes, Y. Finite-State Language Pro essing. MIT Press,Cambridge,1997, h.7.
[26℄ Safra, S. Onthe omplexityof!-automata. In29th Annual Symposium on Foundations ofComputer S ien es (1988),pp.24{29.
[27℄ S h
utenberger,M.-P. Surlesrelationsrationnelles. InAutomata The-ory andFormal Languages,2nd GI Conferen e (1975),H.Brakhage,Ed., vol.33ofLe t. NotesinComput. S i.,Springer,pp.209{213.
[28℄ S h
utenberger,M.-P.Surunevariantedesfon tionssequentielles. The-oret. Comput.S i. 11 (1977),47{57.
[29℄ Thomas, W. Automata on innite obje ts. In Handbook of Theoreti- al Computer S ien e, J.van Leeuwen, Ed., vol. B. Elsevier,1990, h. 4, pp.133{191.
[30℄ Weber, A., and Klemm, R. E onomy of des ription for single-valued transdu ers. InSTACS'94 (1994),vol.775ofLe t.NotesinComput.S i., Springer-Verlag,pp.607{618.
[31℄ Weber, A., and Klemm, R. E onomy of des ription for single-valued transdu ers. Inform. Comput.118 (1995),327{340.