scieee AI-readable full text Open interactive document viewer

The HOM problem is EXPTIME-complete

Creus López, Carles,Gascon Caro, Adrian,Godoy Balil, Guillem,Ramos Garrido, Lander

Abstract

We define a new class of tree automata with constraints and prove decidability of the emptiness problem for this class in exponential time. As a consequence, we obtain several EXPTIME-completeness results for problems on images of regular tree languages under tree homomorphisms, like set inclusion, regularity (HOM problem), and finiteness of set difference. Our result also has implications in term rewriting, since the set of reducible terms of a term rewrite system can be described as the image of a tree homomorphism. In particular, we prove that inclusion of sets of normal forms of term rewrite systems can be decided in exponential time. Analogous consequences arise in the context of XML typechecking, since types are defined by tree automata and some type transformations are homomorphic.

Full text

Copyright © by SIAM. Unauthorized reproduction of this article is prohibited. SIAM J. COMPUT.c 2016 Society for Industrial and Applied Mathematics Vol. 45, No. 4, pp. 1230–1260 THE HOM PROBLEM IS EXPTIME-COMPLETE∗ CARLES CREUS†,ADRI ` AGASC ´ ON‡, GUILLEM GODOY†,AND LANDER RAMOS† Abstract. We define a new class of tree automata with constraints and prove decidability of the emptiness problem for this class in exponential time. As a consequence, we obtain several EXPTIME- completeness results for problems on images of regular tree languages under tree homomorphisms, like set inclusion, regularity (HOM problem), and finiteness of set difference. Our result also has implications in term rewriting, since the set of reducible terms of a term rewrite system can be described as the image of a tree homomorphism. In particular, we prove that inclusion of sets of normal forms of term rewrite systems can be decided in exponential time. Analogous consequences arise in the context of XML typechecking, since types are defined by tree automata and some type transformations are homomorphic. Key words. homomorphisms, regular languages, transducers, tree automata AMS subject classifications. 68Q17, 68Q42, 68Q45 DOI. 10.1137/140999104 1. Introduction. Tree automata [7, 17] are a well studied formalism for representing term languages. They characterize the “regular term languages,” a classical concept used, e.g., to describe the parse trees of a context-free grammar or the well-formed terms over a sorted signature [25], to characterize the solutions of formulas in monadic second-order logic [12], and to naturally capture type formalisms for tree-structured XML data [4, 26]. Unfortunately, the expressiveness of plain tree automata is rather limited, and hence, several extensions have been considered in the literature. For example, tree automata with local disequality constraints allowed proving EXPTIME-completeness of ground reducibility [8], tree automata with constraints between brothers allowed proving decidability of fragments of quantifier-free formulas on one-step rewriting [6], tree set automata allowed generalizing results on decidability of set constraints [19], and tree automata with global constraints allowed proving decidability of extensions of monadic second order logic [2, 14]. In this paper we define a new variant of tree automata with constraints specially suited to deal with problems on tree homomorphisms applied to regular tree languages. A tree homomorphism can be defined by equations of the form H(f(x1,...,x n)) = ∗Received by the editors December 5, 2014; accepted for publication (in revised form) April 28, 2016; published electronically July 6, 2016. This work was supported by funds from the Spanish Ministry of Economy and Competitiveness (MINECO) and the European Union (FEDER funds) under grant COMMAS (TIN2013-46181-C2-1-R) and by funds from the Spanish Ministry of Science and Innovation (MICINN) under grant FORMALISM (TIN2007-66523) and by the SweetLogics project (TIN2010-21062-C02-01). A preliminary version of this work appeared in [9], where we develop specific techniques to prove decidability of the HOM problem in exponential time. Here, we present a more general framework and obtain further results based on the new class of tree automata. http://www.siam.org/journals/sicomp/45-4/99910.html †Computer Science Department at Universitat Polit`ecnica de Catalunya, Jordi Girona 1-3, Barcelona 08034, Spain ([email protected], [email protected], lander.ra[email protected]u). The first author was supported by an FPU grant from the Spanish Ministry of Education. The last author was supported by an FPI grant from the Spanish Ministry of Education. ‡University of Edinburgh, 10 Crichton Street, Edinburgh, United Kingdom, EH8 9AB (agascon@ inf.ed.ac.uk). The work of this author was supported under SOCIAM: The Theory and Practice of Social Machines. The SOCIAM Project is funded by the UK Engineering and Physical Sciences Research Council (EPSRC) under grant EP/J017728/1 and comprises the Universities of Oxford, Southampton, and Edinburgh. 1230 Downloaded 03/23/17 to 5.196.89.225. Redistribution subject to SIAM license or copyright; see http://www.siam.org/journals/ojsa.php Copyright © by SIAM. Unauthorized reproduction of this article is prohibited. THE HOM PROBLEM IS EXPTIME-COMPLETE 1231 H f f ab a =g H f ab H f ab =g g H a H a g H a H a =g g aa g aa Fig. 1.Recursive application of the tree homomorphism Hto compute H(f(f(a, b),a)). t,wheretis a tree labeled by either alphabet symbols, or by H(x1),...,H(xn), which may only appear at the leaves. For example, the image of the set of terms over binary fand nullaries a, b by the tree homomorphism Hdefined by H(a)= a, H(b)=a, H(f(x1,x 2)) = g(H(x1),H(x1)) is the set of complete trees over binary gand nullary a(see Figure 1). It is not difficult to prove that this language is not regular. In general, nonlinear tree homomorphisms like H(due to the duplication of the variable x1) may produce nonregular images. The homomorphism (HOM) problem questions, for a given regular tree language Ldescribed by a tree automaton and a tree homomorphism H,whetherH(L)isregular. The study of preservation of tree regularity by tree homomorphisms was introduced in [27], and many partial or related results have been obtained since then [5, 11, 13, 15, 20, 22, 23, 24, 28]. HOM has recently been proved decidable in [21], together with other problems related to images of regular tree languages under tree homomorphisms, like set inclusion and finiteness of set difference. The obtained time complexity is triple exponential for all of them. In the present paper we extend the work done in [21] by proving that all such problems are, in fact, EXPTIME-complete. To this end, we define a new class of tree automata with constraints called tree automata with disequality and implicit HOM equality constraints (TAihom,≈). TAihom,≈ allow arbitrary local disequality constraints and a particular kind of equality constraints: the left-hand side of rules are terms containing states at some leaf positions, and two positions with the same state implicitly define a local equality constraint between such positions. Note that, in particular, equality constraints between nonbrother positions can be defined, as the left-hand side of the rules are not required to be flat terms. We prove that the emptiness of TAihom,≈ canbedecidedinexponential time with respect to the number of different positions involved in the rules. As a consequence, since the regularity (HOM problem), inclusion, and finiteness of the set difference of images of regular tree languages under tree homomorphisms can be reduced to the emptiness of TAihom,≈ in exponential time, but preserving the positions involved in the rules, the EXPTIME-completeness of all such problems follows. Decidability of emptiness for TAihom,≈ in exponential time also has implications in term rewriting, since the set of reducible terms of a term rewrite system can be described as the image of a tree homomorphism. In particular, we prove that inclusion of sets of normal forms of term rewrite systems can be decided in exponential time. Analogous consequences arise in the context of XML typechecking, since types can be defined by tree automata and some type transformations are homomorphic. 1.1. Approach to decide emptiness of TAihom,≈ in exponential time. Tree automata with disequality constraints (TA≈) are a particular case of TAihom,≈ where only disequality constraints are allowed. Emptiness of TA≈ was proved decidable in exponential time in [8]. In the present paper, we generalize the approach used Downloaded 03/23/17 to 5.196.89.225. Redistribution subject to SIAM license or copyright; see http://www.siam.org/journals/ojsa.php Copyright © by SIAM. Unauthorized reproduction of this article is prohibited. 1232 C. CREUS, A. GASC ´ ON, G. GODOY, AND L. RAMOS in [8] to TAihom,≈. Roughly, the algorithm deciding emptiness of TAihom,≈ looks for an accepting run by iteratively generating all possible runs in increasing order of size: new runs are constructed using the previous runs as direct subruns. In order to guarantee termination, some runs are discarded when the algorithm realizes that they cannot be subruns of the minimum accepting run. Below we briefly describe the involved discarding criterion. In order to determine that a run rcannot be a subrun of the minimum accepting run, we prove that any run rhaving ras a subrun can be transformed into a smaller run reaching the same state. Due to the equality constraints, such a transformation requires replacing several identical subruns of rby other smaller subruns. The fact that equalities of TAihom,≈ are implicitly forced by identity of states provides a great advantage to reason about such replacements: two positions p1,p 2are forced by the automaton to have the same pending term whenever the same sequence of states q1,q 2,...,q nis found while traversing the run from the root to p1and p2. This leads us to introduce the concept of abstract position as a string of states q1q2...q nthat implicitly represents the set of all positions that find q1,q 2,...,q nwhile traversing the run from the root to them. We adapt typical notation of subterm location and replacement to abstract positions. For example, r|q1q2...qndenotes the subrun pending at any of the positions referred by q1q2...q n,andr[r]q1q2...qndenotes the simultaneous replacement of all such subruns by a new subrun r. It is easy to satisfy the implicit equality constraints using such replacements, but in general the result is not a correct run since the disequality constraints of a rule applied above the replaced subruns might become unsatisfied. We extend an argument from [8] to prove that, for each TAihom,≈ A, there exists a natural number Kexponentially bounded by |A| satisfying the following property: given a run r, an abstract position P=q1...q n, and runs r1,...,r Ksmaller than r|P, if all the replacements r[r1]P,...,r[rK]Pfalsify different disequalities, then there exists a prefix Pof Pand a run rsmaller than r|Psuch that r[r]Pdoes not falsify any disequality. In general, finding such runs r1,...,r Ksatisfying the above conditions is not an easy task. The following notion of independence, given in [8], helps to overcome this problem: the runs r1,...,r Kon terms t1,...,t Kare independent with respect to a set of positions Pif, for each position p∈P, either all the terms t1|p,...,t K|p are identical, or they are pairwise different. We prove that it is safe to discard a new generated run ¯rif there exist certain r1,...,r Kchosen among the previously generated runs and such that r1,...,r K,¯rare independent (with respect to the set of positions Pthat can be affected by constraints), under certain additional conditions. To efficiently detect those r1,...,r K, we define a new notion on sets of runs and natural numbers K,namely,K-smallness. With this notion, when a set Sis K-small, but the addition of a new run ¯rgives rise to a non-K-small set S∪{¯r}, it follows the existence of an independent subset ˜ Sof S∪{¯r}with size Kand containing ¯r. 1.2. Organization of the paper. In section 2 we introduce basic notation and concepts related to terms, tree automata, and tree homomorphisms. In section 3 we define TAihom,≈ and recall some results of [21]. In section 4 we introduce the notions of independence and K-smallness and the corresponding results. In section 5 we define abstract positions and replacements and analyze disequality constraints. In section 6, we give the algorithm deciding emptiness of TAihom,≈ in exponential time. In section 7 we show the consequences of this result by reducing other problems to it. In particular, we prove that HOM is EXPTIME-complete. In section 8 we conclude. Downloaded 03/23/17 to 5.196.89.225. Redistribution subject to SIAM license or copyright; see http://www.siam.org/journals/ojsa.php Copyright © by SIAM. Unauthorized reproduction of this article is prohibited. THE HOM PROBLEM IS EXPTIME-COMPLETE 1233 2. Preliminaries. 2.1. Terms. In this section we introduce notation for terms, positions, replacements, substitutions, and rewrite rules. For a survey see [1]. ThesizeofafinitesetSis denoted by |S|,andthepowersetofSis denoted by 2S.Asignature consists of an alphabet Σ, i.e., a finite set of symbols, together with a mapping that assigns to each symbol in Σ a natural number, its arity.Wedenote by arity(f) the arity of symbol f,byΣ (m)the subset of symbols in Σ of arity m,and by maxarity(Σ) the maximum msuch that Σ(m)is not empty. The set of all terms over Σ is denoted T(Σ) and is inductively defined as the smallest set Tsuch that for every f∈Σ(m),m≥0, and t1,...,t m∈T,thetermf(t1,...,t m)isinT.Foraterm of the form a() we simply write a.WefixthesetX={x1,x 2,...}of variables, i.e., any set Vof variables is always assumed to be a subset of X. The set of terms over Σ with variables in X, denoted T(Σ,X), is the set of terms over Σ ∪X where every symbol in Xhas arity zero. By |t|we denote the size of t, defined recursively as |f(t1,...,t m)|=1+|t1|+ ···+|tm|for each f∈Σ(m),m≥0, and t1,...,t m∈T(Σ,X), and as |x|=1 for each x∈X.Byheight(t) we denote the height of t, defined recursively as height(f(t1,...,t m))=1+max{height(t1),...,height(tm)}for each f∈Σ(m),m≥1, and t1,...,t m∈T(Σ,X), as height(a)=0foreacha∈Σ(0),andasheight(x)=0for each x∈X.Atermtis called flat if its height is at most 1. Positions in terms are sequences of natural numbers. Given a term t=f(t1,...,t m)∈T(Σ,X), its set of positions Pos(t) is defined recursively as {λ}∪{i.p |i∈{1,...,m}∧p∈Pos(ti)}. Here, λdenotes the empty sequence (position of the root node) and .denotes concatenation. The length of a position is denoted as |p|.Notethat|λ|=0and|i.p|=1+|p|hold. The subterm of tat position p∈Pos(t) is denoted by t|pand is formally defined as t|λ=t and f(t1,...,t m)|i.p =ti|p.Fortermst, s and position p∈Pos(t), we denote by t[s]p the result of replacing the subterm at position pin tby the term s. More formally, t[s]λis sand f(t1,...,t m)[s]i.p is f(t1,...,t i−1,t i[s]p,t i+1,...,t m). The symbol of t occurring at position pis denoted by t(p). More formally, f(t1,...,t m)(λ)=fand f(t1,...,t m)(i.p)=ti(p). We say that tat position pis labeled by fif f=t(p). For asetΓ,weusePosΓ(t) to denote the set of positions of tthat are labeled by symbols in Γ. When a position pis of the form p1.p2,wesaythatp1is a prefix of p, denoted p1≤p,andp2is a suffix of p. If in addition p2is not λ,thenwesaythatp1is a strict prefix of p, denoted p1<p.Moreover,withp−p1we denote p2.Wesaythat two positions p1and p2are parallel, denoted p1p2, if neither p1≤p2nor p2≤p1 hold. Asubstitution σis a mapping from variables to terms. It can be homomorphically extended to a function from terms to terms: σ(t) denotes the result of simultaneously replacing in tevery x∈Dom(σ)byσ(x). Substitutions are sometimes written as sets of pairs {x1→ t1,...,x n→ tn},whereeachxiis a variable and each tiis a term. Arewrite rule is a pair of terms l→r. The application of a rewrite rule l→rto a term s[σ(l)]pat position pproduces the term s[σ(r)]p.IfRis a set of rewrite rules, the application of a rule of Rtoatermsresulting in a term tis denoted by s→Rt, and the reflexive-transitive closure of this relation is denoted by →∗ R. 2.2. Tree automata. Tree automata and regular tree languages are well-known concepts of theoretical computer science [16, 17, 7]. We assume that the reader knows the Boolean closure properties and the decidability results on regular tree languages. Here we only recall the notion of tree automata. Downloaded 03/23/17 to 5.196.89.225. Redistribution subject to SIAM license or copyright; see http://www.siam.org/journals/ojsa.php Copyright © by SIAM. Unauthorized reproduction of this article is prohibited. 1234 C. CREUS, A. GASC ´ ON, G. GODOY, AND L. RAMOS Definition 2.1. Atree automaton (TA)is a tuple A=Q, Σ,F,Δ,whereQis a finite set of states, Σis a signature, F⊆Qis the subset of final states, and Δis a set of rules of the form f(q1,...,q m)→q,whereq1,...,q m,q are in Q,andfis in Σ(m). The size of A,denoted|A|,is|Q|plus the sum of sizes of all rules in Δ,where thesizeofaruleoftheformf(q1,...,q m)→qis m+2. Arun of Aon a term t∈T(Σ) is a mapping r:Pos(t)→Δsuch that, for each position p∈Pos(t),ift(p)∈Σ(m),thenr(p)is a rule of the form t(p)(q1,...,q m)→q, and r(p.1),...,r(p.m)are rules with right-hand sides q1,...,q m, respectively. We say that r(p)is the rule applied at position p.Therunris called accepting if the righthand side of r(λ)is a state in F.Atermtis accepted by Aif there exists an accepting run of Aon t. The set of accepted terms by A, also called the language recognized by A, is denoted by L(A).AlanguageLis regular if there exists a TA Asuch that L(A)=L. 2.3. Tree homomorphisms. Definition 2.2. Let Σ1,Σ2be two signatures. A tree homomorphism is a function H:T(Σ1)→T(Σ2)that can be defined as follows. Let Xmrepresent the set of variables {x1,...,x m}for each natural number m. The definition of a tree homomorphism H:T(Σ1)→T(Σ2)requires to define H(f(x1,...,x m)) for each function symbol f∈Σ1of arity mas a term tfin T(Σ2,Xm). After that, H(f(t1,...,t m)) is defined recursively, for each term f(t1,...,t m)∈T(Σ1),as{x1→ H(t1),...,x m→ H(tm)}(tf). The size of H,denoted|H|, is the sum of the sizes of all the terms tf. Definition 2.3. The HOM problem is defined as follows: Input: ATA Aand a tree homomorphism H. Question: Is H(L(A)) regular? 2.4. Hardness results. We list some known hardness results that are related to our setting. Proposition 2.4. The following problems are EXPTIME-hard: •The HOM problem (from [20]). •The problems of deciding equivalence and inclusion between the languages recognized by two TA (since universality of TA is EXPTIME-hard and can be reduced to equivalence and to inclusion [7]) and finiteness of their difference (since inclusion can be reduced to finite difference). 3. Tree automata with disequality and implicit HOM equality constraints. Decidability of HOM is tackled in [21] by reasoning on a new kind of automata, which is obtained by a straightforward application of a homomorphism to the rules of a TA (and adding equality and disequality constraints). Its main disadvantage is that dealing with constrained rules makes the presentation of technical proofs a laborious task. For this reason, we define an equivalent kind of automata in which equality constraints are implicitly encoded in the left-hand sides of the rules. Intuitively, a state that appears duplicated in the left-hand side lof a rule implicitly forces an equality test between all the positions of lwhere such state occurs. Definition 3.1. Atree automaton with disequality and implicit HOM equality constraints (TAihom,≈)is a tuple A=Q, Σ,F,Δ,whereQis a finite set of states, Σ is a signature, F⊆Qis the subset of final states, and Δis a finite set of rules of the form lc →q,wherelis a term in T(Σ∪Q)−Q, interpreting the states of Qas nullary Downloaded 03/23/17 to 5.196.89.225. Redistribution subject to SIAM license or copyright; see http://www.siam.org/journals/ojsa.php Copyright © by SIAM. Unauthorized reproduction of this article is prohibited. THE HOM PROBLEM IS EXPTIME-COMPLETE 1235 symbols, and c, called the disequality constraint of the rule, is a conjunction/set of unordered pairs of the form ¯p1≈ ¯p2for arbitrary positions ¯p1,¯p2.Whenalltherules of Ahave an empty disequality constraint, we say that Ais a TAihom. Arun of Aon a term t∈T(Σ) is a partial mapping r:Pos(t)→Δsuch that r(λ)is defined and satisfying the following conditions for each position pfor which r(p)is defined, say, as a rule lc →q. For each position p∈Pos(l), it holds that r(p.p) is defined if and only if l(p)∈Q. Moreover, if l(p)is in Q,thenr(p.p)is a rule with the state l(p)as right-hand side. Otherwise, if l(p)is in Σ,thenl(p)=t(p.p). In addition, (i) for each two positions p1,p 2∈Pos(l)satisfying l(p1)=l(p2)∈Q, t|p.p1=t|p.p2holds, and (ii) for each two positions ¯p1,¯p2satisfying (¯p1≈ ¯p2)∈c, either one of p.¯p1,p.¯p2is not in Pos(t)or both of them are and t|p.¯p1=t|p.¯p2holds. We say that ris a weak run when conditions (i) and (ii) are not enforced. Moreover, since tcan be deduced from r, we often do not make explicit tand just say that ris a (weak) run of A. The state reached by a weak run ris the right-hand side of r(λ), and we say that ris accepting if the state reached by ris in F.ByL(A)we denote the language recognized by A, that is, the set of terms tfor which there exists an accepting run of Aon t. Given a weak run rof Aon a term t, we define Pos(r)as Pos(t),height(r)as height(t),andterm(r)as t. Moreover, given a position psuch that r(p)is defined, we define the weak subrun r|pastheweakrunofAon t|pdescribed by r|p(p)=r(p.p). Note that if risarun,thensoisr|p. Given two weak runs r1,r 2and a position p such that r1(p)is defined and r1|p,r 2reach the same state, we define the replacement r1[r2]pastheweakrunron term(r1)[term(r2)]pdescribed as follows: r(p)=r2(ˆp)if pis of the form p.ˆp,andr(p)=r1(p)otherwise. The size of A,denoted|A|,is|Q|plus the sum of sizes of all rules in Δ,where thesizeofarulelc →qis |l|+|c|+1,and|c|is the sum of the lengths of all the occurrences of positions in c.Byn≈(A)we denote the number of distinct disequality atoms in the rules of A.Byh≈(A)we denote the maximum among the lengths of the positions occurring in disequality atoms in the rules of A.ByPoslhs(A)we denote the set of positions of left-hand sides of rules of A, i.e., (lc →q)∈ΔPos(l).Byhlhs(A)we denote the maximum among the heights of the left-hand sides of the rules of A, i.e., max{|p||p∈Poslhs(A)}.Wejustwriten≈,h≈,Poslhs,hlhs when Ais clear from the context and denote by Athe maximum among n≈,h≈,|Poslhs|,andhlhs. The implicit equality constraints of a TAihom,≈ can be assumed to ask for equality not only of subterms but also of subruns. Runs holding this property are called uniform. Definition 3.2. Let A=Q, Σ,F,Δbe a TAihom,≈.Arunrof Ais called uniform if, for each positions p, p1,p 2such that r(p)is defined as a rule lc →qsatisfying l(p1)=l(p2)∈Q,r|p.p1=r|p.p2holds. Lemma 3.3. Let Abe a TAihom,≈. Then, any run of Acan be transformed into a uniform run on the same term and reaching the same state. With the previous lemma it is clear that the classes of languages recognizable by TAihom,≈ with runs and with uniform runs coincide. We straightforwardly extend the notion of uniform runs to the setting of weak runs and call them uniform weak runs. Note that weak runs do not have to satisfy the disequality constraints or the implicit equality constraints occurring in the rules applied, whereas a uniform weak run guarantees that equality constraints are satisfied. For this reason, uniform weak runs do not allow an equivalent of Lemma 3.3, i.e., it is possible that a weak run cannot Downloaded 03/23/17 to 5.196.89.225. Redistribution subject to SIAM license or copyright; see http://www.siam.org/journals/ojsa.php Copyright © by SIAM. Unauthorized reproduction of this article is prohibited. 1236 C. CREUS, A. GASC ´ ON, G. GODOY, AND L. RAMOS be transformed into a uniform weak run recognizing the same term and reaching the same state. In the remainder of this section we summarize results from [21] that are relevant to our goals. We cite them using the new formalism TAihom,≈, as it is equivalent to the model TAhom,≈ used in [21]. (Such equivalence can easily be proved by means of straightforward PTIME transformations in both directions.) As a first ingredient, the following proposition establishes that the class TAihom canbeusedtorepresent images of regular tree languages under tree homomorphisms. Proposition 3.4 (from Proposition 4.6 and section 4.1 of [21]). There effectively exists a polynomial Psatisfying the following condition. Let Abe a TA,andletHbe a tree homomorphism. Then, a TAihom Bsatisfying L(B)=H(L(A)) can be computed in time P(|A|,|H|). Now we state a technical construction that will be used to check inclusion between images of regular tree languages under tree homomorphisms. Proposition 3.5 (from Corollary 4.9, Proposition 4.13, and section 4.1 of [21]). There effectively exist polynomials P1,P2satisfying the following condition. Let A, B be TAihom with signature Σ.Then,aTAihom,≈ Csatisfying L(C)=L(A)∩L(B)can be computed in time 2P1(maxarity(Σ),|Σ|,A,log |A|,|B|), and such that C≤P 2(A,B). The decision of HOM presented in section 7.1 of [21] consists in reducing such a problem to a question of inclusion between two TAihom A, A. From the previous Proposition 3.5, it is clear that such a question can in turn be reduced to testing emptiness on a TAihom,≈ Brecognizing L(A)∩ L(A). The construction of Afollowing the simple algorithm of Definition 7.1 in [21] takes triple exponential time, complexity that is good enough in the context of [21] as it does not increase their overall cost of testing emptiness of B. Nevertheless, such construction can be refined using the ideas presented in section 5.3 of [21], and combined with the complement construction of section 3 and Lemma 4.8 of [21], in order to reduce the cost of constructing an automaton recognizing L(A) to a single exponential. Thus, we can obtain the following improved result. Proposition 3.6 (from the ideas on the constructions in sections 3, 5.3, and 7.1 and Lemma 4.8 for constructing an automaton recognizing L(A), Proposition 4.13, section 4.1, and Lemma 7.3 of [21]). There effectively exist polynomials P1,P2satis- fying the following condition. Let Abe a TAihom with signature Σ.Then,aTAihom,≈ Bsatisfying that L(B)is empty if and only if L(A)is regular can be computed in time 2P1(maxarity(Σ),|Σ|,|A|), and such that B≤P 2(A). We recall one additional result from [21] that reasons about the finiteness of the language recognized by TAihom,≈. Intuitively, the authors reduce the question of finiteness to a question of emptiness on a new automaton. Proposition 3.7 (from the proof of Corollary 5.20 and section 5.3 of [21]). There effectively exist polynomials P1,P2satisfying the following condition. Let Abe aTAihom,≈.Then,aTAihom,≈ Bsatisfying that L(B)is empty if and only if L(A)is finite can be computed in time 2P1(A,log |A|), and such that B≤P 2(A). 4. Independent sets. The content presented in this section is rather abstract and its results seem, at first look, to fit better in a handbook on combinatorics than in a paper on tree automata. Nevertheless, in [8], similar notions were needed to prove Downloaded 03/23/17 to 5.196.89.225. Redistribution subject to SIAM license or copyright; see http://www.siam.org/journals/ojsa.php Copyright © by SIAM. Unauthorized reproduction of this article is prohibited. THE HOM PROBLEM IS EXPTIME-COMPLETE 1237 EXPTIME-completeness of emptiness for tree automata with disequality constraints. We explain the differences with such notions after Definition 4.1. Before entering into the details, we give some intuition about how these results are connected with the rest of the paper. Let Pbe the set of suffixes of positions occurring in disequality constraints, let rbe a uniform run recognizing a term t,let Pbe a set of positions of rthat are forced by the automaton to have the same pending terms, and let r1,...,r Kbe runs recognizing terms t1,...,t Kand reaching the same state as any of the identical runs r|pfor p∈P. We will define that the set {t1,...,t K,t|p}is P-independent if for any p∈Peither all t1|p,...,t K|p,t|p|p coincide or are pairwise different. Note that Pincludes the positions pof r|pthat are involved in a disequality constraint tested just above p. Intuitively, the fact that {t1,...,t K,t|p}is P-independent allows us to conclude that, for each of the positions pinside r|pand involved in an atomic disequality constraint tested just above p,we can use any of the ri’s, except for at most one of them, to do a replacement at pthat still satisfies such constraint, as either all the ti’s coincide with t|pat por all of them are different at p. In section 4.1, the notion of independence and how to detect it efficiently is presented in a more abstract setting with tuples to simplify the presentation and obtain more general results. In section 4.2, these results are adapted from tuples to terms. 4.1. Independent sets of tuples. We assume a given set (the universe) Uand a natural number n,andworkwithn-tuples t=e1,...,e nof elements of U.For such a tuple t, with t[i]wedenotetheith component ei.Wedenotethesetofall such possible tuples as T. For a given finite set of tuples, we are interested in finding a “large” subset which is independent according to the following definition. Definition 4.1. A finite set of tuples {t1,...,t k}⊆Tis independent if for all i∈{1,...,n}, either all elements t1[i],...,t k[i]are the same, or the elements t1[i],...,t k[i]are pairwise different. Note that if a set is independent, then any of its subsets also is. In [8], it is proved for a fixed natural number Kthat, given a set Swith Kn·n! tuples, there effectively exists an independent subset ˜ Sof Swith size K.Thisfact is used in [8] to decide emptiness of tree automata with disequality constraints in exponential time. In order to produce simpler arguments in our setting, we need more than just the existence of such ˜ S. We also need to ensure that a certain tuple tin Sis also in ˜ S. As a first step, we note that, since all tuples of an independent subset coincide at certain components, we can restrict our search of such ˜ Sto subsets of Swhose tuples already coincide with tat some fixed components. Definition 4.2. Let S, t, I be such that t∈S⊆Tand I⊆{1,...,n}. We define the set of tuples coincidents(S, t, I)as {t∈S|∀i∈I:t[i]=t[i]}. Note that, if t∈coincidents(S, t, I), then coincidents(S, t,I)=coincidents(S, t, I). For a natural number K, we define a counting property on sets of tuples, namely K- smallness, that will be useful to construct an independent set of size Kcontaining a specific tuple t. Definition 4.3. Let Kbe a natural number. Let S⊆Tbe a set of tuples. We say that Sis K-small if the following statement holds: ∀t∈S:∀I{1,...,n}: |coincidents(S, t, I)|<K n−|I|·(n−|I|)!. The following lemma states that K-small sets are indeed “small.” Downloaded 03/23/17 to 5.196.89.225. Redistribution subject to SIAM license or copyright; see http://www.siam.org/journals/ojsa.php Copyright © by SIAM. Unauthorized reproduction of this article is prohibited. 1238 C. CREUS, A. GASC ´ ON, G. GODOY, AND L. RAMOS Lemma 4.4. Let Kbe a natural number. Let S⊆Tbe a nonempty K-small set. Then, |S|<K n·n!. Proof. Note that for any tuple t∈S,S=coincidents(S, t, ∅)holds.Thus,|S|= |coincidents(S, t, ∅)|<K n−|∅| ·(n−|∅|)! = Kn·n!. The following lemma holds by Definitions 4.2 and 4.3. Lemma 4.5. Let Kbe a natural number. Let S⊆Tbe a set of tuples. Then, checking whether Sis K-small can be done with at most |S|2·2n·ncomparisons between elements occurring in the tuples of S. In order to show that detecting K-smallness is enough for our purposes, we prove in Lemma 4.10 that, given a set Sand a tuple t∈Ssuch that S−{t}is K-small but Sis not, there always exists an independent subset ˜ S⊆Sof size Kand including t. To this end, as a first ingredient, we relate the existence of an independent subset of Swith the existence of an edge-free subset of nodes of a graph. In the literature, edge-free subsets of nodes are simply called independent. Here, we use this other name in order to avoid confusion with our notion of independent sets of tuples. Definition 4.6. Let G=V,Ebe an undirected graph. Let ˜ Vbe a subset of V. We say that ˜ Vis edge-free in Gif each two nodes of ˜ Vare not connected, i.e., if {(u, v)|u, v ∈˜ V}∩E=∅. The graph where we want to find edge-free subsets of nodes is defined to have coincidents(S, t, I)asitssetofnodes,forafixedI, and to have an edge between each two different tuples t1,t 2if and only if t1and t2coincide at some component not in I. This is defined formally as follows. Definition 4.7. Let S, t, I be such that t∈S⊆Tand I⊆{1,...,n}. We define graph(S, t, I)as the undirected graph G=V,Ewith V=coincidents(S, t, I)and E={(t1,t 2)∈V2|t1=t2∧∃i∈{1,...,n}−I:t1[i]=t2[i]}. The following lemma formally establishes the relation between independent sets of tuples and edge-free sets of nodes of a graph. Lemma 4.8. Let S, t, I be such that t∈S⊆Tand I⊆{1,...,n}.Let˜ Sbe a subset of coincidents(S, t, I)which is edge-free in graph(S, t, I).Then,˜ Sis independent. Proof. Consider any iin {1,...,n}.Ifi∈I, then for any t∈coincidents(S, t, I) we have t[i]=t[i], and the notion of independence is satisfied for ˜ Sand such i. Otherwise, if i∈ I, then, since ˜ Sis edge-free in graph(S, t, I), for any t1,t 2∈˜ S we have that t1and t2are not connected in graph(S, t, I). Thus, by the definition of graph(S, t, I) and the fact that i∈ I,t1[i]=t2[i] follows. Hence, the notion of independence is satisfied for ˜ Sand such i. In the proof of Lemma 4.10, the existence of an edge-free subset of nodes is concluded using, as a last ingredient, the following simple and well-known statement from graph theory, where maxdegree(G) denotes the maximum among all degrees of nodes of G. It was argued as a part of the proof of Theorem 2 in [8], and we include a proof here to keep the paper self-contained. Lemma 4.9. Let G=V,Ebe an undirected graph. Let ube a node of G. Then, there exists a subset ˜ Vof Vwhich is edge-free in G,includesu, and satisfies |˜ V|=|V| maxdegree(G)+1 . Downloaded 03/23/17 to 5.196.89.225. Redistribution subject to SIAM license or copyright; see http://www.siam.org/journals/ojsa.php Copyright © by SIAM. Unauthorized reproduction of this article is prohibited. THE HOM PROBLEM IS EXPTIME-COMPLETE 1245 Lemma 5.8. Let Abe a TAihom,≈.Letrbe a uniform run of A,andletPbe a pure abstract position of r. Let a close disequality with respect to Pbe tested at ¯ P,¯p1,¯p2. Let r1,...,r nbe uniform runs of Areaching the same state as r|Pand such that the terms term(r|P),term(r1),...,term(rn)are pairwise different and ∼A-equivalent and form a suff≈-independent set. Then, for at most one i∈{1,...,n}, the replacement r[ri]Pfalsifies the close disequality tested at ¯ P,¯p1,¯p2. Proof. We start considering the case {¯p1,¯p2} ⊆ Pos(r|¯ P). This is straightforward, since the assumptions that term(r|P),term(r1),...,term(rn)are∼A-equivalent and ¯ P,¯p1,¯p2is close with respect to Pguarantee that {¯p1,¯p2} ⊆ Pos(r[ri]P|¯ P)for each i∈{1,...,n}, and thus, in all the replacements the close disequality tested at ¯ P,¯p1,¯p2is trivially satisfied. Hence, from now on we assume {¯p1,¯p2}⊆Pos(r|¯ P) and note that {¯p1,¯p2}⊆Pos(r[ri]P|¯ P) follows for each i∈{1,...,n}. We reason on the underlying terms. Let t=term(r|¯ P), and let si=term(ri) for each i∈{1,...,n}.Notethatt|¯p1=t|¯p2holds. Let Sbe the set of positions of twhere the replacements take place, i.e., S={p∈Pos(t)|∃¯p∈abstract−1 r(¯ P): abstractr(¯p.p)=P}. (Note that the set could be equivalently defined changing the existential quantifier in the condition by a universal quantifier.) By definition, Sis a nonempty set of parallel positions, and moreover, the subterms of tpending at the positions in Sare all identical. To ease the presentation, we denote by t|Sthe subterm of tpending at any of the positions in S,andbyt[si]Sthe simultaneous replacement in tof all the subterms pending at positions in Sby si.Notethat,by the assumptions of the lemma, t|S,s 1,...,s nare distinct terms, ∼A-equivalent, and form a suff≈-independent set. In order to conclude, it suffices to show that at most one i∈{1,...,n}satisfies t[si]S|¯p1=t[si]S|¯p2. By the assumption that ¯ P,¯p1,¯p2is close with respect to P, it follows that there exists p∈Ssuch that p≤¯p1or p≤¯p2. Since both cases are symmetric, without loss of generality we assume p≤¯p1.Let¯p 1be ¯p1−pand note that ¯p 1∈suff≈.Now,we distinguish cases depending on ¯p2and the positions in S. First, assume that there exists p∈Ssuch that p≤¯p2.Let¯p 2be ¯p2−pand note that ¯p 2∈suff≈.In this case, it suffices to prove that at most one i∈{1,...,n}satisfies si|¯p 1=si|¯p 2. But, since t|S∼Asiand t|S|¯p 1=t|p|¯p 1=t|¯p1=t|¯p2=t|p|¯p 2=t|S|¯p 2, it follows that si|¯p 1=si|¯p 2for all i∈{1,...,n}. Second, assume that ¯p2is parallel to all positions in S, and consider any i, j ∈{1,...,n}such that t[si]S|¯p1=t[si]S|¯p2and t[sj]S|¯p1=t[sj]S|¯p2. Note that, in this case, this condition is equivalent to saying si|¯p 1=t|¯p2and sj|¯p 1=t|¯p2. It suffices to note that necessarily i=j:otherwise, t|S|¯p 1=si|¯p 1=sj|¯p 1since {t|S,s 1,...,s n}is suff≈-independent, and thus, t|¯p1=t|¯p2 since t|S|¯p 1=t|p|¯p 1=t|¯p1, contradicting t|¯p1=t|¯p2. Third, assume that there exists p∈Ssatisfying ¯p2<p . Then, for all i∈{1,...,n}it follows height(t[si]S|¯p1)< height(t[si]S|¯p2), and thus, t[si]S|¯p1=t[si]S|¯p2. Now we are ready to construct a replacement r[r]Pthat does not falsify any close disequality. From the previous result, it is clear that a single candidate rfor the replacement at Pmight not suffice, and instead, we require some uniform runs r1,...,r nsuch that nis greater than the number of different close disequalities in r. Moreover, these r1,...,r nmust reach the same state as r|Pand satisfy that term(r|P),term(r1),...,term(rn) are pairwise different and ∼A-equivalent and form a suff≈-independent set. These conditions are enough to guarantee that if r[ri]Pfalsifies a close disequality tested at ¯ P,¯p1,¯p2,thennootherr[rj]Pwith i=jcan falsify the close disequality tested at ¯ P,¯p1,¯p2. The following lemma states the number Downloaded 03/23/17 to 5.196.89.225. Redistribution subject to SIAM license or copyright; see http://www.siam.org/journals/ojsa.php Copyright © by SIAM. Unauthorized reproduction of this article is prohibited. 1246 C. CREUS, A. GASC ´ ON, G. GODOY, AND L. RAMOS nof needed candidates to construct mreplacements that do not falsify any close disequality. Lemma 5.9. Let Abe a TAihom,≈.Letmbe a natural number, and let n=h≈ · n≈ +m.Letrbe a uniform run of A,andletPbe a pure abstract position of r. Let r1,...,r nbe uniform runs of Areaching the same state as r|Pand such that the terms term(r|P),term(r1),...,term(rn)are pairwise different and ∼A-equivalent and form a suff≈-independent set. Then, there exists a subset {i1,...,i m}of {1,...,n} such that the replacements r[ri1]P,...,r[rim]Pdo not falsify any close disequality. Proof. Note that by Lemma 5.8, each close disequality can be falsified in at most one of the replacements r[r1]P,...,r[rn]P. Also note that, since a close disequality can be tested at most h≈ steps above Pand there are n≈ different disequality atoms in the rules of A, it follows that there are at most h≈ ·n≈ different close disequalities that we need to consider. Therefore, n−h≈ ·n≈ =mof the replacements r[r1]P,...,r[rn]P, say, r[ri1]P,...,r[rim]P, do not falsify any close disequality. The previous result is not enough for our purposes, since the arguments in section 5.4 need a bound for the case where the candidate terms are not assumed to be ∼A-equivalent or form a suff≈-independent set. These assumptions are necessary when the replacement must be performed at a fixed pure abstract position Pof the uniform run r, but not when such Pcan be chosen among several possibilities. Hence, consider some pure abstract positions P1,...,P nof rsuch that r|P1,...,r|Pn reach the same state and recognize distinct terms. We prove that, when nis “big enough,” there exists a subset {i1,...,i m}of {1,...,n}such that the replacements r[r|Pi1]Pim,...,r[r|Pim−1]Pimdo not falsify any close disequality with respect to Pim. The value of such nis given by means of the function Bclose of Definition 5.12, which uses as intermediate result the following bound for the number of equivalence classes induced by the relation ∼A. Definition 5.10. Let Abe a TAihom,≈. We define Beq(A)as 2|suff≈|·|suff≈||suff≈|. Lemma 5.11. Let Abe a TAihom,≈. The number of different equivalence classes induced by ∼Ais bounded by Beq(A). Proof. The first condition of the definition of ∼Ainduces as many equivalence classes as there are subsets of suff≈, and this is bounded by 2|suff≈|. The second condition of the definition of ∼Adepends on which subterms pending at positions in suff≈ are equal or different. This condition induces as many equivalence classes as the number of partitions of the set suff≈, and this is bounded by |suff≈||suff≈|.The statement follows by combining both bounds. We now give the concrete definition of Bclose for the number of needed candidates. Definition 5.12. Let Abe a TAihom,≈.Letmbe a natural number. We define Bclose(A, m)as (h≈ ·n≈ +m)|suff≈|·|suff≈|!·B eq(A). Lemma 5.13. Let Abe a TAihom,≈.Letmbe a natural number, and let n= Bclose(A, m).Letrbe a uniform run of A.LetP1,...,P nbe pure abstract positions of rsuch that the subruns r|P1,...,r|Pnreach the same state and recognize pairwise different terms. Then, there exists a subset {i1,...,i m}of {1,...,n}such that r|Pi1 ···r|Pimand the replacements r[r|Pi1]Pim,...,r[r|Pim−1]Pimdo not falsify any close disequality. Proof. By Lemma 5.11, there are n:= n/Beq(A) pure abstract positions among P1,...,P nsatisfying that the terms recognized by the subruns at such positions Downloaded 03/23/17 to 5.196.89.225. Redistribution subject to SIAM license or copyright; see http://www.siam.org/journals/ojsa.php Copyright © by SIAM. Unauthorized reproduction of this article is prohibited. THE HOM PROBLEM IS EXPTIME-COMPLETE 1247 are ∼A-equivalent. Without loss of generality, we assume that these npure abstract positions are the first ones, i.e., that the terms term(r|P1),...,term(r|Pn)are ∼A-equivalent. Since nis (h≈ ·n≈ +m)|suff≈|·|suff≈|!, by Corollary 4.16 there exists a suff≈-independent subset of {term(r|P1),...,term(r|Pn)}with size n := h≈ ·n≈ +m. Without loss of generality, we assume that this subset is formed by the terms recognized by the subruns at the n first pure abstract positions, i.e., that {term(r|P1),...,term(r|Pn )}is suff≈-independent. We also assume without loss of generality that term(r|P1) ···  term(r|Pn ). Let the imof the statement be defined as n. By Lemma 5.9 applied on r,Pim,andr|P1,...,r|Pn −1, it follows that there exists a subset {i1,...,i m−1}of {1,...,n  −1}such that the replacements r[r|Pi1]Pim,...,r[r|Pim−1]Pimdo not falsify any close disequality. We conclude the proof by assuming without loss of generality that i1<··· <i m−1, and thus, r|Pi1···r|Pim−1r|Pim. 5.4. Far disequalities. We start with a result on far disequalities analogous to the statement on close disequalities of Lemma 5.8. More precisely, consider a specific disequality tested by the uniform run rat ¯ P,¯p1,¯p2, and assume that it is a far disequality with respect to a pure abstract position Pof r. Given some candidate uniform runs r1,...,r nfor replacements of the form r[ri]P, we prove that at most one of those replacements can falsify the far disequality tested at ¯ P,¯p1,¯p2. In contrast with Lemma 5.8, in this case the only needed assumptions on r1,...,r nare that they reach the same state as r|Pand recognize pairwise different terms. Lemma 5.14. Let Abe a TAihom,≈.Letrbe a uniform run of A,andletPbe a pure abstract position of r. Let a far disequality with respect to Pbe tested at ¯ P,¯p1,¯p2.Letr1,...,r nbe uniform runs of Aon distinct terms and reaching the same state as r|P. Then, for at most one i∈{1,...,n}, the replacement r[ri]P falsifies the far disequality tested at ¯ P,¯p1,¯p2. Proof. We start considering the case {¯p1,¯p2} ⊆ Pos(r|¯ P). This is straightforward, since the assumption that ¯ P,¯p1,¯p2is far with respect to Pguarantees that {¯p1,¯p2} ⊆ Pos(r[ri]P|¯ P)foreachi∈{1,...,n}, and thus, in all the replacements the far disequality tested at ¯ P,¯p1,¯p2is trivially satisfied. Hence, from now on we assume {¯p1,¯p2}⊆Pos(r|¯ P) and note that {¯p1,¯p2}⊆Pos(r[ri]P|¯ P) follows for each i∈{1,...,n}. We reason on the underlying terms. Let ti=term(r|¯ P.¯pi)fori∈{1,2}, and note that t1=t2holds. For i∈{1,2},letSibe the sets of positions of tiwhere the replacements take place, i.e., Si={p∈Pos(ti)|∃¯p∈abstract−1 r(¯ P):abstractr(¯p.¯pi.p)=P}. By definition, Siis a (maybe empty) set of parallel positions, and moreover, the subterms of tipending at the positions in Siare all identical. As in the proof of Lemma 5.8, we denote by ti[s]Sithe simultaneous replacement in tiof all the subterms pending at positions in Siby a term s. In order to conclude, it suffices to show that at most one term ssatisfies t1[s]S1=t2[s]S2. We assume that there exists a term ssatisfying t1[s]S1=t2[s]S2and prove that it is unique. Note that, for each position p1∈S1, there is no position p2∈S2such that p1<p 2or p2<p 1: otherwise, the condition t1[s]S1=t2[s]S2would be false for any s. Also, note that S1=S2: otherwise, the condition t1[s]S1=t2[s]S2would imply t1=t2since all the replaced subterms of t1and t2are identical by definition. Hence, there exists a position p∈(S1−S2)∪(S2−S1). Without loss of generality, assume that such a pis in S1−S2. The condition t1[s]S1=t2[s]S2and the fact that any position in S2is parallel with pimplies s=t2|p, and we are done. Downloaded 03/23/17 to 5.196.89.225. Redistribution subject to SIAM license or copyright; see http://www.siam.org/journals/ojsa.php Copyright © by SIAM. Unauthorized reproduction of this article is prohibited. 1248 C. CREUS, A. GASC ´ ON, G. GODOY, AND L. RAMOS It is clear from the previous result that a single candidate rfor the replacement r[r]Pis not enough to guarantee that no far disequality is falsified. In particular, given some candidates r1,...,r nrecognizing distinct terms, each specific far disequality can only be falsified by one of the ri’s when performing the replacement at P. In contrast to our arguments in section 5.3 dealing with close disequalities, note that the number of far disequalities is not bounded. For this reason, the definition of the number nof needed candidates is more complex. We start with the following intermediate lemma where we only consider far disequalities that are “near” P, i.e., far disequalities tested at a bounded distance from the pure abstract position where the replacement is performed. Lemma 5.15. Let Abe a TAihom,≈.Letm, k be natural numbers, and let n= k·n≈ +m.Letrbe a uniform run of A,andletPbe a pure abstract position of r.Letr1,...,r nbe uniform runs of Aon distinct terms reaching the same state as r|Pand such that, for a given natural number d, the replacements r[r1]P,...,r[rn]P do not falsify any far disequality tested at most dsteps above P.Then,thereexists asubset{i1,...,i m}of {1,...,n}such that the replacements r[ri1]P,...,r[rim]Pdo not falsify any far disequality tested at most d+ksteps above P. Proof. Note that by Lemma 5.14, each far disequality can be falsified in at most one of the replacements r[r1]P,...,r[rn]P. Also note that, among the far disequalities that are tested at most d+ksteps above P, we do not need to consider the ones that are tested at most dsteps above Psince they are already satisfied by assumption. Hence, since there are n≈ different disequality atoms in the rules of A, it follows that there are at most k·n≈ different far disequalities that we need to consider. Therefore, n−k·n≈ =mof the replacements r[r1]P,...,r[rn]P,say,r[ri1]P,...,r[rim]P,donot falsify any far disequality tested at most d+ksteps above P. Now we are ready to tackle the far disequalities that are not “near” P.Consider that we have candidates r1,...,r nsuch that the replacements r[r1]P,...,r[rn]Pdo not falsify any close disequality. We assume that all of them falsify some far disequality, since otherwise, no further arguments would be needed. We define an n“big enough” to guarantee that we are able to construct from subruns of rand from r1,...,r n new candidates r 1,...,r  nfor replacements at a pure abstract position P<P such that, again, r[r 1]P,...,r[r n]Pdo not falsify any close disequality. Note that in the case where all of them falsify some far disequality, this argument can be iterated to obtain new candidates r 1,...,r  nto perform replacements at a P <P <P, i.e., at a pure abstract position closer to the root. Hence, we are guaranteed to eventually find a replacement that does not falsify any far disequality. The number nof needed candidates is given by means of the function Bof Definition 5.16 and the proof of this fact is given in Lemma 5.17. The function Btakes two natural numbers Mand Nfor which we do not give a concrete definition until Lemma 5.19. At this point it suffices to assume that they satisfy M·N≥B(A, M, N)=n.In order to illustrate the definition of B, we sketch the steps that we perform in the proof of Lemma 5.17 to construct the new candidates r 1,...,r  nand to find the new pure abstract position Pfor the replacement. We start by noting that, since all the replacements r[r1]P,...,r[rn]Pfalsify far disequalities, we can consider the maximal pure abstract positions ¯ P1,..., ¯ Pnsuch that, for i∈{1,...,n}, the replacement r[ri]P falsifies a far disequality tested at ¯ Pi. We also assume without loss of generality that ¯ P1≥¯ P2≥ ··· ≥ ¯ Pnby reordering the runs riif necessary (see Figure 2). Now, the proof proceeds as follows: Downloaded 03/23/17 to 5.196.89.225. Redistribution subject to SIAM license or copyright; see http://www.siam.org/journals/ojsa.php Copyright © by SIAM. Unauthorized reproduction of this article is prohibited. THE HOM PROBLEM IS EXPTIME-COMPLETE 1249 ¯ Pi ¯ Pi.¯pi2 ¯ Pi.¯pi1 ¯ Pi.¯pi1.p i Qi=¯ Pi.¯pi2.p i P ¯ P1 ¯ P2 ¯ P3 ¯ Pn ¯ Pn−1 ¯ Pn−2 . . . . . . Fig. 2.Abstract positions of the uniform run rthat are considered in Lemma 5.17.(Thesingle path depicted should be understood as all paths in rwith abstract position P.) •As an initial step, we need the pure abstract positions ¯ P1,..., ¯ Pnto be spaced between them. In particular, we want any two ¯ Pi,¯ Pjto be more than h≈+hlhs steps away from each other. To this end, we first remove from ¯ P1,..., ¯ Pnany repetition of pure abstract positions. Recall that, by Lemma 5.14, the far disequalities falsified by a candidate riare necessarily different from the far disequalities falsified by any other candidate rj. However, since a rule may have several different disequality atoms, it follows that we can have several occurrences of identical ¯ Pi’s. But there are at most n≈ occurrences of the same element, and hence, it is possible to take from ¯ P1,..., ¯ Pna selection with n1:= n/n≈ distinct pure abstract positions, say, ¯ P1,..., ¯ Pn1. Finally, we can take a new selection with n2:= n1/(1+h≈ +hlhs) pure abstract positions from ¯ P1,..., ¯ Pn1,say, ¯ P1,..., ¯ Pn2, that are more than h≈ +hlhs steps away from each other. •We now consider each selected ¯ Piand their corresponding positions ¯pi1,¯pi2 of the far disequality tested at ¯ Piand falsified by r[ri]P, and consider common extensions of ¯ Pi.¯pi1,¯ Pi.¯pi2defined by positions p isatisfying that either ¯ Pi.¯pi1.p ior ¯ Pi.¯pi2.p iis pure in rand the terms pending at such abstract positions in rare still different (and note that the terms pending at such abstract positions in r[ri]Pmust coincide). We prove that for each of such p i,oneof the extensions, say, ¯ Pi.¯pi1.p i,isaprefixofP, and that the other one, i.e., ¯ Pi.¯pi2.p i, is parallel to P. Among all the possible p i,wechooseaminimal one in size such that the extension ¯ Pi.¯pi2.p iparallel to Pis pure. Thanks to the fact that the selected ¯ P1,..., ¯ Pn2are spaced between them by more than h≈ +hlhs steps, this extension can be done for each ¯ Piwithout reaching any larger ¯ Pj.LetQibe the extension ¯ Pi.¯pi2.p i. We prove that the subruns r|Q1,...,r|Qn2recognize distinct terms. •At this point, we split {1,...,n 2}into two subsets depending on how close the corresponding ¯ Pi’s are to P: one subset with the n3closest ones and the other with the n4:= n2−n3remaining ones. Say they are {1,...,n 3} Downloaded 03/23/17 to 5.196.89.225. Redistribution subject to SIAM license or copyright; see http://www.siam.org/journals/ojsa.php Copyright © by SIAM. Unauthorized reproduction of this article is prohibited. 1250 C. CREUS, A. GASC ´ ON, G. GODOY, AND L. RAMOS and {n3+1,...,n 2}, respectively. Recall that each ¯ Piis the maximal pure abstract position where a far disequality is falsified by the replacement r[ri]P. This means that the ¯ Pi’s that are furthest from Pnecessarily correspond to the replacements where all the falsified far disequalities are “very far” from P.WenowextractM+ 1 indexes from {1,...,n 3},say,{1,...,M+1},such that, for each i∈{1,...,M}, the replacement r[r|Qi]QM+1 does not falsify any close disequality with respect to ¯ PM+1. Moreover, for each of such i,we extract a set of Nindexes from {n3+1,...,n 2}such that, for each of such indexes j, the simultaneous replacement r[r|Qi]QM+1 [rj]Pdoes not falsify any close disequality with respect to ¯ PM+1.Weprovethatn3:= |Q|·Bclose(A, M+ 1+(2·h≈ +hlhs)·n≈) suffices to guarantee the existence of such M+1 indexes, where the factor |Q|is required in order to guarantee that r|Q1,...,r|QMreach the same state as r|QM+1 . For each of such i∈{1,...,M}the generation of the subset of size Nfrom {n3+1,...,n 2}must be done depending on i since, even though for all j∈{n3+1,...,n 2}the replacement r[rj]Pdoes not falsify any disequality below ¯ PM+1,itmightbethecasethatitfalsifies some such disequality when combined with the replacement at QM+1.We prove that n4:= N+(2·h≈ +hlhs)·n≈ suffices to guarantee the existence of such Nindexes. To summarize, it is possible to combine each of the Mreplacements at QM+1 with the Ncorresponding replacements at P, and thus we can define the M·N≥B(A, M, N)=nneeded candidates as runs of the form r[r|Qi]QM+1 [rj]P|¯ PM+1 and the abstract position Pas ¯ PM+1. By considering the values given to n1,n2,n3,andn4in the previous explanation, we can finally define the global bound B(A, M, N) and prove the main result of this section. Definition 5.16. Let Abe a TAihom,≈.LetM,N be natural numbers. We define B(A, M, N)=n≈ ·(1 + h≈ +hlhs)·|Q|·B close(A, M +1+(2·h≈ +hlhs)·n≈) +N+(2·h≈ +hlhs)·n≈. Lemma 5.17. Let A=Q, Σ,F,Δbe a TAihom,≈.LetM,N be natural numbers satisfying M·N≥B(A, M, N).Letn=B(A, M, N).Letrbe a uniform run of A, and let Pbe a pure abstract position of r.Letr1,...,r nbe uniform runs of Aon distinct terms reaching the same state as r|Pand such that r1,...,r nr|Pand each one of the replacements r[r1]P,...,r[rn]Pfalsifies at least one far disequality but does not falsify any close disequality. Then, there exists a pure abstract position P<P of rand uniform runs r 1,...,r  nof Aon distinct terms reaching the same state as r|P, and such that r 1,...,r  nr|Pand each one of the replacements r[r 1]P,...,r[r n]P does not falsify any close disequality. Proof. For each i∈{1,...,n},let ¯ Pibe the maximal pure abstract position such that the replacement r[ri]Pfalsifies a far disequality tested at ¯ Pi. Without loss of generality, we assume that ¯ P1≥¯ P2≥···≥ ¯ Pnby reordering the runs riif necessary. Note that |term(r|¯ P1)|≤|term(r|¯ P2)| ≤ ··· ≤ |term(r|¯ Pn)|. By Lemma 5.14 and the fact that there are n≈ different disequality atoms in the rules of A, it follows that for each pure abstract position P<P at most n≈ of the pure abstract positions ¯ Pi coincide with P. Thus, we can choose a subset Sof {1,...,n}with size n:= n/(n≈ ·(1 + h≈ +hlhs)) = |Q|·B close(A, M +1+(2·h≈ +hlhs)·n≈) +N+(2·h≈ +hlhs)·n≈ Downloaded 03/23/17 to 5.196.89.225. Redistribution subject to SIAM license or copyright; see http://www.siam.org/journals/ojsa.php Copyright © by SIAM. Unauthorized reproduction of this article is prohibited. THE HOM PROBLEM IS EXPTIME-COMPLETE 1251 satisfying that ¯ Pjis more than h≈ +hlhs steps above ¯ Pifor each i, j ∈Swith i<j and that ¯ Piis more than h≈ +hlhs steps above Pfor each i∈S. Without loss of generality, we assume that Sis {1,...,n }.Notethat¯ P1>¯ P2>··· >¯ Pnand |term(r|¯ P1)|<|term(r|¯ P2)|<···<|term(r|¯ Pn)|. Consider any kin S. Since the replacement r[rk]Pfalsifies a disequality tested at ¯ Pk, it follows that there exist positions ¯pk1,¯pk2such that the atom ¯pk1≈ ¯pk2oc- curs in the disequality constraint of the rule r(¯ Pk), and moreover, term(r|¯ Pk)|¯pk1= term(r|¯ Pk)|¯pk2and term(r[rk]P|¯ Pk)|¯pk1=term(r[rk]P|¯ Pk)|¯pk2.Letpkbe the shortest position such that at least one of ¯ Pk.¯pk1.pk,¯ Pk.¯pk2.pkis defined in r(i.e., corresponds to a pure abstract position of r), and moreover, term(r|¯ Pk)|¯pk1.pk=term(r|¯ Pk)|¯pk2.pk and term(r[rk]P|¯ Pk)|¯pk1.pk=term(r[rk]P|¯ Pk)|¯pk2.pk.Notethat|¯pk1|,|¯pk2|≤h≈ and |pk|≤hlhs, which implies that ¯ Piis not a prefix of ¯ Pk.¯pk1.pkor ¯ Pk.¯pk2.pkfor each i∈S with i<k, and neither Pis prefix of ¯ Pk.¯pk1.pkor ¯ Pk.¯pk2.pk. Also note that ¯ Pk.¯pk1.pk and ¯ Pk.¯pk2.pkare necessarily parallel and at least one of them is a prefix of P, since otherwise, either term(r|¯ Pk)|¯pk1.pk=term(r|¯ Pk)|¯pk2.pkor term(r[rk]P|¯ Pk)|¯pk1.pk= term(r[rk]P|¯ Pk)|¯pk2.pkwould be impossible. By Lemma 5.4, without loss of generality, we can assume that ¯ Pk.¯pk1.pkis a prefix of Pand that ¯ Pk.¯pk2.pkis not a prefix of P.Letp kbe the shortest extension of pksuch that ¯ Pk.¯pk2.p kis defined in r (i.e., corresponds to a pure abstract position of r), and moreover, term(r|¯ Pk)|¯pk1.p k= term(r|¯ Pk)|¯pk2.p kand term(r[rk]P|¯ Pk)|¯pk1.p k=term(r[rk]P|¯ Pk)|¯pk2.p k. Note that in the case where ¯ Pk.¯pk2.pkalready corresponds to a pure abstract position of r,p kis just pk.Inanycase,wehave|p k|≤hlhs.LetQkbe the pure abstract position ¯ Pk.¯pk2.p k. Observe that all of such Qkare parallel with P. We prove that the terms term(r|Q1),...,term(r|Qn) are distinct by showing that term(r|Qi) is a strict subterm of term(r|Qj)foreach1≤i<j≤n.Fromthe fact that ¯ Pjis more than h≈ +hlhs steps above ¯ Pi, it follows that ¯ Pj.¯pj1.p jis a strict prefix of ¯ Pi, and thus also of Qi. Hence, term(r|Qi) is a strict subterm of term(r|¯ Pj)|¯pj1.p j.Moreover,sinceQiis parallel with P,term(r|Qi)isalsoastrict subterm of term(r[rj]P|¯ Pj)|¯pj1.p j.Sinceterm(r[rj]P|¯ Pj)|¯pj1.p j=term(r[rj]P|¯ Pj)|¯pj2.p j, it follows that term(r|Qi) is also a strict subterm of term(r[rj]P|¯ Pj)|¯pj2.p j, i.e., of term(r[rj]P|Qj). Finally, since Qjis parallel with P,term(r|Qi) is also a strict subterm of term(r|Qj). Let m=M+1+(2·h≈ +hlhs)·n≈, and consider the first |Q|·B close(A, m) elements of S, i.e., {1,...,|Q|·B close(A, m)}. Necessarily, there exists Bclose(A, m) elements among them, say, {1,...,Bclose(A, m)}without loss of generality, such that the subruns of rat the pure abstract positions Q1,...,Q Bclose(A,m)reach the same state. By Lemma 5.13, there exists a subset {i1,...,i m}of {1,...,Bclose(A, m)} such that r|Qi1 ···  r|Qimand the replacements r[r|Qi1]Qim,...,r[r|Qim−1]Qim do not falsify any close disequality. Moreover, by Lemma 5.15, there exists a subset {j1,...,j M}of {i1,...,i m−1}such that the replacements r[r|Qj1]Qim,...,r[r|QjM]Qim do not falsify any far disequality tested at most 2 ·h≈ +hlhs steps above Qim.Note that, since ¯ Pimis at most h≈ +hlhs steps above Qim, the replacements do not falsify any disequality tested at most h≈ steps above ¯ Pim, and hence, they do not falsify any close disequality with respect to ¯ Pim. Now, consider the last |S|−|Q|·B close(A, m) remaining elements of S.Observe that S:= S−{1,...,|Q|·B close(A, m)}={|Q|·B close(A, m)+1,...,n }={n− (N+(2·h≈ +hlhs)·n≈)+1,...,n }. Also, note that, for each i∈S, the replacement r[ri]Pdoes not falsify any disequality tested below or at ¯ Pim.Thus,foreachi∈S and each k∈{1,...,M},since ¯ Pim.¯pim1.p imand ¯ Pim.¯pim2.p imare parallel, it follows Downloaded 03/23/17 to 5.196.89.225. Redistribution subject to SIAM license or copyright; see http://www.siam.org/journals/ojsa.php Copyright © by SIAM. Unauthorized reproduction of this article is prohibited. 1252 C. CREUS, A. GASC ´ ON, G. GODOY, AND L. RAMOS that the replacement r[r|Qjk]Qim[ri]Pdoes not falsify any disequality tested below or at ¯ Pim.¯pim1.p im. Recall that |¯pim1|≤h≈ and |p im|≤hlhs. By Lemma 5.15, for each fixed k∈{1,...,M}, we can choose a subset Skof Swith size Nsuch that, for each i∈Sk, the replacement r[r|Qjk]Qim[ri]Pdoes not falsify any disequality tested below or at ¯ Pim, and moreover, it does not falsify any disequality tested at most h≈ steps above ¯ Pim, i.e., it does not falsify any close disequality with respect to ¯ Pim.Letrki be r[r|Qjk]Qim[ri]P|¯ Pimfor each k∈{1,...,M}and each i∈Sk.Notethatallsuchrki’s are uniform runs of Aon distinct terms reaching the same state as r|¯ Pim.Moreover, each of such rki satisfies rki r|¯ Pim, and the replacement r[rki]¯ Pim,whichinfact produces r[r|Qjk]Qim[ri]P, does not falsify any close disequality with respect to ¯ Pim. Observe that there are M·N≥nof such rki’s. Thus, by defining Pas ¯ Pimand r 1,...,r  nas nof such rki’s, the lemma follows. At this point it is clear that, by iterative applications of Lemma 5.17, we can construct a replacement that does not falsify any disequality or implicit equality constraint—i.e., a replacement that produces a run—whenever we have B(A, M, N) candidates for the replacement that do not falsify any close disequality. Moreover, note that since the candidates considered are smaller than the subrun being replaced, such replacement necessarily decreases the size of the starting run. The following corollary is an immediate consequence of this fact stating that, when the starting run is accepting, then it is not a minimum accepting run since we can decrease its size by performing such a replacement. Corollary 5.18. Let Abe a TAihom,≈.LetM,N be natural numbers satisfying M·N≥B(A, M, N).Letn=B(A, M, N).Letrbe an accepting uniform run of A,andletPbe a pure abstract position of r.Letr1,...,r nbe uniform runs of A on distinct terms reaching the same state as r|Pand such that r1,...,r nr|Pand each one of the replacements r[r1]P,...,r[rn]Pdoes not falsify any close disequality. Then, ris not a minimum accepting run. In order to conclude, it only remains to prove that there exist Mand Nsatisfying M·N≥B(A, M, N). In the following lemma we give concrete values for Mand N that satisfy that condition. Note that there exist alternative definitions, but the ones we use are rather straightforward and lead to a simple proof. Lemma 5.19. Let Abe a TAihom,≈.LetM=n≈ ·(1 + h≈ +hlhs)+1 and N= n≈ ·(1 + h≈ +hlhs)·(|Q|·B close(A, M +1+(2·h≈ +hlhs)·n≈)+(2·h≈ +hlhs)·n≈). Then, M·N=B(A, M, N). Proof. It follows by replacing the Nin the definition of Bby the definition of N in the statement and factoring the result. More precisely, let X=n≈ ·(1+h≈ +hlhs) and Y=(|Q|·Bclose(A, M +1+(2·h≈ +hlhs)·n≈)+(2·h≈ +hlhs)·n≈) and note that M=X+1andN=X·Y. Then, B(A, M, N)=X·(Y+N)=X·(Y+X·Y)= X·((1 + X)·Y)=(1+X)·X·Y=M·N. 6. Emptiness decision algorithm. In this section we introduce an algorithm that decides the emptiness of the language recognized by TAihom,≈ in exponential time. In contrast to the previous section, we can now refrain from reasoning on runs since most of the information they provide is superfluous in our current setting. In particular, the only relevant data that the algorithm needs from a run is the term it recognizes and the state it reaches. For this reason, we focus on a formalism simpler than runs, namely, (term, state)-pairs defined as follows. Downloaded 03/23/17 to 5.196.89.225. Redistribution subject to SIAM license or copyright; see http://www.siam.org/journals/ojsa.php Copyright © by SIAM. Unauthorized reproduction of this article is prohibited. THE HOM PROBLEM IS EXPTIME-COMPLETE 1253 Definition 6.1. Let A=Q, Σ,F,Δbe a TAihom,≈. A (term, state)-pair t, q∈ T(Σ) ×Qis called a feasible pair of Aif there exists a run of Aon treaching q,and moreover, it is called accepting if such run is accepting, i.e., if q∈F. We compare (term, state)-pairs by the lexicographic extension of andanarbitrary total ordering on states. We also use to denote the ordering on (term, state)-pairs. Two sets of feasible pairs, called Definitive and Candidates, are maintained as data structures of the algorithm. Initially, Definitive is empty, and Candidates has all the feasible pairs t, qsuch that there exists a run with only one applied rule on tand reaching q. At each iteration, the minimum pair t, qwith respect to in Candidates is considered. The pair t, qis added to the set Definitive unless it is realized that it cannot be used to construct the minimum term with respect to of L(A). This fact can be detected using the results of the previous section. Corollary 6.4 is a consequence of Corollary 5.18 and Lemma 5.9. Definition 6.2. Let A=Q, Σ,F,Δbe a TAihom,≈.Lett, q,t,q∈T(Σ)×Q be feasible (term, state)-pairs. We say that t,qis a piece of t, qif there exists a run rof Aon treaching qsuch that there is a position p∈Pos(t)satisfying that r(p) is defined, r|preaches q,andt|p=t. Definition 6.3. Let Abe a TAihom,≈.LetM,N be natural numbers defined as in Lemma 5.19. We define K(A)as h≈ ·n≈ +B(A, M, N). Corollary 6.4. Let A=Q, Σ,F,Δbe a TAihom,≈.Lett, s1,...,s K(A)be distinct terms in T(Σ) with runs of Aon them reaching a state q∈Qand such that {t, s1,...,s K(A)}is suff≈-independent, t∼As1,...,s K(A),ands1,...,s K(A)t. Then, t, qis not a piece of the minimum accepting pair of A. According to the previous corollary, in order to discard the addition of t, q to Definitive, we should consider the set {s|s, q∈Definitive ∧s∼At}and check whether it has a subset {s1,...,s K(A)}such that {t, s1,...,s K(A)}is suff≈- independent. The time complexity of searching for such subset is too high for our goals. Fortunately, section 4.2 gives us an alternative criterion to determine, in some cases, that such a subset exists. Along the execution of the algorithm we preserve an invariant stating that each of such sets {s|s, q∈Definitive ∧s∼At} is a (K(A)+1,suff≈)-small set of terms. If the addition of tto this set makes it non(K(A)+1,suff≈)-small, then, by Lemma 4.15, it follows the existence of the subset {s1,...,s K(A)}mentioned above. Thus, in this case we must discard the pair t, q, since it is not a piece of the minimum accepting pair of A. In the case where the pair t, qis not discarded, it is added to the set Definitive and used to generate new feasible (term, state)-pairs, which are added to Candidates. This generation is performed (i) using the left-hand sides of rules in Δ to determine the symbols in the top-most positions of the new terms, (ii) using the feasible (term, state)-pairs in Definitive to instantiate the states appearing in such left-hand sides, and also (iii) guaranteeing that the specific pair t, qis used for the instantiation. This last condition ensures that all the pairs added to Candidates are new, i.e., that the algorithm has still not considered them to be added to Definitive (although they may be already in Candidates due to a previous generation). This generation is defined formally as follows. Definition 6.5. Let A=Q, Σ,F,Δbe a TAihom,≈.LetS⊆T(Σ) ×Qbe a set of feasible (term, state)-pairs. Let t, q∈Sbe a feasible (term, state)-pair. We Downloaded 03/23/17 to 5.196.89.225. Redistribution subject to SIAM license or copyright; see http://www.siam.org/journals/ojsa.php Copyright © by SIAM. Unauthorized reproduction of this article is prohibited. 1254 C. CREUS, A. GASC ´ ON, G. GODOY, AND L. RAMOS define the set of instantiations of Δwith Sand t, qas the set of feasible pairs: t=l[t1]p1...[tn]pn,q|∃(lc →q)∈Δ,{p1,...,p n}=PosQ(l), ∀i∈{1,...,n}:ti,l(pi)∈S, ∃i∈{1,...,n}:ti,l(pi)=t, q, ∀i, j ∈{1,...,n}:(l(pi)=l(pj)⇒ti=tj), ∀(¯p1≈ ¯p2)∈c:(¯p1,¯p2∈Pos(t)⇒t|¯p1=t|¯p2). When there are no more pairs in Candidates to be considered, the algorithm stops and states nonemptiness if there is a (term, state)-pair in Definitive where the state is final. We present in Algorithm 6.1 a formalization of the previous explanations. Algorithm 6.1 Emptiness decision for the language recognized by a TAihom,≈ A. Input:aTAihom,≈ A=Q, Σ,F,Δ. Data structures:Definitive,Candidates sets of elements in T(Σ) ×Q. (1) Insert in Candidates the pairs l, qsuch that there exists a rule (lc →q)∈Δ with l∈T(Σ) and satisfying ∀(¯p1≈ ¯p2)∈c:(¯p1,¯p2∈Pos(l)⇒l|¯p1=l|¯p2). (2) While Candidates is not empty: (a) Let t, qbe the smallest pair in Candidates with respect to . (b) Remove t, qfrom Candidates. (c) If {s|s, q∈Definitive ∧s∼At}∪{t}is (K(A)+1,suff≈)-small: (i) Insert t, qin Definitive. (ii) Insert in Candidates all the elements in the set of instantiations of Δ with Definitive and t, q. (3) If there is a pair t, q∈Definitive with q∈F, then output “NON-EMPTY,” else output “EMPTY.” Example 6.6. Consider the signature Σ with binary symbols h, g and a nullary symbol a, and the language of terms over Σ of the form h(t1,t 2) satisfying that t1,t 2 are different complete trees over gand a. Such language is recognized by the TAihom,≈ A={q,q,q accept},Σ,{qaccept},{a→q|q,g(q,q)→q|q,h(q,q)1≈2 −→ qaccept}, whereweusel→q|qto simultaneously denote the rules l→qand l→q. In order to apply Algorithm 6.1, we first need to fix an ordering for terms. We choose a natural recursive definition: for distinct terms t, t,if|t|<|t|,thentt, andinthecase|t|=|t|(which implies that the sizes are at least 2 since t=t), tt if (t(λ)=g∧t(λ)=h)∨(t(λ)=t(λ)∧t|1t|1)∨(t(λ)=t(λ)∧t|1=t|1∧t|2t|2). To lexicographically extend the ordering to (term, state)-pairs we simply assume t, qt, qt, qaccept. We execute Algorithm 6.1 step by step. First, Candidates := {a, q,a, q} is set at step 1. Second, step 2 is executed repeatedly, where the first four iterations proceed as follows (to ease the presentation, we do not discuss (K(A)+1,suff≈)-smallness in detail): 1. The -minimum pair extracted from Candidates is a, q.SinceDefinitive is still empty, step 2(c) is satisfied with a trivial (K(A)+1,suff≈)-smallness test. Hence, Definitive := {a, q},andthepaira, qand the current Definitive are used to instantiate two new feasible pairs for Candidates: Candidates := {a, q}  {g(a, a),q,g(a, a),q}. 2. The -minimum pair extracted from Candidates is a, q.Now,Definitive is nonempty, but its subset {s|s, q∈Definitive}is, and thus, step 2(c) is Downloaded 03/23/17 to 5.196.89.225. Redistribution subject to SIAM license or copyright; see http://www.siam.org/journals/ojsa.php