Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf ·...

201
Combinatorics on Words: An Introduction Jeffrey Shallit School of Computer Science University of Waterloo Waterloo, Ontario N2L 3G1 Canada [email protected] http://www.cs.uwaterloo.ca/~shallit 1 / 201

Transcript of Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf ·...

Page 1: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Combinatorics on Words:

An Introduction

Jeffrey ShallitSchool of Computer Science

University of WaterlooWaterloo, Ontario N2L 3G1

[email protected]

http://www.cs.uwaterloo.ca/~shallit

1 / 201

Page 2: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

The Main Themes

periodicity

2 / 201

Page 3: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

The Main Themes

periodicity

patterns and pattern avoidance

3 / 201

Page 4: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

The Main Themes

periodicity

patterns and pattern avoidance

equations in words

4 / 201

Page 5: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

The Main Themes

periodicity

patterns and pattern avoidance

equations in words

infinite words and their properties

5 / 201

Page 6: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Some notation

Σ - a finite nonempty set of symbols - the alphabet

6 / 201

Page 7: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Some notation

Σ - a finite nonempty set of symbols - the alphabet

word - a finite or infinite list of symbols chosen from Σ

7 / 201

Page 8: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Some notation

Σ - a finite nonempty set of symbols - the alphabet

word - a finite or infinite list of symbols chosen from Σ

Σ∗ - set of all finite words

8 / 201

Page 9: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Some notation

Σ - a finite nonempty set of symbols - the alphabet

word - a finite or infinite list of symbols chosen from Σ

Σ∗ - set of all finite words

Σ+ - set of all finite nonempty words

9 / 201

Page 10: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Some notation

Σ - a finite nonempty set of symbols - the alphabet

word - a finite or infinite list of symbols chosen from Σ

Σ∗ - set of all finite words

Σ+ - set of all finite nonempty words

Σω - set of all (right-)infinite words

10 / 201

Page 11: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Some notation

Σ - a finite nonempty set of symbols - the alphabet

word - a finite or infinite list of symbols chosen from Σ

Σ∗ - set of all finite words

Σ+ - set of all finite nonempty words

Σω - set of all (right-)infinite words

Σ∞ = Σ∗ ∪ Σω

11 / 201

Page 12: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

More notation

the empty word: ε

12 / 201

Page 13: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

More notation

the empty word: ε

w = a1a2 · · · an

13 / 201

Page 14: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

More notation

the empty word: ε

w = a1a2 · · · an

w [i ] := ai , w [i ..j ] := aiai+1 · · · aj

14 / 201

Page 15: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

More notation

the empty word: ε

w = a1a2 · · · an

w [i ] := ai , w [i ..j ] := aiai+1 · · · aj

w = a0a1a2 · · ·

15 / 201

Page 16: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

More notation

the empty word: ε

w = a1a2 · · · an

w [i ] := ai , w [i ..j ] := aiai+1 · · · aj

w = a0a1a2 · · ·

xω = xxx · · ·

16 / 201

Page 17: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

More notation

the empty word: ε

w = a1a2 · · · an

w [i ] := ai , w [i ..j ] := aiai+1 · · · aj

w = a0a1a2 · · ·

xω = xxx · · ·

ultimately periodic: z = xyω

17 / 201

Page 18: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

More notation

the empty word: ε

w = a1a2 · · · an

w [i ] := ai , w [i ..j ] := aiai+1 · · · aj

w = a0a1a2 · · ·

xω = xxx · · ·

ultimately periodic: z = xyω

Operations: concatenation, raising to powers xn =

n︷ ︸︸ ︷xx · · · x , x0 = ε,

reversal xR

18 / 201

Page 19: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

More notation

the empty word: ε

w = a1a2 · · · an

w [i ] := ai , w [i ..j ] := aiai+1 · · · aj

w = a0a1a2 · · ·

xω = xxx · · ·

ultimately periodic: z = xyω

Operations: concatenation, raising to powers xn =

n︷ ︸︸ ︷xx · · · x , x0 = ε,

reversal xR

prefix, suffix, factor, subword

19 / 201

Page 20: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Algebraic framework

semigroup: concatenation is multiplication, associative

20 / 201

Page 21: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Algebraic framework

semigroup: concatenation is multiplication, associative

monoid: semigroup + identity element (ε)

21 / 201

Page 22: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Algebraic framework

semigroup: concatenation is multiplication, associative

monoid: semigroup + identity element (ε)

free monoid: no relations among elements

22 / 201

Page 23: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Algebraic framework

semigroup: concatenation is multiplication, associative

monoid: semigroup + identity element (ε)

free monoid: no relations among elements

group: add inverses of elements a−1

23 / 201

Page 24: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Periodicity

words - fundamentally noncommutative

24 / 201

Page 25: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Periodicity

words - fundamentally noncommutative

casebook 6= bookcase

25 / 201

Page 26: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Periodicity

words - fundamentally noncommutative

casebook 6= bookcase

When do words commute?

26 / 201

Page 27: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Periodicity

words - fundamentally noncommutative

casebook 6= bookcase

When do words commute?Here are two words that “almost” commute:

27 / 201

Page 28: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Periodicity

words - fundamentally noncommutative

casebook 6= bookcase

When do words commute?Here are two words that “almost” commute:

w = 01010 and x = 01011010

28 / 201

Page 29: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Periodicity

words - fundamentally noncommutative

casebook 6= bookcase

When do words commute?Here are two words that “almost” commute:

w = 01010 and x = 01011010

wx = 0101001011010

29 / 201

Page 30: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Periodicity

words - fundamentally noncommutative

casebook 6= bookcase

When do words commute?Here are two words that “almost” commute:

w = 01010 and x = 01011010

wx = 0101001011010

xw = 0101101001010

By the way, this raises the question: can the Hamming distancebetween wx and xw be 1? It can’t; there is a one-line proof.

30 / 201

Page 31: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

What are the solutions to x2 = y 3 in words?

- Over N, x2 = y3 iff x is a cube and y is a square

31 / 201

Page 32: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

What are the solutions to x2 = y 3 in words?

- Over N, x2 = y3 iff x is a cube and y is a square

- Suggests what solutions of x i = y j will look like over words

32 / 201

Page 33: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

What are the solutions to x2 = y 3 in words?

- Over N, x2 = y3 iff x is a cube and y is a square

- Suggests what solutions of x i = y j will look like over words

33 / 201

Page 34: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

First Theorem of Lyndon-Schutzenberger

Theorem

Let x , y ∈ Σ+. Then the following three conditions are equivalent:

34 / 201

Page 35: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

First Theorem of Lyndon-Schutzenberger

Theorem

Let x , y ∈ Σ+. Then the following three conditions are equivalent:(1) xy = yx;

35 / 201

Page 36: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

First Theorem of Lyndon-Schutzenberger

Theorem

Let x , y ∈ Σ+. Then the following three conditions are equivalent:(1) xy = yx;(2) There exist z ∈ Σ+ and integers k, l > 0 such that x = zk andy = z l ;

36 / 201

Page 37: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

