On the binomial equivalence classes of finite words

01/31/2020 ∙ by Marie Lejeune, et al. ∙ University of Liège 0

Two finite words u and v are k-binomially equivalent if, for each word x of length at most k, x appears the same number of times as a subsequence (i.e., as a scattered subword) of both u and v. This notion generalizes abelian equivalence. In this paper, we study the equivalence classes induced by the k-binomial equivalence with a special focus on the cardinalities of the classes. We provide an algorithm generating the 2-binomial equivalence class of a word. For k ≥ 2 and alphabet of 3 or more symbols, the language made of lexicographically least elements of every k-binomial equivalence class and the language of singletons, i.e., the words whose k-binomial equivalence class is restricted to a single element, are shown to be non context-free. As a consequence of our discussions, we also prove that the submonoid generated by the generators of the free nil-2 group on m generators is isomorphic to the quotient of the free monoid { 1, ... , m}^* by the 2-binomial equivalence.



There are no comments yet.


page 1

page 2

page 3

page 4

This week in AI

Get the week's most popular data science and artificial intelligence research sent straight to your inbox every Saturday.

1. Introduction

Let be a totally ordered alphabet of the form . We make use of the same notation for the induced lexicographic order on .

Let be an equivalence relation on . The equivalence class of the word is denoted by . We will be particularly interested in two types of subsets of with respect to . We let

denote the language of lexicographically least elements of every equivalence class for . So there is a one-to-one correspondence between and . We let

denote the language made of the so-called -singletons, i.e., the elements whose equivalence class is restricted to a single element. Clearly, we have . In the extensively studied context of Parikh matrices (see Section 2), two words are -equivalent if they have the same Parikh matrix. In that setting, singletons are usually called -unambiguous words and have attracted the attention of researchers, see, for instance, [13] and the references therein.

Let be an integer. Let be the -abelian equivalence relation introduced by Karhumäki [7]. Two words are -abelian equivalent if they have the same number of factors of length at most . If , the words are abelian equivalent. We denote by the

Parikh vector

of the finite word , defined as

where is the number of occurrences of the letter in . Two words and are abelian equivalent if and only if .

The -abelian equivalence relation has recently received a lot of attention, see, for instance, [9, 10]. In particular, the number of -abelian singletons of length is studied in [8]. Based on an operation of -switching, the following result is given in [1].

Theorem 1.

Let . Let be a -letter alphabet. For the -abelian equivalence, the two languages and are regular.

As discussed in Section 2, the set of -unambiguous words over a -letter alphabet is also known to be regular. Motivated by this type of results, we will consider another equivalence relation, namely the -binomial equivalence introduced in [12], and study the corresponding sets and .

Definition 2.

We let the binomial coefficient denote the number of times appears as a (not necessarily contiguous) subsequence of . Let be an integer. Two words and are -binomially equivalent, denoted , if for all words of length at most .

We will show that -abelian and -binomial equivalences have incomparable properties for the corresponding languages and . These two equivalence are both a refinement of the classical abelian equivalence and it is interesting to see how they differ. As mentioned by Whiteland in his Ph.D. thesis: “part of the challenges in this case follow from the property that a modification in just one position of a word can have global effects of the distribution of subwords, and thus the structure of the equivalence classes.” [15].

This paper is organized as follows. The special case of -binomial equivalence over a -letter alphabet is presented in Section 2: the corresponding languages are known to be regular. In Section 3, we discuss an algorithm generating the -binomial equivalence class of any word over an arbitrary alphabet. Then we prove that the submonoid generated by the generators of the free nil- group on generators is isomorphic to . Section 4 is about the growth rate of . As a consequence of Sections 3 and 4, the growth function for the submonoid generated by the generators of the free nil- group on generators is in . In the last section, contrasting with Theorem 1, we show that and are rather complicated languages when and : they are not context-free.

2. -binomial equivalence over a -letter alphabet

Let be a -letter alphabet. Recall that the Parikh matrix associated with a word is the matrix given by

For , can be deduced from . Indeed, we have and if ,


It is thus clear that if and only if . We can therefore make use of the following theorem of Fossé and Richomme [2]. If two words and over an arbitrary alphabet can be factorized as and with , we write . The reflexive and transitive closure of this relation is denoted by .

