On some interesting ternary formulas

We show that, up to renaming of the letters, the only infinite ternary words avoiding the formula $ABCAB.ABCBA.ACB.BAC$ (resp. $ABCA.BCAB.BCB.CBA$) have the same set of recurrent factors as the fixed point of $\texttt{0}\mapsto\texttt{012}$, $\texttt{1}\mapsto\texttt{02}$, $\texttt{2}\mapsto\texttt{1}$. Also, we show that the formula $ABAC.BACA.ABCA$ is $2$-avoidable. Finally, we show that the pattern $ABACADABCA$ is unavoidable for the class of $C_4$-minor-free graphs with maximum degree $3$. This disproves a conjecture of Grytczuk.


Introduction
A pattern p is a non-empty finite word over an alphabet ∆ = {A, B, C, . . .} of capital letters called variables. An occurrence of p in a word w is a non-erasing morphism h : ∆ * → Σ * such that h(p) is a factor of w. The avoidability index λ(p) of a pattern p is the size of the smallest alphabet Σ such that there exists an infinite word over Σ containing no occurrence of p.
A variable that appears only once in a pattern is said to be isolated. Following Cassaigne [1], we associate a pattern p with the formula f obtained by replacing every isolated variable in p by a dot. The factors between the dots are called fragments.
An occurrence of a formula f in a word w is a non-erasing morphism h : ∆ * → Σ * such that the h-image of every fragment of f is a factor of w.
As for patterns, the avoidability index λ(f ) of a formula f is the size of the smallest alphabet allowing the existence of an infinite word containing no occurrence of f . Clearly, if a formula f is associated with a pattern p, every word avoiding f also avoids p, so λ(p) λ(f ). Recall that an infinite word is recurrent if every finite factor appears infinitely many times. If there exists an infinite word over Σ avoiding p, then there exists an infinite recurrent word over Σ avoiding p. This recurrent word also avoids f , so that λ(p) = λ(f ). Without loss of generality, a formula is such that no variable is isolated and no fragment is a factor of another fragment. We say that a formula f is divisible by a formula f ′ if f does not avoid f ′ , that is, there is a non-erasing morphism h such that the image of any fragment of f ′ by h is a factor of a fragment of f . If f is divisible by f ′ , then every word avoiding f ′ also avoids f . Let Σ k = {0, 1, . . . , k − 1} denote the k-letter alphabet. We denote by Σ n k the k n words of length n over Σ k .
We say that two infinite words are equivalent if they have the same set of factors. Let b 3 be the fixed point of 0 → 012, 1 → 02, 2 → 1. A famous result of Thue [2,5,6] can be stated as follows: Theorem 1. [2,5,6] Every bi-infinite ternary word avoiding AA, 010, and 212 is equivalent to b 3 .
In Section 2, we obtain a similar result for b 3 by forbidding one ternary formula but without forbidding explicit factors in Σ * 3 . In the remainder of the paper, we discuss a counterexample to a conjecture of Grytczuk stating that every avoidable pattern can be avoided on graphs with an alphabet of size that depends only on the maximum degree of the graph.

