HAL Id: hal-00619334
https://hal-upec-upem.archives-ouvertes.fr/hal-00619334
Submitted on 6 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 abroad, or from public or private research centers.
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 publics ou privés.
Frédérique Bassino, Marie-Pierre Béal, Dominique Perrin
To cite this version:
Frédérique Bassino, Marie-Pierre Béal, Dominique Perrin. A finite state version of the Kraft-McMillan theorem. SIAM Journal on Computing, Society for Industrial and Applied Mathematics, 2000, 30 (4), pp.1211-1230. �hal-00619334�
FR
ED
ERIQUE BASSINO
, MARIE-PIERRE B
EAL
, AND DOMINIQUE PERRIN
Abstrat. Themainresultisanite-stateversionoftheKraft-MMillantheoremharaterizing
thegeneratingsequeneofak-aryregulartree.Theproofusesanewonstrutionalledthemultiset
onstrutionwhihisaversionwithmultipliitiesofthewell-knownsubsetonstrutionofautomata
theory.
Keywords.generatingseries,regulartrees,nonnegativematries.
AMSsubjet lassiations.68Q45,68R10,94A45,37B10
1. Introdution. TheKraftinequality P
n0 s
n k
n
1haraterizesthegen-
erating sequenes (s
n )
n0
of leaves in a k-ary tree. It is used in onnexion with
Humanalgorithm tobuildprexodesorsearhtreesandusuallyrestritedto the
ase of nite trees. We are interested here in the ase of innite sequenes orre-
sponding to innite trees. These innite trees arise for example as searh trees in
innitesets. Theyalsoappearintheontextofniteautomata havingnestedloops
torepresentthesetofrstreturnstoagivenstate. Thetreethusobtainedisalleda
regulartree. Ithasonlyanitenumberofnon-isomorphisubtreessinetwosubtrees
orresponding to the samestate of theautomaton are isomorphi. The generating
sequenes ofsuh innitetreesare of interestin the appliations ofnite automata
totextompressionorhanneloding.
Our main result is a haraterization of the generating sequenes of leaves of
regular k-ary trees. Its essene is that the two onditions of being the generating
sequeneof
(i) ak-arytree
(ii) aregulartree
are independent in the sense that their onjuntion is enough to guarantee that a
sequeneisthegeneratingsequeneofaregulark-arytree.
The proof uses a new onstrution on graphs alled the multiset onstrution
whihisaounterpartforautomatawithmultipliitiesofthewell-knownsubseton-
strutionofautomatatheory.
Our resultshaveaonnexion with symbolidynamis. Atually, in both ases,
theemphasisisonthespaeofpathsinanite graph. Evenifwedonotuseresults
fromsymbolidynamis,someofthemethodsused,likestate-splittingorthePerron
theory are similar. Using an expression of Lind and Marus [15℄, our treatmentis
\dynamial in spirit". The relationship with symboli dynamis is disussed more
loselyin[7℄and[8℄.
The paper is organized as follows. Setion 2 ontains preliminary results and
denitions on graphs, trees, regularsequenes and the Perron-Frobeniustheory. In
Setion 3,wepresentthe multisetonstrution. Setion 4ontainsthe proofof our
mainresult(Theorem4.2). Thefollowingsetion(Setion5)treatsasimilarproblem,
withthesetofleavesreplaedbytheset ofallnodes.
The results ontained in this paper represent the terminal point of a series of
steps. Inapreviouspaper[7℄(withapreliminaryversionin[5℄),weprovedTheorem
InstitutGaspardMonge,UniversitedeMarne-la-Vallee,77454Marne-la-ValleeCedex2Frane.
fbassino,beal,perringu niv- mlv .fr.
4.2 in the partiular ase of a strit inequality. The proof uses the tehnique of
state-splitting from symboli dynamis. In the same paper, we also give a proof
of Theorem 5.3 whih is dierent from theproof given here,whih is based on the
multiset onstrution and is more simple. Part of the results of the present paper
waspresentedattheonfereneLATIN'98[6℄. Finally,thesurveypaper[8℄givesan
overviewoflengthdistributionsand regularsequenes.
2. Denitionsand bakground. Inthissetion,wexournotationonern-
ing graphs, trees and regular sequenes. We also reall some notions onerning
positivematries.
Awordontheterminologyusedhere. Weonstantlyusethetermregular where
ariherterminologyisoftenused. Inpartiular,whatweallherearegularsequene
is,in Eilenberg'sterminology,anN-rational sequene(see[11℄,[19℄or[10℄).
2.1. Graphs and trees. Inthispaper,weusediretedmultigraphsi.e.graphs
with possibly several edgeswith thesame originandthe sameend. We simplyall
them graphs in all what follows. We denote G = (Q;E) agraph with Q as set of
vertiesandE asset ofedges. WealsosaythatGisagraphontheset Q.
AtreeT onasetofnodesN witharoot r2N isafuntionT :N frg !N
whih assoiatesto eah node distint from theroot its fatherT(n), in suh away
that, for eah node n, there is a nonnegativeinteger h suh that T h
(n) = r. The
integerhistheheight ofthenoden.
A treeis k-ary ifeahnode hasat mostk hildren. A node withouthildrenis
alled aleaf. Anode whih isnotaleafis alledinternal. Anode nisadesendant
of a node m ifm = T h
(n) for someh 0. A k-ary tree is omplete ifall internal
nodeshaveexatlykhildrenandhaveatleastonedesendantwhihisaleaf.
For eah node n of a tree T, the subtree rooted at n, denoted T
n
is the tree
obtainedbyrestritingtheset ofnodestothedesendantsofn.
TwotreesS;Tareisomorphi,denotedS T,ifthereisamapwhihtransforms
S into T by permuting thehildren ofeah node. Equivalently, S T ifthere is a
bijetivemap f :N !M from theset ofnodesofS ontotheset ofnodesofT suh
thatf ÆS =T Æf. Suhamapf isalledanisomorphism.
If T is a tree with N as set of nodes, the quotient graph of T is the graph
G=(Q;E)where QandE aredenedasfollows. Theset QisthequotientofN by
theequivalenenmifT
n T
m
. Letm denotethelassofanodem. Thenumber
ofedgesfromm to nisthenumberofhildrenofmequivalentton.
Conversely, the set of paths in a graphwith given originis atree. Indeed, let
G = (Q;E) be a graph. Let r 2 Q be a partiular vertex and let N be the set
of paths in G starting at r. The tree T having N as set of nodes and suh that
T(p
0
;p
1
;:::;p
n )=(p
0
;p
1
;:::;p
n 1
)isalled theovering tree ofGstartingat r.
BothonstrutionsaremutuallyinverseinthesensethatanytreeT isisomorphi
totheoveringtreeof itsquotientgraphstartingat theimageoftheroot.
Proposition 2.1. Let T bea tree with root r. Let Gbeits quotient graph and
letibethevertexofGwhih isthe lassofthe rootofT. ForeahvertexqofGand
for eah n0,the numberof paths oflengthn fromi toqisequal tothe numberof
nodesof T atheight nin thelass of q.
A tree is said to beregularif it admits only anite number of non-isomorphi
subtrees,i.e. ifitsquotientgraphisnite.
For example, the innite tree represented on Figure 2.1 is a regular tree. Its
Fig.2.1. Aregulartree.
1 3
4 2
Fig.2.2.Anditsquotientgraph.
There isalsoaloseonnexion betweentreesand sets ofwordsonanalphabet.
Let X bea set ofwordson thealphabet f0;1;:::;k 1g. The set X is said to be
prex-losed ifanyprex ofanelementofX isalso inX. WhenX isprexlosed,
we anbuild atree T(X) asfollows. Theset of nodes is X, the root is the empty
wordandT(a
1 a
2 a
n )=a
1 a
2 a
n 1 .
LetforexampleX=f;0;1;10;11g.ThetreeT(X)isrepresentedonFigure2.3.
Fig.2.3.ThetreeT(X).
2.2. Regularsequenes. Weonsidersequenesofnaturalintegerss=(s
n )
n0 .
We shall not distinguish between suh a sequene and the formal series s(z) =
P
n0 s
n z
n
:
WeusuallydenoteavetorindexedbyelementsofasetQ,alsoalledaQ-vetor,
withboldfaesymbols. Forv=(v
q )
q2Q
wesaythatvisnonnegative,denotedv0,
(resp. positive, denoted v > 0) if v
q
0 (resp. v
q
> 0) for all q 2 Q. The same
onventions are used for matries. A nonnegative QQ-matrix M is said to be
irreduible if, forallindies p;q, there is anintegerm suh that (M m
) >0. The
matrixisprimitive ifthereisanintegermsuhthat M m
>0.
Theadjaeny matrix of agraphG=(Q;E) istheQQ-matrixM suh that
foreahp;q2Q,theintegerM
p;q
isthenumberofedgesfromptoq. Theadjaeny
matrixofagraphGisirreduibleithegraphisstronglyonneted. Itisprimitive
if,moreover,theg..d oflengthsofylesin Gis1.
LetGbeanitegraphandletI,T betwosetsofverties. Foreahn0,lets
n
bethenumberofdistintpathsoflengthnfromavertexofI toavertexofT. The
sequenes=(s
n )
n0
isalled thesequenereognized by(G;I;T)oralso by GifI
and T are alreadyspeied. When I =fig and T =ftg,wesimply denote(G;i;t)
insteadof (G;fig;ftg).
A sequene s = (s
n )
n0
of nonnegative integers is said to be regular if it is
reognizedbysuhatriple(G;I;T),whereGisnite. Wesaythatthetriple(G;I;T)
isarepresentationofthesequenes. ThevertiesofI arealledinitial andthoseof
T terminal. Tworepresentationsaresaidtobeequivalent iftheyreognizethesame
sequene.
Arepresentation(G;I;T)issaidto betrim ifeveryvertexofGisonsomepath
fromI toT. Itislearthatanyrepresentationisequivalenttoatrimone.
A wellknownresult in theory of nite automata allowsoneto use apartiular
representationofanyregularsequenessuhthats
0
=0. Oneanalwayshoosein
this ase arepresentation (G;i;t) of s with aunique initial vertex i, a uniquenal
vertext6=isuhthatnoedgeisenteringvertexiand noedge isgoingoutofvertex
t. Suh a representationis alled anormalized representation (see for example[17℄
page14).
Let (G;i;t) be atrim normalizedrepresentation. If we merge theinitial vertex
i and thenal vertext in a singlevertex still denoted byi, weobtaina newgraph
denotedbyG,whihisstronglyonneted. Thetriple(G ;i;i)isalledthelosureof
(G;i;t).
Let sbea regularsequene suh that s
0
=0. The star s
of thesequene sis
denedby
s
(z)= 1
1 s(z) :
Proposition 2.2. If (G;i;t) is a normalized representation of s, its losure
(G ;i;i)reognizesthe sequenes
.
Proof. Thesequene s isthe lengthdistribution ofthe pathsof rst returnsto
vertexiinG,thatisofnitepathsgoingfromitoiwithoutgoingthroughvertexi.
Thelengthdistributionof theset ofall returnsto iis thus 1+s(z)+s 2
(z)+:::=
1=(1 s(z)).
An equivalent denition of regular sequenes uses vetors instead of sets I;F.
Let i be a Q-rowvetorof nonnegativeintegers and let tbe aQ-olumn vetorof
nonnegativeintegers. Wesaythat(G;i;t)reognizesthesequenes=(s
n )
n0 iffor
eahintegern0
s
n
=iM n
t;
whereM istheadjaenymatrixofG. Theproofthatbothdenitionsareequivalent
followsfromthefatthatthefamilyofregularsequenesislosedunderaddition(see
[11℄). Atriple(G;i;t)reognizingasequenesisalsoalledarepresentationofsand
A sequenes=(s
n )
n0
ofnonnegativeintegersis rational ifitsatisesareur-
rene relationwithintegraloeÆients. Equivalently,s isrational ifthereexist two
polynomialsp(z);q(z)withintegraloeÆientsandwithq(0)=1suhthat
s(z)= p(z)
q(z) :
Anyregular sequeneis rational. Theonverseis howevernottrue(seeSetion
5). Forexample,thesequenesdenedbys(z)= z
1 z z 2
isthesequeneofFibonai
1 2
Fig.2.4.TheFibonaigraph.
numbersalsodenedbys
0
=0;s
1
=1ands
n+1
=s
n +s
n 1
. Itisreognizedbythe
graphofFigure 2.4withI =f1gandT =f2g.
2.3. Regular sequenes and trees. If T is atree, itsgenerating sequeneof
leaves is thesequene of numberss=(s
n )
n0
, where s
n
isthe numberof leavesat
heightn. Wealsosimplysaythat sisthegenerating sequene ofT.
Thefollowingresultisadiretonsequeneofthedenitions.
Theorem 2.3. The generatingsequeneof aregulartreeisaregularsequene.
Proof. LetT bearegulartreeandletGbeitsquotientgraph. SineT isregular,
G is nite. The leaves of T form an equivalene lass t. By Proposition 2.1, the
generating sequeneof T is reognizedby(G;i;t) where i isthelass of therootof
T.
Wesaythatasequenes=(s
n )
n1
satisestheKraft inequalityfortheinteger
kif
X
n0 s
n k
n
1;
i.e.usingtheformalseriess(z)= P
n0 s
n z
n
,if
s(1=k)1:
WesaythatssatisesthestritKraftinequalityforkifs(1=k)<1. Thefollowing
resultiswell-known(see[3℄page35forexample).
Theorem 2.4. A sequene s is the generating sequene of a k-ary tree i it
satisesthe Kraft inequalityfor the integerk.
Proof. LetrstTbeak-arytreeandletsbeitsgeneratingsequene. Itisenough
toprovethat,foreahn0,thesequene(s
0
;:::;s
n
)satisestheKraftinequality.
ItisthegeneratingsequeneofthenitetreeobtainedbyrestritingT tothenodes
atheightatmostn. WemaythussupposeT tobeanitetree. Wehave
s(z)=zt
1
(z)+:::+zt
k (z)
wheret
1
;:::;t
k
arethegeneratingsequenesofleavesofthe(possiblyempty)subtrees
rooted at the hildrenof the root of T. By indution on the number of nodes, we
havet (1=k)1whenethedesiredresult.
Conversely,weuseanindution onntoprovethatthereexistsak-arytreewith
generatingsequene(s
0
;:::;s
n
). Forn=0,wehaves
0
1andT iseitheremptyor
reduedtoonenode. SupposebyindutionhypothesistohavealreadybuiltatreeT
withgeneratingsequene(s
0
;s
1
;:::;s
n 1
). Wehave
n
X
i=0 s
i k
i
1;
then
n
X
i=0 s
i k
n i
k n
;
andthus
s
n k
n n 1
X
i=0 s
i k
n i
:
Thisallowsustoadds
n
leavesatheightnto thetreeT.
LetusonsidertheKraft'sequalityase. Ifs(1=k)=1,thenanytreeT havings
asgeneratingsequeneisomplete. Theonversepropertyisnottrueingeneral(see
[11℄p. 231). However,itis alassialresultthatwhenT is aomplete regulartree,
itsgeneratingsequenesatisess(1=k)=1(seeProposition2.8).
Forthesakeofaompletedesriptionoftheonstrutiondesribedaboveinthe
proof of Theorem 2.4, we have to speify the hoie made at eah step among the
leavesatheightn. Apossiblepoliyistohoosetogiveasmanyhildrenaspossible
tothenodeswhiharenotleavesandofmaximalheight.
IfwestartwithanitesequenessatisfyingKraft'sinequality,theabovemethod
builds a nite tree with generating sequene equal to s. It is not true that this
inremental method givesa regular tree when we start with a regular sequene, as
shownin thefollowingexample.
Lets(z)=z 2
=(1 2z 2
). Sines(1=2)=1=2,wemayapplytheKraftonstrution
to buildabinarytree withlengthdistribution s. Theresultisthe treeT(X)where
X istheset ofprexesoftheset
Y = [
n0 01
n
0f0;1g n
:
whihisnotregular.
Ifsisaregularsequenesuh thats
0
=0,thereexists aregulartreeT havings
asgeneratingsequene. Indeed,let(G;i;t)beanormalizedrepresentationofs. The
generatingsequeneoftheoveringtreeofGstartingatiiss. Ifssatisesmoreover
theKraftinequalityforanintegerk,itishowevernottruethat theregularovering
treeobtainedisk-ary,asshownin thefollowingexample.
Let sbethe regularsequene reognized bythe graphof Figure 2.5on theleft
withi=1andt=4. Wehaves(z)=3z 2
=(1 z 2
). Furthermores(1=2)=1andthus
ssatisesKraft'sequalityfork=2. Howevertherearefouredgesgoingoutofvertex
2and its regularoveringtreestarting at 1is 4-ary. A solution forthis exampleis
given by thegraph of Figure 2.5 onthe right. It reognizess and its overingtree
startingat1is theregularbinarytreeofFigure2.1.
TheaimofSetion4istobuildfromaregularsequenesthatsatisestheKraft
inequalityfor aninteger k a tree with generating sequene s whih is both regular
1 2 3
4
1 3
4 2
Fig.2.5.Graphsreognizings(z)=3z 2
=(1 z 2
).
2.4. Approximate eigenvetor. Let M be the adjaeny matrix of a graph
G. Bythe Perron-Frobenius theorem (see [12℄, for ageneral presentation and [15℄,
[14℄or[9℄forthelinkwithgraphsandregularsequenes),thenonnegativematrixM
hasanonnegativereal eigenvalueof maximalmodulus denotedby ,alsoalled the
spetralradiusofthematrix.
WhenGisstronglyonneted,thematrixisirreduibleandthePerron-Frobenius
theoremassertsthat thedimensionoftheeigenspaeofthematrixM orresponding
toisequalto one,andthat thereisapositiveeigenvetorassoiatedto .
Letkbeaninteger. Ak-approximateeigenvetorofanonnegativematrixM is,
bydenition,anintegralvetorv0suhthat
Mvkv :
Onehasthefollowingresult(see[15℄p.152).
Proposition 2.5. An irreduible nonnegative matrix M with spetral radius
admitsa positive k-approximate eigenvetorik.
Foraproof,see[15℄p.152. WhenMistheadjaenymatrixofagraphG,wealso
saythatvisak-approximateeigenvetorofG. Theomputationofanapproximate
eigenvetoranbeobtainedbytheuseofFranaszek'salgorithm(seeforexample[15℄).
Itanbeshownthatthereexistsak-approximateeigenvetorwithelementsbounded
abovebyk 2n
wheren isthedimensionof M [4℄. Thusthesize oftheoeÆientsof
ak-approximate eigenvetoris bounded abovebyanexponentialinn andanbein
theworstaseofthisorderofmagnitude.
Thefollowingresultiswell-known. Itlinkstheradiusofonvergeneofasequene
withthespetralradiusoftheassoiatedmatrix.
Proposition2.6. Letsbearegularsequenereognizedbyatrimrepresentation
(G;I;T). LetM bethe adjaeny matrixof G. Theradiusofonvergeneof sisthe
inverseof the maximaleigenvalueof M.
Proof. ThemaximaleigenvalueofM is=limsup
n0 n p
kM n
k,where kkis
anyof theequivalentmatrixnorms. Letbetheradiusofonvergeneofsand, for
eahp;q2Q, let
pq
betheradiusof onvergeneofthe sequeneu
pq
=(M n
pq )
n0 .
Then 1== min
pq
. Sine (G;I;T)is trim, we have
pq
for allp;q2 Q. On
the other hand, min
pq
sine s is a sum of some of the sequenes u
pq . Thus
s
=min
pq
whih onludestheproof.
Asaonsequeneofthisresult,theradiusofonvergeneofaregularsequene
sisapole. Indeed,withtheabovenotation,s(z)=i(1 Mz) 1
t. Thendet(I Mz)
is adenominator ofthe rationalfration s, thepolesof s areamong theinversesof
theeigenvaluesofM. Andsine1=istheradiusofonvergeneofs,ithasto bea