[
Abstract
A narrow connection between infinite binary words rich in classical palindromes and infinite binary words rich simultaneously in palindromes and pseudopalindromes (the socalled rich words) is demonstrated. The correspondence between rich and rich words is based on the operation acting over words over the alphabet and defined by , where . The operation enables us to construct a new class of rich words and a new class of rich words. Finally, the operation is considered on the multiliteral alphabet as well and applied to the generalized Thue–Morse words. As a byproduct, new binary rich and rich words are obtained by application of on the generalized Thue–Morse words over the alphabet .
Constructions of words rich in palindromes and pseudopalindromes]Constructions of words rich
in palindromes and pseudopalindromes
\publicationdetails1820163161513
1 Introduction
In the present paper we concentrate on construction of infinite words which are filled with palindromes or pseudopalindromes to the highest possible level, the socalled rich words. Before we explain the expression “the highest possible level” we recall the basic notions we work with. We understand by an infinite word over a finite alphabet a sequence , where for each . A factor of is a finite sequence of letters from such that for some . The set of all factors of is the language of , usually denoted . A finite word is called palindrome if coincides with its reversal .
Infinite words whose language contains infinitely many palindromes are being studied by many authors. Apart from the impulses from outside mathematics (such as HoKnSi where these words are used in a model of solid materials with finite local complexity) the main reason of the interest of mathematicians is the variety of characterizations of rich words. To specify the expression “the highest possible level” one can adopt two distinct points of view: local and global.
From the local point of view, one looks at a finite piece of the infinite word, i.e., at a factor of , and counts the number of distinct palindromes occurring in this factor. A motivation for rich word definition was an inequality due to Droubay and Pirillo, see DrPi, which states that a finite word of length contains at most distinct palindromes (the empty word is counted as a palindrome). An infinite word is rich, or full, if every its factor of length contains distinct palindromes.
From the global point of view, one counts the palindromes of length in the set of all factors of , i.e., in the language . Let and denote the number of factors of length and the number of palindromic factors of length , respectively. As shown in BaMaPe, if is closed under reversal, then the number of palindromes in is bounded from above by the relation
(1) 
In BuLuGlZa, Bucci, De Luca, Glen and Zamboni show that for infinite words with language closed under reversal the local and global points of view coincide. More precisely, is rich if and only if the inequality in (1) can be written as an equality for every .
Classic examples of rich words on binary alphabets include Sturmian words, i.e., infinite words over binary alphabet with the factor complexity for each . Sturmian words can be generalized to multiliteral alphabets in many ways, see for example BaPeSta2. Two of these generalizations, namely ary Arnoux–Rauzy words and words coding interval exchange transformation with symmetric interval permutation, are rich as well. Both mentioned classes have their language closed under reversal.
Blondin Massé, Brlek, Garon and Labbé showed in BlBrLaVu11 that rich words include complementarysymmetric Rote words. They can be defined as binary words with factor complexity for every nonzero integer and with language closed under the exchange of letters, see Rote. This implies that the language of a complementarysymmetric Rote word is closed under two mappings acting on the set of all finite binary words: the first is and the second is defined by for letters and and . Thus, the language of a complementarysymmetric Rote word is closed under all elements of a group . The same property has the language of the famous Thue–Morse word , nevertheless, it is wellknown that is not rich.
For binary words having language closed under all elements of , we show in PeSta1 that
(2) 
where is the function counting palindromes – words fixed by – in the word . Analogously to the case of equality in (1), we say that an infinite word with language closed under all elements of is rich if in (2) the equality holds for all . We also demonstrated that the Thue–Morse word is rich. In Sta2011 the second author proved that the binary generalization of the Thue–Morse word is rich for all (the definition of is recalled in Preliminaries). In fact, the words are the only rich words that have been found up to now.
One of the main aims of the present article is to describe a procedure which produces new rich words. We have found an inspiration in a connection between complementarysymmetric Rote words and Sturmian words due to Rote in Rote. Given an infinite word , we set with for all positive integer . The operator defines the mentioned relation: a word is a complementarysymmetric Rote word if and only if is a Sturmian word.
In Section 4, we investigate binary words which are simultaneously rich and also rich in the classical sense. In particular, we prove that every complementarysymmetric Rote word is rich, see Corollary 14. The main result concerning richness is presented in Theorem 24. On the one hand the theorem says that the operator applied to an rich word produces a rich word. Using the examples of rich words mentioned earlier, we get a new class of rich words, namely the words for all . On the other hand, the theorem transforms the task to discover new rich words to the task to discover a new class of rich words with special structures of palindromes. One such class is described in Sta2015. Section 5 is devoted to the notion of richness on a multiliteral alphabet. In particular, the operation is defined over the alphabet . Theorem 31 illustrates that even on a multiliteral alphabet the operation connects richness and richness for, in general, distinct groups and . In this sense Theorem 31 is a weaker version of Theorem 24.
2 Preliminaries
The set is the set of all finite words over the alphabet which is a finite set of letters. The length of the word with for all is denoted and equals . The empty word – the unique word of length – is denoted . The set together with concatenation forms a free monoid with the neutral element . A word is a factor of if for some word . If, moreover, , then we say that is a prefix of , if , the word is a suffix of . If has the form , then is denoted and the word is a conjugate of the word .
The infinite word over is a sequence . The symbol denotes the set of all infinite words over . A finite word of length is a factor of if there exists an index such that ; the index is an occurrence of the factor . The symbol stands for the set of all factors of length occurring in . The set of all factors of is the language of and is denoted by .
An infinite word is recurrent if any factor of has at least two occurrences in . Equivalently, a word is recurrent if any factor has infinitely many occurrences. If moreover for any factor the gaps between consecutive occurrences of are bounded, then the word is uniformly recurrent. Let and be factors of such that has a prefix and occurs in exactly twice. The word is a return word of and is a complete return word of . One can say equivalently: a recurrent word is uniformly recurrent if any factor has finite number of return words of .
The factor complexity of is the mapping , defined by . Given and , a factor is a right extension of the factor . Any factor of has at least one right extension, the set of all right extensions of is denoted . If has at least two right extensions we call it right special. Analogously one can define left extension and left special and . In a recurrent word any factor has at least one left extension. A factor which is left and right special is bispecial. Special factors can be used to determine the factor complexity, in particular
If is a binary alphabet, we get
(3) 
A mapping is a morphism if for all . It is an antimorphism if for all . An infinite word is closed under the mapping if for any factor . Domain of a morphism can be naturally extended to by the prescription An infinite word is called fixed point of a morphism if .
An antimorphism is involutory if . The most frequent involutory antimorphism is the reversal mapping . If the word is closed under an involutory antimorphism, then is necessarily recurrent.
If , the word is a palindrome or pseudopalindrome, if specification of the mapping is not needed. In the case , we say only palindrome instead of palindrome. The set of all palindromes occurring as factors of a finite word is denoted . The palindromic complexity of an infinite word is the mapping , defined by .
A palindrome is centered at if for some word . If a palindrome is centered at , then it is of even length.
3 defect and richness
First, we recall the definition of palindromic defect as it was introduced by Brlek, Hamel, Nivat and Reutenauer in BrHaNiRe. This classical definition is based on the inequality
(4) 
where is the set of all palindromic factors of including the empty word.
The defect of a finite word is
and defect of an infinite word is
We prefer to use the name defect instead of the originally used “defect” because we will introduce an analogous notion for a general antimorphism as well. An infinite word with is called full or rich. If is finite, we say that is almost rich. In BrReconjecture, the inequality (1) is used to introduce the value
and they conjectured that if is closed under reversal, then
(5) 
Their conjecture was proven in BaPeSta5. In particular, it means that is finite if and only if there exists such that for all , or in other words in (1) the equality holds for all .
To prove richness we will use the characterization of rich words given in BaPeSta. It exploits the notion of the bilateral order of a factor and the palindromic extension of a palindrome. The bilateral order was introduced in Ca as
(6) 
The set of all palindromic extensions of a palindrome is defined by
Theorem 1 (BaPeSta2).
Let be an infinite word closed under reversal.

