Abstract 1 Introduction 2 Preliminaries 3 The Morphism ϕ 4 Modified Versions of Previous Results 5 Parametric Representations for Certain Sets 6 Main Result 7 Conclusion References

An Improved Version of Hmelevskii’s Theorem on Three-Variable Word Equations

Aleksi Saarela ORCID Department of Mathematics and Statistics, University of Turku, Finland
Abstract

Hmelevskii proved in 1971 that every constant-free three-variable word equation has a parametric solution. We prove an improved version of this result by showing that every such equation has a parametric solution using only three numerical parameters and with only two levels of nesting. This means that the structure of the solution sets of these equations is considerably simpler than has been known before.

Keywords and phrases:
Combinatorics on words, word equation, parametric word
Copyright and License:
[Uncaptioned image] © Aleksi Saarela; licensed under Creative Commons License CC-BY 4.0
2012 ACM Subject Classification:
Mathematics of computing Combinatorics on words
Funding:
Supported by the Research Council of Finland under grant 339311.
Editors:
Meena Mahajan, Florin Manea, Annabelle McIver, and Nguyễn Kim Thắng

1 Introduction

The study of word equations is interesting from the point of view of algebra and combinatorics, and also from the point of view of several more applied topics, such as string solvers [3] and document spanners [7]. Two very common (and closely related) research questions about word equations are studying the complexity of the satisfiability problem, that is, the problem of determining whether a given equation has a solution, and studying the structure of solution sets. These questions can be studied for different restricted subfamilies or for various generalizations of word equations. We give here some examples of existing results.

The satisfiability problem of word equations is known to be in NSPACE(n) [12]. It is also known to be NP-hard, but it is an open question whether it is in NP. There are many generalized versions of word equations for which the satisfiability problem is undecidable, see, for example, [4]. An interesting open question is the decidability of the satisfiability of word equations with length constraints. On the other hand, many easier variants can be solved in polynomial time, e.g., [11, 6, 5].

Strong results about the structure of solution sets exist for many subfamilies of word equations. It is a folklore result that constant-free equations on one or two variables have only periodic solutions. Constant-free equations on three variables are much more complicated, but they always have a so-called parametric solution, as proved by Hmelevskii [10]. Constant-free equations on four variables, on the other hand, do not always have parametric solutions; this was also proved in [10]. For one-variable equations with constants, it is known that if the solution set is infinite, then the possible values for the variable are exactly the words in a language of the form (uv)u [14], and if the solution set is finite, there are at most three solutions [16]. There are also results about the solution sets of arbitrary word equations or some of their generalizations, such as [2].

In this article, we concentrate on constant-free equations on three variables, with the goal of giving an improved, more precise version of the above-mentioned result of Hmelevskii. Although the statement of the old result is strong and elegant, there are a couple of weaknesses: First, the original proof, and even the simpler version of that proof in [13, 18], is very long and hard to read. Second, the parametric words that arise from the proof can be very complicated. For example, the number of numerical parameters and the nesting level can be estimated to be logarithmic with respect to the length of the equation, see [17, 18].

We prove as our main result that every constant-free equation on three variables has a parametric solution using only three numerical parameters and with nesting level at most two. This result was essentially conjectured in [19], and a similar result was proved for the subfamily of so-called unbalanced equations.

Our approach is very different from the one used by Hmelevskii, and it is not reliant on the results in [10]. On the other hand, we make extensive use of some other existing results, both old and recent, like the ones in [1, 19].

The structure of the article is as follows. In Section 2, we give many necessary definitions and state some existing results. In Section 3, we define a particular free group morphism and prove several lemmas related to it. This morphism then allows us to reformulate a result that was proved in [19]. The reformulation essentially combines six cases into one, making the result much easier to apply. On the other hand, the fact that the morphism is a free group morphism instead of a free monoid morphism leads to some complications. In Section 4, we give modified versions of some earlier results. The results are very close to the original ones, and large parts of the proofs are the same as in the original articles, but some changes are necessary to make the results work for our purposes. Section 5 contains the most important part of the proof of the main theorem. In this section, we find simple parametric representations for certain sets, and these can then be used as building blocks for a parametric solution of an arbitrary three-variable equation, as is finally done in Section 6.

2 Preliminaries

Let denote the set of nonnegative integers.

The set of all words over an alphabet Σ is denoted by Σ. This set, together with the concatenation operation, is a free monoid. The empty word, denoted by ε, is the neutral element of this monoid.

A word u is a factor of a word w if there exist words s,t such that w=sut. Words u and v are conjugates if there exist words s,t such that u=st and v=ts.

