The cycle rank of the box graph of an automatic word
Abstract.
For an infinite word , Bell asked whether the number of connected components of the variety of degree- truncated point modules of the monomial algebra is -regular whenever is -automatic, and reformulated it as the number of connected components of a graph on the factors of length of . We show that the question is exactly a question about cycles: , where is the subword complexity, the number of edges and the cycle rank, and the first two terms are -regular because they are first-order definable. So is -regular if and only if is. For binary words, is a forest as soon as at most one position carries two or more edges. Using Walnut we prove that this holds for every for the period-doubling, paperfolding, Thue–Morse, Rudin–Shapiro and Mephisto waltz words, with for the first two and for the last three. For the ternary word fixed by , , we prove that has exactly three triangles for every , so and : cycles occur, and the answer is still positive. Letter permutations preserving the factors act on , and the proofs use them to reduce to one pair of letters. This answers Bell’s question for these six words. We conjecture that is eventually constant for every word of linear subword complexity, which would answer the question in general.
Key words and phrases:
Automatic sequences, -regular sequences, subword complexity, point modules, monomial algebras, Walnut2020 Mathematics Subject Classification:
Primary 68R15; Secondary 11B85, 16S38, 03D051. Introduction
Let be a right-infinite word over a finite alphabet , let be the number of distinct factors of length of , and let be the closure of the orbit of under the left shift. Bell and Greenfeld describe the point modules of the graded monomial algebra , whose degree- component has dimension , through families of factors with a common right-infinite continuation [5]. In [4] Bell counts the irreducible components of the variety of truncated point modules: they correspond to the maximal extendable boxes , with , and for -automatic their numbers are -regular. He closes with the following question [4, §8].
Question 1 (Bell).
For a -automatic word , is the number of connected components of always -regular?
Bell restates it in terms of words. Let be the graph whose vertices are the factors of length of , with and joined when they differ in exactly one position and there is a right-infinite word with . Then the number of connected components of is the number of connected components of [4, §8]. Bell notes that the first-order method of Charlier, Rampersad and Shallit [8], which gives his counts of boxes, does not apply directly, since connectedness is not a first-order property.
Our first result isolates exactly what is not first-order. Write for the number of edges of and for its cycle rank, the dimension of its cycle space.
Theorem A (5).
For every infinite word , . If is -automatic, then and are -regular, so is -regular if and only if is. In particular, if is a forest for every , then is -regular.
The edges of carry a label, the position at which their two words differ. For binary words this gives a simple test for cycles (7): if at most one position carries two or more edges, is a forest. The labels and the edge counts are first-order, so the test can be decided with Walnut [9, 10].
Theorem B (8 and 10).
For every , the graph has the following edges and components:
-
(1)
period-doubling and paperfolding: exactly one edge at each position ; is a forest and ;
-
(2)
Thue–Morse, Rudin–Shapiro and the Mephisto waltz: exactly two edges, both at position , exchanged by the flip ; is a forest and ;
-
(3)
the -automatic word fixed by , , : exactly three triangles , with the prefixes of length of the three fixed points of , permuted by the rotation ; and .
Hence 1 has a positive answer for these six words.
So cycles do occur, and in the third case they do not prevent a positive answer. The letter symmetries organize the proofs: a permutation of the letters that preserves the factors of is an automorphism of every (3), so it is enough to prove the statements for one pair of letters, and the other edges and triangles follow. In the tribonacci word has one triangle, and in every case we computed the cycle rank is constant from on (2). We conjecture that this always happens.
2. The box graph
We use the notation of the introduction. A word is a factor of if for some ; the finite factors of the elements of are exactly the factors of , so if and only if every prefix of is a factor of .
Definition 2.
Two factors of the same length have a common continuation if there is a right-infinite word with . The box graph has the factors of length as vertices, and an edge between and if they differ in exactly one position and have a common continuation; is the label of the edge. We write for the number of edges, for the number of connected components, and .
By König’s lemma, and have a common continuation if and only if for every there is a word of length with and both factors of [4]. Every factor is a vertex, since a factor of length spans a zero-dimensional extendable box [4]; an extendable box of positive dimension is a connected subgraph of , and two maximal extendable boxes give intersecting components of exactly when they share a word. This is why is the number of connected components of [4, §8].
The integer is the cycle rank of : it is nonnegative, and it vanishes if and only if is a forest. An extendable box with two branching positions gives a -cycle, and an extendable box with a coordinate set of size gives a triangle; cycles may also run through several boxes.
Lemma 3 (symmetry).
Let be a permutation of , applied letter by letter to words, that maps the set of factors of to itself. Then , and induces an automorphism of every that preserves the labels of the edges.
Proof.
A right-infinite word lies in exactly when all its prefixes are factors, and preserves this property and its inverse does too, as permutes the finite set of factors of each length. So implies , and preserves the positions at which two words differ. ∎
Lemma 4 (short heads).
If has an edge with label , then there are letters and and a right-infinite word with .
Proof.
Write the two words of the edge as and with , and let be a common continuation. Let be the last letter of . Since is closed under the shift, and lie in ; put . ∎
3. The reduction to cycles
Let be -automatic. We work, as Bell does, in the first-order structure with . Every relation definable in it is -recognizable [6], and we use the counting theorem of Charlier, Rampersad and Shallit in the form stated in [4, §5]: if is -recognizable and every fibre is finite, then is -regular [8].
Theorem 5.
Let be an infinite word over a finite alphabet. Then for every . If is -automatic, the sequences and are -regular, and the following are equivalent:
-
(1)
is -regular;
-
(2)
is -regular.
Proof.
The identity is the definition of . Put and define, with all quantifiers over ,
where abbreviates . says that is the first occurrence of its factor of length ; says that the factors at and differ exactly at position ; and, by König’s lemma, says that they have a common continuation. So
each a fibre count of a definable relation with finite fibres, since a factor has one first occurrence. Both are -regular by the counting theorem. Since -regular sequences form a ring [1], is -regular, which gives the equivalence. ∎
Corollary 6.
If is -automatic and is eventually constant, in particular if is a forest for all large , then is -regular.
Proof.
An eventually constant sequence is -regular [1]. ∎
4. A cycle test for binary words
Lemma 7.
Let . If at most one label is carried by two or more edges of , then is a forest. In particular is a forest if every label is carried by at most one edge, or if all edges carry the same label.
Proof.
Over a binary alphabet, crossing an edge with label changes the letter at position and no other. Along a cycle every letter returns to its value, so every label occurs on the cycle an even number of times. If only one label occurred, the cycle would alternate between a word and the word obtained by changing position , and would not be simple. So a cycle uses two distinct labels, each at least twice, and two labels are each carried by at least two edges of . ∎
Over larger alphabets the lemma fails: the words , , may be joined pairwise by edges with label , and this happens in 6.
When all edges of a binary word carry the label , an edge is a pair with , determined by ; so is the number of words of length such that and are factors with a common continuation, that is, such that is a prefix of some with .
5. Six words
| word | morphism | coding | |
|---|---|---|---|
| period-doubling | , | — | |
| paperfolding | , , , | , | |
| Thue–Morse | , | — | |
| Rudin–Shapiro | , , , | , | |
| Mephisto waltz | , | — |
Theorem 8.
Let be one of the words of 1. For every , is a forest, and:
-
(1)
for period-doubling and paperfolding, every label is carried by exactly one edge, so and ;
-
(2)
for Thue–Morse, Rudin–Shapiro and the Mephisto waltz and , every edge has label and there are exactly two edges, so .
In particular is -regular for each of the five words, with as in 1.
Proof.
Each word is the image under a coding of the fixed point of a -uniform morphism, so it is -automatic, read by the automaton whose states are the letters and whose transitions on the digit are the -th letters of the images [2]; the automata are the files X*.txt of the ancillary material. We encode , and of 5 in Walnut [9], with , and decide the following sentences, where :
-
(S1)
every edge with has label ;
-
(S2)
two edges with the same label join the same pair of factors;
-
(S3)
every label is carried by an edge;
-
(L1)
for every there are exactly two factors of length such that and are factors with a common continuation.
Walnut returns TRUE for (S2) and (S3) on period-doubling and paperfolding, and for (S1) and (L1) on Thue–Morse, Rudin–Shapiro and the Mephisto waltz. For (1), every label is carried by exactly one edge, so is a forest by 7 and . For (2), all edges have label , so is a forest by 7, and by the remark after it is the number of words in (L1), which is . In both cases , and is -regular by 5, as and the constant are -regular. ∎
As controls, Walnut returns TRUE for the existence of edges at and on all five words, FALSE for (S1) on period-doubling and paperfolding, and FALSE for the statement that exactly one word satisfies (L1). For the graph is a single edge and for all five words.
Remark 9 (the flip).
For Thue–Morse, Rudin–Shapiro and the Mephisto waltz, Walnut also returns TRUE for: (F0) the factors are closed under the flip ; and (F1) the two words of (L1) are flips of each other. By 3 the flip is an automorphism of , and it exchanges the two edges.
Theorem 10.
Let be the fixed point starting with of , , , and let be the rotation of the letters. For every , the edges of are those of the three triangles , where runs over the prefixes of length of the fixed points , and . These triangles are disjoint, so , and , which is -regular.
Proof.
Since , permutes the three fixed points, with mod . Let be the set of their prefixes of length ; it has three elements, with first letters , , , and . Walnut returns TRUE for:
-
(R0)
the factors of are closed under ;
-
(R2)
for , a factor of length has and factors with a common continuation if and only if ;
-
(R3)
every element of is a factor;
-
(T)
for each , the words of length with are exactly , , ;
and FALSE for the control obtained from (R2) by replacing with the prefixes of alone. By (R0) and 3, is a label-preserving automorphism of each , and every unordered pair of distinct letters is for some .
Left extensions of infinite words. Let be right-infinite with for letters . Applying with , we get for . For every the prefix of length of satisfies the condition of (R2), so it lies in ; as the elements of are determined by their first letters, is one of the three fixed points, and so is .
All labels are . If had an edge with label , 4 would give letters and and with . By the previous paragraph is a fixed point, and then and are two words of (T) with the same first letter, which do not exist.
The edges with label . An edge with label is a pair with and a common continuation. Applying as above gives the pair , so by (R2), and . Conversely, for and any pair , (R2) and (R3) give an edge , and carries it to an edge joining and . So the edges are exactly the triangles with ; they are disjoint since the three words differ. A disjoint union of three triangles and isolated vertices has cycle rank , and . The sequence is -regular by 5. ∎
For the graph is the single triangle on the letters, and .
6. Cycles
| word | class | status | ||
|---|---|---|---|---|
| period-doubling, paperfolding | -automatic | 8, all | ||
| Thue–Morse, Rudin–Shapiro | -automatic | 8, all | ||
| Mephisto waltz | -automatic | 8, all | ||
| Cantor, , | -automatic | () | computed, | |
| vtm, , , | -automatic | computed, | ||
| , , | -automatic | 10, all | ||
| Fibonacci, , | Sturmian | computed, | ||
| tribonacci, , , | Arnoux–Rauzy | computed, |
2 collects the results and the computations. Two of the words have cycles: the ternary word of 10, with three triangles, and the tribonacci word, an Arnoux–Rauzy word of complexity [3], where has one triangle and one further edge, with label , so .
In every example the cycles are triangles of label- edges. Edges with label are always few when the complexity is linear: if and () are factors, then is left special, and the number of left special factors of length is at most , which is bounded when is linear [7]; so at most edges with label hang on each of a bounded number of words . Edges with other labels need not be few, since period-doubling has one at every position, but in every example they close no cycle.
Conjecture 11.
A weaker statement already suffices for 1: by 5, it is enough that be -regular. The binary case is a natural first test. By 7 a cycle of a binary word needs two labels each carried by at least two edges, and in none of the binary words of 2 do two labels carry two edges each.
Question 12.
Is a forest for all large for every binary word of linear subword complexity?
Code and data availability
The ancillary files are box_graph.py, which builds the words of 1 and 2 and computes , , , and the edge labels for by direct enumeration, and checks the triangles of the ternary word of 6, with its log; and the directory walnut/, which contains the word automata X*.txt (written by mkwords.py), the command files with the sentences (S1)–(S3), (L1), (F0), (F1), (R0), (R2), (R3), (T) and the controls, the script run_all.sh, and the logs. The Walnut computations used Walnut version 4.0.0, built from its source, with a GB heap; all of them together take about five minutes. The sentences for 10 are stated for the pair of letters and for words of length only, and the rotation supplies the rest; the corresponding sentences for all pairs of letters and all labels exceed that heap.
References
- [1] J.-P. Allouche and J. Shallit, The ring of -regular sequences, Theoret. Comput. Sci. 98 (1992), 163–197.
- [2] J.-P. Allouche and J. Shallit, Automatic Sequences: Theory, Applications, Generalizations, Cambridge University Press, 2003.
- [3] P. Arnoux and G. Rauzy, Représentation géométrique de suites de complexité , Bull. Soc. Math. France 119 (1991), 199–215.
- [4] J. Bell, Boxes in infinite words: complexity, automata, and point modules, arXiv:2611.21772, 2026.
- [5] J. P. Bell and B. Greenfeld, Noncommutative point spaces of symbolic dynamical systems, Adv. Math. 469 (2025), 110211.
- [6] V. Bruyère, G. Hansel, C. Michaux and R. Villemaire, Logic and -recognizable sets of integers, Bull. Belg. Math. Soc. Simon Stevin 1 (1994), 191–238.
- [7] J. Cassaigne, Special factors of sequences with linear subword complexity, in: Developments in Language Theory II (Magdeburg, 1995), World Scientific, 1996, 25–34.
- [8] E. Charlier, N. Rampersad and J. Shallit, Enumeration and decidable properties of automatic sequences, Internat. J. Found. Comput. Sci. 23 (2012), 1035–1066.
- [9] H. Mousavi, Automatic theorem proving in Walnut, arXiv:1603.06017, 2016.
- [10] J. Shallit, The Logical Approach to Automatic Sequences: Exploring Combinatorics on Words with Walnut, London Math. Soc. Lecture Note Ser. 482, Cambridge University Press, 2022.