The word is rich if and only if any bispecial factor of satisfies:
(7) 
If the word is almost rich, then (7) is satisfied for all bispecial factors up to finitely many exceptions.
The first attempt to study the number of palindromes for an involutory antimorphism was made in BlBrGaLa. Blondin Massé, Brlek, Garon and Labbé considered the binary alphabet and the antimorphism . They showed that
(8) 
In Sta2010, this results is generalized for an arbitrary involutory antimorphism and arbitrary alphabet into the inequality
(9) 
where . Clearly, if we have (8) as for any , if we have (4) as for any . Based on the inequality (9), the defect of is defined by
(10) 
The defect of an infinite word is defined analogously, i.e., .
Infinite words having finite defect can be characterized by several properties, for more details about defect see BaPeSta3 and about defect see Sta2010; PeSta_Milano_IJFCS. In PeSta_Milano_IJFCS we showed that there exists a very narrow connection between words with finite defect and words with zero defect. We proved that if is closed under an involutory antimorphism and is finite, then is a morphic image of a word with for some involutory antimorphism . If moreover is uniformly recurrent, then . In this sense, considering instead of does not bring a broader variability into the concept of rich words.
The situation changes when we consider more antimorphisms. In PeSta1 we defined a generalization of the notion of defect. In what follows, the symbol stands for a finite group consisting of morphisms and antimorphisms over and containing at least one antimorphism. The orbit of is the set
(11) 
We say that is closed under if for any . Word is a palindrome if for some antimorphism . The generalization of the set of all palindromic factors of a word is a set consisting of palindromic orbits, namely the set
Note that if where is an involutory antimorphism, then is in onetoone correspondence with the set (the only difference is that the latter is a set of orbits instead of factors). Let us stress that in we count how many different orbits have a palindromic representative occurring in .
Definition 2.
Let be a finite word. The defect of is defined as
where
A finite word is rich if its defect is . An infinite word is rich if all its factors are rich. In PeSta1, a distinct and equivalent definition of richness is used: it is based on a specific structure of graphs representing the factors of same length of the word.
Example 3.
We illustrate the previous notions on the Thue–Morse word , the fixed point of the morphism and starting with , i.e., . The word is closed under and . Let . For the group the value for any . Consider , the prefix of of length . We have
The corresponding defects of are
In fact, the Thue–Morse word is rich, whereas its defect and defect are both infinite, see Example 8 later.
For richness, theorems analogous to the theorems for the classical richness can be stated, c.f. PeSta2. The list of known rich words with having at least two antimorphisms is modest. It contains the generalized Thue–Morse words . The word is defined on the alphabet for all and as
where denotes the sum of digits in the base representation of the integer . See for instance AlSh; CUSICK20114738 where this class of words is studied. The language of is closed under a group isomorphic to the dihedral group of order , here denoted . In Section 5, we describe the group in details. In Sta2011, the second author proved that is rich for any parameters and .
In LCorollary 14 we add to the list of rich words also complementarysymmetric Rote words. As already mentioned in Introduction, an infinite binary word is a complementarysymmetric Rote word if its factor complexity satisfies for all and its language is closed under the exchange of the two letters .
In this article, we focus on groups acting on for which the implication
is true for any letter and any pair of antimorphisms . In PeSta1, for such a group, the number is called distinguishing, since the image of a single letter by an antimorphism from allows to identify the antimorphism. For example, the number is distinguishing for the group used in Example 3. Also for the dihedral groups studied in Section 5, the number is distinguishing.
If an infinite word is closed under a group and is distinguishing, then
(12) 
where denotes the set of all involutory antimorphisms from , see PeSta1. Clearly, if is generated by one antimorphism, say , then and . The inequality (1) is the special case of (12). Similarly, the inequality (2) can be obtained from (12) if we put . The following analogue of the result obtained by Bucci, De Luca, Glen and Zamboni in BuLuGlZa for the classical richness is proved in PeSta2.
Theorem 4.
Let an infinite word be closed under a group such that the number is distinguishing. The defect is zero if and only if in (12) the equality holds for each .
In PeSta1 we also introduced the notion almost rich word. A word closed under a group is almost rich if there exists such that the equality in (12) takes place for all integers . An infinite word is almost rich if and only if its defect
is finite.
Remark 5.
In fact, in PeSta2 the last statement is shown only for uniformly recurrent words. However, one can use the same argument we applied in proof of Theorem 2 in BaPeSta5 and show that is finite if and only if in (12) the equality takes place from some on.
4 Binary words invariant under two involutory antimorphisms
4.1 richness in binary alphabet
In this section we suppose . On binary alphabet we have only two antimorphisms and . Therefore, only the groups
can be considered when inspecting the defect . Let us start with examples of rich and almost rich words for these three groups.
Example 6.
()
The classical richness has been studied very intensively and thus
there are known many examples of binary rich words including
Sturmian words, see DrJuPi, Rote Words, see BlBrLaVu11, the
period doubling word, see Ba_phd, etc.
Plenty examples of binary almost rich words can be constructed
by application of special standard morphisms to any rich word, see
GlJuWiZa for the definition of standard morphism and a proof.
Example 7.
()
It can be easily seen, or shown using the results of
BlBrGaLa, that there exist only two rich infinite
words, namely the periodic word and its shift
. The two mentioned words are also rich and
rich as the equalities hold in (1) and
(2)
for all .
Examples of infinite words with finite defect are standard words with seed (see BuLuLuZa2 for their definition and PeSta_Milano_IJFCS for a proof). This class also includes very simple examples of words with finite defect: periodic words having the form with . One can easily show that in this case (see Corollary 8 in BrHaNiRe for defect, a modification for is straightforward).
Example 8.
()
The only so far known examples of rich words are given in
Sta2011: they are the generalized Thue–Morse words
.
If is odd, then and hence is also rich and rich.
If is even, the word is aperiodic and . To prove it for any even we use the fact that is a fixed point of the morphism determined by
It is readily seen that the factor is strong, i.e., its bilateral order is positive, specifically , as all four words , , , and belong to . Moreover is an palindrome. The form of the morphism ensures that