First Theorem of Lyndon-Schutzenberger

Theorem

Let x , y ∈ Σ+. Then the following three conditions are equivalent:(1) xy = yx;(2) There exist z ∈ Σ+ and integers k, l > 0 such that x = zk andy = z l ;(3) There exist integers i , j > 0 such that x i = y j .

37 / 201

Page 38: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Second Theorem of Lyndon-Schutzenberger

Under what conditions can a string have a nontrivial proper prefixand suffix that are identical?

38 / 201

Page 39: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Second Theorem of Lyndon-Schutzenberger

Under what conditions can a string have a nontrivial proper prefixand suffix that are identical?

Examples in English: reader — begins and ends with r

39 / 201

Page 40: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Second Theorem of Lyndon-Schutzenberger

Under what conditions can a string have a nontrivial proper prefixand suffix that are identical?

Examples in English: reader — begins and ends with r

alfalfa — which begins and ends with alfa

40 / 201

Page 41: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Second Theorem of Lyndon-Schutzenberger

Under what conditions can a string have a nontrivial proper prefixand suffix that are identical?

Examples in English: reader — begins and ends with r

alfalfa — which begins and ends with alfa

The answer is given by the following theorem.

41 / 201

Page 42: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Second Theorem of Lyndon-Schutzenberger

Under what conditions can a string have a nontrivial proper prefixand suffix that are identical?

Examples in English: reader — begins and ends with r

alfalfa — which begins and ends with alfa

The answer is given by the following theorem.

Theorem

Let x , y , z ∈ Σ+. Then xy = yz if and only if there exist u ∈ Σ+,v ∈ Σ∗, and an integer e ≥ 0 such that x = uv, z = vu, andy = (uv)eu = u(vu)e .

42 / 201

Page 43: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Primitive words

We say a word x is a power if it can be expressed as x = y n forsome y 6= ε, n ≥ 2.

43 / 201

Page 44: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Primitive words

We say a word x is a power if it can be expressed as x = y n forsome y 6= ε, n ≥ 2.

A nonpower is called primitive.

44 / 201

Page 45: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Primitive words

We say a word x is a power if it can be expressed as x = y n forsome y 6= ε, n ≥ 2.

A nonpower is called primitive.

Every nonempty word can be written uniquely in the form xk

where x is primitive and k ≥ 1.

45 / 201

Page 46: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Primitive words

We say a word x is a power if it can be expressed as x = y n forsome y 6= ε, n ≥ 2.

A nonpower is called primitive.

Every nonempty word can be written uniquely in the form xk

where x is primitive and k ≥ 1.

Enumeration: there are exactly

d | n

µ(d)kn/d

46 / 201

Page 47: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Primitive words

We say a word x is a power if it can be expressed as x = y n forsome y 6= ε, n ≥ 2.

A nonpower is called primitive.

Every nonempty word can be written uniquely in the form xk

where x is primitive and k ≥ 1.

Enumeration: there are exactly

d | n

µ(d)kn/d

primitive words of length n over a k-letter alphabet. Here µ is theMobius function and the sum is over the divisors of n.

47 / 201

Page 48: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Primitive words

We say a word x is a power if it can be expressed as x = y n forsome y 6= ε, n ≥ 2.

A nonpower is called primitive.

Every nonempty word can be written uniquely in the form xk

where x is primitive and k ≥ 1.

Enumeration: there are exactly

d | n

µ(d)kn/d

primitive words of length n over a k-letter alphabet. Here µ is theMobius function and the sum is over the divisors of n.

Open question: is the set of primitive binary words a CFL?

48 / 201

Page 49: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Conjugates

A word w is a conjugate of a word x if w can be obtained from xby cyclically shifting the letters.

49 / 201

Page 50: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Conjugates

A word w is a conjugate of a word x if w can be obtained from xby cyclically shifting the letters.

For example, the English word enlist is a conjugate of listen.

50 / 201

Page 51: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Conjugates

A word w is a conjugate of a word x if w can be obtained from xby cyclically shifting the letters.

For example, the English word enlist is a conjugate of listen.

A conjugate of a k-th power is a k-th power of a conjugate.

51 / 201

Page 52: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Conjugates

A word w is a conjugate of a word x if w can be obtained from xby cyclically shifting the letters.

For example, the English word enlist is a conjugate of listen.

A conjugate of a k-th power is a k-th power of a conjugate.

Every primitive word has an unbordered conjugate.

52 / 201

Page 53: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Conjugates

A word w is a conjugate of a word x if w can be obtained from xby cyclically shifting the letters.

For example, the English word enlist is a conjugate of listen.

A conjugate of a k-th power is a k-th power of a conjugate.

Every primitive word has an unbordered conjugate.

Lyndon word: lexicographically least among all its conjugates

53 / 201

Page 54: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Conjugates

A word w is a conjugate of a word x if w can be obtained from xby cyclically shifting the letters.

For example, the English word enlist is a conjugate of listen.

A conjugate of a k-th power is a k-th power of a conjugate.

Every primitive word has an unbordered conjugate.

Lyndon word: lexicographically least among all its conjugates

Theorem: Every finite word has a unique factorization as theproduct of Lyndon words w1w2 · · ·wn, where w1 ≥ w2 ≥ w3 · · ·wn.

54 / 201

Page 55: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Fractional powers

We say a word w is a p/q power, for integers p ≥ q ≥ 1, if

w = xbp/qcx ′

for a prefix x ′ of x such that |w |/|x | = p/q.

55 / 201

Page 56: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Fractional powers

We say a word w is a p/q power, for integers p ≥ q ≥ 1, if

w = xbp/qcx ′

for a prefix x ′ of x such that |w |/|x | = p/q.

For example, the French word entente is a 7/3-power, as it canbe written as (ent)2e.

56 / 201

Page 57: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Fractional powers

We say a word w is a p/q power, for integers p ≥ q ≥ 1, if

w = xbp/qcx ′

for a prefix x ′ of x such that |w |/|x | = p/q.

For example, the French word entente is a 7/3-power, as it canbe written as (ent)2e.

The German word schematische is a 3/2 power.

57 / 201

Page 58: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Fractional powers

We say a word w is a p/q power, for integers p ≥ q ≥ 1, if

w = xbp/qcx ′

for a prefix x ′ of x such that |w |/|x | = p/q.

For example, the French word entente is a 7/3-power, as it canbe written as (ent)2e.

The German word schematische is a 3/2 power.

If w = xbp/qcx ′ is a p/q power, then we call x a period of w .Often the word period is used to refer to |x |.

58 / 201

Page 59: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Fractional powers

We say a word w is a p/q power, for integers p ≥ q ≥ 1, if

w = xbp/qcx ′

for a prefix x ′ of x such that |w |/|x | = p/q.

For example, the French word entente is a 7/3-power, as it canbe written as (ent)2e.

The German word schematische is a 3/2 power.

If w = xbp/qcx ′ is a p/q power, then we call x a period of w .Often the word period is used to refer to |x |.

If a word w is a p/q > 1 power, then it begins and ends with somenonempty string. Such a string is also called bordered. Otherwiseit is unbordered.

