Lyndon word
In mathematics, in the areas of combinatorics and computer science, a Lyndon word is a nonempty string that is strictly smaller in lexicographic order than all of its rotations. Lyndon words are named after mathematician Roger Lyndon, who investigated them in 1954, calling them standard lexicographic sequences.[1] Anatoly Shirshov introduced Lyndon words in 1953 calling them regular words.[2] Lyndon words are a special case of Hall words; almost all properties of Lyndon words are shared by Hall words.
Definitions
[edit]Several equivalent definitions exist.
A -ary Lyndon word of length is an -character string over an alphabet of size , and which is the unique minimum element in the lexicographical ordering in the multiset of all its rotations. Being the singularly smallest rotation implies that a Lyndon word differs from any of its non-trivial rotations, and is therefore aperiodic.[3]
Alternately, a word is a Lyndon word if and only if it is nonempty and lexicographically strictly smaller than any of its proper suffixes, that is for all nonempty words such that and is nonempty.
Another characterisation is the following: A Lyndon word has the property that it is nonempty and, whenever it is split into two nonempty substrings, the left substring is always lexicographically less than the right substring. That is, if is a Lyndon word, and is any factorization into two substrings, with and understood to be non-empty, then . This definition implies that a string of length is a Lyndon word if and only if there exist Lyndon words and such that and .[4] Although there may be more than one choice of and with this property, there is a particular choice, called the standard factorization, in which is as long as possible.[5]
Enumeration
[edit]The Lyndon words over the two-symbol binary alphabet {0,1}, sorted by length and then lexicographically within each length class, form an infinite sequence that begins
- 0, 1, 01, 001, 011, 0001, 0011, 0111, 00001, 00011, 00101, 00111, 01011, 01111, ...
The first string that does not belong to this sequence, "00", is omitted because it is periodic (it consists of two repetitions of the substring "0"); the second omitted string, "10", is aperiodic but is not minimal in its permutation class as it can be cyclically permuted to the smaller string "01".
The empty string also meets the definition of a Lyndon word of length zero. The numbers of binary Lyndon words of each length, starting with length zero, form the integer sequence
Lyndon words correspond to aperiodic necklace class representatives and can thus be counted with Moreau's necklace-counting function.[3][6]
Generation
[edit]Duval (1988) provides an efficient algorithm for listing the Lyndon words of length at most with a given alphabet size in lexicographic order. If is one of the words in the sequence, then the next word after can be found by the following steps:
- Repeat and truncate it to a new word of length exactly .
- As long as the final symbol of is the last symbol in the sorted ordering of the alphabet, remove it, producing a shorter word.
- Replace the final remaining symbol of by its successor in the sorted ordering of the alphabet.
For example, suppose we have generated the binary Lyndon words of length up to 7, and we have generated up to , then the steps are:
- Repeat and truncate to get
- Since the last symbol is 0, it is not the final symbol.
- Increment the last symbol to obtain .
The worst-case time to generate the successor of a word by this procedure is . However, if the words being generated are stored in an array of length , and the construction of from is performed by adding symbols onto the end of rather than by making a new copy of , then the average time to generate the successor of (assuming each word is equally likely) is constant. Therefore, the sequence of all Lyndon words of length at most can be generated in time proportional to the length of the sequence.[7] A constant fraction of the words in this sequence have length exactly , so the same procedure can be used to efficiently generate words of length exactly or words whose length divides , by filtering out the generated words that do not fit these criteria.
Standard factorization
[edit]According to the Chen–Fox–Lyndon theorem, every string may be formed in a unique way by concatenating a sequence of Lyndon words, in such a way that the words in the sequence are nonincreasing lexicographically.[8] The final Lyndon word in this sequence is the lexicographically smallest suffix of the given string.[9] A factorization into a nonincreasing sequence of Lyndon words (the so-called Lyndon factorization) can be constructed in linear time.[9] Lyndon factorizations may be used as part of a bijective variant of the Burrows–Wheeler transform for data compression,[10] and in algorithms for digital geometry.[11]
Such factorizations can be written (uniquely) as finite binary trees, with the leaves labelled by the alphabet, with each rightward branch given by the final Lyndon word in the sequence.[12] Such trees are sometimes called standard bracketings and can be taken as factorization of the elements of a free group or as the basis elements for a free Lie algebra. These trees are a special case of Hall trees (as Lyndon words are a special case of Hall words), and so likewise, the Hall words provide a standard order, called the commutator collecting process for groups, and basis for Lie algebras.[13] Indeed, they provide an explicit construction for the commutators appearing in the Poincaré–Birkhoff–Witt theorem needed for the construction of universal enveloping algebras.
Every Lyndon word can be understood as a permutation, the suffix standard permutation.
Duval algorithm
[edit]Duval (1983) developed an algorithm for finding the standard factorization that runs in linear time and constant space. It iterates over a string trying to find as long a Lyndon word as possible. When it finds one, it adds it to the result list and proceeds to search the remaining part of the string. The resulting list of strings is the standard factorization of the given string. More formal description of the algorithm follows.
Given a string S of length N, one should proceed with the following steps:
- Let m be the index of the symbol-candidate to be appended to the already collected symbols. Initially, m = 1 (indices of symbols in a string start from zero).
- Let k be the index of the symbol we would compare others to. Initially, k = 0.
- While k and m are less than N, compare S[k] (the k-th symbol of the string S) to S[m]. There are three possible outcomes:
- S[k] is equal to S[m]: append S[m] to the current collected symbols. Increment k and m.
- S[k] is less than S[m]: if we append S[m] to the current collected symbols, we'll get a Lyndon word. But we can't add it to the result list yet because it may be just a part of a larger Lyndon word. Thus, just increment m and set k to 0 so the next symbol would be compared to the first one in the string.
- S[k] is greater than S[m]: if we append S[m] to the current collected symbols, it will be neither a Lyndon word nor a possible beginning of one. Thus, add the first m−k collected symbols to the result list, remove them from the string, set m to 1 and k to 0 so that they point to the second and the first symbol of the string respectively.
- When m > N, it is essentially the same as encountering minus infinity, thus, add the first m−k collected symbols to the result list after removing them from the string, set m to 1 and k to 0, and return to the previous step.
- Add S to the result list.
Connection to de Bruijn sequences
[edit]If one concatenates together, in lexicographic order, all the Lyndon words that have length dividing a given number n, the result is a de Bruijn sequence, a circular sequence of symbols such that each possible length-n sequence appears exactly once as one of its contiguous subsequences. For example, the concatenation of the binary Lyndon words whose length divides four is
- 0 0001 0011 01 0111 1
This construction, together with the efficient generation of Lyndon words, provides an efficient method for constructing a particular de Bruijn sequence in linear time and logarithmic space.[14]
Additional properties and applications
[edit]Lyndon words have an application to the description of free Lie algebras, in constructing a basis for the homogeneous part of a given degree; this was Lyndon's original motivation for introducing these words.[4] Lyndon words may be understood as a special case of Hall sets.[4]
For prime p, the number of irreducible monic polynomials of degree d over the field is the same as the number of Lyndon words of length d in an alphabet of p symbols; they can be placed into explicit correspondence.[15]
A theorem of Radford states that a shuffle algebra over a field of characteristic 0 can be viewed as a polynomial algebra over the Lyndon words. More precisely, let A be an alphabet, let k be a field of characteristic 0 (or, more general, a commutative ℚ-algebra), and let R be the free noncommutative k-algebra k ⟨ xa | a ∈ A ⟩. The words over A can then be identified with the "noncommutative monomials" (i.e., products of the xa) in R; namely, we identify a word (a1,a2,...,an) with the monomial xa1xa2...xan. Thus, the words over A form a k-vector space basis of R. Then, a shuffle product is defined on R; this is a k-bilinear, associative and commutative product, which is denoted by ш, and which on the words can be recursively defined by
- 1 ш v = v for any word v;
- u ш 1 = u for any word u;
- ua ш vb = (u ш vb)a (ua ш v)b a,b ∈ A and any words u and v. for any
The shuffle algebra on the alphabet A is defined to be the additive group R endowed with ш as multiplication. Radford's theorem[16] now states that the Lyndon words are algebraically independent elements of this shuffle algebra, and generate it; thus, the shuffle algebra is isomorphic to a polynomial ring over k, with the indeterminates corresponding to the Lyndon words.[16]
See also
[edit]Notes
[edit]- ^ Lyndon (1954).
- ^ Shirshov (1953).
- ^ a b Berstel & Perrin (2007); Melançon (2001).
- ^ a b c Melançon (2001).
- ^ Berstel & Perrin (2007).
- ^ Ruskey (2003) provides details of these counts for Lyndon words and several related concepts.
- ^ Berstel & Pocchiola (1994).
- ^ Melançon (2001). Berstel & Perrin (2007) write that although this is commonly credited to Chen, Fox & Lyndon (1958), and follows from results in that paper, it was not stated explicitly until Schützenberger (1965). It was formulated explicitly by Shirshov (1958), see Schützenberger & Sherman (1963).
- ^ a b Duval (1983).
- ^ Gil & Scott (2009); Kufleitner (2009).
- ^ Brlek et al. (2009).
- ^ Glen (2012).
- ^ Melançon (1992); Melançon & Reutenauer (1989); Hohlweg & Reutenauer (2003)
- ^ According to Berstel & Perrin (2007), the sequence generated in this way was first described (with a different generation method) by Martin (1934), and the connection between it and Lyndon words was observed by Fredricksen & Maiorana (1978).
- ^ Golomb (1969).
- ^ a b Radford (1979)
References
[edit]- Berstel, Jean; Perrin, Dominique (2007), "The origins of combinatorics on words" (PDF), European Journal of Combinatorics, 28 (3): 996–1022, doi:10.1016/j.ejc.2005.07.019, MR 2300777.
- Berstel, J.; Pocchiola, M. (1994), "Average cost of Duval's algorithm for generating Lyndon words" (PDF), Theoretical Computer Science, 132 (1–2): 415–425, doi:10.1016/0304-3975(94)00013-1, MR 1290554.
- Brlek, S.; Lachaud, J.-O.; Provençal, X.; Reutenauer, C. (2009), "Lyndon Christoffel = digitally convex" (PDF), Pattern Recognition, 42 (10): 2239–2246, Bibcode:2009PatRe..42.2239B, doi:10.1016/j.patcog.2008.11.010.
- Chen, K.-T.; Fox, R. H.; Lyndon, R. C. (1958), "Free differential calculus. IV. The quotient groups of the lower central series", Annals of Mathematics, 2nd Ser., 68 (1): 81–95, doi:10.2307/1970044, JSTOR 1970044, MR 0102539.
- Duval, Jean-Pierre (1983), "Factorizing words over an ordered alphabet", Journal of Algorithms, 4 (4): 363–381, doi:10.1016/0196-6774(83)90017-2.
- Duval, Jean-Pierre (1988), "Génération d'une section des classes de conjugaison et arbre des mots de Lyndon de longueur bornée", Theoretical Computer Science (in French), 60 (3): 255–283, doi:10.1016/0304-3975(88)90113-2, MR 0979464.
- Fredricksen, Harold; Maiorana, James (1978), "Necklaces of beads in k colors and k-ary de Bruijn sequences", Discrete Mathematics, 23 (3): 207–210, doi:10.1016/0012-365X(78)95002-X, MR 0523071.
- Gil, J.; Scott, D. A. (2009), A bijective string sorting transform (PDF).
- Glen, Amy (2012), "Combinatorics of Lyndon Words" (PDF), Mini-Conference: Combinatorics, representations, and structure of Lie type, University of Melbourne
- Golomb, Solomon W. (1969), "Irreducible polynomials, synchronizing codes, primitive necklaces and cyclotomic algebra", in Bose, R.C.; Dowling, T.A. (eds.), Combinatorial mathematics and its applications: Proceedings of the conference held at the University of North Carolina at Chapel Hill, April 10-14, 1967, University of North Carolina monograph series in probability and statistics, vol. 4, University of North Carolina Press, pp. 358–370, ISBN 9780807878200, OCLC 941682678
- Hohlweg, Christophe; Reutenauer, Christophe (2003), "Lyndon words, permutations and trees" (PDF), Theoretical Computer Science, 307 (1): 173–8, doi:10.1016/S0304-3975(03)00099-9
- Kufleitner, Manfred (2009), "On bijective variants of the Burrows-Wheeler transform", in Holub, Jan; Žďárek, Jan (eds.), Prague Stringology Conference, pp. 65–69, arXiv:0908.0239, Bibcode:2009arXiv0908.0239K.
- Lothaire, M. (1983), Combinatorics on words, Encyclopedia of Mathematics and its Applications, vol. 17, Addison-Wesley Publishing Co., Reading, Mass., ISBN 978-0-201-13516-9, MR 0675953
- Lyndon, R. C. (1954), "On Burnside's problem", Transactions of the American Mathematical Society, 77 (2): 202–215, doi:10.2307/1990868, JSTOR 1990868, MR 0064049.
- Martin, M. H. (1934), "A problem in arrangements", Bulletin of the American Mathematical Society, 40 (12): 859–864, doi:10.1090/S0002-9904-1934-05988-3, MR 1562989.
- Melançon, Guy (1992), "Combinatorics of Hall trees and Hall words" (PDF), Journal of Combinatorial Theory, Series A, 59 (2): 285–308, doi:10.1016/0097-3165(92)90070-B
- Melançon, G. (2001) [1994], "Lyndon word", Encyclopedia of Mathematics, EMS Press
- Melançon, Guy; Reutenauer, Christophe (1989), "Lyndon words, free algebras and shuffles", Canadian Journal of Mathematics, 41 (4): 577–591, doi:10.4153/CJM-1989-025-2, S2CID 17395250
- Ruskey, Frank (2003), Info on necklaces, Lyndon words, De Bruijn sequences, archived from the original on 2006-10-02.
- Schützenberger, M. P.; Sherman, S (1963), "On a formal product over the conjugate classes in a free group", Journal of Mathematical Analysis and Applications, 7 (3): 482–488, doi:10.1016/0022-247X(63)90070-2, MR 0158002.
- Schützenberger, M. P. (1965), "On a factorisation of free monoids", Proceedings of the American Mathematical Society, 16 (1): 21–24, doi:10.2307/2033993, JSTOR 2033993, MR 0170971.
- Shirshov, A. I. (1953), "Subalgebras of free Lie algebras", Mat. Sbornik, New Series, 33 (75): 441–452, MR 0059892
- Shirshov, A. I. (1958), "On free Lie rings", Mat. Sbornik, New Series, 45 (87): 113–122, MR 0099356
- Radford, David E. (1979), "A natural ring basis for the shuffle algebra and an application to group schemes", Journal of Algebra, 58 (2): 432–454, doi:10.1016/0021-8693(79)90171-6.