Finding All Solutions of Equations in Free Groups and Monoids with Involution
FFinding All Solutions of Equations in FreeGroups and Monoids with Involution
Volker Diekert , Artur Je˙z , ,? , and Wojciech Plandowski Institut f¨ur Formale Methoden der Informatik, University of Stuttgart, Germany Institute of Computer Science, University of Wroclaw, Poland Max Planck Institute f¨ur Informatik, Saarbr¨ucken, Germany Institute of Informatics, University of Warsaw, Poland
Abstract.
The aim of this paper is to present a
PSPACE algorithmwhich yields a finite graph of exponential size and which describes theset of all solutions of equations in free groups as well as the set of allsolutions of equations in free monoids with involution in the presence ofrational constraints. This became possible due to the recently invented recompression technique of the second author.He successfully applied the recompression technique for pure word equa-tions without involution or rational constraints. In particular, his methodcould not be used as a black box for free groups (even without rationalconstraints). Actually, the presence of an involution (inverse elements)and rational constraints complicates the situation and some additionalanalysis is necessary. Still, the recompression technique is general enoughto accommodate both extensions. In the end, it simplifies proofs thatsolving word equations is in
PSPACE (Plandowski 1999) and the cor-responding result for equations in free groups with rational constraints(Diekert, Hagenah and Guti´errez 2001). As a byproduct we obtain a di-rect proof that it is decidable in
PSPACE whether or not the solution setis finite. Introduction
A word equation is a simple object. It consists of a pair (
U, V ) of words overconstants and variables and a solution is a substitution of the variables by wordsin constants such that U and V become identical words. The study of wordequations has a long tradition. Let WordEquation be the problem of decidingwhether a given word equation has a solution. It is fairly easy to see that Word-Equation reduces to Hilbert’s 10th Problem (in Hilbert’s famous list presentedin 1900 for his address at the International Congress of Mathematicians). Hencein the mid 1960s the Russian school of mathematics outlined the roadmap toprove undecidability of Hilbert 10 th Problem via undecidability of WordEqua-tion. The program failed in the sense that Matiyasevich proved Hilbert’s 10th ? Supported by Humboldt Research Fellowship for Postdoctoral Researchers A preliminary version of this paper was presented as an invited talk at CSR 2014 inMoscow, June 7–11, 2014. a r X i v : . [ c s . L O ] M a y roblem to be undecidable in 1970, but by a completely different method, whichemployed number theory. The missing piece in the proof of the undecidabilityof Hilbert’s 10th Problem was based on methods due to Robinson, Davis, andPutnam [21]. On the other hand, in 1977 Makanin showed in a seminal pa-per [18] that WordEquation is decidable! The program went a different way, butits outcome were two major achievements in mathematics. Makanin’s algorithmbecame famous since it settled a long standing problem and also because his al-gorithm had an extremely complex termination proof. In fact, his paper showedthat the existential theory of equations in free monoids is decidable. This isclose to the borderline of decidability as already the ∀∃ positive theory of freemonoids is undecidable [8]. Furthermore Makanin extended his results to freegroups and showed that the existential and positive theories in free groups aredecidable [19, 20]. Later Razborov was able in [28] (partly shown also in [29]) todescribe the set of all solutions for systems of equations in free groups (see also[15] for a description of Razborov’s work). This line of decidability results culmi-nated in the proof of Tarski’s conjectures by Kharlampovich and Myasnikov in aseries of papers ending in [16]. In particular, they showed that the theory of freegroups is decidable. In order to prove this fundamental result the description ofall solutions of an equation in a free group is crucial.Another branch of research was to extend Makanin’s result to more generalalgebraic structures including free partially commutative monoids [22, 6], freepartially commutative monoids with involution, graph groups (also known asright-angled Artin groups) [7], graph products [5], and hyperbolic groups [30, 2].In all these cases the existential theory of equations is decidable. Proofs usedthe notion of equation with rational constraints , which was first developed in thehabilitation of Schulz [31]. The concept of equation with rational constraints isused also throughout the present paper.In parallel to these developments there were drastic improvements in thecomplexity of deciding Wordequation. It is fairly easy to see that the problem is NP -hard. Thus, NP is a lower bound. First estimations for the time complexityon Makanin’s algorithm for free monoids led to a tower of several exponentials,but it was lowered over time to EXPSPACE in [10]. On the the other hand itwas shown in [17] that Makanin’s scheme for solving equations in free groups isnot primitive recursive. (Already in the mid 1990 this statement was somehowpuzzling and counter-intuitive, as it suggested a strange crossing of complexities:The existential theory in free monoids seemed to be easier than the one in freegroups, whereas it was already known at that time that the positive theory infree monoids is undecidable, but decidable in free groups.) The next importantstep was done by Plandowski and Rytter, whose approach [27] was the first es-sentially different than Makanin’s original solution. The main idea was to applycompression to WordEquation and the result was that the length-minimal solu-tion of a word equation compresses well, in the sense that Lempel-Ziv encoding,which is a popular practical standard of compression, of such a solution is expo-nentially smaller than the solution itself (if the solution is at least exponentialin the length of the equation). This yielded an npoly ( n, log N ) algorithm for2ordEquation, note that at that time the only available bound on N was thetriply exponential bound by Makanin. Still, this result prompted Plandowski andRytter to formulate a (still open) conjecture that WordEquation is NP -complete.Soon after a doubly exponential bound on N was shown by Plandowski [23],this bound in particular used the idea of representing the solutions in a com-pressed form (in fact, the equation as well is kept in a compressed form) as wellas employing a novel type of factorisations. Exploiting better the interplay be-tween factorisations and compression Plandowski showed that WordEquation isin PSPACE , i.e., it can be solved in polynomial space and exponential time [24].His method was quite different from Makanin’s approach and more symmetric.Furthermore, it could be also used to generate all solutions of a given word equa-tion [25], however, this required non-trivial extensions of the original method.Using Plandowski’s method Guti´errez showed that satisfiability of equationsin free groups is in
PSPACE [11], which led Diekert, Hagenah and Guti´errezto the result that the existential theory of equations with rational constraintsin free groups is
PSPACE -complete [4]. Without constraints
PSPACE is still thebest upper bound, although the existential theories for equations in free monoids(with involution) and free groups are believed to be NP complete. Since this proofgeneralized Plandowski’s satisfiability result [24], it is tempting to also extendthe generator of all solutions [25]. Indeed, Plandowski claimed that his methodapplies also to free groups with rational constraints, but he found a gap in hisgeneralization [26].However in 2013 another substantial progress in solving word equations wasdone due to a powerful recompression technique by Je˙z [14]. His new proofthat WordEquation is in PSPACE simplified the existing proofs drastically. Inparticular, this approach could be used to describe the set of all solutions rathereasily, so the previous construction of Plandowski [25] was simplified as well.What was missing however was the extension to include free monoids withinvolution and therefore free groups and another missing block was the the pres-ence of rational constraints. Both extensions are the subject of the present paper.
Outline
We first follow the approach of [4] how to (bijectively) transform the setof all solutions of an equation with rational constraints over a free group in poly-nomial time into a set of all solutions of an equation with regular constraints overa free monoid with involution, see Section 1.2. Starting at that point in Section 2we formulate the main technical claim of the paper: existence of a procedure thattransforms equations over the free monoid and (roughly speaking) keeps the setof solutions as well as does not increase the size of the word equation; in par-ticular in this section we make all the intuitive statements precise. Moreover,we show how this procedure can be used to create
PSPACE -transducer whichproduces a finite graph (of exponential size) describing all solutions and whichis nonempty if and only if the equation has at least one solution. Moreover, thegraph also encodes whether or not there are finitely many solutions, only. Thetechnique of recompression simplifies thereby [4] and it yields the important newfeature that we can describe all solutions.3
Preliminaries
As already mentioned, the general plan is to reduce the problem of word equationwith regular constraints over free group to the problem of word equation withregular constraints over a free monoid with an involution and give an algorithmfor the latter problem. In this section we first introduce all notions regardingthe word equation over the free monoid, see Section 1.1, and only afterwards thesimilar notions for a free group together with the reduction of the latter scenarioto the former one, see Section 1.2.
Let A and Ω be two finite disjoint sets, called the alphabet of constants and thealphabet of variables (or unknowns ), respectively. For the purpose of this paper A and Ω are endowed with an involution , which is is a mapping such that x = x for all elements. In particular, an involution is a bijection. If involutionis defined for a monoid, then we additionally require that xy = y x for all itselements x, y . This applies in particular to a free monoid A ∗ over a set withinvolution: For a word w = a · · · a m we thus have w = a m · · · a . If a = a for all a ∈ A then w simply means to read the word from right-to-left. It is sometimesuseful to consider involution closed sets , i.e., such that S = S .A word equation is a pair ( U, V ) of words over A ∪ Ω , often denoted by U = V . A solution σ of a word equation U = V is a substitution σ of unknownsin Ω by words over constants, such that the replacement of unknowns by thesubstituted words in U and in V give the same word. Moreover, as we work withinvolutions we additionally demand that the solution satisfies σ ( X ) = σ ( X ) forall X ∈ Ω . If an equation does not have simultaneous occurrences of X and X where X = X then this additional requirement is vacuous. A solution is non-empty , if σ ( X ) = (cid:15) for every variable X such that X or X occurrs in theequation. During the proof we will consider only non-empty solutions. This isnon-restrictive, as we can always non-deterministically guess the variables thatare assigned (cid:15) by a solution and remove such variables form the equation. Onthe other hand, it is useful to assume that a solution assigns (cid:15) to each variable X such that X , nor X occur in the equation: during the algorithm we removethe variables that are assigned (cid:15) in the solution. Nevertheless, we need to knowthe substitution for such X , as we create the set of all solutions by backtracking. Example 1.
Let Ω = (cid:8) X, Y, X, Y (cid:9) and A = { a, b } with b = a . Then XabY = Y baX behaves as a word equation without involution One of its solutions isthe substitution σ ( X ) = bab , σ ( Y ) = babab . Under this substitution we have σ ( X ) abσ ( Y ) = bababbabab = σ ( Y ) baσ ( X ). It can be proved that the solutionset of the equation XabY = Y baX is closely related to Sturmian words [13].The notion of word equation immediately generalizes to a system of wordequations ( U , V ) , . . . , ( U s , V s ). In this case a solution σ must satisfy all ( U i , V i )simultaneously. However, such a system can be reduced to a single equation4 U a · · · U s aU b · · · U s b, V a · · · V s aV b · · · V s b ) where a , b are fresh constants with a = b . Furthermore, this reduction remains valid when additionally regular con-straints are introduced, such constraints are properly defined below.Lastly, we always assume that the involution on Ω is without fixed points:otherwise for a variable X such that X = X we can introduce a fresh variable X , set X = X and add an equation X = X , which ensures that σ ( X ) = σ ( X ).In this way we can avoid some case distinctions. Constraints
Let C be a class of formal languages, then a system of word equa-tions with constraints in C is given by a finite list ( U i , V i ) i of word equationsand a finite list of constraints of type X ∈ L (resp. X / ∈ L ) where X ∈ Ω and L ⊆ A ∗ with L ∈ C . For a solution we now additionally demand that σ ( X ) ∈ L (resp. σ ( X ) / ∈ L ) for all constraints.Here, we focus on rational and recognizable (or regular) constraints and weassume that the reader is familiar with basic facts in formal language theory.The classes of rational and recognizable subsets are defined for every monoid M [9], and they are incomparable, in general. Rational sets (or languages) aredefined inductively as follows. – All finite subsets of M are rational. – If L , L ⊆ M are rational, then the union L ∪ L , the concatenation L · L ,and the generated submonoid L ∗ are rational.A subset L ⊆ M is called recognizable , if there is a homomorphism ρ to somefinite monoid E such that L = ρ − ρ ( L ). We also say that ρ (or E ) recognizes L in this case. Kleene’s Theorem states that in finitely generated free monoids bothclasses coincide, and we follow the usual convention to call a rational subset ofa free monoid regular . If M is generated by some finite set Γ ⊆ M (as it alwaysthe case in this paper) then every rational set is the image of a regular set L under the canonical homomorphism from Γ ∗ onto M ; and every recognizableset of M is rational. (These statements are trivial consequences of Kleene’sTheorem.) Therefore, throughout we assume that a rational (or regular) languageis specified by a nondeterministic finite automaton, NFA for short.Consider a list of k regular languages L i ⊆ Σ ∗ each of them being specifiedby some NFA with m i states. The disjoint union of these automata yields asingle NFA with m = m + · · · + m k states which accepts all L i by choosingappropriate initial and final sets for each L i ; we may assume that the NFAhas state set { , . . . m } . Then each constant a ∈ A defines a Boolean m × m matrix τ ( a ) where the entry ( p, q ) is 1 if ( p, a, q ) is a transition and 0 otherwise.This yields a homomorphism τ : A ∗ → B m × m such that τ recognizes L i for all1 ≤ i ≤ k .Moreover, for each i there is a row vector I i ∈ B × n and a column vector F i ∈ B n × such that we have w ∈ L i if and only if I i · τ ( w ) · F i = 1.For a matrix P we let P T be its transposition. There is no reason that τ ( a ) = τ ( a ) T , hence τ is not necessarily a homomorphism which respects the5nvolution. So, as done in [4], we let M m ⊆ B m × m denote the following monoidwith involution: M m = (cid:8)(cid:0) P Q (cid:1) (cid:12)(cid:12) P, Q ∈ B m × m (cid:9) with (cid:0) P Q (cid:1) = (cid:16) Q T P T (cid:17) . Define ρ ( a ) = (cid:16) τ ( a ) 00 τ ( a ) T (cid:17) . Then the homomorphism ρ : A ∗ → M m respectsthe involution. Moreover ρ recognizes all L i and L i = { w | w ∈ L i } .Consider regular constraints X ∈ L and X / ∈ L . As ρ recognises both L and L , the conditions σ ( X ) ∈ L and σ ( X ) / ∈ L are equivalent to ρ ( σ ( X )) ∈ ρ ( L )and ρ ( σ ( X )) / ∈ ρ ( L ). As the image of ρ is a subset of M m , there are only finitelymany elements in it. Thus all regular constraints on X boil down to restrictionsof possible values of ρ ( σ ( X )). To be more precise, if all positive constraints on X are ( L i ) i ∈ I and all negative are ( L i ) i ∈ I , all those constraints are equivalentto ρ ( σ ( X )) ∈ \ i ∈ I ρ ( L i ) ∩ \ i ∈ I ( M m \ ρ ( L i )) . Thus, as a preprocessing step our algorithm guesses the ρ ( σ ( X )), which we shallshortly denote as ρ ( X ), moreover this guess needs to satisfy – ρ ( X ) = ρ ( X ) – ρ ( X ) ∈ ρ ( L ) for each positive constraint L on X ; – ρ ( X ) / ∈ ρ ( L ) for each negative constraint L on X .In the following we are interested only in solutions for which ρ ( σ ( X )) = ρ ( X ).Note that, as ρ is a function, each solution of the original system corresponds toa solution for an exactly one such a guess, thus we can focus on generating thesolutions for this restricted problem.We now give a precise definition of the main problem we are considering inthe rest of the paper: Definition 1. An equation E with constraints is a tuple E = ( A, Ω, ρ ; U = V ) containing the following items: – An alphabet of constants with involution A . – An alphabet of variables with involution without fixed points Ω . – A mapping ρ : A ∪ Ω → M m such that σ ( x ) = σ ( x ) for all x ∈ A ∪ Ω . – The word equation U = V where U, V ∈ ( A ∪ Ω ) ∗ .A solution of E is a homomorphism σ : ( A ∪ Ω ) ∗ → A ∗ leaving the constantsfrom A invariant such that the following conditions are satisfied: σ ( U ) = σ ( V ) ,σ ( X ) = σ ( X ) for all X ∈ Ω,ρ ( σ ( X )) = ρ ( X ) for all X ∈ Ω. The input size of E is given by k E k = | A | + | Ω | + | U V | + m .
6n the following, when this does not cause a confusion, we denote both thesize of the instance and the length of the equation by n . Note that we can alwaysincrease the size of the equation by repeating it several times.The measure of size of the equation is accurate enough with respect to poly-nomial time and/or space. For example note that if an NFA has m states thenthe number of transitions is bounded by m | A | . Note also that | A | can be muchlarger than the sum over the lengths of the equations and inequalities plus thesum of the number of states of the NFAs in the lists for the constraints.As already noted, by a convention, when a variable X and its involution X are not present in the equation, each solution assigns (cid:15) to both X and X . Inparticular, this assignment should satisfy the constraint, i.e., ρ ( X ) = ρ ( (cid:15) ) foreach variable not present in the solution. Note that the input equation can havevariables that are not present in the equation and have constraints other than ρ ( X ) = ρ ( (cid:15) ), however, such a situation can be removed by a simple preprocessing. Equations during the algorithm.
During the procedure we will create vari-ous other equations and introduce new constants. Still, the original alphabet A never changes and new constants shall represent words in A ∗ . As a consequence,we will work with equations over B ∪ Ω , where B is the smallest alphabet con-taining A and all constants in U V U V . We shall call such B the alphabet of ( U, V ). Note that | B | ≤ | A | + 2 | U V | and we therefore we can ignore | B | for thecomplexity.Ideally, a solution of ( U, V ) assigns to variables words over the alphabetof (
U, V ), call it B . However, as our algorithm transforms the equations andsolutions, it is sometimes more convenient to allow also solutions that assignwords from some B ⊃ B . A solution is simple it if uses only constants from B , by default we consider simple solutions. Whenever we consider a non-simplesolution, we explicitly give the alphabet over which this is a solution.To track the meaning of constants outside A , we additionally require thata solution (over an alphabet B ) supplies some homomorphism h : B A ∗ ,which is constant on A and compatible with ρ , in the sense that ρ ( b ) = ρ ( h ( b ))for all b ∈ B . (Due to its nature, we also assume that h ( b ) contains at least twoconstants for b ∈ B \ A .) Thus, in the following, a solution is a pair ( σ, h ). Inparticular, given an equation ( U, V ) the h ( σ ( U )) corresponds to a solution ofthe original equation.A weight of a solution ( σ, h ) of an an equation ( U, V ) isw( σ, h ) = | U | + | V | + X X ∈ Ω | U V | X | h ( σ ( X )) | , (1)where | U V | X denotes the number of occurrences of X in U and V together.The main property of such defined weight is that it decreases during the runof the algorithm, using this property we shall guarantee a termination of thealgorithm: each next equation in the sequence will have a smaller weight, whichensures that we do not cycle. 7iven a non-simple solution ( σ, h ) we can replace all constants c / ∈ B (where B is the alphabet of the equation) in all σ ( X ) by h ( c ) (note, that as ρ ( c ) = ρ ( h ( c )), the ρ ( X ) is preserved in this way). This process is called a simplification of a solution and the obtained substitution σ is a simplification of σ . It is easyto show that σ is a solution and that h ( σ ( U )) = h ( σ ( U )), so in some sense both σ and σ represent the same solution of the original equation. Lastly, σ and σ have the same weight, see Lemma 1. Thus, in some sense we can always simplifythe solution.As a final note observe that h is a technical tool used in the analysis, itis not stored, nor transformed by the algorithm, nor it is used in the graphrepresentation of all solutions. Lemma 1.
Suppose that ( σ, h ) is a solution of the equation ( U, V ) . Then thesimplification ( σ , h ) of ( σ, h ) is also a solution of ( U, V ) , h ( σ ( U )) = h ( σ ( U )) and w( σ, h ) = w( σ, h ) .Proof. Let B be the alphabet of the equation and B the alphabet of the solution σ . Consider any constant b ∈ B \ B . As it does not occur in the equation, allits occurrences in σ ( U ) and σ ( V ) come from the varibles, i.e., from some σ ( X ).Then replacing all occurrences of b in each σ ( X ) by the same string w preservesthe equality of σ ( U ) = σ ( V ), thus σ is also a solution. Since we replace someconstants b with h ( b ) (and h ◦ h = h ), clearly h ( σ ( X )) = h ( σ ( X )) for eachvariable. Furthermore, as ρ ( c ) = ρ ( h ( c )) we have that h ( σ ( X )) = h ( σ ( X )).Thus, h ( σ ( U )) = h ( σ ( U )) and w( σ, h ) = w( σ, h ), as claimed. ut By F ( Γ ) we denote the free group over a finite set Γ . We let A = Γ ∪ Γ − . Setalso x = x − for all x ∈ F ( Γ ). Thus, in (free) groups we identify x − and x . Bya classical result of Benois [1] rational subsets of F ( Γ ) form an effective Booleanalgebra. That is: if L is rational and specified by some NFA then F ( Γ ) \ L isrational; and we can effectively find the corresponding NFA. There might be anexponential blow-up in the NFA size, though. This is the main reason to allownegative constraints X / ∈ L , so we can avoid explicit complementation. Proposition 1 ([4]).
Let F ( Γ ) be a free group and A = Γ ∪ Γ − be the corre-sponding set with involution as above. There is polynomial time transformationwhich takes as input a system S of equations (and inequalities) with rationalconstraints over F ( Γ ) and outputs a word equation with regular constraints S over A which is solvable if and only if S is solvable in F ( Γ ) .More precisely, let ϕ : A ∗ → F ( Γ ) be the canonical morphism of the freemonoid with involution A ∗ onto the free F ( Γ ) . Then the set of all solutions for S is bijectively mapped via σ ϕ ◦ σ onto the set of all solutions of S . Proposition 1 in particular shows that the description of all solutions of asystem of equations and inequalities (with rational constraints) over a free groupcan be efficiently reduced to solving the corresponding task for word equations8ith regular constraints in a free monoid with involution. For convenience of thereader let us remark that the proof of Proposition 1 is fairly straightforward.It is based on the fact that
XY Z = 1 in F ( Γ ) is equivalent with the existenceof words P, Q, R ∈ A ∗ such that X = P Q , Y = QR , and Z = RP . Indeed, if XY Z = 1 in F ( Γ ) then we can represent X , Y , and Z by reduced words and theexistence of P, Q, R follows because F ( Γ ) is a free group. The other direction istrivial and holds for non reduced words as well. Input size.
The input size for the reduction is given by the sum over thelengths of the equations and inequalities plus the size of Γ plus the sum of thenumber of states of the NFAs in the lists for the constraints. As in the case ofword equations over free monoid, the measure is accurate enough with respectto polynomial time and or space. Note that | Γ | can be much larger than the sumover the lengths of the equations and inequalities plus the sum of the number ofstates of the NFAs in the lists for the constraints. Recall that we encode X = 1by a rational constraint, which introduces an NFA with 2 | Γ | +1 states. Since | Γ | is part of the input, this does not cause any problem. The output size remainsat most quadratic in the input size. We can easily extend the algorithm for word equations over free groups withrational constraints to existential theory of free groups with rational constraints.As a first step note that we can eliminate the disjunction by non-deterministicguesses. Secondly, as the singleton { } ⊆ F ( Γ ) is, by definition, rational, the set F ( Γ ) \ { } is rational, too. Therefore an inequality U = V can be handled by anew fresh variable X and writing U = XV & X ∈ F ( Γ ) \ { } instead of U = V . We shall consider linear Diophantine systems with solutions over natural num-bers. Formally, such a system is given by an m × n matrix A with coefficientsin Z and an m × b ∈ Z m . We write Ax = b and its set of solutions isgiven by the set { x ∈ N n | Ax = b } . We say that Ax = b is satisfiable over N ifthe set of solutions is non-empty. Note that while we could also allow inequali-ties, a system of inequalities Ax ≥ b can be reduced to equalities by introducingfresh variables y and rewriting the system as Ax − y = b . Looking for solutionsin N n makes the problem NP -hard. Actually, we use the following well-knownproposition. Proposition 2.
The following two problems are NP -complete. Input. Ax = b where A ∈ Z n × n and b ∈ Z n × and coefficients are written inbinary. Question 1.
Is the set { x ∈ N n | Ax = b } non-empty? Question 2.
Is the set |{ x ∈ N n | Ax = b }| infinite? roof. The NP -completeness of the first problem is standard, see e.g., [12]. Itcan be reduced to the second problem by adding an equation y − z = 0 where y, z are fresh variables. A possible reduction of the second problem to satisfiabilityis as follows. Given an equation Ax = b we create a system Ax = b & Ax = b ,where x = ( x , . . . , x n ) and x = ( x , . . . , x n ) use disjoint sets of variables. Thenwe add equations x = x + y where y uses fresh variables. This guarantees that x ≥ x . Finally, we add an equation x + · · · + x n = x + · · · + x n + z + 1.This guarantees that x > x , in the sense that at least one of the inequalities x i ≥ x i is strict. If the new system is satisfiable then Ax = b has infinitely manysolutions x + k ( x − x ) with k ∈ N . Conversely, if Ax = b has infinitely manysolutions then there must exist solutions x and x with x < x due to Dickson’sLemma [3], and they satisfy the created system. In this section we give an overview of the graph representation of all solutionsand the way such a representation is generated as well as a detailed descriptionof the graph representation of all solution of word equation with constraints.This description is devised so that it is a citable reference, in particular, it issupposed to be usable without reading the actual construction and the proof ofits correctness. It will include all the necessary definitions, though. The actualconstruction and the proof of correctness is given in Section 3.
By an operator we denote a function that transforms substitutions (for variables).All our operators have simple description: σ ( X ) is usually obtained from σ ( X )by morphisms, appending/prepending constants, etc. In particular, they havea polynomial description. We usually denote them by ϕ and their applicationsby ϕ [ σ ].Recall that the instance size is n , so in particular the input equation is oflength at most n and has at most n variables. Definition 2.
A word equation ( U, V ) with constraints is strictly proper if – in total U and V have at most cn of constants; – in total U and V have at most n occurrences of variables; – there is a homomorphism h : B A + that is compatible with ρ , where B isthe alphabet of ( U, V ) .An equation is proper if instead of the first condition it satisfies a weaker one – in total U and V have at most cn constants. A possible constant is c = 27 as we will see later. The idea is that strictlyproper equations satisfy the desired upper-bound and proper equations are some10ntermediate equations needed during the computation, so they can be a bitlarger.Concerning the existence of h , note that we do not want to consider equationscontaining letters that cannot represent strings in the input alphabet. For theinput equation we may assume A = B and therefore we can take h as the identity.The input equation is strictly proper.The main technical result of the paper states that: Lemma 2.
Suppose that ( U , V ) is a strictly proper equation with | U | , | V | > and let it have a solution ( σ , h ) . Then there exists a sequence of proper equa-tions ( U , V ) , ( U , V ) , . . . , ( U k , V k ) , over alphabets B , B , . . . , B k and solu-tions ( σ , h ) , ( σ , h ) , . . . , ( σ k , h k ) of those equations and families of operators Φ , Φ , . . . , Φ k and their simple solutions such that – k > and ( U k , V k ) is strictly proper. – There is ϕ i +1 ∈ Φ i +1 and a solution ( σ i +1 , h i +1 ) of ( U i +1 , V i +1 ) over B i ∪ B i +1 such that • σ i = ϕ i +1 [ σ i +1 ] • σ i +1 is a simplification of σ i +1 • h i ( σ i ( U i )) = h i +1 ( σ i +1 ( U i +1 )) = h i +1 ( σ i +1 ( U i +1 )) .Furthermore, w( σ i , h i ) > w( σ i +1 , h i +1 ) = w( σ i +1 , h i +1 ) . – If ( σ i +1 , h i +1 ) is a solution of ( U i +1 , V i +1 ) (over an arbitrary alphabet) and ϕ i +1 ∈ Φ i +1 then ( σ i , h i ) is a solution of ( U i , V i ) , where σ i = ϕ i +1 [ σ i +1 ] and h i is some homomorphism compatible with ρ . – Each family Φ i as well as operator ϕ i ∈ Φ i have polynomial-size description.Given ( U , V ) , all such sequences (for all possible solutions) can be produced in PSPACE .Discussion
The exact definition of allowed families of operators Φ is deferred toSection 2.2, for the time being let us only note that Φ has polynomial descrip-tion (which can be read from ( U i , V i ) and ( U i +1 , V i +1 )), may be infinite and itselements can be efficiently listed, (in particular, it can be tested, whether Φ isempty or not).Concerning the difference between σ i +1 and σ i +1 : while we know that σ i = ϕ i +1 [ σ i +1 ] we cannot guarantee that ( σ i +1 , h i +1 ) is simple, so the claim of theLemma 2 does not apply to it σ i +1 . However, when we take a simplification( σ i +1 , h i +1 ) of σ i +1 , the claim applies. Moreover, σ i +1 and σ i +1 represent thesame solution h i +1 ( σ i +1 ( U i +1 )) = h i +1 ( σ i +1 ( U i +1 )) of the original equation, sonothing is lost in the substitution. Alternatively, we could impose the conditionthat the solution ( σ i +1 , h i +1 ) is simple however then we cannot assume that σ i = ϕ i +1 [ σ i +1 ], we can only guarantee that h i ( σ i ( U i )) = h i +1 ( σ i +1 ( U i +1 )).This makes details of many proofs more complicated, but this is a technicaldetail that should not bother the reader.Getting back to the solutions, an equation in which both U i and V i havelength 1 has easy to describe solutions:11 if U i , V i are the same constant then the equation has exactly one solution,in which every variable is assigned (cid:15) (recall our convention that a variablenot present in the equation is assigned (cid:15) ); – if U i , V i are both variables, say X and Y , then if ρ ( X ) = ρ ( Y ) then thereis not solution, otherwise any σ that assigns (cid:15) to other variables and w to X, Y , where ρ ( w ) = ρ ( X ), is a solution; – if U i is a constant and V i a variable, say a and X then if ρ ( a ) = ρ ( X ) thenthere is no solution, otherwise there is a unique solution, which assigns a to X and (cid:15) to all other variables.In this way all solutions of the input equation ( U, V ) are obtained by a path from( U , V ) to some satisfiable ( U i , V i ) satisfying | U i | = | V i | = 1 and the solutionof ( U, V ) is a composition of operators from the families on the path applied tothe solution of ( U i , V i ). Note that there may be several ways to obtain the samesolution, using different paths in the graph. Using Lemma 2 one can construct in
PSPACE a graph like representation of all solutions of a given word equation:for the input equation (
U, V ) we construct a directed graph G which has nodeslabelled with proper equations. Then for each strictly proper equation ( U , V )such that | U | > | V | > U , V ). For each such sequence ( U , V ) , ( U , V ) , . . . , ( U k , V k ) we put theedges ( U , V ) → ( U , V ), ( U , V ) → ( U , V ), . . . , ( U k − , V k − ) → ( U k , V k ) andannotate the edges with the appropriate family of operators. We lastly removethe nodes that are not reachable from the starting node and those that do nothave a path to an ending node.In this way we obtain a finite description of all solution of a word equationwith regular constraints. Theorem 1.
There exists and can be effectively constructed a
PSPACE trans-ducer that given a word equation with regular constraints over a free monoidgenerates a finite graph representation of all its solutions.
Using Proposition 1 we obtain a similar claim for word equation with rationalconstraints over a free group.
Corollary 1.
There exists and can be effectively constructed a
PSPACE trans-ducer that given a word equation with regular constraints over a free group gen-erates a finite graph representation of all its solutions.
Families of operators
Let us now describe the used family of operators. Givenan edge (
U, V ) → ( U , V ) the class Φ of operators is defined using: – A linear Diophantine system of polynomial size in parameters { x X , y X } X ∈ Ω .12 A set { s X , s X } X ∈ Ω of strings, length of string s X ( s X ) may depend on x X ( y X , respectively): it may use one expression of the form ( ab ) x X (( ab ) y X ,respectively) or a x X / a y X when a = b . Each s X and s X is of polynomiallength (we treat ( ab ) x X as having description of O (1) size). – A set of E , . . . , E k of strings which may use expressions ( ab ) x X and ( ab ) y X (or a x X and a y X ), similarly to s X and s X , k is of polynomial size and each E i has polynomial-size description. There are corresponding letters c E , c E ,. . . , c E k that occur in ( U , V ) but not in ( U, V ).Note that the Diophantine system may be empty and some of { s X , s X } X ∈ Ω maybe (cid:15) or not dependent on parameters. On the other hand, each E i consists of atleast two letters.Particular operator ϕ ∈ Φ corresponds to a solution { ‘ X , r X } X ∈ Ω . It firstreplaces each letter c E i with strings E i in which all x X and y X are replaced withnumbers ‘ X and r X . Then it prepends to σ ( X ) the s X in which parameter x X is replaced with ‘ X , then appends s X in which parameter y X is replaced with r X . In this section we describe procedures that show the claim of Lemma 2. Inessence, for a word equation (with constraints) (
U, V ) with a solution σ we wantto compress the word σ ( U ) directly on the equation, i.e., without the knowl-edge of the actual solution. In case of the free monoid (without involution) [14],the ‘compression’ essentially is a replacement of all substrings ab with a singleconstant c . However, due to the involution (and possibility that a = b ) the com-pressions in case of free monoid with involution are more involved: we replacethe ab - blocks , as defined later in this section, see Definition 4. To do this, wesometimes need to modify the equation ( U, V ).The crucial observation is that a properly chosen sequence of such compres-sion guarantees that if the compressed equation is not too long than neither is theobtained equation (formally, if the compressed equation is strictly proper thenthe resulting one is as well), see Lemma 8. Moreover, the compression steps de-crease the weight of the corresponding solution, which guarantees a terminationof the whole process.
As we want to describe theset of all solutions, ideally there should be a one-to-one correspondence betweenthe solutions before and after the application of used subprocedures. However, asthose subprocedures are non-deterministic and the output depends on the non-deterministic choices, the situation becomes a little more complicated. What wewant to guarantee is that no solution is ‘lost’ in the process and no solution is‘gained’: given a solution for some non-deterministic choices we transform the13quation into another one, which has a ‘corresponding’ solution and we knowa way to transform this solution back into the original equation. Furthermore,when we transform back in this way any solution of the new equation, we obtaina solution of the original equation.As already noticed, to ease the presentation, the solutions of the new equationmay use constants outside the alphabet of the new equation. To be more precise,they can ‘inherit’ some constants from the previous solution and therefore usealso the constants that occurred in the previous equation.
Definition 3 (Transforming the solution).
Given a (nondeterministic) pro-cedure and a proper equation ( U, V ) we say that this procedure transforms ( U, V ) (which is proper) with its solution ( σ, h ) to ( U , V ) with ( σ , h ) if – there are some nondeterministic choices that lead to an equation ( U , V ) (over the alphabet B ) and based on the nondeterministic choices and equa-tion ( U, V ) we can define a family of operators Φ such that ϕ [ σ ] = σ for somesolution ( σ , h ) over the alphabet B ∪ B of the equation ( U , V ) and someoperator ϕ ∈ Φ . Furthermore, h ( σ ( U )) = h ( σ ( U )) and w( σ , h ) ≤ w( σ, h ) and if ( U, V ) = ( U , V ) then this inequality is in fact strict. – For every equation ( U , V ) that can be obtained from a proper equation ( U, V ) and any its solution ( σ , h ) (not necessarily simple) and for everyoperator ϕ ∈ Φ the ( ϕ [ σ ] , h ) is a solution of ( U, V ) for any homomorphism h : B A + compatible with ρ , where B is an alphabet of ϕ [ σ ]( U ) .If this procedure transforms any solution ( σ, h ) of any proper equation ( U, V ) then we say that it transforms solutions . Note that both (
U, V ) and Φ depend on the nondeterministic choices, so it mightbe that for different choices we can transform ( U, V ) to ( U , V ) (with a family Φ ) and to ( U , V ) (with a family Φ ).We call Φ the corresponding family of inverse operators . In many cases, Φ consists of a single operator ϕ , in such a case we call it the corresponding inverseoperator furthermore, in some cases ϕ does not depend on ( U, V ).Note that when (
U, V ) with a ( σ, h ) is transformed into ( U , V ) with ( σ , h )then the simplification σ of σ (recall that a simplification replaces all con-stants b / ∈ B by h ( b ) in all σ ( X )) is also a solution of ( U , V ) and moreover h ( σ ( U )) = h ( σ ( U )), so it corresponds to the same original solution of theinput equation as ( σ ( U ) , h ), see Lemma 1.Clearly, composition of two operations that (weakly) transform the equationsalso (weakly) transforms the equations (although the description of the familyof inverse operators may be more complex).As a last comment, observe that when we take an arbitrary solution ( σ , h )and operator ϕ then we cannot guarantee that there is some h for which h ( ϕ [ σ ]( U )) = h ( σ ( U )): imagine we can replace factor aba with a single letter c while h ( c ) = a b , so there is no way to reasonably define h ( a ) and h ( b ). Thus we can takeany h for ϕ [ σ ], and we know that one exists by the assumption that ( U, V ) isproper. 14 b -blocks. In an earlier paper using the recompression technique [14] there weretwo types of compression steps: compression of pairs ab , where a = b were twodifferent constants, and compression of maximal factor a ‘ (i.e., ones that cannotbe extended to the right, nor left). In both cases, such factors were replaced witha single fresh constant, say c . While the actual replacement was performed onlyon the equation ( U, V ) implicitly it was performed also on the solution σ ( U ) aswell.The advantage of such compression steps was that the replaced factors werenon-overlapping, in the sense that when we fixed a pair (or block) to be com-pressed, each constant in a word w belongs to at most one replaced factor.We would like to use similar compression rules also for the case of monoidswith involution, however, one needs to take into the account that when w isreplaced with a constant c , then also w should be replaced with c . The situationgets complicated, when some of constants in w are fixed-points for the involution,i.e., a = a . In the worst case, when a = a and b = b the occurrences of ab and ab = ba are overlapping, so the previous approach no longer directly applies.(Even if we start with a situation such that a = a for all a ∈ A , as it is thecase for free groups, fixed points in larger alphabets are produced during thealgorithm.)Intuitively, when we want to compress ab into a single constant, also ba needsto be replaced. Furthermore, if factors s and s are to be replaced and they areoverlapping, we should replace their union with a single constant. Lastly, thefactors to be replaced naturally fall into types , depending on whether the firstconstant of the factor is a or b and the last b or a .These intuitions lead to the following definition of ab -blocks (for a fixed pairof constants ab ) and their types. Definition 4.
Depending on a and b , ab - blocks are1. If a = b then there are two types of ab -blocks: a i for i ≥ and a i for i ≥ .2. If a = b , a = a and b = b then ab and ab = ba are the two types of ab -blocks.3. If a = b , a = a and b = b then ab , ab = ba and bab are the three types of ab -blocks.4. If a = b , a = a and b = b then ab , ab = ba and aba are the three types of ab -blocks.5. If a = b , a = a and b = b then the ( ba ) i , a ( ba ) i , ( ba ) i b and ( ab ) i (where ineach case i ≥ ) are the four types of ab -blocks.An occurrence of an ab -block in a word is an ab - factor , it is maximal , if it is notcontained in any other ab -factor. Note that for the purpose of this definition when a = a we treat a and a asthe same letter, even if for some syntactic reason we write a and a .The following fact is a consequence of the definitions of maximal ab -blocksand shows the correctness of the definition. Lemma 3.
For any word w ∈ B ∗ and two constants a, b ∈ B , maximal ab -factors in w do not overlap. b -factor ab -factor ab -factor? Fig. 1.
To prove Lemma 3 we need to show that a union of two overlapping ab -factorsis also an ab -factor. Proof.
For the proof it is enough to show that when two ab -factors s and s areoverlapping then their union (i.e., the smallest factor that encompasses themboth) is also an ab -factor, see Figure 1 Due to case distinction it follows by acase by case analysis according to Definition 4.If a = b and a = a then as ab and ba have no common constants, two over-lapping ab -factors are both factors consisting of repetitions of the same constantand so also their union is an ab -factor. If a = a then ab = ba and so the sameargument as before applies.If a = b , a = a and b = b then two overlapping ab -factors need to be thesame factor (note that here we do not exclude the case a = b ).If a = b , a = a and b = b then consider two different overlapping ab -factors.As all constants in any ab -block are different, if s and s are of the same typeand overlapping then they are in fact the same factor. If the factors ab and ba overlap then their union is bab , which is also an ab -factor. If factors ab and bab overlap, then the latter contains the former; the same applies to the factors ba and bab .If a = b , a = a and b = b then the analysis is symmetric to the one givenabove.In the last case, when a = b , a = a and b = b observe that a factor is an ab -factor if and only if it has length at least 2 and consists solely of alternatingconstants a and b . Thus also a union of two overlapping ab -factors is an ab -factor. ut Given a set of ab -blocks we perform the compression by replacing maximal ab -factors from this set. For consistency, we assume that such a set is involutionclosed. Definition 5 ( S -reduction). For a fixed ab and an involution-closed set of ab -blocks S the S - reduction of the word w is the word w in which all maximalfactors s ∈ S are replaced by a new constant c s , where c s = c s . The inverseoperation is an S - expansion . There are the following observations. – The S -expansion is a functions on B ∗ , using Lemma 3 we obtain that also S -reduction is a function on B ∗ as well.16 The S -reduction introduces new constants to B , we extend ρ to it in a naturalway. – We let c = c if and only if s = s . In this way constants may become fixedpoint for the involution. For example, aa is an aa -block for a = a . If aa iscompressed into c then c = c . – It might be that after S -reduction some constant c in the solution is no longerin B (as it was removed from the equation). In such a case the correspondingsolution will not be simple, this is described in more detail later on. Performing the S -reduction The S -reduction is easy, if all maximal fac-tors from S are wholly contained within the equation or within substitution fora variable: in such a case we perform the S -reduction separately on the equa-tion and on each substitution for a variable (the latter is done implicitly). Itlooks non-obvious, when part of some factor s is within the substitution for thevariable and part in the equation. Let us formalise those notions. Definition 6.
For a word equation ( U, V ) an ab -factor is crossing in a solu-tion σ if it does not come from U ( V , respectively), nor from any σ ( X ) for anoccurrence of a variable X ; ab is crossing in a solution σ , if some ab -factor iscrossing. Otherwise ab is non-crossing in σ . Note that as ba is an ab -block, it might be that ab is crossing because of a factor ba . By guessing all X ∈ Ω with σ ( X ) = (cid:15) (and removing them) we can alwaysassume that σ ( X ) = (cid:15) for all X . In this case crossing ab ’s can be alternativelycharacterized in a more operational manner. Lemma 4.
Let σ ( X ) = (cid:15) for all X . Then ab is crossing in σ if and only if oneof the following holds: – aX or aX = Xa , for an unknown X , occurs in U or V and σ ( X ) beginswith b (so σ ( X ) ends with b ) or – Xb or Xb = b X , for an unknown X , occurs in U or V and σ ( X ) ends with a (so σ ( X ) begins with a ) or – XY or XY = Y X , for unknowns
X, Y , occurs in U or V and σ ( X ) endswith a while σ ( Y ) begins with b (so σ ( Y ) ends with b and σ ( X ) begins with a ).Proof. So suppose that ab is crossing, which means that there is some ab -factorthat is crossing. By definition it means that it does not come from one occurrenceof a variable, nor from equation. Thus one of its constants comes from a variableand the other from the equation or from a different variable (note that as thesolution is non-empty, the considered constants and variables are neighbouringin the word). Case inspection implies that one of the conditions listed in thelemma describes this situation.So suppose that ab satisfies one of the conditions in the lemma. Then clearly ab is crossing: for instance, if aX occurs in the equation and σ ( X ) begins with b then the ab -factor formed by this a and the first b in σ ( X ) is crossing, othercases are shown in the same way. ut ab can be associated with an occurrence of a variable X , itfollows that the number of crossing ab s is linear in the number of occurrences ofvariables. Lemma 5.
Let ( U, V ) be a proper equation and σ its solution. Then there areat most n different crossing words in σ . The only property of a proper equation is that it has at most n occurrences ofvariables. Proof.
Firstly observe that if σ ( X ) = (cid:15) for any variable, then we can remove all X es from the equation and this does not influence whether ab is crossing or not.Thus we can assume that σ is non-empty, in the sense that σ ( X ) = (cid:15) for everyvariable present in the equation. So in the remaining part we may assume thatthe assumptions of Lemma 4 are satisfied.By Lemma 4 when ab is crossing, then one can associate ab (or ba ) withan occurrence of a variable and its first or last constant. There are at most n occurrences of variables, so 2 n occurrences with distinguished first or lastconstant and we have also two options of associating ( ab or ba ), so 4 n possibilitiesin total, which yields the claim. ut Reduction for non-crossing ab . When ab is non-crossing in the solution σ wecan make the compression for all ab -factors that occur in the equation ( U, V ) on σ ( U ) by replacing each ab -factor in U and V . The correctness follows from thefact that each maximal occurrence of ab -block in σ ( U ) and σ ( V ) comes eitherwholly from U ( V , respectively) or from σ ( X ). The former are replaced by ourprocedure and the latter are replaced implicitly, by changing the solution. Thusit can be shown that the solutions of the new and old equation are in one-to-onecorrespondence, i.e., are transformed by the procedure. Algorithm 1
CompNCr ( U, V, ab ) Reduction for a non-crossing ab S ← all maximal ab -factors in U and V for s ∈ S do
3: let c s be a fresh constant4: if s = s then
5: let c s denote c s else
7: let c s be a fresh constant8: replace each maximal ab -factor s ( s ) in U and V by c s ( c s , respectively)9: set ρ ( c s ) ← ρ ( s ) and ρ ( c s ) ← ρ ( s )10: return ( U , V ) To show that
CompNCr ( U, V, ab ) transforms the solutions (for a non-crossing ab ) or weakly transforms the solutions (in the general case), for a solution ( σ, h )we should define a corresponding solution ( σ , h ) of the obtained ( U , V ) as18ell as an inverse operator ϕ . Intuitively, they are defined as follows (let as in CompNCr ( U, V, ab ) the S be the set of all maximal ab -blocks in ( U, V ) and let
CompNCr ( U, V, ab ) replace s ∈ S by c s ): – σ ( X ) is obtained by replacing each s ∈ S by c s – h is h extended to new constants by setting h ( c s ) = h ( s ) – the operator ϕ { c s → s } s ∈ S in each σ ( X ) replaces each c s by s , for all s ∈ S .(Note that ϕ { c s → s } s ∈ S is the S -expansion.)Note that the defined operator is in the class defined in Section 2.2: all s X , s X are (cid:15) while E , . . . , E k are exactly the elements of S . Lemma 6.
Let ab is non-crossing in a solution σ and let CompNCr ( U, V, ab ) compute a set of ab -blocks S in ( U, V ) and replace s ∈ S by c s . Then CompNCr ( U, V, ab ) transforms ( U, V ) with ( σ, h ) to ( U , V ) with ( σ , h ) , where h is defined as aboveand ϕ { c s → s } s ∈ S is the inverse operator.Proof. We define a new solution σ by replacing each maximal factor s ∈ S in any σ ( X ) by c s . Note that in this way ρ ( σ ( X )) = ρ ( σ ( X )), as for each s we define ρ ( c s ) ← ρ ( s ). As all constants { c s → s } s ∈ S are fresh, this meansthat σ = ϕ { c s → s } s ∈ S [ σ ], as claimed. This is a solution of ( U , V ): consider anymaximal ab -factor s in σ ( U ) (or σ ( V )): – If it came from the equation then it was replaced by
CompNCr ( U, V, ab ). – If it came from a substitution for a variable and s • is in S then it was replaced implicitly in the definition of σ ; • is not in S then it is left as it was. – It cannot be crossing, as this contradicts the assumption.Thus, σ ( U ) is obtained from σ ( U ) by replacing each maximal ab -factor s ∈ S by c s , in particular, σ ( U ) = σ ( V ).We define h simply by extending h to new letter c s in a natural way: h ( c s ) = h ( s ) for each s ∈ S ; note that such defined h is compatible, since ρ ( c s ) = ρ ( s )and h is known to be compatible. Furthermore h ( σ ( U )) = h ( σ ( U )), as σ ( U )is obtained from σ ( U ) by replacing each maximal factor s ∈ S by c s and bydefinition h ( c s ) = h ( s ) and on all other letters they are equal.Now, if ( σ , h ) is any solution of ( U , V ) then ϕ { c s → s } s ∈ S [ σ ]( U ) = ϕ { c s → s } s ∈ S [ σ ]( V ):observe that ϕ { c s → s } s ∈ S [ σ ]( U ) is obtained from σ ( U ) by replacing each c s by s , as the same applies to ϕ { c s → s } s ∈ S [ σ ]( V ), we obtain that indeed ( σ , h ) is asolution, for any h for letters present in σ ( U ). We now show that there is atleast one such a homomorphism: we know that there is such a homomorphismfor the alphabet of ( U, V ) (as it is a proper equation) and for other letters wecan use the homomorphism h , by the form of ϕ { c s → s } s ∈ S there are no otherletters.Concerning the weight, observe first that h ( σ ( X )) = h ( σ ( X )): – if c s replaced s then h ( c s ) = h ( s ); – for every preserved constant a it holds that h ( a ) = h ( a ).Clearly we have | U | + | V | ≤ | U | + | V | , so the weight does not increase. Further-more, if ( U, V ) = ( U , V ) then at least one factor was replaced in the equationand so | U | + | V | < | U | + | V | and so the weight decreases. ut .2 Reduction for crossing ab . Since we already know how to compress a non-crossing ab , a natural way to dealwith a crossing ab is to ‘uncross’ it and then compress using CompNCr . To thisend we pop from the variables the whole parts of maximal ab -blocks which causethis block to be crossing. Afterwards all maximal ab -blocks are noncrossing andso they can be compressed using CompNCr
Idea
As an example consider an equation abaXaXaXa = aXabY bY bY , let a = a an b = b so that the ab -blocks are non-trivial. For simplicity, let usfor now ignore the constraints. Also, let us focus on the solutions of the form X ∈ b ( ab ) ‘ X and Y = ( ab ) ‘ Y a ; clearly, ab is crossing in this solution. So we ‘pop’from X the b ( ab ) ‘ X and ( ab ) ‘ Y a from Y (and remove those variables). After thepopping this equation is turned into ( ab ) ‘ X +4 a = ( ab ) ‘ X +3 ‘ Y +4 a , for which ab is noncrossing. Thus solutions of the original equation (of the predescribed form X = b ( ab ) ‘ X and Y = ( ab ) ‘ Y a ) correspond to the solutions of the Diophantineequation: 3 ‘ X + 4 = ‘ X + 3 ‘ Y + 4. This points out another idea of the popping:when we pop the whole part of block that is crossing, we do not immediatelyguess its length, instead we treat the length (here: 2 ‘ X + 1 or 2 r X + 1) asa parameter , identify ab -blocks of the same length and only afterwards verify,whether our guesses were correct. The verification is formalised as a linear systemof Diophantine equations (here: 3 ‘ X + 4 = ‘ X + 3 ‘ Y + 4) in parameters (here: ‘ X and r X ). We can check solvability (and compute a minimal solution) in NP (so in particular in PSPACE ), see e.g., [12]. (For or a more accurate estimationof constants see [4]). Each of solutions of the Diophantine system correspondsto one “real” set of lengths of ab -blocks popped from variables. Now we replaceequation ( ab ) ‘ X +4 a = ( ab ) ‘ X +3 ‘ Y +4 a with ca = ca , which has a unique solution σ ( X ) = σ ( Y ) = (cid:15) . Of course there is no single inverse operator, instead, theyshould take into the account the system 3 ‘ X + 4 = ‘ X + 3 ‘ Y + 4. And it is so, foreach solution ( ‘ X , r X ) of this system there is one inverse operator, which firstreplaces c with ( ab ) ‘ X +3 ‘ Y +4 and then appends b ( ab ) ‘ X to the substitution for X and ( ab ) r X a to the substitution for Y .There are some details that were ignored in this example: during poppingwe need to also guess the types of the popped blocks and whether the variableshould be removed (as now it represents (cid:15) ) or not. Furthermore, we also needto calculate the transition of the popped ab -block, which depends on the actuallength (i.e., on particular ‘ X , ‘ Y , etc.). However, this ab block is long becauseof repeated ab . Now, when we look at ρ ( ab ), ρ ( ab ) , . . . then starting from some(at most exponential) value it becomes periodic, the period is also at most ex-ponential. Thus ρ ( ab ) ‘ X = ρ ( ab ) ‘ for some ‘ which is at most exponential. Thiscan be written as an Diophantine equation and added to the constructed lin-ear Diophantine system which has polynomial size if coefficients are written inbinary. Detailed description
A full description is available also as a psuedocode, seeAlgorithm 2. The proof of correctness is provided in Lemma 7.20 dempotent power
In the preprocessing, when the ab -blocks can be nontrivial(i.e., when a = b or a = b and a = a and b = b ) we guess (some) idempotentpower p of ρ ( ab ) (when a = b ) or ρ ( a ) (when a = b , in the following we consideronly the former case) in M m , i.e., p such that ρ ( ab ) p = ρ ( ab ) p . It is easy to showthat there is such p ≤ | M m | ≤ m , so we can restrict the guess so that thebinary notation of p is of polynomial size. Note that we can verify the guess bycomputing ρ ( ab ) p and ρ ( ab ) p in time poly (log p, m ) (the powers are computedbe iterated squaring of the matrices). And so we can indeed verify that p is anidempotent power of ρ ( ab ). Note that as a = a and b = b in this case, p is alsoan idempotent power of ba = ab . Popping and transitions
Now for every variable X we guess whether σ ( X ) begins(and ends) with an ab -factor or a single-letter suffix (prefix, respectively) of an ab -factor; to simplify the notation, the ab - prefix of σ ( X ) is the maximal prefix of σ ( X ) that is also a suffix of some ab -factor; define the ab - suffix in a symmetricway. Note that an ab prefix of σ ( X ) may be empty, may consist of a single-letter (i.e., a or b ) or have more letters in which case it is also an ab -factoritself. Thus, for each X we guess its ab -prefix s X and left-pop it from X , i.e., wereplace X with s X X (at the same time we need to right-pop the s X from X , i.e.,replace X with Xs X , note that this is the ab -suffix of X ). Consider s X , supposethat it is nontrivial, i.e., more than 1 letter was popped. When a = b then s X = a x X or s X = a x X for some x X ≥
2. Similarly, when a = a, b = b and a = b then s X ∈ { ( ab ) x X , ( ab ) x X b, b ( ab ) x X , ( ab ) x X } , for some x X ≥
1. In other cases, s X does not include any parameter x X . Similar observation can be made for s X , which uses parameter y X . We treat x X , y X as parameters denoting integerswhose values are to be established later on (we do not use name variables , as thisis reserved for variables representing words). The information about the x X , y X is encoded in s X , s X : we simply write them in one of the forms given above (notethat x X = y X and y X = x X ). Eventually, we fix the values of x X and y X , say to ‘ X and r X . Then s X [ ‘ X ] denotes a string s X in which we substituted a number ‘ X for parameter x X and so s X [ ‘ X ] is a string of a well-defined length. If s X does not depend on ‘ X then also s X [ ‘ X ] is a string that does not depend on ‘ X ,still we use this notion to streamline the presentation.We now fix the transitions of the popped blocks; if x X and y X are defined,the transition depends on them. As an example, consider a transition ρ ( ab ) x X .Recall that p is the idempotent power for ρ ( ab ) (and so also of ρ ( ba )), whichmeans that ρ ( ab ) kp + ‘ = ρ ( ab ) p + ‘ (when k ≥ ≤ ‘ < p . Thus for ρ ( ab ) x X we guess whether x X ≥ p . If so, we guess 0 ≤ ‘ X < p and writeequations kp + ‘ X = x X , k ≥
1, then ρ ( ab ) x X = ρ ( ab ) p + ‘ X , and both p and ‘ X are known, so we can calculate ρ ( ab ) p + ‘ . If x X ≤ p then we guess its value(at most 2 p ) and compute ρ ( ab ) x X . The same is done for y X . Identical blocks
As we know the types of ab -factors in the equation (note thatthey do not depend on particular values of { x X , y X } X ∈ Ω ), we can calculate themaximal ab -factors in the equation (as well as their types), even though x X and y X are not yet known. Denote those maximal ab -factors by E , . . . , E ‘ , note21hat they may use ( ab ) x X or ( ab ) y X , similarly as { s X , s X } X ∈ Ω , we do not im-pose the condition that one E i uses at most one such an expression. As in caseof { s X , s X { X ∈ Ω , by E i [ { ‘ X , r X } X ∈ Ω ] we denote E i in which parameters x X and y X were replaced with numbers ‘ X and r X , for each variable X . Concerning theirlengths, denote by e i the length fo E i . since the popped factors have lengths thatare linear in x X or y X for some X the lengths e , e , . . . , e ‘ are also linear in { x X , y X } X ∈ Ω . It is easy to see (Lemma 7) that ‘ is polynomial in the size ofthe equation and so are the descriptions of each e i . For the future reference, by e i [ { ‘ X , r X } X ∈ Ω ] we denote the evaluation of expression e i when x X is substi-tuted by ‘ X and y X is substituted by r X , for each X ∈ Ω . This corresponds tothe length for some particular values of parameters { x X , y X } X ∈ Ω .Consider all maximal ab -factors of the same type, we guess the order be-tween their lengths, i.e., we guess which of them are equal and what is the orderbetween groups of expressions denoting equal lengths. We write the correspond-ing conditions into the system of equations; formally we divide these expres-sions into groups E , E , . . . , E k , one group contains only factors of the sametype and its elements correspond to factors of the same length. For each group E = { E i , E i , . . . , E i ‘ } we add equations e i = e i , e i = e i , . . . , e i ‘ − = e i ‘ ,which ensure that indeed those factors are of the same length. Then for allgroups E , E , . . . , E k of factors of the same type we guess the relation betweenthe lengths of factors between the groups, i.e.,. for each two groups E i and E j we choose elements from the group, say E i and E j , and add the appropriate ofthe inequalities e i < e j or e i > e j to the system. Note that we can rule out thepossibility that e i = e j , as we put e i and e j in different groups Verification
As the constructed Diophantine system D is of polynomial size, itcan be non-deterministically verified in polynomial time, in particular, this canbe done in PSPACE , see e.g., [12]. If the verification fails, we terminate.
Replacement
When the system D is successfully verified, we replace all ab -factorsin one group by a new letter, i.e., blocks { E i , E i , . . . , E i k } are replaced with aletter a e i (the choice of e i is arbitrary), obtaining the new equation. Family of inverse operators
The corresponding family of inverse operators isdefined in terms of system D , the popped prefixes and suffixes { s X , s X } X ∈ Ω and the maximal blocks E , E , . . . , E k (replaced with letters c e , c e , . . . , c e k ),call this class Φ D, { s X ,s X } X ∈ Ω ,E ,...,E k . For each solution { ‘ X , r X } X ∈ Ω of D thefamily contains an operator ϕ { ‘ X ,r X } X ∈ Ω . The action of such an operator (on X )are as follows: it first replaces each letter c e i with ab -block E i [ { ‘ X , r X } X ∈ Ω ] (soof length e i [ { ‘ X , r X } X ∈ Ω ]). Afterwards, we append/prepend blocks s X [ ‘ X ] and s X [ r X ] to the substitution for X .Note that this family of operators is of the form promised in Section 2.2. Inverse operator for a particular solution
For a solution ( σ, h ) consider the runof
CompCr ( U, V, ab ) in which the non-deterministic choices are done accordingto σ : i.e., we guess { s X , s X } X ∈ Ω such that s X [ ‘ X ] is the ab -prefix of σ ( X )22 lgorithm 2 CompCr ( U, V, ab ) Compression of ab -blocks for a crossing ab p ← idempotent power of ρ ( ab ) in M m . Guess and verify when needed. Thesame as for ab for { X, X } ∈ Ω do . Consider X and its involution at the same time3: guess ab -prefix of s X of σ ( X ) . May depend on a parameter x X
4: add constraint x X ≥ x X ≥ . Depending on s X andwhether a = b . x X ≥ a = b , a = a , b = b and x X ≥ a = b if x X < p then . Guess when applicable6: guess ‘ X , where ‘ X < p . value of x X
7: add x X = ‘ X to D , calculate ρ x ← ρ ( s X [ ‘ X ])8: else
9: guess ‘ X , where 0 ≤ ‘ X < p . value of x X mod p
10: add { x X = k · p + ‘ X , k > } to D , calculate ρ s ← ρ ( s X [ ‘ X + p ])11: guess ρ X such that ρ ( X ) = ρ s ρ X
12: replace each X with s X X , set ρ ( X ) ← ρ X if σ ( X ) = (cid:15) and ρ ( X ) = ρ ( (cid:15) ) then . Guess14: remove X from the equation15: Perform symmetric actions on the end of X .
With parameter y X
16: let E , E , . . . , E ‘ be the maximal ab -factors in ( U, V ) and e , e , . . . , e ‘ theirlengths17: partition { E , E , . . . , E ‘ } into groups {E , . . . , E k } , . Guess the partition . Each group has ab -factors of the same type18: for each group E i j = { E i , E i , . . . , E i ‘ } do
19: add equations { e i = e i , e i = e i , . . . , e i ‘ − = e i ‘ } to D for different groups E i and E j of ab -factors of the same type do
21: take any e i ∈ E i , e j ∈ E j , add one of inequalities { e i < e j } or { e i < e j } to D
22: verify system
D .
In NP23: for each part E i = { E i , E i , . . . , E i ‘ } do
24: let c e i be an unused constant25: replace blocks E i , E i , . . . , E i ‘ by c e i and s X [ r X ] is the ab -suffix of σ ( X ) for appropriate values { ‘ X , r X } X ∈ Ω (when σ ( X ) = s X [ ‘ X ] we guess s X = (cid:15) ). We partition the arithmetic expressionsaccording to σ , i.e., E i and E j (of the same type) are in one group if and onlyif E i [ { ‘ X , r X } X ∈ Ω ] = E j [ { ‘ X , r X } X ∈ Ω ] (which in particular implies that theirlengths e i [ { ‘ X , r X } X ∈ Ω ] and E j [ { ‘ X , r X } X ∈ Ω ] are equal). Additionally, for twodifferent groups E i and E j of expressions of the same type we add an equation e i
U, V ) with ( σ, h ) and ϕ { ‘ X ,r X } X ∈ Ω ∈ Φ D, { s X ,s X } X ∈ Ω ,E ,...,E k is thecorresponding inverse operator. Concerning homomorphism h , we extend h tonew constants by setting h ( c e i ) = h ( e i [ { ‘ X , r X } X ∈ Ω ]).It remains to formally state and prove the above intuitions.23 emma 7. CompCr ( U, V, ab ) transforms solutions. Let D be the system returnedby CompCr ( U, V, ab ) for the corresponding non-deterministic choices, and let X left-popped s X and right-popped s X and let expressions in groups E , . . . , E k bereplaced with letters c e , . . . , c e k . Then the family Φ D, { s X ,s X } X ∈ Ω ,E ,...,E k is thecorresponding family of operators.Proof. Let us focus on a proper equation (
U, V ). As a first step, we shall showthat indeed all maximal blocks have lengths that are arithmetic expressions in { x X , y X } X ∈ Ω , there are polynomially (in | U | + | V | ) many such lengths and thateach of them of them is also of polynomial size. Consider, what letters can beincluded in a maximal ab -factor. As the equation is proper, before any poppingthere are O ( | U | + | V | ) letters in the equation. There are at most 2( | U | + | V | )popped factors (two for each occurrence of a variable) and each of the length isat most 3 + 2 x X (or 3 + 2 y X ). Hence, the total sum of lengths is O ( | U | + | V | )plus 2 P X ∈ Ω ( x X + y X ), as claimed. Now, every nonempty popped s X (and s X )goes into exactly one maximal ab -factor, so indeed the lengths are expressionslinear in { x X , y X } X ∈ Ω .We now show that if ( U, V ) has a solution ( σ, h ) then for appropriate non-deterministic choices we transform it into ( U , V ) with ( σ , h ) and the inverseoperator is in the defined family. So consider such a solution. As already noted,consider the non-deterministic guesses of CompCr ( U, V, ab ) that are consistentwith ( σ, h ), i.e., for each variable X let its ab -prefix and ab -suffix be s X [ ‘ X ]and s X [ r X ] (note that it may be that s X does not depend on the parameter x X , or s X on y X , it may be that one of them is (cid:15) ; additionally, when σ ( X ) = s X [ ‘ X ], we take s X = (cid:15) ). Let CompCr ( U, V, ab ) guess those s X and s X . Let also CompCr ( U, V, ab ) remove X from the equation only when this is needed, i.e., σ ( X ) = s X [ ‘ X ] s X [ r X ].Consider the equation ( U , V ) obtained from the equation calculated so farby CompCr ( U, V, ab ) by substituting { ‘ X , r X } X ∈ Ω for { x X , y X } X ∈ Ω . Then it hasa solution ( σ , h ), where σ ( X ) = s X [ ‘ X ] σ ( X ) s X [ r X ]. Moreover, σ ( U ) = σ ( U ).This is easy to see: s X [ ‘ X ] and s X [ r X ] are the ab -prefix and ab -suffix of σ ( X )(by their definition) and we replace X by s X [ ‘ X ] Xs X [ r X ] (or s X [ ‘ X ] s X [ r X ]).Let E , . . . , E ‘ be the maximal ab -factors calculated by the CompCr ( U, V, ab ).Then in ( U , V ) the maximal ab -factors are E [ { ‘ X , r X } X ∈ Ω ] , . . . , E ‘ [ { ‘ X , r X } X ∈ Ω ]and have lengths e [ { ‘ X , r X } X ∈ Ω ], . . . , e ‘ [ { ‘ X , r X } X ∈ Ω ]: the s X and s X werechosen so that they are of the type of the ab -prefix and ab -suffix of σ ( X ) and s X [ ‘ X ] and s X [ r X ] are the prefix and suffix of σ ( X ).Lastly, the ab is non-crossing in ( U , V ) in σ : suppose that it is not. As weassumed that we removed X when σ ( X ) = s X [ ‘ X ] s X [ r X ] then this means that σ is non-empty and so we can apply Lemma 4. As the cases listed in the lemmaare symmetric, suppose that aX occurs in ( U , V ) and σ ( X ) begins with b . If s X = (cid:15) then this is a contradiction, as then σ ( X ) also begins with b and so weguessed the ab -prefix of σ ( X ) incorrectly. Thus s X = (cid:15) and so also s X [ ‘ X ] = (cid:15) . If s X [ ‘ X ] consists of at least two letters then it is an ab -factor and it overlaps withthe ab -factor consisting of the last letter of s X [ ‘ X ] and the following b and so byLemma 3 the s X [ ‘ X ] b is also an ab -factor, which contradicts the choice of s X .24f s X is a single letter, i.e., a , then we clearly guessed incorrectly: s X [ ‘ X ] σ ( X )begins with ab and so also σ ( X ) begins with ab , thus we should have popped an ab -factor from it and not a single a . The other cases are shown in the same way.At this moment CompCr ( U, V, ab ) also calculates the transition ρ s as wellas adds some equations to the system. Let it make the following choices: if ‘ X < p then let it guess that x X < p and guess ‘ X as the value for x X .Then ‘ X satisfies the added equations x X < p and x X = ‘ X . We calculate thetransition ρ s = ρ ( s X [ ‘ X ]) and there is a transition ρ X = ρ ( σ ( X )) such that ρ s ρ X = ρ ( X ); we make the corresponding nondeterministic choices. If ‘ X ≥ p then let CompCr ( U, V, ab ) guess this. The added inequality x X ≥ p is satisfiedby ‘ X . Additionally, we guess ‘ X = ‘ X mod p , then the added equations x X = kp + ‘ X and k ≥ ‘ X and some k (which is irrelevant later on).Moreover, as p is an idempotent power for ρ ( ab ) (or ρ ( a ), when a = b ; for thesimplicity of presentation in the following we consider only the former case), weknow that ρ ( s X [ ‘ X ]) = ρ ( s X [ ‘ X + p ]), so ρ s = ρ ( s x [ ‘ X ]) and it is also correctlycalculated. Hence we can guess ρ X to be the transition for ρ ( σ ( X )) and then ρ ( X ) = ρ s ρ X .Consider the equations and inequalities on e , . . . , e k added to D . An equality e i = e j is added if and only if E i [ { ‘ X , r X } X ∈ Ω ] = E j [ { ‘ X , r X } X ∈ Ω ] (whichimplies that e i [ { ‘ X , r X } X ∈ Ω ] = e j [ { ‘ X , r X } X ∈ Ω ]) and we consider the choicesin which inequality e i < e j is added only when the corresponding blocks areof the same type and e i [ { ‘ X , r X } X ∈ Ω ] < e j [ { ‘ X , r X } X ∈ Ω ]. Thus { ‘ X , r X } X ∈ Ω satisfy those equations and inequalities as well.Let us now investigate the replacement of ab -factors by CompCr ( U, V, ab ). Re-call that we take the non-deterministic choices in which it assigns E i and E j intothe same group if and only if E i [ { ‘ X , r X } X ∈ Ω ] = E j [ { ‘ X , r X } X ∈ Ω ] and they rep-resent factors of the same type. Then the corresponding ab -factors in ( U , V ) areequal. Thus the action of CompCr ( U, V, ab ) are equivalent to
CompNCr ( U , V , ab )(up to naming of the new letters), recall that we already shown that ab isnon-crossing in σ . Lemma 6 guarantees that when ab is non-crossing in σ then CompNCr ( U , V , ab ) transforms the solution σ and the inverse operatorreplaces letters c e i with the corresponding blocks of length e i [ { ‘ X , r X } X ∈ Ω ].So let ( U , V ) with ( σ , h ) be transformed to ( U , V ) with ( σ , h ), as guar-anteed Lemma 6. By the same lemma we know what is the inverse operatorthat transforms ( U , V ) with ( σ , h ) to ( U , V ) with ( σ , h ). From previ-ous considerations we also know what is the inverse operator that transforms( U , V ) with ( σ , h ) to ( U, V ) with ( σ, h ). It is easy to see that their compo-sition is exactly ϕ { ‘ X ,r X } X ∈ Ω from Φ D, { s X ,s X } X ∈ Ω ,E ,...,E k . As { ‘ X , r X } X ∈ Ω isa solution of D , this shows the the appropriate inverse operator indeed is in Φ D, { s X ,s X } X ∈ Ω ,E ,...,E k .Concerning the weight, note that Lemma 6 shows that w( σ , h ) ≤ w( σ , h )and the inequality is strict if ( U , V ) = ( U , V ). Similarly, since σ ( X ) = s X [ ‘ X ] σ ( X ) s X [ r X ] and each X was replaced with s X [ ‘ X ] Xs X [ r X ], each popped s X [ ‘ X ] introduces | s X [ ‘ X ] | to w( σ , h ), while in ( σ , h ) it introduced 2 | h ( s X [ ‘ X ]) | ,the same applies to s X [ r X ]. Thus w( σ , h ) ≤ w( σ, h ) and if any of s X , s X is non-25mpty, the inequality is strict. In the end, w( σ , h ) ≤ w( σ, h ) and the equalityhappens only when no factor was replaced and nothing was popped, i.e., when( U, V ) = ( U , V ), as claimed.We now move to the next part of the proof. Assume that ( U, V ) is turnedinto the equation ( U , V ) that has a solution ( σ , h ) and system D was cre-ated on the way; let also s X and s X be popped to the left and right from X (any of those may be (cid:15) ), finally, let blocks from partition parts E , E , . . . , E k be replaced with letters c e , c e , . . . , c e k . We are to show that for any oper-ator ϕ ∈ Φ D, { s X ,s X } X ∈ Ω ,E ,...,E k the ( ϕ [ σ ] , h ) is a solution of ( U, V ), for anyhomomorphism h for ϕ [ σ ]( U ) compatible with ρ (and that there is such a ho-momorphism h ).First observe that ϕ corresponds to some solution { ‘ X , r X } X ∈ Ω of D .Consider the equation obtained by CompCr ( U, V, ab ) after popping letters butbefore replacement of ab -factors, i.e., the one using parameters { x X , y X } X ∈ Ω .Consider the equation obtained by substituting { ‘ X , r X } X ∈ Ω for those parame-ters, i.e., each s X is replaced with s X [ ‘ X ] and each s X by s X [ r X ]. Denote thisequation by ( U , V ). If ( σ , h ) is a solution of ( U , V ) then ( σ, h ) is a solution of( U, V ), where σ ( X ) is obtained from σ ( X ) by appending s X [ ‘ X ] and prepending s X [ r X ] to σ ( X ): – Since σ ( X ) = s X [ ‘ X ] σ ( X ) s X ( r X ) and ( U , V ) was obtained by replacing X with s X [ ‘ X ] Xs X [ r X ] (or s X [ ‘ X ] s X [ r X ] and then σ ( X ) = (cid:15) ), we get that σ ( U ) = σ ( U ) and similarly σ ( V ) = σ ( V ). – For the constraints: ρ ( σ ( X )) = ρ X calculated by CompCr ( U, V, ab ) andsatisfying the condition ρ ( X ) = ρ s X ρ X ρ s X . As { ‘ X , r X } is a solution of D then CompCr ( U, V, ab ) correctly calculated ρ s X = ρ ( s X [ ‘ X ]) and ρ s X = ρ ( s X [ r X ]). – For the involution, note that we assume that σ ( X ) = σ ( X ) and s X = s X and so we get that σ ( X ) = σ ( X ).Note that the inverse operator transforming the solutions of ( U , V ) to so-lutions of ( U, V ) is a ‘second part’ of the inverse operator ϕ .Now consider an equation obtained from ( U , V ) by replacing every letter a e i by an ab -factor E i [ { ‘ X , r X } X ∈ Ω ]. Change the solution of σ in the sameway, obtaining σ . Concerning the constraints, note that we define ρ ( c e i ) so that ρ ( c e i ) = ρ ( e i [ { ‘ X , r X } X ∈ Ω ]), assuming that we properly calculate the latter.As { ‘ X , r X } X ∈ Ω is a solution of D and we calculated the idempotent power p correctly, this is the case: when ‘ X < p we make the calculations explicit andotherwise we have that ρ ( ab ) ‘ X = ρ ( ab ) p + ‘ X , where ‘ X mod p = ‘ X , whichis calculated by the algorithm. Note that this change is the first part of theoperation performed by ϕ .Observe that σ ( U ) = σ ( V ), as each letter a e i was replaced in the sameway in the equation and in the solution, so σ is a solution of ( U , V ), as claimed.As equation is proper, we take any homomorphism h , so it is left to show thatat least one such a homomorphism exists: for letters that are present in ( U, V )note that a compatible h can be defined for them, as we assumed that ( U, V ) is26roper. Letters in σ ( U ) that are not in ( U, V ) were taken from ( U , V ) and soa compatible h for such letters is known to exist. ut Main transformation.
The main procedure
TransformEq ( U, V ) first lists all ab s that are either factors in ( U, V ) or are crossing in σ (note that the latter needto be guessed). While any of them is non-crossing and present in the equation,we compress this factor (and remove it from the list). When none factor in thelist is non-crossing, we guess the crossing ab s (note that we always include allthe remaining factors in the list). Then for each of those factors we compress itusing CompCr . Algorithm 3
TransformEq ( U, V ) P ← list of explicit or crossing ab ’s in U , V .
At most | U | + | V | + 4 n while there is a non-crossing ab ∈ P such that ab is a factor in U or V do CompNCr ( U, V, ab )4: remove ab from P P ← crossing ab ’s . Done by guessing first and last constants of each σ ( X ), | P | ≤ n . P contains all factors from P still occurring in the equation6: for ab ∈ P do CompCr ( U, V, ab )8: return ( U, V ) The crucial property of
TransformEq is that it uses equation of bounded size,as stated in the following lemma. Note that this bound does not depend on thenon-deterministic choices of
TransformEq . Lemma 8.
Suppose that ( U, V ) is a strictly proper equation. Then during Trans-formEq the ( U, V ) is a proper equation and after it is strictly proper.Proof. Consider, how many constants are popped into the equation during
Trans-formEq . For a fixed ab , CompCr may introduce long ab -blocks at sides of eachvariable, but then they are immediately replaced with one constant, so we cancount them as one constant (and in the meantime each such popped prefix andsuffix is represented by at most four constants). Thus, 2 n constants are poppedin this way. There are at most 4 n crossing factors, see Lemma 5, so in total 8 n constants are introduced to the equation.Consider constants initially present in the equation. We show that for twosuch consecutive constants at least one is in a factor replaced during TransformEq .Suppose otherwise and let ab be those consecutive constants, clearly this factoris in P computed by TransformEq . If
TransformEq compressed ab during thecompression of non-crossing factors, then as we assumed that none of those a , b was replaced, this factor ab was present and so it was compressed, contradiction.So ab was not compressed during the compression of non-crossing factors. As it27till was a factor when we began compression of crossing factors, it was consideredas a factor to be replaced and so we either replaced it or one of its constants wasreplaced, which shows the claim. comp. factor comp. factorcomp. factoruncomp. constant Fig. 2.
Each uncompressed letter is followed by a compressed factor
Now, consider any sequence, say of length k , of constants initially present inthe equation, see Fig. 2. We estimate, how many of its constants were removedduring TransformEq . Each constant (except perhaps the last one) that was notpart of a replaced factor can be associated with the replaced factor to its right. Asa factor is replaced with a single constant, this means that at least k − initiallypresent constants were removed (note that if a factor includes a constant poppedfrom a variable then it looses all its initial constants, as we count the constantthat replaced it as the one popped from a variable).Let k , k , . . . , k ‘ be the (maximal) sequences of constants initially presentin the equation, define k = P ‘i =1 k i and observe that as there are two sides of theequation and each of (at most n ) variables terminates a sequence of constants,we have ‘ ≤ n + 2. Then at least ‘ X i =1 k i −
13 = k − ‘ ≥ k − n − n new constants introduced, we conclude that the number ofconstants in the equation is at most k − k − n −
23 + 8 n = 2 k n n . As initially the the equation had at most 27 n constants, this yields that after-wards again it has at most 27 n of them.Lastly, note that every equation on the way has at most 35 n constants:initially there are 27 n of them and we pop at most 8 n in total. ut .3 Proof of Lemma 2 and generation of the graphs representationof all solutions We are now ready to give the proof of Lemma 2. To this end we first reformulateit in the language of transformation of solutions.
Lemma 9 (A modernised statement of Lemma 2).
Suppose that ( U , V ) is a strictly proper equation with | U | , | V | > and a simple solution ( σ , h ) .Consider a run of TransformEq on ( U , V ) . Then for some nondeterministicchoices the obtained sequence of equations ( U , V ) , ( U , V ) , . . . , ( U k , V k ) withcorresponding families of inverse operators Φ , Φ , . . . , Φ k have simple solutions ( σ , h ) , ( σ , h ) , . . . , ( σ k , h k ) such that – < k = O ( n ) ; – all ( U , V ) , ( U , V ) , . . . , ( U k , V k ) are proper and ( U k , V k ) is strictly proper; – ( U i , V i ) with ( σ i , h i ) is transformed to ( U i +1 , V i +1 ) with ( σ i +1 , h i +1 ) , Φ i +1 isthe corresponding family of inverse operators and ( σ i +1 , h i +1 ) is a simplifi-cation of ( σ i +1 , h i +1 ) .Proof. Concerning the nondeterministic choices: firstly, let
TransformEq correctlyguess the set of crossing factors. Then for each considered factor ab from P (saywe have equation ( U i , V i ) with the solution ( σ i , h i )) let it correctly guess, whetherit is crossing or not in σ i . Then by Lemma 6, CompNCr ( U, V, ab ) transforms( U i , V i ) with ( σ i , h i ) to ( U i +1 , V i +1 ) with ( σ i +1 , h i +1 ), set σ i +1 as the simplifica-tion of σ i +1 . The same lemma guarantees that w( σ i , h i ) > w( σ i +1 , h i +1 ), if wereplaced at least one factor in ( U i , V i ).Now, let TransformEq correctly guess that no pair in P is non-crossing (for thecurrent equation ( U ‘ , V ‘ ) with ( σ ‘ , h ‘ )). Let it also correctly guess the set of cross-ing factors. Lastly, let during each call for CompCr ( U, V, ab ) let it make the cor-rect non-deterministic choices, in the sense of Lemma 7. Then this Lemma guar-antees that the equation ( U i , V i ) with ( σ i , h i ) is transformed by CompCr ( U, V, ab )into ( U i +1 , V i +1 ) with ( σ i +1 , h i +1 ), set σ i +1 as the simplification of σ i +1 . Thesame lemma guarantees that w( σ i , h i ) ≥ w( σ i +1 , h i +1 ) and the inequality isstrict if ( U i , V i ) = ( U i +1 , V i +1 .By Lemma 8 we know that the equation computed during TransformEq ( U, V )are proper and the last one of them is strictly proper, so this shows the boundon the size of ( U i , V i ) and on ( U k , V k ).Concerning size of k : one equation is created for one compressed pair. Thereare O ( n ) such factors in P and O ( n ) in P . To show that k >
1, it is enoughto show that at least one pair is compressed. Assume otherwise. As at least oneof U , V is of length 2 or more, there is some ab ∈ P . If ab is compressed as anelement of P , we are done, otherwise it goes to P . Without loss of generality,let ab be the first considered pair from P . Since it is in P , it is crossing and sowe fist uncross and then comprss it. ut Running time for satisfiability
For word equations over the free monoid (without the regular constraints) theknown algorithms [27, 14] (non-deterministically) verify the satisfiability in timepolynomial in n and log N , where N is the length of the length-minimal solution.In particular, it is the common belief that N is at most exponential in n , andshould this be so, those algorithms would yield that WordEquation is in NP .While our algorithm works in polynomial space, so far a similar bound on itsrunning time is not known.When no constraints are allowed in the equations the proof for the freemonoid follows the lines similar to Lemma 8: for a length-minimal solution σ when s is a factor in σ ( U ) then either s is a factor of U or it has a crossingoccurrence in σ (as otherwise we could remove all factors s from the solution,obtaining a shorter solution, which contradicts the length-minimality). Thus TransformEq ( U, V ) tries to compress each two-letter factor in σ ( U ) and so thesame argument as in Lemma 8 yields that the length of the length-minimal so-lution decreases after TransformEq ( U, V ) by a constant factor, so there are onlylog N applications of TransformEq ( U, V ).However, the regular constraints make such an argument harder: when wecross out a factor s from σ ( X ), the ρ ( σ ( X )) changes, which is not allowed.However, this can be walked around: instead of crossing s out we replace it witha single constant that has the same transition as s . To this end we extend theoriginal alphabet: we add to the original alphabet A constants a P for each P ∈ ρ ( A + ), where ρ ( A + ) denotes the image of A + by ρ , i.e., { ρ ( w ) | w ∈ A + } . Thisset can be big, so we do not store it explicitly, instead we have a subprocedurethat tests whether P ∈ ρ ( A + ).There is another technical note: as we often apply simplification we do notreally know what happens with a length-minimal solution. However, for a tuneddefinition of length-minimal solutions, which takes into the account also theweight of the solution as a secondary factor, each length-minimal solution insome sense cannot be simplified. ρ -closed alphabets We begin with the precise definition of the ρ -closure of the alphabet and thenshow that a word equation with constraints is satisfiable over A if and only if itis satisfiable over the ρ -closure of A .Given a finite alphabet A together with a homomorphism ρ from A to M m we say that an alphabet A is ρ - closed if ρ ( A ) = ρ ( A + ), i.e., for each word w ∈ A + there exists a constant a such that ρ ( w ) = ρ ( a ).Usually, an alphabet is not ρ -closed, however, we can naturally extend with‘missing’ constants: for an alphabet A define a ρ - closure cl ρ ( A ) of A :cl ρ ( A ) = A ∪ (cid:8) a P (cid:12)(cid:12) there is w ∈ A + such that ρ ( w ) = P (cid:9) , a P is a fresh constant not in A , a P = a P T and a P = a P when P = P .It is easy to see that cl ρ ( A ) is ρ -closed. Whenever clear from the context, we willdrop ρ in the notation and talk about closure and cl.Viewing the equation over A as an equation over cl( A ) does not change thesatisfiability. Lemma 10.
Suppose that we are given a word equation ( U, V ) with regular con-straints (defined using a homomorphism ρ ) over a free monoid generated by ρ -closed alphabet A . Then ( U, V ) has a solution over A if and only if it has asolution when treated as an equation over the alphabet of constants cl( A ) . Note that the set of all solution of the equation is of course different for A andcl( A ), though in this section we are interested only in the satisfiability. Proof. If σ is a solution over A then it is of course a solution over cl( A ).On the other hand, when σ is a solution over cl( A ) then we can create asolution over A : for each P ∈ ρ ( A + ) choose a word w P such that ρ ( w P ) = P ,moreover choose in a way so that w P = w P T , and replace every a P in σ ( X )by w P . Since constants a P do not occur in the equation, it is routine to checkthat the obtained substitution is a solution (and since ρ ( w P ) = ρ ( a P ), that allconstraints are satisfied). ut Oracles for cl( A ) Note that the size of cl( A ) may be much larger than | A | (infact, exponential in the input size). Thus we cannot store it explicitly, instead,whenever a constant from cl( A ) \ A is introduced to the instance, we verify,whether it is indeed in cl( A ), i.e., whether the corresponding transition matrix P is in ρ ( A + ). In general, such check can be performed in PSPACE (and in factit is
PSPACE -complete in some cases), but it can be performed more efficiently,when we know an upper-bound on | cl( A ) | . Lemma 11.
It can be verified in
PSPACE , whether P ∈ ρ ( A ) . Alternatively,this can be verified in poly ( | ρ ( A + ) | , n ) time.Proof. The proof is standard.Let w P = a a · · · a k be the shortest (non-empty) word such that ρ ( w P ) = P . As M m has at most 2 m elements, we have that k ≤ m : if it werelonger then ρ ( a · · · a i ) = ρ ( a · · · a j ) for some i < j and thus ρ ( a a · · · a k ) = ρ ( a a · · · a i a j +1 · · · a k ), which cannot happen, as this word is shorter than w P .Thus in PSPACE we can non-deterministically guess the constants a , a ,. . . , a k and verify that indeed ρ ( a a · · · a k ) = P . Alternatively, we can deter-ministically list all elements of ρ ( A + ) in poly ( | ρ ( A + ) | , n ) time. ut Length-minimal solution
We now give a proper definition of a length minimalsolution: First, we compare the solutions ( σ , h ) and ( σ , h ) by | σ ( U ) | and | σ ( U ) | and if those are equal, by w( σ , h ) and w( σ , h ).31 efinition 7 (Length-minimal solution). A solution ( σ , h ) (of an equa-tion ( U, V ) ) is length-minimal if for every other solution ( σ , h ) of this equationeither – | σ ( U ) | < | σ ( U ) | or – | σ ( U ) | = | σ ( U ) | and w( σ , h ) ≤ w( σ , h ) . Note that our definition refines the usual one, in the sense that if a solutionis length-minimal according to Definition 7, it is also length-minimal in thetraditional sense, but not the other way around. Furthermore, for the inputequation the h is constant on all constants in the solution, so our refined notioncoincides with the traditional one. ρ -closed alphabet We can show that the length of the length-minimal solution shortens by a con-stant fraction in each run of
TransformEq . Lemma 12.
Let the original alphabet of the problem be a ρ -closed A . Supposethat a strictly proper equation ( U, V ) over an alphabet of constants B ⊇ A has a length-minimal solution ( σ, h ) . Then ( σ, h ) is simple and for some non-deterministic choices TransformEq transforms ( U, V ) with a ( σ, h ) into a strictlyproper ( U , V ) with a simple solution ( σ , h ) such that | σ ( X ) | ≤ σ ( X )+13 foreach variable X . Note that by definition a proper equation over B has a homomorphism h : B A + that is compatible with ρ , i.e., ρ ( b ) = ρ ( h ( b )), in particular ρ ( B ) ⊆ ρ ( A + ). Proof.
Consider a length-minimal solution ( σ, h ) and an application of
Trans-formEq on (
U, V ). According to Lemma 9 for appropriate non-deterministicchoices made by
TransformEq we obtain a sequence of equations (
U, V ) = ( U , V ),( U , V ), . . . , ( U k , V k ), operators ϕ , ϕ , . . . , ϕ k and solutions ( σ, h ) = ( σ , h ),. . . , ( σ k , h k ) such that σ i = ϕ i +1 [ σ i +1 ] and ( σ i +1 , h i +1 ) is a simplification of( σ i +1 , h i +1 ). Suppose first that ( σ , h ) is not simple. Then it uses a letter b thatis not present in ( U , V ) and h ( b ) ∈ A (cid:62) , let P = ρ ( b ). Consider a substitution σ obtained from σ by replacing each b by a P (and each b by a P T = a P ). As B does not occur in ( U , V ), σ ( U ) = σ ( V ), moreover ρ ( σ ( X )) = ρ ( σ ( X )).Since the alphabet of σ is a subset of the alphabet of σ , we conclude that( σ , h ) is a solution of ( U , V ). Clearly | σ ( U ) | = | σ ( U ) | . Additionally, | σ ( X ) | ≤ | σ ( X ) | and the inequality is strict if σ ( X ) contains b or b . As forsome X the σ ( X ) indeed contains b or b , we conclude that w( σ , h ) < w( σ , h ),which contradicts the length-minimality of ( σ , h ).In a similar fashion we want to show that all ( σ , h ), . . . , ( σ k , h k ) are simple.For the sake of contradiction assume that this is not the case and take thesmallest i for which ( σ i , h i ) is not simple. Then in particular ( σ i , h i ) = ( σ i , h i )and ( σ i , h i ) uses a constant b that does not occur in the alphabet of ( U i , V i ), let32 = ρ ( b ). By discussion between the lemma and the proof, there is a P ∈ A suchthat ρ ( a P ) = P . Create ( σ i , h i ) by replacing each b and b in any σ ( X ) by a P and a P . As in the case of ( σ , h ) it is easy to verify that ( σ i , h i ) is a solutionof ( U i , V i ). Now, by definition of σ i and ϕ , . . . , ϕ i σ = ϕ ◦ ϕ ◦ · · · ◦ ϕ i [ σ i ] . and denote by ϕ the ϕ ◦ ϕ ◦ · · · ◦ ϕ i . Consider an action of any of ϕ , ϕ , . . . , ϕ i on some substitution. It may append and prepend letters to σ ( X ) (independentlyof X and of the substitution) and it may replace some letters (outside of A ) bylonger factors, again independently of X and of the substitution. Thus also theircomposition ϕ has this property. Consider now σ = ϕ [ σ i ] . We intend to show that ( σ , h ) is a solution of ( U , V ) and that it contradictsthe length-minimality of ( σ , h ). We need to show that h is defined on anyletter assigned by σ outside A . But if this was the case, the same letter wouldbe used also by σ : if this letter was used by σ i and not replaced by ϕ thenthe same applies to σ i . If it was appended or prepended, then the same letteris appended or prepended to σ i . It is left to show that ( σ , h ) is not length-minimal.Firstly, we show that | σ ( U ) | ≥ | σ ( U ) | . Consider that ϕ [ σ i ] and ϕ [ σ i ]and their action of X . Then ϕ prepends and appends the same strings to σ i ( X )and σ i ( X ), additionally, it replaces letters (outside A ) in σ i ( X ) and σ i ( X ) bythe same strings. As σ i ( X ) is obtained from σ i ( X ) by replacing b and b by a P , a P ∈ A , so σ ( X ) and σ ( X ) differ only in strings that replace b and b : inthe former those are a P and a P while in the latter those are some strings (oflengths at least 2). Thus | σ ( X ) | ≤ | σ ( X ) | and the inequality is strict when b or b is in σ i ( X ). As this constant occurs in at least one σ i ( X ), we conclude that σ is not length-minimal.In exactly the same way we can show that if for some i the ab is a factor in σ i ( U i ) then some ab -factor occurs in ( U i , V i ) or is crossing for σ i : otherwise wecould replace each ab -factor s in any σ ( X ) with a ρ ( s ) , the obtained substitution σ i (together with h i ) is a solution and ϕ ◦ ϕ ◦ · · · ◦ ϕ i [ σ i ] (together with h )is a solution of ( U , V ) and this solution contradicts the length-minimality of σ = ϕ ◦ ϕ ◦ · · · ◦ ϕ i [ σ i ].We move to the main part of the proof. Firstly, assume that TransformEq correctly guesses the set of crossing factors at the very beginning. Let ( U ‘ , V ‘ )be the equation obtained when TransformEq (correctly) decides that no pair from P is non-crossing and afterwards it correctly lists crossing factors (and beginsto compress them). Consider σ k ( X ). As σ ( X ) = ϕ ◦ ϕ ◦ · · · ◦ ϕ k [ σ k ] and eachof the operator can append constants, prepend constants and replace constantsby (strictly) longer words, we know that each constant in σ k ( X ) correspondseither to a single (“uncompressed”) constant from σ ( U ) or to a longer wordinside σ ( U ) (compressed into this constant). We claim that in σ k ( X ) there areno two consecutive constants that are uncompressed. Using this we can easily33how the claim: each uncompressed constant in σ k ( U k ), except perhaps the last,is followed by a constant representing at least two constants in the initial word.Suppose that ab is a factor in σ k ( U k ) and that they both are uncompressed.Thus the corresponding ab is present in σ ‘ ( U ‘ ) and so be earlier claim ab eitheroccurs in ( U ‘ , V ‘ ) or is a crossing factor, in either case it will be in P . Then TransformEq performs the ab compression, contradiction. ut Running time for equations over groups
As a consequence, we can verifythe satisfiability of a word equation in free groups (without rational constraints)in (nondeterministic) time npoly (log
N, n ), where N is the size of the lengthminimal solution. Theorem 2.
The satisfiability of word equation over free group (without rationalconstraints) can be verified in
PSPACE and at the same time npoly (log
N, n ) time,where N is the size of the length-minimal solution of this equation.Proof. We reduce the problem in a free group to the corresponding one in afree semigroup, see Proposition 1. In this way we introduce regular constraint,and these are the only constraints in the problem. This constraint says that aa cannot be a factor of X , for any a . The NFA for this condition has | Γ | + 2states: – sink (all transitions to itself) – initial state – a state ( a, b ), where a is the first constant of the word and b the last.The transitions are obvious. It is easy to see that M m have O ( | Γ | ) elements.Thus the subprocedure for checking whether P ∈ ρ ( A + ) can be implemented in poly ( n ), see Lemma 11.Concerning the problem in the free monoid, we first extend the alphabet A to cl( A ). By Lemma 10 those problems are equisatisfiable. By Lemma 12 thelength of the substitution for a variable drops by a constant fraction after eachapplication of TransformEq (for appropriate non-deterministic choices), so thereare only O (log N ) application of this procedure till all variables are removed. Asthere are no variables in the equation and the weight (i.e., length of the equation)decreases after each application of TransformEq , afterwards there are only O ( n )such applications. Clearly each such an application takes time polynomial in n (as all equation are proper by Lemma 8). ut Using the results above we obtain the following theorem:
Theorem 3.
It can be decided in
PSPACE whether the input system with ratio-nal constraints has a finite number of solutions. roof. To find out whether the equation has infinite number of solutions it isenough to find a path from a start node of the graph to a final node which either – contains a loop or – one of the edges of the path is labeled by a linear system of equations havinginfinite number of solutions or – the final node has infinite number of solutions, which means that it is of theform ( X, Y ), ρ ( X ) = ρ ( Y ) and there are infinitely many words w such that ρ ( w ) = ρ ( X ).The first condition is a simple reachability in a graph, which can be performedin NPSPACE , as the description of the nodes and edges are of polynomial size.The second condition can be verified in NP , see Proposition 2. The last conditioncan be easily verified in PSPACE . Since
NPSPACE contains NP and is equal to PSPACE , the search of such a path can be done in
PSPACE .Now if none of those conditions is satisfied, the graph representation of allsolutions is a finite DAG, for each edge the family of inverse operators is finiteand each final node has finitely many solutions, which implies that there areonly finitely many solutions in total. ut References [1] M. Benois. Parties rationelles du groupe libre.
C. R. Acad. Sci. Paris, S´er. A ,269:1188–1190, 1969.[2] F. Dahmani and V. Guirardel. Foliations for solving equations in groups: free,virtually free and hyperbolic groups.
J. of Topology , 3:343–404, 2010.[3] L. E. Dickson. Finiteness of the odd perfect and primitive abundant numberswith n distinct prime factors. American Journal of Mathematics , 35(4):413–422,1913.[4] V. Diekert, C. Guti´errez, and Ch. Hagenah. The existential theory of equationswith rational constraints in free groups is PSPACE-complete.
Information andComputation , 202:105–140, 2005. Conference version in STACS 2001, LNCS 2010,170–182, 2004.[5] V. Diekert and M. Lohrey. Word equations over graph products.
IJAC , 18(3):493–533, 2008.[6] V. Diekert, Yu. Matiyasevich, and A. Muscholl. Solving word equations modulopartial commutations.
Theoretical Computer Science , 224:215–235, 1999. Specialissue of LFCS’97.[7] V. Diekert and A. Muscholl. Solvability of equations in free partially commutativegroups is decidable.
International Journal of Algebra and Computation , 16:1047–1070, 2006. Journal version of ICALP 2001, 543–554, LNCS 2076.[8] V. G. Durnev. Undecidability of the positive ∀∃ -theory of a free semi-group. Sibirsky Matematicheskie Jurnal , 36(5):1067–1080, 1995. In Russian; Englishtranslation:
Sib. Math. J., 36 (5), 917–929, 1995.[9] S. Eilenberg.
Automata, Languages, and Machines , volume A. Academic Press,New York and London, 1974.[10] C. Guti´errez. Satisfiability of word equations with constants is in exponentialspace. In
Proc. 39th Ann. Symp. on Foundations of Computer Science (FOCS’98),Los Alamitos (California) , pages 112–119. IEEE Computer Society Press, 1998.
11] C. Guti´errez. Satisfiability of equations in free groups is in PSPACE. In
Proceed-ings 32nd Annual ACM Symposium on Theory of Computing, STOC’2000 , pages21–27. ACM Press, 2000.[12] J. E. Hopcroft and J. D. Ulman.
Introduction to Automata Theory, Languagesand Computation . Addison-Wesley, 1979.[13] L. Ilie and W. Plandowski. Two-variable word equations.
Theoretical Informaticsand Applications , 34:467–501, 2000.[14] A. Je˙z. Recompression: a simple and powerful technique for word equations. InN. Portier and T. Wilke, editors,
STACS , volume 20 of
LIPIcs , pages 233–244,Dagstuhl, Germany, 2013. Schloss Dagstuhl–Leibniz-Zentrum fuer Informatik.[15] O. Kharlampovich and A. Myasnikov. Irreducible affine varieties over a free group.II: Systems in triangular quasi-quadratic form and description of residually freegroups.
J. of Algebra , 200(2):517–570, 1998.[16] O. Kharlampovich and A. Myasnikov. Elementary theory of free non-abeliangroups.
J. of Algebra , 302:451–552, 2006.[17] A. Ko´scielski and L. Pacholski. Complexity of Makanin’s algorithm.
Journal ofthe Association for Computing Machinery , 43(4):670–684, 1996.[18] G. S. Makanin. The problem of solvability of equations in a free semigroup.
Math.Sbornik , 103:147–236, 1977. English transl. in Math. USSR Sbornik 32 (1977).[19] G. S. Makanin. Equations in a free group.
Izv. Akad. Nauk SSR , Ser. Math.46:1199–1273, 1983. English transl. in Math. USSR Izv. 21 (1983).[20] G. S. Makanin. Decidability of the universal and positive theories of a free group.
Izv. Akad. Nauk SSSR , Ser. Mat. 48:735–749, 1984. In Russian; English translationin:
Math. USSR Izvestija, 25 , 75–88, 1985.[21] Yu. Matiyasevich.
Hilbert’s Tenth Problem . MIT Press, Cambridge, Mas-sachusetts, 1993.[22] Yu. Matiyasevich. Some decision problems for traces. In S. Adian and A. Nerode,editors,
Proceedings of the 4th International Symposium on Logical Foundationsof Computer Science (LFCS’97), Yaroslavl, Russia, July 6–12, 1997 , volume 1234of
Lecture Notes in Computer Science , pages 248–257, Heidelberg, 1997. Springer-Verlag. Invited lecture.[23] W. Plandowski. Satisfiability of word equations is in NEXPTIME. In
Proceedingsof the Symposium on the Theory of Computing STOC’99 , pages 721–725. ACMPress, 1999.[24] W. Plandowski. Satisfiability of word equations with constants is in PSPACE.
Journal of the Association for Computing Machinery , 51:483–496, 2004.[25] W. Plandowski. An efficient algorithm for solving word equations. In
Proceedingsof the 38th Annual Symposium on Theory of Computing STOC’06 , pages 467–476.ACM Press, 2006.[26] W. Plandowski. personal communication, 2014.[27] W. Plandowski and W. Rytter. Application of Lempel-Ziv encodings to the solu-tion of word equations. In K. G. Larsen et al., editors,
Proc. 25th InternationalColloquium Automata, Languages and Programming (ICALP’98), Aalborg (Den-mark), 1998 , volume 1443 of
Lecture Notes in Computer Science , pages 731–742,Heidelberg, 1998. Springer-Verlag.[28] A. A. Razborov.
On Systems of Equations in Free Groups . PhD thesis, SteklovInstitute of Mathematics, 1987. In Russian.[29] A. A. Razborov. On systems of equations in free groups. In
Combinatorial andGeometric Group Theory , pages 269–283. Cambridge University Press, 1994.[30] E. Rips and Z. Sela. Canonical representatives and equations in hyperbolic groups.
Inventiones Mathematicae , 120:489–512, 1995.
31] K. U. Schulz. Makanin’s algorithm for word equations — Two improvements anda generalization. In K. U. Schulz, editor,
Word Equations and Related Topics ,volume 572 of
Lecture Notes in Computer Science , pages 85–150, Heidelberg,1991. Springer-Verlag., pages 85–150, Heidelberg,1991. Springer-Verlag.