The free monoid Σ can be extended to a free group, which we denote by (Σ±1). We are mostly interested in free monoids, but occasionally we have to refer to free groups. Morphisms over free groups, in particular, are a useful tool in certain parts of this article.

A mapping h:(Σ1±1)(Σ2±1) is a G-morphism if h(uv)=h(u)h(v) for all u,v(Σ1±1). The morphism h is uniquely defined by the values h(c) for cΣ1. The set of all G-morphisms (Σ1±1)(Σ2±1) is denoted by GM(Σ1,Σ2).

If hGM(Σ1,Σ2) and h(c)Σ2 for all cΣ1 (and, consequently, h(u)Σ2 for all uΣ1), then h is called an M-morphism. The set of all M-morphisms (Σ1±1)(Σ2±1) is denoted by MM(Σ1,Σ2).

A morphism hMM(Σ1,Σ2) is periodic if there exists wΣ2 such that h(c)w for all cΣ1, and nonperiodic otherwise.

 Remark 1.

Usually when studying words, morphisms are defined as mappings h:Σ1Σ2 such that h(uv)=h(u)h(v) for all u,vΣ1. Every such mapping can be extended to an M-morphism in a unique way, and conversely, every M-morphism can be restricted to such a mapping. We use M-morphism so that we do not have to talk about extensions and restrictions.

2.1 Equations

Let Ξ be an alphabet of variables and let Σ be an alphabet of constants. A constant-free word equation on Ξ is a pair E=(u,v), where u,vΞ, and a solution of E is an M-morphism hMM(Ξ,Σ) such that h(u)=h(v). The equation E is nontrivial if uv.

A system of equations is a set of equations. A solution of a system is an M-morphism that satisfies all equations in the system.

The set of all solutions of an equation or system E is denoted by Sol(E), and the set of all equations satisfied by a morphism h is denoted by Eq(h). Equations or systems E1,E2 are equivalent if Sol(E1)=Sol(E2), and morphisms h1,h2 are equivalent if Eq(h1)=Eq(h2).

In this article, we are interested in the three-variable case. From now on, let {x,y,z} be an alphabet of three variables, let Σ be a nonunary alphabet of constants and let a,bΣ be two distinct letters.

We use the shorthand notation [u,v,w], where u,v,w(Σ±1), for the morphism hGM({x,y,z},Σ) defined by h(x)=u, h(y)=v, h(z)=w.

Example 2.

Consider the equation E=(xy,yz). For all u,vΣ and j, the morphism h=[uv,(uv)ju,vu] is a solution of E:

h(xy)=uv(uv)ju=(uv)juvu=h(yz).

Similarly, [ε,u,ε] is a solution for all uΣ. It would be quite easy to show that there are no other solutions, so

Sol(E) ={[uv,(uv)ju,vu]u,vΣ,j}{[ε,u,ε]uΣ,j}
=MM({a,b},Σ)({[ab,(ab)ja,ba]j}{[ε,a,ε]j}).

Here we are using the notation GH={ghgG,hH}. We frequently write solution sets or other sets of morphisms in this kind of form.

2.2 Parametric Words

Let 𝒫0(p,q) be the set of functions of the form

α:(Σ)p×qΣ,α(u1,,up;j1,,jq)=ui1uin,

where n and i1,,in{1,,p}. For d1, let 𝒫d(p,q) be the set of functions of the form

α:(Σ)p×qΣ,α(X)=α0(X)β1(X)ji1α1(X)βn(X)jinαn(X),

where X=(u1,,up;j1,,jq), n, i1,,in{1,,q} and αi,βi𝒫d1(p,q) for all i.

The elements of

i=0𝒫i(p,q).

are called parametric words with p word parameters and q numerical parameters. For a parametric word α, the smallest d such that α𝒫d(p,q) is called the nesting level of α. We have 𝒫d1(p,q)𝒫d(p,q), so 𝒫d(p,q) is the set of parametric words with nesting level at most d.

Example 3.

The function defined by α(u,v;i,j,k)=ui(ujv)kuvk is a parametric word in 𝒫2(2,3).

Next we define parametric representations and solutions. To simplify notation, we concentrate on the three-variable case. A finite set

{(αi,βi,γi)i{1,,k}}

of triples of parametric words in 𝒫d(p,q) is a parametric representation of the set of morphisms

{[αi(X),βi(X),γi(X)]i{1,,k},X(Σ)p×q}.

The family of all such sets of triples is denoted by d(p,q). For a three-variable equation E, a parametric representation of Sol(E) is called a parametric solution of E.

Example 4.

The equation (xy,yz) in Example 2 has a parametric solution

{(α1,α2,α3),(β1,β2,β1)},

where

