avoiding overlaps with the greedy algorithmcanadam.math.ca/2009/pdf/guay-paquet.pdf · avoiding...

34
Avoiding Overlaps with the Greedy Algorithm Mathieu Guay-Paquet 1 Jeffrey Shallit 2 1 Department of Combinatorics & Optimization 2 School of Computer Science University of Waterloo 2nd Canadian Discrete and Algorithmic Mathematics Conference May 26, 2009

Upload: others

Post on 10-Jul-2020

10 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Avoiding Overlaps with the Greedy Algorithmcanadam.math.ca/2009/pdf/guay-paquet.pdf · Avoiding Overlaps with the Greedy Algorithm Mathieu Guay-Paquet 1 Jeffrey Shallit 2 1Department

Avoiding Overlaps with the Greedy Algorithm

Mathieu Guay-Paquet 1 Jeffrey Shallit 2

1Department of Combinatorics & Optimization

2School of Computer Science

University of Waterloo

2nd Canadian Discrete and AlgorithmicMathematics Conference

May 26, 2009

Page 2: Avoiding Overlaps with the Greedy Algorithmcanadam.math.ca/2009/pdf/guay-paquet.pdf · Avoiding Overlaps with the Greedy Algorithm Mathieu Guay-Paquet 1 Jeffrey Shallit 2 1Department

Outline

Background

Avoiding squares

Avoiding overlaps

Open questions

Page 3: Avoiding Overlaps with the Greedy Algorithmcanadam.math.ca/2009/pdf/guay-paquet.pdf · Avoiding Overlaps with the Greedy Algorithm Mathieu Guay-Paquet 1 Jeffrey Shallit 2 1Department

Outline

Background

Avoiding squares

Avoiding overlaps

Open questions

Page 4: Avoiding Overlaps with the Greedy Algorithmcanadam.math.ca/2009/pdf/guay-paquet.pdf · Avoiding Overlaps with the Greedy Algorithm Mathieu Guay-Paquet 1 Jeffrey Shallit 2 1Department

The objects

I Alphabet: a (usually finite) set of symbols.

{a, . . . , z}, {0,1}, {0,1,2}, . . .

I Word: a finite or (right) infinite string of symbols.

word,ababca,01101001,010201202 · · · , . . .

I Pattern: a set of words.

{English words}, {xx | x ∈ Σ∗}, {axaxa | a ∈ Σ, x ∈ Σ∗}, . . .

Page 5: Avoiding Overlaps with the Greedy Algorithmcanadam.math.ca/2009/pdf/guay-paquet.pdf · Avoiding Overlaps with the Greedy Algorithm Mathieu Guay-Paquet 1 Jeffrey Shallit 2 1Department

The objects

I Alphabet: a (usually finite) set of symbols.

{a, . . . , z}, {0,1}, {0,1,2}, . . .

I Word: a finite or (right) infinite string of symbols.

word,ababca,01101001,010201202 · · · , . . .

I Pattern: a set of words.

{English words}, {xx | x ∈ Σ∗}, {axaxa | a ∈ Σ, x ∈ Σ∗}, . . .

Page 6: Avoiding Overlaps with the Greedy Algorithmcanadam.math.ca/2009/pdf/guay-paquet.pdf · Avoiding Overlaps with the Greedy Algorithm Mathieu Guay-Paquet 1 Jeffrey Shallit 2 1Department

The objects

I Alphabet: a (usually finite) set of symbols.

{a, . . . , z}, {0,1}, {0,1,2}, . . .

I Word: a finite or (right) infinite string of symbols.

word,ababca,01101001,010201202 · · · , . . .

I Pattern: a set of words.

{English words}, {xx | x ∈ Σ∗}, {axaxa | a ∈ Σ, x ∈ Σ∗}, . . .

Page 7: Avoiding Overlaps with the Greedy Algorithmcanadam.math.ca/2009/pdf/guay-paquet.pdf · Avoiding Overlaps with the Greedy Algorithm Mathieu Guay-Paquet 1 Jeffrey Shallit 2 1Department

The questions

I Given an alphabet and a pattern, are there long wordsavoiding it? Infinite words avoiding it?

I Given a pattern, how big of an alphabet do you need toavoid it?

I What is the lexicographically least infinite word avoiding apattern?

Page 8: Avoiding Overlaps with the Greedy Algorithmcanadam.math.ca/2009/pdf/guay-paquet.pdf · Avoiding Overlaps with the Greedy Algorithm Mathieu Guay-Paquet 1 Jeffrey Shallit 2 1Department

The questions

I Given an alphabet and a pattern, are there long wordsavoiding it? Infinite words avoiding it?

I Given a pattern, how big of an alphabet do you need toavoid it?

I What is the lexicographically least infinite word avoiding apattern?

