An exursion into logi
1 Introdution.
Thishapterisdevotedtothepresentationofthelinksb etweenniteautomata
and logi. B uhi was therst to set upalogiallanguageequivalentto nite
automata. This logial formalismis rather unommon sine it makes use of
seond order variables. The reader will nd in the notes at the end of this
hapterthemotivationsthatdroveB uhiintothisdiretionandadesriptionof
thegenesisofthisasp etofthetheoryofautomata. Weshallsimplyemphasize
heretwoasp etsof thisquestion.
Itisremarkablethatallthelogialtheories o urringinthisframeworkare
deidabletheories. Thisisaonstantofthetheoryofniteautomatainwhih
mostoftheusual problemsarenotonlydeidable but evenoflowomplexity.
Showing o a deidable logial theory equivalent to nite automata is, in a
sense,aonrmationofthisgeneral priniple.
Furthermore,thelogialformalismisthesamefornitewordsandforinnite
words. Theonlyswitho ursintheinterpretationofformulas,inontrastwith
theformalismof automataor rationalexpressions, inwhih thenite and the
innitease have to b e distinguished. In asense, thematerialof this hapter
onstitutes ajustiation ofthe unity ofthe theories of automataonnite or
innitewords.
We rstpresent in Setion 2the elementsof formallogi neessary to un-
derstand the sequel. It onsists essentially of very elementary notionswhih
anb e skipp edby areader havingsomebakgroundinlogi. Weintro due in
partiularmonadiseond orderlogi,whihisthelogiallanguageequivalent
withautomata,asisshownfurtheron. Wedetailtheinterpretationofformulas
onwords. It amountsmainlyto onsiderawordasastruture byasso iating
toeahindexitheletterinp ositioni. Therelationsthatareusedaretheorder
relationb etween theindexesandtherelationa(i) expressingthat theletterin
p ositioniisana.
InSetion3,weprovetheequivaleneb etweenniteautomataandmonadi
seondorderlogi(B uhi'stheorem). Weprove thisresultfornitewordsand
forinnitewords. One oftheonsequenes of this result isthedeidabilityof
themonadiseondorderlogionnaturalintegers(alsoalled monadiseond
orderlogi ofone suessor). Besides, thepro of of thislatterresult is one the
motivationof the work of B uhi. The extension of B uhi's deidabilityresult
to two suessors is Rabin's theorem, whih will b e presented in Chapter X
(TheoremX.4.3).
The onversion fromautomata to logi an b e made by writinga formula
statingthatawordisthelab elofasuessfulpathinanautomaton.Thispro of
brings us a supplementary lue: every formulaof monadi seond order logi
is equivalentto aformulaoflowomplexityintermsofquantieralternation.
Inpartiular,thehierarhybased onthenumb erofquantieralternationsol-
lapses. We shallsee later on that this is amajordierene b etween rstand
seondorder.
Wealsoinvestigatetheexpressivep owerofthelogiallanguageobtainedby
replaingtheorderrelationonintegersbythesuessor funtion. We shallsee
that,forinnitewords,themonadiseondorderlogisofthese twolanguages
areequivalent. Itshouldnotb easurprisetothereaderfamiliarwithlogi,sine
the order relation is denable in monadiseond order logi of the suessor
funtion.
Furthermore, we show that monadi seond orderlogi is, on theintegers,
equivalentwith weak monadiseond order logi. Theweak logiutilizes the
same formulasas the \strong" one but the interpretation is morerestritive:
set variables are alwaysinterpreted as nite sets of integers. The equivalene
b etween weakandstronglogiisaonsequene ofMNaughton'stheorem. In-
deed, one an dedue from this theorem that eah rational set X A
!
is a
b o oleanombinationofsubsets oftheform
!
Y withY A
. Andsuh aset is
denablebytheformula
8x9y (y>x^'(y ))
where '(y ) is the formula expressing that the y 's rst letters of a word are
inY. Sine Y isa set of nite words,we an restrit ourselves to weak logi
to interpret '(y ). This interdep endene of results expressible in logi and in
termsofautomataisthemarkofthedeepandrealonnetionb etweenthetwo
approahes. Weshall seeotherexamplesinthesequel whenwe shalldealwith
rstorderlogi.
In Setion 4,we present the orresp ondingtheory forrst orderlogi. We
start byrst order theory of the linearorder sine, and it is arst dierene
with the monadiase, the logiof the linear order andthat of the suessor
arenolongerequivalent.
Therstorderlogiofthelinearorderisshowntob eequivalenttoap erio di
automataor,as we have seen inChapter VI,tostar-free sets. Thisis true for
nitewordsandforinnitewords.
InSetion4.2,we desrib ethehierarhyoftherstorderlogiofthelinear
order,orresp ondingtothealternateuseofexistentialanduniversalquantiers.
We showthat thishierarhyorresp onds,onwords,totheonatenation hier-
arhydesrib ed inChapterVI.Thisleads toadoublysatisfyingsituation: rst
order formulasnotonly orresp ondgloballyto anaturallass of reognizable
sets(the star-free sets),butthisorresp ondene holdslevelbylevel.
In Setion 5, we study amore restrited language, the rst order logi of
thesuessor. Wegive aneetive haraterizationofthesetsofinnitewords
denable in this logi: they are the threshold lo allytestable sets (dened in
Chapter VI I) whih are in the lass
2
(dened inChapter I I I. We shall in-
andwe shalluseitfor provingtheharaterization theorem.
We intro due inthe last setion the formalismof temporal logi and show
thatthislogiisequivalenttorstorderlogi.Finally,wedesrib e theexpres-
sive p owerof thetemp orallogiwithouttheuntilop erator.
InChaptersIXandX, we shallseehowthelogialframeworkpresented in
thishapter extends to themoregeneral ases ofbi-innite words and innite
trees.
2 The formalism of logi.
In this setion, we review the basi denitions of logi that will b e used in
thisb o ok. We shalldenesuessively rstorderlogi,seond order, monadi
seondorderandweakmonadiseondorder logi.
2.1 Syntax.
We shall rstdene thesyntax oflogial formulas. Letus start by rstorder
logi.
The basi ingredients are the logial symbols whih enompass the logial
onnetives: ^(and),_(or), :(not),! (implies),theequalitysymb ol=,the
quantiers9(thereexists)and8(forall),aninnitesetofvariables(mostoften
denotedbyx,y ,z,orx
0 ,x
1 ,x
2
,...) andparenthesis(toensurelegibilityofthe
formulas).
In addition to these logial symb ols, we make use of a set L of non logi-
al symb ols. These auxiliarysymb olsan b e of three typ es: relationsymb ols
(forinstane<),funtionsymb ols(forinstanemin),oronstant symb ols(for
instane 0, 1). Expressions are built from the symb ols of L by ob eying the
usualrules ofthesyntax,thenrst orderformulasarebuiltbyusing thelogi-
al symb ols,and aredenoted byF
1
(L). We nowgive adetailed desription of
thesyntaxi rulestoobtainthelogialformulasinthree steps, passingsues-
sively, followingthestandard terminology,fromterms to atomiformulasand
subsequentlyto formulas.
We shallillustratetheformationrulesbytakingas anexample
L=f<;min;0g
inwhih <is abinary relationsymb ol,minis atwo-variablefuntionsymb ol
and0isaonstant.
WerstdenethesetofL-terms. Itistheleastsetofexpressionsontaining
thevariables,theonstantsymb olsofL(iftherearesome)whihislosedunder
the following formation rule: if t
1
;t
2
;:::;t
n
are terms and if f is a funtion
symb ol with n arguments, then the expression f(t
1
;t
2
;:::;t
n
) is a term. In
partiular, if L do es notontain any funtionsymb ol,the onlyterms are the
variablesand theonstantsymb ols. Inour example,thefollowingexpressions
areterms:
x
0
min(0;0) min(x
1
;min(0;x
2
)) min(min(x
0
;x
1
);min(x
1
;x
2 ))
Theatomiformulasareformulaseitheroftheform
(t =t )
wheret
1 andt
2
areterms,or oftheform
R(t
1
;:::;t
n )
wheret
1
;:::;t
n
aretermsandwhereRisan-aryrelationsymb olofL. Onour
example,thefollowingexpressionsare atomiformulas:
(min(x
1
;min(0;x
2 ))=x
1
) (min(0;0)<0)
(min(min(x
0
;x
1
);min(x
1
;x
2
))<min(x
3
;x
1 ))
Notiethat,inordertoimprovelegibility,we didn'ttakeliterallythedenition
of atomiformulas: indeed, sine <isasymb olofbinary relation,one should
write<(t
1
;t
2
)instead oft
1
<t
2 .
Finally,therstorder formulasonL formtheleastsetof expressions on-
taining the emptyformulaand the atomiformulasand losed under thefol-
lowingformationrules:
(i) If('
i )
i2I
isanite familyofrstorderformulas,so aretheexpressions
(
^
i2I '
i
) and ( _
i2I '
i )
(ii) If'and are rstorderformulas,so aretheexpressions
:' and ('! )
(iii) If'isarstorderformulaandifxisavariable,thentheexpressions
(9x') and (8x')
arerstorderformulas.
Tomakenotationseasier,weset
true=
^
i2;
'
i
and false= _
i2;
'
i
Thefollowingexpressions arerstorderformulasof ourexamplelanguage:
(9x(8y ((y<min(z;0))^(x<0)))) (8x(y=x))
Again,it is onvenientto simplifynotationbysuppressing someof theparen-
thesis andwe shallwritethepreviousformulasundertheform
9x8y (y<min(x;0))^(z<0) 8xy=x
In arst orderformula, somevariableso ur after aquantier(existentialor
universal): the o urrenes of these variables are said to b e bounded and the
othero urrenes aresaidtob e free. Forexample,intheformula
9x(y<h(x;0))^8y (z<y)
thesimplyunderlinedo urrenes ofxandy areb oundedandtheo urrenes
of z and y doubly underlined are free. A variable is free ifat leastone of its
o urrenes is free. The set FV(') of free variables of a formula ' an b e
(1) If'isanatomiformula,FV(') istheset ofvariableso urringin',
(2) FV(:')=FV(')
(3) FV( V
i2I '
i
)=FV( W
i2I '
i )=
S
i2I FV('
i )
(4) FV('! )=FV(')[FV( )
(5) FV(9x')=FV(8x')=FV(')nfxg
Astatementisaformulainwhihallo urrenes ofvariablesareb ounded. For
example,theformula
9x8y (y<min(x;0))
isastatement.
Weshalldenoteby'(x
1
;x
2
;:::;x
n
)aformula'inwhihthesetoffreevari-
ablesisontainedinfx
1
;:::;x
n
g(but isnotneessarilyequaltofx
1
;:::;x
n g).
Thevariablesusedinrstorderlogi,orrst order)areinterpreted, aswe
shallsee,astheelementsofaset. Inseondorderlogi,onemakesuseofanother
typ eofvariables,alledseondordervariables,whihrepresentrelations. These
variablesaredenotedtraditionallybyapitalletters: X
0 ,X
1
,et.. Onebuiltin
this waythe set ofseond orderformulasonL,denoted by F
2
(L). The setof
termsisthesameasforrstorder. Theatomiformulasareeither oftheform
(t
1
=t
2 )
wheret
1 andt
2
areterms,oroftheform
R(t
1
;:::;t
n
) or X(t
1
;:::;t
n )
wheret
1
;:::;t
n
areterms,Risan-aryrelationsymb olofLandX isavariable
representingan-aryrelation.
Finally, seond order formulas on L formthe least set of expressions on-
tainingtheatomiformulasandlosedunderthefollowingformationrules:
(i) If'and areseondorder formulas,thenso are
:'; ('^ ); ('_ ); ('! )
(ii) If 'isaseondorder formula,if xisavariableand ifX isavariableof
relation,thentheexpressions
(9x') (8x') (9X') (8X')
areseondorder formulas.
Weallmonadiseond orderlogithefragmentofseondorderlogiinwhih
theonlyrelationvariablesareunaryrelationvariables,inotherwords,variables
representing subsets of the domain. By onveniene, they are alled set vari-
ables. We denotebyMF
2
(L)theset of monadiseond order logionL. We
shallalsousethenotationx2X insteadofX(x).
2.2 Semantis.
We have adopted so far a syntati p oint of view to dene formulaswith no
referene to semantis. But of ourse, formulaswould b e uninterestingif they
weremeaningless. Givingapreisemeaningtoformulasrequirestosp eify the
domainon whih we want tointerpret eah ofthe symb olsof thelanguageL.
Formally,astrutureS onL isgivenbyanonemptyset D ,alleddomainand
(1) toeahn-aryrelationsymb olofL,an-aryrelationdened onD ,
(2) toeahn-aryfuntionsymb olf ofL,an-aryfuntiondenedonD ,
(3) toeahonstantsymb olofL,anelementof D .
Todeongest notations, we shall use thesame notationfor therelation (resp.
funtion, onstant) symb ols and forthe relations (resp. funtions, onstants)
represented by these symb ols. The ontext willallow us to determine easily
what thenotationstands for. Forexample,we shallalwaysemploythesymb ol
< to designate the usual order relation on aset of integers, indep endently of
thedomain(N,Z,orasubsetof N).
We still have to interpret variables. Let us start by rst order variables.
Given a xed struture S on L, with domainD , a valuation on S is a map
from theset of variables into the set D . It is then easy to extend into a
funtionofthesetoftermsofL intoD ,byindutionontheformationrulesof
terms:
(1) If isaonstant symb ol,we put()=,
(2) iff isan-aryfuntionsymb oland ift
1 ,...,t
n
areterms,
f(t
1
;:::;t
n )
=f((t
1 ):::(t
n ))
If isavaluationanda anelementofD , we denoteby a
x
thevaluation 0
dened by
0
(y )= (
(y ) ify6=x
a ify=x
The notion of interpretation an b e now easily formalized. Dene, for eah
rstorderformula'andforeah valuation,theexpressions\thevaluation
satises'inS",or\S satises'[℄",denoted byS j='[℄,asfollows:
(1)Sj=(t
1
=t
2
)[℄ ifandonlyif(t
1 )=(t
2 )
(2)Sj=R(t
1
;:::;t
n
)[℄ifandonlyif (t
1
);:::;(t
n )
2R
(3)Sj=:'[℄ ifandonlyifnotSj='[℄
(4)Sj=(
^
i2I
')[℄ ifandonlyifforeah i2I; Sj='
i [℄
(5)Sj=( _
i2I
')[℄ ifandonlyifthereexistsi2I; Sj='
i [℄
(6)Sj=('! )[℄ ifandonlyifSj=6 '[℄orS j= [℄
(7)Sj=(9x')[℄ ifandonlyifSj='[
a
x
℄forsomea2D
(8)Sj=(8x')[℄ ifandonlyifSj='[
a
x
℄foreah a2D
Note that,atually, thetruth of theexpression \the valuation satises 'in
S"only dep ends onthevalues takenbythe free variables of'. In partiular,
if'isastatement,thehoieofthevaluationisirrelevant. Therefore,if'isa
statement,one saysthat'issatised byS (orthatS satises'),anddenote
bySj=',if,foreah valuation,S j='[℄.
Nextwemovetotheinterpretationofseondorderformulas. Givenastruture
S on L, with domain D , a seond order valuation on S is a map whih
asso iatestoeahrstordervariableanelementofDandtoeahn-aryrelation
n
IfisavaluationandRasubset ofD n
, R
X
denotesthevaluation 0
dened
by
0
(x)=(x)ifxisarstordervariable
0
(Y)= (
(Y) ifY 6=X
R ifY =X
Thenotionofinterpretation,alreadydenedforrstorder,issupplementedby
thefollowingrules:
(9) S j=(X(t
1
;:::;t
n
))[℄ifandonlyif (t
1
);:::;(t
n )
2(X)
(10)S j=(9X')[℄ ifandonlyifthere existsRD n
; Sj='[
R
X
℄
(11)S j=(8X')[℄ ifandonlyiffor eahRD n
; Sj='[
R
X
℄
Weak monadi seond order logi is omp osed with the same formulas than
monadiseondorderlogi,buttheinterpretation isevenmorerestrited: are
onlyonsideredvaluationswhih asso iatetosetvariablesnite subsetsof the
domainD .
Twoformulas'and aresaidtob elogiallyequivalentif,foreahstruture
S onL,wehave Sj='ifandonlyifS j= .
Itiseasy toseethatthefollowingformulasarelogiallyequivalent:
(1) '^ and :(:'_: )
(2) '! and :'_
(3) 8x' and :(9x:')
(4) '_ and _'
(5) '^ and ^'
(6) '^fal se and fal se
(7) '_fal se and '
Consequently, upto logialequivalene, we mayassumethat theformulasare
builtwithoutthesymb ols^,!and8.
Logialequivalenealsop ermitstogiveamorestruturedformtoformulas.
A formula is said to b e under disjuntive normal form if it an b e written
as disjuntion of onjuntions of atomi formulas or of negations of atomi
formulas,inotherwordsundertheform
_
i2I
^
j2Ji ('
ij _:
ij )
where I and the J
i
are nite sets, and where the '
ij
and the
ij
are atomi
formulas. Thenext resultisstandard andeasilyproved.
Prop osition2.1 Every quantier free formula is logially equivalent with a
quantierfreeformulain disjuntive normalform.
Oneansetupahierarhyinsiderstorderformulasasfollows. Let
0
=
0
thesetquantier-freeformulas. Next,foreahn0,denoteby
n+1
theleast
(1) ontainstheb o oleanombinationsofformulasof
n ,
(2) islosedunderdisjuntionsandniteonjuntions,
(3) if'2andifxisavariable,9x'2.
Similarly,denoteby
n+1
theleastset offormulassuh that
(1) ontainstheb o oleanombinationsofformulasof
n ,
(2) islosedunderdisjuntionsandniteonjuntions,
(3) if'2 andifxisavariable,8x'2 .
Inpartiular,
1
isthesetof existentialformulas|thatisoftheform
9x
1 9x
2 ::: 9x
k '
where'isquantier-free.
Finally,we denotebyB
n
thesetofb o oleanombinationsofformulasof
n .
Arstorderformulaissaidtob einprenex normalformifitisoftheform
=Q
1 x
1 Q
2 x
2 ::: Q
n x
n '
wheretheQ
i
areexistentialoruniversalquantiers(9or8)and'isquantier-
free. Thesequene Q
1 x
1 Q
2 x
2 ::: Q
n x
n
, whih an b e onsidered as aword
onthealphab et
f9x
1
;9x
2
;:::;8x
1
;8x
2
;:::g;
isalledthequantiationprexof . Theinterestoftheseformulasinprenex
normalformomesfromthefollowingresult.
Prop osition2.2 Every rst orderformula islogiallyequivalenttoa formula
inprenexnormalform.
Pro of. ItsuÆes toverifythatifthevariablexdo es noto ur intheformula
then
9x('^ )(9x')^
9x('_ )(9x')_
andthesameformulasholdforthequantier8. Heneitisp ossible,byrenaming
thevariables,tothrowbakthequantiers totheoutside.
Prop osition2.2anb eimprovedtotakeintoaounttheleveloftheformula
inthe
n
hierarhy.
Prop osition2.3 Foreah integern0,
(1) Every formulaof
n
islogiallyequivalenttoaformulainprenexnormal
forminwhihthe quantiation prexisasequene ofn(possibly empty)
alternating bloks of existentialand universalquantiers,starting with a
blokof existentialquantiers.
(2) Every formulaof
n
islogiallyequivalenttoaformulainprenexnormal
forminwhihthe quantiation prexisasequene ofn(possibly empty)
alternating bloks of existentialand universalquantiers,starting with a
For example,theformula
9x
1 9x
2 9x
3
| {z }
blo k1 8x
4 8x
5
| {z }
blo k2 9x
6 9x
7
| {z }
blo k3 '(x
1
;:::;x
6 )
b elongsto
3
(andalsotoall
n
'ssuh thatn3). Similarlytheformula
|{z}
blo k1 8x
4 8x
5
| {z }
blo k2 9x
6 9x
7
| {z }
blo k3 '(x
1
;:::;x
7 )
b elongsto
3
andto
2
, but notto
2
, sine theounting ofblo ksof a
n -
formulashouldalwaysb eginbyap ossiblyemptyblo kofexistentialquantiers.
One an intro due normalformsand ahierarhyforseond order monadi
formulas. Thus, one an show that every monadi seond order formula is
logiallyequivalentto aformulaoftheform
=Q
1 X
1 Q
2 X
2 ::: Q
n X
n '
wheretheQ
i
areexistentialoruniversalquantiersand'isarstorderformula.
2.3 Logi on words.
The logial language that we shall use now was intro dued by B uhi under
thenameof\sequentialalulus". Itp ermitsto formalizeertainprop ertiesof
words. Tointerpretformulasonwords,weshallonsiderawordu=u(0)u(1):::
as amap asso iating a letter to eah index. The set of indexes will itself b e
onsideredasasubset oftheset
N =N[f1g
thesetofnaturalnumb erswithanewmaximalelement,denotedby1.
LetAb eanalphab et. Foraninnitewordu2A
!
,wesetjuj=1,sothat
thelengthofawordisalwaysanelementofthesetN. Foreahwordu2A 1
,
onedenesthedomainofu,denotedbyDom(u)as
Dom(u)=fi2N j0ijujg
So, if u is a nite word, Dom(u) = f0;:::;jujg and if u is an innite word,
Dom(u)=N. Deneforeahlettera2Aaunaryrelationaonthedomainof
uby
a=fi<jujju(i)=ag:
Finally,letusasso iatetoeahworduthestruture
M
u
= Dom(u);(a)
a2A
;
Beware that, with these denitions, the domain of a nite or innite word
omprises a supplementary p osition at the end. One an imagine that this
p ositioniso upiedbyanend symb ol(the$prizedbylexialanalyzers...).
Forexample, ifu=abbaab,then Dom(u)=f0;1;:::;6g,a=f0;3;4gand
b=f1;2;5g. Ifu=(aba)
!
,then
a=fn2Njn0 mo d3or n2 mo d3gand
b=fn2Njn1 mo d3g
Fromnow and on, we shall interpret logial formulas onwords, that is, on a
strutureoftheformM
u
asexplainedab ove. Let'b eastatement. Aniteor
innitewordu2A 1
satises'ifthestrutureM
u
satises'. Thisisdenoted
byuj='. We alsosaythatuisamo delof'. Denethespetrumof'as the
set
S(')=fu2A 1
jusatises'g
We alsosetS
(')=S(')\A
,S +
(')=S(')\A +
andS
!
(')=S(')\A
!
.
Fromnowandon,allthevariableswillb einterpretedasnaturalintegersor
1. Therefore, we shall use logialequivalene restrited to interpretations of
domainN.
The various logial languages that we shall onsider all ontain, for eah
a2A, aunaryrelationsymb oldenoted(a)whennoonfusionarises. Weshall
also use two other non logial symb ols, < and S, that willb e interpreted as
theusualorderand asthesuessor relationonDom(u): S(x;y ) ifandonlyif
y = x+1. In thesequel, we shall mainlyonsider twologiallanguages: the
language
L
<
=f<g[faja2Ag
willb e alledthelanguageof thelinear orderandthelanguage
L
S
=fSg[faja2Ag
willb ealledthelanguageofthesuessor. Theatomiformulasofthelanguage
ofthelinearorder areoftheform
a(x); x=y ; x<y
andthoseofthelanguageofthesuessor areoftheform
a(x); x=y ; S(x;y ):
Weshalldenoteresp etivelybyF
1
(<)andMF
2
(<)thesetofrstorderand
monadiseond order formulasof signaturef<;(a)
a2A
g. Similarly,wedenote
byF
1
(S)andMF
2
(S)thesamesetsofformulasofsignaturefS;(a)
a2A
g. Inside
F
1
(<)(resp. F
1
(S)),the
n
(<)(resp.
n
(S))hierarhyisbasedonthenumb er
ofquantieralternations.
Weshallnowstarttheomparisonb etweenthevariouslogiallanguageswe
have intro dued. First of all,the distintionb etween thesignatures S and <
is onlyrelevantfor rstorder inview ofthe followingprop osition. A relation
R(x
1
;;x
n
)on theintegers is saidto b e dened bya formula'(x
1
;:::;x
n )
if,foreahi
1
;:::;i
n
0,R(i
1
;:::;i
n
)ifand onlyif'(i
1
;:::;i
n
)istrue.
Prop osition2.4 ThesuessorrelationanbedenedinF
1
(<),andtheorder
relationonintegersanbe denedinMF
2 (S).
Pro of. Thesuessor relationanb e denedbytheformula
(i<j)^8k
(i<k )!((j=k )_(j<k ))
whih states that j = i+1 if i is smaller than j and there exist no element
b etween iandj. Conversely,i<j an b eexpressed inMF
2
(S) asfollows:
9X
8x8y
(x2X)^S(x;y )
!(y2X)
^(j2X)^(i2=X)
whih intuitivelymeans that there exists anintervalof theform[k ;+1[on-
tainingjbut noti.
On theontrary, we shallsee later on(Corollary 5.10)that therelation <
annotb edened inF
1 (S).
GiventwosetsofformulasF andG,we usethenotationFGifforeah
formula of F, there exists an equivalent formula inG (we remind the reader
that the variables are alwaysinterpreted as integers). Denote by F G the
asso iatedequivaleneandbyF <GtherelationF GbutF 6G. Thenext
result summarizestheexpressive p owerofthevariouslogiallanguages.
Prop osition2.5 The followingrelationshold:
F
1
(S)<F
1
(<)<MF
2
(S)=MF
2 (<)
Pro of. Prop osition2.4showsthedoubleinequalityF
1
(S)F
1
(<)MF
2 (S).
Thefatthattheseinequalitiesarestritfollowresp etivelyfromCorollary5.10
andCorollary4.4,whihwillb e provedlateron.
Finally, we have MF
2
(S) MF
2
(<) sine S an b e expressed in F
1 (<),
whih inturn is ontainedinMF
2
(<). But we also have MF
2
(<) MF
2 (S)
sine,byProp osition2.4,therelation<an b edened inMF
2 (S).
It will b e onvenient to enrih our logial languages by adding auxiliary
formulaswhih anb e onsideredas abbreviations. We shallseeanexamplea
fewlinesb elowwiththeprediateFinite(X)whihexpressesthefatthataset
(ofintegers)isnite.
If xis a variable, it is onvenient to write x+1 (resp. x 1) to replae
avariable y submitted to the onditionS(x;y ) (resp. S(y ;x)). However, the
readershouldb ewareofthefatthatx+yisnotdenableinMF
2
(<)(Exerise
3).
Weanalsousethesymb olsand6=withtheirusualinterpretations: xy
stands for(x<y )_(x=y ) andx6=yfor:(x=y ).
Anotherexample,tob eusedb elow,arethesymb olsmin,max,whihdesig-
natetherstandthelastelementofthedomain.Thesesymb olsanb edened
inF
1
(S)withtwoalternationsofquantiers:
min: 9min 8x:S(x;min)
max: 9max 8x:S(max;x)
Thesesymb olsp ermittoexpressthatuistheemptyword(max=min)orthat
uisnite((max=min)_9xS(x;max)). WeshalldenotebyFINITEthelatter
formula.
We shall sometimesneedaparametrized,or relative,notionof satisfation
for aformula. Let indeed '(x;y ) b e aformulawithonly twofree variables x
and y . Let u2A 1
b ea wordand i;j 2Dom(u). A wordu2A 1
is saidto
satisfythe formula' b etween i and j if u
i :::u
j 1
j=' (or u
i u
i+1
:::j=' if
j=1).
Prop osition2.6 Foreahstatement',thereexistsaformula'(x;y ) withthe
same level in the hierarhy
n
), having x and y as unique free variables and
whihsatisesthe following property: foreah niteor inniteworduand for
eah s;t2Dom(u), uj='(s;t) ifand onlyif usatises'between sand t.
Pro of. Theformulas'(x;y ) are built byindutionon theformation rulesas
follows: if'isanatomiformula,weset '(x;y )='. Otherwise,weset
(:')(x;y )=:'(x;y )
('_ )(x;y )='(x;y )_ (x;y )
(9z')(x;y )=9z ((xz)^(z<y )^'(x;y ))
(9X')(x;y )=9X ((8z(X(z)!(xz)^(z<y ))^'(x;y ))
Itiseasytoverifythattheformulas'(x;y ) builtinthiswayhavetherequired
prop erties.
Weonludethissetionbyexaminingtheplaeoftheweaktheoriesofthe
linear order and the suessor. First of all, one an verify that the formulas
usedinthepro ofofProp osition2.4atuallydenetherelation<inWMF
2 (S)
(Exerise 1). Itfollowsthat
WMF
2
(S)=WMF
2 (<)
andthattheweakmonaditheoriesofthesuessor andofthelinearorderare
thesame.
Weshallseeontheotherhandthat
WMF
2
(<)=MF
2 (<)
so that theweak andstrongtheories of thelinearorderoinide. We an also
noteimmediatelythenext result,whihistrue inamuhmoregeneral setting
(atuallyasso onasonean writeaformulaexpressingthat aset isnite).
Prop osition2.7 The formula WMF
2
(<)MF
2
(<) holds.
Pro of. OneanwriteinMF
2
(<)aformulaFinite(X)expressingthatasetX
isnite. Forinstane
Finite(X)=9x(8y X(y )!y<x)
EveryformulaofWMF
2
(<)isequivalenttoaformulaoftheform
=Q
1 X
1 :::Q
n X
n '
where'isarstorderformula.Theformula isthenequivalenttotheformula
Q
1 X
1 :::Q
n X
n '^
^
1in
Finite(X
i )
ofMF
2 (<).
The formulas in whih the prediates a do not o ur p ertain uniquely to
integers. We shallseeinthenext setionthat thewords have nevertheless the
3 Monadi seond order logi on words.
Thissetionisdevotedtothepro ofofaresultofB uhistatingthatthesubsets
of A 1
denable inmonadi seond order logi are exatly the rational (resp.
! -rational)sets.
Theorem3.1 LetX A 1
bea set of niteor innite words. The following
onditionsareequivalent:
(1) X isdenable byaformula of MF
2 (<),
(2) X isreognizable.
The pro of of this result an b e deomp osed into two parts: passing from
words toformulas,andfromformulastowords.
Topassfromwordstoformulas,wesimulatetheb ehaviourofanautomaton
byaformula.
Prop osition3.2 For eah B uhi automaton A = (Q;A;E;I;F), there exist
formulas'
+
;'
! ofMF
2
(<)suh thatS +
('
+ )=L
+
(A),S
!
('
! )=L
!
(A) and
L 1
(A)=S('
+ _'
! ).
Pro of. Supp osethatQ=f1;:::;ng. Werstwriteaformula expressingthe
existene ofa pathof lab elu. Tothis purp ose, we asso iate to eah state q a
set variableX
q
whiheno des theset ofp ositionsinwhihagiven pathvisits
thestate q . Theformulastates thatthe X
q
'sare pairwisedisjointand that if
apath is instate q inp osition x,in state q 0
inp osition x+1and ifthe x-th
letterisana, then(q ;a;q 0
)2E. Thisgives
=
^
q 6=q 0
:9x(X
q
(x)^X
q 0
(x))
^
8x8yS(x;y )! _
(q ;a;q 0
)2E X
q
(x)^a(x)^X
q 0
(y )
It remainsto state that the pathis suessful. For anite path, itsuÆes to
knowthat 0b elongsto one oftheX
q
'ssuh that q2I and that maxb elongs
tooneoftheX
q
'ssuh thatq2F. Therefore,weset
+
= ^FINITE^
_
q 2I X
q (0)
^
_
q 2F X
q (max)
Aninnitepathissuessfulif0b elongstooneoftheX
q
'ssuhthatq2I and
if,for eah p ositionx, thereexists ap osition y>xinwhih thepath visitsa
nalstate. Insummary,weset:
!
= ^
_
q 2I X
q (0)
^
_
q 2F
8x9y (x<y ^ X
q (y ))
Theformulas
'
+
=9X
1 9X
2 :::9X
n (
+ )
' =9X 9X :::9X ( )
nowentirelyeno de theautomaton.
To pass from statements to sets of words, a natural idea is to argue by
indutionontheformationrulesofformulas. TheproblemisthatthesetS(')
is only dened when ' is a statement. The traditional solution in this ase
onsistsofaddingonstantstointerpret freevariablestothestruture inwhih
the formulas are interpreted. For the sake of homogeneity, we pro eed in a
slightlydierentway,sothatthese strutures remainwords.
Theideaistouseanextendedalphab etoftheform
B
p;q
=Af0;1g p
f0;1g q
suh thatp(resp. q )isgreater thanorequaltothenumb erofrstorder(resp.
seond order) variables of '. An innite word on the alphab et B
p;q
an b e
identiedwiththesequene
(u
0
;u
1
;:::;u
p
;u
p+1
;:::;u
p+q )
whereu
0 2A
!
andu
1
;:::;u
p
;u
p+1
;:::;u
p+q
2f0;1g
!
. Weareatuallyinter-
estedinthesetK
p;q
ofwordsofB 1
p;q
inwhiheahoftheomp onentsu
1
;:::;u
p
ontainexatlyoneo urrene of1. Iftheontextp ermits,we shallnoteB in-
steadofB
p;q
andK insteadofK
p;q
. We alsoset
K
=K\B
; K
!
=K\B
!
Forexample,ifA=fa;bg,awordofB
!
3;2
isrepresented inFigure3.1.
u
0
a b a a b a b
u
1
0 1 0 0 0 0 0
u
2
0 0 0 0 1 0 0
u
3
1 0 0 0 0 0 0
u
4
0 1 1 0 0 1 1
u
5
1 1 0 1 0 1 0
Figure3.1. AwordofB
!
3;2 .
Theelementsof K arealled marked wordsonA. This terminologyexpresses
the fat that the elements of K are (nite or innite) words in whih lab els
markingertainp ositionshaveb eenadded. Eahoftheprstrowsonlymarks
onep ositionandthelastq onesanarbitrarynumb erofp ositions.
Reall thatthestar-freesubsets of B 1
are obtainedfromthesets B 1
and
;byusingtheb o oleanop erationsandthemarkedprodut
(X ;b;Y)!XbY
whihasso iates toXA
,b2BandY B 1
,thesubset XbY ofB 1
. Star-
free sets areinpartiular rationalsubsets ofB 1
. Thenwe have the following
prop erty.
Prop osition3.3 For eah p;q0, the set K
p;q
is a star-free,and hene ra-
tional,subsetof B 1
.
Pro of. Set,for1ip,
C
i
=f(b
0
;b
1
;:::;b
p+q
)2Bjb
i
=1g
ThenK istheset ofwords ofB 1
ontainingexatlyone letterofeahC
i , for
1ip. Nowtheformula
K=
\
1ip B
C
i B
1
n [
1ip B
C
i B
C
i B
1
:
showsthatK isastar-free subset ofB 1
.
TheinterpretationofformulasonthewordsofB 1
p;q
followsthemainlinesof
theinterpretationdesrib edinSetion2.3,buttheinterpretationofaisslightly
mo diedbysetting
a=fi<jujju
0
(i)=ag:
Let '(x
1
;:::;x
r
;X
1
;:::;X
s
) b e a formula in whih the rst (resp. seond)
orderfreevariablesarex
1
;:::;x
r
(resp. X
1
;:::;X
s
),withrpandsq . Let
u=(u
0
;u
1
;:::;u
p+q
) b e awordof K
p;q
and, for1i p, denote byn
i the
p ositionoftheunique1ofthewordu
i
. Ontheexampleab ove,onewouldhave
n
1
=1, n
2
= 4and n
3
=0. A worduis said to satisfy' ifu
0
satises '[℄,
whereisthevaluationdened by
(x
j )=n
j
(1jr )
(X
j
)=fi2Nju
p+j;i
=1g (1js)
Inotherwords,eahX
j
isinterpretedasthesetofp ositionsof1'sinu
p+j ,and
eah x
j
as theuniquep ositionof 1inu
j
. Note thatfor p=q=0,we reover
theustomaryinterpretationofstatements.
Set
S
p;q
(')=fu2K
p;q
jusatises'(x
1
;:::;x
p
;X
1
;:::;X
q )g
Again,weshallsometimessimplyusethenotationS(')instead ofS
p;q
('). We
alsonote that S
(')=S(')\A
and S
!
(')=S(')\A
!
. Conjuntionsand
disjuntionsareeasily onvertedintob o oleanop erations.
Prop osition3.4 Foreahnitefamilyofformulas('
i )
i2I
,thefollowingequal-
itieshold:
(1) S(
W
i2I '
i )=
S
i2I S('
i ),
(2) S(
V
i2I '
i )=
T
i2I S('
i ),
(3) S(:')=K
p;q nS(')
Pro of. Thisisanimmediateonsequene ofthedenitions.
Toonludethepro of ofTheorem3.1,itremains toprove byindutionon
the formation rules of formulas that the sets S(') are rational. Let us start
with theatomiformulas. As forthe set K, we prove a slightly morepreise
Prop osition3.5 For eah variablex;y , for eah set variableX and for eah
lettera2A,thesetsofthe formS(a(x)),S(x=y ), S(x<y ) andS(X(x))are
star-free,and hene rational, subsetsof B 1
.
Pro of. Set,fori;j2f1;:::;p+q g
C
j;a
=fb2B
p;q jb
j
=1andb
0
=ag
C
i;j
=fb2B
p;q jb
i
=b
j
=1g
C
i
=fb2B
p;q jb
i
=1g
Thenwe have,bysetting B=B
p;q
S(a(x
i
))=K\B
C
i;a B
1
S(x
i
=x
j
)=K\B
C
i;j B
1
S(x
i
<x
j
)=K\B
C
i B
C
j B
1
S(X
i (x
j
))=K\B
C
i+p;j B
1
whihestablishestheprop osition.
Prop osition 3.4allowsone totreat logialonnetives. It remainsto treat
thease oftheformulasoftheform9x'and9X'. Denoteby
i
thefuntion
onsistingto \erase"thei-thomp onent,dened by
i (b
0
;b
1
;:::;b
p+q )=(b
0
;b
1
;:::;b
i 1
;b
i+1
;:::;b
p+q )
Thus
i
should b e onsidered asafuntionfromB
p;q into B
p 1;q
ifipand
intoB
p;q 1
ifp<ip+q .
Prop osition3.6 Foreah formula', the followingformulashold
(1) S
p 1;q (9x
p ')=
p (S
p;q ('))
(2) S
p;q 1 (9X
q ')=
p+q (S
p;q ('))
Pro of. Thisfollowsfromthedenitionofexistentialquantiers.
Weare nowreadyto showthatifS(') isrational,thenso areS(9x')and
S(9X'). Wemayassumethatx=x
p
andX =X
q
. Then,byProp osition3.6,
we have S(9x
p ') =
p
(S(')) and S(9X
q
') =
p+q
(S(')). Sine morphisms
preserve rationality,theresult follows.
This onludes thepro of ofB uhi'stheorem. Thereader willndinExer-
ise 4 the sketh of another pro of to pass fromwords to formulasbased on a
tradutionofrationalexpressions.
Wenowshow,asitwasannounedinSetion2.3thatstrongandweaklogi
oinideonwords.
Theorem3.7 The theoriesMF
2
(<) and WMF
2
(<) areequivalent onwords.
Pro of. Prop osition 2.7 shows that WMF
2
(<) MF
2
(<). To establish the
opp osite diretion,it suÆes, byB uhi's theorem, to show that eah rational
subset ofA 1
anb e dened byaformulaofWMF
2
(<). There isnoproblem
sets. ThereforeitsuÆestoonsidertheaseofareognizablesetX ofinnite
words.
By MNaughton'stheorem (TheoremI.9.1),X isab o oleanombinationof
sets of the form
!
Y . We laim that suh a set is denable in weak monadi
seond order logi. Indeed, let '(x;y ) b e a formula of WMF
2
(<) dening
Y (whih onsists of nite words). Then we have u j= '(0;n) if and only if
u
0 u
1 :::u
n 1
2Y byProp osition2.6andtheformula
=8x 9y (x<y )^'(0;y )
guaranties thatuhasinnitelymanyprexesinY. ThusS( )=
!
Y .
Another pro of of this result is given in Exerise 5. It onsists in o ding
diretly a Muller automaton by a weak monadi seond order formula. We
onludethissetionbymakingtwoobservationsoflogialnature.
First of all, B uhi's theorem allowsone to show that the monadi seond
ordertheoryofnonnegative integersisdeidable.
Theorem3.8 There is an algorithm to deide whether a given statement of
MF
2
(<) istrueon N.
Pro of. Let'2MF
2
(<). OneaneetivelyalulatethesetS(')anddeide
whetherS(')=A
!
or S(')=;.
Next, the pro of of Prop osition 3.2 shows that the hierarhy on formulas
of MF
2
(<) based on the numb er of alternations of seond order quantiers
ollapsesto therstlevel. Wehaveindeed thefollowingresult.
Prop osition3.9 Every formula of MF
2
(<) is equivalent to aformula of the
form
9X
1 :::9X
k '(X
1
;:::;X
k )
where'isarstorderformula.
Infat,one anevenshowthatevery formulaofMF
2
(<)isequivalenttoa
formulaoftheform9X'(X) where'is arstorderformula(Exerise 2).
4 First order logi of the linear order.
WenowstudythelanguageF
1
(<)oftherstorderlogiofthelinearorder. We
shall,inarststep,haraterizethesetsofwordsdenableinthislogi,whih
happ entob ethestar-freesets. Next,weshallseeinSetion4.2howthisresult
anb erenedtoestablishaorresp ondeneb etweenthelevelsthe
n
-hierarhy
ofrstorderlogiandtheonatenationhierarhyofstar-free sets.
4.1 First order and star-free sets.
We shallprove thefollowingkeyresult.
Theorem4.1 A set of nite or innite words is star-free if and only if it is
denable byaformula ofF (<).