Theorem 3.

Let be two words over . The following assertions are equivalent:

  • the words and have the same Parikh matrix;

  • the words and are -binomially equivalent;

  • .

Consequently, the language avoiding two separate occurrences of and (or, and ) is regular. A regular expression for this language is given by

A NFA accepting was given in [13].

Remark 4.

From [12], we know that

Note that this is exactly the sequence A000125 of cake numbers, i.e., the maximal number of pieces resulting from planar cuts through a cube.

Proposition 5.

The language is regular.


As a consequence of Theorem 3, if a word belongs to , it cannot be of the form because otherwise, the word belongs to the same class and is lexicographically less. Consequently,

The reader can check that the language in the r.h.s. has exactly words of length . We conclude with the previous remark that the two languages are thus equal. ∎

3. -binomial equivalence over a -letter alphabet

Theorem 3 does not hold for ternary or larger alphabets. Indeed, the two words and are -binomially equivalent but both words belong to which means that . It is therefore meaningful to study over larger alphabets and to describe the -binomial equivalence classes.

The first few terms of are given by

This sequence also appears in the Sloane’s encyclopedia as entry A140348 which is the growth function for the submonoid generated by the generators of the free nil- group on three generators. In this section, we make explicit the connection between these two notions (see Theorem 11).

Recall that the commutator of two elements belonging to a multiplicative group is . Hence, the following relations hold

A nil- group is a group for which the commutators belong to the center , i.e.,


Let . The free nil- group on generators has thus a presentation

As an example, making use of these relations, let us show that two elements of the free group on are equivalent in :

Let be the alphabet of the inverse letters, that we suppose disjoint from . By abuse of notation, for all , is the letter . Since is the quotient of the free monoid under the congruence relations generated by and (2), we will consider the natural projection denoted by

In Section 3.1, we provide an algorithmic description of any -binomial class. We make use of this description in Section 3.2 to show that the monoid is isomorphic to the submonoid, generated by , of the nil- group .

3.1. A nice tree

Let be a word over and the lexicographically least element in its abelian equivalence class, i.e.,

Consider the following algorithm that, given , produces the word only by exchanging adjacent symbols. We let denote the longest common prefix of two finite words and . We define a sequence of words starting with .



thus and with and

consider the leftmost occurring in , i.e,

and only contains letters less than .

for to

Remark 6.

It can easily be shown that, at the beginning of each iteration of the while loop, the word is the least lexicographic word of its abelian class. It follows that and only contains letters less than .

In the for loop, the two letters and are exchanged. Observe that . After the for loop, the two letters and are exchanged (and again ). We record the sequence and number of exchanges of the form for all with that are performed when executing the algorithm.

Using (1), the next lemma is obvious.

Lemma 7.

Two abelian equivalent words are -binomially equivalent if and only if for all with . Let be a word in . In the set of tuples of size

the greatest element, for the lexicographic ordering, is achieved for .

We consider the coefficients with . Note that, in the algorithm, if is obtained from by an exchange of the form , all these coefficients remain unchanged except for

Corollary 8.

When applying the algorithm producing the word from the word , the total number of exchanges , with , is given by

Consequently two words are -binomially equivalent if and only if they are abelian equivalent and the total number of exchanges of each type , , when applying the algorithm to these two words, is the same. An equivalence class is thus completely determined by a word and the numbers of different exchanges. We obtain an algorithm generating all words of .

Definition 9.

Let us build a (directed) tree whose vertices are words, the root is . There exists an edge from to if and only if is obtained by an exchange of the type , , from . The edge is labeled with the applied exchange.

To generate the -equivalence class of , it suffices to take all the nodes that are at level such that the path from to the node is composed of edges labeled by , for all letters . Note that a polynomial time algorithm checking whether or not two words are -binomially equivalent has been obtained in [3] and is of independent interest.