α1(u,v;j)=uv, α2(u,v;j)=(uv)ju, α3(u,v;j)=vu,
β1(u,v;j)=ε, β2(u,v;j)=u.

Here α2𝒫1(2,1) and the other parametric words are in 𝒫0(2,1), so the parametric solution is in 1(2,1).

It is usually not necessary to explicitly define the parametric words, since they can be directly seen from expressions like [uv,(uv)ju,vu] or [ab,(ab)ja,ba].

Hmelevskii [10] proved that every constant-free three-variable word equation has a parametric solution. These parametric solutions use two word parameters, except that trivial equations have a parametric solution in 0(3,0). This is connected to the famous defect theorem, according to which n words satisfying a nontrivial relation can be expressed as products of n1 words (see [8] for more on the defect theorem and its variations). The number of numerical parameters and nesting level were not analyzed in [10], but a logarithmic upper bound follows from the proofs in [17, 18], leading to the next theorem.

Theorem 5.

For every nontrivial constant-free three-variable word equation E, there exist q,d such that E has a parametric solution in d(2,q). Moreover, q and d are logarithmic with respect to the length of E.

The following lemma is well-known, see Example 5.1.2 and the proof of Theorem 5.1.3 in [18] for an explanation.

Lemma 6.

The set of periodic solutions of a constant-free three-variable equation has a parametric representation in 1(1,3).

2.3 Classification of Morphisms

Budkina and Markov [1] classified all three-generator subsemigroups of a free semigroup. This result has been used in many places, often reformulated in terms of morphisms and equations. We copy here the formulation that was used in [19]. An essentially equivalent result was proved independently by Spehner [20, 21], see [9] for a good comparison of these results.

Theorem 7 (Budkina and Markov [1]).

Every nonperiodic morphism in MM({x,y,z},Σ) that satisfies a nontrivial equation is equivalent, up to a permutation of the variables, to a morphism of one of the following types:

  1. BM1.

    [a,b,ak0i=1nbaki], where n,k0,,kn.

  2. BM2.

    [a,bm,bn], where m,n and m,n1 and gcd(m,n)=1.

  3. BM3.

    [a,apbaq,apbi=1n(akib)aq], where p,q,p,q,n,k1,,kn and pp=qq=0 and 1p+qk1,,kn.

  4. BM4.

    [a,apb(akb)m,b(akb)naq], where p,q,k,m,n and k,m,n1 and p,qk and gcd(m+1,n+1)=1.

  5. BM5.

    [a,apb(akb)maq,b(akb)n], where p,q,k,m,n and p,q,k,m,n1 and p,qk and gcd(m+1,n+1)=1.

  6. BM6.

    [a,apbaq,bi=1n(akib)(akbi=1n(akib))m], where p,q,k,m,n,k1,,kn and m1 and 1p,qk<p+qk1,,kn.

The labels BM1–BM6 are the same as were used in [19], which makes it easier for the reader to refer to [19]. The morphisms BM1, BM3 and BM6 share some similarities and can often be handled together. Similarly, BM2, BM4 and BM5 are often grouped together.

3 The Morphism ϕ

Let ϕGM({a,b},Σ) be defined by

ϕ(a)=aba,ϕ(b)=a1.

This particular morphism happens to be very useful for us. Specifically, it allows us to combine several lemmas that were proved in [19] into a single theorem (Theorem 12) that looks simpler and, crucially, is much easier to use in the later parts of the article.

First, we need some definitions and lemmas related to the behaviour of ϕ. These are important when formulating, proving and using Theorem 12. In particular, for a word w, we want to characterize the integers j such that ϕj(w) is a word. This characterization is provided in Lemma 11.

Lemma 8.

The morphism ϕ has the following properties:

  • ϕ has an inverse morphism defined by

    ϕ1(a)=b1,ϕ1(b)=bab.
  • For all i,j,

    ϕj((ab)i)=(ab)i,ϕj((ba)i)=(ba)i.
  • For all i,j,

    ϕj((ab)ia)=(ab)i+ja,ϕj(b(ab)i)=b(ab)ij.

    In particular,

    ϕj(a)=(ab)ja,ϕj(b)=b(ab)j.

Proof.

Straightforward computation.

We need to study the question of when ϕj(w) is a word, or when ϕjh is an M-morphism. For that purpose, we give some additional definitions.

A word w{a,b}+ is called an alternating block, or just block for short, if neither aa nor bb is a factor of w. In other words, w is an alternating block if and only if it is a nonempty factor of some word in (ab).

An alternating block decomposition (ABD) of w{a,b} is a sequence (u1,,un) of alternating blocks such that w=u1un and for all i{1,,n1}, the last letter of ui is the same as the first letter of ui+1.

