General definitions

Ordered alphabet

An ordered alphabet Σ is a set of symbols {σ1, σ2,...,σ} such that σ1 < σ2 < ... < σ.

Word

A word w = w0w1..wn-1 of length |w| = n on alphabet Σ is the concatenation of n symbols wk (0 ≤ k < n) drawn from Σ. The empty word of length 0 is denoted by ε.

Prefix, factor, suffix

Given a word w, if w can be written as the concatenation of three possibly empty words u, v and z (w = uvz), then:

A prefix, factor or suffix is said to be proper iff it is different from w itself.

The set of all the prefixes (resp. factors, suffixes) of a word w is denoted by Pref(w) (resp. Fact(w), Suf(w)).

The prefix (resp. suffix) of length k of a word w is denoted by Prefk(w) (resp. Sufk(w)).

Border

Given a word w, any word in Pref(w) ∩ Suf(w) is called a border of w. The set of all the borders of w is denoted by Bord(w).

Period and primitivity

A word w of length n has period p, 0 < p < n, iff, ∀ 0 ≤ k < n - p, wk = wk+p.

If no such period exists, the word is said to be aperiodic.

A word is primitive iff there does not exist any p < n dividing n such that p is a period of w.

Conjugacy class

If a word w can be written as the concatenation of two words u and v (w = uv), then the word vu is called a conjugate of w.

The set of all the conjugates of a word w is denoted by Conj(w) and is called the conjugacy class of w.

Lexorder

The lexicographic order <lex (lexorder for short) is defined as follows. Given two words w and w' on an ordered alphabet Σ, then w < lex w' iff one of these conditions is verified:

Lyndon words

Lyndon word

A word is a Lyndon word iff it is strictly less (in lexorder) than any of its proper suffixes.

Example:

Lyndon word

A word is a Lyndon word iff it is the only smallest (in lexorder) element of its conjugacy class.

Example:

Lyndon word

A word w of length n is a Lyndon word iff ∀ 0 < k < n, Prefk(w) <lex Sufk(w).

Example:

Properties of Lyndon words

Lyndon array

Lyndon array

Given a word w of length n, the Lyndon array of w, denoted by Lw is defined as: ∀ 0 ≤ k < n, Lw[k] is the length of the longest prefix of wk..wn-1 that is a Lyndon word.

Example:

k01234567891011121314
wabaabbabbaaabba
Lw217311311543111