The Smallest String Attractors of Fibonacci and Period-Doubling Words
Abstract
A string attractor of a string is a set of positions of such that any substring of has an occurrence that crosses a position in , i.e., there is a position such that and the intersection is nonempty. The size of the smallest string attractor of Fibonacci words is known to be . We completely characterize the set of all smallest string attractors of Fibonacci words, and show a recursive formula describing the distinct position pairs that are the smallest string attractors of the th Fibonacci word for . Similarly, the size of the smallest string attractor of period-doubling words is known to be . We also completely characterize the set of all smallest string attractors of period-doubling words, and show a formula describing the two distinct position pairs that are the smallest string attractors of the th period-doubling word for . Our results show that strings with the same smallest attractor size can have a drastically different number of distinct smallest attractors.
Keywords and phrases:
String attractors, Fibonacci words, Period-doubling words, Combinatorics on wordsFunding:
Hideo Bannai: JSPS KAKENHI Grant Number JP24K02899.Copyright and License:
Yoshio Okamoto; licensed under Creative Commons License CC-BY 4.0
2012 ACM Subject Classification:
Mathematics of computing Combinatorics on wordsEditors:
Philip Bille and Nicola PrezzaSeries and Publisher:
Leibniz International Proceedings in Informatics, Schloss Dagstuhl – Leibniz-Zentrum für Informatik
1 Introduction
For any string , a set of positions is a string attractor (or simply attractor) of , if any substring of has an occurrence that crosses (i.e., contains) a position in . String attractors [5] are an important combinatorial notion that captures the repetitiveness (compressiveness) of the string in the sense that dictionary compression algorithms can be viewed as algorithms that compute string attractors. It is known that the size of the smallest string attractor of , denoted by , bounds all dictionary compression measures from below, and is NP-hard to compute [5].
The study of string attractors on well-known families of strings has attracted much attention. Mantaci et al. [10, 11] initiated the study of string attractors on standard Sturmian words (which include the Fibonacci words), and Thue–Morse words. For any standard Sturmian word , they showed that at least one of the sets or is a smallest string attractor of , where is the length of the longest proper palindromic prefix of . For de Bruijn words of length , they showed that the smallest attractor size asymptotically approaches . They also showed an attractor of size for the th Thue–Morse word . Later, Kutsukake et al. [7] showed that for all . In a more general setting, Schaeffer and Shallit [14] discussed string attractors of all prefixes of automatic sequences, including the period-doubling words, Thue–Morse words, and Tribonacci words. In particular, they showed that the size of the smallest attractor of any prefix of the period-doubling word longer than one is , using the Walnut theorem prover [13].
For the Fibonacci words, defined as , , , it holds that (where ), and the above result of Mantaci et al. translates to the sets or . Since cannot be an attractor (it can be shown that the length suffix of occurs uniquely and does not have an occurrence crossing a position in ), it follows that is an attractor of . Hence, this gives an explicit pair of positions to be a smallest attractor of Fibonacci words. However, in general, a given string can have multiple smallest string attractors. For example, any single position of a unary string is an attractor. For a more interesting example, the set of all smallest string attractors of is shown in Figure 1. See also Figure 13 for more examples.
In this paper, we take a deeper look into the combinatorial aspects of string attractors of Fibonacci words and period-doubling words, and give a complete characterization of their smallest string attractors. Our characterization for Fibonacci words is based on occurrences of singular words [15] in the Fibonacci word. We show a recursive formula describing the set of all smallest string attractors of the th Fibonacci word for all . For the th period-doubling word defined as and for the morphism and , we show that the position pairs and characterize the smallest attractors for . To the best of our knowledge, this is the first work which shows a complete characterization of the set of smallest string attractors for non-trivial families of strings.
It is also worth noting that, although the smallest attractor size for both the Fibonacci and period-doubling words is two, our results show that the number of smallest attractors can differ drastically, namely, from exponential in the length to constant. We do not yet have a clear interpretation of what this quantity captures, and its understanding remains an open and interesting question, as it may allow us to consider more fine-grained types of repetitiveness. Other related open problems are listed in Section 5.
Related Work
Mieno et al. [12] gave a complete characterization of smallest straight-line programs (SLPs) of Fibonacci words, showing that an SLP of a Fibonacci word is a smallest SLP if and only if it can be obtained by some implementation of the RePair algorithm [8], i.e., the recursive pairing of a most frequent adjacent symbol pair. The number of distinct smallest SLPs for was shown to be for .
We note that for the strings we have considered, the approach of Schaeffer and Shallit [14] and the software Walnut [13] can be applied, and it is possible to compute a finite state automaton for symbols in , such that accepting paths spell out a representation of the two attractor positions and the length of a prefix of the string. While the correctness of our claims can, in principle, be verified by analyzing and characterizing these paths, this would not seem to give us much insight into why the statements hold. This approach is discussed briefly in Appendix A.
Schaeffer and Shallit [14] and Cassaigne et al. [1] have studied another related attractor-based parameter , defined as the smallest distance between the leftmost and rightmost positions in an attractor of .
2 Preliminaries
Let be a binary alphabet. An element of is called a symbol. An element of is called a string. For a string , let denote its length, and let denote the empty string, i.e., . For any integer , let denote the th symbol of , and for any , let , and . Let denote the reverse of , i.e., if , then . The complement of a symbol in is denoted as and , and for any string , its complement is .
For a set of integers and another integer , let and . For two sets and , let . For a string and an occurrence of a substring of , we say that the occurrence of crosses position , if . A boundary is a pair of consecutive positions sometimes identified with two strings ending and starting at the respective positions. We say that an occurrence of a string crosses the boundary if it crosses both positions of the boundary.
Definition 1 (String Attractors [5]).
A string attractor, or an attractor for short, of a string is a set of positions of such that for any substring of , there exists an occurrence of in that crosses some position in . We denote by the set of all smallest attractors of .
It is straightforward that string attractors are invariant under string reversal, meaning that the “mirrored” string attractor is a string attractor of the mirrored string.
Observation 2.
If is an attractor of a string , then is an attractor of .
A string is a minimal unique substring (MUS) [4] of if is a substring of that has a unique occurrence in , and any proper substring of has multiple occurrences in . The following observation is straightforward.
Observation 3.
Any string attractor must contain at least one position that is crossed by the unique occurrence of a MUS.
3 The Smallest Attractors of Fibonacci Words
3.1 Properties of Fibonacci Words and Singular Words
Definition 4 ( and ).
For each , the th Fibonacci word is defined as , and for each . The th Fibonacci number is defined as , and for each . Note that .
Definition 5 (, ).
For , let and . For convenience, let and .
Below are known or simple observations concerning Fibonacci words.
Observation 6 (e.g. [2, 6, 9]).
The following propositions hold.
-
1.
For , .
-
2.
For , is a palindrome (by and induction).
-
3.
For , .
-
4.
For ,
Definition 7 (Singular Words).
Let , , , and for .
Notice that , and all singular words are palindromes. In the literature [15, 3], these words have been defined to be . However, we start from the above definition (Property 2 (4) in [15]) to simplify the presentation. The next lemma summarizes results shown in [15] that we utilize.
Lemma 8 ([15]).
The following lemma is essentially the same as what has been shown by Wen and Wen (Theorem 1 in [15]) for the infinite Fibonacci string.
Lemma 9.
For any , .
Proof.
Induction on . The equation holds for . Suppose it holds for all . Then,
where the last equation uses by Lemma 8 (1). Therefore, the equation holds for .
Corollary 10.
For any , occurs uniquely in and the first (leftmost) occurrence of in spans the range .
Proof.
cannot occur in nor contain (Lemma 8 (2)), nor cross the boundary of (Lemma 8 (3)). The range follows from and .
Lemma 11.
For any , and are the (only) MUSs of .
Proof.
occurs uniquely in ; It cannot occur after its first occurrence (characterized by Corollary 10) since it cannot occur in (Lemma 8 (2)) nor cross the boundary of as well as the boundary of (Lemma 8 (3)). The latter also implies the uniqueness of in . We have , from Corollary 10, and any substring containing them are unique. Since by Observation 6, it holds that and are repeating substrings. These are the maximal substrings of not containing nor . All substrings of these maximal substrings are repeating as well, and include all proper substrings of and . Therefore and are MUSs. Also, since a substring containing a MUS must be unique, there can be no other MUSs in .
Definition 12 ( and ).
For each , define and , i.e., the ranges of positions crossed by the MUSs and , respectively.
Proposition 13 ([10, Thm. 5]).
The size of the smallest string attractor of is for .
For any , a Fibonacci word has exactly two MUSs and the ranges of positions crossed by their occurrence are disjoint (Corollary 10, Lemma 11, Definition 12). Since an occurrence of a unique substring must contain an attractor position (Observation 3) and from Proposition 13, the smallest attractor must consist of one position from each of the two MUS ranges.
Observation 14.
For , .
In Section 3.2, we first characterize a subset of position pairs in that cannot be an attractor of by arguments based on the occurrence of singular words in . We then prove in Section 3.3 that all other position pairs are attractors of .
3.2 Invalid Attractor Position Pairs
Here, we characterize position pairs in that cannot be attractors of by using occurrences of singular words in . We first show that all occurrences of singular words in can be captured by their occurrences in our recursive definition (Definition 7). We interpret the recursion as a grammar rule, and show that each occurrence of singular words in corresponds to a node in the parse tree of this grammar, where a node in the parse tree is considered to span exactly the interval of positions corresponding to the substring it derives. See Figure 2 for a concrete example.
Lemma 15.
Consider the equations of Lemma 9 and Definition 7 as grammar rules that derive for , i.e., , . Then, for any , every occurrence of in corresponds to a node in the parse tree of this grammar.
Proof.
Due to Corollary 10, there is no occurrence of in before its first (leftmost) occurrence in a node of the parse tree. Suppose there is a later occurrence of that does not correspond to a node in the parse tree of the grammar, and consider the lowest common ancestor (LCA) in the parse tree of the leftmost position and rightmost position of the occurrence. From the above observation, if the LCA is , this implies that an occurrence of crosses a boundary of for some which violates Lemma 8 (3). Therefore, the LCA must be for some . Furthermore, since does not occur in (Lemma 8 (2)), the LCA must be for some , thus, . By definition, . Therefore, must have an occurrence in (i) crossing both boundaries between and , and between and (only when ), (ii) crossing only the boundary of and , or (iii) crossing only the boundary of and . Case (i) cannot happen since is not a substring of (Lemma 8 (2)). Case (ii) directly violates Lemma 8 (3) and Case (iii) also violates Lemma 8 (3) due to the fact that is a palindrome and the statement of Lemma 8 (3) holds for as well. In the parse tree of based on the grammar defined in the statement of Lemma 15, we say that the occurrence of is a center child of if it is derived by the rule . Note that has no (or an empty) center child. We say a position is crossed by a node in the parse tree if the occurrence of the string derived by the node crosses .
Lemma 16.
Let and . If or is crossed by a center child in the parse tree of some , then is not an attractor of .
Proof.
See Figure 3. and correspond to the ranges of positions crossed by the MUSs and of , respectively (Definition 12). Therefore, an attractor of size of must contain exactly one position from each of the ranges. By definition, and . Here, only occurs twice as children of , and does not occur elsewhere in the strings and (Lemma 15). Therefore, an attractor position must be crossed by one of the two occurrences of , and any position crossed by the center child of cannot be chosen as an attractor position, since it would not be crossed by . Similarly, there are three occurrences of ; two as children of and one as a center child of . However, since we cannot choose an attractor position in the center child of , an attractor position in must be crossed by one of the two occurrences of . Therefore, a position crossed by the center child of cannot be chosen as an attractor position. The argument can be repeated recursively; For , given that the attractor positions must be crossed by occurrences of and that were not center children in the sub-tree of the parse tree respectively of and , attractor positions in the respective center children and cannot be chosen.
Lemma 17.
Let and . If and is in the right child of the first occurrence of , then is not an attractor of .
Proof.
See Figure 4. Consider the occurrences of in . Due to Lemma 15, has only three occurrences in , and thus in , two of which are the left and right child of . Since the last occurrence is only followed by a single symbol , it follows that there can only be two occurrences of in . Therefore, for an attractor position to be crossed by , if one of the first two positions in (corresponding to the first two positions of ) is not chosen as an attractor position, then, we cannot choose a position in the right child of for the other attractor position. Here, notice that we require , since otherwise, the second occurrence of crosses the boundary of the center and right children of .
3.3 Valid Attractor Position Pairs
In this subsection, we show that the position pairs in that are not invalidated by Lemma 16 nor Lemma 17 are indeed attractors of .
Definition 18 (, , and ).
For , we define three subsets of positions within the first occurrence of ; let be the node in the parse tree corresponding to this occurrence. Let be the set of positions in the left child of that are not crossed by any center child. Similarly, let be the set of positions in the right child of that are not crossed by any center child. Further, let be the set of positions corresponding to the occurrence of in the leftmost path in the parse tree rooted at ( itself when ).
For example, , , . See Figure 2.
Observation 19.
, , , , , , and
| (1) | ||||
| (2) | ||||
| (3) |
for . For ,
| (4) |
Proof.
Equations (1) and (3) hold because, by Lemma 9, in the factorization , the offset between the starting positions of the first occurrences of and is . Equation 4 follows directly from Equation 3. Equation 2 holds because, in , the offset between the starting positions of the two occurrences of is .
The following is straightforward from the definitions and the above observation.
Observation 20.
For , , , , and .
The following holds since all singular words are palindromes and thus the parse tree rooted at each singular word is symmetric, implying that for any , and are a “mirrored” image of the other with respect to some mid-point.
Observation 21.
For any , , .
Using the sets of Definition 18, the results of Section 3.2 can be summarized as follows.
Corollary 22.
For , .
Proof.
Lemma 16 implies that an attractor position pair must be in , where and . Furthermore, Lemma 17 implies that if one of the attractor positions is in , then the other position must be in the set . If is even, this set is exactly . If is odd, only includes , but then is a center child and cannot be an attractor position by Lemma 16. Therefore, the other position will be in . These imply that . Below, we show that all position pairs in this set are actually attractors of .
Theorem 23.
For any , .
Note 24.
Since for , Theorem 23 implies .
Since Corollary 22 establishes , we prove using the following three lemmas.
Lemma 25.
For , if , then .
Proof.
See Figure 5. For any with , let and . Since and , and by Observation 21. Thus, . Since the mapping is bijective, it suffices to show that .
From Observation 6, is a prefix of . Essentially, are positions in that correspond to the positions in , mapped to the occurrence of , i.e., and . Thus, by Observation 2, all substrings of must have an occurrence that crosses or . In order to prove that is an attractor of , consider any substring that does not cross nor . Notice that since , we have . Also, since , we have .
-
1.
If , then , so is a substring of , which is a substring of .
-
2.
If , then is trivially a substring of .
-
3.
If , then so is a substring of , which is a substring of because .
In all these cases, is a substring of , which means has an occurrence that crosses or . Therefore, is an attractor of .
Lemma 26.
For , if , then .
Proof.
See Figure 6. For any with , let . We have since (Equation 2). Since the mapping is bijective, it suffices to show that .
Since is an attractor of , all substrings of have an occurrence crossing or . Consider substrings of that have occurrences crossing but not nor . Since and , all such occurrences are in a substring of . Furthermore, they have an occurrence crossing , since and also occurs positions to the left. Thus, all substrings of have an occurrence crossing or , and therefore, is an attractor of .
Lemma 27.
For , if , then .
Proof.
See Figure 7. For any with and , let , , and . Notice that , , and can be seen from Equation 4 and Observation 20. It can be also seen that (Equation 3), and (Equation 2). Thus, . Since the mapping is bijective, it suffices to show that .
Consider any substring that does not cross nor and the following cases.
-
1.
If , then is a substring of since .
-
2.
If , then is a substring of since , and is a prefix of .
-
3.
If , then is a substring of which crosses , since and .
-
4.
If , then is a substring of , since and .
For Case 3, has an occurrence that crosses , since , and there is an occurrence of , positions to the left (as a prefix of ). It remains to show that all substrings of have an occurrence crossing or . Since is an attractor of , , and , all substrings of have an occurrence that crosses or . Furthermore, as was the case for Case 3, any substring of crossing but not crossing is a substring of , and has an occurrence crossing . Therefore, any substring will cross or , and is an attractor of .
Proof of Theorem 23.
The proof is by induction. and can be confirmed by brute force computation:
Under the induction hypothesis and Note 24, the conditions of Lemmas 25, 26, and 27 hold for , and thus, together with Corollary 22 and the above base cases, the theorem holds.
Corollary 28.
For , and .
Proof.
It is clear that , and for . Therefore, and . Since and , we have from Theorem 23 that and .
4 The Smallest Attractors of Period-Doubling Words
Definition 29 ().
For each , the th period-doubling word is defined as , and where is a morphism defined by and . Note that .
Theorem 30.
. For , , where , , and .
Schaeffer and Shallit [14] showed that for arbitrary prefixes of length at least of the infinite period-doubling sequence, is a smallest attractor when the length is in , and , when the length is in . We consider only the length prefixes, but characterize all smallest string attractors.
Observation 31.
Since any occurrence of b in must have come from an occurrence of a in by , an occurrence of b in is always at an even position. Hence, bb cannot occur. This implies that an occurrence of aa starting at an odd position must be followed (provided it is not the end of the string) and preceded by ab, since it could only have come from .
Furthermore, the above implies the following corollary.
Corollary 32.
Any occurrence of a substring in with has the same parity, i.e., .
Observation 33.
The following are known or easily verifiable properties of period-doubling words.
-
(1)
For , where and .
-
(2)
For , , where .
-
(3)
For any such that , is a suffix of , and for any , is a prefix of .
We first show that the two position pairs are indeed attractors of .
Lemma 34.
For ,
Proof.
The statement can be verified by brute force for and . Suppose the statement holds for all . Let be an arbitrary substring of , and let be the shortest even-length substring of that contains the occurrence of , starting at an odd position, and ending at an even position, i.e., where , . It holds that where . Since (resp. ) are attractors of , has an occurrence crossing (resp. ) or , i.e., for some . Then, since , in the corresponding occurrence of will cross . Since is a substring of , has an occurrence crossing or ending just before . See Figure 8. Thus, to prove that and are attractors of , it remains to show that any substring ending just before (resp. ) or will have an occurrence crossing (resp. ) or .
Since , , and (Observation 33 (2)), any substring ending just before (resp. ) has an occurrence ending just before (resp. ). Since and , any such not crossing must be a suffix of (resp. ), having an occurrence ending just before . See Figure 9.
Finally, we claim that any substring ending just before will have occurrences crossing both and , or . We consider the following disjoint cases depending on .
-
1.
. See Figure 10 (a). Since the starting position of is , crosses both and .
- 2.
-
3.
for . See Figure 10 (b) and Figure 12. Due to Observation 33 (3), there is an occurrence of centered at (i.e., the first copy ending at) both and . Since is a suffix of and crosses , it also has an occurrence crossing .
-
4.
for . See Figure 10 (b) and (c), and Figure 12. is a suffix of . There is an occurrence of centered at both and . Due to Observation 33 (3), there must be an occurrence of also centered at and , and thus an occurrence of (Observation 33 (1)) of which is a suffix. Since , has occurrences that cross as well as .
-
5.
. and . It is easy to see that and from the definition of , so will cross both and , or .
Thus, , proving the lemma.
Next, we will show that no other position pairs can be attractors of with the help of the following lemma.
Lemma 35.
For , let and and . Then, are both even and .
Proof.
The strings aaa, aab, baa, bab, abab, aabaa, aabab, babab, babaa, ababab are all substrings of for . It is clear that is even from Observation 31.
We first claim that . Suppose to the contrary that . Then, for aaa to have an occurrence crossing , , where the underlined a corresponds to position . From Observation 31, we have , where the underlined b corresponds to position . In order for the substrings baa and bab to have an occurrence crossing one of these positions, , where the bold a and ab are due to Observation 31. Next, in order for the substrings aabaa and aabab to have an occurrence crossing or , and . However, then, there cannot be an occurrence of ababab that crosses or contradicting that they are an attractor.
Next, we claim that is even. If it is odd, then, from the above arguments, . We also have . For aab and abab to cross or , . Furthermore, for aabaa to cross or , . However, then at least one of babab and babaa cannot cross or .
Finally, consider any substring of . If , then, from the above arguments, since could not have been derived by , and since must have been derived by . Hence, crosses or . If , consider the corresponding substring in . Since is an attractor of , has an occurrence crossing or . Furthermore, since and the parity of its occurrences is determined uniquely (Corollary 32), an occurrence of at position in crossing or implies an occurrence of at position in crossing or .
Proof of Theorem 30.
Assume the statement of Theorem 30 holds for all . Lemma 35 implies that any element other than or in would imply an element in not in contradicting the induction hypothesis. Together with Lemma 34, this completes the proof.
While we studied in earlier sections the smallest attractors of Fibonacci words and period-doubling words of higher orders ( for and for ), for completeness, we list the smallest attractors of lower orders in Figure 13.
5 Discussion
Some natural related open problems are:
-
Characterization of all smallest bidirectional macro schemes (BMS) for the same family of strings considered.
-
Characterization of all smallest string attractors and BMS for arbitrary prefixes of the considered infinite sequence.
References
- [1] Julien Cassaigne, France Gheeraert, Antonio Restivo, Giuseppe Romana, Marinella Sciortino, and Manon Stipulanti. New string attractor-based complexities for infinite words. J. Comb. Theory, Ser. A, 208:105936, 2024. doi:10.1016/J.JCTA.2024.105936.
- [2] Aldo de Luca. A combinatorial property of the Fibonacci words. Inf. Process. Lett., 12(4):193–195, 1981. doi:10.1016/0020-0190(81)90099-5.
- [3] Gabriele Fici. Factorizations of the Fibonacci infinite word. J. Integer Seq., 18(9):15.9.3, 2015. URL: https://cs.uwaterloo.ca/journals/JIS/VOL18/Fici/fici5.html.
- [4] Lucian Ilie and William F. Smyth. Minimum unique substrings and maximum repeats. Fundam. Informaticae, 110(1-4):183–195, 2011. doi:10.3233/FI-2011-536.
- [5] Dominik Kempa and Nicola Prezza. At the roots of dictionary compression: string attractors. In Ilias Diakonikolas, David Kempe, and Monika Henzinger, editors, Proceedings of the 50th Annual ACM SIGACT Symposium on Theory of Computing, STOC 2018, Los Angeles, CA, USA, June 25-29, 2018, pages 827–840. ACM, 2018. doi:10.1145/3188745.3188814.
- [6] Donald E. Knuth, James H. Morris Jr., and Vaughan R. Pratt. Fast pattern matching in strings. SIAM J. Comput., 6(2):323–350, 1977. doi:10.1137/0206024.
- [7] Kanaru Kutsukake, Takuya Matsumoto, Yuto Nakashima, Shunsuke Inenaga, Hideo Bannai, and Masayuki Takeda. On repetitiveness measures of Thue–Morse words. In Christina Boucher and Sharma V. Thankachan, editors, String Processing and Information Retrieval - 27th International Symposium, SPIRE 2020, Orlando, FL, USA, October 13-15, 2020, Proceedings, volume 12303 of Lecture Notes in Computer Science, pages 213–220. Springer, 2020. doi:10.1007/978-3-030-59212-7_15.
- [8] N. Jesper Larsson and Alistair Moffat. Offline dictionary-based compression. In Data Compression Conference, DCC 1999, Snowbird, Utah, USA, March 29-31, 1999, pages 296–305. IEEE Computer Society, 1999. doi:10.1109/DCC.1999.755679.
- [9] M. Lothaire. Sturmian Words, volume 90 of Encyclopedia of Mathematics and its Applications, pages 45–110. Cambridge University Press, 2002.
- [10] Sabrina Mantaci, Antonio Restivo, Giuseppe Romana, Giovanna Rosone, and Marinella Sciortino. String attractors and combinatorics on words. In Alessandra Cherubini, Nicoletta Sabadini, and Simone Tini, editors, Proceedings of the 20th Italian Conference on Theoretical Computer Science, ICTCS 2019, Como, Italy, September 9-11, 2019, volume 2504 of CEUR Workshop Proceedings, pages 57–71. CEUR-WS.org, 2019. URL: https://ceur-ws.org/Vol-2504/paper8.pdf.
- [11] Sabrina Mantaci, Antonio Restivo, Giuseppe Romana, Giovanna Rosone, and Marinella Sciortino. A combinatorial view on string attractors. Theor. Comput. Sci., 850:236–248, 2021. doi:10.1016/J.TCS.2020.11.006.
- [12] Takuya Mieno, Shunsuke Inenaga, and Takashi Horiyama. RePair grammars are the smallest grammars for Fibonacci words. In Hideo Bannai and Jan Holub, editors, 33rd Annual Symposium on Combinatorial Pattern Matching, CPM 2022, Prague, Czech Republic, June 27-29, 2022, volume 223 of LIPIcs, pages 26:1–26:17. Schloss Dagstuhl – Leibniz-Zentrum für Informatik, 2022. doi:10.4230/LIPIcs.CPM.2022.26.
- [13] Hamoon Mousavi. Automatic theorem proving in Walnut, 2021. arXiv:1603.06017.
- [14] Luke Schaeffer and Jeffrey Shallit. String attractors for automatic sequences, 2024. arXiv:2012.06840.
- [15] Zhi-Xiong Wen and Zhi-Ying Wen. Some properties of the singular words of the Fibonacci word. Eur. J. Comb., 15(6):587–598, 1994. doi:10.1006/EUJC.1994.1060.
Appendix A Using Walnut to Characterize the Smallest Attractors
Using the approach by Schaeffer and Shallit [14], we can characterize the smallest attractors of period-doubling and Fibonacci words using the following Walnut program. Below, we only introduce the connection and do not give rigorous arguments.
def pdfaceq "k+i>=j & A u,v (u>=i & u<=j & v+j=u+k) => PD[u]=PD[v]": def pdsa2 "(i1<n) & (i2<n) & Ak,l (k<=l & l<n) => (Er,s r<=s & s<n & (s+k=r+l) & $pdfaceq(k,l,s) & ((r<=i1 & i1<=s) | (r<=i2 & i2<=s)))": def pdfa1 "An (n>=2) => Ei1,i2 $pdsa2(i1,i2,n)": def pdfa2 "$pdsa2(i1,i2,n) & i1 < i2": def fibfaceq "?msd_fib k+i>=j & A u,v (u>=i & u<=j & v+j=u+k) => F[u]=F[v]": def fibsa2 "?msd_fib (i1<n) & (i2<n) & Ak,l (k<=l & l<n) => (Er,s r<=s & s<n & (s+k=r+l) & $fibfaceq(k,l,s) & ((r<=i1 & i1<=s) | (r<=i2 & i2<=s)))": def fibfa1 "?msd_fib An (n>=2) => Ei1,i2 $fibsa2(i1,i2,n)": def fibfa2 "?msd_fib $fibsa2(i1,i2,n) & i1 < i2":
The code for the automaton pdfa2 for period-doubling words is taken from [14]. The code for fibfa2 only changes PD (period-doubling words) to F (Fibonacci words), and specifies the numeration system the corresponding automaton is defined for.
See Figures 14 and 15. While these automata characterize the set of all smallest string attractors of arbitrary prefixes of the period-doubling words or Fibonacci words, their interpretation is not straightforward. To limit the lengths of prefixes to the words we consider, we can modify the above to:
reg pow2 msd_2 "10*": def pdsapow2 "(i1<n) & (i2<n) & (i1<i2) & $pow2(n) & Ak,l (k<=l & l<n) => (Er,s r<=s & s<n & (s+k=r+l) & $pdfaceq(k,l,s) & ((r<=i1 & i1<=s) | (r<=i2 & i2<=s)))": reg fibpow msd_fib "10*": def fibsaf "?msd_fib (i1<n) & (i2<n) & (i1<i2) & $fibpow(n) & Ak,l (k<=l & l<n) => (Er,s r<=s & s<n & (s+k=r+l) & $fibfaceq(k,l,s) & ((r<=i1 & i1<=s) | (r<=i2 & i2<=s)))":
Figure 16 shows the sub-automaton pdsapow2 of pdfa2 for paths corresponding to prefixes of of lengths , and can be used to verify the results of Theorem 30. For Fibonacci words, Figure 17 shows a sub-automaton fibsaf of fibfa2 containing only the accepting paths for prefixes of length , which can be used to verify the results of Theorem 23.