59 / 201

Page 60: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Unbordered words

The unbordered words play the same role for fractional powers asthe primitive words do for ordinary powers.

60 / 201

Page 61: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Unbordered words

The unbordered words play the same role for fractional powers asthe primitive words do for ordinary powers.

Enumeration of unbordered words is more challenging and there isno simple closed form.

61 / 201

Page 62: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Unbordered words

The unbordered words play the same role for fractional powers asthe primitive words do for ordinary powers.

Enumeration of unbordered words is more challenging and there isno simple closed form.

However, there are asymptotically ckkn such words, where ck is a

constant that tends to 1 as k tends to ∞.

62 / 201

Page 63: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Duval’s conjecture

Let µ(w) be the length of the longest unbordered factor of w .

63 / 201

Page 64: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Duval’s conjecture

Let µ(w) be the length of the longest unbordered factor of w .

Let p(w) be the length of the longest period of w .

64 / 201

Page 65: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Duval’s conjecture

Let µ(w) be the length of the longest unbordered factor of w .

Let p(w) be the length of the longest period of w .

Duval conjectured that if |w | ≥ 3µ(w), then µ(w) = p(w).

65 / 201

Page 66: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Duval’s conjecture

Let µ(w) be the length of the longest unbordered factor of w .

Let p(w) be the length of the longest period of w .

Duval conjectured that if |w | ≥ 3µ(w), then µ(w) = p(w).

This was proved by Harju & Nowotka, and S. Holub. The resulthas been improved to |w | ≥ 3µ(w)− 2 =⇒ µ(w) = p(w).

66 / 201

Page 67: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

The Fine-Wilf theorem

Theorem

Let w and x be nonempty words. Let y ∈ w{w , x}ω andz ∈ x{w , x}ω. Then the following conditions are equivalent:

(a) y and z agree on a prefix of length at least|w |+ |x | − gcd(|w |, |x |);

67 / 201

Page 68: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

The Fine-Wilf theorem

Theorem

Let w and x be nonempty words. Let y ∈ w{w , x}ω andz ∈ x{w , x}ω. Then the following conditions are equivalent:

(a) y and z agree on a prefix of length at least|w |+ |x | − gcd(|w |, |x |);

(b) wx = xw;

68 / 201

Page 69: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

The Fine-Wilf theorem

Theorem

Let w and x be nonempty words. Let y ∈ w{w , x}ω andz ∈ x{w , x}ω. Then the following conditions are equivalent:

(a) y and z agree on a prefix of length at least|w |+ |x | − gcd(|w |, |x |);

(b) wx = xw;

(c) y = z.

(c) =⇒ (a): Trivial.

69 / 201

Page 70: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

The Fine-Wilf theorem

Theorem

Let w and x be nonempty words. Let y ∈ w{w , x}ω andz ∈ x{w , x}ω. Then the following conditions are equivalent:

(a) y and z agree on a prefix of length at least|w |+ |x | − gcd(|w |, |x |);

(b) wx = xw;

(c) y = z.

(c) =⇒ (a): Trivial.We’ll prove (a) =⇒ (b) and (b) =⇒ (c).

70 / 201

Page 71: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Fine-Wilf: The proof

Proof.(a) y and z agree on a prefix of length at least|w |+ |x | − gcd(|w |, |x |) =⇒ (b) wx = xw

71 / 201

Page 72: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Fine-Wilf: The proof

Proof.(a) y and z agree on a prefix of length at least|w |+ |x | − gcd(|w |, |x |) =⇒ (b) wx = xw

We prove the contrapositive. Suppose wx 6= xw .

72 / 201

Page 73: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Fine-Wilf: The proof

Proof.(a) y and z agree on a prefix of length at least|w |+ |x | − gcd(|w |, |x |) =⇒ (b) wx = xw

We prove the contrapositive. Suppose wx 6= xw .

Then we prove that y and z differ at a position≤ |w |+ |x | − gcd(|w |, |x |).

73 / 201

Page 74: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Fine-Wilf: The proof

Proof.(a) y and z agree on a prefix of length at least|w |+ |x | − gcd(|w |, |x |) =⇒ (b) wx = xw

We prove the contrapositive. Suppose wx 6= xw .

Then we prove that y and z differ at a position≤ |w |+ |x | − gcd(|w |, |x |).

The proof is by induction on |w |+ |x |.

74 / 201

Page 75: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Fine-Wilf: The proof

Proof.(a) y and z agree on a prefix of length at least|w |+ |x | − gcd(|w |, |x |) =⇒ (b) wx = xw

We prove the contrapositive. Suppose wx 6= xw .

Then we prove that y and z differ at a position≤ |w |+ |x | − gcd(|w |, |x |).

The proof is by induction on |w |+ |x |.

The base case is |w |+ |x | = 2. Then |w | = |x | = 1, and|w |+ |x | − gcd(|w |, |x |) = 1. Since wx 6= xw , we must havew = a, x = b with a 6= b. Then y and z differ at the first position.

75 / 201

Page 76: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Now assume the result is true for |w |+ |x | < k.

76 / 201

Page 77: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Now assume the result is true for |w |+ |x | < k.

We prove it for |w |+ |x | = k.

77 / 201

Page 78: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Now assume the result is true for |w |+ |x | < k.

We prove it for |w |+ |x | = k.

If |w | = |x | then y and z must disagree at the |w |’th position orearlier, for otherwise w = x and wx = xw ; since|w | ≤ |w |+ |x | − gcd(|w |, |x |) = |w |, the result follows.

78 / 201

Page 79: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Now assume the result is true for |w |+ |x | < k.

We prove it for |w |+ |x | = k.

If |w | = |x | then y and z must disagree at the |w |’th position orearlier, for otherwise w = x and wx = xw ; since|w | ≤ |w |+ |x | − gcd(|w |, |x |) = |w |, the result follows.

So, without loss of generality, assume |w | < |x |.

79 / 201

Page 80: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Now assume the result is true for |w |+ |x | < k.

We prove it for |w |+ |x | = k.

If |w | = |x | then y and z must disagree at the |w |’th position orearlier, for otherwise w = x and wx = xw ; since|w | ≤ |w |+ |x | − gcd(|w |, |x |) = |w |, the result follows.

So, without loss of generality, assume |w | < |x |.

If w is not a prefix of x , then y and z disagree on the |w |’thposition or earlier, and again |w | ≤ |w |+ |x | − gcd(|w |, |x |).

80 / 201

Page 81: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Now assume the result is true for |w |+ |x | < k.

We prove it for |w |+ |x | = k.

If |w | = |x | then y and z must disagree at the |w |’th position orearlier, for otherwise w = x and wx = xw ; since|w | ≤ |w |+ |x | − gcd(|w |, |x |) = |w |, the result follows.

So, without loss of generality, assume |w | < |x |.

If w is not a prefix of x , then y and z disagree on the |w |’thposition or earlier, and again |w | ≤ |w |+ |x | − gcd(|w |, |x |).

So w is a proper prefix of x .

81 / 201

