A Characterization of Morphic Words with Polynomial Growth
DDiscrete Mathematics and Theoretical Computer Science
DMTCS vol. :1, 2019, A Characterization of Morphic Words withPolynomial Growth
Tim Smith
School of Computer Science, University of Waterloo, Canada received 29 th Mar. 2019 , revised 1 st Nov. 2019 , accepted 1 st Dec. 2019 . A morphic word is obtained by iterating a morphism to generate an infinite word, and then applying a coding. Wecharacterize morphic words with polynomial growth in terms of a new type of infinite word called a zigzag word . Azigzag word is represented by an initial string, followed by a finite list of terms, each of which repeats for each n ≥ in one of three ways: it grows forward [ t (1) t (2) · · · t ( n )] , backward [ t ( n ) · · · t (2) t (1) ], or just occurs once [ t ].Each term can recursively contain subterms with their own forward and backward repetitions. We show that an infiniteword is morphic with growth Θ( n k ) iff it is a zigzag word of depth k . As corollaries, we obtain that the morphic wordswith growth O ( n ) are exactly the ultimately periodic words, and the morphic words with growth O ( n ) are exactlythe multilinear words. Keywords: morphic word, polynomial growth, zigzag word, multilinear word
Morphic words [AS03] are a well-studied class of infinite words obtained by iterating a morphism h on a letter c , and then applying a coding (letter-to-letter mapping) τ . The morphism h is required to beprolongable on c , meaning that h ( c ) = cx for some string x such that h i ( x ) is nonempty for all i . Such aword has the form τ ( h ω ( c )) = τ ( c x h ( x ) h ( x ) h ( x ) · · · ) We call the triple ( h, c, τ ) a “representation” of the morphic word α = τ ( h ω ( c )) . In this paper wecharacterize morphic words with polynomial growth, i.e. those having a representation ( h, c, τ ) whosegrowth function f ( n ) = | h n ( c ) | = | τ ( h n ( c )) | is bounded by a polynomial in n .Our characterization involves a new type of infinite word which we call a zigzag word . A zigzag word isrepresented by an initial string (which may be empty), followed by a finite list of terms. Each term repeatsfor each n ≥ according to one of three functions, denoted F , B , and S . The function F causes forwardgrowth, B causes backward growth, and S causes stasis (no growth). Each F or B term can recursivelycontain subterms with their own instances of the three functions, while each S term contains only a string.For example, the list l = [( B, [( S, a ) , ( F, [( S, b )])])] ISSN 1365–8050 c (cid:13) a r X i v : . [ c s . F L ] F e b Tim Smith represents the zigzag word α = (cid:89) n ≥ i = n (cid:89) ( a n (cid:89) j =1 b )= ab abb ab abbb abb ab abbbb abbb abb ab · · · Here, (cid:81) denotes concatenation, and we use (cid:81) ni =1 f ( i ) to mean f (1) f (2) · · · f ( n ) , and (cid:81) i = n f ( i ) to mean f ( n ) f ( n − · · · f (1) . Thus, the outermost (cid:81) corresponds to the increasing bound n which is alwayspresent, the middle (cid:81) corresponds to the B and indicates backwards growth from n down to 1, and theinnermost (cid:81) corresponds to the F and indicates forwards growth from 1 up to n . The net effect is that thenumber of a s in each block remains stationary at 1, while the number of b s “zigzags” with the pattern 1, 2,1, 3, 2, 1, 4, 3, 2, 1, . . . A formal definition of zigzag words appears in Section 3, along with the notion ofthe depth of a zigzag representation as the level of nesting of its terms.As our main result, we show that an infinite word has a morphic representation with growth Θ( n k ) iff ithas a zigzag representation of depth k . Our proof makes use of the notion of “rank” due to Ehrenfeuchtand Rozenberg [ER79]. Notice that whereas a morphic representation makes use of a coding, a zigzagrepresentation does not: the letters in the zigzag representation are just those that appear in the word.We use our result to make connections with two other classes of infinite words: ultimately periodicwords and multilinear words. Ultimately periodic words have the form qrrr · · · for strings q, r , whilemultilinear words [Smi13, EHK11] have the form q (cid:89) n ≥ r a n + b r a n + b · · · r a m n + b m m where (cid:81) denotes concatenation, q, r i are strings, and a i , b i are nonnegative integers. For example, (cid:81) n ≥ a n +1 b = abaabaaab · · · is a multilinear word. We show that the morphic words with growth O ( n ) are exactly the ultimately periodic words, and that the morphic words with growth O ( n ) are exactly themultilinear words. Thus, ultimately periodic words and multilinear words can be seen as the first two levelsof the hierarchy of morphic words with polynomial growth, or equivalently, of the hierarchy of zigzagwords. A previous characterization of morphisms with polynomial growth is due to Ehrenfeucht and Rozenberg[ER79], who introduce the notion of the “rank” of letters under a morphism. They show that a string x has rank k under a morphism h iff k is the minimal degree of a polynomial p such that for every n , p ( n ) ≥ | h n ( x ) | . We make use of this result in proving the equivalence between morphic words withpolynomial growth and zigzag words.Other topics studied in connection with morphisms with polynomial growth include questions of sequenceequivalence [Kar77, Hon03b], ω -equivalence [Hon03a], the relationship between these types of equivalence[Hon02], language equivalence [Hon04], length sets [EKR78], codes [HW85], and boundedness [HL87].The class of multilinear words appears in [Smi13] as the infinite words determined by one-way stackautomata, and also in [EHK11] (as the reducts of the “prime” stream Π ). In [Smi16], prediction of periodicwords and multilinear words is studied in an automata-theoretic setting. Characterization of Morphic Words with Polynomial Growth The rest of the paper is organized as follows. Section 2 gives preliminary definitions. Section 3 defineszigzag words and gives examples. Section 4 proves our main result, the correspondence between zigzagwords and morphic words with polynomial growth. Section 5 applies this correspondence in connectionwith ultimately periodic and multilinear words. Section 6 gives our conclusions.
We denote the positive integers by Z + . When X is a set, we denote the cardinality of X by | X | . We usesquare brackets to denote a list: e.g. [ x , . . . , x m ] is the list containing the elements x , . . . , x m in thatorder. The number of elements in a list v is denoted by | v | . For lists v , . . . , v n , we let append( v , . . . , v n ) denote the list of length | v | + · · · + | v n | consisting of the elements of v , followed by the elements of v , . . . , followed by the elements of v n .An alphabet A is a finite set of letters. A word is a concatenation of letters from A . We denote the setof finite words by A ∗ and the set of infinite words by A ω . We call finite words strings . The length of astring x is denoted by | x | . We denote the empty string by λ . We write A + to mean A ∗ − { λ } . A language is a subset of A ∗ . For a finite or infinite word S , a prefix of S is a string x such that S = xS (cid:48) for someword S (cid:48) . The i th letter of S is denoted by S [ i ] ; indexing starts at . We denote the set of letters occurringin S by alph( S ) . Periodic and multilinear words
For a nonempty string x , x ω denotes the infinite word xxx · · · . Such aword is called purely periodic . An infinite word of the form xy ω , where x and y are strings and y (cid:54) = λ , iscalled ultimately periodic . An infinite word is multilinear if it has the form q (cid:89) n ≥ r a n + b r a n + b · · · r a m n + b m m where (cid:81) denotes concatenation, q is a string, m is a positive integer, and for each ≤ i ≤ m , r i is anonempty string and a i and b i are nonnegative integers such that a i + b i > . For example, (cid:81) n ≥ a n +1 b = abaabaaab · · · is a multilinear word. Clearly the multilinear words properly include the ultimatelyperiodic words. Any multilinear word that is not ultimately periodic we call properly multilinear . Morphic words A morphism on an alphabet A is a map h from A ∗ to A ∗ such that for all x, y ∈ A ∗ , h ( xy ) = h ( x ) h ( y ) . Notice that h ( λ ) = λ . The morphism h is a coding if for all c ∈ A , | h ( c ) | = 1 . For x ∈ A ∗ , we let L ( x, h ) denote the set of strings { h i ( x ) | i ≥ } . The letter c is recursive (for h ) if forsome i ≥ , h i ( c ) contains c . A string x ∈ A ∗ is mortal (for h ) if there is an m ≥ such that h m ( x ) = λ .The morphism h is prolongable on a letter c if h ( c ) = cx for some x ∈ A ∗ , and x is not mortal. If h isprolongable on c , h ω ( c ) denotes the infinite word c x h ( x ) h ( x ) · · · . We call such an infinite word puremorphic . An infinite word α is morphic if there is a morphism h , coding τ , and letter c such that h isprolongable on c and α = τ ( h ω ( c )) . For example, let h ( c ) = cbaa τ ( c ) = a h ( a ) = aa τ ( a ) = a h ( b ) = b τ ( b ) = b Tim Smith
Then τ ( h ω ( c )) = a ba ba ba ba b · · · is a morphic word. See Allouche and Shallit [AS03] for moreon morphic words.A morphism h has growth f ( n ) on a string x if | h n ( x ) | = f ( n ) for all n ≥ . We say that h is polynomially bounded on x if | h n ( x ) | is in O ( n k ) for some k ≥ . The following proposition says thatif h is polynomially bounded on x (and x is not mortal), its growth on x must be in Θ( n k ) for some k ≥ ,and so cannot be an “in-between” function like n log n . Proposition 1.
For every morphism h and string x , if h is polynomially bounded on x and x is not mortalunder h , then | h n ( x ) | is in Θ( n k ) for some k ≥ . Proof:
Take any morphism h and string x such that h is polynomially bounded on x and x is not mortalunder h . Take the lowest k such that | h n ( x ) | is in O ( n k ) . By [ER79, Theorem 3], x has rank k under h .Then by [ER79, Corollary 1], we have that | h n ( x ) | is in Θ( n k ) .We say that a morphic word α has growth f ( n ) if for some morphism h , coding τ , and letter c , h isprolongable on c , α = τ ( h ω ( c )) , and h has growth f ( n ) on c . We say that α has polynomial growth if ithas growth Θ( n k ) for some k .Note that a morphic word with polynomial growth may have alternative representations in which growthis exponential. For example, a ω has polynomial growth (take c = s , h ( s ) = sa , h ( a ) = a , τ ( s ) = a , τ ( a ) = a ), notwithstanding the existence of exponential representations (e.g. c = a , h ( a ) = aa , τ ( a ) = a ).In conjunction with Proposition 1 above, [DK09, Theorem 25] shows that for every aperiodic pure morphicword α , either (1) every representation ( h, c ) of α has exponential growth, or (2) for some k ≥ , everyrepresentation ( h, c ) of α has growth Θ( n k ) . We do not know whether the same holds for (not necessarilypure) morphic words and representations ( h, c, τ ) . We now introduce zigzag words, define a notion of depth for these words, and give some examples. Below, (cid:81) denotes concatenation, and we use (cid:81) ni =1 f ( i ) to mean f (1) f (2) · · · f ( n ) , and (cid:81) i = n f ( i ) to mean f ( n ) f ( n − · · · f (1) . In this section and all following ones, let A be an alphabet. Let F , B , and S befunctions, to be defined below.Let L be the set of all nonempty lists over ( { F, B } × L ) ∪ ( { S } × A + ) . That is, L consists of all listsof the form [( f , x ) , . . . , ( f m , x m )] with m ≥ , such that for each ≤ i ≤ m , f i is in { F, B } and x i is in L, or f i = S and x i is in A + . Define R : L × Z + → A + as follows: R ([( f , x ) , . . . , ( f m , x m )] , i ) = m (cid:89) j =1 f j ( x j , i ) Characterization of Morphic Words with Polynomial Growth F : L × Z + → A + as follows: F ( l, n ) = n (cid:89) i =1 R ( l, i ) Define B : L × Z + → A + as follows: B ( l, n ) = i = n (cid:89) R ( l, i ) Define S : A + × Z + → A + as follows: S ( r, n ) = r A zigzag word is an infinite word α such that for some q ∈ A ∗ and l ∈ L , α = q (cid:89) i ≥ R ( l, i ) For a list l = [( f , x ) , . . . , ( f m , x m )] ∈ L , we define depth( l ) = max { depth( i ) | ≤ i ≤ m } where in the context of l , for each ≤ i ≤ m , we define depth( i ) = (cid:40) if f i = S depth( x i ) + 1 if f i = F or B A zigzag word α has depth k if for some q ∈ A ∗ and l ∈ L , α = q (cid:89) i ≥ R ( l, i ) and depth( l ) = k . Below we give examples of zigzag words α of the form q (cid:81) i ≥ R ( l, i ) for various values of q and l . Foreach word, we also give a shorthand notation of the form q : r , where r is a string obtained as follows. Forclarity, we enclose string literals in quotes in the following definitions. Define r = short( l ) , where short([( f , x ) , . . . , ( f m , x m )]) = (cid:89) ≤ i ≤ m short( f i , x i ) Tim Smith and where short( f i , x i ) = x i if f i = S “(” short( x i ) “)” if f i is in { F, B } and depth( x i ) = 1 “F(” short( x i ) “)” if f i = F and depth( x i ) > “B(” short( x i ) “)” if f i = B and depth( x i ) > We write the shorthand q : r as just r if q = λ . Example 1. (depth 1, ultimately periodic) q = a , l = [( S, bc )] α = a ( bc ) ω = abcbcbc · · · shorthand: a : bc Example 2. (depth 2, multilinear) q = λ, l = [( S, a ) , ( F, [( S, b )])] α = (cid:89) n ≥ ab n = ababbabbb · · · shorthand: a ( b ) Example 3. (depth 3) q = λ, l = [( F, [( S, a ) , ( F, [( S, b )])]) , ( B, [( S, c ) , ( F, [( S, d )])])] α = (cid:89) n ≥ ( n (cid:89) i =1 ab i )( i = n (cid:89) cd i )= abcd ababbcddcd ababbabbbcdddcddcd · · · shorthand: F ( a ( b )) B ( c ( d )) In this section we establish that an infinite word is morphic with growth Θ( n k ) iff it is a zigzag word ofdepth k (Theorem 3). We first show that every zigzag word of depth k is a morphic word with growth Θ( n k ) (Theorem 1), and then that every morphic word with growth Θ( n k ) is a zigzag word of depth k (Theorem 2). Lemma 1.
For every l ∈ L , there is a string w , morphism h , and coding τ such that for all n ≥ , τ ( h n ( w )) = R ( l, n + 1) , and h has growth Θ( n depth( l ) − ) on w . Characterization of Morphic Words with Polynomial Growth Proof:
The list l has the form [( f , x ) , . . . , ( f m , x m )] .We proceed by induction on the depth k of l .If k = 1 , then every f i = S , so for all n ≥ , R ( l, n ) = x · · · x m . Then we can take w = x · · · x m ,and for every letter c in w , set h ( c ) = τ ( c ) = c . The morphism h has growth Θ( n ) = Θ(1) on w asdesired.If k > , suppose for induction that the claim is true for every list of depth < k .For each ( f j , x j ) with ≤ j ≤ m , we will describe how to construct a string w j , morphism h j , andcoding τ j so that h j has growth Θ(1) on w j if f j = S and growth Θ( n depth( x j ) ) on w j if f j is in { F, B } ,and further that for all n ≥ , τ j ( h nj ( w j )) = f j ( x j , n + 1) .If f j = S , then x j is a string. So set w j = x j , and for all c in x j , set h j ( c ) = τ j ( c ) = c . Then h j hasgrowth Θ(1) on w j as desired.If f j = F , then since depth( x j ) < depth( l ) , we can apply the induction hypothesis, obtaining w (cid:48) j , h (cid:48) j , τ (cid:48) j such that for all n ≥ , τ (cid:48) j ( h (cid:48) nj ( w (cid:48) j )) = R ( x j , n + 1) , and h (cid:48) j has growth Θ( n depth( x j ) − ) on w (cid:48) j .For all c in the alphabet of h (cid:48) j , set h j ( c ) = h (cid:48) j ( c ) and for all c in the alphabet of τ (cid:48) j , set τ j ( c ) = τ (cid:48) j ( c ) . Now,let a be a new letter. Set w j = a w (cid:48) j [2] · · · w (cid:48) j [ | w (cid:48) j | ] . Set h j ( a ) = w j h j ( w (cid:48) j [1]) and set τ j ( a ) = τ (cid:48) j ( w (cid:48) j [1]) .Then h j ( w j ) = w j h j ( w (cid:48) j ) , so we have for all n ≥ , τ j ( h nj ( w j )) = τ j ( w j n (cid:89) i =1 h ij ( w (cid:48) j ))= τ (cid:48) j ( w (cid:48) j n (cid:89) i =1 h (cid:48) ij ( w (cid:48) j ))= n (cid:89) i =0 τ (cid:48) j ( h (cid:48) ij ( w (cid:48) j ))= n +1 (cid:89) i =1 R ( x j , i )= F ( x j , n + 1) as desired. From above, we have that for all n ≥ , | h nj ( w j ) | = | (cid:81) ni =0 h (cid:48) ij ( w (cid:48) j ) | = (cid:80) ni =0 | h (cid:48) ij ( w (cid:48) j ) | . Weknow that h (cid:48) j has growth Θ( n depth( x j ) − ) on w (cid:48) j , so | h (cid:48) nj ( w (cid:48) j ) | is bounded above and below by polynomialsof degree depth( x j ) − . Therefore h j has growth Θ( n depth( x j ) ) on w j , since for any polynomial p ( n ) ofdegree k , the sum (cid:80) ni =0 p ( i ) equals a polynomial p (cid:48) ( n ) of degree k + 1 .If f j = B , we proceed as in the case f j = F , but this time set w j = w (cid:48) j [1] · · · w (cid:48) j [ | w (cid:48) j | − a , set Tim Smith h j ( a ) = h j ( w (cid:48) j [ | w (cid:48) j | ]) w j , and set τ j ( a ) = τ (cid:48) j ( w (cid:48) j [ | w (cid:48) j | ]) . Then h j ( w j ) = h j ( w (cid:48) j ) w j , so for all n ≥ , τ j ( h nj ( w j )) = τ j ( i = n (cid:89) h ij ( w (cid:48) j ) w j )= τ (cid:48) j ( i = n (cid:89) h (cid:48) ij ( w (cid:48) j ) w (cid:48) j )= i = n (cid:89) τ (cid:48) j ( h (cid:48) ij ( w (cid:48) j ))= i = n +1 (cid:89) R ( x j , i )= B ( x j , n + 1) as desired. Further, by the same reasoning as for the case f j = F , h j has growth Θ( n depth( x j ) ) on w j .We now have w j , h j , τ j for each j , and we want to make a unified w, h, τ for the whole list l . First, werename certain letters to avoid conflicts. We say that a conflict occurs when there are j (cid:54) = j and a letter c such that c belongs to the alphabet of both h j and h j . If there is a conflict, take any such c, j , j . Let d be a new letter not appearing in any w j , h j , or τ j . Replace all occurrences of c in w j , h j , and the lefthandside of τ j with d . Repeat this process until no conflicts remain.With all conflicts resolved, we set w = w · · · w m , and create a morphism h and coding τ such that forevery ≤ j ≤ m , for every c in the alphabet of h j , h ( c ) = h j ( c ) and τ ( c ) = τ j ( c ) . Now we have that forall n ≥ , τ ( h n ( w )) = m (cid:89) j =1 f j ( x j , n + 1) = R ( l, n + 1) as desired. Now, since depth( l ) = k and k > , we have by definition that for every j with f j in { F, B } , depth( x j ) ≤ k − , and for at least one such j , depth( x j ) = k − . Then by our construction, every h j has growth O ( n k − ) on w j , and at least one h j has growth Θ( n k − ) on w j . Therefore h has growth Θ( n k − ) on w . Theorem 1.
Every zigzag word of depth k is a morphic word with growth Θ( n k ) . Proof:
Take any zigzag word α of depth k . Then for some q ∈ A ∗ and l ∈ L with depth( l ) = k , α = q (cid:89) i ≥ R ( l, i ) By Lemma 1, there are w, h, τ such that for all n ≥ , τ ( h n ( w )) = R ( l, n + 1) , and h has growth Θ( n k − ) on w . Let a, b, c , . . . , c | q | , d , . . . , d | w | be new letters. Let s = c · · · c | q | d · · · d | w | h ( w ) . Since w and Characterization of Morphic Words with Polynomial Growth h ( w ) are nonempty, | s | ≥ . Set h ( c i ) = λ τ ( c i ) = q [ i ] h ( d i ) = λ τ ( d i ) = τ ( w [ i ]) h ( a ) = a b s [3] · · · s [ | s | ] τ ( a ) = τ ( s [1]) h ( b ) = h ( s [1] s [2]) τ ( b ) = τ ( s [2]) Then for all n ≥ , we have τ ( h n ( a )) = τ ( n − (cid:89) i =0 h i ( s ))= τ ( s n − (cid:89) i =1 h i ( s ))= τ ( s n (cid:89) i =2 h i ( w ))= q τ ( w h ( w ) n (cid:89) i =2 h i ( w ))= q n (cid:89) i =0 τ ( h i ( w ))= q n +1 (cid:89) i =1 R ( l, i ) and therefore h is prolongable on a and τ ( h ω ( a )) = α . Now, h has growth Θ( n k − ) on w , and w is notmortal under h . So | h ( w ) | is bounded above and below by polynomials of degree k − ≥ . Therefore h has growth Θ( n k ) on a , since for any polynomial p ( n ) of degree k , the sum (cid:80) ni =0 p ( i ) equals a polynomial p (cid:48) ( n ) of degree k + 1 . Therefore α is a morphic word with growth Θ( n k ) . We begin by defining the rank and level of a string under a morphism, as well as the concept of a normalizedmorphism.
Rank and level
Let h be a morphism. Following [ER79], we now define the rank of a letter c under h ,denoted rank( c, h ) . Informally, the rank 0 letters are those that are finite under h , the rank 1 letters arethose that are finite under h once the rank 0 letters have been removed, the rank 2 letters are those that arefinite under h once the rank 0 and rank 1 letters have been removed, and so on. Formally, for an alphabet B , let ϕ ( h, B ) be the morphism such that for all d ∈ A , ϕ ( h, B )( d ) is the string resulting from h ( d ) byerasing all letters in h ( d ) that are not in B . We define rank( c, h ) as follows: • If L ( c, h ) is finite, then rank( c, h ) = 0 . • For n ≥ , let A n = A − { d | rank( d, h ) < n } and let h n = ϕ ( h, A n ) . If c ∈ A n and L ( c, h n ) isfinite, then rank( c, h ) = n .0 Tim Smith
Note that some letters may have no rank under h . A string x has rank under h if x (cid:54) = λ and every letterin x has rank under h . The rank of x under h , denoted rank( x, h ) , is max { rank( c, h ) | the letter c occursin x } . In [ER79] it is shown that x has rank k under h iff k is the minimal degree of a polynomial p suchthat for every n , p ( n ) ≥ | h n ( x ) | .We now introduce a more fine-grained concept of rank, called level . For each letter c with rank under h ,we define level( c, h ) as follows. If c is mortal, level( c, h ) = 0 . Otherwise, if c is recursive (reachable fromitself), level( c, h ) = rank( c, h ) · . Otherwise, level( c, h ) = rank( c, h ) · .Thus, a rank 0 letter may have level 0, 1, or 2, a rank 1 letter may have level 3 or 4, a rank 2 letter mayhave level 5 or 6, and so on.A string x has level under h iff it has rank under h . The level of x under h , denoted level( x, h ) , is max { level( c, h ) | the letter c occurs in x } .If the intended morphism is clear from context, we write rank( c ) instead of rank( c, h ) , level( x ) insteadof level( x, h ) , etc. Normalized morphism
Below we make use of the concept of a normalized morphism from [DK09]. A normalized morphism h has the following properties (among others which we omit): • alph( h ( c )) = alph( h ( c )) for all c ∈ A • h ( c ) = h ( c ) for all c ∈ A such that rank( c, h ) = 0 By [DK09, Lemma 17], for every morphism h , there is a power h (cid:48) = h t with t ≥ such that h (cid:48) isnormalized. Lemma 2.
Let h be a morphism and let c be a letter with rank under h . Then rank( h ( c )) = rank( c ) . Proof:
Let i = rank( c ) . For n ≥ , let A n = A − { b | rank( b, h ) < n } and let h n = ϕ ( h, A n ) . Suppose h ( c ) contains a letter d of rank > i . Since rank( c ) = i , L ( c, h i ) is finite. Since rank( d ) > i , L ( d, h i ) isinfinite. But h i ( c ) contains d , making L ( c, h i ) infinite, a contradiction. So every letter in h ( c ) has rank ≤ i . Then if i = 0 , we have rank( h ( c )) = 0 . So say i > . If every letter in h ( c ) has rank < i , thenevery letter in h i − ( c ) has rank i − . Then for every letter d in h i − ( c ) , L ( d, h i − ) is finite. But then L ( h i − ( c ) , h i − ) is finite; hence L ( c, h i − ) is finite, and therefore rank( c ) = i − , a contradiction. So atleast one letter in h ( c ) has rank i , and therefore rank( h ( c )) = i . Lemma 3.
Let h be a morphism, let c be a letter with rank under h , and suppose rank( c ) ≥ and h ( c ) = sct for some s, t ∈ A ∗ . Then rank( st ) = rank( c ) − . Proof:
For n ≥ , let A n = A − { b | rank( b, h ) < n } and let h n = ϕ ( h, A n ) . Let i = rank( c ) and j = rank( st ) . Suppose j < i − . Then h i − ( c ) = c , so L ( c, h i − ) is finite. But then rank( c ) = i − , acontradiction. So j ≥ i − . Now, since L ( c, h i ) is finite, st must be mortal under h i . So for some k ≥ , h ki ( st ) = λ . Then h ki − ( st ) consists entirely of letters of rank i − . But then L ( h ki − ( st ) , h i − ) is finite;hence L ( st, h i − ) is finite. Therefore since j ≥ i − , applying the definition of rank gives j = i − . Lemma 4.
Let h be a normalized morphism and let c be a letter that has rank under h and is not mortalunder h . Suppose h ( c ) does not include c . Then level( h ( c )) = level( c ) − . Characterization of Morphic Words with Polynomial Growth Proof:
Since h is normalized, alph( h ( c )) = alph( h ( c )) . Then for all i ≥ , alph( h i ( c )) = alph( h ( c )) .So since h ( c ) does not include c , there is no i ≥ such that h i ( c ) includes c . Therefore c is not recursive.Hence since c is not mortal, level( c ) = rank( c ) · . Now, by Lemma 2, rank( h ( c )) = rank( c ) , so h ( c ) contains at least one letter d such that rank( d ) = rank( c ) . Take any such d that is not mortal. Thensince h is normalized, d appears in h | A | +2 ( c ) . So d can be reached from c via a chain of | A | + 1 ancestorletters, each of rank( c ) . Some letter e appears twice in this chain. Therefore e is recursive. Then since h isnormalized, h ( e ) = set for some s, t ∈ A ∗ . If rank( e ) = 0 , then st is mortal, and if rank( e ) ≥ , then byLemma 3, rank( st ) = rank( c ) − . In either case, d cannot appear in st or be descended from st , andtherefore d = e . Hence d is recursive. This holds for every letter d with rank( c ) in h ( c ) that is not mortal.Therefore level( h ( c )) = rank( c ) · c ) − . Lemma 5.
Let h be a normalized morphism and let x be a string with rank 0 and level > under h . Takeany v ≥ level( x ) . Then there is an l ∈ L of depth such that for all i ≥ , R ( l, i ) = h v + i ( x ) . Proof:
Since rank( x ) = 0 , L ( x, h ) is finite. Let s = h ( x ) . Since level( x ) > , x is not mortal under h ,so s (cid:54) = λ . Further, since h is normalized, h i ( x ) = s for all i ≥ . So let l = [( S, s )] . Then l has depth 1and for all i ≥ , R ( l, i ) = s = h v + i ( x ) . Lemma 6.
Let h be a normalized morphism and let x be a string with rank under h such that level( x ) > .Let r = rank( x ) and take any v ≥ level( x ) . Then there is an l ∈ L of depth r + 1 such that for all i ≥ , R ( l, i ) = h v + i ( x ) . Proof:
We proceed by induction on v . For the base case of v = 1 , we have level( x ) = 1 . Then r = 0 , so theclaim holds by Lemma 5.So say v ≥ . Suppose for induction that for all v (cid:48) < v , for every string x (cid:48) with rank under h such that v (cid:48) ≥ level( x (cid:48) ) > , there is an l (cid:48) ∈ L of depth rank( x (cid:48) ) + 1 such that for all i ≥ , R ( l (cid:48) , i ) = h v (cid:48) + i ( x (cid:48) ) .For each j from 1 to | x | such that x [ j ] is not mortal, we will construct an l j ∈ L of depth rank( x [ j ]) + 1 such that for all i ≥ , R ( l j , i ) = h v + i ( x [ i ]) .To construct l j , proceed as follows. Let c = x [ j ] . Suppose h ( c ) does not include c . Since c is not mortal,we have level( h ( c )) > . Further, we can apply Lemma 4, obtaining level( h ( c )) = level( c ) − . Let v (cid:48) = v − and x (cid:48) = h ( c ) . Then v (cid:48) ≥ level( x (cid:48) ) > , so we can apply the induction hypothesis, obtainingan l (cid:48) ∈ L of depth rank( h ( c )) + 1 such that for all i ≥ , R ( l (cid:48) , i ) = h v − i ( h ( c )) . Then for all i ≥ , R ( l (cid:48) , i ) = h v + i ( c ) as desired. Further, by Lemma 2, rank( h ( c )) = rank( c ) , so depth( l (cid:48) ) = rank( c ) + 1 as desired. So set l j to l (cid:48) .So say h ( c ) includes c . Then h ( c ) = sct for some s, t ∈ A ∗ . If rank( c ) = 0 , then the claim holds byLemma 5. So say rank( c ) ≥ . Then we can apply Lemma 3, obtaining rank( st ) = rank( c ) − . Supposethat neither s nor t is mortal. Then by the induction hypothesis, taking v (cid:48) = v − and x (cid:48) = s , there is an l s ∈ L of depth rank( s ) + 1 such that for all i ≥ , R ( l s , i ) = h v − i ( s ) . Similarly, taking x (cid:48) = t , thereis an l t ∈ L of depth rank( t ) + 1 such that for all i ≥ , R ( l t , i ) = h v − i ( t ) . Now set l j = [( B, l s ) , ( S, h v ( c )) , ( F, l t )] Tim Smith
We have for all n ≥ , R ( l j , n ) = B ( l s , n ) h v ( c ) F ( l t , n )= i = n (cid:89) R ( l s , i ) h v ( c ) n (cid:89) i =1 R ( l t , i )= i = n (cid:89) h v − i ( s ) h v ( c ) n (cid:89) i =1 h v − i ( t )= i = v + n − (cid:89) v h i ( s ) h v ( c ) v + n − (cid:89) i = v h i ( t )= i = v + n − (cid:89) v h i ( s ) i = v − (cid:89) h i ( s ) c v − (cid:89) i =0 h i ( t ) v + n − (cid:89) i = v h i ( t )= i = v + n − (cid:89) h i ( s ) c v + n − (cid:89) i =0 h i ( t )= h v + n ( c ) Further, depth( l j ) = max(depth( l s ) , depth( l t )) + 1 = (rank( st ) + 1) + 1 = rank( c ) + 1 , as desired.Now, we supposed above that neither s nor t was mortal. They cannot both be mortal, since that wouldmake rank( c ) = 0 , and we are considering the case rank( c ) ≥ . So suppose that s is mortal and t is not.Since h is normalized, h ( s ) = λ . So construct l t as above and set l j = [( S, h v ( c )) , ( F, l t )] Then following the derivation above, we have for all n ≥ , R ( l j , n ) = h v ( c ) v + n − (cid:89) i = v h i ( t )= i = v − (cid:89) h i ( s ) c v − (cid:89) i =0 h i ( t ) v + n − (cid:89) i = v h i ( t )= s c v + n − (cid:89) i =0 h i ( t )= h v + n ( c ) and depth( l j ) = depth( l t ) + 1 = (rank( t ) + 1) + 1 = rank( c ) + 1 as desired. Similarly, if t is mortaland s is not, then h ( t ) = λ . So construct l s as above and set l j = [( B, l s ) , ( S, h v ( c ))] Characterization of Morphic Words with Polynomial Growth n ≥ , R ( l j , n ) = i = v + n − (cid:89) v h i ( s ) h v ( c )= i = v + n − (cid:89) v h i ( s ) i = v − (cid:89) h i ( s ) c v − (cid:89) i =0 h i ( t )= i = v + n − (cid:89) h i ( s ) c t = h v + n ( c ) and depth( l j ) = depth( l s ) + 1 = (rank( s ) + 1) + 1 = rank( c ) + 1 as desired.We have now constructed an l j for each j from 1 to | x | such that x [ j ] is not mortal. Since h is normalized, h ( x [ j ]) = λ if x [ j ] is mortal. So for each j from 1 to | x | such that x [ j ] is mortal, set l j = [ ] , the emptylist. Now let l = append( l , . . . , l | x | ) . We have that for all i ≥ , R ( l, i ) = h v + i ( x ) , as desired. Further, l has depth max { depth( l j ) | ≤ j ≤ | x | and x j is not mortal } = max { rank( x [ j ]) + 1) | ≤ j ≤ | x |} = rank( x ) + 1 as desired. Theorem 2.
Every morphic word with growth Θ( n k ) is a zigzag word of depth k . Proof:
Take any morphic word α with growth Θ( n k ) . There exist a morphism h , coding τ , and letter c such that h is prolongable on c , α = τ ( h ω ( c )) , and h has growth Θ( n k ) on c .By [DK09, Lemma 17], there is a power h (cid:48) = h t with t ≥ such that h (cid:48) is normalized. Because h hasgrowth Θ( n k ) on c and h (cid:48) is a power of h , h (cid:48) also has growth Θ( n k ) on c . Since h is prolongable on c , h (cid:48) is prolongable on c . So h (cid:48) ( c ) = cx for some x ∈ A ∗ . Then α = τ ( c x h (cid:48) ( x ) h (cid:48) ( x ) · · · ) Let v = level( x, h (cid:48) ) . Let q = τ ( h (cid:48) v +1 ( c )) = τ ( c v (cid:89) i =0 h (cid:48) i ( x ) ) By [ER79, Theorem 3], rank( c, h (cid:48) ) = k . Since α is infinite, we know k ≥ . Hence by Lemma 3, rank( x, h (cid:48) ) = k − . Again since α is infinite, level( x, h (cid:48) ) > . Then we can apply Lemma 6, obtainingan l ∈ L of depth k such that for all i ≥ , R ( l, i ) = h (cid:48) v + i ( x ) . Let l (cid:48) be l with every string s replaced with4 Tim Smith τ ( s ) . Then for all i ≥ , R ( l (cid:48) , i ) = τ ( h (cid:48) v + i ( x )) . Then q (cid:89) i ≥ R ( l (cid:48) , i ) = τ ( h (cid:48) v +1 ( c )) (cid:89) i ≥ τ ( h (cid:48) v + i ( x ))= τ ( c v (cid:89) i =0 h (cid:48) i ( x )) (cid:89) i ≥ v +1 τ ( h (cid:48) i ( x ))= τ ( c (cid:89) i ≥ h (cid:48) i ( x ))= α Therefore α is a zigzag word of depth k . Finally, we obtain our main result.
Theorem 3.
An infinite word is morphic with growth Θ( n k ) iff it is a zigzag word of depth k . Proof:
Immediate from Theorems 1 and 2.
In this section we apply the equivalence between zigzag words and morphic words with polynomial growthobtained in the previous section to the first two orders of growth. We show an exact correspondencebetween morphic words with growth O ( n ) and ultimately periodic words, and between morphic words withgrowth O ( n ) and multilinear words. As far as we are aware, these results have not previously appeared inthe literature. Theorem 4.
An infinite word is morphic with growth O ( n ) iff it is ultimately periodic. Proof: = ⇒ : Take any morphic word α with growth O ( n ) . By Proposition 1, α has growth Θ( n ) . (Since α is infinite, it cannot have growth Θ(1) .) Then by Theorem 3, α is a zigzag word of depth 1. Then there are q ∈ A ∗ and l ∈ L such that α = q (cid:89) i ≥ R ( l, i ) and l has depth 1. Then l has the form [( S, r ) , . . . , ( S, r m )] . It follows that α = q ( r · · · r m ) ω . Thus α isultimately periodic. ⇐ = : Take any ultimately periodic word α = qr ω . Let l = [( S, r )] . Then α = q (cid:89) i ≥ R ( l, i ) So α is a zigzag word of depth 1. Then by Theorem 3, α is a morphic word with growth O ( n ) . Characterization of Morphic Words with Polynomial Growth Theorem 5.
An infinite word is morphic with growth O ( n ) iff it is multilinear. Proof: = ⇒ : Take any morphic word α with growth O ( n ) . By Proposition 1, α has growth Θ( n ) or Θ( n ) . If α has growth Θ( n ) , then by Theorem 4, it is ultimately periodic and hence multilinear. So say α has growth Θ( n ) . Then by Theorem 3, α is a zigzag word of depth 2. Then there are q ∈ A ∗ and l ∈ L such that α = q (cid:89) i ≥ R ( l, i ) and l has depth 2. Now, l has the form [( f , x ) , . . . , ( f m , x m )] . For each ≤ i ≤ m , we create a term t i = [ r i , a i , b i ] as follows. If f i = S , then x i is a string, so let t i = [ x i , , . If f i = F or B , then x i hasdepth 1, and therefore has the form [( S, s ) , . . . , ( S, s k )] . So let t i = [ s · · · s k , , . Now the multilinearword [ q, [ t , . . . , t m ]] equals q (cid:89) n ≥ m (cid:89) i =1 r n · a i + b i i = q (cid:89) n ≥ m (cid:89) i =1 f i ( x i , n )= q (cid:89) n ≥ R ( l, i )= α as desired. ⇐ = : Take any multilinear word α . If α is ultimately periodic, then by Theorem 4, α is a morphic wordwith growth O ( n ) . Otherwise, α is properly multilinear, so by [Smi16, Theorem 7], we can write α as q (cid:89) n ≥ m (cid:89) i =1 p i s ni for some m ≥ , q ∈ A ∗ , and p i , s i ∈ A + . Let l = [( S, p ) , ( F, [( S, s )]) , . . . , ( S, p m ) , ( F, [( S, s m )])] . Then l has depth 2 and α = q (cid:89) n ≥ R ( l, i ) So α is a zigzag word of depth 2. Then by Theorem 3, α is a morphic word with growth O ( n ) . In this paper we characterized morphic words with polynomial growth in terms of zigzag words, showingthat an infinite word is morphic with growth Θ( n k ) iff it is a zigzag word of depth k . We then applied6 Tim Smith this characterization to show that the morphic words with growth O ( n ) are exactly the ultimately periodicwords, and the morphic words with growth O ( n ) are exactly the multilinear words.Some open problems involving the above characterization arise in connection with automata. We saythat an automaton M determines an infinite word α if L ( M ) is infinite and every string in L ( M ) is aprefix of α . In [Smi13] it is shown that ultimately periodic words are exactly those determined by finiteautomata, and multilinear words are exactly those determined by one-way stack automata (a generalizationof pushdown automata). It would be interesting to know what kind of automaton determines exactly thezigzag words.It is further shown in [Smi13] that every multilinear word can be determined by a one-way 2-head DFA.(These automata can also determine infinite words that are not multilinear.) It would be interesting to knowwhether or not the following statement holds: every zigzag word of depth k (morphic word with Θ( n k ) growth) can be determined by a one-way k -head DFA. Acknowledgements
I would like to thank Jeffrey Shallit for suggesting the connection between multilinear words and morphicwords with quadratic growth, and for his helpful comments on a draft of this paper.
References [AS03] Jean-Paul Allouche and Jeffrey Shallit.
Automatic Sequences: Theory, Applications, General-izations . Cambridge University Press, New York, NY, USA, 2003.[DK09] Volker Diekert and Dalia Krieger. Some remarks about stabilizers.
Theor. Comput. Sci. ,410(30-32):2935–2946, August 2009.[EHK11] J¨org Endrullis, Dimitri Hendriks, and Jan Willem Klop. Degrees of Streams.
Integers: ElectronicJournal of Combinatorial Number Theory , 11B(A6):1–40, 2011.[EKR78] A. Ehrenfeucht, J. Karhum¨aki, and G. Rozenberg. A note on D0L length sets.
DiscreteMathematics , 22(3):233 – 242, 1978.[ER79] A. Ehrenfeucht and G. Rozenberg. On the structure of polynomially bounded D0L systems.
Fundamenta Informaticae 2 , pages 187–197, 1979.[HL87] Tom Head and Barbara Lando. Bounded D0L languages.
Theoretical Computer Science ,51(3):255 – 264, 1987.[Hon02] Juha Honkala. On infinite words generated by polynomial D0L systems.
Discrete AppliedMathematics , 116(3):297–305, 2002.[Hon03a] Juha Honkala. A bound for the ω -equivalence problem of polynomial D L systems.
RAIRO -Theoretical Informatics and Applications , 37:149–157, April 2003.[Hon03b] Juha Honkala. The equivalence problem of polynomially bounded D0L systems - a bounddepending only on the size of the alphabet.
Theory Comput. Syst. , 36(1):89–103, 2003.
Characterization of Morphic Words with Polynomial Growth
Inf. Comput. , 190(1):70–80,2004.[HW85] Tom Head and John Wilkinson. Code properties and derivatives of D0L systems. In
Combina-torial Algorithms on Words , pages 315–327. Springer Berlin Heidelberg, 1985.[Kar77] Juhani Karhum¨aki. The decidability of the equivalence problem for polynomially bounded D0Lsequences.
RAIRO. Inform. th´eor. , 11(1):17–28, 1977.[Smi13] Tim Smith. On infinite words determined by stack automata. In
FSTTCS 2013 , volume 24 of
Leibniz International Proceedings in Informatics (LIPIcs) , pages 413–424, Dagstuhl, Germany,2013. Schloss Dagstuhl–Leibniz-Zentrum fuer Informatik.[Smi16] Tim Smith. Prediction of infinite words with automata.