56
AAECC 10, 97–152 (2000) Special Cases and Substitutes for Rigid E-Unification David A. Plaisted Department of Computer Science, University of North Carolina at Chapel Hill, Chapel Hill, NC 27599-3175, USA (e-mail: [email protected]) Received: March 6, 1997; revised version: August 13, 1999 Abstract. The simultaneous rigid E-unification problem arises naturally in theorem proving with equality. This problem has recently been shown to be undecidable. This raises the question whether simultaneous rigid E-unification can usefully be applied to equality theorem proving. We give some evidence in the affirmative, by presenting a number of common special cases in which a decidable version of this problem suffices for theorem proving with equality. We also present some general decidable methods of a rigid nature that can be used for equality theorem proving and discuss their complexity. Finally, we give a new proof of undecidability of simultaneous rigid E-unification which is based on Post’s Correspondence Problem, and has the interesting feature that all the positive equations used are ground equations (that is, contain no variables). Keywords: Theorem proving, Equality, Unification, Rigid E-unification, Decidability, Tableaux, Horn clauses, First-order logic. Contents 1 Introduction ....................................... 98 2 Paths and Spanning Sets ................................ 99 3 Critical Pairs and Rigid E-Unification ......................... 101 3.1 NP-Completeness of Rigid E-Unification .................... 105 4 Decidable Cases of Simultaneous Rigid E-Unification ................. 111 4.1 Unit Equations .................................. 111 4.2 Horn Clauses ................................... 113 4.3 Case Analysis ................................... 120 5 Path Paramodulation .................................. 123 5.1 A Modified System ................................ 131 5.2 Delayed Path Creation .............................. 132

Special Cases and Substitutes for Rigid E-Unification

Embed Size (px)

Citation preview

Page 1: Special Cases and Substitutes for Rigid E-Unification

AAECC 10, 97–152 (2000)

Special Cases and Substitutes for RigidE-Unification

David A. Plaisted

Department of Computer Science, University of North Carolina at Chapel Hill, Chapel Hill,NC 27599-3175, USA (e-mail: [email protected])

Received: March 6, 1997; revised version: August 13, 1999

Abstract. The simultaneous rigidE-unification problem arises naturally intheorem proving with equality. This problem has recently been shown to beundecidable. This raises the question whether simultaneous rigidE-unificationcan usefully be applied to equality theorem proving. We give some evidencein the affirmative, by presenting a number of common special cases in whicha decidable version of this problem suffices for theorem proving with equality.We also present some general decidable methods of a rigid nature that can beused for equality theorem proving and discuss their complexity. Finally, wegive a new proof of undecidability of simultaneous rigidE-unification which isbased on Post’s Correspondence Problem, and has the interesting feature that allthe positive equations used are ground equations (that is, contain no variables).

Keywords: Theorem proving, Equality, Unification, RigidE-unification,Decidability, Tableaux, Horn clauses, First-order logic.

Contents

1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98

2 Paths and Spanning Sets. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99

3 Critical Pairs and RigidE-Unification . . . . . . . . . . . . . . . . . . . . . . . . . 1013.1 NP-Completeness of RigidE-Unification . . . . . . . . . . . . . . . . . . . . 105

4 Decidable Cases of Simultaneous RigidE-Unification. . . . . . . . . . . . . . . . . 1114.1 Unit Equations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1114.2 Horn Clauses. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1134.3 Case Analysis. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120

5 Path Paramodulation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1235.1 A Modified System. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1315.2 Delayed Path Creation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132

Page 2: Special Cases and Substitutes for Rigid E-Unification

98 D. A. Plaisted

6 Rigid Clause Paramodulation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1326.1 Non-Horn Equality Problems. . . . . . . . . . . . . . . . . . . . . . . . . . . 135

7 Sizes of Amplifications. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137

8 A New Undecidability Proof . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1398.1 Expressing Finite Automata and Regular Sets. . . . . . . . . . . . . . . . . . 1398.2 Lists of Lists . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1418.3 Pairing Lists. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1448.4 Expressing PCP as a Regular Set. . . . . . . . . . . . . . . . . . . . . . . . . 1468.5 Expressing PCP as a List of Lists. . . . . . . . . . . . . . . . . . . . . . . . . 1478.6 The Final Simultaneous Problem. . . . . . . . . . . . . . . . . . . . . . . . . 149

9 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150

1 Introduction

Simultaneous rigidE-unification, which is related to theorem proving withequality, has recently been shown to be undecidable. However, we show thatin many common cases of interest, this problem is decidable and of reasonablecomplexity. We also present some decidable rigid inference systems that cansubstitute for simultaneous rigidE-unification, in a certain sense. Althoughfirst-order logic is not decidable, it is possible to use decidable techniques aspart of a method for theorem proving in first-order logic with equality. Finally,we give another undecidability proof for simultaneous rigidE-unification basedon Post’s Correspondence Problem.

Simultaneous rigidE-unification is related to the matings method of An-drews [And81] as well as to the connection framework of Bibel [Bib87]. Infact, [Bib87] presents methods closely related to rigidE-unification. RigidE-unification is also used as a way to incorporate equality into the semantictableau framework [Fit88] for theorem proving. For simplicity, we discuss thisproblem in the context of sets of clauses, although the semantic tableau frame-work is more general and the original paper of Andrews [And81] considers amore general structure of formulas (negation normal form) which has certainadvantages.

The organization of this paper is as follows. In Sect. 2, we discuss the rigidapproach to first-order theorem proving in the absence of equality. In Sect. 3,we discuss rigid theorem proving with equality, and define the simple and si-multaneous rigidE-unification problems. We also give the NP-completenessproof for simple rigidE-unification. The simultaneous problem, however, isof the most interest for first-order logic with equality. Sections 2 and 3 areprimarily expository in nature, reviewing known results, as an introduction tolater material. Since the generalE-unification problem is undecidable, we givesome decidable special cases of it in Sect. 4. These involve unit equations andHorn clauses. We also give a fully general method based on case analysis, butit involves some explicit enumeration of terms, which is often inefficient. In

Page 3: Special Cases and Substitutes for Rigid E-Unification

Special Cases and Substitutes for RigidE-Unification 99

Sect. 5, we give a fully general path-based method for equality in the context ofrigid E-unification. This method avoids the explicit enumeration of terms, andrelies instead on unification. This method is closely related to tableau methods.Some modifications of this method are also presented, and complexity anal-yses of some of the methods are given. Another paramodulation-based rigidapproach to equality reasoning is given in Sect. 6, and a set of clauses is alsogiven that illustrates some of its properties. In Sect. 7, we discuss some the-oretical questions related to the sizes of the amplifications needed for variousmethods, and a number of open problems are presented. Finally, in Sect. 8, wepresent a new proof of the undecidability of the general problem of simultane-ous rigidE-unification. In fact, we show that the special case of positive groundequations is still undecidable, and that for undecidability one needs only sixsimple rigidE-unification problems. This proof makes use of a reduction fromPost’s Correspondence Problem.

2 Paths and Spanning Sets

Rigid approaches to theorem proving make use of amplifications, paths, andspanning sets, which we now define. We also present a few known results relatedto rigid E-unification. We restrict our attention to first-order logic. In addition,although rigid methods are often used for non-clausal theorem proving, werestrict our attention to sets of clauses, both for simplicity and also to bring outthe underlying ideas. Anamplificationof a setS of clauses is a setT of clausesincluding one or more copies of each clause inS, with variables renamed so thateach variable appears in at most one clause inT . Thus ifS is {C[x, y], D[u, v]},then{C[x, y], C[x ′, y ′], D[u, v]} is an amplification ofS. Of course, there arealso many other amplifications.

The following known result is an immediate consequence of Herbrand’stheorem:

Theorem 2.1 A setS of clauses of first-order logic is unsatisfiable iff thereexist an amplificationT of S and a substitution2 such thatT 2 is ground andunsatisfiable.

However, given an amplificationT , it is not clear how one decides if sucha substitution2 exists, other than by enumerating all substitutions. The mat-ings (connection graph, Prawitz [Pra60]) methods have been developed for thispurpose. These involve paths and spanning sets, which we now define.

If S is a set{C1, C2, . . . , Cn} of clauses where allCi are distinct, then apathin S is a set{L1, L2, . . . , Ln} of literals such thatLi ∈ Ci for all i, 1≤ i ≤ n.

A pair is a set of two elements.

Page 4: Special Cases and Substitutes for Rigid E-Unification

100 D. A. Plaisted

A setSp of pairs of literals isspanningfor a setT of clauses if for everypathP in T , there is a pairp in Sp such thatp is a subset ofP . We call such asetSp aspanning set.

A substitution2 is a simultaneous unifierof a spanning setSp if for allpairs{L, M} in Sp, L2 andM2 are complementary literals.