Page 82: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Now assume the result is true for |w |+ |x | < k.

We prove it for |w |+ |x | = k.

If |w | = |x | then y and z must disagree at the |w |’th position orearlier, for otherwise w = x and wx = xw ; since|w | ≤ |w |+ |x | − gcd(|w |, |x |) = |w |, the result follows.

So, without loss of generality, assume |w | < |x |.

If w is not a prefix of x , then y and z disagree on the |w |’thposition or earlier, and again |w | ≤ |w |+ |x | − gcd(|w |, |x |).

So w is a proper prefix of x .

Write x = wt for some nonempty word t.

Now any common divisor of |w | and |x | must also divide|x | − |w | = |t|, and similarly any common divisor of both |w | and|t| must also divide |w |+ |t| = |x |. So gcd(|w |, |x |) = gcd(|w |, |t|).

82 / 201

Page 83: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Now wt 6= tw , for otherwise we have wx = wwt = wtw = xw , acontradiction.

83 / 201

Page 84: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Now wt 6= tw , for otherwise we have wx = wwt = wtw = xw , acontradiction.

Then y = ww · · · and z = wt · · · . By induction (since|w |+ |t| < k) w−1y and w−1z disagree at position|w |+ |t| − gcd(|w |, |t|) or earlier.

84 / 201

Page 85: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Now wt 6= tw , for otherwise we have wx = wwt = wtw = xw , acontradiction.

Then y = ww · · · and z = wt · · · . By induction (since|w |+ |t| < k) w−1y and w−1z disagree at position|w |+ |t| − gcd(|w |, |t|) or earlier.

Hence y and z disagree at position2|w |+ |t| − gcd(|w |, |t|) = |w |+ |x | − gcd(|w |, |x |) or earlier.

85 / 201

Page 86: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

(b) =⇒ (c): If wx = xw , then by the theorem ofLyndon-Schutzenberger, both w and x are in u+ for some word u.Hence y = uω = z.

86 / 201

Page 87: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Finite Sturmian words

The proof also implies a way to get words that optimally “almostcommute”, in the sense that xw and wx should agree on as long asegment as possible.

87 / 201

Page 88: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Finite Sturmian words

The proof also implies a way to get words that optimally “almostcommute”, in the sense that xw and wx should agree on as long asegment as possible.

Theorem

For each m, n ≥ 1 there exist words x, w of length m, n,respectively, such that xw and wx agree on a prefix of lengthm + n − gcd(m, n)− 1 but differ at position m + n − gcd(m, n).

88 / 201

Page 89: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Finite Sturmian words

The proof also implies a way to get words that optimally “almostcommute”, in the sense that xw and wx should agree on as long asegment as possible.

Theorem

For each m, n ≥ 1 there exist words x, w of length m, n,respectively, such that xw and wx agree on a prefix of lengthm + n − gcd(m, n)− 1 but differ at position m + n − gcd(m, n).

These are the finite Sturmian words.

89 / 201

Page 90: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Finite Sturmian words

The proof also implies a way to get words that optimally “almostcommute”, in the sense that xw and wx should agree on as long asegment as possible.

Theorem

For each m, n ≥ 1 there exist words x, w of length m, n,respectively, such that xw and wx agree on a prefix of lengthm + n − gcd(m, n)− 1 but differ at position m + n − gcd(m, n).

These are the finite Sturmian words.

Many authors have worked on generalizations to multiple periods:Castelli, Mignosi, & Restivo, Simpson & Tijdeman, Constantinescu& Ilie, ...

90 / 201

Page 91: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Patterns and pattern avoidance

The story begins with Axel Thue in 1906.

91 / 201

Page 92: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Patterns and pattern avoidance

The story begins with Axel Thue in 1906.

He noticed that over a 2-letter alphabet, every word of length ≥ 4contains a square: either 02, 12, (01)2 or (10)2.

92 / 201

Page 93: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Patterns and pattern avoidance

The story begins with Axel Thue in 1906.

He noticed that over a 2-letter alphabet, every word of length ≥ 4contains a square: either 02, 12, (01)2 or (10)2.

But over a 3-letter alphabet, it is possible to create arbitrarily longwords (or — what is equivalent — an infinite word) with no squarefactors at all. Such a word is called squarefree.

93 / 201

Page 94: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Patterns and pattern avoidance

The story begins with Axel Thue in 1906.

He noticed that over a 2-letter alphabet, every word of length ≥ 4contains a square: either 02, 12, (01)2 or (10)2.

But over a 3-letter alphabet, it is possible to create arbitrarily longwords (or — what is equivalent — an infinite word) with no squarefactors at all. Such a word is called squarefree.

The easiest way to construct such a sequence was found by Thuein 1912 (and rediscovered many times).

94 / 201

Page 95: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Patterns and pattern avoidance

The story begins with Axel Thue in 1906.

He noticed that over a 2-letter alphabet, every word of length ≥ 4contains a square: either 02, 12, (01)2 or (10)2.

But over a 3-letter alphabet, it is possible to create arbitrarily longwords (or — what is equivalent — an infinite word) with no squarefactors at all. Such a word is called squarefree.

The easiest way to construct such a sequence was found by Thuein 1912 (and rediscovered many times).

It is based on the Thue-Morse sequence.

95 / 201

Page 96: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

The Thue-Morse morphism

Morphism: a map h from Σ∗ to ∆∗ such that

h(xy) = h(x)h(y).

96 / 201

Page 97: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

The Thue-Morse morphism

Morphism: a map h from Σ∗ to ∆∗ such that

h(xy) = h(x)h(y).

Thue-Morse morphism: µ(0) = 01; µ(1) = 10.

97 / 201

Page 98: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

The Thue-Morse morphism

Morphism: a map h from Σ∗ to ∆∗ such that

h(xy) = h(x)h(y).

Thue-Morse morphism: µ(0) = 01; µ(1) = 10.

If Σ = ∆ then we can iterate h.

98 / 201

Page 99: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

The Thue-Morse morphism

Morphism: a map h from Σ∗ to ∆∗ such that

h(xy) = h(x)h(y).

Thue-Morse morphism: µ(0) = 01; µ(1) = 10.

If Σ = ∆ then we can iterate h.

We write hi =

i︷ ︸︸ ︷

h(h(h(· · · ))).

99 / 201

Page 100: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Morphic words

If a nonerasing morphism has the property that h(a) = ax , theniterating h produces an infinite word

hω(a) = a x h(x) h2(x) h3(x) · · · .

100 / 201

Page 101: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Morphic words

If a nonerasing morphism has the property that h(a) = ax , theniterating h produces an infinite word

hω(a) = a x h(x) h2(x) h3(x) · · · .

If we do this with µ we get the Thue-Morse word:

101 / 201

Page 102: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Morphic words

If a nonerasing morphism has the property that h(a) = ax , theniterating h produces an infinite word

hω(a) = a x h(x) h2(x) h3(x) · · · .

If we do this with µ we get the Thue-Morse word:

t = µω(0) = 0110100110010110 · · · .

102 / 201

Page 103: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Morphic words