Lemma 9.

Every word w{a,b} has a unique ABD.

Proof.

We split w in the middle of every occurrence of the factors aa and bb. This gives an ABD, and no other way of splitting w into factors can give an ABD.

For a word w{a,b} with an ABD (u1,,un), we define its a-degree

dega(w)=inf{k+i:ui=(ab)k1a}.

and b-degree

degb(w)=inf{k+i:ui=b(ab)k1}.

For c{a,b} and for hMM({x,y,z},Σ) such that h(x),h(y),h(z){a,b}, we define

degc(h)=inf{degc(h(x)),degc(h(y)),degc(h(z))}.
Example 10.

The word w=ababaabaabbaba has the ABD (ababa,aba,ab,baba). We have dega(w)=2 and degb(w)=.

Lemma 11.

For all w{a,b} and j, the following equivalence holds:

ϕj(w){a,b}dega(w)<j<degb(w).

Proof.

Let the ABD of w be (u1,,un). By Lemma 8, every block ui that is not of the form b(ab)k with k<j or of the form (ab)ka with k<j is mapped to a word that begins and ends with the same letter as ui. In particular, if dega(w)<j<degb(w), then ϕj(ui){a,b} for all i and therefore ϕj(w){a,b}.

If jdegb(w), then there is at least one i such that ui=b(ab)k with k<j. For all such i, ϕj(ui)=b(ab)kj=(a1b1)jk1a1. If i2, then ui1 ends with b and thus ϕj(ui1) ends with either b or a1. Similarly, if in1, then ϕj(ui+1) begins with either b or a1. This means that when we calculate ϕj(w) as the product of the images of the blocks, no cancellation can happen. Therefore, the reduced form of ϕj(w) still has a1 in it, and ϕj(w) is not in {a,b}.

The case jdega(w) is analogous to the case jdegb(w).

The next theorem shows why we are interested in the morphism ϕ: It allows us to give a greatly simplified formulation of certain old results. This is then useful when applying the theorem.

Theorem 12.

Let h be a morphism of one of the types BM1–BM6. Let P be the set of periodic solutions of Eq(h). Then

Sol(Eq(h))=MM({a,b},Σ){ϕjh0j<degb(h)}P. (1)

Proof.

Let 0j<degb(h) and fMM({a,b},Σ). First, we check that fϕjh is an M-morphism (instead of being just a G-morphism): 0j<degb(h) implies dega(h(t))<j<degb(h(t)) for all t{x,y,z}, so we can use Lemma 11 to see that ϕj(h(t)){a,b} for all t{x,y,z}, and it follows that fϕjhMM({x,y,z},Σ). If (u,v)Eq(h), then h(u)=h(v) and thus (fϕjh)(u)=(fϕjh)(v). This shows that fϕjhSol(Eq(h)) and that the right-hand side of (1) is a subset of the left-hand side.

The fact that every nonperiodic morphism in Sol(Eq(h)) is in

MM({a,b},Σ){ϕjh0j<degb(h)}

follows from the results in [19]: Theorem 5.2 gives an equivalent equation for each Eq(h), and Lemmas 6.1–6.6 then solve these equations. In each case, it can be easily checked that the formulas that give the nonperiodic solutions match fϕjh. This shows that the left-hand side of (1) is a subset of the right-hand side.

It is an interesting question whether Theorem 12 could be proved in another way without having to use the rather large and cumbersome case analysis in [19].

4 Modified Versions of Previous Results

In [19], some ideas for proving a stronger version of Hmelevskii’s theorem were discussed, and a couple of theorems were proved that could possibly point towards such a result. We were not able to use those theorems directly as they were stated. Instead, we prove here slightly modified versions of them. The changes to both the theorems and their proofs are mostly very small.

We also need a slightly modified version of Lemma 24 in [15]. We give this in the next lemma without proof, because the original proof in [15] works also for this modified statement.

Lemma 13.

Let G be the set of morphisms in the classes BM2, BM4, BM5. Let E be a nontrivial constant-free equation on {x,y,z}. If Sol(E)G has more than one element, then there exist m,p,q,r,s such that

Sol(E)G{[a,apb(amb)iaq,arb(amb)jas]i,j}Sol(E).

The next lemma is a modified version of Theorem 8.1 in [19].

Lemma 14.

Let GMM({x,y,z},Σ) contain a representative of every equivalence class of nonperiodic morphisms that satisfy a nontrivial equation. Let E be a nontrivial constant-free equation on {x,y,z}. Let H be such that

Sol(E)GHSol(E).

Let P be the set of periodic solutions of E. Then