Let us consider the word on the alphabet . Its -equivalence class is . It can be read from the tree in Figure 1. Some comments need to be done about this figure. The edges labeled by (resp., , ) are represented in black (resp., red, green). In every node, the vertical line separates the longest common prefix (denoted by in the algorithm) between the word in the node and the word from we are going to reach. If the current node can be written while the word can be written , the underlined letter corresponds to the leftmost occurring in (see the algorithm). Finally, when building the tree, if a path has a number of black (resp. red, green) edges greater than (resp., , ), it is useless to continue computing children of this node, since they won’t lead to an element of .

Figure 1. Generating the -class of .

3.2. Isomorphism with a nil- submonoid

Since we are dealing with the extended alphabet , let us first introduce a convenient variation of binomial coefficients of words taking into account inverse letters.

Definition 10.

Let be an integer. For all words over the alphabet and , let us define

where is the usual binomial coefficient over the alphabet . Let and denote

where the last components are obtained from all the words made of two different letters in , ordered by lexicographical order.

Notice that, if and are words over , then

and so, and are -binomially equivalent if and only if .


Let and . Applying the previous definition, for all , we have

Similarly, for all , we have


Therefore, computing classical binomial coefficients, we obtain

We are now ready to prove the main result of this section.

Theorem 11.

Let . The monoid is isomorphic to the submonoid, generated by , of the nil- group .


Let us first show that for any two words and over such that , the relation holds. Indeed, using (4) one can easily check that, for all and , we have

Now, one can show that, for all and ,

For instance, let with ,

This implies that a map can be defined on the free nil- group (otherwise stated, the diagram depicted in Figure 2 is commutative) by

Figure 2. A commutative diagram (proof of Theorem 11).

In particular, if and are words over such that , then we may conclude that meaning that they are -binomially equivalent. Otherwise stated, for every , is a subset of an equivalence class for .

To conclude the proof, we have to show that all the elements of an equivalence class for are mapped by on the same element of . Let be such that . Using the algorithm described in Section 3.1, there exists a path in the associated tree from the root to and another one to . By definition of the commutator, if is written with , then . Moreover, since the commutators are central in .

Therefore, following backwards the path from to the root of the tree and recalling that each edge corresponds to an exchange of letters, we obtain

and, similarly, following backwards the path from to the root,

But since , we get . ∎

4. Growth order

We first show that the growth of is bounded by a polynomial in . This generalizes a result from [12] for a binary alphabet. Note that a similar result was obtained in [11]

. Next, we obtain better estimates for


Proposition 12.

Let and . We have

when tends to infinity.


For every such that and , we have

Therefore, for every such that , we have

By definition, the -equivalence class of is uniquely determined by the values of for all such that . There are

such coefficients and thus,

We have obtained an upper bound which is far from being optimal but it ensures that the growth is polynomial. However, for , it is possible to obtain the polynomial degree of the growth. We make use of Landau notation: if there exist constants such that, for all large enough, .

Proposition 13.

Let be an alphabet of size . We have

when tends to infinity.


Let be the function such that for any ,

In other words, counts the number of -binomial equivalence classes whose Parikh vector is . Let be the -norm (i.e., for all vectors , ). Clearly for all ,


For any , , and , and . Any word has its equivalence class uniquely determined by the values of for all and for all . Moreover, for all and , . We deduce that for all ,

From equation (5), we get that

We conclude that when . It remains to get a convenient lower bound.

For any , , and , let

Considering all possible letter exchanges as in (3) from to , the binomial coefficient decreases by at every step from to , we thus have


which is a set of cardinality . For any , let us consider the following language

where the products must be understood as languages concatenations, the indices of the last product are taken in decreasing order, and is the remainder of the Euclidean division of by .

For instance for ,

Roughly speaking, for every and , we will show that mostly depends on and takes a quadratic number of values (when choosing accordingly). Furthermore, the role of

words is limited to padding. Indeed, observe that for all

, .

Let and . Then, by definition, there exist words with, for all , , such that

Let and be two integers such that and let us compute the binomial coefficient associated with . A subword either occurs in a single factor of the above product (the first two terms below), or and appear in two different factors:

Observe that by definition of , the second and last terms vanish. Hence,

The second term of the latter expression is uniquely a function of (there is no dependency on ) while, from (6),

Thus for a fixed , considering all , can take different values. Moreover, for all such that

there exists such that for all . We deduce that, for all ,

By equation (5), we finally get the lower bound: