Pattern avoidance in partial words over a ternary alphabet

Blanched-Sadri and Woodhouse in 2013 have proven the conjecture of Cassaigne, stating that any pattern with m distinct variables and of length at least 2 is avoidable over a ternary alphabet and if the length is at least 3 · 2m−1 it is avoidable over a binary alphabet. They conjectured that similar theorems are true for partial words – sequences, in which some characters are left “blank”. Using method of entropy compression, we obtain the partial words version of the theorem for ternary words.


Introduction.
Let Σ = {a, b, c, . . .} and ∆ = {A, B, C, . . .} be finite alphabets.We refer to elements of Σ as letters and to elements of ∆ as variables.A word w over some alphabet is a sequence of letters from this alphabet, an infinite word is an infinite sequence of letters.A factor of w is a subsequence of w consisting of consecutive letters.A prefix of w is a factor containing the first letter of w and a suffix is a factor containing its last letter.A pattern p is a word over ∆ and a doubled pattern is a pattern in which every variable occurs at least twice.A word w over Σ is an instance of p if there exists a morphism h : ∆ + → Σ + such that h(p) = w.A word w is said to avoid p if no factor of w is an instance of p.For example, aabaac contains an instance of ABA and abaca avoids AA.
A partial word over alphabet Σ is a sequence of characters from extended alphabet Σ = Σ∪{ }, an occurrence of is called a hole.For a partial word w we denote the set of positions of holes as holes(w).A partial word w is an instance of p if there exists a substitution of single letters from Σ to holes(w) such that the resulting word is an instance of p.For example, w = a ab contains an instance of AAA but it avoids ABBA and holes(w) = {2}.
The avoidability index λ(p) of pattern p is the size of the smallest alphabet Σ such that there exists an infinite word over Σ that avoids p.The partial avoidability index λ * (p) of pattern p is the size of the smallest alphabet Σ such that there exists an infinite partial word W over Σ avoiding p and with |holes(W )| = ∞.
(1) If p has length at least 2 k then λ(p) ≤ 3. ( It was known previously that above bounds are the best possible [6].Blanchet-Sadri and Woodhouse conjectured that for partial avoidability the first statement remains true for doubled patterns with at least 4 variables and the second remains true without changes.Proof of the first statement for partial words is the main result of this paper, i.e. we will prove that if p is a doubled pattern with k ≥ 4 variables and length at least 2 k , then λ(p) ≤ 3.

Tools and notation.
In this section we introduce a few classical combinatorial concepts and results which will be used in the proof.

Analytic combinatorics.
First we need several concepts of analytic combinatorics.We send readers not familiar with this topic to an excellent book of Flajolet and Sedgewick [3].We say that a number sequence (a i ) i∈N is of exponential order K n , which we abbreviate as a n K n iff: We will also use one of the basic ordinary generating functions operator, namely SEQ.The operator corresponds to the class of objects 1 + E + 1 + E 2 + . . .and represents sequences, i.e. the slots are not being permuted and there is exactly one empty sequence.We have .
Analytic combinatorics will be used in the proof as a tool for bounding asymptotic growth of coefficients of the generating function f (z) defined by an equation of type f (z) = z • φ(f (z)).The following theorem will allow us to do that: Theorem 2.1 (Flajolet,Sedgewick [3], Proposition IV.5).Let φ be a function analytic at 0, having non-negative Taylor coefficients such that φ(0) = 0. Let R ≤ +∞ be the radius of convergence of the series representing φ at 0. Under the condition, (1) lim there is a unique solution τ ∈ (0, R) of the characteristic equation: Then, the formal solution y(z) of the equation y(z) = z • φ(y(z)) is analytic at 0 and its coefficients satisfies exponential growth formula: . Based on the above theorem we introduce the general method for bounding the exponential order of combinatorial sequences proposed by Zydroń [9].Let f (z) = Σ ∞ i=0 f i z i be a generating function satisfying an equation f (z) = z • φ(f (z)) where φ(y) satisfies the following conditions: I φ(0) = 0, II φ(y) is analytic in 0, III ∀ n≥0 [y n ]φ(y) ≥ 0, IV lim y→R − φ(y) = +∞, where R is the finite radius of convergence of power series expansion of φ(y) at 0.
Define function z(f ) = f φ(f ) -an inversion of f (calculated from the equation defining f ).Note that the condition IV implies that: and hence that the condition (1) of Theorem 2.1 is satisfied.It means that φ(y) satisfies all conditions of Theorem 2.1 so there is precisely one solution of the equation ( 2) and hence also the equation z (τ ) = 0. Note that z(0) = lim f →R − z(f ) = 0 and z(f ) is non-negative in the interval (0, R).Based on the above fact we deduce that z(f )'s only maximum in (0, R) is the point τ .Moreover, from thesis of Theorem 2.1 we get that z(τ ) is a radius of convergence of f (z).Based on the above observations we are ready to propose a general method for bounding exponential order of the coefficients of f : Step 1. Express generating function f as solution of the equation where φ satisfies conditions I-IV.
Step 2. Basing on the above equation, calculate function z(f ) -an inversion of f (z).
Step 3. Find a point f 0 inside the interval (0, R) where R is a radius of convergence of φ(f ) such that z(f 0 ) > 1 K for some K.
Step 4. Basing on Theorem 2.1, deduce that radius of convergence of the function f (z) is greater than 1  K and hence that its coefficients are of exponential order at most K n .Note that K does not need to be the maximal value of z(f ), which allows us to use numerical computations in the proof.

Dyck paths.
A Generalized Dyck path of type (n, m) is a path on the square lattice with steps (1, 1) and (1, −1) from (0, 0) to (n, m) that never falls below the x-axis.We denote the number of all generalized Dyck paths of type (m, n) as D m,n .Dyck paths are a standard example of structures counted by Catalan numbers -D 2n,0 is equal to C n .3. Proof.The proof follows the general framework of Moser-Tardosz algorithmisation of Lovasz local lemma [7] adjusted for application to sequences by Grytczuk, Kozik and Micek [4].We will refer to this method as entropy compression.In the proof we assume that it is not possible to construct an infinite word over alphabet {a, b, c} avoiding pattern p and therefore there is such n that every word of length n contains an instance of p. Hence a naive algorithm that given an infinite sequence of letters S = {a, b, c} * tries to construct a word W of length n avoiding pattern p never stops.We use this fact to get the desired contradiction by compressing initial segments of the sequence S to a better extent than it is actually possible.There are 3 M possible prefixes of sequence S of length M and we want to show that it is possible to reconstruct any such prefix from a structure created by the algorithm and that there is strictly less than 3 M such structures possible to obtain after M steps of the algorithm.Proof.Let us fix a pattern p with at least 4 variables and arbitrarily large N .We will prove by contradiction that it is possible to construct a word W = w 1 . . .w N over alphabet Σ = {a, b, c} with holes(W ) = {i : 100 | i} avoiding p.We consider Algorithm 1 running on a random source S that tries to assign letters to all positions of W (even the ones with positions divisible by 100 for easier analysis) and retract all instances of p treating positions in holes(W ) as proper holes when it comes to pattern identification and retracting letters assigned to them normally.Note that by our assumption that appropriate assignment of letters does not exist, the algorithm never stops.Let us fix some input sequence S and run the algorithm for M steps (i.e.M iterations of the main loop).With every such run we associate some structure describing the behavior of the algorithm.Clearly such a structure depends only on M initial values of S.More importantly sequences S and S which differ on at least one of M initial positions would produce different structures.The structure we use for description of a run of the algorithm is a tuple (P, L, R, H, F ) where: (1) P = (p 1 , . . ., p M ) is a sequence of numbers such that p i is the number of places with assigned symbols after i-th step (i.e. the number of indexes i for which w i is defined), (2) L = (L 1 , . . ., L s ) is a sequence of sets of numbers such that L i = {l i,1 , . . ., l i,k−1 } where l i,j is a number of letters assigned to j-th variable in the i-th retracted occurrence of p during the runtime of the algorithm, (3) R = (r 1 , . . ., r r ) is a sequence of letters such that after retraction of pattern p, letters assigned to variables A, B, C, . . .are added as suffixes of S, (4) H = {h 1 , . . .h v } is a sequence of letters assigned to holes in retracted instances of p.After every retraction we add to H as many letters as many holes were retracted.It is somewhat redundant with R but it does not make an asymptotic difference, (5) F = (f 1 , . . ., f n ) is a sequence of symbols left in the word W after M steps of the algorithm.Now we need to prove that this encoding of a prefix of S is loseless and that it is an actual compression for M large enough.
Loselessness.We prove that it is possible to reconstruct the first M elements of the input sequence S from a tuple (P, L, R, H, F ) constructed in M steps of the algorithm.Given (P, L, R, H, F ) we are going to decode S(M ) and (P , L , R , H , F ) -tuple constructed by the algorithm running for M − 1 steps on the same input sequence S. Then by simple iteration we can extract all values S(i) for i ∈ {1, . . ., M }.We consider two cases: Case 1.If p M = p M −1 + 1 then no pattern instance was retracted during the last step of the algorithm.Then: where k > 0, then in the last step there was a retraction of r elements that formed an instance of the pattern p. Then from the last element of L we can reconstruct the structure of this instance, i.e. numbers of letters assigned to each of the variables.From the last element of P we know in which place of the word W an instance occurred and hence the number and placement of holes present in the instance.From the last elements of R we are able to reconstruct the exact letters forming an instance (number of letters we need to subtract from R is equal to the sum of lengths of subwords substituted to variables, which we already know from L).Note that these letters were not necessarily the letters assigned to the places with holes so finally from H we reconstruct the letters assigned to all holes in the instance (number of holes is already known from P ).Knowing precisely the structure of the retracted fragment, we can find the last element of S and the quintuple (P , L , R , H , F ): -S(M ) is the last element of the reconstructed retracted fragment, -P is one element shorter, -L is one element (i.e.set) shorter, -R is shorter by all elements used to reconstruct the retracted fragment, -H is shorter by as many elements as many holes were in the reconstructed fragment, -F is equal to F with the reconstructed fragment added as a suffix without the last element added at the end.
Compression.We are concerned with the asymptotic number of descriptions when M tends to infinity.We will bound P, L, R together and then separately H and F .
Bounding P, L, R. We use analytic combinatorics to find an exponential order of sequence (T i ) i∈N of possible tuples (P, L, R) occurring after i steps of the algorithm.Before we can use the previously presented method, we need to apply two transformations on P .First we transform P 's into generalized Dyck paths by adding downsteps for every retraction -if in P number n follows number k and n < k we add between them all natural numbers between n and k.For example sequence (0, 1, 2, 3, 4, 1, 2, 0) would be transformed into ( . Such modified P is a sequence in which two consecutive numbers differ by exactly 1, which clearly corresponds to a generalized Dyck path.Note that this operation makes P at most two times longer.
Second transformation we apply only to the paths ending on level other than first.Every such a path we artificially prolong by adding sequence of upward steps until it reaches level N and then sequence of downward steps until it reaches level 1.We add upward steps because we want to keep the condition that all the paths have descendances at least as long as many variables are in the pattern p.
Note that if M (numbers of steps of Algorithm 1, which is now close to half of the length of paths) will be big enough in comparison to N , then such operation will not change the exponential order of the number of our paths.We construct the desired generating function step by step.
Let P (z) be the generating function encoding all Dyck paths with falls of lengths being lengths of possible retractions in the algorithm, P L(z) be the generating function of such Dyck paths encoded together with possible L's and finally t(z) be the desired generating function for P, L and R. We will use Flajolet's symbolic operators notation [3] for operations on combinatorial classes.We use slightly modified last passages decomposition for Dyck paths.Let P 0,n (z) be a generating function of possible paths starting at level 0 and ending at level n.Recording the times at which each level 0, . . ., n is last traversed gives us P 0,n (z) = P 0,1 (z) n−1 so summing up for all possible last descendances, we get P (z) = z(1 + SEQ(P (z))).Since together with last descendance we want to record L we need to divide it into k parts corresponding to variables in such a way that the part corresponding to the i-th variable occurring u i times in p is of length divisible by u i .
We get Encoding it together with R, we get construction for t and transform it into generating function equation: satisfies conditions I −V I necessary to use our method.Since t(z) is the formal solution of the equation t(z) = z• φ(t(z)) and we are interested in bounding exponential order of its coefficients from above we need to investigate maximum of its inversion -x φ(x) .To do that we need to find for which u's the function achieves the smallest values.For this purpose we consider the function ϕ(u 1 , . . ., u k ) = t 1 + k i=1 ( 3t u i 1−3t u i ) for t ∈ (0, 0.6), u 1 , . . ., u k ≥ 2 -we can use this restriction on t since we don't need to find the real maximum of x φ(x) and restriction on u's comes from the fact that the pattern is doubled.Since ϕ(u 1 , . . ., u k ) is convex for variables u 1 , . . ., u k and maximal value in convex set {(u 1 , . . ., u k ); 2 ≤ u i , Σ k i=1 u k = 2 k } is one of sets extremal points we get: .
Using Maple software, we check that the right side of the last inequality achieves 0.471 for t = 0.487 so exponential order of T n is at most 1/0.487= 2.0533 and hence there is at most 2.0533 M possible tuples P, L, R. Bounding H. Since a pattern p has length at least 2 k for k ≥ 4 and its every retracted instance has at least one letter substituted to every variable then every retraction is of length at least 16.Also, since distance between two holes is 100, every retraction adds at most |R| 100 letters to H.Moreover, the sum of retraction lengths is at most M (we couldn't retract more than we wrote) so there is at most 3 M 16 < 1.08 M possible H's.Bounding F .Finite sequence is of length at most |W | − 1 so there are less then 4 |W | possibilities of such sequence, because there can be assigned symbols 0, 1, 2 or no symbol assigned at every place.Symbols are assigned at prespecified positions so there is no need to encode them.Bounding P, L, R, H, F .Summing all bounds together, we get that for M big enough there is at most 4. Concluding remarks.Overall, entropy compression is a useful method for proving results for partial words.It is mainly helpful to obtain bounds for bigger numbers of variables, since it needs to encode Dyck paths and takes advantage of the fact that short retractions never occur.Straightforward application of developed methods for the second part of the conjectureabout binary words, provides the desired result for doubled patterns with at least 3 variables.To prove it for shorter patterns it may be necessary to use some other, possibly deterministic methods.

A
sample generalized Dyck path of type (10, 2)

Algorithm 1 : 2 i ← 1 , 3 j ← 1 4while 7 j++ 8 if
Avoiding pattern P 1 input: S : N → Σ = {a, b, c} Symbols are not assigned to entire W do 5 w j ← S(i) 6 i++ there is an occurrence R of pattern p ending in w j , then 9 let W R be the positions of R 10 for k ∈ W R do 11 erase the value of w k 12 j ← index of the first point in W R 13 return W (2.0533 • 1.08) M • 4 |W | < 2.2176 M • 4 |W | < 3 Mtuples and they fully describe 3 M possible prefixes of S, which gives us the desired contradiction.