If a nonerasing morphism has the property that h(a) = ax , theniterating h produces an infinite word

hω(a) = a x h(x) h2(x) h3(x) · · · .

If we do this with µ we get the Thue-Morse word:

t = µω(0) = 0110100110010110 · · · .

Also rediscovered by Marston Morse, Max Euwe, Solomon Arshon,and the Danish composer Per Nørgard.

103 / 201

Page 104: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Properties of the Thue-Morse word

An overlap is a word of the form axaxa, where a is a single letterand x is a word.

104 / 201

Page 105: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Properties of the Thue-Morse word

An overlap is a word of the form axaxa, where a is a single letterand x is a word.

An example in English is alfalfa (take x = lf).

105 / 201

Page 106: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Properties of the Thue-Morse word

An overlap is a word of the form axaxa, where a is a single letterand x is a word.

An example in English is alfalfa (take x = lf).

Thus an overlap is just slightly more than a square.

106 / 201

Page 107: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Properties of the Thue-Morse word

An overlap is a word of the form axaxa, where a is a single letterand x is a word.

An example in English is alfalfa (take x = lf).

Thus an overlap is just slightly more than a square.

It is also called a 2+ power.

107 / 201

Page 108: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Properties of the Thue-Morse word

An overlap is a word of the form axaxa, where a is a single letterand x is a word.

An example in English is alfalfa (take x = lf).

Thus an overlap is just slightly more than a square.

It is also called a 2+ power.

Theorem

The Thue-Morse word t is overlap-free.

108 / 201

Page 109: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

From overlap-free to squarefree

We can construct a squarefree word from t, as follows:

109 / 201

Page 110: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

From overlap-free to squarefree

We can construct a squarefree word from t, as follows:

Count the number of 1’s in t between consecutive 0’s:

110 / 201

Page 111: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

From overlap-free to squarefree

We can construct a squarefree word from t, as follows:

Count the number of 1’s in t between consecutive 0’s:

We get:

111 / 201

Page 112: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

From overlap-free to squarefree

We can construct a squarefree word from t, as follows:

Count the number of 1’s in t between consecutive 0’s:

We get:

0

2︷︸︸︷

11 0

1︷︸︸︷

1 0

0︷︸︸︷

0

2︷︸︸︷

11 0

0︷︸︸︷

0

1︷︸︸︷

1 0

2︷︸︸︷

11 0

1︷︸︸︷

1 0

0︷︸︸︷

0

1︷︸︸︷

1 0

2︷︸︸︷

11 · · ·

112 / 201

Page 113: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

From overlap-free to squarefree

We can construct a squarefree word from t, as follows:

Count the number of 1’s in t between consecutive 0’s:

We get:

0

2︷︸︸︷

11 0

1︷︸︸︷

1 0

0︷︸︸︷

0

2︷︸︸︷

11 0

0︷︸︸︷

0

1︷︸︸︷

1 0

2︷︸︸︷

11 0

1︷︸︸︷

1 0

0︷︸︸︷

0

1︷︸︸︷

1 0

2︷︸︸︷

11 · · ·

This is squarefree, as a square in this word implies and overlap inthe Thue-Morse word.

113 / 201

Page 114: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Enumeration of power-free words

How many squarefree words are there?

114 / 201

Page 115: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Enumeration of power-free words

How many squarefree words are there?

Infinite - countable or uncountable

115 / 201

Page 116: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Enumeration of power-free words

How many squarefree words are there?

Infinite - countable or uncountable

Finite - polynomially-many or exponentially-many of length n?

116 / 201

Page 117: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Enumeration of power-free words

How many squarefree words are there?

Infinite - countable or uncountable

Finite - polynomially-many or exponentially-many of length n?

Same question can be asked for the overlap-free words.

117 / 201

Page 118: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Enumeration of power-free words

How many squarefree words are there?

Infinite - countable or uncountable

Finite - polynomially-many or exponentially-many of length n?

Same question can be asked for the overlap-free words.

For overlap-free words over {0, 1} there is a factorization theoremof Restivo and Salemi that implies only polynomially-many oflength n.

118 / 201

Page 119: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Enumeration of power-free words

How many squarefree words are there?

Infinite - countable or uncountable

Finite - polynomially-many or exponentially-many of length n?

Same question can be asked for the overlap-free words.

For overlap-free words over {0, 1} there is a factorization theoremof Restivo and Salemi that implies only polynomially-many oflength n.

For squarefree words over {0, 1, 2} there are exponentially many.

119 / 201

Page 120: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Dejean’s Conjecture

Given an alphabet Σ of cardinality k, we can try to find the optimal(fractional) exponent αk avoidable by infinite words over Σ.

120 / 201

Page 121: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Dejean’s Conjecture

Given an alphabet Σ of cardinality k, we can try to find the optimal(fractional) exponent αk avoidable by infinite words over Σ.

For k = 2 we have already seen that overlaps are avoidable andsquares are not. So α2 = 2.

121 / 201

Page 122: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Dejean’s Conjecture

Given an alphabet Σ of cardinality k, we can try to find the optimal(fractional) exponent αk avoidable by infinite words over Σ.

For k = 2 we have already seen that overlaps are avoidable andsquares are not. So α2 = 2.

Dejean (1972) showed that α3 = 7/4 and conjectured thatα4 = 7/5 and αk = k/(k − 1) for k ≥ 5.

122 / 201

Page 123: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Dejean’s Conjecture

Given an alphabet Σ of cardinality k, we can try to find the optimal(fractional) exponent αk avoidable by infinite words over Σ.

For k = 2 we have already seen that overlaps are avoidable andsquares are not. So α2 = 2.

Dejean (1972) showed that α3 = 7/4 and conjectured thatα4 = 7/5 and αk = k/(k − 1) for k ≥ 5.

This conjecture has been proven by the combined efforts ofPansiot, Moulin-Ollagnier, Currie & Mohammad-Noori, Carpi,Currie & Rampersad, and Rao.

123 / 201

Page 124: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Dejean’s Conjecture

Given an alphabet Σ of cardinality k, we can try to find the optimal(fractional) exponent αk avoidable by infinite words over Σ.

For k = 2 we have already seen that overlaps are avoidable andsquares are not. So α2 = 2.

Dejean (1972) showed that α3 = 7/4 and conjectured thatα4 = 7/5 and αk = k/(k − 1) for k ≥ 5.

This conjecture has been proven by the combined efforts ofPansiot, Moulin-Ollagnier, Currie & Mohammad-Noori, Carpi,Currie & Rampersad, and Rao.

Still open: many other variants of Dejean where the length of theperiod is also taken into account.

124 / 201

Page 125: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

More general patterns

Instead of avoiding xx or axaxa, we can try to avoid more generalpatterns.

125 / 201

Page 126: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

More general patterns

Instead of avoiding xx or axaxa, we can try to avoid more generalpatterns.

“Avoiding the pattern α” means constructing an infinite word x

such that, for all non-erasing morphisms h, the word h(α) is not afactor of x.

126 / 201

Page 127: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

More general patterns

