Jump to content

Draft:Fine and Wilf's theorem

From Wikipedia, the free encyclopedia


In combinatorics on words, Fine and Wilf’s theorem is a fundamental result describing what happens when a long-enough word has two different periods (i.e., distances at which its letters repeat)[1][2]. Informally, the conclusion is that such words  have also a third, shorter period. If the periods and length of  satisfy certain conditions, then this third period can equal . In this case then, the theorem’s conclusion is that  is a power of a single letter. The theorem was introduced in 1963 by Nathan Fine and Herbert Wilf[3]. It is easy to prove, and has uses across theoretical computer science and symbolic dynamics[4][1].

Herbert Wilf, who introduced the theorem alongside Nathan Fine

Statement

[edit]

The two most common phrasings of Fine and Wilf’s theorem are as follows[2][4]:

Theorem — Let  be a word with periods  and  (i.e., distances at which its letters repeat). If the length of  is at least , then  also has period .

Theorem — Let be nonempty words. If the infinite words  and  have a common prefix of length , then  are powers of a common word.

It is folklore that an infinite sequence having two periods  and  has also  as a period[5]. Indeed, by Bézout’s identity, there are integers  satisfying  or . In the first case, we always have . And in the second, we always have .

Fine and Wilf’s theorem refines this result only by bounding the length of the sequence  to some large-enough finite value such that the third period must still arise. The finite bound of Fine and Wilf is optimal. Indeed, consider . Then  has periods  and , since . By Fine and Wilf’s theorem,  would also have period  if its length were at least . In fact, the length of  is , only one short of this threshold, and  fails to have this short period .

Proof

[edit]

We prove the second phrasing of the theorem above. The proof comes from [2], and is closely related to the extended Euclidean algorithm, much like the proof of Bézout’s identity.

Let  be nonempty words over an alphabet . We first reduce to the case : If instead we have and , with , , we consider  and  as elements of . That is, we view them as words over the alphabet  whose letters are words of length  in the original alphabet . With respect the larger alphabet , and so proving the result for this case will suffice.

So let  and with . Suppose that  and  have a common prefix of length . Assume further (by symmetry) that , and consider the image shown below. Here the positions of the words  and  are numbered . The vertical dashed line indicates how far the words  and  can be compared.

The procedure used in our proof of Fine and Wilf's theorem.

The arrow describes a procedure, the purpose of which is to fix the values of new positions to be the same as a given value of an initial position . By our premises, the value of the position computed as follows:where  is reduced to the interval , gets the same value as that of . So the procedure computes  from the number . Since ,   differs from . If differs from  as well, the procedure can be repeated. The claim is: The new positions obtained will always differ from all the previous ones. Indeed, if with , then necessarily , since .

Now, if the procedure can be repeated  times, then every position in (the first repetition of)  will get covered, meaning that these’ll all get the same letter as the initial one at position . But this implies that  is a power of a single letter, and thus so is . Hence, this would complete the proof.

But the procedure can be repeated  times if we choose  such that .  If this holds, then all the values  for  differ from . Clearly, such an  can be found.

Variants

[edit]

Often the following weakening of Fine and Wilf’s theorem is formulated[2]:

Theorem — Let be nonempty words. If the infinite words  and  have a common prefix of length , then  are powers of a common word.

This variant can be proved using a simplified version of the above argument. It is often strong enough in application[2].

Another reformulation removes the emphasis on the words' "left-hand-sides" (i.e., the requirement for and to agree from the start). This statment therefore requires only that has a different periodic presentation than the trivial one as a repetition of s. To write it down formally, let denote the maximal length of a common factor of the words and . Then[2]

Theorem — Let be nonempty words. If , then the primitive roots of are conjugates.

Variants of the theorem have also been introduced that look at abelian periods[6] (i.e., consecutive blocks in words that are not necessarily identical, but anagrams of each other). There are also ways to apply the theorem to continuous functions having multiple periods[3][5].

Generalisations

[edit]

Fine and Wilf’s theorem has been generalised to work with words having more than two periods[7][5]. For instance, for three periods , the appropriate bound iswhere  is a function related to the Euclidean algorithm on three inputs[8][5].

The result has also been investigated with respect to “partial words[9], which are allowed to contain “don’t care” positions called holes. Holes match each other and all other letters. More precisely,[5]

Theorem — There exists a computable function  such that, if a word  with  holes and periods has length , then  also has period .