for any strong factor ;

if is an palindrome, then is an palindrome,

if is an palindrome, then is an palindrome,
These properties imply that for any , the factor is an palindrome and hence it is not an palindrome. Thus there exist infinitely many nonpalindromic bispecial factors with nonzero bilateral order. Using LTheorem 1 one may see that .
To prove that we may proceed analogously. The factors are palindromes but they are not palindromes for all . These factors are bispecial with the same bilateral order . A modification of LTheorem 1 for the antimorphism (which can be found in full generality in PeSta2, Proposition 45) gives the result.
Now we look at the question whether a word can be simultaneously (almost) rich for two groups on the binary alphabet. We will discuss the connection between finiteness of defects , and . In what follows we will consider words invariant under and simultaneously. First we study the relationship between  and palindromes.
Lemma 9.
Let be palindromes such that the word is an palindrome, i.e.,
(13) 
There exist and such that and .
Proof.
We will induce on the difference of and . First, suppose that , then (13) implies that and it suffices to set and .
Suppose now that . We can suppose without loss of generality that . Set with . It follows from (13) that , thus and . Therefore, is a palindrome. Since is a palindrome, we have . We get
(14) 
This equation on words, written in general as , has a wellknown solution: there exist words and such that and . If the word is palindrome, then the form of implies that and are palindromes as well. To use the solution of to solve (14), we set , and and we get the solutions and . Since , it follows that the difference of and is less than . We apply the induction hypothesis on the palindromes and satisfying and we get that and for some . Substituting for and one can find that it suffices to set and the claim is proved. ∎
Corollary 10.
If and are palindromes such that , then there exists such that for some .
Proposition 11.
If an infinite recurrent word has finite defect and finite defect, then is periodic with a period conjugate to , where is an palindrome.
Proof.
Let be an infinite recurrent word with finite  and defects. Using Proposition 5 in PeSta_Milano_IJFCS, it follows that is closed under and and there exists an integer such that
for all . Since is also closed under all elements of the group , combining the two previous equalities with (2) we get for all , i.e., the word is eventually periodic. Since is recurrent and closed under , the word is purely periodic, i.e., . As is closed under , the word is a factor of . It implies that with and . As the length of any palindrome is even, the concatenation of two palindromes is conjugate to an palindrome, in other words, the word is conjugate to an palindrome, say . Thus for some . As has language closed under as well, by the same reasoning we have , where and . Applying Corollary 10 we get for some . It is enough to set . ∎
The following proposition treats another combination of two defects.
Proposition 12.
Let be a word having its language closed under the group and let or . If is finite (resp. zero), then is finite (resp. zero) as well.
Before giving a proof of the last proposition, we recall Proposition 4.3 of BaPeSta3 which will be needed.
Proposition 13.
Let be an infinite word with language closed under reversal. Suppose that there exists an integer such that for all the equality holds. The complete return words of any palindromic factor of length are palindromes.
of LProposition 12.
Let us realize that closedness of under and ensures that the numbers and are even. Indeed, if is an palindrome of length , then is an palindrome as well, and analogously for palindromes.
First we consider . Let us suppose that there exists a positive integer such that
We will show that this assumption leads to a contradiction.
In particular the assumption yields the inequality , which implies that there is no palindrome of length at least . Let be an palindrome of length at least . We say that a factor has Property if it satisfies all of the following:

