lecture-3---unavoidable-patterns
lecture-3---unavoidable-patterns
SMSTC Module
Contents
1 Powers 2
2 Sesquipowers 2
5 Problems 6
Bibliography 7
A pattern p is a word that contains special symbols called variables, and the associated (infi-
nite) pattern language p(A) is obtained by replacing the variables with arbitrary nonempty
words over an alphabet A, with the condition that two occurrences of the same variable
must be replaced with the same word. Patterns are also allowed to contain constant
letters, which unlike variables are never replaced with arbitrary words, but this type of
patterns is not to be consider in the module. A pattern p is avoidable if there exists an
infinite sequence w over a finite alphabet such that the intersection of the set of all factors
of w and the language associated with p is empty. The pattern p is unavoidable otherwise.
For an example of a pattern (that we have already met), consider square αα having
associated pattern language αα(A) = {uu|u ∈ A+ }. It is a classical result that αα(A) is
an avoidable set of words if A has at least three letters, whereas it is an unavoidable set
of words if A has only one or two letters. Indeed, an infinite square-free word on three
letters can be constructed (remember how?), and it is easy to check that every binary
word of length 4 contains a square. We will say that the pattern αα is 3-avoidable and
2-unavoidable. More generally, a pattern is k-avoidable if and only if it is avoidable on
any k-letter alphabet. A pattern which is not k-avoidable is k-unavoidable. There is the
(recursive) Zimin algorithm (using so called pattern adjacency graphs, free sets, and the
concept of irreducibility, to be discussed in Section 3) to find out if a given pattern is
avoidable or not.
Another example of a pattern is αβα representing words of the form uvu, with u, v ∈
A+ . By Theorem 2.1 below, the pattern αβα is unavoidable (for any finite alphabet). Yet
1
another example of a pattern is p = ααββα. The pattern language associated with p over
an alphabet A is p(A) = {uuvvu|u, v ∈ A+ }. The word 1011011000111 contains p (given
by the morphism/substitution h : α → 011, β → 0), whereas the word 0000100010111
avoids p. In fact, by Theorem 4.1 below, ααββα is 2-avoidable.
1 Powers
The simplest class of patterns is the class of powers of a single variable, namely, αn for
n ≥ 0. The first two, α0 = ε and α1 = α, are trivially unavoidable as they are encountered
by any nonempty word. For n ≥ 2, α2 = αα is 3-avoidable, and αn for n ≥ 3 is 2-
avoidable (the morphism µ : a → abc, b → ac, c → b and the Thue-Morse morphism
θ : 0 → 01, 1 → 10, respectively, support these facts).
Two overlapping occurrences of the same word either contain the pattern ααα or
the pattern αβαβα. It was already mentioned above that the Thue-Morse sequence is
overlap-free because it avoids both of these patterns. Next theorem justifies this fact.
Theorem 1.1. The Thue-Morse sequence t avoids the patterns ααα and αβαβα.
2 Sesquipowers
2
one item. This is a simple, but very powerful principle that appears as early as in 1624 in
a book attributed to Jean Leurechon [2].
Theorem 2.1. The pattern αβα is unavoidable. More precisely, if for an alphabet A,
|A| = k, then any word of length at least 2k + 1 contains an occurrence of αβα.
Theorem 2.2. Let p be a pattern unavoidable on A, and x be a variable that does not
occur in p. Then the pattern pxp is unavoidable on A.
Proof. Let |A| = k. Since p is unavoidable on A, there is an integer ℓ such that any word
in Aℓ contains p. This is a finite set with k ℓ elements. Let now N := k ℓ (ℓ + 1) + ℓ, and
consider any word w ∈ AN . The word w can be viewed as concatenation of k ℓ + 1 words of
length ℓ, separated by individual letters. Among these k ℓ + 1 factors of length ℓ, at least
two are equal (by the pigeonhole principle), say w = w0 vw1 vw2 with |v| = ℓ and |w1 | ≥ 1.
There is a nonerasing morphism h : (Alph(p))∗ → A∗ such that v = v0 h(p)v1 , and letting
h(x) := v1 w1 v0 , we conclude that h(pxp) is a factor of w.
Let E denote the alphabet used in patterns, whose elements are, as above, α, β, γ, etc.
Let p ∈ E ∗ be a pattern. The adjacency graph of p is the bipartite graph AG(p) with two
copies of E as vertices, denoted by E L and E R , and with an edge between ξ L and ν R if
and only if ξν is a factor of p. For example, the adjacency graph of the pattern αβαγβα,
shown in Figure 1, has 6 vertices and 4 edges.
A nonempty subset F of Alph(p) is called a free set (for p) if there exists no path
in AG(p) linking a left-side vertex ξ L to a right-side vertex ν R for ξ, ν ∈ F . To find all
free sets, one should first determine the connected components of AG(p). In our example,
AG(p) has two connected components, {β L , αR } and {γ L , β R , αL , γ R }, and two free sets,
{α} and {β}.
3
αL αR
βL βR
γL γR
Given a pattern p and a free set F for p, we say that p reduces in one step to q by
the deletion of F if q is the pattern obtained by deleting from p all occurrences of letters
in F . Further, we say that p reduces to q if there is a sequence of one-step reductions
leading from p to q. Finally, a pattern p is reducible if it reduces to the empty pattern ε,
and p is irreducible otherwise.
In the above example, p = αβαγβα reduces to βγβ by deletion of the free set {α},
and βγβ itself reduces to γ, which in turn reduces to ε. The pattern p is therefore reducible.
However, if we had begun with the deletion of the free set {β}, we would have obtained the
irreducible pattern ααγα. To prove that a pattern is irreducible, it is therefore necessary
to recursively explore all possible sequences of one-step reductions and make sure that
none of them leads to the empty pattern. (One should not expect this procedure to be
very efficient in practice.) This recursive algorithm is known as the Zimin algorithm.
It should be notes that it is sometimes necessary to delete free sets having more
than one element, for instance for the pattern
where all deletions of a free singleton lead to an irreducible pattern, while p can be reduced
to the empty pattern starting with the deletion of the free set {α, α′ }.
The (pretty long and technical) proof of the following fundamental result can be
found in [1].
Theorem 3.1. A pattern is avoidable if and only if it is irreducible.
One of the facts used to prove Theorem 3.1 is the following statement whose proof
can be found in [1].
Theorem 3.2. If a pattern p reduces to a pattern q and q is unavoidable, then p is also
unavoidable.
4
Theorem 3.4. Let p be a pattern with n variables. If |p| ≥ 2n , then p is avoidable.
Proof. We prove by induction on n that if p is unavoidable, then |p| < 2n . The base
case follows from the existence of square-free sequences. Assume that it holds for n, and
consider an unavoidable pattern p with n + 1 variables. According to Theorem 3.3, there
is a variable α that occurs only once in p. Then p can be written as p = p1 αp2 , where p1
and p2 are patterns with at most n variables, which are both unavoidable since they are
factors of the unavoidable p. By the induction hypothesis, p1 and p2 have length at most
2n − 1, hence p has length at most 2n+1 − 1.
In some sense, Zimin words give all unavoidable patterns. Indeed, say that a pattern
p divides a pattern p′ if p′ , viewed as an ordinary word, has a factor in the pattern language
of p. Then, we have the following statement whose proof is based on the fact that if p
reduces to q in one step, and q divides Zn , then p divides Zn+1 .
Theorem 3.5. A pattern p is unavoidable if and only if it divides some Zimin word Zn .
The Zimin type of a finite word w (introduced in [3]) is the maximum number k such
that w is an image of the Zimin word Zk under a non-erasing morphism. For example,
the Zimin type of the word u = adbadcccadbad is 3, because u is the image of Z3 under
the morphism
α1 → ad, α2 → b, α3 → ccc,
and u is not an image of Zk for k > 3 under any morphism. On the other hand, the Zimin
type of the word star is 1, because this word is the image of Z1 under the morphism
α1 → star (and not an image of Zk for k > 1 under any morphism).
The paper [3] gives an efficient algorithm to compute the Zimin type of a word.
Avoidability index µ(p) of a pattern p is the smallest integer k such that p is k-avoidable,
or ∞ if p is unavoidable. Clearly, 2 ≤ µ(p) ≤ ∞ since no pattern is 1-avoidable. Roughly
speaking, the avoidability index of a pattern measures how easy it is to avoid this pattern.
There is no algorithm to compute avoidability index. Even for very short patterns the
value of µ(p) may be unknown. For instance, it is not known whether µ(ααββγγ) is equal
to 2 or 3, although there is some experimental evidence that the index is 2.
Apart from the final remark below, we only consider the class of binary patterns,
that is, patterns with at most two different variables in E = {α, β}.
The fact that αα is a 3-avoidable 2-unavoidable pattern gives us some information
about binary patterns. Only a finite number of binary patterns are 3-unavoidable. Indeed,
a pattern that contains αα as a factor must be 3-avoidable, and since αα is 2-unavoidable,
there are only finitely many binary patterns which do not contain αα, namely, ε, α, β, αβ,
5
βα, αβα, and βαβ. All of these are in fact unavoidable, which implies that the avoidability
index of a binary pattern can only be 2, 3, or ∞.
The remaining question is to distinguish 3-avoidable from 2-avoidable patterns.
• The 22 binary patterns αα = ββ, ααβ = ββα, αββ = βαα, ααβα = ββαβ,
ααββ = ββαα, αβαα = βαββ, αβαβ = βαβα, αββα = βααβ, ααβαα = ββαββ,
ααβαβ = ββαβα, and βαβαα = αβαββ have avoidability index 3.
• All other binary patterns, in particular, all binary patterns of length 6 or more, have
avoidability index 2.
As a final remark, we note the following fact. The pattern αα separates the binary
and ternary alphabets meaning that it is 3-avoidable but 2-unavoidable. Similarly, the
pattern αβuθγvγαwβαzαγ separates 3- and 4-alphabets, that is, it is 4-avoidable but
3-unavoidable. Interestingly, no pattern separating larger alphabets is known!
5 Problems
1. It is known that the longest binary words avoiding the patterns αα, ααβ, ααβα,
αββα, and ααββ are 3, 4, 9, 10, and 11, respectively. Can you come up with
examples of such words? For example, for the first pattern, αα, such a word is aba,
whereas for the last pattern, ααββ, such a word is abaaabaaaba. (You don’t need
to prove anything, just try to find suitable constructions satisfying the restrictions.)
3. What is the Zimin type of the word baobabarbaoba? Why? What about the Zimin
type of the word radar?
4. Find the number of binary words avoiding the pattern αα. The same question is for
ααβ. Don’t forget the empty word in your count! Did you get 7 and 15, respectively?
How can you argue that a longest ααβ-avoiding word is of length 4? How many of
binary ααβ-avoiding words are Lyndon?
6. Is the pattern αβγβγβγβ avoidable? To justify your result, you may use one of the
theorems in the lecture notes.
6
7. Prove that the pattern αβαγ is unavoidable for any finite alphabet A. (Hint: One
way to approach the problem is to use the proof of the theorem on unavoidability of
the pattern αβα.)
References
[2] B. Rittaud and A. Heeffer. The pigeonhole principle, two centuries before Dirichlet.
The Mathematical Intelligencer 36 (2014) 2, 27–29.
[3] W. Rytter, A. M. Shur. Searching for Zimin patterns. Theoretical Computer Science
571 (2015) 50–57.