As an example, suppose thatT is {{p(a)}, {¬p(x), q(x)}, {¬q(a)}}. Thenthe paths are{p(a),¬p(x),¬q(a)} and{p(a), q(x),¬q(a)}. A spanning setis {{p(a),¬p(x)}, {q(x),¬q(a)}, and a simultaneous unifier is{x ← a}.

Theorem 2.2 If S is a set of clauses, then there is a2 such thatS2 is groundand unsatisfiable iff there is a spanning setSp for S and a simultaneous unifier2 for Sp.

Proof. Let us expressS = {C1, C2, . . . , Cn} in disjunctive normal form asD1 ∨D2 ∨ · · · ∨Dm, where eachDi is a conjunctionL1 ∧ L2 ∧ · · · ∧ Ln forliteralsLi ∈ Ci . ThenS ≡ D1 ∨D2 ∨ · · · ∨Dm, and soS2 is unsatisfiable iffDi2 is unsatisfiable for alli. But Di2 can only be unsatisfiable iff it containstwo complementary literals. Also, eachDi is the conjunction of the literals insome path inS. Therefore,S2 is unsatisfiable iff for every pathP in S, P2

contains a pair of complementary literals. LetSp be the set of pairsp ⊆ P forpathsP in S, such thatp2 is a pair of complementary literals. ThenSp is aspanning set forS, and2 is a simultaneous unifier forSp. Conversely, if sucha simultaneous unifier2 exists, thenP2 is unsatisfiable for all pathsP of S,so(D1 ∨D2 ∨ · · · ∨Dm)2 is unsatisfiable, soS2 is unsatisfiable. �

Combining this with theorem 2.1, we obtain the following (known) result,which gives the connection between amplifications, spanning sets, and satisfi-ability.

Theorem 2.3 A setS of clauses is unsatisfiable iff there is an amplificationT

of S, a spanning setSp for T , and a simultaneous unifier2 of Sp.

Therefore, in order to show thatS is unsatisfiable, we have to chooseT ,find Sp, and test if2 exists. ChoosingT consists in deciding how many copiesof each clause ofS are needed for the proof; of course, one cannot know thesenumbers in advance, but must try increasing numbers of copies in the searchfor a proof. FindingSp involves a search through a large number of possiblesets of pairs of literals for a set that is spanning. The number of possible setsSp one needs to examine is at most exponential in the size ofS. To show this,we note that the number of pairs of literals is at most the square of the num-ber of literals inS, so each setSp is of size polynomial in the size ofS. Thesearch for a spanning setSp can be time consuming, but at least it is possibleto verify that a setSp is a spanning set in a small amount of space, by lookingthrough all paths in some order, one by one. Of course, this can be made some-what more efficient. Formally, testing whether a given set of pairs of literals is a

Page 5: Special Cases and Substitutes for Rigid E-Unification

Special Cases and Substitutes for RigidE-Unification 101

spanning set is in co-NP. Testing if2 exists is (for first-order logic) easy, sincesolving simultaneous unification problems is not more difficult than solvingsingle problems, which can be done in linear time. For this, it suffices to notethat2 unifies the pairs{L1, M1}, . . . , {Ln, Mn} if 2 unifiesf (L1, . . . , Ln) andf (M1, . . . , Mn), wheref is a new function symbol.

This same approach can be applied to higher-order logic. The prover ofAndrews [And81] uses higher-order logic, which is much more expressive, butalso has a harder unification problem. Here we are concerned with the extensionto first-order logic with equality.

3 Critical Pairs and Rigid E-Unification

The foregoing approach was extended to equality reasoning in [GNRS92].The motivation for this is that it is awkward to consider the equality axiomsexplicitly, so one would like to build in equality in some way. Also, it is difficultto know how many copies of the equality axioms to choose. This extension toequality is done as follows.

In this section, we review some of the results from [GNPS90]. We saythat a setS of clauses isEq-unsatisfiable ifS ∪ Eq is unsatisfiable, whereEq are the equality axioms (reflexivity, transitivity, symmetry, substitutiv-ity (x = y ⊃ f (. . . x . . .) = f (. . . y . . .)) and predicate replacement (x =y ∧ P(. . . x . . .) ⊃ P(. . . y . . .)). We similarly define Eq-satisfiability and Eq-validity. By aninequationwe mean a formula of the forms 6= t . An inequalityis a formula of the forms > t or s < t or s ≥ t or s ≤ t .

Again, by the use of Herbrand’s theorem, we obtain the following result.

Theorem 3.1 A setS of clauses isEq-unsatisfiable iff there is an amplificationT of S and a2 such thatT 2 is ground andEq-unsatisfiable.

As before, we want to find computable criteria for the existence of such a2. To do this, we need to consider more closely the structure of minimal unsat-isfiable sets of equations and inequations. Such computable criteria will entaila translation to eliminate non-equality predicates as well as a consideration ofcritical pairs and critical pair proofs.

We first translate the clause set so that the only predicate inS is the equalitypredicate. This simplifies the formalism to some extent. In some sections of thispaper, we will assume that this equality translation has already been done, andin other places we will not assume this. This translation is done by replacinga positive literalP(r1, . . . , rn) by the equationfP (r1, . . . , rn) = true andreplacing a negative literal¬P(r1 . . . rn) by fP (r1, . . . , rn) 6= true, wherefP is a new function symbol depending only onP . Assuming that “true”is a new constant symbol, one can show that this translation is satisfiabilitypreserving. For now, we generally assume that this translation has been done,

Page 6: Special Cases and Substitutes for Rigid E-Unification

102 D. A. Plaisted

although sometimes we refer to the equationsfP (r1, . . . , rn) = true as positiveliterals andfP (r1, . . . , rn) 6= true as negative literals. We also refer to thesenew equations and inequations involvingfP as literal equationsand literalinequations, respectively. If this translation is not done, then it is necessary toconsider non-equality literals and equality literals separately, leading to moreinference rules.

Definition 3.2 An equational setfor a setS of clauses is a set of equationsand inequations fromS containing exactly one inequation. We also requirethat if an equational set contains a literal inequationfP (r1, . . . , rn) 6= true,then it contains exactly one literal equation having the function symbolfP ,possibly with other non-literal equations. If the equational set contains no literalinequations, then it contains no literal equations.

We will show later that any minimal unsatisfiable set of equations andinequations is an equational set. The intuition for this is that an unsatisfiableset of Horn clauses needs only one negative clause. We consider Horn clausesbecause the equality axioms are Horn clauses. If we had not done the translationto equality, then we would also have to consider equational sets containingequations and a positive and negative non-equality literal.

Definition 3.3 A simplification ordering> is a partial ordering on terms thatis well-founded and satisfies the following three properties:

1. Thesubterm property, that is, for all termss, f (. . . s . . .) > s,2. the replacement property, that is, for all termsr and s, r > s implies

f (. . . r . . .) > f (. . . s . . .), and3. the full invariance property, that is, for all termsr ands and all substitutions

2, r > s impliesr2 > s2.

We say that a simplification ordering istotal on ground termsif for all distinctground termss andt , eithers > t or t > s.

In the sequel, we will generally assume that> (or <) is a simplificationordering that is total on ground terms.

Definition 3.4 Supposer1[u] = s1 andr2 = s2 are two equations andr1[u] hasa non-variable subtermu that unifies withr2. Letα be a most general unifier ofu andr2. Then(r1[s2]α, s1α) is acritical pair between the equationsr1[u] = s1

andr2 = s2. We sometimes also call the equation(r1[s2] = s1)α a critical pair.We callα thecritical substitutionof this critical pair. Acritical pair operationinfersR ∪ {(r1[s2] = s1)}α from R, whereR contains the equationsr1[u] = s1

and r2 = s2. We also define the inequation(r1[s2] 6= s1)α as a critical pairbetweenr1[u] 6= s1 andr2 = s2 and define the associated critical pair operationthat infersR ∪ {(r1[s2] 6= s1)}α from R if R containsr1[u] 6= s1 andr2 = s2.In this case, too, we callα a critical substitution. We say that this critical pair iswith respect to the simplification ordering> if it is not the case thatriα < siα.

Page 7: Special Cases and Substitutes for Rigid E-Unification

Special Cases and Substitutes for RigidE-Unification 103

Definition 3.5 A critical pair proof from a setq of equations and inequationsis a sequencee1, e2, . . . , en of equations and inequations where eachei is eitheran element ofq or is a critical pair between two previous equations in thesequence. Acritical pair refutation is a critical pair proofe1, . . . , en such thaten is unifiable withx 6= x, wherex is a new variable.

It is known [HR91, BDP89] that ifq is anEq-unsatisfiable set of equationsand inequations, then there is a critical pair refutation fromq in which eachcritical pair is with respect to>. For the following proof, we assume that> isan ordering such thattrue is minimal in the ordering.

Theorem 3.6 Suppose thatq is a set of equations and inequations fromS. Thenif q is Eq-unsatisfiable, q has a minimalEq-unsatisfiable subsetp such thatp is an equational set forS.

Proof. We first note thatq may contain non-literal equations and inequationsas well as literal equations and inequations. We know that ifq is unsatisfiable,then there is a critical pair proof of an inequation unifiable withx 6= x fromq. We prove the theorem by observing what kinds of critical pair operationscan contribute to this proof. We note that the following kinds of critical pairoperations are possible:

1. A critical pair between a non-literal equation and a non-literal equation,yielding a non-literal equation.

2. A critical pair between a non-literal equation and a non-literal inequation,yielding a non-literal inequation.

3. A critical pair between a non-literal equation and a literal inequation, yield-ing a literal inequation.

4. A critical pair between a non-literal equation and a literal equation, yieldinga literal equation.

5. A critical pair between a literal equation and a literal inequation, yieldingtrue 6= true.

There are no other possibilities, because each critical pair operation must involveat least one equation, and critical pairs between two literal equations mustinvolve literal equations with the same symbolfP , yieldingtrue = true, whichcannot contribute to a proof. Also, the symbolsfP occur only at the top level, sothat the result of step 4 always has a symbolfP at the top level and is thereforea literal equation. For the same reason, there cannot be a critical pair betweena literal equation and a non-literal inequation.

Now, we can only obtain an equation unifiable withx 6= x from step 5 or2. (The result of step 3 will have atrue on one side.) Working backwards, toobtain an inequation from step 2, we only need a set of non-literal equationsand one non-literal inequation. Working backwards from step 5, we only need

Page 8: Special Cases and Substitutes for Rigid E-Unification

104 D. A. Plaisted

a set of non-literal equations, a literal equation with a symbolfP , and a literalinequation with the same symbolfP . We can let the setq be the set of equationsand inequations actually used in the proof, and we observe in all cases thatq isan equational set. �

We again make use of paths. Apath is defined as for the non-equationalcase. A setSp of equational sets isspanningfor S if for every pathP for S

there is an equational setp in Sp such thatp ⊆ P . Such a setSp is called anequational spanning setfor S.

Theorem 3.7 Suppose thatT is a set of clauses and2 is a substitution suchthatT 2 is ground. ThenT 2 is unsatisfiable iff there is an equational spanningsetSp for T such that for allp in Sp, p2 is Eq-unsatisfiable.

Proof. Similar to that for the non-equational case, except that we note that forEq-unsatisfiability, we need to consider sets of more than two equations andinequations. IfT 2 is unsatisfiable, the every path ofT 2 is Eq-unsatisfiable.By theorem 3.6, we can find an unsatisfiable equational subsetp of the path.Taking all of these subsets together, we obtain an equational spanning set forT

as specified in the theorem. For the reverse direction, if there is an equationalspanning setSp for T as specified, then every path ofT 2 is Eq-unsatisfiable,soT 2 is Eq-unsatisfiable. �

Combining this with the previous result, we obtain the following.

Theorem 3.8 A setS of clauses isEq-unsatisfiable iff there is an amplificationT of S, an equational spanning setSp for T , and a2 such that for allp in Sp,p2 is Eq-unsatisfiable.

Now, in contrast to the non-equality case, determining if such a2 ex-ists can be very difficult. In order to study this question, we introduce rigidE-unification.

Definition 3.9 The (simple) rigidE-unification problem(E, e), whereE is aset of equations ande is a single equation, is to determine if there is a substitution2 such thatE2 |= e2 (relative to equality). Such a substitution is called arigidE-unifierof e relative toE.

It is easy to see that this problem is equivalent to determining whether anequational set(E ∪ {¬e})2 is Eq-unsatisfiable, since(E ∧ ¬e)2 isEq-unsatisfiable iffE2 |= e2 relative to equality.

Definition 3.10 The simultaneousrigid E-unification problem(E1, e1), . . . ,

(En, en), where theEi are sets of equations and theei are equations, is todetermine if there is a substitution2 such that for alli, Ei2 |= ei2 relative toequality. Such a2 is called asimultaneous rigidE-unifierof Ei relative toei ,or asolutionof the simultaneous rigidE-unification problem.

Page 9: Special Cases and Substitutes for Rigid E-Unification

Special Cases and Substitutes for RigidE-Unification 105

Suppose(E ∪ {¬e}) is an equational set. Then theassociated rigidE-unification problemis to determine if there is a2 such thatE2 |= e2 rela-tive to equality. SupposeSp = {p1, . . . , pn} is a set of equational sets. Then theassociated simultaneous rigidE-unification problemis (E1, e1), . . . , (En, en),where(Ei, ei) is the simple rigidE-unification problem associated withpi .

Proposition 3.11 2 is a solution of the simultaneous rigidE-unification prob-lem associated withSp iff for all p in Sp, p2 is Eq-unsatisfiable.

We therefore say that a substitution2 is a simultaneous rigidE-unifier ofSp if for everyp in Sp, p2 is Eq-unsatisfiable.

Theorem 3.12 A setS of clauses isEq-unsatisfiable iff there is an amplificationT ofS, an equational spanning setSp for T , and a simultaneous rigidE-unifier2 of Sp.

As before, this gives us a way to prove theorems involving equality. To im-plement this, one must choose an amplification, find equational spanning sets,and then test if such a2 exists. The first two may be done as in the non-equalitycase. The third part involves simultaneous rigidE-unification. This problemhas a history of faulty attempts to develop algorithms, but was recently shownto be undecidable [DV95c, DV95b]. However, the problem of performing asimple rigidE-unification is NP-complete. This motivates the search for otherspecial cases of simultaneous rigidE-unification that are decidable, or even NP-complete, for applications to deduction. We first review the NP-completenessproof, to fix terminology. A similar proof was given in [GNPS90]. Then wepresent some special cases in which simultaneous rigidE-unification is decid-able. Next we present some complete (decidable) techniques for incorporatingequality into theorem proving; these techniques have a rigid flavor. As men-tioned before, the decidability of these approaches does not contradict the factthat first-order logic is not decidable. We also discuss some related questions.Finally, we give a new proof that the general simultaneous rigidE-unificationproblem is undecidable.

3.1 NP-Completeness of RigidE-Unification

To fix notation, we here review the proof that the simple rigidE-unificationproblem is NP-complete. NP-hardness was shown in [Koz81], so it suffices toshow membership in NP. For this, it suffices to show that if there is a2 suchthatE2 |= e2, then there is a proof of this fact whose length is polynomial in(E, e).

From now on, for simplicity we assume thatE is a set of equations andinequations, and we are concerned with the problem of whether there is a(ground)2 such thatE2 is ground andEq-unsatisfiable.

We first note that the assumption of groundness does not lead to a loss ofgenerality, since ifE2 |= e2 then for all substitutionsγ , E2γ |= e2γ . Thus

Page 10: Special Cases and Substitutes for Rigid E-Unification

106 D. A. Plaisted

we can chooseγ to replace distinct variables inE2 ande2 by distinct newconstant symbols.

Definition 3.13 If E is a set of equations, then thesubterm sizeSt (E) of E isthe number of distinct subterms that appear inE. Note that a subterm is onlycounted once, even if it appears many times. Also, subterms are only consideredidentical if their variables are identical. We say that a quantity is polynomial inE if it is polynomial inSt (E), and similarly for setsS of clauses.

Since a term may appear many times inE, the length ofE, written out asa string, may be exponential inSt (E).

Definition 3.14 (Recall definition 3.4.) SupposeE is a set of equations andinequations. Supposee[u] is an equation or inequation ofE andr2 = s2 (or itssymmetric version) is an equation ofE. Let α be a most general unifier ofuwith r2. Then we callα a critical substitutionfor E. We also callα a criticalsubstitution betweene[u] and the rewrite ruler2→ s2.

Theorem 3.15 SupposeE is a set of equations andα is a critical substitutionfor E. ThenSt (Eα) ≤ St (E).

Proof. See [PSK95]. �

Definition 3.16 A uniform rewritingstep on a term-rewriting systemR[r] con-taining a ruler → s, infers the systemR[s] in which all occurrences of thesubtermr in R have been replaced bys except for the occurrence on the left-hand side of the ruler → s itself.

The following result, also from [PSK95], will be useful to us.

Theorem 3.17 Suppose thatR is a ground term-rewriting system and> isan arbitrary simplification ordering that is total on ground terms. Then wecan completeR in a polynomial number of uniform rewriting steps to ob-tain R′ such thatR and R′ are equivalent(that is, the sentenceR′ ≡ R isEq-valid), R′ is terminating and confluent, for all rulesr → s in R′, r > s,andSt(R′) ≤ St (R). For this, it suffices to choose at each step the rewrite ruler → s such thats is >-minimal subject to the condition thatR[r] andR[s] arenot identical.

Proof. See [PSK95]. �

Definition 3.18 If A is a formula, thenGr(A) is A with the variablesx sys-tematically replaced by new constant symbolscx . We similarly defineGr(R)

for a term-rewriting systemR.

Page 11: Special Cases and Substitutes for Rigid E-Unification

Special Cases and Substitutes for RigidE-Unification 107

We now present a rigidE-unification proof system in which polynomiallength proofs of rigidE-unifiability can be constructed. Others have also studiedsystems for dealing with rigidE-unification. We are not sure of the relationshipsof these methods to our own. In [Pet94], a complete method is given for buildingin equality reasoning in the connection calculus. In [Bec94], a method is givento combine classical and rigidE-unification. In [Gou93], a rule-based methodis given for finding complete sets of rigidE-unifiers. This uses congruenceclosure. In [Bau92], a method is given to add rigidE-unification to an orderedtheory resolution calculus. An algorithm for simultaneous rigidE-unificationfrom [Gou94] is apparently incomplete. An approach to equality combiningthe matrix rule with equation solving is given in [DV95a].

We represent inference rules of our rigidE-unification proof system in theformat

A

BX ,

meaning thatB is derivable fromA, andX is the name of the rule. We useA ` D to indicate thatD may be obtained fromA by a sequence of zero ormore applications of such inference rules. Thelengthof such a proof is thenumber of rule applications in it. We represent a set of equations and inequa-tions as a quadruple(R, N, C, α) whereR is a set of rewrite rules,N is a setof inequations,C is a constraint, andα is a substitution. The constraints areconjunctions of inequalities of the formr > s for termsr, s. The constraints arenot needed for soundness or completeness, but help to prune the search space.We require that in every inference rule, for a quadruple used as the hypothesis ofthe inference rule, the constraintC besatisfiable. This means that there must bea simplification ordering satisfying the inequalities in the constraint. To test forthis, we consider the associated term-rewriting systemRC = {r → s:r > s isa conjunct ofC}. ThenC is satisfiable only ifGr(RC) is terminating, and wenote that ground termination can be tested in polynomial time [Pla93]. Thisproof system has four inference rules, orientation, ground completion, criticalsubstitution, and contradiction, as follows:

E

(R, N,∧{r > s : r → s ∈ R}, id)Orientation

whereR are the equations ofE oriented into rewrite rules in an arbitrary mannerandN are the inequations ofE andid is the identity substitution.

(R, N, C, α)

(R′, N ′, C ∧ C ′, α)Ground Completion

whereGr(R′) is canonical andEq-equivalent toGr(R). Thus(R ≡ R′) isEq-valid. Also,Gr(N ′) are in normal form with respect toGr(R′). Furthermore,R ⊃ (N ≡ N ′) and (R ∪ N) ≡ (R′ ∪ N ′) (relative toEq). Note that it ispossible that the orientations of the rules ofR′ are not uniquely determined bythose ofR. The additional constraintC ′ represents the orientation decisions

Page 12: Special Cases and Substitutes for Rigid E-Unification

108 D. A. Plaisted

that were made during the ground completion ofR, as explained below. Thesatisfiability of the constraintC ∧ C ′ implies thatGr(R ∪ R′) is terminating.

We now show in more detail how the ground completion step can be donein (nondeterministic) time polynomial inSt (R ∪N). For this, it suffices to usethe congruence closure method of [Sny89]. It is also possible to perform thisstep using the method of [PSK95]. This will complete a ground system in apolynomial number of rewrites. At each step, one chooses the ruler → s withthe smallest right-hand sides that can be applied somewhere, and applies iteverywhere. When a rewrite ruleu → v is rewritten tou′ → v′, then it maybe re-oriented asv′ → u′. Since we are working with constraints, when a ruler → s is chosen, then we include inC ′ all constraints of the forms ′ > s forall other rulesr ′ → s ′ that also can be applied. We also add the constraintr > s. In this way, we completeR in a polynomial number of steps and updatethe constraintC to C ∧ C ′. We also rewriteN to normal form along with therewrites done onR, as the method progresses. As in [PSK95], we have thatSt (R′ ∪N ′) ≤ St (R ∪N).

(R, N, C, α)

(Rβ, Nβ, Cβ, αβ)Critical Substitution

whereβ is a (non-identity) critical substitution for(R∪N). Thus we can createcritical substitutions involving rules and inequations, as well as critical substitu-tions involving rules and rules. We require here too thatGr(Rβ) be terminating.Note that the critical substitution rule eliminates at least one variable, sinceβ

is not the identity.

(R, N ∪ {s 6= t}, C, α)

(Rβ, false, Cβ, αβ)Contradiction

wheres andt are unifiable andβ is a most general unifier ofs andt .From now on, for simplicity we often omit the constraint. We write(R, N, α)

` (R′, N ′, α′) if (R′, N ′, α′) can be derived from(R, N, α) using these rules.We first remark that for each one-step derivation using these rules, if(R, N, α) `(R′, N ′, α′), then there existsβ such thatα′ ≡ αβ. By transitivity, this also fol-lows for many-step derivations.

We now show that for each one-step derivation, if(R, N, α) ` (R′, N ′, αβ),then(R ∪ N)β ≡ (R′ ∪ N ′) relative toEq. This can be shown by examiningthe last three rules. In particular, we consider the contradiction rule. IfN has aninequations 6= t such thats, t are unifiable with most general unifierβ, thenNβ

contains an instance ofx 6= x and so isEq-unsatisfiable. Thus(R∪N)β isEq-unsatisfiable and equivalent to(Rβ ∪ false) relative toEq. The arguments forthe other rules are straightforward. It follows by transitivity that, if(R, N, α) `(R′, N ′, αβ) for ann-step derivation, then(R∪N)β ≡ (R′∪N ′) relative toEq.

Also, if E ` (R, N, β) by a one-step derivation thenEβ ≡ (R∪N) relativeto Eq, since thenβ is the identity substitution. It follows by transitivity and anabove result that ifE ` (R, N, β) by ann-step derivation, thenEβ ≡ (R∪N)

Page 13: Special Cases and Substitutes for Rigid E-Unification

Special Cases and Substitutes for RigidE-Unification 109

relative toEq. Thus ifE ` (R′, false, β), thenEβ is Eq-unsatisfiable. Thuswe have found a rigidE-unifier, namely,β. If we desire aβ ′ such thatEβ ′ isground andEq-unsatisfiable, then this can be found by modifyingβ to replacevariables by distinct new constant symbols.

We now show that if there is a2 such thatE2 is Eq-unsatisfiable, thenE ` (R′, false, α′) for someR′ andα′. Furthermore, the length of this rigidE-unification proof is polynomial in the size ofE. Since the result is knownfrom [GNPS90], we will try to be brief.

Definition 3.19 The length of a rigid E-unification proof is the number ofinference steps in it.

Theorem 3.20 SupposeR is a set of equations, N is a set of inequations, and2 is a substitution such that(R∪N)2 is ground andEq-unsatisfiable. SupposeE ` (R,N,α) for someE andα. Then(R,N,α) ` (R′,false,αβ) for someβsuch that(R ∪ N)β is Eq-unsatisfiable, and there is a proof whose length ispolynomial inSt (R ∪N).

Proof. By induction. For this we order the triples(R, N, α) lexicographically,first by the number of variables inR∪N , and then by the ordering of a minimalground substitutionβ such that(R ∪ N)β is ground andEq-unsatisfiable.Here we are ordering substitutions using the simplification ordering< which isassumed to be total on ground terms. That is,β ≤ β ′ iff for all variablesx, xβ ≤xβ ′. We know that some suchβ exists at the beginning (namely2), and we provethat given a triple(R, N, α) such that for someβ, (R∪N)β isEq-unsatisfiable,there is a proof step that generates a smallerEq-unsatisfiable triple.

For the proof, we note that(R ∪ N)2 is a ground system and can becompleted by ground completion. The result of this ground completion willbe a system containing an inequation of the formt 6= t . We lift these groundcompletion steps toR and N to obtain a proof as desired. This proof willgenerate something havingt 6= t as an instance. This must therefore be aninequation of the formr 6= s wherer ands are unifiable, in other words, aninequation that unifies withx 6= x.

We assume that the ground completion rule has already been applied toR∪N . We can always choose an ordering consistent with2 for ground completion,that is, we can order termsr and s by r >2 s (for ground completion) ifr2 > s2. If R ∪ N is the result of a ground completion step with such anordering, then we know that ifr = s is an equation inR andr2 > s2, thenall occurrences ofr in R (other than in this equation) will have been replacedby s. Now, if (R ∪N)2 is Eq-unsatisfiable, then eitherN contains already aninequation that unifies withx 6= x, or (R ∪ N)2 has a critical substitution.We often write a rewrite ruler → s as the equationr = s in the following.Suppose the critical substitution involves the two equations(r12)[u] = s12andr22 = s22, where(r12)[u] has a subtermu that is identical tor22. Since allterms (with2 applied) are ground,((r12)[s22], s12) is a critical pair between

Page 14: Special Cases and Substitutes for Rigid E-Unification

110 D. A. Plaisted

the equations(r1 = s1)2 and(r2 = s2)2. Now, we consider the position of thesubtermu in r12. If u occurs inside a2 term that replaces a variabley of r1,then we can writey2 as(y2)[u] and let2′ be defined byx2 ≡ x2′ if x 6≡ y,andy2′ = (y2)[s22]. We note in passing here thaty2 hasu as a subterm.Then2′ < 2 and(R ∪ N)2′ is alsoEq-unsatisfiable, and we can proceedby induction. If the critical substitution is trivial (the identity), then this stepwould have been done during ground completion. The only other possibility isthatu occurs at a non-variable position ofr1 and there is a critical pair with anon-trivial critical substitution. This substitution must bind a variable to a termnot containing that variable, and therefore reduces the number of variables. Sowe can perform a critical substitution step and again argue by induction.

There is a technicality to consider here. That is, we need to know that theequationr22 = s22 still occurs in(R∪N)2′ in order to know that(R∪N)2′

is Eq-unsatisfiable. This will be true unlessr2 or s2 containsy, since2 and2′ are identical on terms not containingy. We noted above thaty2 hasu as asubterm, andu ≡ r22. Thusr22 is a subterm ofy2. If r2 containsy, thenr22

hasy2 as a subterm, so it must be thaty2 ≡ r22, and thereforey ≡ r2. Also,y cannot occur ins2 since we are assuming thatr22 > s22. Thus the equationr2 = s2 is of the formy = s2 for some variabley that does not appear ins2.We note in passing that such equations cannot be derived ifR has a nontrivialmodel. If r1 also has the variabley at theu position, then this replacement ofy by s2 in r12 could have occurred already in the ground completion step, sowe do not need to consider this possibility. Otherwise, we perform a criticalsubstitution step by unifyingr2 with whatever term occurs at theu position ofr1. This will reduce the number of variables, so we can proceed by induction.Thus in all the cases we need to consider, the equationr22 = s22 still occursin (R ∪N)2′, and so(R ∪N)2′ is Eq-unsatisfiable.

We now need to show that the length of the proof is polynomial inSt (R∪N).The number of variable eliminating steps (applications of critical substitutions)is linear in the number of variables. We only have to check that the combinedwork to ground complete is polynomial in the size of the originalR∪N . This isnot obvious, because it could be thatR∪N grows in size, and so although eachground completion is polynomial, their combined time could be exponential inthe size of the originalR∪N . The polynomial bound is obtained by noting thatground completion does not increase the subterm size, and the work to groundcomplete is polynomial in the subterm size (for example, by the method of[PSK95] or [Sny89]). �

Corollary 3.21 SupposeE is a set of equations and inequations and2 is a sub-stitution such thatE2 is ground andEq-unsatisfiable. ThenE ` (R′,false,β)

for someβ such thatEβ is Eq-unsatisfiable, and there is a proof of this thatcan be found in nondeterministic polynomial time(polynomial inSt (E)). Wecan findβ ′ such thatEβ ′ is ground andEq-unsatisfiable, too, by replacingvariables by distinct new constant symbols.

Page 15: Special Cases and Substitutes for Rigid E-Unification

Special Cases and Substitutes for RigidE-Unification 111

Proof. One application of the orientation rule yieldsE ` (R, N, id). Combin-ing this with the theorem, we obtain the desired result. �Corollary 3.22 RigidE-unification is in NP.

Proof. If for some2, E2 is ground andEq-unsatisfiable, then in nondeter-ministic polynomial time (polynomial inSt (E)) we can find a proof of thisfact, using the preceding corollary. �

Since the NP-hardness of rigidE-unification is known by other methods[Koz81], we obtain that rigidE-unification is NP-complete.

4 Decidable Cases of Simultaneous RigidE-Unification

We now present some special cases which are fairly common in which simul-taneous rigidE-unification is decidable and of reasonable complexity. Thisshows that the rigidE-unification approach is still viable for theorem provingwith equality, in many cases. For these cases, we are still assuming thatS istranslated to eliminate non-equality predicates.

4.1 Unit Equations

We now assume thatS is a set of clauses consisting of a setE of unit equations(that is, clauses of the form{r = s} for some termsr ands) and a setS ′ ofclauses not containing positive occurrences of the equality predicate. For setsof unit equations, completion-based approaches are well known and efficient,so approaches based on rigidE-unification are of less interest. However, wepresent this material for completeness. We say a spanning setSp forT isuniformif for all (non-literal) equationse in E, for all p1 andp2 in Sp, e ∈ p1 iff e ∈ p2.

Theorem 4.1 SupposeS is a set of clauses consisting of a setE of unit equa-tions and a setS ′ of clauses not containing positive occurrences of the equal-ity predicate (for translatedS, not containing positive non-literal equations).ThenS is Eq-unsatisfiable iff there is an amplificationT of S, a uniform equa-tional spanning setSp′ for T , and a 2 such that for allp′ in Sp′, p′2 isEq-unsatisfiable.

Proof. If such a uniform equational spanning setSp′ exists, thenS is Eq-unsatisfiable as before. We now show that ifS is as stated, then such a uniformequational spanning setSp′ exists. We know from theorem 3.8 that ifS is Eq-unsatisfiable then there is an amplificationT of S, an equational spanning setSp

for T , and a2 such that for allp in Sp,p2 isEq-unsatisfiable. Now, we modifySp to obtain a setSp′ that is uniform. We defineSp′ to be{p ∪ E:p ∈ Sp}.Then ifp2 is Eq-unsatisfiable,(p ∪E)2 is Eq-unsatisfiable. This completesthe proof. �

Page 16: Special Cases and Substitutes for Rigid E-Unification

112 D. A. Plaisted

Now, the proof actually gives us more information than stated. In particular,we have thatSp′ is a spanning set for the same amplificationT asSp. This meansthat in order to use uniform spanning sets in this case, we do not need to increasethe size of the amplification.

We now show that simultaneousE-unification problems derived fromuniform spanning sets are NP-complete.

Theorem 4.2 SupposeSp is a uniform spanning set. Let(E1, e1), . . . , (En, en)

be the simultaneous rigidE-unification problem corresponding toSp. Let fbe a new function symbol not occurring inSp. Then there is a simple rigidE-unification problem(E, e) such that for all2 not containing the functionsymbolf , 2 is a solution of the problem(E, e) iff 2 is a solution of thesimultaneous problem(E1, e1), . . . , (En, en). Also, (E, e) is obtainable from(E1, e1), . . . , (En, en) in polynomial time.

Proof. Consider the simultaneous rigidE-unification problem correspondingto Sp. This will be a set(E1, e1), . . . , (En, en) of simple rigidE-unificationproblems in which all sets of non-literal equations are identical. That is, allEi

are identical except possibly for some literal equations. LetE be this set of non-literal equations. To obtain(E, e), we first eliminate these literal equations. Theonly kind of equational sets containing literal equations that we need to con-sider are those containing a single positive literal equationfP (u1 . . . un) = trueand a single negative literal equationfP (v1 . . . vn) 6= true. The literal equa-tion fP (u1 . . . un) = true would then occur in someEi and thenei wouldbe fP (v1 . . . vn) = true. We can remove the literal equation fromEi andreplaceei by the equationg(u1 . . . un) = g(v1 . . . vn) whereg is a new func-tion symbol, since the only way to obtain a contradiction is to derive equal-ity between (instances of)ui and vi for all i. In this way, we can replace(Ei, ei) by (E, g(u1 . . . un) = g(v1 . . . vn)). We then obtain an equivalent si-multaneous problem(E, e′1), . . . , (E, e′n) by performing this translation on all(Ei, ei). Also, we can assume that there are no literal equations or inequationsamongE or the e′i . Let us expresse′i as ri = si and lete be the equationf (r1, . . . , rn) = f (s1, . . . , sn), wheref is a new function symbol. We thennote that∧i(E2 |= ei2) iff E2 |= ∧iei2 iff E2 |= e2. �

Corollary 4.3 SupposeSp is a uniform spanning set. Then the problem ofdeciding if there is a2 such that for allp in Sp, p2 is Eq-unsatisfiable, is inNP.

Proof. A substitution2 satisfies (for allp in Sp, p2 is Eq-unsatisfiable) iff2 is a solution to the simultaneous rigidE-unification problem associated withSp. However, if the simultaneous problem is uniform, then there is a simplerigid E-unification problem(E, e) such that2 is a solution to(E, e) iff 2

is a solution to the simultaneous problem. Furthermore,(E, e) is obtainable in

Page 17: Special Cases and Substitutes for Rigid E-Unification

Special Cases and Substitutes for RigidE-Unification 113

polynomial time, and the simple rigidE-unification problem is in NP. Puttingall of these facts together, we obtain the above corollary. �

Corollary 4.4 SupposeS is a set of clauses consisting of a setE of equa-tions and a setS ′ of clauses containing no positive occurrences of the equalitypredicate(that is, no positive non-literal equations). Suppose thatT is an am-plification ofS. Then the problem of determining whether there exists a ground2 such thatT 2 is ground andEq-unsatisfiable is solvable in exponential time.

Proof. We know thatT 2 isEq-unsatisfiable iff there is a uniform spanning setSp such that for allp in Sp, p2 is Eq-unsatisfiable. Each path inSp will beof the formE ∪p′ wherep′ has one or two elements. Therefore the number ofelements ofSp is polynomial inS, and the number of suchSp is exponentialin S. To determine whetherT 2 is Eq-unsatisfiable, we can enumerate all theuniform spanning setsSp of T and test for each one whether such a2 exists.There may be exponentially many such spanning setsSp, and testing for theexistence of2 will take at most exponential time (since it is a problem in NP).Thus the total running time is exponential. (Actually, we can bound the positionof this problem in the polynomial hierarchy better than this, if we like, but westill cannot improve the exponential time bound at present.) �

This shows us (essentially) that the simultaneous rigidE-unification prob-lem is in the polynomial hierarchy for problems obtained from sets of clausesin which all equations occur in unit clauses.

4.2 Horn Clauses

Definition 4.5 A Horn clauseis a clause containing at most one positive literal.Thus{¬p(x),¬q(x), r(x)} and{¬p(x),¬q(x)} are Horn clauses.

Definition 4.6 We say that a clauseC is all-negativeor justnegativeif everyliteral in C is a negative literal.

Definition 4.7 A Horn equational seth for a setS of clauses is a set such thatfor all elementsy of h, eithery is a literal from a clause inS, considered as a unitclause, ory is a Horn clause fromS. Also,h contains at most one all-negativeclause.

Definition 4.8 A set h of Horn clausescoversa pathP of S if P intersectsevery clause inh.

Definition 4.9 A setSp of Horn equational sets isspanningfor S if for everypathP in S, there is a Horn equational seth for S in Sp such thath coversP .We call such a setSp aHorn spanning setfor S.

Page 18: Special Cases and Substitutes for Rigid E-Unification

114 D. A. Plaisted

Definition 4.10 A substitution2 is asimultaneous unifierof a Horn spanningsetSp if for all Horn equational setsh in Sp, h2 is Eq-unsatisfiable.

Theorem 4.11 If S is a set of clauses, then there is a2 such thatS2 is groundandEq-unsatisfiable iff there is a Horn spanning setSp for S and a simulta-neous unifier2 for Sp.

Proof. Similar to the proofs of theorems 2.2 and 3.7. IfS2 isEq-unsatisfiable,then there is an equational spanning set, which we can take asSp since it isalso a Horn spanning set. The only new part is to show that if a simultaneousunifier2 for Sp exists, thenS is Eq-unsatisfiable. This follows because ifh2

is Eq-unsatisfiable andh covers a pathP , thenP2 is alsoEq-unsatisfiable.�

We note that this theorem doesn’t say much yet, since ifS2 is Eq-unsatis-fiable we can just takeSp as an equational spanning set (without Horn clauses).But the other direction of the theorem gives us some new information, and willbe useful later.

We now develop some special cases that will be useful for obtaining anotherdecidable subcase for rigidE-unification.

Definition 4.12 Suppose thatH is a subset ofS such that every clauseC inH is a Horn clause. Then we say thatH is separable fromS if H satisfies thefollowing conditions:

1. No clauseD in S − H contains a literalM such thatM is a non-literalequation.

2. If there exists a clauseC of H and a literalL of C such thatL is of the formfP (r1, . . . , rn) 6= true, then no clauseD in S − H contains a literalM ofthe formfP (s1, . . . , sn) = true.

3. H contains no all-negative clauses.

Briefly stated, 2 means that predicate symbols that appear negatively inH

cannot appear positively outside ofH .

Definition 4.13 A Horn spanning setSp for S is uniform for S relative toH

if H is separable fromS and every Horn equational seth in Sp is of the formH ∪ h′ whereh′ contains either

1. A non-literal inequation from a clause inS −H or2. A literal inequation from a clause inS −H or3. A literal inequation from a clause inS −H and a literal equation with the

same predicate, also from a clause inS −H .

We note that ifH is separable fromS andT is an amplification ofS, thenthere is anH ′ that is separable fromT ; this is obtained by taking the copies ofH that are inT .

Page 19: Special Cases and Substitutes for Rigid E-Unification

Special Cases and Substitutes for RigidE-Unification 115

Theorem 4.14 SupposeS is a set of clauses andH is a set of Horn clauses inSthat is separable fromS. ThenS isEq-unsatisfiable iff there is an amplificationT of S, a setH ′ of Horn clauses inT that is separable fromT , a uniform(relative toH ′) Horn spanning setSp′ for T , and a2 such that for allp′ inSp′, p′2 is Eq-unsatisfiable.

Proof. If such a uniform equational spanning setSp′ exists, thenS is Eq-unsatisfiable as before. We now show that ifS is as stated, then such a uni-form equational spanning setSp′ exists. We know from theorem 3.1 that ifS is Eq-unsatisfiable, then there is an amplificationT of S and a2 suchthat T 2 is Eq-unsatisfiable. LetH ′ be the part ofT consisting of copiesof clauses fromH and letP consist ofall the paths inT − H ′. Let Sp be{p ∪H ′:p ∈ P}. Then we know that for allp in Sp, p2 is unsatisfiable. (Thisfollows by simple propositional reasoning.) Also, every path inT is coveredby some element ofSp. Now, we construct a spanning setSp′ for T whichcontains for each elementp ∪ H ′ in Sp a pathq ∪ H ′, whereq is minimalsuch that(q ∪H ′)2 is Eq-unsatisfiable. By properties of Horn sets and equal-ity, it follows thatq must contain exactly one all-negative clauseC. SinceH ′

has no all-negative clauses andq consists only of single literals,C must bea negative literalL. If L is a non-literal inequation, then by the definition ofseparable it follows thatq contains no other literals, and condition 1 of thedefinition of uniformity is satisfied. IfL is a literal inequation, then by the def-inition of separable it follows thatq may contain no other literals or perhapsone other literalM which is a literal equation having the same symbolfP asL. These cases correspond to conditions 2 and 3 of the definition of unifor-mity, respectively. ThereforeSp′ is uniform and satisfies the conditions of thetheorem.

This completes the proof. �

We may see that this condition onq is satisfied by considering thatH ′ andthe equality axioms are Horn clauses, and so we can obtain a proof of unsat-isfiability by Prolog-style backward chaining from the inequationL. By thedefinition of separable, it follows that when we back chain into theH ′ regionwe never get out of it again. The only way that theH ′ region can contributeto the proof is by deriving a setG of literal equations and non-literal equa-tions that, together withq, areEq-unsatisfiable. By theorem 3.6, we knowthat a minimal setq ∪ G of this form either contains (a) no literal equationsor inequations, or (b) a literal inequation of the formfP (r1, . . . , rn) 6= trueand a literal equation of the formfP (s1, . . . , sn) = true. The setq ∪ G mayalso contain non-literal equations, and since no non-literal equations occur inT −H ′, these must be elements ofG. If (a) holds, then condition 1 of the def-inition of uniformity is satisfied. If (b) holds, thenL is fP (r1, . . . , rn) 6= true.Depending on whether the literalfP (s1, . . . , sn) = true is a lemma derivedfrom H ′ or in q, we obtain conditions 2 and 3 of the definition of uniformity,respectively.

Page 20: Special Cases and Substitutes for Rigid E-Unification

116 D. A. Plaisted

We note here as in theorem 4.1 that the proof actually gives us more infor-mation than stated. In particular, we have thatSp′ is a spanning set for the sameamplificationT asSp. This means that in order to use uniform spanning setsin this case, we do not need to increase the size of the amplification.

Definition 4.15 The (simple) rigid Horn unification problem(H, e), whereHis a set of Horn clauses (possibly involving equality) ande is a single equation,is to determine if there is a substitution2 such thatH2 |= e2 (relative toequality). Such a substitution is called arigid Horn unifierof e relative toH .

It is easy to see that this problem is equivalent to determining whether aHorn set(H∪{¬e})2 isEq-unsatisfiable, since(H∧¬e)2 isEq-unsatisfiableiff H2 |= e2 relative to equality.

Definition 4.16 Thesimultaneousrigid Horn unification problem(H1, e1), . . . ,

(Hn, en), where theHi are sets of Horn clauses (possibly involving equality)and theei are equations, is to determine if there is a substitution2 such thatfor all i, Hi2 |= ei2. Such a2 is called asimultaneous rigid Horn unifieroftheHi relative toei .

Suppose thate is an equation and(H ∪{¬e}) is a Horn equational set. Thenthe associated simple rigid Horn unification problemis to determine if thereis a2 such thatH2 |= e2 relative to equality. SupposeSp = {p1, . . . , pn}is a set of Horn equational sets. Then theassociated simultaneous rigid Hornunification problemis (H1, e1), . . . , (Hn, en), where(Hi, ei) is the simple rigidHorn unification problem associated withpi .

Proposition 4.17 2 is a solution of the simultaneous rigid Horn unificationproblem associated withSp iff for all p in Sp, p2 is Eq-unsatisfiable.

We now show that ifSp is uniform, the simultaneous rigid Horn unificationproblem associated withSp can be converted to an equivalent simple rigid Hornunification problem. Then we show that this simple problem is in NP.

Theorem 4.18 SupposeSp is a uniform Horn spanning set relative toH . Let(H1,e1), . . . , (Hn, en) be the simultaneous rigid Horn unification problem cor-responding toSp. Letf be a new function symbol. Then there is a simple rigidHorn unification problem(H,e) such that for all2 not containingf , 2 is asolution of the problem(H,e) iff 2 is a solution of the simultaneous problem(H1,e1), . . . ,(Hn,en). Also, (H,e) is obtainable from(H1,e1), . . . ,(Hn,en) inpolynomial time.

Proof. Very similar to the proof of theorem 4.2. It is only necessary to modify(Hi, ei) to (H, e′i) and then introduce the new function symbolf as before.The only difference is that we may have either 1)Hi = H andei is a singlenon-literal equation, or 2)Hi = H andei is a single literal equation, or 3)

Page 21: Special Cases and Substitutes for Rigid E-Unification

Special Cases and Substitutes for RigidE-Unification 117

Hi = H ∪Li whereLi is a non-literal equation, andei is a non-literal equationwith the same symbolfP . This follows by the definition of uniformity ofSp

relative toH . Cases 1) and 3) are handled as for the unit equational case. Thusin case 3), we introduce a new equatione′i as in theorem 4.2 such that(H, e′i) isequivalent to(Hi, ei). Case 2) is new, but this does not matter, since it is in anyevent a single equation and can be treated the same as case 1). We thus obtainan equivalent system(H, e′1), . . . , (H, e′n). Then we introducee equivalent tothe conjunctione′1 ∧ · · · ∧ e′n as in theorem 4.2, so that(H, e) is equivalent to(H, e′1), . . . , (H, e′n). �

We now present a set of inference rules in order to show that the simplerigid Horn unification problem is in NP. We refer to a Horn clause, all of whoseliterals are equality or inequality literals, and which contains at least one positiveliteral, as aHorn equational clause. Note that this includes ordinary equations asa special case.A non-positive clauseis a clause containing at least one negativeliteral, and in this context, refers to a Horn equational clause containing at leastone negative literal. Note that every Horn equational clause is either a unitequation or a non-positive clause.

We need to redefine the notion of a critical substitution, as follows:

Definition 4.19 SupposeH is a set of Horn equational clauses. Supposee[u]is a clause ofH andr2 = s2 (or its symmetric version) is a unit equation ofH .If e is a non-positive clause, suppose thatu is a term occurring in its leftmostinequation. Letα be a most general unifier ofu with r2 . Then we callα acritical substitutionfor H . We also callα a critical substitution betweene[u]and the rewrite ruler2→ s2.

As before, we represent a set of Horn equations and Horn inequations asa quadruple(R, N, C, α) whereR is a set of rewrite rules,N is a set of non-positive clauses,C is a constraint, andα is a substitution. The constraints areconjunctions of inequalities of the formr > s for termsr, s. As before, theconstraints are not needed for soundness, but help to prune the search space.We require that in every inference rule, for a quadruple used as the hypothesisof the inference rule, the constraintC be satisfiable. This proof system hasfour inference rules, orientation, ground completion, critical substitution, andinequation elimination, as follows:

H

(R, N,∧{r > s:r → s ∈ R}, id)Orientation

whereH is a set of Horn equational clauses andR are the (unit) equations ofH oriented into rewrite rules in an arbitrary manner andN are the non-positiveclauses ofH andid is the identity substitution.

(R, N, C, α)

(R′, N ′, C ∧ C ′, α)Ground Completion

Page 22: Special Cases and Substitutes for Rigid E-Unification

118 D. A. Plaisted

whereGr(R′) is canonical and Eq-equivalent toGr(R). (Recall definition 3.18of Gr.) Thus(R ≡ R′) is Eq-valid. Also,Gr(N ′) are in normal form withrespect toGr(R′). Furthermore,R ⊃ (N ≡ N ′) and(R ∪ N) ≡ (R′ ∪ N ′)(relative to Eq). The additional constraintC ′ represents the orientation decisionsthat were made during the ground completion ofR. The satisfiability of theconstraintC∧C ′ implies thatGr(R∪R′) is terminating. Ground completion isdone exactly as for the non-Horn equational case; it is only necessary to rewriteN asR is rewritten.

(R, N, C, α)

(Rβ, Nβ, Cβ, αβ)Critical Substitution

whereβ is a (non-trivial) critical substitution for(R ∪ N). Note that in theHorn case which we are now considering, we can generate critical substitutionsbetween rules and non-positive clauses. We require here too thatGr(Rβ) beterminating. Note as before that the critical substitution rule eliminates at leastone variable, sinceβ is not the identity.

(R, N ∪ {{s 6= t, L2, . . . , Ln}}, C, α)

(Rβ, N ∪ {{L2, . . . , Ln}}β, Cβ, αβ)Inequation Elimination

wheres andt are unifiable andβ is a most general unifier ofs andt . We notethat the resulting clause{L2, . . . , Ln}β can be empty, and we consider an emptyclause as equivalent to “false.”

We also have a special case of inequation elimination:

(R, N ∪ {{s 6= t, r1 = r2}}, C, α)

((R ∪ {r1→ r2})β, Nβ, (C ∧ (r1 > r2))β, αβ)Inequation Elimination

Hereβ is a most general unifier ofs and t , as before. The equationr1 = r2

(or r2 = r1) is converted to a rewrite rule and added toR, and the constraint ismodified.

From now on, for simplicity we often omit the constraint. We write(R, N, α)

` (R′, N ′, α′) if (R′, N ′, α′) can be derived from(R, N, α) using these rules. Asbefore, for each one-step derivation using these rules, if(R, N, α) ` (R′, N ′, α′),then there exists a substitutionβ such thatα′ ≡ αβ. By transitivity, this alsofollows for many-step derivations. Also, as for the unit equational case, if(R, N, α) ` (R′, N ′, αβ) for ann-step derivation, then(R ∪N)β ≡ (R′ ∪N ′)relative toEq. That is, the rules are equivalence (hence satisfiability) preserv-ing. Similarly, if H ` (R, N, β) by ann-step derivation, thenHβ ≡ (R ∪ N)

relative toEq. Thus ifH ` (R′, N ′∪{{}}, β), thenHβ isEq-unsatisfiable. Thismeans that we have found a rigid Horn unifier, namely,β (suitably grounded,if desired).

We now show that if there is a2 such thatH2 is Eq-unsatisfiable, thenH ` (R′, N ′ ∪ {{}}, α′) for someR′, N ′, andα′. Furthermore, the length of thisproof is polynomial in the size ofH . Since the result is similar to that for theunit equational case, we will omit some details.

Page 23: Special Cases and Substitutes for Rigid E-Unification

Special Cases and Substitutes for RigidE-Unification 119

Theorem 4.20 SupposeH is a set of equational Horn clauses and2 is asubstitution such thatH2 is ground andEq-unsatisfiable. ThenH ` (R′,N ′ ∪{false},β) for someR′, N ′, andβ such thatHβ is Eq-unsatisfiable, and thereis a proof whose length is polynomial inSt (H).

Proof. The basic idea of the proof is to observe that we can ground completethe systemH2 by applying ground completion to the pure equational part ofH . We also rewrite literals in inequations ofH . If some inequation rewrites tothe formr 6= r, then we can delete it. We note that when all the inequations in aHorn clause are deleted, we either obtain “false” or a new equation, which canthen be added in to the unit equations, which in turn can be ground completedagain. If no inequation rewrites to this form then we can do nothing more andunless{} has been derived,H2 is consistent. This ground proof fromH2 canthen be lifted to a proof fromH .

Formally, letH be E ∪ N , whereE are unit equations andN are non-positive clauses. We showed in theorem 3.20 that the ground completion ofE2 could be lifted toE, and the same proof applies here since all necessarycritical pair operations can still be performed. Thus we obtainH ` (R, N ′, α),where2 = αα′, α′ is a substitution such that(R∪N ′)α′ is ground, andRα′ is aconfluent ground term-rewriting system equivalent toE2. Also, we can assumethat N ′ is in normal form relative toR (by the ground completion inferencerule).

Suppose thatN ′α′ has some clauseC with an inequation of the formr 6= r.Then there is an inequation elimination rule that can be applied to(R, N ′, α),simplifying the system.

Suppose that none of the inequations ofN ′α′ are of the formr 6= r. Supposealso thatfalse(i.e.,{}) has not been derived. Then(R∪N ′)α′ is consistent, sincewe can interpret every term to itsRα′-normal form. Also, we interpret “=” asequality. Let us call this interpretationI . Now, all remaining inequationss 6= t

haves, t with differentRα-normal forms. This means that these inequationsare true (satisfied) in the interpretationI . Also, the unit equations are inR andthus are true in the interpretationI . Thus every clause in(R ∪N ′)α′ has a trueliteral, so all clauses are satisfied byI . But we know as in theorem 3.20 that(R ∪N ′)α′ ≡ H2, which is unsatisfiable.

The only other case is thatN ′α′ and thusN ′ contains{}. In this case wehave already derived a proof of a contradiction.

We now show that this proof is of polynomial length. This is straightforwardsince the ground completion rule is polynomial time, the orientation rule is onlyapplied once at the beginning, the critical substitution rule eliminates a variable,and the inequation elimination rule eliminates an inequation. By polynomialtime we mean polynomial inSt (H). This is valid since all steps can be donein time polynomial inSt (R ∪ N) and none of the inference steps increaseSt (R ∪N). �

Page 24: Special Cases and Substitutes for Rigid E-Unification

120 D. A. Plaisted

Corollary 4.21 Simple rigid Horn unification is NP-complete.

Proof. If for some2,H2 is ground andEq-unsatisfiable, then in nondetermin-istic polynomial time (polynomial inSt (H)) we can find a proof of this fact,using the preceding result. Also, rigid Horn unification has rigidE-unificationas a special case, and the latter is known to be NP-hard. Hence simple rigidHorn unification is NP-complete. �

Corollary 4.22 SupposeS is a set of clauses,H is a subset ofS that is separablefromS, andSp is a Horn spanning set forS that is uniform relative toH . Thenthe problem of deciding if there is a2 such that for allh in Sp, h2 is Eq-unsatisfiable, is in NP.

Proof. A substitution2 satisfies (for allh in Sp, h2 is Eq-unsatisfiable) iff2 is a solution to the simultaneous rigid Horn unification problem associatedwith Sp. However, if the simultaneous problem is uniform, then by theorem4.18 there is an equivalent simple rigid Horn unification problem(H, e). Fur-thermore,(H, e) is obtainable in polynomial time, and the simple rigid Hornunification problem is in NP. Putting all of these facts together, we obtain thecorollary. �

Corollary 4.23 SupposeS is a set of clauses consisting of a setH of equationalHorn clauses that is separable fromS. Suppose thatT is an amplification ofS. Then the problem of determining whether there exists a2 such thatT 2 isground andEq-unsatisfiable is solvable in exponential time.

Proof. Let H ′ be the part ofT containing copies of clauses inH . ThenH ′ isseparable fromT . Also, we know by theorem 4.14 thatT 2 is Eq-unsatisfiableiff there is a uniform (relative toH ′) spanning setSp′ such that for allh in Sp′,h2 is Eq-unsatisfiable. In addition, any suchSp′ must be of size polynomialin T , since each setp in Sp′ consists ofH ′ together with one or two literalsfrom T −H ′, and there are only a polynomial number of such combinations toconsider. So to determine whetherT 2 is Eq-unsatisfiable, we can enumerateall the uniform spanning setsSp′ of T and test for each one whether such a2

exists. There may be exponentially many such spanning setsSp, and testing forthe existence of2 will take at most exponential time (since it is a problem inNP). Thus the total running time is exponential. �

4.3 Case Analysis

We now present yet another special case in which the rigidE-unification prob-lem can be solved in nondeterministic polynomial time (in a certain sense).From now on in this paper, we will not assume that the equality translation(introduction offP terms) has been done.

Page 25: Special Cases and Substitutes for Rigid E-Unification

Special Cases and Substitutes for RigidE-Unification 121

Definition 4.24 Suppose thatS is a set of clauses. We say thatS is splittableiffor every clauseC in S and for every literalL in C, if L is a (positive) equationthenL has no variables in common withC − {L}.

Definition 4.25 SupposeS is a set of clauses. Then we say thatS1, . . . , Sn is asplittingof S iff the following properties hold:

1. S is unsatisfiable iff for alli, Si is unsatisfiable.2. For allSi , if a clauseC in Si contains a positive equality literal, thenC is a

unit equation.

Theorem 4.26 SupposeS is splittable. Then there is a splittingS1, . . . ,Sn of Ssuch thatn is at worst exponential in the number of literals inS. This splittingcan be found in time exponential inS.

Proof. One obtains theSi by recursively performing the following operation:GivenS, we find a clauseC of S containingL such thatL is a positive equation.We then consider the two sets(S − {C}) ∪ {{L}} and(S − {C}) ∪ {C − L}.SinceL shares no variables with the remainder ofS, S is unsatisfiable iff bothof these two sets are unsatisfiable. Also, each of these two clause sets has fewerliterals thanS. The same transformation can be applied to each of these clausesets, if they have non-unit equations. The theorem then follows by induction.

We note that ifS is splittable andS1 . . . Sn is a splitting ofS, then (essentially)by corollary 4.4, we can reduce simultaneous rigidE-unification for eachSi tosimple rigidE-unification, which is decidable and NP-complete. Thus we candecide in exponential time whether for alli, there exists a substitution2i suchthatSi2i is Eq-unsatisfiable.

Definition 4.27 We say that a set of clausesS is rigidly Eq-unsatisfiableifthere is a substitution2 such thatS2 is ground andEq-unsatisfiable.

Now, if S is an amplification and splittable, we can determine if it isrigidly Eq-unsatisfiable by splitting it and then testing eachSi for rigid Eq-unsatisfiability. TestingSi for rigid Eq-unsatisfiability is in exponential time,by corollary 4.4. However, even if allSi are rigidlyEq-unsatisfiable, it doesnot follow thatS is, because theSi together have more copies of clauses. Butif all Si are rigidlyEq-unsatisfiable, thenS is Eq-unsatisfiable, which is whatwe are really interested in anyway. Thus we have the following definition:

Definition 4.28 An interpolation testis a predicateP on clause sets such thatif S is rigidly Eq-unsatisfiable, thenP(S) is true, and ifP(S) is true, thenS isEq-unsatisfiable.

Page 26: Special Cases and Substitutes for Rigid E-Unification

122 D. A. Plaisted

We note that as far as theorem proving goes, interpolation tests are as goodas rigidEq-unsatisfiability tests. We can test ifS is Eq-unsatisfiable by enu-merating amplificationsT1, T2, . . . , Tn of S and applying an interpolation testto each one. Formally,

Theorem 4.29 SupposeP is an interpolation test. Then a setS of clauses isEq-unsatisfiable iff there is an amplificationT of S such thatP(T ) is true.

Proof. SupposeS is Eq-unsatisfiable. Then there is an amplificationT of S

such thatT is rigidly Eq-unsatisfiable. SinceP is an interpolation test,P(T )

is true. Now, suppose that there is an amplificationT of S such thatP(T ) istrue. ThenS is Eq-unsatisfiable, by the definition of an interpolation test.�

We have such a test for clause sets that are splittable.

Theorem 4.30 SupposeS is a splittable clause set. Then the following is aninterpolation test forS:

1. Generate a splittingS1, . . . ,Sn of S.2. Test eachSi for rigid Eq-unsatisfiablity; we note that this test is in expo-

nential time.3. Return“ true” if all these tests succeed.

Proof. By the definition of splitting, if 2 succeeds, thenS is unsatisfiable. Also,if S is rigidly unsatisfiable, then so is eachSi . �

Thus in this case we have an interpolation test whose complexity is expo-nential. The question arises whether in the general case such an interpolationtest exists. If so, it could take the place of simultaneous rigidE-unification, eventhough the latter is undecidable. The author has invested considerable effort tofind such an interpolation test or to prove it does not exist, without success ineither direction. However, the large number of special cases for which efficientmethods exist suggests that some method might work in general.

We now indicate how the above splitting method can be extended to thegeneral case, that is, to non-splittable clause sets. However, we cannot give anycomplexity bound in terms ofS.

Definition 4.31 SupposeS is an arbitrary set of clauses. Then a substitution2

is asplitting substitutionfor S if S2 is splittable.

Definition 4.32 A shared variablefor S is a variablex such that for someclauseC in S and some literalL in C, L is a positive equality literal andxappears both inL and inC − {L}. Note that we are not assuming that theequality translation has been done onS.

Proposition 4.33 If S is a set of clauses, and2 is a substitution such that forall shared variablesx, x2 is a ground term, then2 is a splitting substitutionfor S.

Page 27: Special Cases and Substitutes for Rigid E-Unification

Special Cases and Substitutes for RigidE-Unification 123

We then obtain the following result.

Theorem 4.34 An arbitrary setS of clauses isEq-unsatisfiable iff there is anamplificationT of S, a splitting substitution2 for T , and a splittingT1, . . . ,Tn

of T 2 such that eachTi is rigidly Eq-unsatisfiable.

Proof. If S is Eq-unsatisfiable, then there is an amplificationT of S and aground substitution2 such thatT 2 is ground andEq-unsatisfiable. Now, sucha2 is a splitting substitution forT , and for any splittingT1, . . . , Tn of T 2, allTi will be rigidly Eq-unsatisfiable. Conversely, if such a splitting substitution2 exists, thenT 2 is Eq-unsatisfiable, henceS is alsoEq-unsatisfiable. �

This implicitly gives a fully general equality theorem proving method basedon rigid E-unification. To test ifS is Eq-unsatisfiable, we enumerate ampli-ficationsT of S, and for eachT , we enumerate splitting substitutions2 andsplittings forT 2, testing theTi for rigid Eq-unsatisfiability using the methodof theorem 4.30. The drawback is that it is necessary to enumerate such substi-tutions2. However, one can easily see that it is only necessary to enumeratesplitting substitutions2 whose domain is the set of shared variables ofS. Also,in many cases there are only a small number of shared variables, making the taskeasier. Finally, we can make this method somewhat more efficient by choos-ing a simplification ordering> on terms and noting that ifS itself contains anequationr = s, then we need not consider substitutions2 containing subtermsrα such thatrα > sα. That is, we need only consider2 that are irreduciblewith respect to ordered rewriting. The combination of these techniques yieldsa simple and fully general equality method that may be sufficient for manypurposes.

The set of shared variables can be made smaller, too, by splittingT to obtainclauses setsTi having Horn subsetsHi that are separable fromTi . For this, wecan say that a variable of a clauseC is shared if it appears

1. in two (positive) equations inC, or2. in an equation ofC and in a non-equality literal ofC.

This suffices because any setTi without such shared variables must consist of asetHi of equational Horn clauses, together with clauses not containing positiveoccurrences of equality. It follows thatHi is separable fromTi , and so one cantest in exponential time if a2 exists makingTi2 Eq-unsatisfiable, by corollary4.23.

5 Path Paramodulation

We now give another fully general solution method for the problem of rigidEq-unsatisfiability. We cannot say much in general about the complexity ofthis method, but it avoids the necessity to enumerate substitutions. This method,

Page 28: Special Cases and Substitutes for Rigid E-Unification

124 D. A. Plaisted

path paramodulation, is based on paramodulation. It is similar to tableau-basedmethods, but the paramodulation rule appears to be different. Also, we give somecomplexity results about this method which appear to be new. Path paramodu-lation is complete (in a sense to be described) and has a rigid flavor.

Path paramodulation converts an amplificationS to a set of paths, thenperforms rigid operations on the paths. If all paths can be contradicted, then weknow thatS isEq-unsatisfiable. Also, because of its rigid flavor, the search spacefor a given amplificationS is finite. For this inference system, we consider a pathto be a multiset of literals, one literal from each clause. Path paramodulationhas five inference rules, as follows.

S

S ⊃ p1, . . . , pn

Path Creation

whereS is an amplification andp1, . . . ,pn is a listing of the set of paths inS. Notethat for largeS, just to list the set of all paths can be impractical. Therefore, itmay be better for practical purposes to letp1, . . . , pn be an equational spanningset forS. We do not know, however, if this preserves completeness.

S ⊃ p1, . . . , T ∪ {L[u], r = s}, . . . , pn

Sα ⊃ p1α, . . . , T α ∪ Lα[sα], . . . , pnαParamodulation

whereα is a most general unifier ofu andr. Here we do not distinguishr = s

from s = r. Note thatL is either an equation, an inequation, or a non-equalityliteral andL has the non-variable termu as a subterm. (We are not assuming thatthe equality translation has been done onS.) Also, note that the two “parent”clauses of the paramodulation are deleted.

It would be possible to modify path paramodulation by specifying a termi-nation ordering< that is total on ground terms and restrict paramodulation sothat the inference is not performed ifrα < sα. We call this paramodulationwith respect tothe ordering<.

S ⊃ p1, . . . , pi−1, T ∪ {L,¬M}, pi+1, . . . , pn

Sα ⊃ p1α, . . . , pi−1α, pi+1α, . . . , pnαResolution

whereL and¬M are literals andα is a most general unifier ofL andM. Thepathpi has been deleted since a contradiction has been derived.

S ⊃ p1, . . . , pi−1, T ∪ T1 ∪ {L}, pi+1, . . . , T ∪ T2 ∪ {L′}, . . . , pn

Sα ⊃ p1α, . . . , pi−1α, pi+1α, . . . , (T ∪ {L′})α, . . . , pnαFactoring

whereα is a most general unifier ofL andL′. Note that theT parts of the pathsT ∪ T1 ∪ {L} andT ∪ T2 ∪ {L′} are identical even before the application ofα. As a special case, if two non-empty paths are identical, one of them can bedeleted.

S ⊃ p1, . . . , T ∪ {r 6= s}, . . . , pn

Sα ⊃ p1α, . . . , pi−1α, pi+1α, . . . , pnαInequation Removal

Page 29: Special Cases and Substitutes for Rigid E-Unification

Special Cases and Substitutes for RigidE-Unification 125

whereα is a most general unifier ofr ands. Again, the pathpi has been deletedbecause a contradiction has been derived.

We consider an empty set of paths as equivalent to “false”. An empty path,however, is equivalent to “true.”

Theorem 5.1 (Soundness)If we can deriveS ⊃ p1, . . . ,pn in this ( pathparamodulation) system, then S ⊃ (∧p1) ∨ (∧p2) ∨ · · · ∨ (∧pn) (relativeto Eq), where∧pi is the conjunction of the literals in the pathpi . For this,we interpret an empty disjunction(when all paths have been contradicted) as“ false.”

Proof. For the path creation rule, we note that(∧p1)∨ (∧p2)∨ · · · ∨ (∧pn) isessentially a disjunctive normal form ofS, which is logically equivalent toS.

Now, for each inference rule

S ⊃ p1, . . . , pn

Sα ⊃ q1, . . . , qp

we show that ifS ⊃ (∧p1) ∨ (∧p2) ∨ · · · ∨ (∧pn) (relative to Eq) thenSα ⊃(∧q1) ∨ (∧q2) ∨ · · · ∨ (∧qn) (relative to Eq). By induction, this yields thedesired result. We show this for each inference rule separately. For example,consider the paramodulation rule. By equality reasoning, it follows that fromC1[u] ∧ r = s one can deriveC1α[sα], whereα is a most general unifier ofuandr. Therefore, ifS ⊃ (∧p1) ∨ · · · ∨ (T ∧ C1[u] ∧ r = s) ∨ · · · ∨ (∧pn),thenSα ⊃ (∧p1)α ∨ · · · ∨ (T α ∧ C1[u]α ∧ (r = s)α) ∨ · · · ∨ (∧pn)α, henceSα ⊃ (∧p1)α∨· · ·∨ (T α∧C1α[sα])∨· · ·∨ (∧pn)α. This corresponds to theconclusion of the paramodulation rule. The other rules can be handled similarly.

Corollary 5.2 If S ` (Sβ ⊃ false) in this system, thenSβ is Eq-unsatisfiable,henceS is Eq-unsatisfiable.

We now want to show the converse, that is, ifS isEq-unsatisfiable, then forsomeβ, Sβ ⊃ falsecan be derived in this system. That is, this system is com-plete. However, for this we have to place some restrictions on the amplificationS. That is, we show that ifS is Eq-unsatisfiable, then there is an amplificationT of S and a substitutionβ such thatTβ ⊃ false can be derived. In order tospecifyT , it is necessary to define resolution-paramodulation proofs and prooftrees.

Definition 5.3 A resolution-paramodulation proofof Cn from S is a sequenceC1C2 . . . Cn of clauses such that eachCi is either inS or is a resolvent orparamodulant of two previous clauses in the sequence. We also call such aproof a linear proof, since it is a linear sequence. This is not meant to implyanything about the theorem proving strategy used to obtain the proof.

Page 30: Special Cases and Substitutes for Rigid E-Unification

126 D. A. Plaisted

Definition 5.4 A resolution-paramodulation proof treeof C fromS is a binarytree in which the root node is labeled with the clauseC, the leaves are labeledwith clauses inS, and if the two children of a nodeN are labeled with clausesC1 andC2, respectively, thenN is labeled with a resolvent or a paramodulantof C1 andC2. The distinctive feature of a proof tree is that each clause is usedonly once.

We use the greek letters5 and5′ to refer to resolution-paramodulationproofs (or proof trees). Also,In(5) is the set of input clauses of the proof5,that is, the set ofCi such thatCi ∈ S for a linear proof, or, the set of labelsof leaf nodes, for a proof tree. Note that any linear proof can be converted to aproof tree by (possibly) duplicating some inference steps.

Definition 5.5 For a resolution-paramodulation proof tree5 of “ false” fromS, we define an amplificationA5 which has one clauseCN for each leaf nodeN in the tree5, and such that for two leaf nodesM andN , CM andCN shareno variables.

We note thatA5 will be an amplification ofIn(5) for all 5. Furthermore,every clause inIn(5) will appear exactly once inA5 (assuming that all theclauses in5 are distinct). Also, the number of clauses inA5 will be one greaterthan the number of resolution-paramodulation steps in5. This observationfollows from a property of binary trees.

For the following proof, we need to consider paths inS as multisets ofliterals, one from each clause inS, and we need the following definition.

Definition 5.6 Suppose thatqj andp′i are paths, considered as multisets ofliterals. Let{q1 . . . qm} and{p′1 . . . p′n} be multisets of paths. Apath correspon-denceis a functionF :{q1 . . . qm} 7→ {p′1 . . . p′n} from multi-sets of paths tomulti-sets of paths which is onto, such that for alli andj , if F(qj ) = p′i , thenqj is a super-multiset ofp′i .

Theorem 5.7 (Completeness)If S is Eq-unsatisfiable, then there is an am-plification T of S and a substitutionβ such thatT ` (Tβ ⊃ false) in thissystem.

Proof. SupposeS is Eq-unsatisfiable. Then there is a (non-rigid) resolution-paramodulation proof of the empty clause fromS ∪ {x = x}, since resolutionand ordered paramodulation are complete relative to equality [HR91, BGLS95].It follows that there is a (rigid) resolution-paramodulation proof tree5 of theempty clause fromS. In particular, we can choose5 so that all of the labels ofthe leaves have disjoint variables. We show that there is a substitutionβ suchthatA5 ` (A5β ⊃ false), that is, we can letT beA5.

We prove the theorem by induction on the size (number of resolution-paramodulation steps) of the proof tree5. We first do the base case, that is,5 consists of a single node, labeled by the empty clause. ThusS contains the

Page 31: Special Cases and Substitutes for Rigid E-Unification

Special Cases and Substitutes for RigidE-Unification 127

empty clause. ThenA5 will contain one copy of the empty clause, and nothingelse. ThenA5 has no paths, that is, the set of paths ofA5 is empty. Since weare considering an empty set of paths as equivalent tofalse, we obtain a proofsimply by the path creation rule fromA5, with β as the identity substitution.

Now we do the inductive step. Suppose that5 contains more than just asingle node, and that one of the resolution-paramodulation steps of5 derivesD from C1 andC2, whereC1 andC2 are labels of leaves of the proof tree. Let5′ be the remaining proof from(T − {C1, C2})∪ {D}. Since5 is a proof tree,so is5′. (This is not always true for linear proofs, sinceC1 andC2 may beused elsewhere in a linear proof.) ThenA5′ is (A5 − {C1, C2}) ∪ {D}. Let T ′

beA5′ for ease of notation. Since5′ has fewer inference steps than5, we canassume by induction that for someβ ′, T ′ ` (T ′β ′ ⊃ false). We then show thatfor someβ, T ` (Tβ ⊃ false).

Let p′1 . . . p′n be the paths ofT ′. Then we assume by induction thatT ′ `(T ′β ′ ⊃ false). Since this proof must begin with the path creation rule, we havethat(T ′ ⊃ p′1 . . . p′n) ` (T ′β ′ ⊃ false). Let p1 . . . pm be the paths ofT . Thenby the path creation rule we obtainT ` (T ⊃ p1 . . . pm). We show that thereis a (partial) proof(T ⊃ p1 . . . pm) ` (T α ⊃ q1 . . . qm) such that everyqj is asuperset (super-multiset) of somep′i and everyp′i is a sub-multiset of someqj .More precisely, there is a path correspondenceF :{q1 . . . qm} 7→ {p′1 . . . p′n}.We will show that such a partial proof exists below. For now, let us just assumethis and see how the rest of the proof can be carried out.

Assuming that we have a proof(T ⊃ p1 . . . pm) ` (T α ⊃ q1 . . . qm)

as specified, the steps in the proof(T ′ ⊃ p′1 . . . p′n) ` (T ′β ′ ⊃ false) canbe simulated on(T α ⊃ q1 . . . qm), in the sense that a path correspondenceexists. For this, every step onp′i has to be performed on all theqj such thatF(qj ) = p′i . Suppose thatγ is the substitution generated by the applicationof this inference rule onp′i . Let s(q) for a pathq denote the path obtained byapplying an inference rule toq as in the simulating or simulated proof. Thuss(p′i) is p′iγ with some literals deleted or modified according to the inferencerule used. Then ifF(qj ) = p′i , qj hasp′i as a sub-multiset and we can applythe same inference rule onqj , generating the substitutionγ also. We may haveother pathsqk such thatF(qk) = p′i ; these paths will now becomeqkγ . Thesewill have the pathp′iγ as a sub-multiset. Thus we can apply the same inferencerule toqkγ as we applied toqj , but sinceγ has already been applied, and weare in a rigid framework,γ need not be applied again. We then update the pathcorrespondenceF so thatF(s(qj )) = s(p′i) andF(s(qk)) = s(p′i). This willpreserve the fact thatF is a path correspondence.

The factoring rule is slightly different, since a pair of paths are involved.However, as before, one can simulate a factoring operation on pathsp′i andp′jby factoring operations on pathsq andr such thatF(q) = p′i andF(r) = p′j .Supposep′i is T ∪ T1 ∪ {L} andp′j is T ∪ T2 ∪ {L′}. Then the result of thefactoring operation onp′i andp′j is the path(T ∪ {L})γ for some most general

Page 32: Special Cases and Substitutes for Rigid E-Unification

128 D. A. Plaisted

unifier γ of L andL′. Now, sinceq andr havep′i andp′j as sub-multisets,q is T ∪ Tq ∪ {L} andr is T ∪ Tr ∪ {L′} for someTq andTr . By a factoringoperation onq and r, we obtain(T ∪ {L})γ , which still preserves the pathcorrespondence. Then we perform the same operation on other pathsq andr

such thatF(q) = p′i andF(r) = p′j . The effect is similar, except that thesubstitutionγ will have already been applied and need not be applied again.

At the end, all the pathsp′i are removed, yielding that(T ′ ⊃ p′1 . . . p′n) `(T ′β ′ ⊃ false). Now, if we have a path correspondenceF :P1→ P2 for setsP1

andP2 of paths andP2 is empty,P1 is empty, also. Therefore, if the simulatedproof is a proof of(T ′β ′ ⊃ false), by simulating it we also obtain a proof of(T αβ ′ ⊃ false). That is, we have a proof(T α ⊃ q1 . . . qm) ` (T αβ ′ ⊃ false).Together with the proof(T ⊃ p1 . . . pm) ` (T α ⊃ q1 . . . qm), this yields theresult(T ⊃ p1 . . . pm) ` (T αβ ′ ⊃ false). Therefore, using the path creationrule,T ` (T αβ ′ ⊃ false).

Now, it remains to do the step that we left out, namely, to show that thereis a proof (T ⊃ p1 . . . pm) ` (T α ⊃ q1 . . . qm) such that there is a pathcorrespondence betweenq1 . . . qm andp′1 . . . p′n. This implies that everyqj is asuper-multiset of somep′i . We show that such a proof exists by case analysis onthe inference steps. SupposeD is obtained by a paramodulation step betweenC1 andC2. Let us writeC1 asB1∪ {L[u]} andC2 asB2∪ {r = s}. We can thenwrite D asB1α∪{Lα[sα]}∪B2α, whereα is a most general unifier ofr andu.LetT1 be such thatT = T1∪{C1, C2}. (Here we use∪ for multiset union.) Everypathpi of T includes one of the literalsL1 from C1 and one of the literalsL2

from C2, together with a path inT1. We now consider several cases, dependingon whether the literalL1 from C1 is in B1 or not, and depending on whether theliteralL2 in C2 is inB2 or not. Letpi be a path inT that includes the literalsL[u]andr = s, together with a pathp1

i in T1. Performing the paramodulation rule onthe pathpi , we remove the literalsL[u] andr = s and add the literalLα[sα].The result of this operation will be the path(pi − {L[u], r = s})α ∪ {Lα[sα]}.The same operation can then be done on all the other pathspj of T which areof the formp1

j ∪{L[u]α(r = s)α} for some pathp1j in T1α. All these paths will

contain the literalsL[u] andr = s, which will have been instantiated toL[u]αand (r = s)α because we are in a rigid framework, and so will not requireany further substitution. In all these other paths, the paramodulation rule willremove the literalsL[u]α and(r = s)α and replace these literals byLα[sα].In this way, we obtain the proof(T ⊃ p1 . . . pm) ` (T α ⊃ q1 . . . qm), byperforming all of these paramodulation inference steps.

Now, every pathp′ in T ′ will include one of the literals ofD, plus literalsfrom other clauses inT ′. We note thatT ′ = (T − {C1, C2})α ∪D. Consider apathqj . It must include a literal ofB1α and a literal ofB2α, or else it includesthe literalLα[sα] resulting from the paramodulation step. In addition,qj mustinclude a literal from each of the other clausesT1α in T α. We show that a pathcorrespondenceF exists. For this step, we need to have that paths are multisets

Page 33: Special Cases and Substitutes for Rigid E-Unification

Special Cases and Substitutes for RigidE-Unification 129

of literals. If qj includes this literalLα[sα] then we can letF(qj ) beqj , sinceqj will be a path inT ′, too. If qj includes a literal fromB1α and an arbitraryliteral L2 from C2α, then we can letF(qj ) beqj − {L2}, which will be a pathin T ′ sinceB1α is a subset ofD. If qj includes a literal fromB2α and the literalLα from C1α, then we can letF(qj ) beqj − {L1}, which will be a path inT ′,sinceB2α is a subset ofD. If qj does not include literals fromB1α orB2α, thenit must include bothL[u]α and(r = s)α, but this cannot be, because we havealready applied the paramodulation operation to all such paths.

The reasoning is similar for the other operations (resolution betweenC1 andC2, and resolution ofC1 with x = x). We use the factoring rule on paths for thefactoring operations on clauses that may be performed as part of a resolutioninference. The factoring rule on paths was designed not only to simulate clausefactoring, but also to be compatible with path correspondences, which is neededfor the rest of the argument. For clause resolution withx = x, we use inequationremoval on paths, which has the same effect.

This completes the proof. �

We note that in an implementation, one might want to modify these inferencerules so that the literals involved in paramodulation, resolution, or inequationremoval are not deleted from their paths. One might also want to allow additionalrules, such as simplification (rewriting) relative to some ordering. However, herewe are only interested in establishing a general framework, which others mayrefine.

One interesting feature of this method is that it solves the simultaneousrigid E-unification problem, in a sense. In particular, ifS consists entirely ofequational clauses (that is, all literals are equations or inequations), andT isan amplification ofS, then every path inT will be a conjunction of equationsand inequations. Therefore, ifS is Eq-unsatisfiable, andT is an amplificationof S, andT ` (Tβ ⊃ false), thenβ is a simultaneous rigidE-unifier of all thepaths inT . We have just shown that ifS is Eq-unsatisfiable, then some suchT andβ exist such thatT ` (Tβ ⊃ false), that is, our inference system willfind the simultaneous rigidE-unifierβ. Even though the general simultaneousrigid E-unification problem is undecidable, this technique finds enough simul-taneous rigidE-unifiers to make it sufficient for theorem proving purposes.This fact makes clear the mismatch between simultaneous rigidE-unificationand theorem proving, in the sense that it is still possible that there are efficientcomplete applications of simultaneous rigidE-unification to theorem proving,even though simultaneous rigidE-unification is undecidable.

Theorem 5.8 Suppose thatT is an amplification and there is a proofT `(Tβ ⊃ false) in this system. Then this proof has a number of steps equal to atmost the number of paths ofT times the number of clauses inT .

Proof. Each inference rule except for path creation reduces the number ofliterals in at least one path. �

Page 34: Special Cases and Substitutes for Rigid E-Unification

130 D. A. Plaisted

The implication of this is that it is decidable whether there is a proofT `(Tβ ⊃ false) in this system, and one need only examine proofs of lengthexponential inT (since the number of paths is at most exponential inT ). Thisdoes not contradict the undecidability of rigidE-unification, since this systemmay need much larger amplifications.

We now consider setsS of ground clauses and amplificationsT of S. Suchan amplificationT must be considered as a multiset, since all copies of a groundclause are identical. We would like to know how large an amplificationT of S

is needed to find a proof by path paramodulation ifS is Eq-unsatisfiable. Wehave the following result.

Recall that ifS is a set of clauses,St (S) is the number of distinct subtermsappearing in clauses ofS, each subterm being counted only once, regardless ofhow many times it appears inS.

Theorem 5.9 There is a fixed polynomialπ such that for allm, n and for allEq-unsatisfiable setsS of ground clauses withSt (S) = n having at mostmliterals per clause, there is an amplificationT ofS havingm∗2π(n) copies of eachclause ofS, such that there is a path paramodulation proofT ` (Tβ ⊃ false).

Proof. We use a counting argument. Letπ be the polynomial from [PSK95]such that if a setE of ground equations and inequations has at mostn distinctsubterms, then there is a critical pair proof of some inequation of the forms 6= s

from E, that has at mostπ(n) steps. Consider a pathp in T . For each clauseCin S, letL be the literal inC that appears the greatest number of times inp. Letqbe the path inS consisting of the set of such literalsL. Note that every elementof q appears at least 2π(n) times inq, sinceC has at mostm literals. Now,using a completion approach such as that in [PSK95], we know that there is acompletion proof of some such inequations 6= s fromq involvingπ(n) criticalpair steps. Expanding this proof to a tree, we obtain a paramodulation prooftree ofs 6= s with at most 2π(n)−1 steps. The pathp has enough copies of eachelement ofq to enable this proof to be accomplished in path paramodulation.One application of inequation removal on the inequations 6= s yields a proofof false, that is, the path is removed. This can be done for all paths, obtainingan empty set of paths, which representsfalse. In this way we obtain the desiredproofT ` (Tβ ⊃ false). �

Corollary 5.10 Under the conditions of the theorem, if S hask clauses, there isa path paramodulation proofT ` (Tβ ⊃ false) having at mostmk2π(n) steps.

Proof. Each path requires 2π(n) steps for a proof. The number of paths inS isat mostmk. �

We note (by the arguments given in [PSK95]) that this still applies if wedo path paramodulation with respect to an arbitrary termination ordering<

that is total on ground terms. That is, we never do paramodulations replacing

Page 35: Special Cases and Substitutes for Rigid E-Unification

Special Cases and Substitutes for RigidE-Unification 131

a subtermrα by sα if rα < sα. This is better than the situation for clauseparamodulation, as we shall see.

5.1 A Modified System

We now consider path paramodulation with the same set of inference rules asabove except that the paramodulation rule is replaced by the following:

S ⊃ p1, . . . , T ∪ {L[u], r = s}, . . . , pn

Sα ⊃ p1α, . . . , T α ∪ Lα[sα] ∪ (r = s)α, . . . , pnαParamodulation

whereα is a most general unifier ofu andr. As above, we do not distinguishr = s from s = r. Note thatL is either an equation, an inequation, or a non-equality literal andL has the non-variable termu as a subterm. The differencebetween this rule and the corresponding rule for path paramodulation is thatthe equationr = s is not deleted.

Theorem 5.11 SupposeS is anEq-unsatisfiable set of ground clauses. ThenS ` (S ⊃ false) in this modified path paramodulation system. That is, forground clause sets, we do not need larger amplifications.

Proof. Each path isEq-unsatisfiable, and therefore we can obtain a contradic-tion by equational completion and resolution. The substitutionβ generated willbe the identity substitution, and thus does not appear explicitly. The proof caneven be obtained by a sequence of rewriting operations, as in [PSK95]. Thismeans that the literal paramodulated into can be deleted, as in modified pathparamodulation. Thus we can simulate this proof by a sequence of paramod-ulations using the above inference rule, followed by an inequation removaloperation or a resolution operation on each path. Using ideas from [PSK95],we can also show that there is a proof in which the number of operations is apolynomial inSt (S) times the number of paths inS. Also, for ground setsS,we do not need the factoring rule. �

We note that this theorem does not seem to be true for the original pathparamodulation system, because it is difficult to bound the length of a resolution-paramodulation proof even from a set of ground clauses.

We now consider modified path paramodulation for non-ground clause sets.In general, each inference rule either binds a variable or else essentially treatsthe system as a ground system. The number of variable bindings is limited bythe number of variables. We would expect a result such as the following:

SupposeS is anEq-unsatisfiable set of clauses andT is an amplificationof S such that for some substitutionβ, T ` (Tβ ⊃ false) in modified pathparamodulation. Then there is a proof ofT ` (Tβ ⊃ false) whose length is atmost a polynomial inT times the number of paths inT .

We would expect this to be true, because the number of variable bindingsteps is linear inT . In between variable bindings, the setT is treated essentially

Page 36: Special Cases and Substitutes for Rigid E-Unification

132 D. A. Plaisted

as a ground system. Unfortunately, this result is not true. Later, in the discussionof our undecidability proof, we will construct setsS of clauses such thatS `(Sβ ⊃ false), but such that there is no recursive bound on the length of theseproofs. If we perform paramodulation with respect to a size-respecting termordering, we can probably limit the length of the proof to be recursive inT , butit might be a stack of exponentials inT since unification can increase term sizeby an exponential amount. Also, restricting paramodulation in this way wouldmiss some proofs, because of the undecidability result.

5.2 Delayed Path Creation

We now modify the above two path paramodulation systems to avoid the needto explicitly list all of the paths inS. This is done by modifying the path creationrule so that the paths are only generated as needed, and not all at once at thebeginning. In this delayed path creation system, paths can contain clauses aswell as literals, and such paths can be split up into more paths by partitioningone of the clauses they contain. The new version of the path creation rule issimply the following:

S

S ⊃ SPath Creation

We also have a path splitting rule as follows:

S ⊃ p1, . . . , pi−1, T ∪ {{L} ∪ C}, pi+1, . . . , pn

S ⊃ p1, . . . , pi−1, T ∪ {{L}}, T ∪ {C}, pi+1, . . . , pn

Path Splitting

whereL is a literal andC is a non-empty clause. This splits the pathT ∪{{L}∪C}containing the clause{{L}∪C} into two paths, one containing just{L} and onecontainingC. The other rules are unchanged, except that instead of literalsL inpaths, we now have to consider unit clauses{L}. Thus the paramodulation rulefor the original path paramodulation inference system would look like this:

S ⊃ p1, . . . , T ∪ {{L[u]}, {r = s}}, . . . , pn

Sα ⊃ p1α, . . . , T α ∪ {{Lα[sα]}}, . . . , pnαParamodulation

Soundness and completeness follow easily from the soundness and complete-ness of the original systems. However, delayed path creation is more practicalfor large sets of clauses, since one does not have to explicitly create all thepaths, but only those that are needed for subsequent inference rules.

6 Rigid Clause Paramodulation

Another approach to theorem proving with equality is rigid clause paramodula-tion, which is related to path paramodulation. We distinguish this from ordinary

Page 37: Special Cases and Substitutes for Rigid E-Unification

Special Cases and Substitutes for RigidE-Unification 133

non-rigid clause paramodulation. Rigid clause paramodulation is essentiallyparamodulation and resolution in which all the variables in a set of clauses aretreated rigidly. This system has the following five inference rules, whereT is aset of clauses:

T ∪ {C1[u], {r = s} ∪D}T α ∪ {C1[u], {r = s} ∪D}α ∪ {C1α[sα] ∪Dα} Paramodulation

whereα is a most general unifier ofu andr. Here we do not distinguishr = s

from s = r. Note thatC1 is an arbitrary clause having the non-variable termu

as a subterm. Also, note that neither of the two “parent” clauses of the paramod-ulation are deleted.

T ∪ {C ∪ {L}, {¬M} ∪D}T α ∪ {C ∪ {L}, {¬M} ∪D}α ∪ {C ∪D}α Resolution

whereL and¬M are literals andα is a most general unifier ofL andM.

T ∪ {C ∪ {L, M}}T α ∪ {C ∪ {L}}α Factoring

whereα is a most general unifier ofL andM.

T ∪ {C ∪ {r 6= s}}T α ∪ {C}α Inequation Removal

whereα is a most general unifier ofr ands.

T ∪ {{}}false

Contradiction

The idea is that we do resolution and paramodulation onT , but all substi-tutions are applied to the whole set of clauses, not just to the one or two clausesinvolved in the inference.

Theorem 6.1 Rigid paramodulation is sound, that is, if there is a proof of{}fromT , thenT is Eq-unsatisfiable.

Proof. Except for inequation removal, rigid paramodulation is a restriction ofordinary non-rigid resolution and paramodulation, which is sound. Also, theinference rule for inequation removal is sound, by properties of equality.�

Theorem 6.2 Rigid paramodulation is complete, that is, if S is anEq-unsatis-fiable set of clauses, then there is an amplificationT of S such that there is arigid paramodulation proof offalse(that is, {}) fromT .

Proof. SupposeS is Eq-unsatisfiable. Then, since ordinary resolution-para-modulation is complete, there is a resolution-paramodulation proof of{} fromS ∪ {x = x}. Therefore there is also a resolution-paramodulation proof tree5

of {} from S ∪ {x = x}. Recall thatA5 is an amplification having one clausefor each use of an element ofS in this proof. Suppose that we rename variables

Page 38: Special Cases and Substitutes for Rigid E-Unification

134 D. A. Plaisted

in A5 so that all clauses have disjoint sets of variables. Then the proof fromS

can be simulated by a rigid proof fromA5. The reason for this is that5 itself,with variables possibly renamed, is a rigid proof, since each clause is only usedonce. Now, the (rigid) proof5 may use instances of the clausex = x. Thesecan all be eliminated by applications of the inequation removal rule. Thus wecan letT beA5 with the instances ofx = x removed. �

We consider whether the proof length for rigid paramodulation-resolutioncan be recursively bounded in terms of the amplificationT . Since there are onlya linear number of variable binding steps, we only need to consider portionsof the search in which no new variables are bound. If there are a boundednumber of literals, then the search space is bounded, because resolution canonly generate an exponential number of clauses from a given set of literals.Therefore, if the minimal proof length cannot be recursively bounded, neithercan be the number of literals generated. These new literals can only be generatedby paramodulation steps (without binding variables), and so there must bea non-recursive upper bound on the number of paramodulation steps. Evenif we do ordered paramodulation, we might have a non-recursive number ofparamodulation steps. In fact, we cannot even show finiteness of the searchspace. We could conceivably generate a sequencee1, e2, e3, . . . of equationsand using these to paramodulate into a given literalL, generate a sequenceL1, L2, L3 . . . , of literals withL1 < L2 < L3 · · · . It is possible that by usingideas analogous to those of [PSK95], we might get a better bound or at leastshow finiteness. We consider it an interesting question whether one can doparamodulation even on ground clause sets in a more efficient manner.

We note that it is possible to get a better result for path paramodulation, asremarked earlier, since we can bound the size of a ground amplification neededin order to be able to obtain a proof. Also, non-rigid clause paramodulation andrigid paramodulation are identical for sets of ground clauses, since there are novariables. However, for clause paramodulation from setsS of ground clauses,if we choose a termination ordering that respects term size, then there are onlyan exponential number of new literals that can be generated.

Definition 6.3 An ordering< on termsrespects term sizeiff for all groundtermss, t , if s < t thens (as a character string) is no longer thant .

Definition 6.4 The lengthof a literal is the number of characters in it, writtenout as a character string. We can similarly speak of the length of a term.

Definition 6.5 A clauseC is atautologyif for some literalL, C contains bothL and¬L.

Theorem 6.6 Suppose thatS is a set of ground clauses. Suppose we performresolution and paramodulation onS, with respect to an ordering that respects

Page 39: Special Cases and Substitutes for Rigid E-Unification

Special Cases and Substitutes for RigidE-Unification 135

term size. Then the set of non-tautologous clausesC that can be generated fromS by resolution and paramodulation has at most3an

elements, wherea is thenumber of function, constant, and predicate symbols inS andn is the length ofthe longest literal inS.

Proof. The only literals that can be generated are those whose length is at mostn.There are at mostan such literals (not counting negations). Each such literal canappear either positively, negatively, or not at all in a non-tautologous clause.Assuming tautologous clauses are deleted, we obtain 3an

possibilities in all.�

Corollary 6.7 Under the conditions of the theorem, if S is Eq-unsatisfiable,then there is a resolution-paramodulation proof whose length is at most3an

.

This is worse than the situation for path paramodulation, where we can usean arbitrary termination ordering and still obtain an exponential bound on prooflength, by the remark after corollary 5.10.

6.1 Non-Horn Equality Problems

Let us consider the following simultaneous rigidE-unification problem,which illustrates some properties of ordered paramodulation:

f (d0) = d0 |= x = d0 (x is f i(d0) for somei)f (d0) = d1 ∧ f (d1) = d0 |= x = d1 (i is odd)f (d0) = d1 ∧ f (d1) = d2 ∧ f (d2) = d0 |= x = d2 (i = 3k − 1, somek)f (d0) = d1 ∧ f (d1) = d2 ∧ f (d2) = d3 ∧ f (d3)

= d0 |= x = d3 (i = 4k − 1, somek). . .f (d0) = d1 ∧ f (d1) = d2 ∧ · · · ∧ f (dn−2)

= dn−1 ∧ f (dn−1) = d0 |= x = dn−1 (i = nk − 1, somek)

This formulation is a modification by Harald Ganzinger of a similar one bythe author. Any solution substitution bindsx to f i(d0), wherei is congruent to−1 modulo 2, 3, 4, . . ., andn. Such ani will be of the formkm − 1 for somek ≥ 0, wherem is the least common multiple of 1, 2, 3, . . . , n. We note thatsince there are aboutn/(logn) primes less thann, and each one is at least 2,m

is asymptotically at least 2n/(logn), and therefore exponential inn. We considerwhether this solutionf i(d0) can be found by rigid paramodulation. We obtainthe following set of clauses whose simultaneous rigidE-unification problem isthat given above:

P1(x) ⊃ x 6= d0

P1(x) ⊃ f (d0) = d0

P2(x) ⊃ x 6= d1

P2(x) ⊃ f (d0) = d1

P2(x) ⊃ f (d1) = d0

Page 40: Special Cases and Substitutes for Rigid E-Unification

136 D. A. Plaisted

P3(x) ⊃ x 6= d2

P3(x) ⊃ f (d0) = d1

P3(x) ⊃ f (d1) = d2

P3(x) ⊃ f (d2) = d0

P4(x) ⊃ x 6= d3

P4(x) ⊃ f (d0) = d1

P4(x) ⊃ f (d1) = d2

P4(x) ⊃ f (d2) = d3

P4(x) ⊃ f (d3) = d0. . .Pn(x) ⊃ x 6= dn−1

Pn(x) ⊃ f (d0) = d1

Pn(x) ⊃ f (d1) = d2

Pn(x) ⊃ f (d2) = d3

Pn(x) ⊃ f (d3) = d4. . .Pn(x) ⊃ f (dn−2) = dn−1

Pn(x) ⊃ f (dn−1) = d0

P1(x) ∨ P2(x) ∨ P3(x) ∨ · · · ∨ Pn(x)

Such clause sets are unsatisfiable for everyn, since we can letx be f i(d0)

wherei ism−1. However, such clause sets are difficult for some good theoremprovers. We feel that these clause sets are interesting, because non-Horn equalityproblems are not common.

Suppose that we do ordered rigid paramodulation using an ordering thatrespects term size (for ground terms). The equations in this set of clauses areall ground equations, and the only other terms in these clauses are occurrencesof the variablex. The only possible paramodulations are therefore between twoground equations or between a ground equation andx. After a paramodulationbetween a ground equation andx, x will be bound to a constant symbol. Also,by paramodulating between two equations of the formf (di) = dk, we mayobtain equations of the forms = t where boths andt are constant symbols.More equations of this type can then be obtained by further paramodulations.However, these are the only kinds of equations and bindings forx that may beobtained using ordered rigid paramodulation on the given clause set.

For this proof, we need to consider an amplification with more than one copyof one or more clauses in order to get a proof. Without such an amplification,only the instancex = f m−1(c) or something larger will lead to a contradiction,and this instance can never be constructed by ordered rigid paramodulation withthe ordering we have chosen (which respects term size).

The conclusion is that even if there is a2 such thatT 2 is ground andunsatisfiable, it may be that ordered rigid paramodulation fromT cannot find a

Page 41: Special Cases and Substitutes for Rigid E-Unification

Special Cases and Substitutes for RigidE-Unification 137

proof. This may not be true for unrestricted rigid paramodulation, since we canalways paramodulate backwards to deriveP1(x) ⊃ x 6= f m−1(d0), P2(x) ⊃x 6= f m−1(d0), and so on, and then obtain the proof using the axiomx = x.Of course, ordered non-rigid paramodulation can find a proof from this set ofclauses, because it implicitly generates a larger amplification. We see then thatordered paramodulation trades larger terms for a larger amplification.

The question then arises, how many more instances in general will orderedrigid paramodulation with a size-respecting ordering, need to get a proof? Atpresent, we cannot say much about this problem.

7 Sizes of Amplifications

We now consider the general question of how large an amplification one needsfor rigid theorem proving using various methods. For example, using the aboveparamodulation-based approach, the size of the amplificationA5 depends onthe length of a resolution-paramodulation proof5. It is not clear how thisdepends on the size of a minimal amplificationT of S such thatT is rigidlyunsatisfiable.

In general, given a rigid theorem proving methodM and a setS of clauses,let AmpM(S) be the number of clauses in the smallest amplificationT of S

such that the unsatisfiability ofT can be demonstrated by methodM. Thequestion we would like to propose is how the quantitiesAmpM(S) relate to oneanother for various methodsM. For example, we can letM1 be unrestrictedsimultaneous rigidE-unification; thusAmpM1(S) is the number of clauses inthe smallestT such thatT is rigidly Eq-unsatisfiable, that is, there is a2 suchthatT 2 is Eq-unsatisfiable. We can letM2 be path paramodulation. Note thatthis reduces to rigid completion in the pure equational case. We can letM3 beresolution on the equality transformation of Brand [Bra75]. (Note that this isnot the same as the equality translation used earlier, which involves the newfunction symbolsfP .) This method converts a setS of clauses to a setS ′ suchthat S ′ ∪ {x = x} is unsatisfiable (without the equality axioms) iffS is Eq-unsatisfiable. ThenAmpM3(S) is the size of the minimalT such thatT is anamplification ofS ′ ∪ {x = x} andT is rigidly unsatisfiable. Also, we can letM4 be rigid clause paramodulation, andM5 be modified path paramodulation(in which parents of paramodulations are not deleted).

The question we would like to study is the relationships betweenAmpMi(S)

for i = 1, 2, 3, 4, 5. In particular, is there a recursive functionfij such thatAmpMi

(S) ≤ fij (St (S), AmpMj(S)) for all S? Can one give a better bound on

fij , such as exponential? Let us call a functionf an ij -bounding functionifAmpMi

(S) ≤ fij (St (S), AmpMj(S)) for all S. We note that if no recursiveij -

bounding function exists, then for some setsS of clauses, methodMi will requiremuch larger amplifications than methodMj . If such a recursiveij -bounding

Page 42: Special Cases and Substitutes for Rigid E-Unification

138 D. A. Plaisted

function exists, and especially if it is small, this means that methodMi neverrequires many more copies of clauses than methodMj . Either conclusion wouldbe very interesting, we feel.

For somei andj , this question is easily settled. For example, the functionf (x, y) = y is anii-bounding function for alli. It is also fairly straightforwardto show thatf (x, y) = y is an 1i-bounding function, sinceM1 gives thesmallest amplifications of any method. Since Brand’s transformation simulatesparamodulation, and path paramodulation uses an amplification whose numberof clauses is bounded by the size of a paramodulation proof, it may be possiblewithout much work to find a recursive 23-bounding function. We have workedsome on the 31 and 21-bounding functions, but the 32-case is also unknown.Results of Voda and Komara [VK96] seem to suggest that there are no recursivei1-bounding functions fori 6= 1.

The systemsM2 andM4 are closely related. We note that using proof trees,we can get an exponential relation between amplifications for path paramod-ulation and rigid clause paramodulation. Path paramodulation will never needmore clauses than are needed for a (rigid) resolution-paramodulation prooftree. Also, any rigid resolution-paramodulation proof can be converted to aproof tree with at most an exponential increase in the number of inferences.Thus we obtain that there is a recursive 24-bounding function, in fact, there isan exponential 24-bounding function. We do not know if there is a recursive42-bounding function.

We can also study this question for specializedS, for example, whenS isa set of unit equations and unit inequations. In this case,M5 is similar to rigidcompletion, that is,M4. Rigid completion can be regarded as a sequence ofground completions, and in between there are critical substitutions (unifications)applied toS that eliminate a variable. The ground completions do not generatenew instances of the input clauses, and the critical pair operations merely applya substitution to the entire clause set. Therefore, we never increase the size ofthe amplification. It follows by theorem 3.20 that ifS2 is a set of equations andinequations that is ground andEq-unsatisfiable, thenM4 andM5 can generate aproof of unsatisfiability fromS. Thus one only needs to consider amplificationshaving a number of clauses equal to the number of clauses inS. Thusf41(x, y) =y andf51(x, y) = y in this special case.

Despite a lot of work trying to resolve some of the remaining cases oneway or the other, we have not been able to. We invite others to attempt theremaining cases. This is not only of interest theoretically, but has implicationsfor the comparative efficiencies of various approaches to theorem proving withequality. One might think that the recent discovery that simultaneous rigidE-unification is undecidable would have implications for this question con-cerning the functionsfij , but it does not seem to directly answer the questions.Another related question is how the existence of interpolation tests influencesbounds on the sizes of thefij .

Page 43: Special Cases and Substitutes for Rigid E-Unification

Special Cases and Substitutes for RigidE-Unification 139

8 A New Undecidability Proof

A number of undecidability proofs for simultaneous rigidE-unification haverecently been given, including [DV95b]. We present another one, which wefeel is interesting because it is based on Post’s Correspondence Problem andalso because it has a bearing on the existence of interpolation tests. In addition,this test has the feature that all of the (positive) equations used are groundequations. The construction can easily be modified (and possibly simplified)to give a direct reduction from Turing machines, as well. We consider setsof clauses that correspond to such hard instances of the simultaneous rigidE-unification problem, and find that for these clause sets, small2 always existwhen a larger amplification is taken.

8.1 Expressing Finite Automata and Regular Sets

We begin by giving some simple rigidE-unification problems to illustrate thetechniques involved. For these constructions, we represent lists [a, b, c, a] using“cons” bycons(a, cons(b, cons(c, cons(a, NIL)))), as is standard. HereNIL

represents the empty list, and from now on we use [] for this instead ofNIL. Inthis section, we uses, s0, . . . , sn, andt, t0, . . . , tn for unspecified ground termsor constant symbols. Consider this rigidE-unification problem:

cons(c, []) = [] ∧ cons(d, []) = [] |= x = []

The solutions are substitutions2 bindingx to lists of the constantsc andd, thatis, lists such ascons(c, cons(d, cons(d, []))). We can also give a simultaneousrigid E-unification probem whose solutions2 bind x to non-empty lists ofthe constantsc andd. This consists of the above rigidE-unification problemtogether with the following:

cons(c, []) = s ∧ cons(d, []) = s ∧ cons(c, s)

= s ∧ cons(d, s) = s |= x = s

Definition 8.1 If X is a language over some finite alphabetT , whereT is afinite set of ground terms, thenListX is the set of lists [a1, a2, . . . , an] such thatthe stringa1a2 . . . an ∈ X.

We recall also thatT ∗ is the set of stringsa1a2 . . . an such thatai ∈ T forall i, andT + is the set of non-empty strings inT ∗.

Theorem 8.2 SupposeT is an arbitrary finite set of ground terms. Then there isa seteqT of ground equations such that2 is a solution to the rigidE-unificationproblem

eqT |= x = []

iff x2 is in ListT ∗ .

Page 44: Special Cases and Substitutes for Rigid E-Unification

140 D. A. Plaisted

Proof. LetT = {t1, t2, . . . , tn}, where theti are ground terms distinct from [] andnot containing the symbol “cons.” Consider the following rigidE-unificationproblem:

cons(t1, []) = [] ∧ cons(t2, []) = [] ∧ · · · ∧ cons(tn, []) = [] |= x = []

This problem then has solutions that bindx to lists of elements ofT . �

Theorem 8.3 SupposeT is an arbitrary finite set of ground terms. Then thereis a constant symbols (not inT ) and a seteqT,s of ground equations such thata substitution2 is a solution to the simultaneous rigidE-unification problem

eqT |= x = []

eqT,s |= x = s

iff x2 is in ListT + .

Proof. Let T = {t1, t2, . . . , tn} where theti are ground terms. Consider thefollowing rigid E-unification problemeqT,s |= x = s:

cons(t1, []) = s ∧ cons(t2, []) = s ∧ · · · ∧ cons(tn, []) = s∧

cons(t1, s) = s ∧ cons(t2, s) = s ∧ · · · ∧ cons(tn, s) = s |= x = s

This problem, together witheqT |= x = [], has solutions that bindx to non-empty lists of elements ofT . �

We can express relations that must hold between adjacent elements in a list.For example, to express that the constantsc andd must alternate in a list, wehave the simultaneous rigidE-unification problem

cons(c, []) = [] ∧ cons(d, []) = [] |= x = []

cons(c, []) = s1 ∧ cons(d, []) = s2 ∧ cons(c, s2) = s1 ∧ cons(d, s1)

= s2 ∧ g(s1) = c ∧ g(s2) = c |= g(x) = c

We can think ofs1 ands2 as states of a finite automaton traversing the list. Ingeneral, we can express regular sets in this way. In this example, boths1 ands2 would be accepting states. In general, since there may be more than oneaccepting states1 . . . sn, we need to express disjunctions of equalities such asx = s1 ∨ · · · ∨ x = sn where thesi are constants (or terms). We can expressthatx is eithers1 or . . . orsn by the rigidE-unification problem

g(s1) = c ∧ · · · ∧ g(sn) = c |= g(x) = c

whereg is a new function symbol.

Page 45: Special Cases and Substitutes for Rigid E-Unification

Special Cases and Substitutes for RigidE-Unification 141

Definition 8.4 If A is a finite automaton with input alphabetT , whereT is afinite set of ground terms, thenL(A) is the set of stringsa1 . . . an in T ∗ suchthatA acceptsan . . . a1.

Theorem 8.5 Suppose thatA is a deterministic finite automaton. Then there isa function symbolg, a constant symbolc, and a seteqA,g,c of ground equationssuch that2 is a solution to the simultaneous rigidE-unification problem

eqT |= x = []

eqA,g,c |= g(x) = c

iff x2 is an element ofListL(A).

Proof. Suppose thatA is a deterministic finite automaton with start states0,set of states{s0, s1 . . . sn}, input alphabetT , and accepting states{s1 . . . sp}. LetFA(a, s) for s in {s0, . . . , sn} anda in T be the next-state function forA whenreadinga in states. Consider the following simultaneous rigidE-unificationproblem:

eqT |= x = []

[] = s0 ∧ (∧s∈{s0...sn},a∈T (cons(a, s) = FA(a, s)))

∧(∧s∈s1...spg(s) = c) |= g(x) = c

The solutions will bindx to lists [a1, a2, . . . , an] such thatT accepts the stringanan−1 . . . a1. �

We note that ifA has only one accepting state, then there is a simultaneousproblem of the form

eqT |= x = []

eqA,c |= x = c

that has solutions that bindx to elements ofListL(A).

8.2 Lists of Lists

For our construction, we will need two levels of lists, that is, simple lists andlists of lists. A list of lists is of the form [list1, list2, . . . , listn] where eachlisti is a simple list, that is, a list of elements from an arbitrary finite alpha-bet T . Simple lists will be terminated by [], but we will use []′ to signify theend of a list of lists. Thus a list of lists is represented by a term of the formcons(list1, cons(list2, . . . , cons(listn, [] ′) . . .)). The reasons for this will be-come clearer later.

Page 46: Special Cases and Substitutes for Rigid E-Unification

142 D. A. Plaisted

Definition 8.6 If X is a set of strings over the finite alphabetT , whereT is afinite set of ground terms, thenLListX is the set of lists of lists of the form[list1, list2, . . . , listn] where eachlisti is in ListX.

We can give a rigidE-unification problem whose solutions are inLListT + ,that is, the solutions bindx to lists of the form [list1, list2, . . . , listn] whereeachlisti is a non-empty list of elements of an arbitrary finite setT of groundterms. This can be done by the simultaneous rigidE-unification problem

eqT ∧ cons([] , [] ′) = [] ′ |= x = [] ′

eqT,s ∧ cons(s, [] ′) = [] ′ |= x = [] ′

whereeqT andeqT,s are as defined above. We can also express membership inLListL(A) for a finite automatonA.

Theorem 8.7 SupposeA is a finite automata whose alphabet is a (finite) setT

of ground terms and such thatA does not accept the empty word. Then there isa seteq of ground equations and a constant symbolc′ such that a substitution2 is a solution to the simultaneous rigidE-unification problem

eqT ∧ cons([] , [] ′) = [] ′ |= L = [] ′

eq |= L = c′

iff L2 is a non-empty element ofLListL(A).

Proof. Let SA be the states ofA. Let S ′A be the accepting states ofA. Supposes0 is the start state ofA. Then we have the following simultaneous problem:

(∧a∈T (cons(a, []) = []) ∧ cons([] , [] ′) = [] ′ |= L = [] ′

[] = s0 ∧ (∧s∈SA,a∈T (cons(a, s) = FA(a, s)))∧

(∧s∈S ′Acons(s, [] ′) = c′) ∧ (∧s∈S ′Acons(s, c′) = c′) |= L = c′

The first problem constrainsL to be a list of elementslisti in which eachlistiis a list of elements ofT . Consider a list of lists of the form [list1, list2, list3]where listi are in ListL(A). Then using the equations []= s0∧ (∧s∈SA,a∈T(cons(a, s) = FA(a, s))), we equate this list to [s1, s2, s3], wheresi are accept-ing states ofSA. Then using the equations∧s∈SA

cons(s, [] ′) = c′, this equalscons(s1, cons(s2, c

′)). Finally, two applications of the equations∧s∈S ′Acons(s,

c′) = c′ equate the entire list toc′. The same argument works in general for a

Page 47: Special Cases and Substitutes for Rigid E-Unification

Special Cases and Substitutes for RigidE-Unification 143

list [list1, . . . , listn] in LListL(A1). Conversely, one shows that any solution tothe above rigidE-unification problem must be of this form. �

We can express the fact thatZ is the first element of a list (of lists)L by theequationcons(Z, L1) = L. We can also express the fact that the last element ofa list of listsL is inListL(A2) and the remaining elements ofL are inListL(A1),whereAi are finite automata.

Definition 8.8 If X andY are two sets of strings over finite alphabets of groundterms, thenLListX,Y is the set of lists of the form [list1, list2,. . . ,listm] wherelistm ∈ ListY andlisti ∈ ListX for 1≤ i < m.

Theorem 8.9 SupposeA1 andA2 are two finite automata whose alphabets are( finite) sets of ground terms and such that neitherAi accepts the empty word.Then there is a seteq of ground equations and a constant symbolc′ such thata substitution2 is a solution to the simultaneous rigidE-unification problem

eqT ∧ cons([] , [] ′) = [] ′ |= L = [] ′

eq |= L = c′

iff L2 is an element ofLListL(A1),L(A2).

Proof. For this, we letA be a product automaton, that is,A simulatesA1 andA2 simultaneously, and the states ofA are pairs of states fromA1 andA2. LetT be the union of the alphabets ofA1 andA2 and letSA be the states ofA. LetSA,1 be the states ofA that correspond to acceptance byA1, and letSA,2 be thestates ofA that correspond to acceptance byA2. That is, if we makeSA,1 theaccepting states ofA, A is equivalent toA1, and if we makeSA,2 the acceptingstates ofA, A is equivalent toA2. Supposes0 is the start state ofA. Then wehave the following simultaneous problem:

(∧a∈T (cons(a, []) = []) ∧ cons([] , [] ′) = [] ′ |= L = [] ′

[] = s0 ∧ (∧s∈SA,a∈T (cons(a, s) = FA(a, s)))∧

(∧s∈SA,2cons(s, [] ′) = c′) ∧ ∧s∈SA,1cons(s, c′) = c′) |= L = c′

The first problem constrainsL to be a list of elementslisti in which eachlisti is alist of elements ofT . Consider a list of lists of the form [list1, list2, list3] wherelist1 andlist2 are inListL(A2) andlist3 is inListL(A1). Then using the equations[] = s0∧ (∧s∈SA,a∈T (cons(a, s) = FA(a, s))), we equate this list to [s1, s2, s3],wheres1 ands2 are states ofSA,1 ands3 is an accepting state ofSA,2. Thenusing the equations∧s∈SA,2cons(s, [] ′) = c′, this equalscons(s1, cons(s2, c

′)).Finally, two applications of the equations∧s∈SA,1cons(s, c′) = c′ equate the

Page 48: Special Cases and Substitutes for Rigid E-Unification

144 D. A. Plaisted

entire list toc′. The same argument works in general for a list [list1, . . . , listn]in LListL(A1),L(A2). Conversely, one shows that any solution to the above rigidE-unification problem must be of this form. �

We can also extend this to three automata, as follows:

Definition 8.10 If X, Y , andZ are three sets of strings over finite alphabets ofground terms, thenLListX,Y,Z is the set of lists of the form [list1, list2,. . . ,listm]wherem ≥ 2, listm ∈ ListZ, listi ∈ ListY for 1 < i < m, andlist1 ∈ ListX.

Theorem 8.11 SupposeA1, A2, andA3 are three finite automata whose alpha-bets are( finite) sets of ground terms and such that none of theAi accepts theempty word. Then there is a seteq of ground equations and a constant symbolc′

such that a substitution2 is a solution to the simultaneous rigidE-unificationproblem

eqT ∧ cons([] , [] ′) = [] ′ |= L = [] ′

eq |= L = c′

iff L2 is an element ofLListL(A1),L(A2),L(A3).

Proof. A fairly straightforward extension of the construction in theorem 8.9.�

8.3 Pairing Lists

We also need a way to pair lists up to specify how a list can be modified by a se-quence of operations. For this we need some definitions. Recall that [t1, . . . , tn]is an abbreviation for the termcons(t1, cons(t2, . . . , cons(tn, []) . . .)).

Definition 8.12 Let u1 . . . un be ground terms. Suppose thatM is a list of theform [f (t1, u1), . . . , f (tn, un)] andL1 is the list [t1, . . . , tn]. Then we callL1

the 1-projectionof M. We call the listL2 = [u1 . . . un] the 2-projectionofM. We call M a pairing of L1 andL2. Thus [a, b, a] is the 1-projection of[f (a, c), f (b, d), f (a, d)] and [c, d, d] is the 2-projection of this list. Also,the list [f (a, c), f (b, d), f (a, d)] is a pairing of [a, b, a] and [c, d, d].

If T1 andT2 are arbitrary finite sets of ground terms andf is a binary functionsymbol, letf (T1, T2) be the set of termsf (x, y) for x ∈ T1 andy ∈ T2. We canexpress the fact thatM is a list of elements off (T1, T2) andL is the 1-projectionof M by the simultaneous problem

eqT1 |= L = []eqf (T1,T2) |= M = []

∧x∈T1,y∈T2f (x, y) = x |= M = L

Page 49: Special Cases and Substitutes for Rigid E-Unification

Special Cases and Substitutes for RigidE-Unification 145

We can express the fact thatL is the 2-projection ofM by the simultaneousproblem

eqT1 |= L = []eqf (T1,T2) |= M = []

∧x∈T1,y∈T2f (x, y) = y |= M = L

Definition 8.13 We say that the list of listsLp is ashifted pairingof the list oflistsL if Lp is of the form [M1, M2, . . . , Mm] where theMi are lists of elementsof f (T , T ), the list of listsL is of the form [list1, . . . , listm], the listslisti arelists of elements ofT , andM1 is a pairing oflist1 and list2, M2 is a pairingof list2 andlist3, . . . , andMm is a pairing oflistm and some list of the form[#, #, . . . , #].

As an example, the list of listsLp = [[f (a, b), f (b, c)], [f (b, a), f (c, d)],[f (a, #), f (d, #)]] is a shifted pairing of the list of listsL = [[a, b], [b, c],[a, d]]. Thus the elements ofLp are a pairing of [a, b] and [b, c], a pairing of[b, c] and [a, d], and a pairing of [a, d] and [#, #], respectively.

Theorem 8.14 Suppose thatT is a set of ground terms and# is a constantsymbol not inT . Then there is a simultaneous rigidE-unification problem suchthat2 is a solution to the problem iffL2 is a list of lists of elements ofT andLp2 is a shifted pairing ofL2.

Proof. Consider the following simultaneous problem:

eqT ∧ cons([] , [] ′) = [] ′ |= L = [] ′

eqf (T ,T∪{#}) ∧ cons([] , [] ′) = [] ′ |= Lp = [] ′

∧x∈T ,y∈T∪{#}f (x, y) = x |= Lp = L

cons([#], [] ′) = [] ′ ∧ cons(#, cons(#, [])) = cons(#, [])∧(∧x∈T ,y∈T∪{#}f (x, y) = y) |= L = cons(Z, Lp)

The equationcons([#], [] ′) = [] ′means that any list of lists can be viewed as hav-ing an arbitrary number of lists of the form [#] on the end. Thus [list1, . . . , listm]= [list1, . . . , listm, [#], . . . , [#]]. The equation cons(#, cons(#, [])) =cons(#, []) means that any one of these lists [#] can be expanded to includean arbitrary number of occurrences of #, that is, can be expanded to a list of theform [#, #, . . . , #]. That is, [#]= [#, #, . . . , #].

The first (simple) rigidE-unification problem given expresses the fact thatL is a list of lists of elements ofT . The second problem expresses the fact thatLp is a list of lists of elements off (T , T ∪ {#}). The third problem expressesthe fact that elements ofL are 1-projections of corresponding elements ofLp.The fourth problem expresses the fact that elements ofL are 2-projections ofpreceding elements ofLp. Together this implies thatLp is a shifted pairing ofL. We can also show that any solution of this simultaneous problem will beof this form. �

Page 50: Special Cases and Substitutes for Rigid E-Unification

146 D. A. Plaisted

8.4 Expressing PCP as a Regular Set

With this machinery, we can express Post’s Correspondence Problem (PCP).An instance of PCP is two sequencesα1 . . . αn andβ1 . . . βn of strings over afinite alphabet6. A solution to this instance of PCP is a sequencei1 . . . ik ofintegers such thatαi1 . . . αik = βi1 . . . βik . It is known to be undecidable whetheran instance of PCP has a solution.

We construct a regular setR from a PCP instance such that this PCP instanceis solvable iff there is a stringy in R having a certain property, which we will callindex consistency. Using this regular setR, we express the Post CorrespondenceProblem as a simultaneous rigidE-unification problem that has a solution iffthe instance of PCP is solvable. We represent a solution to this instance of PCPas a list of listsL = [list1, . . . , listm], wherelistm is a string inR and the indexconsistency oflistm is checked using the other listslisti . We represent a stringas before by a list of constants, so the stringabca would be represented by thelist [a, b, c, a], that is,cons(a, cons(b, cons(c, cons(a, [])))).

Definition 8.15 Consider an instance of the PCP as given above. Let01 be theset of indicesa′j for 1≤ j ≤ n, and let02 be the set of indicesb′j for 1≤ j ≤ n.Let 0 be01 ∪ 02. Let α′i be the regular set consisting of strings obtained fromαi by inserting arbitrary occurrences of the indicesb′j at arbitrary places. Thusif αi is c1c2 . . . cm, thenα′i is 0∗2c10

∗2c2 . . . 0∗2cm0∗2. Let β ′i be the regular set

consisting of strings obtained from theβi by inserting arbitrary occurrences ofthe indicesa′j at arbitrary places. The regular setR is the intersection of thetwo regular sets(α′1a

′1+ · · · + α′na

′n)∗0∗2 and(β ′1b

′1+ · · · + β ′nb

′n)∗0∗1.

Since the intersection of two regular sets is a regular set,R is a regularset. Note thatR is a subset of(6 ∪ 0)∗. Recall that a solution to this instanceof PCP is a string that can be written either asαi1 . . . αik or asβi1 . . . βik . Theintuitive idea ofR is to represent the solution as the stringαi1 . . . αik with the newconstantsa′i1 . . . a′ik inserted after the stringsαi1 . . . αik , respectively, and withthe new constantsb′i1 . . . b′ik inserted after the stringsβi1 . . . βik , respectively.

Definition 8.16 Theα-index traceof a stringc1c2 . . . cn is the stringφ(c1)φ(c2)

. . . φ(cn), whereφ maps the indicesa′j ontoj and other elements of6 ∪0 aremapped onto the empty string. Thus theα-index trace of a string is a list of inte-gers. Theβ-index traceof a stringc1c2 . . . cn is the stringφ(c1)φ(c2) . . . φ(cn),whereφ maps the indicesb′j ontoj and other elements of6 ∪ 0 are mappedonto the empty string. A stringγ in (6 ∪ 0)∗ is index consistentif its α-indextrace is identical to itsβ-index trace.

Thus the stringa′1a′2c3b

′1c4b

′2 is index consistent, because itsα-index trace

is 1, 2 and itsβ-index trace is also 1, 2. However,a′1a′2c3b

′1c4b

′1 is not index

consistent, because itsα-index trace is 1, 2 and itsβ-index trace is 1, 1.

Theorem 8.17 The given instance of PCP has a solution iff there is a nonemptystringy in R such thaty is index consistent.

Page 51: Special Cases and Substitutes for Rigid E-Unification

Special Cases and Substitutes for RigidE-Unification 147

Proof. If such any exists, then we can determine the stringsαi of a PCP solutionusing thea-indices and we can determine the stringsβi of a PCP solution usingtheb-indices. Thus we can obtain a solution to the PCP instance. Conversely,if the PCP instance is solvable, we can take a solutionαi1 . . . αik = βi1 . . . βik

and inserta andb-indices to obtain an element ofR that is index consistent.�

8.5 Expressing PCP as a List of Lists

Let A1 be a finite automaton accepting(6 ∪ 0)∗. SinceR is a regular set,it can be expressed as the set of strings accepted by a finite automatonA2.Therefore, it is possible to expressListL(A2) using a rigidE-unification problemas mentioned earlier. We can then express the fact thatL is in LListL(A1),L(A2)

by a simultaneous rigidE-unification problem, by theorem 8.9 above. Whatcannot easily be expressed is the fact thatlistm is index consistent. To expressthis, we need to constrain the other elementslist1, . . . , listm−1 of the listL ina manner which we now explain.

Definition 8.18 We say that a stringγ2 is a legal transpositionof γ1 if γ2 isobtained fromγ1 by exchanging two adjacent symbols, at least one of which isan element of0. However, we do not permit two indices of the same type to bepermuted. That is, we do not permute two elements of01 or two elements of02. Thus the stringc1a

′1c2b

′2 is a legal transposition of the stringc1c2a

′1b′2, but

the stringc1a′1a′2c2 is not a legal transposition of the stringc1a

′2a′1c2, since that

involves an exchange two indices of the same type (a-indices).

Note that ifγ2 is a legal transposition ofγ1, thenγ1 andγ2 have the sameα-index trace and the sameβ-index trace.

Definition 8.19 A string γ is asimple correspondenceif every occurrence ofa′i is immediately followed byb′i and every occurrence ofb′i is immediatelypreceded bya′i .

Note that the set of simple correspondences is a regular set. Also, all simplecorrespondences are index consistent.

Definition 8.20 A transposition historyis a listLp of the form [list1, list2, . . . ,listm] wherelistm is an element ofR, eachlisti is a legal transposition oflisti+1,andlist1 is a simple correspondence.

Note that ifLp is a transposition history, then all the listslisti have thesameα-index trace and the sameβ-index trace.

Theorem 8.21 The given PCP instance is solvable iff a legal transpositionhistoryLp exists.

Page 52: Special Cases and Substitutes for Rigid E-Unification

148 D. A. Plaisted

Proof. If the PCP instance is solvable, then we can chooselistm as an element ofR that is index consistent. By a sequence of legal transpositions, we can obtainlist1 that is a simple correspondence. Conversely, if there is a transpositionhistory, thenlistm is an element ofR that is index consistent, hence the PCPinstance is solvable. �

Theorem 8.22 There is a finite automataA such that for any listslist1 andlist2 of elements of6 ∪ 0, lists list1 andlist2 are legal transpositions of eachother iffA acceptslist3, wherelist3 is a pairing oflist1 andlist2.

Proof. The listlist3 can only be of the form

[f (a1, a1), f (a2, a2), . . . , f (ai, ai+1), f (ai+1, ai), . . . , f (an, an)]

whereai andai+1 are elements of6 ∪ 0 that are not both in01 or both in02.This can easily be checked by a finite automaton (with one accepting state).

We recall here by theorem 8.14 above that there is a simultaneous rigidE-unification problem whose solutions are listsL andLp such thatLp is ashifted pairing ofL. In fact, we can find such a problem of the form

E1 |= L = [] ′

E2 |= Lp = [] ′

E3 |= Lp = L

E4 |= L = cons(Z, Lp),

by theorem 8.14.What remains is to find a way to constrain the listslisti to be obtained

by permutations in this manner fromlisti+1. For this we use the list pairingmechanism developed above.

Theorem 8.23 There is a rigidE-unification problem whose solutions consistof the listsL andLp such thatL is a transposition history for the given PCPinstance andLp is a shifted pairing ofL.

Proof. We just showed (recalled) how to express the fact thatLp is a shiftedpairing ofL. What remains is to express the fact that adjacent elements ofL areobtained by legal transpositions. By theorem 8.22, there is a finite automatonA

to check if each element ofLp is a pairing of two lists that are legal transpositionsof each other. We have to modify this automatonA to also accept lists of theform [f (a1, #), f (a2, #), . . . , f (an, #)] for ai in 6∪0, since the last element ofLp will be of this form. By theorem 8.7, there is a rigidE-unification problem

E2 |= Lp = [] ′

E5 |= Lp = c′

expressing membership inLListL(A), whereE2 is as above. Therefore weobtain a simultaneous problem of the form

Page 53: Special Cases and Substitutes for Rigid E-Unification

Special Cases and Substitutes for RigidE-Unification 149

E1 |= L = [] ′

E2 |= Lp = [] ′

E3 |= Lp = L

E4 |= L = cons(Z, Lp)

E5 |= Lp = c′

which expresses the fact thatLp is a shifted pairing ofL and that adjacent el-ements ofL are legal transpositions. The only parts that remain are to check thatthe first element ofL is a simple correspondence and that the lastelement ofL is an element ofR. This is equivalent to checking thatL is inLListL(A1),L(A2),L(A3) whereAi are finite automata andA1 checks for simplecorrespondences,A2 accepts anything, andA3 checks for membership inR. Bytheorem 8.11, this can be checked by the problemE1 |= L = [] ′ above togetherwith a problem of the form

E6 |= L = c′′.

These six problems together then satisfy the conditions of the theorem.�

Corollary 8.24 The given simultaneous rigidE-unification problem is solv-able iff the PCP instance is solvable. Therefore,simultaneous rigidE-unificationis undecidable.

We note here that we could just as easily specify thatlisti of L be obtainedfrom listi+1 by one step of a Turing computation, since this can also be checkedby a finite automaton, and thus obtain a simple reduction directly from Turingmachines. This Turing construction might be interesting, because it might leadto a smaller undecidable subclass of simultaneous rigidE-unification.

8.6 The Final Simultaneous Problem

Putting this all together, we obtain a simultaneous problem of the followingform:

(∃L, Z, Lp) [E1 |= L = [] ′ (alphabet ofL)∧E2 |= Lp = [] ′ (alphabet ofLp)∧E3 |= Lp = L (first element of pairs inLp)∧E4 |= L = cons(Z, Lp) (second element of pairs inLp)∧E5 |= Lp = c′ (checkLp that successive elements of

L are obtained by legal transpositions)∧E6 |= L = c′′] (first element ofL has indices

matching, last element ofL is in R)

This corresponds to the following set of clauses:

Page 54: Special Cases and Substitutes for Rigid E-Unification

150 D. A. Plaisted

¬p1(L, Z, Lp) ∨ L 6= [] ′

¬p1(L, Z, Lp) ∨ E1

¬p2(L, Z, Lp) ∨ Lp 6= [] ′

¬p2(L, Z, Lp) ∨ E2

¬p3(L, Z, Lp) ∨ Lp 6= L

¬p3(L, Z, Lp) ∨ E3

¬p4(L, Z, Lp) ∨ L 6= cons(Z, Lp)

¬p4(L, Z, Lp) ∨ E4

¬p5(L, Z, Lp) ∨ Lp 6= c′

¬p5(L, Z, Lp) ∨ E5

¬p6(L, Z, Lp) ∨ L 6= c′′

¬p6(L, Z, Lp) ∨ E6p1(L, Z, Lp) ∨ p2(L, Z, Lp) ∨ p3(L, Z, Lp) ∨ p4(L, Z, Lp) ∨

p5(L, Z, Lp) ∨ p6(L, Z, Lp)

We use¬p1(L, Z, Lp) ∨ E1 to abbreviate the set of clauses of the form¬p1(L, Z, Lp) ∨ e for e in E1, and similarly for the other sets of equa-tions. For a spanning set of these clauses, we can take the equational sets(L 6= [] ′, E1), (Lp 6= [] ′, E2), . . . , (L 6= c′′, E6) together with the pairs of lit-erals{¬pi(L, Z, Lp), pi(L, Z, Lp)}. This is a spanning set because if a pathdoes not include any of the equational sets, then it must include all the¬pi

literals (at least one of each) and it also must contain somepj literal from thebottom clause, leading to a contradiction. Unifying on the setspi and¬pi bindsall the variables, whence we obtain the simultaneous problem above.

This implies the known result that the following problem is undecidable:Given a setS of clauses, is there a substitution2such thatS2 isEq-unsatisfiable.For a proof, consider the above set of clauses. ThenS2 is Eq-unsatisfiable iffthe PCP instance has a solution. We note that the equations appearing in eachseparate rigid unification problem are ground equations.

We note that this set of clauses is splittable. This implies that there is aninterpolation test of fairly low complexity which can substitute for simultane-ous rigidE-unification in this case. Thus the relevance of the undecidability ofsimultaneous rigidE-unification to theorem proving is still unclear. However,some results of Voda and Komara [VK96] may be relevant here. He shows thatby considering larger amplifications, one cannot always remove the undecid-ability property.

9 Conclusion

Despite the undecidability of simultaneous rigidE-unification, we have shownthat in many common special cases of interest, decidable alternatives exist, andsome of these have a complexity essentially the same as that of simple rigidE-unification. We have also presented some fully general alternatives that canbe substituted for simultaneous rigidE-unification, and have analyzed their

Page 55: Special Cases and Substitutes for Rigid E-Unification

Special Cases and Substitutes for RigidE-Unification 151

complexity to some extent. Finally, we presented a new proof of undecidabilityfor the simultaneous problem. This proof is based on a reduction from the PostCorrespondence Problem, and has the interesting feature that all of the positiveequations used are ground equations in the instances constructed. This showsthat simultaneous rigidE-unification is still undecidable when all the positiveequations used are ground equations, a fairly restrictive special case. A numberof open problems and directions for future research are also given. In general,we feel that the analysis of the complexity of theorem proving procedures is achallenging research area, besides giving insight into the behavior and utilityof various approaches to theorem proving.

Acknowledgments.I would like to thank A. Degtyarev and A. Voronkov for their commentson preliminary versions of this paper, especially the undecidability proof. I would also like tothank Sergei Vorobyov for his detailed comments on some of the early sections of the paper, andUwe Waldmann for his detailed reading as well. The comments of two anonymous referees weretremendously helpful in correcting mistakes. Of course, remaining errors are solely my respon-sibility. This research was partially supported by the National Science Foundation under grantCCR-9108904. The author also gratefully acknowledges the support of Max-Planck Institute,Saarbrucken during the summer of 1995.

References

[And81] P. B. Andrews: Theorem proving via general matings. J. Associ. Comput. Machinery28, 193–214 (1981)

[Bau92] P. Baumgartner: An ordered theory resolution calculus. In: A. Voronkov, (ed) LogicProgramming and Automated Reasoning (LPAR’92), p 119–130, 1992. Vol. 624 ofLecture Notes in Computer Science. Berlin Heidelberg New York: Springer 1992

[BDP89] L. Bachmair, N. Dershowitz, D. Plaisted: Completion without failure. In: HassanAit-Kaci and Maurice Nivat (eds.) Resolution of Equations in Algebraic Structures2: Rewriting Techniques, p 1–30, New York: Academic Press 1989

[Bec94] B. Beckert: A completion-based method for mixed universal and rigidE-unification.In: A. Bundy, editor, Automated Deduction — CADE-12. 12th International Con-ference on Automated Deduction., p 678–692, Nancy, France, June/July 1994. Vol.814 of Lecture Notes in Artificial Intelligence

[BGLS95] L. Bachmair, H. Ganzinger, C. Lynch, W. Snyder: Basic paramodulation. Info.Comput.121(2), 172–192 (1995)

[Bib87] W. Bibel: Automated Theorem Proving. Second edition Braunschweig/Wiesbaden:Vieweg 1987.

[Bra75] D. Brand: Proving theorems with the modification method. SIAM J. Comput.4,412–430 (1975)

[DV95a] A. Degtyarev, A. Voronkov: General connections via equality elimination. UPMAILTechnical Report 93, Uppsala University, Computing Science Department, January1995

[DV95b] A. Degtyarev, A. Voronkov: Reduction of second-order unification to simultaneousrigid E-unification. UPMAIL Technical Report 109, Uppsala University, ComputingScience Department, June 1995. To appear in Proc. CSL’95

[DV95c] A. Degtyarev, A. Voronkov: Simultaneous rigidE-unification is undecidable. UP-MAIL Technical Report 105, Uppsala University, Computing Science Department,May 1995

Page 56: Special Cases and Substitutes for Rigid E-Unification

152 D. A. Plaisted

[Fit88] M. Fitting: First-order modal tableaux. J. Automated Reasoning4, 191–213 (1988)[GNPS90] J. Gallier, P. Narendran, D. Plaisted, W. Snyder: RigidE-unification is NP-complete.

Info. Comput.87(1/2) 129–195 (1990) Special issue devoted to LICS ’88[GNRS92] J. Gallier, P. Narendran, S. Raatz, W. Snyder: Theorem proving using equational

matings and rigid E-unification. J. ACM39(2), 377–429 (1992)[Gou93] J. Goubault: A rule-based algorithm for rigidE-unification. In: Georg Gottlob,

Alexander Leitsch, Daniele Mundici (eds.) Computational Logic and Proof Theory.Proceedings of the Third Kurt Godel Colloquium, KGC’93, p 202–210. Brno, August1993. Vol. 713 of Lecture Notes in Computer Science. Berlin Heidelberg New York:Springer 1993

[Gou94] J. Goubault: RigidE-unifiability is DEXPTIME-complete. In: Proceedings of the9th Annual IEEE Symposium on Logic in Computer Science, pages 498–506, Paris,France, July 1994

[HR91] J. Hsiang, M. Rusinowitch: Proving refutational completeness of theorem-provingstrategies: the transfinite semantic tree method. J. Assoc. Comput. Mach.38(3),559–587 (1991)

[Koz81] D. Kozen: Positive first-order logic is NP-complete. IBM J. Res. Develop.25 (4),327–332 (1981)

[Pet94] U. Petermann: A complete connection calculus with rigidE-unification. In:JELIA’94, p 152–166, 1994. Vol. 838 of Lecture Notes in Computer Science.Berlin Heidelberg New York: Springer 1994

[Pla93] D. Plaisted: Polynomial time termination and constraint satisfaction tests. In: ClaudeKirchner (ed.) Fifth International Conference on Rewriting Techniques and Appli-cations, p 405–420, June 1993

[Pra60] D. Prawitz: An improved proof procedure. Theoria26, 102–139 (1960)[PSK95] D. Plaisted, A. Sattler-Klein: Proof lengths for equational completion. Technical Re-

port SEKI Report SR-95-06, University of Kaiserslautern, Kaiserslautern, Germany,1995

[Sny89] W. Snyder: Efficient ground completion: anO(nlogn) algorithm for generating re-duced sets of ground rewrite rules equivalent to a set of ground equations E. In:Proceedings of the 3rd International Conference on rewriting techniques and appli-cations, p 419–433, 1989. Lecture Notes in Computer Science, Vol. 355. BerlinHeidelberg New York: Springer 1989

[VK96] P.J. Voda, P. Komara: On herbrand skeletons. Technical report, Institute of Infor-matics, Comenius University, Bratislava, 1996