occurs in exactly once,

occurs in exactly once,

is a suffix or a prefix of ,

is a suffix or a prefix of .
Let be a factor with Property . Such factor must exist as is closed under and thus as well. As is an palindrome and is closed under reversal, the factor has Property as well. Since , we can assume without loss of generality that is the factor starting in and ending in . Let us look at the complete return word of , say , with prefix . The fact that the equality is valid for all implies according to LProposition 13 that the complete return word of is an palindrome. Thus the factor is a suffix of . Moreover contains only two factors (namely and ) with Property .
We have shown for every factor with Property that its closest right neighbor in with Property is its mirror image . Therefore, there exist only two factors with Property , namely and .
On the other hand, if has Property , then has Property as well and thus . As is a suffix of , the factor has a prefix . It implies that which contradicts the fact that there is no palindrome longer than .
We have shown that
implies
If is rich, then and thus is also rich. If its defect is finite but nonzero, then and has finite defect.
In the case the proof is analogous. ∎
Corollary 14.
Every complementarysymmetric Rote word is rich.
Proof.
In BlBrLaVu11, it is proved that Rote words are rich. Since a complementarysymmetric Rote word is closed under , the previous theorem proves the statement. ∎
Remark 15.
Let us stress that the reverse implication in Proposition 12 does not hold. As shown in Example 8, the Thue–Morse word has , whereas .
According to Proposition 11, the finiteness of both defects and forces the word to be periodic. The Rote words illustrate that there exist aperiodic words with finite and .
4.2 The mapping on binary words
In this section we introduce and study the basic properties of the mapping that is given by
In particular, for every . The following list contains some elementary properties of .

