StefanBold,BenediktLo¨we,ThoralfRa¨sch,JohanvanBenthem(eds.) InfiniteGames Papersoftheconference“FoundationsoftheFormalSciencesV” heldinBonn,November26-29,2004 8 0 An ω-power of a context-free language 0 2 which is Borel above ∆0 ω n a Jacques Duparc and OlivierFinkel J 1 Universite´deLausanne, 1 InformationSystemsInstitute,and WesternSwissCenterforLogic,HistoryandPhilosophyofSciences ] BaˆtimentProvence C CH-1015Lausanne C . and s c [ EquipeMode`lesdeCalculetComplexite´ Laboratoiredel’InformatiqueduParalle´lisme⋆⋆ 1 CNRSetEcoleNormaleSupe´rieuredeLyon v 3 46,Alle´ed’Italie69364LyonCedex07,France. 8 E-mail:[email protected] and [email protected] 7 1 . 1 Abstract. Weuseerasers-likebasicoperationsonwordstoconstructasetthatis 80 bothBorelandabove∆0ω,builtasasetVωwhereV isalanguageoffinitewords acceptedbyapushdownautomaton.Inparticular,thisgivesafirstexampleofan 0 ω-powerofacontextfreelanguagewhichisaBorelsetofinfiniterank. : v i X 1 Preliminaries r a Given a set A (called the alphabet) we write A∗, and Aω, for the sets of finite, and infinite words over A. We denote the empty word by ǫ. In ⋆⋆UMR5668-CNRS-ENSLyon-UCBLyon-INRIA LIPResearchReportRR2007-17 Received:...; Inrevisedversion:...; Acceptedbytheeditors:.... 2000MathematicsSubjectClassification. PRIMARYSECONDARY. (cid:13)c 2006KluwerAcademicPublishers.PrintedinTheNetherlands,pp.1–14. 2 JACQUESDUPARCANDOLIVIERFINKEL order to facilitate thereading, we use u,v,w for finitewords, and x,y,z for infinite words. Given two words u and v (respectively, u and y), we writeuv (respectively,uy)for theconcatenationofu andv (respectively, ofuandy).LetU ⊆ A∗ andY ⊆ A∗∪Aω,weset:UY = {uv,uy : u ∈ X ∧v,y ∈ Y}. We recall that, given a language V ⊆ A∗, the ω-power of this lan- guageis Vω = {x = u u ...u ... ∈ Aω : ∀n < ω u ∈ V \{ε}} 1 2 n n Aω isequippedwiththeusualtopology.i.e.theproductofthediscrete topology on the alphabet A. So that every open set is of the form WAω for any W ⊆ A∗. Or, to say it differently, every closed set is defined as thesetofallinfinitebranchesofatreeoverA.WeworkwithintheBorel hierarchyofsetswhichisthestrictlyincreasing(forinclusion)sequence of classes of sets (Σ0) - together with the dual classes (Π0) and ξ ξ<ω1 ξ ξ<ω1 the ambiguous ones (∆0) - which reports how many operations of ξ ξ<ω1 countable unions and intersections are necessary to produce a Borel set on thebasisoftheopenones. A reduction relation between sets X, Y is a partial ordering X ≤ Y whichexpressesthattheproblemofknowingwhetheranyelementxbe- longs to X is at most as complicated as deciding whether f(x) belongs toY,forsomegivensimplefunctionf.Averynaturalreductionrelation between sets of infinite words (closely related to reals), has been thor- oughly studiedby Wadge in the seventies.From thetopologicalpoint of view, simple means continuous, therefore the Wadge ordering compares sets of infinite sequences with respect to their fine topological complex- ity. Associated with determinacy, this partial ordering becomes a pre- wellorderingwithanti-chainsoflengthatmosttwo.ThesocalledWadge HierarchyitinducesincrediblyrefinestheoldBorelHierarchy.Determi- nacy makes it way through a representation of continuous functions in termsofstrategiesforplayerIIinasuitabletwo-playergame:theWadge game W(X,Y). In this game, players I and II, take turn playing letters of the alphabet corresponding to X for I, and letters of the alphabet cor- responding to Y for II. In order to get the right correspondence between a strategy for player II and a continuousfunction, player II is allowedto skip,whereas Iis not.However,II mustplay infinitelymanyletters. Asusual,reductionrelationsinducethenotionofacompleteset:aset that both belongs to some class, whose members it also reduces. In the ABORELω-POWEROFACONTEXT-FREELANGUAGEABOVE∆0ω 3 contextofWadgereducibility,asetiscompleteifitbelongstosomeclass closed by inverse image of continuous functions, and reduces everyone of its members. A class which admits a complete set is called a Wadge Class.Asamatteroffact,allΣ0,andΠ0,areWadgeclasses,whereas∆0 ξ ξ ξ (ξ > 1)arenot. For instance, the set of all infinite sequences that contains a 1 is Σ0- 1 complete, the one that contains infinitely many 1s is Π0-complete. As 2 a matter of fact, reaching complete sets for upper levels of the Borel hierarchy,requires othermeanswhichweintroduceinnextsections. 2 Erasers For climbing up along the finite levels of the Borel hierarchy, we use erasers-likemoves,see[Dup01]. Forsimplicity,imagineaplayer(either IorII)playingaWadgegame,inchargeofasetX ⊆ Aω,withtheextra possibilityto deleteany terminalpartofherlast moves. WerecallthedefinitionoftheoperationX 7→ X≈oversetsofinfinite words. It was first introduced in [Fin01] by the second author, and is a simplevariantofthefirst author’soperationofexponentiationX 7→ X∼ whichfirst appeared in[Dup01]. We denote |v| the length of any finite word v. If |v| = 0, v is the empty word. If v = v v ...v where k ≥ 1 and each v is in A, then 1 2 k i |v| = k and we write v(i) = v and v[i] = v(1)...v(i) for i ≤ k ; so i v[0] = ǫ. The prefix relation is denoted ⊑: the finite word u is a prefix of the finite word v (denoted u ⊑ v) if and only if there exists a (finite) word w such that v = uw. the finite word u is a prefix of the ω-word x (denoted u ⊑ x)iffthereexistsan ω-wordy such thatx = uy. GivenafinitealphabetA, wewriteA≤ω forA∗ ∪Aω. Definition 2.1. Let A be any finite alphabet, և ∈/ A, B = A ∪ {և}, andx ∈ B≤ω, then և x is inductivelydefinedby: և ǫ = ǫ, andfora finiteword u ∈ (A∪{և})∗: և և (ua) = u a, ifa ∈ A, և և և (uև) = u with itslastletterremoved if|u | > 0, և և (uև) isundefinedif |u | = 0, andfor uinfinite: 4 JACQUESDUPARCANDOLIVIERFINKEL և և (u) = lim (u[n]) , where, given β andv inA∗, n∈ω n v ⊑ lim β ↔ ∃n∀p ≥ n β [|v|] = v. n∈ω n p We now make easy this definition to understand by describing it in- և formally.Forx ∈ B≤ω,x denotesthestringx,onceeveryևoccurring in x has been “evaluated” to the back space operation (the one familiar toyourcomputer!),proceedingfromlefttorightinsidex.Inotherwords և x = x from which every interval of the form “aև” (a ∈ A) is re- և և moved.Byconvention,weassume(uև) isundefinedwhenu isthe empty sequence. i.e. when the last letter և cannot be used as an eraser (because every letter of A in u has already been erased by some eraser և և placed in u). We remark that the resulting word x may be finite or infinite. Forinstance, և – ifu = (aև)n, forn ≥ 1, oru = (aև)ω then(u) = ǫ, և – ifu = (abև)ω then (u) = aω, և – ifu = bb(ևa)ω then(u) = b, և – if u = և(aև)ω or u = aևևaω or u = (aևև)ω then (u) is undefined. Definition 2.2. ForX ⊆ Aω, և X≈ = {x ∈ (A∪{և})ω : x ∈ X}. The following result easily follows from [Dup01] and was applied in [Fin01,Fin04]to studytheω-powersoffinitarycontextfree languages. Theorem 2.3. Let n be an integer ≥ 2 and X ⊆ Aω be a Π0-complete n set. Then X≈ is a Π0 -completesubsetof(A∪{և})ω. n+1 Nextremarks willbeessentiallater. Remark 2.4. Considerthefollowingfunction: f : x ∈ (A∪{և})ω 7→ y ∈ Aω defined by: և – y = 0ω ifx isfiniteorundefined, և – y = x otherwise. ABORELω-POWEROFACONTEXT-FREELANGUAGEABOVE∆0ω 5 It isclearly Borel. Infact aquickcomputationshowsthattheinverse imageofany basicclopen setis Borel oflowfiniterank. Remark 2.5. Let X beany subset oftheCantor space{0,1}ω, and f as inremark 2.4. If0ω 6∈ X, thenforanyx ∈ {0,1,և}ω x ∈ X≈ ⇐⇒ f(x) ∈ X In otherwords,X≈ = f−1X. Inparticular, ifX isBorel, so isX≈ 3 Increasing sequences of erasers The followingconstruction has been partly used by the second authorin [Fin04]to construct a Borel set ofinfiniterank which is an ω-power,i.e. in the form Vω, where V is a set of finite words over a finite alphabet Σ. We iterate the operation X 7→ X≈ finitely many times, and take the limit.Moreprecisely, Definition 3.1. Given anyset X ⊆ Aω: – X≈0 = X, k – X≈1 = X≈, k – X≈2 = (X≈1)≈, k k – X≈(k) = (X≈(k−1))≈, where we apply k times the operation X 7→ k k X≈ withdifferent newlettersև , և , ...,և , և , k k−1 2 1 in suchaway thatwehavesuccessively: • X≈0 = X ⊆ Aω, k • X≈1 ⊆ (A∪{և })ω, k k • X≈2 ⊆ (A∪{և ,և })ω, k k k−1 • X≈(k) ⊆ (A∪{և ,և ,...,և })ω. k 1 2 k – Weset X≈(k) = X≈(k). k X≈∞ ⊆ (A∪{և : 0 < n < ω})ω isdefined by n x ∈ X≈∞ ⇐⇒ def և – foreach integern, x = xև1...ևn−1 n isdefined, infinite,and n – x = lim x isdefined, infinite,andbelongstoX. ∞ n<ω n Remark 3.2. Considerthefollowingsequenceoffunctions: 6 JACQUESDUPARCANDOLIVIERFINKEL – f (x) = x (f is theidentity), 0 0 – f : (A∪{և : k < n < ω})ω 7−→ (A∪{և : k+1 < n < ω})ω k+1 n n defined by: և և • f (x) = x k+1 ifx k+1 isinfinite, k+1 և • f (x) = 0ω ifx k+1 isfiniteorundefined, k+1 By induction on k, one shows that every function f is Borel - and k evenBorel offiniterank. Moreover, since Borel functions are closed under taking the limits [Kur61], thefollowingfunctionisBorel. f : (A∪{և : 0 < n < ω})ω 7−→ Aω ∞ n defined by: – f (x) = lim f (x) iflim f (x) is defined, andinfinite, ∞ n<ω n n<ω n – f (x) = 0ω otherwise. ∞ Remark 3.3. LetX ⊂ {0,1}ω with0ω 6∈ X, thenforany x ∈ ({0,1}∪{և : 0 < n < ω})ω n x ∈ X≈∞ ⇐⇒ f (x) ∈ X ∞ In other words, X≈∞ = f −1(X), which shows that whenever X is ∞ Borel, X≈∞ isBorel too. In fact, with tools described in [Dup01], and [Dup0?], it is possible toshowthatgivenanyΠ0-completesetY,thesetY≈∞ belongstoΠ0 . 1 ω+2 IfX isthesetofinfinitewordsoverthealphabet{0,1}whichcontainsan infinite number of 1s, then it is also possible to show that X≈∞ is Borel by completely different methods involving decompositions of ω-powers [FS03,Fin04]. Proposition3.4. Let X be the set of infinitewords over {0,1}that con- taininfinitelymany1s, X≈∞ ∈ ∆1 \∆0 1 ω ABORELω-POWEROFACONTEXT-FREELANGUAGEABOVE∆0ω 7 Proof. The fact X≈∞ is Borel is Remark 3.3. As for X≈∞ ∈/ ∆0, it ω is a consequence of the fact that the operation Y 7−→ Y≈ is strictly increasing(fortheWadgeordering)inside∆0 (see[Dup01][Dup0?]).In ω other words, for any Y ∈ ∆0 the relation Y < Y≈ holds (< stands ω W W for the strict Wadge ordering). But, as a matter of fact, (X≈∞)≈ ≤ W X≈∞ holdswhich forbidsX≈∞ tobelongto ∆0. ω Indeed,toseethat(X≈∞)≈ ≤ X≈∞ holds,itisenoughtodescribe W awinningstrategyforplayerIIintheWadgegameW (X≈∞)≈,X≈∞ . (cid:0) (cid:1) In this game, player II uses ω many different erasers: և ,և ,և ,... 1 2 3 whose strength is oppositeto their indices (և erases all erasers և for k j any j > k but no և for i ≤ k). While player I uses the same erasers as i player IIdoes, plus an extraone(և) which is strongerthan all theother ones. The winningstrategyforII derivesfrom ordinal arithmetic:1+ω = ω.It consistsin copyingI’srun withashifton theindicesoferasers: – ifIplaysaletter0 or1,then IIplaysthesameletter, – ifIplaysan eraser և , IIplays theeraser և . n n+1 – if I plays the eraser և (the first one that will be taken into account when theerasingprocess starts),then IIplaysև . 0 Thisstrategyisclearly winning. 4 Simulating X≈∞ by the ω-power of a context-free language It was already known that there exists an ω-power of a finitary language which is Borel of infinite rank [Fin04]. But the question was left open whethersuchafinitary languagecouldbecontext free. This article provides effectively a context free language V such that Vω isaBorelsetofinfiniterank,andusesinfiniteWadgegamestoshow thatthisω-powerVω islocated above∆0 intheBorel hierarchy. ω The idea is to have X≈∞, where X stands for the set of all infinite words over {0,1} that contain infinitely many 1s to be of the form Vω forsomelanguageV recognizedbya(nondeterministic)PushdownAu- tomaton.Wefirstrecallthenotionofpushdownautomaton[Ber79,ABB96]. Definition 4.1. A pushdownautomaton(PDA)is a7-tuple M = (Q,A,Γ,δ,q ,Z ,F) 0 0 8 JACQUESDUPARCANDOLIVIERFINKEL where – Qis afinitesetof states, – Ais afiniteinputalphabet, – Γ isa finitepushdownalphabet, – q ∈ Qistheinitialstate,Z ∈ Γ isthestartsymbol, 0 0 – δ isa mappingfromQ×(A∪{ε})×Γ tofinitesubsetsof Q×Γ∗. – F ⊆ Qisthesetof finalstates. If γ ∈ Γ+ describes the pushdown storecontent, the leftmost symbol of γ will be assumed to be on “top” of the store. A configuration of a PDAisa pair(q,γ) whereq ∈ Qandγ ∈ Γ∗. Fora ∈ A∪{ε},γ,β ∈ Γ∗ and Z ∈ Γ,if (p,β)isinδ(q,a,Z),then we writea : (q,Zγ) 7→ (p,βγ). M 7→∗ isthetransitiveandreflexive closureof 7→ . M M Let u = a a ...a be a finite word over A. A finite sequence of 1 2 n configurations r = (q ,γ ) is called a run of M on u, starting in i i 1≤i≤p configuration(p,γ), iff: 1. (q ,γ ) = (p,γ) 1 1 2. for each i, 1 ≤ i ≤ p − 1, there exists b ∈ A ∪ {ε} satisfying i b : (q ,γ ) 7→ (q ,γ ) suchthat a a ...a = b b ...b . i i i M i+1 i+1 1 2 n 1 2 p−1 This run is simply called a run of M on u if it starts from configuration (q ,Z ). 0 0 The languageaccepted byM is L(M) = {u ∈ A∗:thereisa runr ofM onu endingina finalstate}. Forinstance,theset 0∗1 ⊂ {0,1}∗ istriviallycontext-free. Proposition4.2 (Finkel). Let L bethemaximalsubsetof n և և և ... n {0,1,և ,և ,...,և }∗ suchthatL 1 2 = 0∗1, 1 2 n n L is context-free n Thiswas first noticedby thesecond authorin [Fin01]. To be more precise, by u ∈ L we mean: we start with some u, n then weevaluateև as an eraser, and obtainu (providingthat wemust 1 1 neveruseև toerasetheemptysequence,i.e.everyoccurrenceofaև 1 1 symbol does erase a letter 0 or 1 or an eraser և for i > 1). Then we i ABORELω-POWEROFACONTEXT-FREELANGUAGEABOVE∆0ω 9 start again with u , this time we evaluate և as an eraser, which yields 1 2 u ,andsoon.Whenthereisnomoresymbolև tobeevaluated,weare 2 i left withu ∈ {0,1}∗. Wedefine u ∈ L iffu ∈ 0∗1. n n n To makeaPDA recognizeL , theideaistohaveitguess(non deter- n ministically), for each single letter that it reads, whether this letter will be erased later or not. Moreover, the PDA should also guess for each eraser it encounters, whether this eraser should be used as an eraser or whether it should not - for the only reason that it will be erased later on by a stronger eraser. During the reading, the stack should be used to accumulate all pendant guesses, in order to verify later on that they are fulfilled. We would very much like to prove that L∞ = [ Ln is context- n<ω free. Unfortunately, we cannot get such a result. However, we are able to show that a slightly more complicated set (strictly containing L ) is ∞ indeed context-free. Of course, the first problem that comes to mind when working with L , is to handle ω many different erasers with a finite alphabet. This ∞ impliesthaterasers mustbecodedbyfinitewords.Thiswas donebythe second author in [Fin03b]. Roughly speaking, the eraser և is coded n by the word αBnCnDnEnβ with new letters α,B,C,D,E,β. It is a little bit tricky, but the PDA must really be able to read the number n identifyingtheeraser fourtimes. The very definition of the sets L , requires the erasing operations n to be executed in an increasing order: in a word that contains only the erasersև ,...,և ,onemustconsiderfirsttheeraserև ,thenև ,and 1 n 1 2 so on... Therefore thiserasingprocess satisfythefollowingproperties: (a) An eraser և may only erase letters c ∈ {0,1} or erasers և with j k k > j. (b) Assume that in a word u ∈ L , there is a sequence cvw where c is n either in {0,1} or in the set {և ,...,և }, and w is (the code of) 1 n−1 an eraser և which erases c once the erasing process is achieved. k If there is in v (the code of) an eraser և which erases e, where j e ∈ {0,1} or e is (the code of) another eraser, then e must belong to v (itisbetweencandw inthewordu);moreovertheerasing-bythe eraser և - has been achieved before the other one with the eraser j 10 JACQUESDUPARCANDOLIVIERFINKEL և . Thisimpliesj ≤ k. Thustheintegerk mustsatisfy: k k ≥ max{j : an eraser և was usedinsidev} j Theessentialdifferencewiththecasestudiedin[Fin03b]isthathere aneraserև mayonlyeraseletters0or1orerasersև fork > j,while j k in [Fin03b] an eraser և was assumed to be only able to erase letters 0 j or1 orerasers և fork < j.So theaboveinequalitywas replaced by: k k ≤ min{j : an eraser և was usedinsidev} j However,withaslightmodification,wecanconstructaPDABwhich, amongwordswherelettersα,β,B,C,D,Eareonlyusedtocodeerasers ofthe form և , accepts exactly thewords which belongto thelanguage j L .WenowexplainthebehaviorofthisPDA.(Forsimplicity,wesome- ∞ timestalkabouttheeraser և insteadofitscodeαBjCjDjEjβ.) j Assume that A is a finite automaton accepting (by final state) the finitary language0∗1overthealphabetA = {0,1}. We can informally describe the behavior of the PDA B when reading a word u such that the letters α,B,C,D,E,β are only used in u to code theerasers և for1 ≤ j. j B simulates the automaton A until it guesses (non deterministically) that it begins to read a segment w which contains erasers which really eraseandsomelettersofAorsomeothereraserswhichareerasedwhen theoperationsoferasingare achievedinu. Then, still non deterministically, when B reads a letter c ∈ A it may guess that this letter will be erased and push it in the pushdown store, keepingin memorythecurrent stateoftheautomatonA. In a similar manner when B reads the code և = αBjCjDjEjβ, j it may guess that this eraser will be erased (by another eraser և with k k < j)andthenmaypushinthestorethefinitewordγEjν, whereγ,E, ν are inthepushdownalphabetofB. ButB mayalsoguessthattheeraserև = αBjCjDjEjβ willreally j be used as an eraser. If it guesses that the code of և will be used as an j eraser, B has to pop from the top of the pushdown store either a letter c ∈ A or the code γEi.ν of another eraser և , with i > j, which is i erased by և . j