Sol(E)=hHSol(Eq(h))P.

Proof.

Every nonperiodic gSol(E) is equivalent to some hH, and then gSol(Eq(g))=Sol(Eq(h)).

On the other hand, if fSol(Eq(h)) for some hHSol(E), then EEq(h) and thus fSol(Eq(h))Sol(E).

The next lemma is a modified version of Theorem 8.2 in [19].

Lemma 15.

Let E be a nontrivial constant-free equation on {x,y,z}. Let G be the set of morphisms that are, up to a permutation of the variables, of one of the types BM1–BM6. Then there exist sets H1,,H9 such that

Sol(E)Gk=19HkSol(E) (2)

and every Hk is either a finite set or, up to a permutation of the variables, of one of the following forms:

{[a,apbaq,(uv)iu]i} for some p,q and u,vΣ, (3)
{[a,apb(amb)iaq,arb(amb)jas]i,j} for some m,p,q,r,s. (4)

Proof.

Let G1 be the set of morphisms of the types BM1, BM3, BM6. Let G2,,G6 be similar sets for the different permutations of the variables. Let G7 be the set of morphisms of the types BM2, BM4, BM5. Let G8,G9 be similar sets for the different permutations of the variables (we need only three permutations instead of six because of symmetry). Then G=k=19Gk. If we can find suitable sets Hk such that

Sol(E)GkHkSol(E), (5)

then (2) follows.

Morphisms in G1 can be written as [a,apbaq,w] for some w{a,b}. It was proved in [15] that E can have such a solution for at most one pair (p,q). If we fix p and q and replace x by a and y by apbaq in E, we get a nontrivial one-variable equation with constants, and solving this one-variable equation gives us the possible values for w. It is known that if such an equation has infinitely many solutions, then there are u,v such that for each k, the morphism that maps the remaining variable z to (uv)iu is a solution, and there are no other solutions, see [14]. Thus we get a set H1 that is either finite or of the form (3) and satisfies (5). Similarly, we can find sets H2,,H6.

For morphisms in G7, we can use Lemma 13 to find a set H7 that is either finite or of the form (4) and satisfies (5). Similarly, we can find sets H8 and H9.

5 Parametric Representations for Certain Sets

Our intention is to use the set k=19Hk from Lemma 15 as the set H in Lemma 14. This leads us to study the sets hHkSol(Eq(h)) with the help of Theorem 12. The purpose of Lemma 16 is to handle the case where Hk is a finite set. Similarly, Lemma 17 is used for the case where Hk is of the form (3), and Lemma 19 is used for the case where Hk is of the form (4). After proving these three lemmas, we put all the pieces together in Theorem 20 in the next section.

Lemma 16.

Let hMM({x,y,z},Σ). The set

MM({a,b},Σ){ϕjh0j<degb(h)}

has a parametric representation in 1(2,1).

Proof.

For a fixed j, the set

MM({a,b},Σ){ϕjh}

clearly has a parametric representation in 0(2,0), and the same is then true for a finite union of such sets. This takes care of the case where degb(h) is finite. If degb(h) is infinite and h=[u,v,w], then the ABDs of u,v,w do not contain blocks of the form b(ab)i, and therefore ϕj maps every block either to itself, or, in the case of blocks of the form (ab)ia, to (ab)i+ja. This means that ϕj(u) can be written in the form

u0(ab)ju1(ab)jun1(ab)jun, (6)

where u0,,un{a,b} do not depend on j, and ϕj(v) and ϕj(w) can be written in a similar form. Thus we get a parametric representation in 1(2,1).

The following idea that was used in the proof of Lemma 16 is useful also later: If degb(u)=, that is, the ABD of u does not contain blocks of the form b(ab)i, then ϕj(u) can be written in the form (6), and it essentially corresponds to a parametric word in 𝒫1(2,1). We use this kind of reasoning in the following lemmas without explaining it in detail like above.

Lemma 17.

Let u,v{a,b}, p,q and hi=[a,apbaq,(uv)iu]. The set

MM({a,b},Σ){ϕjhii,0j<degb(hi)} (7)

has a parametric representation in 2(2,2).

Proof.

If p=q=0, then degb(hi)=1 for all i and the set (7) is

MM({a,b},Σ){[a,b,(uv)iu]i},

which has a parametric representation in 1(2,1). For the rest of the proof, assume that p1 or q1. Then degb(hi)=degb((uv)iu) for all i.

Let us first assume that some conjugate of uv begins and ends with the same letter c. Let this conjugate be ts, where uv=st. We can write (7) as