, and .

if and only if or .

is an palindrome if and only is an palindrome or an palindrome.
The operation is naturally extended to by setting
To describe the factor complexity of we study special factors in
Lemma 16.
Let . A factor is right special in if and only if one of the following occurs:

or is right special in ,

, and for both .
Proof.
Let be right special in . Then and belong to . It may happen that either both and belong to , which means that is right special in , or both and belong to , which means that is right special in .
Otherwise and are not right special in , but necessarily both belong to . Let and be the unique right prolongations in of and respectively. Since and must be distinct right prolongations of , we have , i.e., . Since has a unique extension to the right , we get . ∎
Lemma 17.
Let . The word is uniformly recurrent if and only if is uniformly recurrent.
Proof.
: Let be a factor of . Then for some . The gaps between the neighboring occurrences of in are bounded by some constant. The gaps between the occurrences of in are bounded by the same constant.
: Let be a factor of . Then is a factor of and the gaps between the occurrences of are bounded, say by . If is the only factor of such that , i.e., is the only preimage of by in , then the occurrences of in are bounded by as well. Let us suppose that has more preimages in . According to Property II, there are only two preimages of , namely and . Let be a factor of such that is a prefix of and is a suffix of and and occur in only once. Then is a complete return word of . As is uniformly recurrent, the gaps between the occurrences of the factor are bounded, say by . Both possible preimages of in , namely and , contain either as its prefix or its suffix. Thus the gaps between the occurrences of in are bounded by as well. ∎
Lemma 18.
Let . If is closed under , then is closed under or under .
Proof.
Let be a prefix of . The word is a factor of . According to the assumption, belongs to as well. Due to Property II, either or belong to . Thus

either there exist infinitely many prefixes such that ;

or there exist infinitely many prefixes such that .
Let us suppose that a) happens. For any we may find a prefix such that and is a factor of . Thus, and we can conclude that is closed under .
The case b) is analogous. ∎
Example 19.
The period doubling word is the fixed point of the primitive morphism
Thus
It is wellknown that the period doubling word is the image of the Thue–Morse word by .
The word is closed under , the word is closed under and . It illustrates that in the previous lemma the simultaneous closedness under and is not excluded.
The previous lemma guarantees that is closed at least under one of the antimorphisms and . We now focus on a property of that ensures that is closed under both of them.
Lemma 20.
Let . The language contains infinitely many palindromes and palindromes if and only if contains infinitely many palindromes centered at the letter and infinitely many palindromes not centered at the letter .
Proof.
Let be a finite nonempty word and let . It suffices to realize the following:

is an palindrome if and only if is an palindrome centered at the letter ;

is an palindrome of even length if and only if is an palindrome centered at the letter ;

is an palindrome of odd length if and only if is an palindrome of even length, i.e., centered at .
∎
Corollary 21.
Let