Instead of avoiding xx or axaxa, we can try to avoid more generalpatterns.

“Avoiding the pattern α” means constructing an infinite word x

such that, for all non-erasing morphisms h, the word h(α) is not afactor of x.

Not all patterns are avoidable — even if the alphabet is arbitrarilylarge.

127 / 201

Page 128: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

More general patterns

Instead of avoiding xx or axaxa, we can try to avoid more generalpatterns.

“Avoiding the pattern α” means constructing an infinite word x

such that, for all non-erasing morphisms h, the word h(α) is not afactor of x.

Not all patterns are avoidable — even if the alphabet is arbitrarilylarge.

For example - it is impossible to avoid xyx , since every sufficientlylong string z will contain three occurrences of some letter a, sayz = rasatau, and then we can let x = a, y = sat, both x and y arenonempty.

128 / 201

Page 129: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Avoiding general patterns

Given a pattern, it is decidable (via Zimin’s algorithm) if it isavoidable over some alphabet.

129 / 201

Page 130: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Avoiding general patterns

Given a pattern, it is decidable (via Zimin’s algorithm) if it isavoidable over some alphabet.

However, we do not have a general procedure to decide if a givenpattern is avoidable over a fixed alphabet.

130 / 201

Page 131: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Abelian powers

Instead of avoiding xx , we can consider trying to avoid other kindsof patterns: the so-called abelian powers.

131 / 201

Page 132: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Abelian powers

Instead of avoiding xx , we can consider trying to avoid other kindsof patterns: the so-called abelian powers.

An abelian square is a nonempty word of the form xx ′, where x ′ isa permutation of x .

132 / 201

Page 133: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Abelian powers

Instead of avoiding xx , we can consider trying to avoid other kindsof patterns: the so-called abelian powers.

An abelian square is a nonempty word of the form xx ′, where x ′ isa permutation of x .

For example, interessierten is an abelian square in German, assierten is a permutation of interes.

133 / 201

Page 134: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Abelian powers

Instead of avoiding xx , we can consider trying to avoid other kindsof patterns: the so-called abelian powers.

An abelian square is a nonempty word of the form xx ′, where x ′ isa permutation of x .

For example, interessierten is an abelian square in German, assierten is a permutation of interes.

In a similar way, we can define abelian cubes as words of the formxx ′x ′′ where both x ′ and x ′′ are permutations of x .

134 / 201

Page 135: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Abelian powers: summary of results

it is possible to avoid abelian squares over a 4-letter alphabet, andthis is optimal;

135 / 201

Page 136: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Abelian powers: summary of results

it is possible to avoid abelian squares over a 4-letter alphabet, andthis is optimal;

it is possible to avoid abelian cubes over a 3-letter alphabet, andthis is optimal;

136 / 201

Page 137: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Abelian powers: summary of results

it is possible to avoid abelian squares over a 4-letter alphabet, andthis is optimal;

it is possible to avoid abelian cubes over a 3-letter alphabet, andthis is optimal;

it is possible to avoid abelian fourth powers over a 2-letteralphabet, and this is optimal.

137 / 201

Page 138: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Abelian powers: summary of results

it is possible to avoid abelian squares over a 4-letter alphabet, andthis is optimal;

it is possible to avoid abelian cubes over a 3-letter alphabet, andthis is optimal;

it is possible to avoid abelian fourth powers over a 2-letteralphabet, and this is optimal.

An open problem: is it possible to avoid, over a finite subset of N,patterns of the form xx ′ where |x | = |x ′| and

∑x =

∑x ′?

138 / 201

Page 139: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Abelian powers: summary of results

it is possible to avoid abelian squares over a 4-letter alphabet, andthis is optimal;

it is possible to avoid abelian cubes over a 3-letter alphabet, andthis is optimal;

it is possible to avoid abelian fourth powers over a 2-letteralphabet, and this is optimal.

An open problem: is it possible to avoid, over a finite subset of N,patterns of the form xx ′ where |x | = |x ′| and

∑x =

∑x ′?

Also still open: fractional version of abelian powers

139 / 201

Page 140: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

A generalization of abelian powers

involution: h2(x) = x for all words x

140 / 201

Page 141: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

A generalization of abelian powers

involution: h2(x) = x for all words x

involutions can be morphic (h(xy) = h(x)h(y)) or antimorphic(h(xy) = h(y)h(x))

141 / 201

Page 142: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

A generalization of abelian powers

involution: h2(x) = x for all words x

involutions can be morphic (h(xy) = h(x)h(y)) or antimorphic(h(xy) = h(y)h(x))

One antimorphism of biological interest: reverse string and applymap A↔ T , G ↔ C .

142 / 201

Page 143: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

A generalization of abelian powers

involution: h2(x) = x for all words x

involutions can be morphic (h(xy) = h(x)h(y)) or antimorphic(h(xy) = h(y)h(x))

One antimorphism of biological interest: reverse string and applymap A↔ T , G ↔ C .

Can avoid some patterns involving involution, but not others

143 / 201

Page 144: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Equations in words

Example 1:

abX = Xba.

144 / 201

Page 145: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Equations in words

Example 1:

abX = Xba.

The only solutions are X ∈ (ab)∗a.

145 / 201

Page 146: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Equations in words

Example 1:

abX = Xba.

The only solutions are X ∈ (ab)∗a.

Example 2:

XaXbY = aXYbX

146 / 201

Page 147: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Equations in words

Example 1:

abX = Xba.

The only solutions are X ∈ (ab)∗a.

Example 2:

XaXbY = aXYbX

The solutions are X = ai , Y = (aib)jai for i ≥ 0, j ≥ 0.

147 / 201

Page 148: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Equations in words

Example 3: Fermat’s equation for words: x iy j = zk

148 / 201

Page 149: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Equations in words

Example 3: Fermat’s equation for words: x iy j = zk

The only solutions for i , j , k ≥ 2 are when x , y , z are all powers ofa third word.

149 / 201

Page 150: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Equations in words

Example 3: Fermat’s equation for words: x iy j = zk

The only solutions for i , j , k ≥ 2 are when x , y , z are all powers ofa third word.

Example 4:

XYZ = ZVX : many solutions, but not expressible by formula withinteger parameters.

150 / 201

Page 151: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Equations in words

More generally, given an equation in words and constants, there isan algorithm (Makanin’s algorithm) that is guaranteed to find asolution if one exists.

151 / 201

Page 152: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Equations in words

More generally, given an equation in words and constants, there isan algorithm (Makanin’s algorithm) that is guaranteed to find asolution if one exists.

Satisfiability in PSPACE: Plandowski (2004)

152 / 201

Page 153: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Equations in words

More generally, given an equation in words and constants, there isan algorithm (Makanin’s algorithm) that is guaranteed to find asolution if one exists.

Satisfiability in PSPACE: Plandowski (2004)

Finiteness of solutions: Plandowski (2006) but complete proofs notyet published.

153 / 201

Page 154: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Kinds of infinite words

pure morphic: obtained by iterating a morphism

154 / 201

Page 155: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Kinds of infinite words