Formulas closely related to b 3
For every letter c ∈ Σ 3 , σ c : Σ * 3 → Σ * 3 is the morphism such that σ c (a) = b, σ c (b) = a, and σ c (c) = c with {a, b, c} = Σ 3 . So σ c is the morphism that fixes c and exchanges the two other letters.
We consider the following formulas.
By considering divisibility, we can deduce that Theorem 2 holds for 72 ternary formulas. Since b 3 , σ 0 (b 3 ), and σ 2 (b 3 ) are equivalent to their reverse, Theorem 2 also holds for the 72 reverse ternary formulas.
Let w be a ternary recurrent word w avoiding f b . Suppose for contradiction that w contains a square uu. Then there exists a non-empty word v such that uuvuu is a factor of w. Thus, w contains an occurrence of f b given by the morphism A → u, B → u, C → v. This contradiction shows that w is square-free.
An occurrence h of a ternary formula over Σ 3 is said to be basic if {h(A), h(B), h(C)} = Σ 3 . As it is well-known, no infinite ternary word avoids squares and 012. So, every infinite ternary square-free word contains the 6 factors obtained by letter permutation of 012. Thus, an infinite ternary square-free word contains a basic occurrence of f b if and only if it contains the same basic occurrence of ABCAB.ABCBA. Therefore, w contains no basic occurrence of ABCAB.ABCBA.
A computer check shows that the longest ternary words avoiding f b , squares, 021020120, 102101201, and 210212012 have length 159. So we assume without loss of generality that w contains 021020120.
Suppose for contradiction that w contains 010. Since w is square-free, w contains 20102. Moreover, w contains the factor of 20120 of 021020120. So w contains the basic occurrence A → 2, B → 0, C → 1 of ABCAB.ABCBA. This contradiction shows that w avoids 010.
Suppose for contradiction that w contains 212. Since w is square-free, w contains 02120. Moreover, w contains the factor of 021020 of 021020120. So w contains the basic occurrence A → 0, B → 2, C → 1 of ABCAB.ABCBA. This contradiction shows that w avoids 212.
Thus c(n) = Θ n ln 6/ ln 3 = Θ n 1+ln 2/ ln 3 . Proof. Let R be the set of words u such that u is recurrent in an infinite binary word avoiding ABACA.ABCA. Let R ′ be the set of words u such that u is recurrent in an infinite binary word avoiding ABAC.BACA.ABCA. An occurrence of ABACA.ABCA is also an occurrence of ABAC.BACA.ABCA, so that R ′ ⊆ R.
Let us show that R ⊆ S. We study the small factors of a recurrent binary word w avoiding ABACA.ABCA. Notice that w avoid the pattern ABAAA since it contains the occurrence A → A, B → B, C → A of ABACA.ABCA. Since w contains recurrent factors only, w also avoids AAA.
A computer check shows that the longest binary words avoiding ABACA.ABCA, AAA, 1001101001, and 0110010110 have length 53. So we assume without loss of generality that w contains 1001101001.
Suppose for contradiction that w contains 1100. Since w avoids AAA, w contains 011001. Then w contains the occurrence A → 01, B → 1, C → 0 of ABACA.ABCA. This contradiction shows that w avoids 1100.
Suppose for contradiction that w contains 0101. Since w avoids 01010 and 10101, w contains 001011. Moreover, w avoids AAA, so w contains 10010110. Then w contains the occurrence A → 10, B → 0, C → 1 of ABACA.ABCA. This contradiction shows that w avoids 0101.
A binary word is a factor of the m a -image of some binary word if and only if it avoids {000, 111, 0101, 1100}. Indeed, both kinds of binary words are characterized by the same Rauzy graph with vertex set Σ 3 2 \ {000, 111}. So w is the m a -image of some binary word.
Obviously, the image by a non-erasing morphism of a word containing a formula also contains the formula. Thus, the pre-image of w by m a also avoids ABACA.ABCA. This shows that R ⊆ S.
Let us show that S ⊆ R ′ , that is, every word in S avoids ABAC.BACA.ABCA. We suppose for contradiction that a finite word w ∈ S avoids ABAC.BACA.ABCA and that m a (w) contains an occurrence h of ABAC.BACA.ABCA.
We say that a factor s is gentle if either |s| 3 or s ∈ {00, 01, 11}. By previous remarks, all the occurrences of the same gentle factor have the same position modulo 3.
First, we consider the case such that h(A) is gentle. This implies that the distance between two occurrences of h(A) is 0 (mod 3). Because of the repetitions h(ABA), h(ACA), and h(ABCA) are contained in the formula, we deduce that  This shows that S ⊆ R ′ . Since R ′ ⊆ R ⊆ S ⊆ R ′ , we obtain R ′ = R = S, which proves Theorem 3. 4 A counter-example to a conjecture of Grytczuk Grytczuk [3] has considered the notion of pattern avoidance on graphs. This generalizes the definition of nonrepetitive coloring, which corresponds to the pattern AA. Given a pattern p and a graph G, λ(p, G) is the smallest number of colors needed to color the vertices of G such that every non-intersecting path in G induces a word avoiding p.
We think that the natural framework is that of directed graphs, and we consider only non-intersecting paths that are oriented from a starting vertex to an ending vertex. This way, λ(p) = λ p, − → P where − → P is the infinite oriented path with vertices v i and arcs − −− → v i v i+1 , for every i 0. The directed graphs that we consider have no loops and no multiple arcs, since they do not modify the set of non-intersecting oriented paths. However, opposite arcs (i.e., digons) are allowed. Thus, an undirected graph is viewed as a symmetric directed graph: for every pair of distinct vertices u and v, either there exists no arc between u and v, or there exist both the arcs − → uv and − → vu. Let P denote the infinite undirected path. We are nitpicking about directed graphs because, even though λ AA, − → P = λ(AA, P ) = 3, there exist patterns such that λ p, − → P < λ(p, P ). For example, λ(ABCACB) = λ ABCACB, − → P = 2 and λ(ABCACB, P ) = 3. We do not attempt the hazardous task of defining a notion of avoidance for formulas on graphs.
A conjecture of Grytczuk [3] says that for every avoidable pattern p, there exists a function g such that λ(p, G) g(d(G)), where G is an undirected graph and d(G) denotes its maximum degree.
As a counterexample, we consider the pattern ABACADABCA which is 2-avoidable by the result in the previous section. Let us show that ABACADABCA is unavoidable on the infinite oriented graph − → G with vertices v i and arcs − −− → v i v i+1 and − −−−−−− → v 100i v 100i+2 , for every i 0. Notice that − → G is obtained from − → P by adding the arcs − −−−−−− → v 100i v 100i+2 . Suppose that − → G is colored with k colors. Consider the factors in the subgraph − → P induced by the paths from v 300ik+1 to v 300ik+200k+1 , for every i 0. Since these factors have bounded length, the same factor appears on two disjoint such paths p l and p r (such that p l is on the left of p r ). Notice that p l contains 2k + 1 vertices with index ≡ 1 (mod 100). By the pigeon-hole principle, p l contains three such vertices with the same color a. Thus, p l contains an occurrence of ABACA such that A → a on vertices with index ≡ 1 (mod 100). The same is true for p r . In − → G , the occurrences of ABACA in p l and p r imply an occurrence of ABACADABCA since we can skip an occurrence of the variable A in p l thanks to some arc of the form This shows that ABACADABCA is unavoidable on − → G , which has maximum degree 3.