Relation to Sturmian Words

[edit]

Let  be coprime. Fine and Wilf’s Theorem allows for words of length  to have periods  and  without being a power of a single letter. In fact, given  and , such a word always exists[2]. Moreover, it is binary and unique (up to renaming its letters).

The proof of this claim follows the proof given above. Indeed, in that proof, the letters in the positions of the shorter word were fixed using the procedure. The procedure could be applied in all but one case, namely when the position was . Now there are two positions wherein the procedure cannot be applied, viz.  and . Accordingly, we are free to choose the letters occurring in two positions of the shorter word, but as soon as we do this, every other position is fixed. Since we want a word that’s not a power of a single letter, our only choice (modulo the letters’ names) is to put different letters in the two positions we have control over. Uniqueness follows from the fact that every other position is fixed.

The words so obtained are the finite Sturmian words[2]. These words admit many characterisations[1][8]; the above discourse gives a way to compute them.

Applications

[edit]

One application of Fine and Wilf's theorem is to string-searching algorithms[5]. For instance, the Knuth-Morris-Pratt algorithm finds all occurrences of a pattern  in a text  in time bounded by . It compares to a portion of  beginning at a position  and, if a mismatch is found, shifts  rightward depending on where the mismatch occurred[10]. The worst-case for the Knuth-Morris-Pratt algorithm comes from “almost-periodic” words, the idea being that – in this case – long sequences of matching letter can occur without a complete match. It turns out that such words are precisely the maximal “counterexamples” to Fine and Wilf’s theorem (i.e., the finite Sturmian words, described in the previous section)[5].

Fine and Wilf’s theorem can also be used to reason about the solution sets of word equations[2].

References

[edit]
  1. ^ a b c Lothaire, M., ed. (1997-05-29). Combinatorics on Words (2 ed.). Cambridge University Press. doi:10.1017/cbo9780511566097. ISBN 978-0-521-59924-5.
  2. ^ a b c d e f g h i Karhumäki, Juhani. "Combinatorics of Words" (PDF). Retrieved 23 November 2024.{{cite web}}: CS1 maint: url-status (link)
  3. ^ a b Fine, N. J.; Wilf, H. S. (1965). "Uniqueness theorems for periodic functions". Proceedings of the American Mathematical Society. 16 (1): 109–114. doi:10.1090/S0002-9939-1965-0174934-9. ISSN 0002-9939.
  4. ^ a b Handbook of Formal Languages. doi:10.1007/978-3-642-59136-5.
  5. ^ a b c d e f g Shallit, Jeffrey. "Fifty Years of Fine and Wilf" (PDF). Retrieved 23 November 2024.{{cite web}}: CS1 maint: url-status (link)
  6. ^ Karhumäki, Juhani; Puzynina, Svetlana; Saarela, Aleksi (2012). Yen, Hsu-Chun; Ibarra, Oscar H. (eds.). "Fine and Wilf's Theorem for k-Abelian Periods". Developments in Language Theory. Berlin, Heidelberg: Springer: 296–307. doi:10.1007/978-3-642-31653-1_27. ISBN 978-3-642-31653-1.
  7. ^ Constantinescu, Sorin; Ilie, Lucian (2005-06-11). "Generalised fine and Wilf's theorem for arbitrary number of periods". Theoretical Computer Science. Combinatorics on Words. 339 (1): 49–60. doi:10.1016/j.tcs.2005.01.007. ISSN 0304-3975.
  8. ^ a b Lothaire, M., ed. (2002), "Sturmian Words", Algebraic Combinatorics on Words, Encyclopedia of Mathematics and its Applications, Cambridge: Cambridge University Press, pp. 45–110, doi:10.1017/cbo9781107326019.003, ISBN 978-0-521-81220-7, retrieved 2024-11-23
  9. ^ Berstel, Jean; Boasson, Luc (1999-04-28). "Partial words and a theorem of Fine and Wilf". Theoretical Computer Science. 218 (1): 135–141. doi:10.1016/S0304-3975(98)00255-2. ISSN 0304-3975.
  10. ^ Cormen, Thomas H.; Leiserson, Charles Eric; Rivest, Ronald Linn; Stein, Clifford (2022). Introduction to algorithms (4th ed.). Cambridge, Massachusetts London, England: The MIT Press. ISBN 978-0-262-04630-5.