MM({a,b},Σ){ϕjh00j<degb(h0)}
MM({a,b},Σ){ϕjh10j<degb(h1)}
MM({a,b},Σ){ϕjhii2,0j<degb(hi)}.

Here, we can use Lemma 16 for the first two sets, so it is enough to consider the third set. For i2, (uv)iu=s(ts)i1tu. Here ts begins and ends with c, s is either empty or ends with c, and tu is either empty or begins with c. Therefore, the ABD of s(ts)i1tu consists of the ABD of s followed by i1 copies of the ABD of ts followed by the ABD of tu. For all i2, degb(hi)=inf(degb(s),degb(ts),degb(tu)), which does not depend on i. If degb(hi) is finite, then we have a finite union of sets of the form

MM({a,b},Σ){[ϕj(a),ϕj(apbaq),ϕj(s)(ϕj(ts))i1ϕj(tu)]i2}.

In each set, j is a constant. We can write i=i2 and (ϕj(ts))i1=(ϕj(ts))iϕj(ts). Then i runs through all natural numbers and we can think of it as a numerical parameter. Thus we get a parametric representation in 1(2,1). If degb(hi) is infinite, then we have

MM({a,b},Σ){[ϕj(a),ϕj(apbaq),ϕj(s)(ϕj(ts))i1ϕj(tu)]i2,j0},

where ϕj(a)=(ab)ja and ϕj(apbaq)=((ab)ja)p1ab((ab)ja)q if p1 and ϕj(apbaq)=((ab)ja)pba((ab)ja)q1 if q1. Thus we can think of j and i2 as numerical parameters, and we get a parametric representation in 2(2,2).

Let us then consider the case where no conjugate of uv begins and ends with the same letter. This means that uv(ab)(ba). There are four subcases:

  • u,v(ab),

  • u,v(ba),

  • u(ab)a, vb(ab),

  • ub(ab), v(ab)a.

The first three are simple: In all these subcases, degb(hi)=degb(uv)=degb(u)=, and (7) can be written simply as

MM({a,b},Σ){[ϕj(a),ϕj(apbaq),(ϕj(uv))iϕj(u)]i,j},

which has a parametric representation in 2(2,2).

The fourth subcase is the most complicated one. Example 18 illustrates this case for some particular values of u and v. It might be easier to get the basic idea from that example than from the general proof below.

Let u=(ba)rb and v=(ab)sa. Then (uv)iu=(ba)(r+s+1)i+rb. Let t=r+s+1. Let k,l be such that j=tk+l and 0l<t. Let m,n be such that rl=tm+n and 0n<t. Then (uv)iu=(ba)ti+rb and

ϕj((uv)iu)=(ba)ti+rjb=(ba)ti+rtklb=(ba)t(ik)+tm+nb=(ba)t(ik+m)+nb.

We have degb(hi)=degb((uv)iu)=ti+r+1 and therefore we can rewrite the condition j<degb(hi) using the following sequence of equivalences:

j<degb(hi) j<ti+r+1tk+l<ti+r+1
t(ik)+tm+n+1>0t(ik+m)+n+1>0
ik+m0

At this point, r,s,t are fixed, while k,l,m,n depend on j. However, since there are only finitely many possible values for l, we can consider these separately. If we fix l, then m and n are also fixed. The part of (7) corresponding to a particular value of l is

MM({a,b},Σ){[ϕtk+l(a),ϕtk+l(apbaq),(ba)t(ik+m)+nb]i,k0,ik+m0}
= MM({a,b},Σ){[ϕtk+l(a),ϕtk+l(apbaq),(ba)t(ik+m)+nb]i0,0k<m}
MM({a,b},Σ){[ϕtk+l(a),ϕtk+l(apbaq),(ba)t(ik+m)+nb]ikm,km}.

Here, the first set of the union is a finite union of sets, one for each value of k. We can think of i as the only numerical parameter and write (ba)t(ik+m)+nb=((ba)t)i(ba)t(mk)+nb, and we get a parametric representation in 1(2,1). In the second set of the union, on the other hand, we can write k=km and i=ik+m, and then k and i run through all natural numbers independently of each other, so we can think of them as numerical parameters. Thus we get a parametric representation in 1(2,2). Combining all these parametric representations for all values of l gives a parametric representation for (7).

Example 18.

Consider Lemma 17 with p=1, q=0, u=b, v=aba. We have

{ϕjhii,0j<degb(hi)}
= {ϕj[a,ab,(baba)ib]i,0j2i}
= {[(ab)ja,ab,(ba)2ijb]i,0j2i}
= {[(ab)2ka,ab,(ba)2i2kb]i,02k2i}
{[(ab)2k+1a,ab,(ba)2i2k1b]i,02k+12i}
= {[(abab)ka,ab,(baba)ikb]i,k,ik0}
{[(abab)kaba,ab,(baba)ik1bab]i,k,ik10}
= {[(abab)ka,ab,(baba)ib]i,k}
{[(abab)kaba,ab,(baba)ibab]i,k}.