pure morphic: obtained by iterating a morphism

Examples:

155 / 201

Page 156: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Kinds of infinite words

pure morphic: obtained by iterating a morphism

Examples:

the Thue-Morse word, obtained by iterating 0→ 01, 1→ 10

156 / 201

Page 157: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Kinds of infinite words

pure morphic: obtained by iterating a morphism

Examples:

the Thue-Morse word, obtained by iterating 0→ 01, 1→ 10

the Fibonacci word, obtained by iterating 0→ 01, 1→ 0

157 / 201

Page 158: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Kinds of infinite words

pure morphic: obtained by iterating a morphism

Examples:

the Thue-Morse word, obtained by iterating 0→ 01, 1→ 10

the Fibonacci word, obtained by iterating 0→ 01, 1→ 0

morphic: obtained by iterating a morphism, then applying a coding(letter-to-letter morphism)

158 / 201

Page 159: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Kinds of infinite words

pure morphic: obtained by iterating a morphism

Examples:

the Thue-Morse word, obtained by iterating 0→ 01, 1→ 10

the Fibonacci word, obtained by iterating 0→ 01, 1→ 0

morphic: obtained by iterating a morphism, then applying a coding(letter-to-letter morphism)

fixed point of uniform morphism: like the Thue-Morse word

159 / 201

Page 160: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Kinds of infinite words

pure morphic: obtained by iterating a morphism

Examples:

the Thue-Morse word, obtained by iterating 0→ 01, 1→ 10

the Fibonacci word, obtained by iterating 0→ 01, 1→ 0

morphic: obtained by iterating a morphism, then applying a coding(letter-to-letter morphism)

fixed point of uniform morphism: like the Thue-Morse word

automatic: image, under a coding, of a fixed point of a uniformmorphism

160 / 201

Page 161: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Other important infinite words

Sturmian words: exactly n + 1 factors of length n

161 / 201

Page 162: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Other important infinite words

Sturmian words: exactly n + 1 factors of length nMany other characterizations:

162 / 201

Page 163: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Other important infinite words

Sturmian words: exactly n + 1 factors of length nMany other characterizations:

balanced: any two words w , x of length n have δ(x , y) = 1,where δ(x , y) = ||x |1 − |y |1|

163 / 201

Page 164: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Other important infinite words

Sturmian words: exactly n + 1 factors of length nMany other characterizations:

balanced: any two words w , x of length n have δ(x , y) = 1,where δ(x , y) = ||x |1 − |y |1|

of the form (bα(n + 1) + γc − bαn + γc)n≥1 for real α, γ

164 / 201

Page 165: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Other important infinite words

Sturmian words: exactly n + 1 factors of length nMany other characterizations:

balanced: any two words w , x of length n have δ(x , y) = 1,where δ(x , y) = ||x |1 − |y |1|

of the form (bα(n + 1) + γc − bαn + γc)n≥1 for real α, γ

Episturmian words: natural generalization of Sturmian words tolarger alphabets

165 / 201

Page 166: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

More infinite words

Toeplitz words: generated by starting with a periodic word with“holes”; then inserting another periodic word with holes into that,etc.

166 / 201

Page 167: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

More infinite words

Toeplitz words: generated by starting with a periodic word with“holes”; then inserting another periodic word with holes into that,etc.

Paperfolding words: generated by iterated folding of a piece ofpaper

167 / 201

Page 168: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

More infinite words

Toeplitz words: generated by starting with a periodic word with“holes”; then inserting another periodic word with holes into that,etc.

Paperfolding words: generated by iterated folding of a piece ofpaper

Xn+1 = XnaXnR

168 / 201

Page 169: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

More infinite words

Toeplitz words: generated by starting with a periodic word with“holes”; then inserting another periodic word with holes into that,etc.

Paperfolding words: generated by iterated folding of a piece ofpaper

Xn+1 = XnaXnR

Kolakoski’s word: generated by applying a transducer iteratively

169 / 201

Page 170: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

More infinite words

Toeplitz words: generated by starting with a periodic word with“holes”; then inserting another periodic word with holes into that,etc.

Paperfolding words: generated by iterated folding of a piece ofpaper

Xn+1 = XnaXnR

Kolakoski’s word: generated by applying a transducer iteratively

The sequence 1221121221 · · · that encodes its own sequenceof run lengths

170 / 201

Page 171: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Properties of infinite words

recurrence - every factor that occurs, occurs infinitely often

171 / 201

Page 172: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Properties of infinite words

recurrence - every factor that occurs, occurs infinitely often

uniform recurrence - recurrent, plus distance between twoconsecutive occurrences of the same factor of length n is bounded,for all n

172 / 201

Page 173: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Subword complexity

“subword” complexity - given an infinite word w, count thenumber of distinct factors of length n in w

173 / 201

Page 174: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Subword complexity

“subword” complexity - given an infinite word w, count thenumber of distinct factors of length n in w

O(n) for automatic sequences

174 / 201

Page 175: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Subword complexity

“subword” complexity - given an infinite word w, count thenumber of distinct factors of length n in w

O(n) for automatic sequences

n + 1 for Sturmian words

175 / 201

Page 176: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Subword complexity

“subword” complexity - given an infinite word w, count thenumber of distinct factors of length n in w

O(n) for automatic sequences

n + 1 for Sturmian words

O(n2) for morphic words

176 / 201

Page 177: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Subword complexity

“subword” complexity - given an infinite word w, count thenumber of distinct factors of length n in w

O(n) for automatic sequences

n + 1 for Sturmian words

O(n2) for morphic words

A classification of possible growth rates exists

177 / 201

Page 178: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Automatic sequences

A deterministic finite automaton with output (DFAO) is a6-tuple: (Q,Σ, δ, q0,∆, τ), where ∆ is the finite outputalphabet and τ : Q → ∆ is the output mapping.

178 / 201

Page 179: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Automatic sequences

A deterministic finite automaton with output (DFAO) is a6-tuple: (Q,Σ, δ, q0,∆, τ), where ∆ is the finite outputalphabet and τ : Q → ∆ is the output mapping.Next, we decide on a integer base k ≥ 2 and represent n as astring of symbols over the alphabet Σ = {0, 1, 2, . . . , k − 1}.

179 / 201

Page 180: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Automatic sequences

A deterministic finite automaton with output (DFAO) is a6-tuple: (Q,Σ, δ, q0,∆, τ), where ∆ is the finite outputalphabet and τ : Q → ∆ is the output mapping.Next, we decide on a integer base k ≥ 2 and represent n as astring of symbols over the alphabet Σ = {0, 1, 2, . . . , k − 1}.To compute fn, given an automaton M, express n in base-k,say,

arar−1 · · · a1a0,

and compute

fn = τ(δ(q0, arar−1 · · · a1a0)).

180 / 201

Page 181: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Automatic sequences

A deterministic finite automaton with output (DFAO) is a6-tuple: (Q,Σ, δ, q0,∆, τ), where ∆ is the finite outputalphabet and τ : Q → ∆ is the output mapping.Next, we decide on a integer base k ≥ 2 and represent n as astring of symbols over the alphabet Σ = {0, 1, 2, . . . , k − 1}.To compute fn, given an automaton M, express n in base-k,say,