Page 9: Avoiding Overlaps with the Greedy Algorithmcanadam.math.ca/2009/pdf/guay-paquet.pdf · Avoiding Overlaps with the Greedy Algorithm Mathieu Guay-Paquet 1 Jeffrey Shallit 2 1Department

The questions

I Given an alphabet and a pattern, are there long wordsavoiding it? Infinite words avoiding it?

I Given a pattern, how big of an alphabet do you need toavoid it?

I What is the lexicographically least infinite word avoiding apattern?

Page 10: Avoiding Overlaps with the Greedy Algorithmcanadam.math.ca/2009/pdf/guay-paquet.pdf · Avoiding Overlaps with the Greedy Algorithm Mathieu Guay-Paquet 1 Jeffrey Shallit 2 1Department

Some answers

Thue (1906, 1912):I Can avoid overlaps over a binary alphabet, but not a unary

one.0110100110010110 · · ·

I Can avoid squares over a ternary alphabet, but not abinary one.

0120210121020120 · · ·

Page 11: Avoiding Overlaps with the Greedy Algorithmcanadam.math.ca/2009/pdf/guay-paquet.pdf · Avoiding Overlaps with the Greedy Algorithm Mathieu Guay-Paquet 1 Jeffrey Shallit 2 1Department

Some answers

Thue (1906, 1912):I Can avoid overlaps over a binary alphabet, but not a unary

one.0110100110010110 · · ·

I Can avoid squares over a ternary alphabet, but not abinary one.

0120210121020120 · · ·

Page 12: Avoiding Overlaps with the Greedy Algorithmcanadam.math.ca/2009/pdf/guay-paquet.pdf · Avoiding Overlaps with the Greedy Algorithm Mathieu Guay-Paquet 1 Jeffrey Shallit 2 1Department

Some tools

How do you describe an infinite word and prove things about it?

I Give a program to compute it. But it’s hard to reason aboutproperties of the word.

I Give it as a fixed point of a morphism. Then proveproperties of the morphism.

0110100110010110 · · · 0120210121020120 · · ·0 7→ 01 0 7→ 0121 7→ 10 1 7→ 02

2 7→ 1

Page 13: Avoiding Overlaps with the Greedy Algorithmcanadam.math.ca/2009/pdf/guay-paquet.pdf · Avoiding Overlaps with the Greedy Algorithm Mathieu Guay-Paquet 1 Jeffrey Shallit 2 1Department

Some tools

How do you describe an infinite word and prove things about it?

I Give a program to compute it. But it’s hard to reason aboutproperties of the word.

I Give it as a fixed point of a morphism. Then proveproperties of the morphism.

0110100110010110 · · · 0120210121020120 · · ·0 7→ 01 0 7→ 0121 7→ 10 1 7→ 02

2 7→ 1

Page 14: Avoiding Overlaps with the Greedy Algorithmcanadam.math.ca/2009/pdf/guay-paquet.pdf · Avoiding Overlaps with the Greedy Algorithm Mathieu Guay-Paquet 1 Jeffrey Shallit 2 1Department

Outline

Background

Avoiding squares

Avoiding overlaps

Open questions

Page 15: Avoiding Overlaps with the Greedy Algorithmcanadam.math.ca/2009/pdf/guay-paquet.pdf · Avoiding Overlaps with the Greedy Algorithm Mathieu Guay-Paquet 1 Jeffrey Shallit 2 1Department

Finite vs. infinite alphabets

The lexicographically least infinite squarefree word over{0,1,2} is hard to compute.

0102012021012010 · · ·

The lexicographically least infinite squarefree word over N istrivial to compute.

w2 = 0102010301020104 · · ·

Page 16: Avoiding Overlaps with the Greedy Algorithmcanadam.math.ca/2009/pdf/guay-paquet.pdf · Avoiding Overlaps with the Greedy Algorithm Mathieu Guay-Paquet 1 Jeffrey Shallit 2 1Department

Finite vs. infinite alphabets

The lexicographically least infinite squarefree word over{0,1,2} is hard to compute.

0102012021012010 · · ·

The lexicographically least infinite squarefree word over N istrivial to compute.

w2 = 0102010301020104 · · ·

Page 17: Avoiding Overlaps with the Greedy Algorithmcanadam.math.ca/2009/pdf/guay-paquet.pdf · Avoiding Overlaps with the Greedy Algorithm Mathieu Guay-Paquet 1 Jeffrey Shallit 2 1Department

The ruler word

w2 = γω(0) = 01020103010201040102010301020105 · · ·

where

γ(0) = 01γ(1) = 02γ(2) = 03

...γ(i) = 0 · (i + 1)

Photo by Flickr user iliahi.

