Finite test sets for morphisms which are square-free on some of Thue's square-free ternary words
James D. Currie

TL;DR
This paper characterizes when a morphism preserves square-freeness on infinite words over a ternary alphabet, showing it suffices to check factors up to length 8 for certain sets of factors.
Contribution
It introduces finite test sets for morphisms to determine square-freeness on specific classes of infinite words, simplifying verification processes.
Findings
Square-freeness of morphisms can be tested on finite factors of length 8 or less.
The result applies to words avoiding certain factor sets $S$.
Provides a practical criterion for morphism analysis in combinatorics on words.
Abstract
Let be one of and , and let be an infinite square-free word over with no factor in . Suppose that is a non-erasing morphism. Word is square-free if and only if is square-free on factors of of length 8 or less.
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
Topicssemigroups and automata theory · Geometric and Algebraic Topology · Algorithms and Data Compression
Finite test sets for morphisms which are square-free on some of Thue’s square-free ternary words
James D. Currie
Department of Mathematics and Statistics
University of Winnipeg
Winnipeg, Manitoba R3B 2E9, Canada
Abstract
Let be one of and , and let be an infinite square-free word over with no factor in . Suppose that is a non-erasing morphism. Word is square-free if and only if is square-free on factors of of length 7 or less.
The papers of Axel Thue on square-free words [9, 10] are foundational to the area of combinatorics on words. A word is square-free if we cannot write , where is a non-empty word. The longest square-free words over the 2-letter alphabet are and , each of length 3, but Thue showed that arbitrarily long square-free words exist over a 3-letter alphabet. Infinite square-free words over finite alphabets are routinely encountered in combinatorics on words, and are frequently used as building blocks in constructions. (See [6, 7] for further background and definitions.)
Let be an infinite square-free word over . Thue showed that must contain every length 2 square-free word over as a factor. However, Thue showed that the same is not true for length 3 square-free words over . For each of , and , he constructed an infinite square-free word over with no factor in . The infinite square-free word over with no factor in has been called vtm (for ‘variation of Thue-Morse’), and has been used in constructions in several papers [2, 4, 5]. Various constructions involve the necessity of showing (vtm) to be square-free for particular morphisms . In this paper, we give a simple testable characterization of morphisms such that vtm) is square-free; we do the same in the case where vtm is replaced by an infinite square-free word over with no factors in .
From now on, fix to be one of and , and let be an infinite square-free word over with no factor in . We establish the following:
Theorem 1**.**
Suppose that is a non-erasing morphism. Word is square-free if and only if is square-free on factors of of length 7 or less.
Our theorem says that to establish square-freeness of , one need only check for square-freeness on a finite test set. A variety of similar theorems were proved by Crochemore [3]; in particular, a morphism defined on preserves square-freeness exactly when it preserves square-freeness on words of of length at most 5. Note that the theorem of the present paper tests a weaker property; while is square-free, we do not require to be square-free, for example. Finite test sets for morphisms preserving overlap-freeness have also been well-studied [8].
The theorem suggests a couple of open problems:
Problem 1**.**
Is the constant 7 in Theorem 1 optimal?
Problem 2**.**
Suppose is an infinite square-free word over with no factor in . Is there a constant such that for any non-erasing morphism on , is square-free if and only if it is square-free on factors of of length at most ?
Write
[TABLE]
Suppose that is a non-erasing morphism which is square-free on factors of of length 7 or less.
Lemma 1**.**
Suppose is a factor of , where and is a factor of . Then .
Proof.
If is a letter of , and is a factor of ,
[TABLE]
Since is non-erasing, this forces , giving .
If is not a letter of , then is a square-free word over a two-letter alphabet, so that ∎
Lemma 2**.**
Suppose that is a prefix or suffix of , where . Then .
Proof.
We give the proof where is a prefix of . (The other case is similar.) Suppose . Then must be a factor of , and is square-free. However, begins with the square , contradicting the square-freeness of on factors of of length at most 7.∎
Lemma 3**.**
There is no solution to the equation such that , is a suffix of , is a suffix of , is a non-empty prefix of , is a factor of .
Proof.
Suppose are such that , is a suffix of , is a suffix of , is a non-empty prefix of , is a factor of , and .
Since is a non-empty prefix of , but also a suffix of , we see that contains square , so that is not a factor of . This forces . On the other hand, since is a factor of , we conclude that . Again, is a prefix of , but also a suffix of , so that contains a square. Since is a factor of , it follows that . Similarly, contains a square, but is a factor of , so that that . Finally, we see that contains a square. Let be the last letter of . We conclude that . However, now is a squarefree word of length 4 over the two-letter alphabet . This is impossible. ∎
The symmetrical lemma is proved analogously:
Lemma 4**.**
There is no solution to the equation such that , , is a prefix of , is a non-empty suffix of , is a prefix of , is a factor of .
Theorem 2**.**
Suppose that contains a non-empty square. Then contains a factor , , , , such that is not a factor of .
The proof of Theorem 2 will use several lemmas. Suppose that contains a non-empty square , with as short as possible. Write , such that
[TABLE]
[TABLE]
[TABLE]
where are non-negative integers, and for each non-negative integer , , and is a prefix of , but . This notation is not intended to exclude the possibilities that , and/or .
Remark 1**.**
Since is square-free on factors of of length at most 7, but contains the square , we must have .
Remark 2**.**
We cannot have ; otherwise suffix of is a factor of , and is a factor of suffix of . Then, is a factor of , forcing by Lemma 1, so that , a contradiction. Reasoning, in the same way, we show that .
For , let be the suffix of such that . By our choice of , Then
[TABLE]
Remark 3**.**
Since , we must have and/or
Lemma 5**.**
We must have and .
Proof.
We give the proof that . (The proof of the other assertion is similar.) Suppose for the sake of getting a contradiction that . Then . It follows that for some non-empty prefix of . Similarly, one shows that for some non-empty suffix of . Now , and . However, either , or . If , then for some non-empty prefix of which contradicts Lemma 3, letting , , , , , .
In the case where , we get the analogous contradiction using Lemma 4. ∎
Lemma 6**.**
We have , , , and , .
Proof.
To begin with we show that . Since both words are suffixes of , it suffices to show that . Suppose for the sake of getting a contradiction that .
By the previous lemma, . Let be greatest such that Thus , and
[TABLE]
It follows that , for some non-empty suffix of . Therefore, contains the square factor , forcing . If , then is a prefix of , and Lemma 2 forces . This is contrary to our choice of . We may therefore write where is non-empty.
Now is a suffix of . Let be greatest such that is a suffix of ; thus . It follows that a non-empty prefix of is a suffix of ; this implies contains a square, whence . Let be greatest such that ; thus . Each of and is a suffix of . Since , we conclude that is a suffix of . By the choice of , does not have letter as a factor; it is thus a square-free word over a 2-letter alphabet, whence . However, is a suffix of , so that the square is a factor of This is impossible, since is a factor of of length at most 4.
The assumption leads to a contradiction. The assumption leads to a similar contradiction, and we conclude that , as desired.
Next, we show that and , . Suppose that . (The other case is similar.) Suppose now that we have shown that for some , that
[TABLE]
This is true when ; i.e., .
From (1), one of and is a suffix of the other. Together with (2), this implies that one of and is a suffix of the other. By Lemma 2, this implies that , and by combining this with (2),
[TABLE]
By induction we conclude that
[TABLE]
which implies , . In particular, we note that
[TABLE]
If we now have , then , and (1) and (4) imply that . Then is a suffix of and Lemma 2 forces . Then (1) and (4) force , contrary to our choice of . We conclude that . From (1) and (4) we conclude that , as desired. ∎
Proof of Theorem 2.
By Lemma 6, contains a factor , where , , , . This gives .
Since is square-free, we cannot have ; otherwise contains the square ; similarly, . To see that is not a factor of , we note that is square-free on factors of of length at most 7, but contains the square ; this is a square since and . Since , we conclude that is not a factor of . ∎
Lemma 7**.**
If , the only length 3 squarefree words over which are not factors of are and . In addition, contains no factor of the form or .
Proof.
Thue [10] showed that a squarefree word over not containing or as a factor contains every other length 3 square-free word as a factor.
Suppose contains a factor . Since is not a factor of , . Since and are factors of , and hence square-free, the first letter of cannot be or , and must be . Similarly, the last letter of must be . But contains , and thus . This is a contradiction. Therefore contains no factor .
Replacing by and vice versa in the preceding argument shows that contains no factor . ∎
Combining Theorem 2 and Lemma refaba,cbc gives this corollary:
Corollary 1**.**
If and is square-free on factors of of length at most 7, then is squarefree.
Lemma 8**.**
If , the only length three squarefree words over which are not factors of are and . In addition, contains no factor of the form or , .
Proof.
Thue [10] showed that a squarefree word over not containing or as a factor contains every other length 3 square-free word as a factor.
Suppose contains a factor , . Since and are factors of , and hence square-free, the first letter of cannot be or , and must be . Similarly, the last letter of must be . However, since is a factor of , but is not, the second letter of cannot be and must be . Write . Then contains the square , which is impossible. We conclude that contains no factor , .
Replacing by and vice versa in the preceding argument shows that contains no factor , . ∎
Corollary 2**.**
If and is square-free on factors of of length at most 7, then is square-free.
Combining Corollaries 1 and 2 establishes our main result.
Theorem 1: Suppose that is a non-erasing morphism. Word is square-free if and only if is square-free on factors of of length 7 or less.
Remark 4**.**
The square-free word where has no factors or . It follows that any analogous theorem for , with an analogous proof, would require us to replace 7 by a value of at least
The reference list from the paper itself. Each links out to its DOI / PubMed record.
- 1[1] J. Berstel, Axel Thue’s Papers on Repetitions in Words: a Translation . Publications du Laboratoire de Combinatoire et d’Informatique Mathématique 20 Université du Québec à Montréal (1995).
- 2[2] F. Blanchet-Sadri, J. Currie, N. Fox, N. Rampersad, Abelian complexity of fixed point of morphism 0 → 012 , 1 → 02 , 2 → 1 formulae-sequence → 0 012 formulae-sequence → 1 02 → 2 1 0\rightarrow 012,1\rightarrow 02,2\rightarrow 1 , INTEGERS 14 (2014), A 11.
- 3[3] M. Crochemore, Sharp characterizations of squarefree morphisms Theoret. Comput. Sci. , 18 (2) (1982), 221–226.
- 4[4] J. D. Currie. Which graphs allow infinite nonrepetitive walks?, Discrete Math. , 87 ’: 249–260, 1991.
- 5[5] James Currie, Tero Harju, Pascal Ochem, Narad Rampersad, Some further results on squarefree arithmetic progressions in infinite words, ar Xiv : 1901.06351.
- 6[6] M. Lothaire, Combinatorics on Words . Cambridge University Press, Cambridge (1997).
- 7[7] M. Lothaire, Algebraic Combinatorics on Words . Cambridge University
- 8[8] G. Richomme, F. Wlazinski, Overlap-free morphisms and finite test-sets Discrete Appl. Math. , 143 (2004), 92–109.
