aa r X i v : . [ c s . D M ] O c t A Unique Extension of Rich Words
Josef Rukavicka ∗ October 01, 2019Mathematics Subject Classification: 68R15
Abstract
A word w is called rich if it contains | w | + 1 palindromic factors,including the empty word. We say that a rich word w can be extendedin at least two ways if there are two distinct letters x, y such that wx, wy are rich.Let R denote the set of all rich words. Given w ∈ R , let K( w ) denote the set of all words such that if u ∈ K( w ) then wu ∈ R and wu can be extended in at least two ways. Let ω ( w ) = min {| u | | u ∈ K( w ) } and let φ ( n ) = max { ω ( w ) | w ∈ R and | w | = n } , where n > . Vesti(2014) showed that φ ( n ) ≤ n . In other words, it says that for each w ∈ R there is a word u with | u | ≤ | w | such that wu ∈ R and wu canbe extended in at least two ways.We prove that φ ( n ) ≤ n . In addition we prove that for each realconstant c > and each integer m > there is n > m such that φ ( n ) ≥ ( − c ) n . The results hold for each finite alphabet having atleast two letters. A word is called a palindrome if it is equal to its reversal. Two examples ofpalindromes are “noon” and “level”. It is known that a word w can containat most | w | + 1 distinct palindromic factors, including the empty word [2].If the bound | w | + 1 is attained, the word w is called rich . Quite many ∗ Department of Mathematics, Faculty of Nuclear Sciences and Physical Engineering,CZECH TECHNICAL UNIVERSITY IN PRAGUE ([email protected]). w is rich then there is a letter x such that wx is also rich. In [5] it was proved that if w is rich then there is a word u and two distinct letters x, y such that | u | ≤ | w | and wux, wuy are rich.Concerning this result, the author of [5] formulated an open question: • Let w be a rich word. How long is the shortest u such that wu canalways be extended in at least two ways?In the current article we improve the result from [5] and as such, to someextent, we answer to the open question. Let R denote the set of all richwords. We say that a rich word w can be extended in at least two ways ifthere are two distinct letters x, y such that wx, wy are rich. Given w ∈ R ,let K( w ) denote the set of all words such that if u ∈ K( w ) then wu ∈ R and wu can be extended in at least two ways; K( w ) contains the empty word if w can be extended in at least two ways. Let ω ( w ) = min {| u | | u ∈ K( w ) } and let φ ( n ) = max { ω ( w ) | w ∈ R and | w | = n } , where n > . The resultfrom [5] can be presented as φ ( n ) ≤ n .We show that φ ( n ) ≤ n . It is natural to ask how good this bound is. Therich word wu is called a unique rich extension of w if there is no proper prefix ¯ u of u such that w ¯ u can be extended in at least two ways. In Remark . in [5]there is an example which shows that there are w n , u n ∈ R such that w n u n is aunique rich extension of w n and | u n | = n , where n > . However in the givenexample the length of w n grows significantly more rapidly than the length of u n as n tends towards infinity. This could suggest that lim n →∞ φ ( n ) n = 0 ; weshow that this suggestion is false. We prove that for each real constant c > and each integer m > there is n > m such that φ ( n ) ≥ ( − c ) n .We explain the idea of the proof. Let w R denote the reversal of the word w . We construct rich words h n = u n v R tv n , where n ≥ such that1. The word t is the longest palindromic suffix of u n v Rn t .2. For every factor xpy of tv n we have that xpx is a factor of u n , where x, y are distinct letters and p is a palindrome.3. | h n | < | h n +1 | . 2et ¯ vx be a prefix of v n , where x is a letter. Let y be a letter distinctfrom x and let ypy be the longest palindromic suffix of u n v Rn t ¯ vy . Property 1implies that ypy is a suffix of y ¯ v R t ¯ vy , since ¯ v R t ¯ v is the longest palindromicsuffix of u n v Rn t ¯ v . Property 2 implies that ypy is not unioccurrent in u n v Rn t ¯ vy .In consequence u n v Rn t ¯ vy is not rich; see Proposition 2.3. Hence there is noproper prefix v of v n such that u n v Rn tv can be extended in at least two ways.It follows that | v n | ≤ ω ( u n v R t ) . Property 3 implies that for each m > thereis n such that | h n | > m .We will see that to find u n for given v n is quite straightforward. Thecrucial part of our construction is the word v n . To be specific, the word v n that we will present contains only a “small” number of factors xpy definedin Property 2. As a result the length of u n grows almost linearly with thelength of v n as n tends towards infinity. Consider an alphabet A with q letters, where q > . Let A + denote theset of all nonempty words over A . Let ǫ denote the empty word, and let A ∗ = A + ∪ { ǫ } . We have that R ⊆ A ∗ .Let F( w ) be the set of all factors of the word w ∈ A ∗ ; we define that ǫ, w ∈ F( w ) . Let Prf( w ) and Suf( w ) be the set of all prefixes and all suffixesof w ∈ A ∗ respectively; we define that { ǫ, w } ⊆ Prf( w ) ∩ Suf( w ) .Let SufU( v, u ) = S t ∈ Prf( u ) \{ ǫ } Suf( vt ) , where v, u ∈ A ∗ . The set SufU( v, u ) is the union of sets of suffixes of vt , where t is a nonempty prefix of u .We define yet the reversal that we have already used in the introduction:Let w R denote the reversal of w ∈ A ∗ ; formally if w = w w . . . w k then w R = w k . . . w w , where w i ∈ A and i ∈ { , , . . . , k } .Let lps( w ) and lpp( w ) denote the longest palindromic suffix and thelongest palindromic prefix of w ∈ A ∗ respectively. We define that lps( ǫ ) =lpp( ǫ ) = ǫ . Let lpps( w ) and lppp( w ) denote the longest proper palindromicsuffix and the longest proper palindromic prefix of w ∈ A ∗ respectively, where | w | ≥ . If | w | = 1 then we define lppp( w ) = lpps( w ) = ǫ .Let rtrim( w ) = v , where v, w ∈ A ∗ , y ∈ A , w = vy , and | w | ≥ . Let ltrim( w ) = v , where v, w ∈ A ∗ , x ∈ A , w = xv , and | w | ≥ . The functions rtrim( w ) and ltrim( w ) remove the last and the first letter of w respectively.Let occur( u, v ) be the number of occurrences of v in u , where u, v ∈ A + ;formally occur( u, v ) = |{ w | w ∈ Suf( u ) and v ∈ Prf( w ) }| . We call a factor3 unioccurrent in u if occur( u, v ) = 1 .We list some known properties of rich words that we use in our article.All of them can be found, for instance, in [3]. Recall the notion of a completereturn [3]: Given a word w and factors r, u ∈ F( w ) , we call the factor r acomplete return to u in w if r contains exactly two occurrences of u , one asa prefix and one as a suffix. Proposition 2.1. If w, u ∈ R ∩ A + , u ∈ F( w ) , and u is a palindrome thenall complete returns to u in w are palindromes. Proposition 2.2. If w ∈ R and p ∈ F( w ) then p, p R ∈ R . Proposition 2.3.
A word w is rich if and only if every prefix p ∈ Prf( w ) has a unioccurrent palindromic suffix. From Proposition 2.2 and Proposition 2.3 we have an obvious corollary.
Corollary 2.4.
A word w is rich if and only if every suffix p ∈ Suf( w ) hasa unioccurrent palindromic prefix. We define a left standard extension and a right standard extension of a richword. The construction of a standard extension has already been used in [5].The name “standard extension” has been introduced later in [4]. Here we usea different notation and we distinguish a left and a right standard extension.
Definition 3.1.
Let j ≥ be a nonnegative integer, w ∈ R , and | w | ≥ .We define ER j ( w ) , EL j ( w ) as follows: • ER ( w ) = EL ( w ) = w . • EL( w ) = EL ( w ) = xw , where x ∈ A is such that lppp( w ) x ∈ Prf( w ) . • ER( w ) = ER ( w ) = wx , where x ∈ A is such that x lpps( w ) ∈ Suf( w ) . • EL j ( w ) = EL(EL j − ( w )) , where j > . • ER j ( w ) = ER(ER j − ( w ) , where j > . et EL a ( w ) = { EL j ( w ) | j ≥ } . We call p ∈ EL a ( w ) a left standardextension of w . Let ER a ( w ) = { ER j ( w ) | j ≥ } . We call p ∈ ER a ( w ) aright standard extension of w .Remark . It is easy to see that ER j ( w ) = (EL j ( w R )) R and EL j ( w ) =(ER j ( w R )) R , where j ≥ .If x ∈ A then ER( x ) = EL( x ) = xx , since lppp( x ) = lpps( x ) = ǫ . Example . Let
A = { , , , } and w = 010200330 . Then we have: • lppp( w ) = 010 and lpps( w ) = 0330 . • ER( w ) = 0102003300 , ER ( w ) = 01020033002 , ER ( w ) = 010200330020 , ER ( w ) = 0102003300201 , ER ( w ) = 01020033002010 , ER ( w ) = 010200330020102 , ER ( w ) = 0102003300201020 . • EL( w ) = 2010200330 , EL( w ) = 02010200330 , EL( w ) = 002010200330 , EL( w ) = 3002010200330 , EL( w ) = 33002010200330 , EL( w ) = 033002010200330 , EL( w ) = 0033002010200330 , EL( w ) = 20033002010200330 .A left and a right standard extension of a rich word w is rich. In con-sequence, every rich word w can be extended to rich words wx, yw for someletters x, y ; this has already been proved in [3, 4, 5]. Lemma 3.4. If w ∈ R and | w | ≥ then ER a ( w ) ∪ EL a ( w ) ⊆ R .Proof. Since EL j ( w ) = (ER j ( w R )) R and since for every t ∈ ER a ( w ) \ { w } there is a rich word ¯ t ∈ ER a ( w ) such that t = ER(¯ t ) , it is enough to provethat ER( w ) ∈ R .Let xpx = lps(ER( w )) , where x ∈ A . Because w ∈ R , Proposition 2.3implies that we need to prove that xpx is unioccurrent in ER( w ) . Realize that p = lpps( w ) ; it means that p is either unioccurrent in w or w is a completereturn to p . In either case xpx is unioccurrent in ER( w ) . This completes theproof. We formally define a unique rich extension mentioned in the introduction.In addition we define a flexed point of a rich word.5 efinition 4.1. If u, v ∈ R ∩ A + , v ∈ Prf( u ) , and Prf(rtrim( u )) ∩ { vt | t ∈ ω ( v ) } = ∅ then we call u a unique rich extension of v .Given v ∈ R with | v | > , let T( v ) = { ux | ux ∈ Prf( v ) and x ∈ A and ux = ER( u ) } .We call w ∈ T( v ) a flexed point of v .Remark . Note that if x ∈ A and ux is a flexed point of a rich word v then u can be extended in at least two ways. A similar notion of a “flexedpalindrome” has been used in [4]. Example . Let
A = { , , } . • The rich word can be extended in at least two ways, because , , and are rich. • The rich word cannot be extended in at least two ways be-cause and are not rich. Only the right standardextension is rich. Hence is a unique rich extensionof . • If w = 201011011101111011111001 then w is unique rich extensionof w ; this example is a modification of the example in Remark . in[5]. • If w = 2010110111011110111 then the set of flexed points of w is: T( w ) = { , , , , , , } .There is a connection between a unique rich extension and a right stan-dard extension. Lemma 4.4. If u is a unique rich extension of w then u ∈ ER a ( w ) .Proof. Suppose there is ¯ ux ∈ Prf( u ) such that ¯ u ∈ ER a ( w ) , x ∈ A , and ¯ ux ER a ( w ) . Then obviously ¯ u can be extended in at least two ways, sinceboth ¯ ux and ER(¯ u ) are rich. Hence u cannot be a unique rich extension of w . The lemma follows. 6o simplify the formulation of next lemmas and propositions concerninga unique rich extension we define an auxiliary set Γ as follows: ( v, ¯ v, u ) ∈ Γ if v ¯ vu is a unique rich extension of v ¯ v and lpps( v ¯ v ) = ¯ v , where v, ¯ v, u ∈ R ∩ A + .We show that if wu is unique rich extension of w , then lpps( w ) is unioc-current in lpps( w ) u . Proposition 4.5. If ( v, ¯ v, u ) ∈ Γ then occur(¯ vu, ¯ v ) = 1 .Proof. The proposition follows from the proof of Theorem . in [5]. Theauthor shows that a rich word w can be extended into a rich word w ¯ w insuch a way that a n is a suffix of w ¯ w , where a n is the largest power of someletter a ∈ A . It is proved that w ¯ w can be extended in at least two ways. Inboth cases distinguished in the proof of Theorem . in [5] it is easy to seethat occur(lpps( w ) ¯ w, lpps( w )) = 1 . The proposition follows.We present two simple properties of a unique rich extension. Lemma 4.6.
Let ( v, ¯ v, u ) ∈ Γ .1. If | u | ≤ | v | then u R ∈ Suf( v ) .2. If | u | ≥ | v | then v R ∈ Prf( u ) .Proof. Obviously v ¯ vv R ∈ ER a ( v ¯ v ) . Lemma 4.4 implies that v ¯ vu ∈ ER a ( v ¯ v ) .The lemma follows.The next proposition discusses words of the form v ¯ vux , where v ¯ vux isunique rich extension of v ¯ v , x is a letter, ¯ v is the longest proper palindromicsuffix of v ¯ v , and ¯ vux is a flexed point of ¯ vux . The proposition asserts thatthere are words t , t such that v = t t , xu R is a proper suffix of t , and ¯ vt R is a flexed point of ¯ vt R . In particular it implies that | v | > | ux | . Proposition 4.7. If ( v, ¯ v, ux ) ∈ Γ and ¯ vux ∈ T(¯ vux ) then there exist t , t ∈ R such that • v = t t , • xu R ∈ Suf(ltrim( t )) , and • ¯ vt R ∈ T(¯ vt R ) . roof. Let w = lpps(¯ vu ) and let y ∈ A be such that yw ∈ Suf(¯ vu ) . Since ¯ vux ∈ T(¯ vux ) we have that x = y .Obviously ywy ∈ F( v ¯ vu ) because v ¯ vux is a unique rich extension of v ¯ v and thus v ¯ vuy R . Hence the palindromic suffix ywy of v ¯ vuy is not unioc-current in v ¯ vuy , see Proposition 2.3.We have that w is unioccurrent in ¯ vu and ¯ v F( w ) , since w = lpps(¯ vu ) and ¯ v is unioccurrent in ¯ vu , see Proposition 4.5. It follows that there are t , t ∈ F( v ) such that v = t t , ywy ∈ Prf( t ¯ vux ) and ywy is unioccurrentin t ¯ vux . Thus lpp( yt ¯ vux ) = ywy .From the fact that ¯ v F( w ) follows that ywy ∈ Prf( t ¯ v ) . Lemma 4.6implies that | t | ≥ | ux | and xu R ∈ Suf(ltrim( t )) . Just consider that | t | ≤| ux | would imply that ywy ∈ F(¯ vux ) .Since xu R ¯ v ∈ Suf( t ¯ v ) , w ∈ Suf(¯ vu ) , ywy ∈ Prf( t ¯ v ) , and x = y it followsthat occur( t ¯ v, w ) > ; hence Proposition 2.1 implies that lppp(ltrim( t ¯ v )) = w . It follows that t ¯ v = EL(ltrim( t ¯ v )) . Consequently ¯ vt R = ER(rtrim(¯ vt R )) and thus ¯ vt R ∈ T(¯ vt R ) . This completes the proof.We step to the main result of this section. The theorem says that if v ¯ vu is a unique rich extension of v ¯ v and ¯ v is the longest proper palindromic suffixof v ¯ v then u is not longer than v ¯ v . Theorem 4.8. If ( v, ¯ v, u ) ∈ Γ then | u | ≤ | v ¯ v | .Proof. Let ( v, ¯ v, u ) ∈ Γ . If | u | + | lpps(¯ v ) | ≤ | ¯ v | then clearly | u | ≤ | v ¯ v | . For therest of the proof suppose that | u | + | lpps(¯ v ) | > | ¯ v | . We show that the set offlexed points T(¯ vu ) is nonempty. Let ¯ v = h lpps(¯ v ) . Proposition 4.5 impliesthat h R Prf( u ) , because occur( h lpps(¯ v ) h R , ¯ v ) = 2 . Since | u | + | lpps(¯ v ) | > | ¯ v | it follows that there are ¯ u ∈ R and x ∈ A such that ¯ ux ∈ Prf( u ) and ¯ v ¯ ux = ER(¯ v ¯ u ) ; just realize that h lpps(¯ v ) h R ∈ ER a ( h lpps(¯ v )) . We showedthat T(¯ vu ) \ Prf(¯ v ) = ∅ .Without lost of generality, suppose that ¯ v ¯ ux is the longest flexed pointfrom the set T(¯ vu ) \ Prf(¯ v ) and suppose that | u | > | v | . Proposition 4.7asserts that there are t , t ∈ R such that v = t t , ¯ vt R ∈ T(¯ vt R ) , and x ¯ u R ∈ Suf(ltrim( t )) . If | u | > | v | , then ¯ vt R ∈ Prf(¯ vu ) , see Lemma 4.6. Thisis a contradiction, since we supposed that ¯ v ¯ ux is the longest flexed point of ¯ vu . We conclude that | u | ≤ | v | . This completes the proof.The simple corollary is that if wu is a unique rich extension of w then u is not longer than w . 8 orollary 4.9. If n ≥ then φ ( n ) ≤ n .Proof. The corollary is obvious for n ∈ { , } . If wu is a unique rich extensionof w , | w | ≥ , and | u | ≥ then there is clearly ( v, ¯ v, u ) ∈ Γ such that w = v ¯ v .Then the corollary follows from Theorem 4.8. Definition 5.1.
We call a word xpy a switch if x, y ∈ A , x = y , and p ∈ A ∗ is a palindrome. Let sw( v ) = { w | w ∈ F( v ) and w is a switch } . Let swSuf( v, u ) = sw( vu ) ∩ SufU( v, u ) , where v, u ∈ A ∗ .Given S ⊆ A ∗ , let rdc( S ) = { w | w ∈ S and w [ u ∈ S \{ w } F( u ) } .We call rdc( S ) a reduction of S .Suppose xpy is a switch, let spc( xpy ) = xpx , where x, y ∈ A . We call spc( xpy ) a switch palindromic closure of the switch xpy . If B ⊂ A + is a setof switches then we define spc( B ) = rdc( S w ∈ B { spc( w ) } ) .Remark . Note that if xpy is a switch, then p can be the empty word.The set swSuf( v, u ) is a set of switches that are suffixes of v ¯ u for allnonempty prefixes ¯ u of u .The reduction rdc( S ) of the set S is a subset of S and contains onlyelements that are not proper factors of other elements of S .The switch palindromic closure of a set B is a reduction of the union ofall switch palindromic closures of switches from the set B . Example . Let
A = { , , } , v = 0100110 , and u = 12 . Then we have: • sw( vu ) = { , , , , , , , , , , } . • swSuf( v, u ) = (sw( v ∩ Suf( v ∪ (sw( v ∩ Suf( v { } ∪ { , , } . • spc(001101) = 001100 , spc(12) = 11 , spc(012) = 010 , spc(11012) = 11011 . 9 spc(swSuf( v, u )) = rdc( { , , , } ) = { , , } .The following proposition clarifies the importance of switches for a uniquerich extension of rich words. The proposition says that if • wu R ¯ vu is a rich word and • ¯ v is the longest palindromic suffix of wu R ¯ v and • x is a factor of w for every letter and • for every switch t which is a suffix of wu R ¯ v ¯ u for some ¯ u ∈ Prf( u ) wehave that spc( t ) is a factor of w then wu R ¯ vu is unique rich extension of wu R ¯ v . Proposition 5.4. If w, u, ¯ v ∈ A + , wu R ¯ vu ∈ R , lps( wu R ¯ v ) = ¯ v , A ∩ F( w ) =A , and spc(swSuf( wu R ¯ v, u )) ⊆ F( w ) then wu R ¯ vu is a unique rich extensionof wu R ¯ v .Proof. We show that there is no prefix ¯ ux ∈ Prf( u ) ∩ ω ( wu R ¯ v ) , where x ∈ A .Suppose that there is ¯ ux ∈ Prf( u ) ∩ ω ( wu R ¯ v ) . Let y ∈ A be such that x = y and wu R ¯ v ¯ uy ∈ R . Let t = lps( wu R ¯ v ¯ uy ) . We distinguish two cases: • t ∈ A . The assumptions of the proposition guarantee that t ∈ F( w ) . • t = y ¯ ty for some palindrome ¯ t . Clearly y ¯ tx ∈ swSuf( wu R ¯ v, u ) and theassumptions of the proposition guarantee that t = spc( ytx ) = yty ∈ F( w ) .It follows that the longest palindromic suffix t is not unioccurrent, hence wu R ¯ v ¯ uy is not rich; see Proposition 2.3. This completes the proof.Given a factor u of a word w , for us it will not be important if u or u R isunioccurrent in w . For this purpose we define a special notion. Definition 5.5. If P v ∈{ u,u R } occur( w, v ) = 1 then we say that the word u is reverse-unioccurrent in w , where w, u ∈ A + .Remark . The notion of reverse-unioccurrence has also been used in [4].We show that if the switch ytx is a suffix of the word wx and ytx isreverse-unioccurrent in wx then wx is a flexed point of wx .10 emma 5.7. If w, wx ∈ R , x, y ∈ A , ytx ∈ Suf( wx ) ∩ sw( wx ) , and ytx isreverse-unioccurrent in wx then wx ∈ T( wx ) .Proof. Suppose that wx ∈ ER a ( w ) . If u = lpps( w ) then | t | < | u | and t ∈ Prf( u ) ∩ Suf( u ) . It follows that xux ∈ Suf( wx ) and ty ∈ Prf( u ) , since yt ∈ Suf( u ) . Consequently xty ∈ Prf( xu ) , which is a contradiction, because xty is reverse-unioccurrent in wx . The lemma follows.There is an obvious corollary of Lemma 5.7 saying that if t is a switch of w , then there is a flexed point v of w such that either t or t R is a suffix of v . Corollary 5.8. If w ∈ R , t ∈ sw( w ) then there is v ∈ T( w ) such that { t, t R } ∩ Suf( v ) = ∅ .Proof. If w ∈ R and t ∈ sw( w ) , then there is obviously u ∈ Prf( w ) such that { t, t R } ∩ Suf( u ) = ∅ and t is reverse-unioccurrent in u . Then Lemma 5.7implies that u ER a (rtrim( u )) . This completes the proof.In order to construct a word with a prefix containing all switch palin-dromic closures of its switches we introduce two functions ewp and elpp . Definition 5.9. If w, t ∈ R ∩ A + and t is a palindrome then we define Σ w,t = { u | u ∈ Prf( w ) and | u | ≥ | lppp( w ) | and rtrim( t ) ∈ Suf( u ) } .If Σ w,t = ∅ then let ¯ π w,t denote the shortest element of Σ w,t and let π w,t besuch that ¯ π w,t = lppp( w ) π w,t .Let x = Prf( t ) ∩ A and let ewp( w, t ) = ( x ( π w,t ) R w if Σ w,t = ∅ and t F( v R w ) w otherwise.In addition we define ewp( w, t , t , . . . , t m ) = ewp( . . . (ewp(ewp( w, t ) , t ) , . . . ) , t m ) ,where w is a nonempty rich word and t , t , . . . , t m are rich nonempty palin-dromes.Given w ∈ A + and x ∈ A , let maxPow( w, x ) = k such that x k ∈ F( w ) and x k +1 F( w ) .Suppose w ∈ R , y ∈ A , and k = maxPow( w, y ) . Let elpp y ( w ) =ewp( w, y k +1 ) . emark . The notation “ewp” stands for “extension with prefix”. It isclear that ( π w,t ) R w is a left standard extension of w that has as a prefix ltrim( t ) .The notation “maxPow” stands for “maximal power”. If x F( w ) then maxPow( w, x ) = 0 .The notation “elpp” stands for “extension with letter power prefix”. Thefunction elpp y ( w ) is the word yu where u is a left standard extension of w such that y maxPow( w,y ) is a prefix. If maxPow( w, y ) = 0 then elpp y ( w ) = yw . Example . Let
A = { , , } , w = 2020111010111010 , t = 11011 , and t = 20201 . Then we have: • rtrim( t ) = 1101 , ltrim( t ) = 1011 , lpp( w ) = 202 . • Σ w,t = { , } , σ w,t = 011101 . • ewp( w, t ) = 11011102020111010111010 . • Let v = ewp( w, t ) . Then σ v,t = 102020 • ewp( w, t , t ) = ewp( v, t ) = 202020111011102020111010111010 . • maxPow( w,
1) = 3 , maxPow( w,
2) = 1 , and maxPow( w,
0) = 1 . • elpp ( w ) = ewp( w, . • elpp ( w ) = ewp( w,
22) = 22020111010111010 . • elpp ( w ) = ewp( w,
00) = 002020111010111010 .We prove that ewp( w, t ) , elpp y ( w ) ∈ R are rich words. Lemma 5.12. If w, t ∈ R ∩ A + and y ∈ A then ewp( w, t ) , elpp y ( w ) ∈ R .Proof. Because elpp( w ) = ewp y ( w, y k +1 ) it suffices to prove that ewp( w, t ) ∈ R . From the definition of ewp( w, t ) it is clear that we need to verify onlythe case where Σ w,t = ∅ and t F( v R w ) . Obviously ( π w,t ) R w ∈ R , since ( π w,t ) R w ∈ EL a ( w ) , see Lemma 3.4. Let x = Prf( t ) ∩ A . Then lpp( xv R w ) = t and since t F( v R w ) we have occur( xv R w, t ) = 1 . Hence Corollary 2.4implies that xv R w ∈ R . 12 Construction of a Uniquely Extensible RichWord II
In this section we consider that { , } ⊆ A . Let g n = g n − n n − , where g = 1 and n > . For n, k ≥ we show that the words k g n are rich andthat k g n − , k g n − n are the only flexed points of k g n that are notflexed points of k g n − . Let ¯T n = T(0 k g n ) \ T(0 k g n − ) . Proposition 6.1. If n, k ≥ then k g n ∈ R and ¯T n = { k g n − , k g n − n } .Proof. Obviously k g ∈ R . Suppose that k g n − ∈ R , where n ≥ . Weshow that k g n ∈ R . We have that k g n = 0 k g n − n n − . Note that lps(0 k g n − ) = g n − . It follows that k g n − k g n − ) and hence k g n − ∈ R . It is easy to see that lps(0 k g n −
01) = lps(0 k g n − n − n −
01) = 10 g n − and that occur(0 k g n − ,
10 g n −
01) = 1 . Hence we have k g n − ∈ R ; seeProposition 2.3. It follows that k g n − n − ∈ ER a (0 k g n − ⊆ R . Alsowe have that k g n − = ER(0 k g n − and thus k g n − ∈ ¯T n .Obviously occur(0 k g n − n , n ) = 1 . Since n is a palindrome we havethat k g n − n ∈ R ; see Proposition 2.3. Since g n − n n − is a palin-drome we have that lps(0 k g n − n t ) = t R n t for each t ∈ Prf(0 g n − ) .This implies that k g n − n t ∈ ER a (0 k g n − n ) ⊆ R and in particular k g n ∈ ER a (0 k g n − n ) ⊆ R . Clearly k g n − n = ER(0 k g n − n − ) andthus k g n − n ∈ ¯T n .Consequently for each n, k ≥ , we conclude that k g n ∈ R and ¯T n = { k g n − , k g n − n } .We present all switches of k g n . Let S n = (cid:0) sw(0 k g n ) \ sw(0 k g n − ) (cid:1) ∩ S w ∈ ¯T n Suf( w ) , where n ≥ . Proposition 6.2. If k ≥ and n ≥ then S n = {
00 g n − , n − n − n , n } .Proof. Proposition 6.1 states that ¯T n = { k g n − , k g n − n } . We willconsider the switches that are suffixes of the flexed points from ¯T n :13 For k g n − : Let t = lps(0 k g n − . Obviously t = 0 g n − . Since occur( t, n − ) = 1 it follows that t is the only palindromic suffix of k g n − which contains the factor n − . Consequently each palin-dromic suffix of k g n − which is not equal to t is a factor of n − ∈ Suf( t ) . Thus
00 g n − is the only switch of ¯ t = 00 g n − which is nota switch of n − ∈ F(0 k g n − ) . • For k g n − n : Let t ∈ Suf(0 k g n − n ) ∩ sw(0 k g n ) . Since n ∈ Suf(00 g n − n ) it follows that | t | ≥ n + 1 . For | t | = n + 1 thereis the switch n . For | t | > n + 1 we have that n − ∈ Suf(rtrim( t )) ∩ Prf(ltrim( t )) and because occur(00 g n − n − , n − ) = 2 it follows thatthere is only one switch with | t | > n + 1 ; namely ¯ t = 01 n − n − n .The proposition follows.Proposition 6.2 and Corollary 5.8 allow us to list all switches of k g n . Corollary 6.3. If n ≥ then sw(0 k g n ) = k [ i =1 { i } ∪ { , , , , }∪ n [ i =3 {
00 g n − , n − n − n , n n − n − , n , n } .Proof. Proposition 6.2 states that S n = {
00 g n − , n − n − n , n } for n ≥ . We may easily check that • (00 g n − R = 10 g n − F(0 k g n ) , • (01 n − n − n ) R = 1 n n − n − ∈ F(0 k g n ) , and • (00 g n − R F(0 k g m ) for all m ≥ .Obviously sw(0 k g ) = S ki =1 { i }∪{ , , , , } ; recall that k g = 0 k . Note that (01011) R = 11010 ∈ F(g ) , (00 i R = 10 i F(g m ) , and (00101) R = 10100 F(g m ) for all i, m ≥ . Corollary 5.8 assertsfor every switch t of w that there is a flexed points ¯ w ∈ T( w ) such that { t, t R } ∩ Suf( ¯ w ) = ∅ . The corollary follows.Let j ≥ . We define: 14 α ,j = 00 g j − , • α ,j = 01 j − j − j − , • α ,j = 1 j j − j , and • α ,j = 1 j +1 .The next obvious corollary of Corollary 6.3 presents the switch palin-dromic closures of all switches of the word k g n . Corollary 6.4. If k ≥ and n ≥ then spc(sw(0 k g n )) = { k , , , , α ,n }∪ n [ i =3 { α ,j , α ,j , α ,j } .Proof. Corollary 6.3 lists all switches of the word k g n . For every switch t ∈ sw(0 k g n ) we may easily verify that there is v ∈ spc(sw(0 k g n )) such that spc( t ) ∈ F( v ) . This completes the proof. Remark . Note that the palindromes α ,j are factors of α ,n for j ≤ n .This is the difference to palindromes α i,j , where i ∈ { , , } . For this reasonthe palindrome α ,j is not involved in the union formula from i = 3 to n .The next definition defines a word h n . Later we show that h n is a uniquerich extension of ¯h n , where h n = ¯h n ltrim(g n ) . Definition 6.6.
Let n ≥ . We define: • κ ( j, w ) = elpp (ewp( w, α ,j , α ,j , α ,j , α ,j )) , where w ∈ R ∩ A + and ≤ j ≤ n . • h n,n = κ ( n,
000 g n
00 g n ) . • h n,j = κ ( j, h n,j +1 ) , where ≤ j < n . • Suppose that A is totally ordered, let σ (A) = x x . . . x m , where x i ∈ A \{ , } , x i < x i +1 , ≤ i < m , and m = | A | − . • h n = σ (A) ewp(h n, , , , . emark . The function κ ( j, w ) extends the word w to a word ¯ ww in sucha way that ¯ ww contains the switch palindromic closures of switches α ,j , α ,j , α ,j , α ,j . In addition the longest palindromic prefix of ¯ ww is k for some k > .The word h n, is constructed by iterative applying of the function κ ( j, w ) starting with the word
000 g n
00 g n .The word h n contains the switch palindromic closures of all switches ofthe word
00 g n . The suffix of h n is the word
000 g n
00 g n . As a result h n hasthe form u rtrim(g n )1001 ltrim(g n ) for some u ∈ A ∗ . It is the form used inProposition 5.4. The prefix σ (A) of h n is there to assert that u contains allletters. The order of the letters does not matter. We show that h n is a rich word. Lemma 6.8. If n ≥ then h n ∈ R .Proof. Lemma 5.12 says that both ewp( w, t ) , elpp ( w ) ∈ R , where w, t ∈ R . Proposition 2.2 and Proposition 6.1 imply that rtrim( α i,j ) ∈ R , since rtrim( α i,j ) ∈ F(00 g j ) ⊆ F(00 g n ) , where i ∈ { , , , } and ≤ j ≤ n .Because α i,n = ER(rtrim( α i,n )) we have that α i,n ∈ R , see Lemma 3.4.Hence κ ( j, w ) ∈ R .Proposition 6.1 asserts that k g n ∈ R . Also it is easy to see that
000 g n
00 g n ∈ R ; just consider that
00 g n
00 g n ∈ ER a (00 g n ) , occur(000 g n
00 g n , , and lpp(000 g n
00 g n ) = 000 ,see Corollary 2.4. In consequence h n,j ∈ R for ≤ j < n . We have that ewp(h n, , , , ∈ R , because , , ∈ R .Obviously σ (A) ∈ R . Moreover it is easy to verify that if w , w ∈ R and F( w ) ∩ F( w ) = ǫ then w w ∈ R . Hence σ (A) ewp(h n, , , , ∈ R .We conclude that h n ∈ R . Proposition 6.9.
Let ¯h n be such that h n = ¯h n ltrim(g n ) . If n > then h n is a unique rich extension of ¯h n .Proof. Obviously there is w ∈ R such that h n = w rtrim(g n )1001 ltrim(g n ) .Corollary 6.4 lists the elements of spc(sw(0 k g n )) . The construction of h n guarantees that all these elements are factors of w ; formally α i,j ∈ F( w ) for16ll i ∈ { , , , } and ≤ j ≤ n . For
00 g we can see that sw(001011010) = { , , , , , , , } . It follows that spc(sw(001011010)) = { , , , , } . Obviously we havethat { , , , , } ⊆ F( w ) .Since σ (A) ∈ Prf(h n ) we have that A ∈ F( w ) . It is easy to check that lps( w rtrim(g n )1001) = 1001 . Hence we have w rtrim(g n )1001 ltrim(g n ) ∈ ER a ( w rtrim(g n )1001) .Thus Proposition 5.4 implies that h n is a unique rich extension of ¯h n .Let ρ ( n ) = | g n | , where n ≥ . Since g n = g n − n n − , we have ρ ( n ) < ρ ( n + 1) and consequently ρ ( n ) < k ρ ( n + k ) , where k > .We derive an upper bound for length of h n . We start with an upperbound for | κ ( j, w ) | . Proposition 6.10. If j, k > , ¯ w ∈ R , w = 0 k g j ¯ w ∈ R , lpp( w ) = 0 k and α i,j F( ¯ w ) for i ∈ { , , } then | κ ( j, w ) | < | w | + 7 ρ ( j −
1) + 5 k + 5 j + 10 .Proof. Let t = ewp( w, α ,j ) , t = ewp( t , α ,j ) , t = ewp( t , α ,j ) , and t =ewp( t , α ,j ) . Clearly κ ( j, w ) = elpp ( t ) . It is easy to see that: • t = 00 g j − k g j ¯ w ; lpp( t ) = α ,j = 00 g j − . • t = 01 j − j − j − j − k − t ; lpp( t ) = α ,j = 01 j − j − j − . • t = 1 j j − j j − k g j − k g j − t ; lpp( t ) = α ,j = 1 j j − j . • If α ,j ∈ F( w ) then t = t and lpp( t ) = lpp( t ) else t = 1 t and lpp( t ) = α ,j = 1 j +1 . • If α ,j ∈ F( w ) then κ ( j, w ) = 00 k g j − t else κ ( j, w ) = 00 k g j − j j − t . In either case we have lpp( κ ( j, w )) = 0 k +1 .It follows that: • | t | = | w | + ρ ( j −
1) + 2 . 17 | t | = | t | + ( k −
2) + 2 ρ ( j −
2) + 2( j −
1) + 4 = | w | + 6 + ρ ( j −
1) +2 ρ ( j −
2) + ( k −
2) + 2( j − . • | t | = | t | + 2 ρ ( j −
2) + 2 ρ ( j −
1) + 2 k + 3 + 2 j = | w | + 9 + 3 ρ ( j −
1) +4 ρ ( j −
2) + ( k −
2) + 2 k + 2( j −
1) + 2 j . • | t | ≤ | t | + 1 . • | κ ( j, w ) | ≤ | t | + k + 4 + ρ ( j −
1) + ρ ( j −
2) + j = | w | + 14 + 4 ρ ( j −
1) + 5 ρ ( j −
2) + ( k −
2) + 3 k + 2( j −
1) + 3 j .Since ρ ( j − < ρ ( j − we have | κ ( j, w ) | < | w | +7 ρ ( j − k +5 j +10 .The main theorem of the section presents an upper bound for the lengthof h n . Theorem 6.11. If n ≥ then | h n | < ρ ( n )+( n − n +22)+3 n +20+ | A | .Proof. Proposition 6.10 implies for j = n , k = 3 and w = 000 g n
00 g n that | h n,n | = | κ ( n, w ) | < | w | + 7 ρ ( n −
1) + 4 ∗ n + 10 . (1)For n − and n − we have: • | h n,n − | = | κ ( n − , h n,n ) | < | h n,n | + 7 ρ ( n −
2) + 4 ∗ n −
1) + 10 . • | h n,n − | = | κ ( n − , h n,n − | < | h n,n − | +7 ρ ( n − ∗ n − .And generally for n − i : | h n,n − i | < | h n,n − i +1 | + 7 ρ ( n − i −
1) + 4( i + 3) + 5( n − i ) + 10 = | h n,n − i +1 | + 7 ρ ( n − i −
1) + 5 n − i + 22 < | h n,n − i +1 | + 7 ρ ( n − i −
1) + 5 n + 22 . (2)Realize that ρ ( n − i − ≤ i +1 ρ ( n ) , | w | = 2 ρ ( n ) + 5 , and P n − i =1 12 i +1 < . Itfollows from (1) and (2) that: | h n, | < ρ ( n ) + 5 + 7 ρ ( n ) n − X i =1 i +1 + (5 n + 22) n − X i =1 < ρ ( n ) + ( n − n + 22) + 5 . (3)18bviously lpp(h n, ) = 0 n and n g ∈ Prf(h n, ) .Let t = ewp(h n, , , t = ewp( t , . We have that h n = σ (A) ewp( t , . We can verify that t = 001 h n, , t = 11011010 n − t ,and h n = σ (A)01010 n n t .Using (3) we get: | h n | ≤ | h n, | + | | + | n − | + | n n | + | A | < ρ ( n ) + ( n − n + 22) + 3 n + 20 + | A | .This completes the proof.Theorem 6.11 and Proposition 6.9 have the following corollary to thelower bound for φ ( n ) . Corollary 6.12.
For each real constant c > and each integer m > thereis n > m such that φ ( n ) ≥ ( − c ) n .Proof. Proposition 6.9 implies that ω ( | ¯h n | ) ≤ | g n | − ρ ( n ) − . It followsthat φ ( | ¯h n | ) ≥ ρ ( n ) − and φ ( | ¯h n | ) ≥ ρ ( n ) − | ¯h n | | ¯h n | . (4)From Theorem 6.11 and Proposition 6.9 we have that ρ ( n ) − | ¯h n | = ρ ( n ) − | h n | − ρ ( n ) − ρ ( n ) − ρ ( n ) + ( n − n + 22) + | A | +4 . Since ρ ( n ) ≥ n this implies that ρ ( n ) − | ¯h n | ≤ for n > (5)and lim n →∞ ρ ( n ) − | ¯h n | = 29 (6)The corollary follows from (4),(5), and (6).19 cknowledgments The author acknowledges support by the Czech Science Foundation grantGAČR 13-03538S and by the Grant Agency of the Czech Technical Universityin Prague, grant No. SGS14/205/OHK4/3T/14.
References [1]
M. Bucci, A. De Luca, A. Glen, and L. Q. Zamboni , A newcharacteristic property of rich words , Theor. Comput. Sci., 410 (2009),pp. 2860–2863.[2]
X. Droubay, J. Justin, and G. Pirillo , Episturmian words and someconstructions of de Luca and Rauzy , Theor. Comput. Sci., 255 (2001),pp. 539–553.[3]
A. Glen, J. Justin, S. Widmer, and L. Q. Zamboni , Palindromicrichness , Eur. J. Combin., 30 (2009), pp. 510–531.[4]
J. Rukavicka , Rich words containing two given factors , Mercaş R.,Reidenbach D. (eds) Combinatorics on Words. WORDS 2019. Lec-ture Notes in Computer Science, vol 11682. Springer, Cham, DOI:https://doi.org/10.1007/978-3-030-28796-2_23.[5]