Page 18: Avoiding Overlaps with the Greedy Algorithmcanadam.math.ca/2009/pdf/guay-paquet.pdf · Avoiding Overlaps with the Greedy Algorithm Mathieu Guay-Paquet 1 Jeffrey Shallit 2 1Department

Irreducibility

The idea: we can generate w2 by starting with the empty wordand repeatedly appending the smallest letter which does notcreate a square.

A word is irreducible at a position (with respect to squares) ifreplacing the letter at that position by any smaller letter createsa squares ending at that position.

010201020304

Page 19: Avoiding Overlaps with the Greedy Algorithmcanadam.math.ca/2009/pdf/guay-paquet.pdf · Avoiding Overlaps with the Greedy Algorithm Mathieu Guay-Paquet 1 Jeffrey Shallit 2 1Department

Irreducibility

The idea: we can generate w2 by starting with the empty wordand repeatedly appending the smallest letter which does notcreate a square.

A word is irreducible at a position (with respect to squares) ifreplacing the letter at that position by any smaller letter createsa squares ending at that position.

010201020304

Page 20: Avoiding Overlaps with the Greedy Algorithmcanadam.math.ca/2009/pdf/guay-paquet.pdf · Avoiding Overlaps with the Greedy Algorithm Mathieu Guay-Paquet 1 Jeffrey Shallit 2 1Department

Squarefreedom, irreducibility, and the lex order

Key property: if v is irreducible (at every position) and w issquarefree, then v ≤ w in the lexicographic order (or w is aprefix of v ).

So: the irreducible squarefree words are the prefixes of w2.

So: if γ is irreducible and squarefree, then w2 = γω(0).

Page 21: Avoiding Overlaps with the Greedy Algorithmcanadam.math.ca/2009/pdf/guay-paquet.pdf · Avoiding Overlaps with the Greedy Algorithm Mathieu Guay-Paquet 1 Jeffrey Shallit 2 1Department

Squarefreedom, irreducibility, and the lex order

Key property: if v is irreducible (at every position) and w issquarefree, then v ≤ w in the lexicographic order (or w is aprefix of v ).

So: the irreducible squarefree words are the prefixes of w2.

So: if γ is irreducible and squarefree, then w2 = γω(0).

Page 22: Avoiding Overlaps with the Greedy Algorithmcanadam.math.ca/2009/pdf/guay-paquet.pdf · Avoiding Overlaps with the Greedy Algorithm Mathieu Guay-Paquet 1 Jeffrey Shallit 2 1Department

Squarefreedom, irreducibility, and the lex order

Key property: if v is irreducible (at every position) and w issquarefree, then v ≤ w in the lexicographic order (or w is aprefix of v ).

So: the irreducible squarefree words are the prefixes of w2.

So: if γ is irreducible and squarefree, then w2 = γω(0).

Page 23: Avoiding Overlaps with the Greedy Algorithmcanadam.math.ca/2009/pdf/guay-paquet.pdf · Avoiding Overlaps with the Greedy Algorithm Mathieu Guay-Paquet 1 Jeffrey Shallit 2 1Department

Outline

Background

Avoiding squares

Avoiding overlaps

Open questions

Page 24: Avoiding Overlaps with the Greedy Algorithmcanadam.math.ca/2009/pdf/guay-paquet.pdf · Avoiding Overlaps with the Greedy Algorithm Mathieu Guay-Paquet 1 Jeffrey Shallit 2 1Department

Finite vs. infinite alphabets

Berstel (1994), then Allouche, Currie, Shallit (1998) describethe lexicographically least infinite overlap-free word over {0,1}with any prefix.

001001t = 0010011001011001101001 · · ·

M, Shallit (2008) describe the lexicographically least infiniteoverlap-free word over N.

w2+ = 00100110010020010011001002100 · · ·

Page 25: Avoiding Overlaps with the Greedy Algorithmcanadam.math.ca/2009/pdf/guay-paquet.pdf · Avoiding Overlaps with the Greedy Algorithm Mathieu Guay-Paquet 1 Jeffrey Shallit 2 1Department

Finite vs. infinite alphabets

Berstel (1994), then Allouche, Currie, Shallit (1998) describethe lexicographically least infinite overlap-free word over {0,1}with any prefix.

001001t = 0010011001011001101001 · · ·

M, Shallit (2008) describe the lexicographically least infiniteoverlap-free word over N.

w2+ = 00100110010020010011001002100 · · ·

Page 26: Avoiding Overlaps with the Greedy Algorithmcanadam.math.ca/2009/pdf/guay-paquet.pdf · Avoiding Overlaps with the Greedy Algorithm Mathieu Guay-Paquet 1 Jeffrey Shallit 2 1Department

The overlap-free word

The word w2+ = ϕω(0) = 00100110 · · · is generated by amorphism ϕ with