Here we have split the set in two parts corresponding to even j=2k and odd j=2k+1. Then, in the end, we have replaced ik with i in the first part, noticing that for all i,k, there exists i such that i=ik. Similarly, we have replaced ik1 by i in the second part. We can think of i and k as numerical parameters, and we get a parametric representation in 1(2,2).

Lemma 19.

Let m,p,q,r,s and hi,j=[a,apb(amb)iaq,arb(amb)jas]. The set

MM({a,b},Σ){ϕkhi,ji,j,0k<degb(hi,j)} (8)

has a parametric representation in 2(2,3).

Proof.

First, let m=0. If max(i,j)2, then degb(hi,j)=1, so we can write (8) as

i,j{0,1}MM({a,b},Σ){ϕkhi,j0k<degb(hi,j)}
MM({a,b},Σ){hi,ji,j}

The four sets corresponding to i,j{0,1} have parametric representations in 1(2,1) by Lemma 16, and the last set has a parametric representation in 1(2,2).

Then, let m=1. For each of p,q,r,s, there are two cases depending on whether it is zero or positive. While this technically leads to a total of 16 cases, these are all quite similar, so we give here only the case p=q=r=s=0: We can write

ϕkhi,j=[(ab)ka,b(ab)ik,b(ab)jk],

where k, ik and jk run through all natural numbers independently of each other, so we can think of them as three numerical parameters, and we get a parametric representation in 1(2,3).

Finally, let m2. We can write (8) as

MM({a,b},Σ){ϕkh0,00k<degb(h0,0)}
MM({a,b},Σ){ϕkh0,jj1,0k<degb(h0,j)}
MM({a,b},Σ){ϕkhi,0i1,0k<degb(hi,0)}
MM({a,b},Σ){ϕkhi,ji,j1,0k<degb(hi,j)}.

We explain here how to get a parametric representation for the last of these four sets; the first three can be handled in a similar way. For i,j1, we can write

ϕkhi,j= ϕk[a,apbamb(amb)i1aq,arbamb(amb)j1as]
= [ϕk(a),ϕk(apbamb)(ϕk(amb))i1ϕk(aq),ϕk(arbamb)(ϕk(amb))j1ϕk(as)].

Every word that is being mapped by ϕk here has infinite b-degree. We can think of i1, j1 and k as numerical parameters, and we get a parametric representation in 2(2,3).

6 Main Result

We are now ready to prove our main result.

Theorem 20.

Every nontrivial constant-free word equation E on {x,y,z} has a parametric solution in 2(2,3).

Proof.

Let P be the set of periodic solutions of E. Let G and H1,,H9 be as in Lemma 15. We can then use Lemma 14 with H=k=19Hk. This, together with Theorem 12, gives

Sol(E) =hHSol(Eq(h))P
=k=19hHkSol(Eq(h))P
=k=19hHkMM({a,b},Σ){ϕih0i<degb(h)}P
=k=19MM({a,b},Σ){ϕihhHk,0i<degb(h)}P.

Note that the sets P in Theorem 12 are subsets of the set P in this proof, so they can be ignored here.

The set P has a parametric representation in 1(1,3) by Lemma 6. To complete the proof of the theorem, it suffices to show that each of the sets

MM({a,b},Σ){ϕihhHk,0i<degb(h)}

has a parametric representation in 2(2,3). If Hk is a finite set, this follows from Lemma 16, if Hk is of the form (3), this follows from Lemma 17, and if Hk is of the form (4), this follows from Lemma 19.

7 Conclusion

In this article, we have proved that every nontrivial constant-free word equation on three variables has a parametric solution with at most three numerical parameters and with nesting level at most two. This is a much more exact version of the old result of Hmelevskii. Several interesting questions remain:

  • Is the result optimal, that is, does there exist a constant-free word equation on three variables that does not have a parametric solution with less than three numerical parameters or with nesting level less than two?

  • A parametric solution was defined as a set of triples. How large does this set need to be, that is, how many triples do we need, at most? Can we give a fixed finite bound, or does this depend on the length of the equation?

  • What is the complexity of finding a parametric solution for a given constant-free equation on three variables?