arar−1 · · · a1a0,

and compute

fn = τ(δ(q0, arar−1 · · · a1a0)).

Any sequence that can be computed in this way is said to bek-automatic.

181 / 201

Page 182: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

The Thue-Morse automaton

The word t is computed by the following DFAO:

182 / 201

Page 183: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

The Thue-Morse automaton

The word t is computed by the following DFAO:

0 01

1

0 1

183 / 201

Page 184: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Robustness

the order in which the base-k digits are fed into theautomaton in does not matter (provided it is fixed for all n);

184 / 201

Page 185: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Robustness

the order in which the base-k digits are fed into theautomaton in does not matter (provided it is fixed for all n);

other representations also work (such as expansion inbase-(−k));

185 / 201

Page 186: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Robustness

the order in which the base-k digits are fed into theautomaton in does not matter (provided it is fixed for all n);

other representations also work (such as expansion inbase-(−k));

automatic sequences are closed under many operations, suchas shift, periodic deletion, q-block compression, and q-blocksubstitution.

186 / 201

Page 187: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Robustness

the order in which the base-k digits are fed into theautomaton in does not matter (provided it is fixed for all n);

other representations also work (such as expansion inbase-(−k));

automatic sequences are closed under many operations, suchas shift, periodic deletion, q-block compression, and q-blocksubstitution.

if a symbol in an automatic sequence occurs with well-definedfrequency r , then r is rational.

187 / 201

Page 188: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Christol’s theorem

Theorem

(Christol [1980]). Let (un)n≥0 be a sequence over

Σ = {0, 1, . . . , p − 1},

where p is a prime. Then the formal power seriesU(X ) =

n≥0 unXn is algebraic over GF (p)[X ] if and only if

(un)n≥0 is p-automatic.

188 / 201

Page 189: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Christol’s theorem: example

Let (tn)n≥0 denote the Thue-Morse sequence.

189 / 201

Page 190: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Christol’s theorem: example

Let (tn)n≥0 denote the Thue-Morse sequence.Then tn = sum of the bits in the binary expansion of n, mod 2.

190 / 201

Page 191: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Christol’s theorem: example

Let (tn)n≥0 denote the Thue-Morse sequence.Then tn = sum of the bits in the binary expansion of n, mod 2.Also t2n ≡ tn and t2n+1 ≡ tn + 1. If we set A(X ) =

n≥0 tnXn,

then

191 / 201

Page 192: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Christol’s theorem: example

Let (tn)n≥0 denote the Thue-Morse sequence.Then tn = sum of the bits in the binary expansion of n, mod 2.Also t2n ≡ tn and t2n+1 ≡ tn + 1. If we set A(X ) =

n≥0 tnXn,

then

A(X ) =∑

n≥0

t2nX2n +

n≥0

t2n+1X2n+1

192 / 201

Page 193: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Christol’s theorem: example

Let (tn)n≥0 denote the Thue-Morse sequence.Then tn = sum of the bits in the binary expansion of n, mod 2.Also t2n ≡ tn and t2n+1 ≡ tn + 1. If we set A(X ) =

n≥0 tnXn,

then

A(X ) =∑

n≥0

t2nX2n +

n≥0

t2n+1X2n+1

=∑

n≥0

tnX2n + X

n≥0

tnX2n + X

n≥0

X 2n

193 / 201

Page 194: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Christol’s theorem: example

Let (tn)n≥0 denote the Thue-Morse sequence.Then tn = sum of the bits in the binary expansion of n, mod 2.Also t2n ≡ tn and t2n+1 ≡ tn + 1. If we set A(X ) =

n≥0 tnXn,

then

A(X ) =∑

n≥0

t2nX2n +

n≥0

t2n+1X2n+1

=∑

n≥0

tnX2n + X

n≥0

tnX2n + X

n≥0

X 2n

= A(X 2) + XA(X 2) + X/(1− X 2)

194 / 201

Page 195: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Christol’s theorem: example

Let (tn)n≥0 denote the Thue-Morse sequence.Then tn = sum of the bits in the binary expansion of n, mod 2.Also t2n ≡ tn and t2n+1 ≡ tn + 1. If we set A(X ) =

n≥0 tnXn,

then

A(X ) =∑

n≥0

t2nX2n +

n≥0

t2n+1X2n+1

=∑

n≥0

tnX2n + X

n≥0

tnX2n + X

n≥0

X 2n

= A(X 2) + XA(X 2) + X/(1− X 2)

= A(X )2(1 + X ) + X/(1 + X )2.

195 / 201

Page 196: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Christol’s theorem: example

Let (tn)n≥0 denote the Thue-Morse sequence.Then tn = sum of the bits in the binary expansion of n, mod 2.Also t2n ≡ tn and t2n+1 ≡ tn + 1. If we set A(X ) =

n≥0 tnXn,

then

A(X ) =∑

n≥0

t2nX2n +

n≥0

t2n+1X2n+1

=∑

n≥0

tnX2n + X

n≥0

tnX2n + X

n≥0

X 2n

= A(X 2) + XA(X 2) + X/(1− X 2)

= A(X )2(1 + X ) + X/(1 + X )2.

Hence (1 + X )3A2 + (1 + X )2A+ X = 0.196 / 201

Page 197: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Open Problems

Is the set of primitive words over {0, 1} context-free? (Almostcertainly not.)

197 / 201

Page 198: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Open Problems

Is the set of primitive words over {0, 1} context-free? (Almostcertainly not.)

What are the frequencies of letters in Kolakoski’s word? Dothey exist? Are they equal to 1/2?

198 / 201

Page 199: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Open Problems

Is the set of primitive words over {0, 1} context-free? (Almostcertainly not.)

What are the frequencies of letters in Kolakoski’s word? Dothey exist? Are they equal to 1/2?

Nivat’s conjecture: extension of periodicity to 2-dimensionalarrays

199 / 201

Page 200: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

Open Problems

Is the set of primitive words over {0, 1} context-free? (Almostcertainly not.)

What are the frequencies of letters in Kolakoski’s word? Dothey exist? Are they equal to 1/2?

Nivat’s conjecture: extension of periodicity to 2-dimensionalarrays

Is there a word over a finite subset of N that avoids xx ′ with|x | = |x ′| and

∑x =

∑x ′?

200 / 201

Page 201: Combinatorics on Words: An Introductionshallit/Talks/introcw.pdf · Nowassumetheresultistrueforjwj+jxj

For Further Reading

M. Lothaire, Combinatorics on Words, Cambridge, 1997(reprint)

M. Lothaire, Algebraic Combinatorics on Words, Cambridge,2002

M. Lothaire, Applied Combinatorics on Words, Cambridge,2005

V. Berthe, M. Rigo, Combinatorics, Automata, and NumberTheory, Cambridge, 2010

J.-P. Allouche and J. Shallit, Automatic Sequences: Theory,Applications, Generalizations, Cambridge, 2003.

201 / 201