ϕ(0) = ψ(0,1) = 001ϕ(1) = ψ(1,2) = 1001002ϕ(2) = ψ(2,3) = 200100110010020010011001003

...

where ψ(h, k) is the lexicographically least overlap-free wordstarting with h and ending with k for letters h ≤ k . Thismorphism is overlap-free and irreducible.

Page 27: Avoiding Overlaps with the Greedy Algorithmcanadam.math.ca/2009/pdf/guay-paquet.pdf · Avoiding Overlaps with the Greedy Algorithm Mathieu Guay-Paquet 1 Jeffrey Shallit 2 1Department

The structure of ψ(h, k)

I It turns out that ψ(h, k) = ϕk−h(h) for all h ≤ k .I We can construct ψ(h,h + 1) as

ψ(h, k) = h · ψ(0,h) · ψ(0,h) · h−1 · (h + 1)

= S(ψ(0,h) · ψ(0,h)) · (h + 1).

I Solving a simple recurrence gives |ψ(0, k)| = b2kk !√

ec.

Page 28: Avoiding Overlaps with the Greedy Algorithmcanadam.math.ca/2009/pdf/guay-paquet.pdf · Avoiding Overlaps with the Greedy Algorithm Mathieu Guay-Paquet 1 Jeffrey Shallit 2 1Department

The structure of ψ(h, k)

I It turns out that ψ(h, k) = ϕk−h(h) for all h ≤ k .I We can construct ψ(h,h + 1) as

ψ(h, k) = h · ψ(0,h) · ψ(0,h) · h−1 · (h + 1)

= S(ψ(0,h) · ψ(0,h)) · (h + 1).

I Solving a simple recurrence gives |ψ(0, k)| = b2kk !√

ec.

Page 29: Avoiding Overlaps with the Greedy Algorithmcanadam.math.ca/2009/pdf/guay-paquet.pdf · Avoiding Overlaps with the Greedy Algorithm Mathieu Guay-Paquet 1 Jeffrey Shallit 2 1Department

The structure of ψ(h, k)

I It turns out that ψ(h, k) = ϕk−h(h) for all h ≤ k .I We can construct ψ(h,h + 1) as

ψ(h, k) = h · ψ(0,h) · ψ(0,h) · h−1 · (h + 1)

= S(ψ(0,h) · ψ(0,h)) · (h + 1).

I Solving a simple recurrence gives |ψ(0, k)| = b2kk !√

ec.

Page 30: Avoiding Overlaps with the Greedy Algorithmcanadam.math.ca/2009/pdf/guay-paquet.pdf · Avoiding Overlaps with the Greedy Algorithm Mathieu Guay-Paquet 1 Jeffrey Shallit 2 1Department

The structure of ψ(h, k)

The word ψ(0, k) is formed from many cyclically shifted copiesof ψ(0, k − 1).

ψ(0,3) = 001001100100200100110010021001002001001100100200100120010011001002001001100100 3

In particular, it follows that S(ψ(0, k)) = R(ψ(0, k)).

Page 31: Avoiding Overlaps with the Greedy Algorithmcanadam.math.ca/2009/pdf/guay-paquet.pdf · Avoiding Overlaps with the Greedy Algorithm Mathieu Guay-Paquet 1 Jeffrey Shallit 2 1Department

The structure of ψ(h, k)

The word ψ(0, k) is formed from many cyclically shifted copiesof ψ(0, k − 1).

ψ(0,3) = 001001100100200100110010021001002001001100100200100120010011001002001001100100 3

In particular, it follows that S(ψ(0, k)) = R(ψ(0, k)).

Page 32: Avoiding Overlaps with the Greedy Algorithmcanadam.math.ca/2009/pdf/guay-paquet.pdf · Avoiding Overlaps with the Greedy Algorithm Mathieu Guay-Paquet 1 Jeffrey Shallit 2 1Department

Outline

Background

Avoiding squares

Avoiding overlaps

Open questions

Page 33: Avoiding Overlaps with the Greedy Algorithmcanadam.math.ca/2009/pdf/guay-paquet.pdf · Avoiding Overlaps with the Greedy Algorithm Mathieu Guay-Paquet 1 Jeffrey Shallit 2 1Department

Open questions

I For 1-letter prefixes, we have ψ(h,∞) = ϕω(h). Whatabout longer prefixes?

I Similar constructions and arguments work for any integeror integer-plus power. What about avoiding rational powersover N? Do we always use every element of N?

I Are there other patterns P with irreducible P-freemorphisms?

Page 34: Avoiding Overlaps with the Greedy Algorithmcanadam.math.ca/2009/pdf/guay-paquet.pdf · Avoiding Overlaps with the Greedy Algorithm Mathieu Guay-Paquet 1 Jeffrey Shallit 2 1Department

The end

Thank you!