References

  • [1] L. G. Budkina and Al. A. Markov. F-semigroups with three generators. Akademiya Nauk SSSR. Matematicheskie Zametki, 14:267–277, 1973.
  • [2] Laura Ciobanu, Volker Diekert, and Murray Elder. Solution sets for equations over free groups are EDT0L languages. International Journal of Algebra and Computation, 26(5):843–886, 2016. doi:10.1142/S0218196716500363.
  • [3] Joel D. Day. Word equations in the context of string solving. In Proceeding of the 26th DLT, volume 13257 of LNCS, pages 13–32. Springer, 2022. doi:10.1007/978-3-031-05578-2_2.
  • [4] Joel D. Day, Vijay Ganesh, Paul He, Florin Manea, and Dirk Nowotka. The satisfiability of word equations: decidable and undecidable theories. In Reachability problems, volume 11123 of LNCS, pages 15–29. Springer, 2018. doi:10.1007/978-3-030-00250-3_2.
  • [5] Joel D. Day, Florin Manea, and Dirk Nowotka. The hardness of solving simple word equations. In Proceedings of the 42nd MFCS, volume 83 of LIPIcs, pages 18:1–14. Schloss Dagstuhl – Leibniz-Zentrum für Informatik, 2017. doi:10.4230/LIPIcs.MFCS.2017.18.
  • [6] Robert Da̧browski and Wojtek Plandowski. Solving two-variable word equations (extended abstract). In Proceedings of the 31st ICALP, volume 3142 of LNCS, pages 408–419. Springer, 2004. doi:10.1007/978-3-540-27836-8_36.
  • [7] Dominik D. Freydenberger and Mario Holldack. Document spanners: from expressive power to decision problems. Theory of Computing Systems, 62:854–898, 2017. doi:10.1007/s00224-017-9770-0.
  • [8] Tero Harju and Juhani Karhumäki. Many aspects of defect theorems. Theoretical Computer Science, 324(1):35–54, 2004. doi:10.1016/j.tcs.2004.03.051.
  • [9] Tero Harju and Dirk Nowotka. On the independence of equations in three variables. Theoretical Computer Science, 307(1):139–172, 2003. doi:10.1016/S0304-3975(03)00098-7.
  • [10] Ju. I. Hmelevskiĭ. Equations in free semigroups. American Mathematical Society, 1976. Translated by G. A. Kandall from the Russian original: Trudy Mat. Inst. Steklov. 107 (1971).
  • [11] Artur Jeż. One-variable word equations in linear time. Algorithmica, 74(1):1–48, 2016. doi:10.1007/s00453-014-9931-3.
  • [12] Artur Jeż. Word equations in non-deterministic linear space. Journal of Computer and System Sciences, 123:122–142, 2022. doi:10.1016/j.jcss.2021.08.001.
  • [13] Juhani Karhumäki and Aleksi Saarela. An analysis and a reproof of Hmelevskii’s theorem. In Proceedings of the 12th DLT, volume 5257 of LNCS, pages 467–478. Springer, 2008. doi:10.1007/978-3-540-85780-8_37.
  • [14] Markku Laine and Wojciech Plandowski. Word equations with one unknown. International Journal of Foundations of Computer Science, 22(2):345–375, 2011. doi:10.1142/S0129054111008088.
  • [15] Dirk Nowotka and Aleksi Saarela. One-variable word equations and three-variable constant-free word equations. International Journal of Foundations of Computer Science, 29(5):935–950, 2018. doi:10.1142/S0129054118420121.
  • [16] Dirk Nowotka and Aleksi Saarela. An optimal bound on the solution sets of one-variable word equations and its consequences. SIAM Journal on Computing, 51(1):1–18, 2022. doi:10.1137/20M1310448.
  • [17] Aleksi Saarela. On the complexity of Hmelevskii’s theorem and satisfiability of three unknown equations. In Proceedings of the 13th DLT, volume 5583 of LNCS, pages 443–453. Springer, 2009. doi:10.1007/978-3-642-02737-6_36.
  • [18] Aleksi Saarela. Word equations and related topics: independence, decidability and characterizations. PhD thesis, University of Turku, 2012. URL: http://urn.fi/URN:ISBN:978-952-12-2737-0.
  • [19] Aleksi Saarela. On the solution sets of three-variable word equations. Theory of Computing Systems, 68:1556–1571, 2024. doi:10.1007/s00224-024-10193-9.
  • [20] Jean-Claude Spehner. Quelques problémes d’extension, de conjugaison et de présentation des sous-monoïdes d’un monoïde libre. PhD thesis, Univ. Paris, 1976.
  • [21] Jean-Claude Spehner. Les systemes entiers d’équations sur un alphabet de 3 variables. In Semigroups Theory and Applications, volume 1320 of LNM, pages 342–357. Springer, 1988. doi:10.1007/BFb0083443.