29
Journal (~f Automated Reasoning 5: 309-337, 1989. 309 ~(') 1989 Kluwer Academic Publishers. Printed #z the Netherlands. Horn Equational Theories and Paramodulation ULRICH FURBACH Forschungsgruppe lntellektik, TU Mibtchen, h~stitut fiir h~/ormatik, Post/ach 202420, D-8000 Miinchen 2, F.R,G. E-mail." uli(,a'tumki.it{formatik.tu-muenchen.de STEFFEN HOLLDOBLER and JOACHIM SCHREIBER Universitiit der Bundeswehr Mt?nchen, Fakultiit fi~r Informatik, Werner-Heisenberg-Weg 39, D-8014 Neubiber~. F.R.G. E-mail: steffen~i'tumki.informatik.tu-muenchen.de (Received: 4 January 1988) Abstract, A language of equational programs together with an inference system, based on paramodulation is defined. The semantics of the language is given with respect to least models, least fixpoints and success sets and its soundness and completeness is proven using fixpoint theory. The necessity of the functional reflexive axioms is investigated in detail. Finally, the application of these ideas to term rewriting systems is outlined by discussing directed paramodulation and narrowing. Key words. Horn clause logic, equational programs, paramodulation rule. 1. Introduction Robinson's pioneering work on mechanizing mathematical logic [35] has ahnost immediately raised the question "How can axioms of equaliO, be built into the deductive machhwry?" [36]. Early approaches have been based on adding to the resolution rule a special inference rule to cope with equality theories, for example demodulation [401 or the paramodulation rule [34, 39]. By that time the interest was focused on building refutation-complete inference systems for first-order theories, To ensure completeness of such systems factoring has to be included. At the same time one was looking for efficient refutation-strategies which are complete for a subclass of first order logic. Horn clause logic together with input or unit resolution offers this kind of calculus, and it is comparatively easy to implement such a restriction. Since the property of being Horn is decidable for finite sets of clauses, one has a sufficient and decidable criterion for the completeness of unit or input resolution. This viewpoint has changed with the advent of the logic programming paradigm. From there on the a priori restriction to Horn clause logic was more or less reasonable. For such a programming system the inference system together with its strategies could be tailored; therefore it was an obvious request to demonstrate that factoring is not needed with respect to completeness, E.g. Hill [18] showed this for LUSH-resolution (linear resolution with unrestricted selection function for Horn clauses), whereas Apt and van Emden [2] gave a proof of the completeness of SLD-resolution (linear resolution with selection function for definite clauses).

Horn equational theories and paramodulation

Embed Size (px)

Citation preview

Journal (~f Automated Reasoning 5: 309-337, 1989. 309 ~(') 1989 Kluwer Academic Publishers. Printed #z the Netherlands.

Horn Equational Theories and Paramodulation

U L R I C H F U R B A C H Forschungsgruppe lntellektik, TU Mibtchen, h~stitut fiir h~/ormatik, Post/ach 202420, D-8000 Miinchen 2, F.R,G. E-mail." uli(,a'tumki.it{formatik.tu-muenchen.de

S T E F F E N H O L L D O B L E R and J O A C H I M S C H R E I B E R Universitiit der Bundeswehr Mt?nchen, Fakultiit fi~r Informatik, Werner-Heisenberg-Weg 39, D-8014 Neubiber~. F.R.G. E-mail: steffen~i'tumki.informatik.tu-muenchen.de

(Received: 4 January 1988)

Abstract, A language of equational programs together with an inference system, based on paramodulation is defined. The semantics of the language is given with respect to least models, least fixpoints and success sets and its soundness and completeness is proven using fixpoint theory. The necessity of the functional reflexive axioms is investigated in detail. Finally, the application of these ideas to term rewriting systems is outlined by discussing directed paramodulation and narrowing.

Key words. Horn clause logic, equational programs, paramodulation rule.

1. Introduction

Robinson's pioneering work on mechanizing mathematical logic [35] has ahnost immediately raised the question "How can axioms of equali O, be built into the deductive machhwry?" [36]. Early approaches have been based on adding to the resolution rule a special inference rule to cope with equality theories, for example demodulation [401 or the paramodulation rule [34, 39]. By that time the interest was focused on building refutation-complete inference systems for first-order theories, To ensure completeness

of such systems factoring has to be included. At the same time one was looking for efficient refutation-strategies which are

complete for a subclass of first order logic. Horn clause logic together with input or unit resolution offers this kind of calculus, and it is comparatively easy to implement such a restriction. Since the property of being Horn is decidable for finite sets of clauses, one has a sufficient and decidable criterion for the completeness of unit or

input resolution. This viewpoint has changed with the advent of the logic programming paradigm.

From there on the a priori restriction to Horn clause logic was more or less reasonable. For such a programming system the inference system together with its strategies could be tailored; therefore it was an obvious request to demonstrate that factoring is not needed with respect to completeness, E.g. Hill [18] showed this for LUSH-resolution (linear resolution with unrestricted selection function for Horn clauses), whereas Apt and van Emden [2] gave a proof of the completeness of SLD-resolution (linear resolution with selection function for definite clauses).

310 ULRICH FURBACH ET AL.

Starting out from these results many people were convinced that extending these inference systems by the paramodulation rule to handle equality leaves completeness invariant. Indeed there does exist a proof in Henschen and Wos [16], demonstrating the completeness of input (and unit) resolution with paramodulation and factoring. But only recently one of the authors [8] has proved that for such a system factoring is not necessary. This was done by using a result from [16] and afterwards transform- ing each derivation using resolution, paramodulation, and factoring into a derivation where factoring is not employed. Hence the result obtained there is based on various papers from the theorem-proving literature, making it difficult to understand the overall idea of the proof. For example, it is impossible to see why the functional reflexive clauses have to be included without following the chain of references starting in [8].

In this paper we will present a direct proof for the completeness of paramodulation for Horn equality theories. The focus on a subset of Horn clause logic will give us the opportunity to present a formal proof using well-known techniques from logic programming [2, 6], which nevertheless gives the reader all ideas necessary to under- stand why it works. Of course, we assume the reader to be familiar with the textbook

[31]. This paper is organized such that in the following Section 2 some preliminaries

concerning terms, equations and substitutions are stated. Section 3 contains the main part, where we define Horn equational theories and prove that an inference system based on paramodulation is sound and complete. In Section 4 we comment on the application of our work to restricted classes of equational theories, e.g. ground

confluent theories and those which can be defined by conditional term rewriting systems.

2. Preliminaries

2.1. TERMS AND EQUATIONS

We consider an alphabet which contains disjoint and countably infinite sets of variables and graded function symbols. 0-ary function symbols are sometimes called constants. Without loss of generality we assume that there is at least one constant in

each alphabet. Terms are defined in the usual way. Let s and t be terms. Then s - t is said to be an equation with left-hand side s and right hand side t, where - is a 2-ary predicate symbol written infix.

Throughout the paper we will make use of the notational conventions depicted in the following table:

a , b

C, d~ , .

i , j . . . .

x , y , . .

constants D conjunction of equations function symbols E equation integers E P equational program terms G goal clause variables a , 0 . . . . substitutions

HORN EQUATIONAL THEORIES AND PARAMODULATION 311

In order to have a formal way to deal with subterms we define the set o f occurrences

in t, O(t) , induct ively as follows:

A E O(t) ,

e O( f i ) impl ies i . ~ e O ( f ( q . . . . . t , ) ) , I <~ i <~ n.

Hence, an occurrence is a finite word over the set o f posi t ive integers, where A denotes

the empty word and • conca tena t ion .

F o r all 7r e O(t) any a rb i t r a ry s we define t[~zl and t l ~ ~ s[ induct ively as follows:

t lA] = t,

f ( t t , . . . , t ~ . . . . . t , ) l i ' ~ l = t, lTrl,

t [ A * - sl = s,

f ( t l , . . . , ti . . . . . t , ) ] i " 7t *-- sl = f ( t i . . . . . titT~ *'- sl . . . . , t,,).

ritz I is called subterm of t at 7z. We also say tha t t contains t l ~I. ritz +- s l is called the

replacement of s in t at n. ~ ~ O(t) is said to be a variable (resp. non-variable) occurrence, i f tits] is (resp. is not) a variable. The above defini t ions can easily be

extended to ho ld also for equat ions .

Let X b e a term, an equat ion , a con junc t ion o f equat ions , or a clause. Then Var($5)

denotes the set o f var iables occurr ing in X.

2.2. SUBSTITUTIONS

A substitution is a m a p p i n g a f rom the set o f var iables into the set o f terms which is

equal to the ident i ty m a p p i n g a lmos t everywhere; it is represented by the finite set o f

pairs a = (x~ ~ t~, . . . , x, ~ t,} where xi ¢ ti for all i, 1 ~< i ~< n. The ident i ty

mapp ing , i.e. the empty substitution, is deno ted e. Subst i tu t ions are extended to

morph i sms on the set o f terms, equat ions , conjunc t ions o f equat ions , and clauses in

the obvious way. The domain o f a, Dora(a), is {xpax ¢ x} . The eodomain o f a,

Cod(a) , is { a x l x ~ D o m ( a ) } . The restriction o f a to a set of var iables V is {x , - t

o-i x ~ V}. s is called an instance of t i f f there exists a subs t i tu t ion a such that s = at.

s is called a ground instance of t i f f s is an instance o f t and Var(s) = ~ . s and t are

variants if there exist a and 0 such tha t s = a t and t = Os. We also say tha t s is a

variant of t and t is a variant of s. I f s = at and the var iables i n t h e codoma in o f a

'have not occur red ' before, then s is said to be a new variant of t. The composition 0a

o f the subs t i tu t ion a and 0 is the subs t i tu t ion {x ~ - t ~ O rx (~ Dom(a ) }

{x ~ Orrx *-- t ~ a A x # Ot}.

A subs t i tu t ion a is called a unifier for s and t i f f as = at. a is called a most general unifier (mgu) for s and t i f f any o ther unifier for s and t can be ob ta ined from a by

compos i t ion . It is well known tha t for any terms s and t, it is decidable whether there

exists an mgu for s and t. Fu r the rmore , this mgu is unique m o d u l o var iable renaming

and can be c o m p u t e d using the a lgor i thm in [35].

312 ULRICH FURBACH ET AL.

3. Horn Equational Theories

In this section we present the language of equational programs and define its declara- tive and fixpoint semantics. For the operational semantics we introduce the inference

rules paramodulat ion and reflection and prove their soundness and completeness.

3.1. EQUATIONAL PROGRAMS

A program clause is of the form E ~- D, where D is a (possibly empty) conjunction of equations. E is called head and D is called body of the program clause. A finite set

of program clauses is called equational program. A goal clause is of the form ~ D. The

equations in the body of a goal clause are often called subgoals. The empty clause is a goal clause with empty hypothesis and will be denoted D. For notational con-

venience a conjunction of equations will sometimes be treated as a multiset of

equations. In this case set operations denote their multiset equivalent. As an example consider the equational program

EAX(EP): x - x ~ (reflexivity) x - y ~- y - x (symmetry)

x - z ~- x - y /x y - z (transitivity)

f ( x l . . . . , x . . . . . x , ) - f ( x l . . . . . y . . . . . x , ) ~ x - y

for each n-ary function symbol f occuring in E P and each i, 1 ~< i ~ n (f-substitutivity)

which consists of the axioms of equality for a given equational program EP. Ordinarily, there are several ways of handling the concept of equality within first

order theories: Firstly, one adds the axioms of equality to the equational program (see e.g. [4]).

With this method there is no need to change the inference system; resolution alone would meet all theoretical needs, correctness and completeness results are not affec-

ted. From an operational viewpoint, however, it is obvious that the additional clauses representing the axioms of equality lead to a tremendously growing search space.

Secondly, we can keep the resolution rule, but replace the unification algorithm by

an unification procedure under the respective equality theory [33]. Thirdly, clauses can be 'flattened' by replacing nested functional applications by

new variables and adding the equations built from the new variables and the replaced

subterms to the bodies of the clauses [3, 5]. Then SLD-resolution can be applied to compute the E-unsatisfiability of a 'flattened' equational program and a 'flattened' goal clause. This technique can also be characterized as applying the axioms of equality finitely many times upon an equational program and a goal clause and then throwing the equality axioms away [3].

Fourthly, one adds a substitution rule and the axioms of reflexivity [34, 39]. The substitution rule states that

t w o e q u a l t e r m s s a n d t r e m a i n e q u a l i f a s u b t e r m v o f s is r e p l a c e d b y a t e r m w w h i c h

is e q u a l to v ,

HORN EQUATIONAL THEORIES AND PARAMODULAT1ON 313

whereas the axiom of reflexivity expresses that

two terms are equal i f they are syntactically equal.

This latter method mirrors in a very convenient way the properties of equality without

adding extra clauses according to the first approach. However, it should be men-

tioned, that deciding when to use the substitution rule during a deduction is a question

which has to be investigated very carefully (see [38]). From a theoretical point of view it is obvious that one has to prove the soundness and completeness of this new inference system.

Following this last approach, we are concerned with such soundness and complete- ness proofs for the remaining parts of this paper.

In the sequel, let cEP = EP w EAX(EP) for any equational program EP.

3.2. DECLARATIVE SEMANTICS

Whenever we give an equational program EP in the sequel we implicitely define an

alphabet by the convention that the set of variables (resp. function symbols) contains

the variables (resp. function symbols) occurring in EP. It is well known that logical consequence can be determined in the context of the Herbrand universe of EP

(e.g. [4]). The Herbrand universe U(EP) of EP is the set of all terms that can be built from the function symbols occurring in the alphabet defined by EP. The Herbrand base B(EP) of EP is the set of all ground equations that can be built from the elements

of the Herbrand universe of EP as usual. A Herbrand interpretation I for EP is a

subset of B(EP) with the understanding that s - t is true under I iff s - t e L A Herbrand interpretation I satisfies a program clause P iff for each ground instance

E +- D of P we have, E • I whenever D _ I. A Herbrand E-interpretation for EP is

a Herbrand interpretation that satisfies the axioms of equality for EP. A Herbrand model for EP is a Herbrand interpretation for EP that satisfies each program clause

in EP. A Herbrand E-model for EP is a Herbrand model for EP that satisfies the

axioms of equality for EP. Since we will consider only Herbrand (E-)interpretations and (E-)models in this paper, we will omit the qualification 'Herbrand ' in the sequel.

D is a logical consequence of EP iff for every interpretation I of EP, I is a model for EP implies I is a model for {E +-- ]g • D}. EP vo {+--D} is unsatisfiable iff EP w

{E *-- ]E • D} has no models. Proposition 1 follows immediately:

P R O P O S I T I O N 1. D is a logical consequence of EP iff EP w { ~ D } is unsali.~able.

The set of all E-models of EP is the set of all models for cEP. Since cEP is a Horn clause program the model intersection property [6J holds also for cEP, i.e. the intersection of all models for cEP is also a model for cEP. Furthermore, since cEP

contains the axiom of equality for EP, we find that this intersection is also an E-model for EP. Thus we obtain

314 ULRICH FURBACH ET AL.

PROPOSITION 2 (E-model intersection property). Le t M o d e ( E P ) be the set o f all

E-models f o r E P . MEe = c~Mode(EP) is an E-model f o r EP.

Hence, we can define the declarative semantics o f an equational p rogram as its least E-model.

An answer substitution for E P w { ~ D } is a substitution for the variables in D. Let

a be an answer substitution for E P w {~-D}. a is said to be a correct answer substitution iff a D is a logical consequence o f EP.

3.3. FIXPOINT CHARACTERIZATION

Let E P be an equational program. Then 2 B(EP), the set o f all interpretations of EP, is

a complete lattice under the partial order set inclusion. The top element of this lattice

is B(EP) and the bo t tom element is ~ . The least upper bound (lub) o f any set of

interpretations is the interpretation which is the union of all the interpretations in the

set. The greatest lower bound (glb) is its intersection. Similar to e.g. [31] we can

associate a mapping TEp with an equational p rogram EP.

Let E P be an equational p rogram and I be an interpretation of EP. The mapping

Tee :28~Eel ~ 2 e(ep) is defined as Tee( l ) = SAREe w L e e ( l ) w Ree( I ) , where

SAREp = {t - t i t ~ U(EP)}

Lee ( I ) = {s - t E B(EP)I

Rep = {s - t e B ( E P ) I

there exist a n ~ O(s - t) and a ground

instance v : w ~ D of a clause in E P

such that (s - t) lnl = v and

D w {(s - t ) [ ~ *-- wl} - I}

there exist a ~ ~ O(s - t) and a ground

instance v - w ~ D of a clause in E P

such that (s - t)[~l = w and

D w {(s - t)l~ ~- vl} ~ I }

Informally, SAREe is the set o f all g round instances o f the axiom of reflexivity.

LEe(I) (resp. REe(I) ) is the set of g round equations that can be 'constructed ' f rom

elements o f I by replacing one occurrence o f the right hand (resp. left hand) side o f

v - w by its left hand (resp. right hand) side, if D is in I. Figure 1 illustrates an

application o f LEp to I. As an example, let E P = {a - b ~ , a - c ~-}. Then

SAREe =- {a - a, b "-- b, c - c},

L e e ( ~ ) = R E e ( ~ ) = ~ ,

and, hence

T E e ( ~ ) = {a -- a , b - b , c - c}.

HORN EQUATIONAL THEORIES AND PARAMODULATION 315

v - w ~ D

7

Fig. I.

F u r t h e r m o r e ,

LEp(T~(~))

a n d hence,

F u r t h e r m o r e ,

LEp( T~p(~))

Ree( r~p(~5) )

and , hence ,

= REp(TE~(~)) = { a - b , b - a , a - c , c - a } ,

{a ~ a , b ~ b , c ± c , a ± b , b ± a , a ~ c , c ~ a } ,

= {a ~ a , a ~ b , b ± a , a ~ c , c ~ a } ,

= {a ± b , b ± a , a ~ c , c ~ a , b ~ b , b ~ c , c ~ b , c ± c

T3p(~J) = { a - a , b - b , c - c , a - b , b - a , a "- c , c - a , b "= c , c - b}.

N o t e , for all n >~ 3, T2p(~) = T3p(~) .

T o a p p l y the resul t s o f f ixpo in t t heo ry , we have to s h o w t h a t TEe is m o n o t o n i c a n d c o n t i n u o u s .

P R O P O S I T I O N 3. TEe is continuous and, hence, monotonic.

Proof. Let X be a d i r ec t ed subse t o f 2 8(Ep), i.e. each finite subse t o f X has an u p p e r

b o u n d in X. N o t e first t h a t Y _~ l u b ( X ) iff Y __c /, fo r s o m e I ~ X. In o r d e r to s h o w

Tee is c o n t i n u o u s , we have to s h o w TEp(lub(X)) = lub(TEe(X)) , for each d i r ec t ed subse t X:

s - t ~ TEp(lub(X)) iff

s "- t ~ SAREp ~9 LEp(lub(X)) w Rep(lub(X)) iff

s "-- t ~ { s - t ~ B ( E P ) [

s = t or there exis t a ~r ~ O(s - t) a n d a g r o u n d in s t ance

v - w ~ D o f a c lause in EP such t ha t

((s - t)rTr[ = v a n d O w {(s - t)tTr +-- w[} ~_ l u b ( X ) ) o r

((s - t)lrcl = w a n d D w {(s - t)Jrc ~ vl} _~ lub(X) )} iff

316 ULRICH FURBACH ET AL.

S -- t ~ {S -- t ~ B ( E P ) ]

s = t o r there exis t a ~ ~ O(s - t) a n d a g r o u n d in s t ance

v - w *-- D o f a c lause in E P such t h a t

((s - t)lTz] = v a n d D ~ {(s - t)lzt +-- wl} ~_ I, fo r s o m e

I e X ) or

((s - t ) l~[ = w a n d D u {(s _-" t ) [~ ~ v[} _~ J , for s o m e

J e X)} iff

s - t 6 { s - t ~ B ( E P ) I

s = t o r there exis t a 7z E O(s =- t) a n d a g r o u n d in s t ance

v - ' w ~ D o f a c lause in E P a n d a Y e X such t ha t

((s =" t)lrt l = v a n d D w {(s "-- t)lrc ~ wl} --- I w J _ Y) o r

((s - t)lrcl = w a n d D w {(s - t)lrc ~ vl} -= I w J ~ Y)} iff

s - t 6 S A R ~ p w L E e ( Y ) w R E p ( Y ) , for s o m e Y ~ X iff

s - t 6 Top(Y), for s o m e Y ~ X i f f

s -'_ t c lub(TEp(X)) . Q . E . D .

P R O P O S I T I O N 4. l f p (Tee ) = g l b { I I T E e ( I ) = I } = g lb { I I T e e ( I ) ~ I } .

Proo f . The resul t fo l lows f r o m TEe be ing m o n o t o n i c ( P r o p o s i t i o n 3) a n d 2 B~L'p~ be ing

a c o m p l e t e la t t ice u n d e r set inc lus ion . Q . E . D .

F r o m f ixpo in t t heo ry we learn tha t , s ince Tee is c o n t i n u o u s , the leas t f ixpo in t

l fp(Tep) can be c o m p u t e d as TEp 1" o , where co is the first inf ini te o r d i n a l a n d

TEp T n = TEp(Tcp ~ (n - 1)) if n is a pos i t ive in teger .

T H E O R E M 5. ~ ( ~ e ) = ~ e T o .

T h u s we can cha ra c t e r i z e an e q u a t i o n a l p r o g r a m E P by the leas t f ixpo in t o f Tee .

I t is, o f course , de s i r ab l e t ha t the d e c l a r a t i v e s eman t i c s a n d the f ixpo in t cha rac t e r i z -

a t i on o f an e q u a t i o n a l p r o g r a m are iden t i ca l . T o p r o v e this resul t we s h o w first t h a t

a s u b s t i t u t i o n rule a p p l i e d to the e l emen t s o f an E - i n t e r p r e t a t i o n y ie lds on ly e l emen t s

o f t ha t E - i n t e r p r e t a t i o n .

P R O P O S I T I O N 6. L e t I be an E - in t e rpre ta t i on . I f {v - w, s - t} ~_ I a n d

(s - t) l~[ = v, then (s - t) lTz ~ w l ~ I.

P r o o f . Let I be an E - i n t e r p r e t a t i o n . The resul t is s h o w n by i n d u c t i o n on the l eng th

o f re.

HORN EQUATIONAL THEORIES AND PARAMODULATION 317

If ~z = 1, then s = v. Since I is symmetric it follows from v - w e i that w ="

v e L Further , s i n c e / i s transitive it follows from {w "= v, v - t} c / t h a t w _-' t e I.

If ~z = 2 then t = v and the result follows by I being transitive.

Now suppose the result holds for ~. If (s - t)tTr" i] = v, then (s - t)l=i must

be of the form f ( f i , . . . , t~), n >~ i. Since I is reflexive we find f ( h . . . . . t,,) ="

/'(t~ . . . . . t~) e l a n d t~ = v. Fur thermore , since v "= w e l a n d / s a t i s f i e s the axioms

off-subst i tu t iv i ty , f ( f i . . . . . t~ . . . . . t,,) "= f ( t~ . . . . . w, . . . . t,,) e L The result holds

by an appl icat ion of the induct ion hypothesis. Q.E.D.

T H E O R E M 7. L e t E P be an equational program, if" I is an E-mode l j o r EP , then

T~,e(I) =- 1.

Proof . Suppose I is an E-model for E P and s - t e TEe(I). We have to show that

s - t ~ L By the definition of TEe, s -- t ~ S A R E e vo LEe(I ) vo REp(I) .

I f s -- t e S A R E e , then s = t and since I i s reflexive we find s - t e L

If s - t ~ LEe( I ) , then there exist a ~ ~ O(s ± t) and a ground instance v ="

w * - D of a clause in E P such that (s - t)ITr I = v a n d D • {(s =" t)]~ *-- wi} -~ I.

Since I is an E-model for E P , we find v - w e L and since I is symmetric we have

w ± v e L Fur thermore , (s - t)[~ *-- v] e I by Proposi t ion 6.

Finally, if s - t e REe( I ) , then the result holds in analogy to the previous case.

Q.E.D.

The following example shows that the converse of Theorem 7 does not hold. Let

E P be the equat ional program

{a - i ~ , b - j * - } ,

and I the interpretat ion

{a - b , a "= a , b "- b , i - i , j - j , a ± i , a "=j ,b ± j ,

i =- a , i -~ h , i - j , j - b}.

Then TEe( l ) c_ / b u t / i s not an E-model for E P because b - a is missing. The reason

is that whereas I uses only symbols from E P it specifies more than E P , for example

the value of a = b under I is true. However, this is not forced by EP.

Corol lary 8 shows that the least fixpoint of TEe is conta ined in the least E-model

of E P .

C O R O L L A R Y 8. [fp(TEp) ~ MEe

Proof . Let EP be an equat ional program. By Proposi t ion 4 we have

l fp(TEp) = glb{ll TEe(I) ~ I } .

From Theorem 7 we conclude that

{ I ITEe( I ) c_ I } ~ { / I / i s an E-model for E P }

318 ULRICH FURBACH ET AL.

and , hence,

g l b { I I T E e ( I ) ~ I } ~_ g l b { I l l is an E - m o d e l for E P } = MER. Q . E . D .

W e can n o t reverse T h e o r e m 7 b u t we can show a w e a k e r f o r m o f it:

T H E O R E M 9. l f p (Tee ) is a H e r b r a n d E - m o d e l f o r E P .

Proo f . Fi rs t ly , we will s h o w tha t l fp(Tee) is a m o d e l for E P . There fo re , we have to

show tha t for al l g r o u n d ins t ances s - t ~- D o f p r o g r a m c lauses in E P we f ind

D _ l fp(Tre ) impl ies s - t • lfp(TEe). I f D ~ l fp(Tee ), then there exists an n such

t h a t D c_ T E e T n . Clear ly , t "_- t • TEeTn and , hence, s - t • T e e ~ ( n + 1) by

r ep lac ing the t a t occ u r r en ce 1 in t - t.

Second ly , we will show tha t lfp(TEe) is an E - m o d e l fo r E P . F r o m the de f in i t ion o f

TEe fo l lows t ha t l f p ( T e e ) c o n t a i n s all g r o u n d ins tances o f the a x i o m o f ref lexivi ty. I t

r ema ins to show tha t l fp(Tee) is sy mmet r i c , t rans i t ive , a n d o b e y s the f - s u b s t i t u t i v i t y

ax ioms .

I f s - t e lfp(TEe), then there exists an n such t ha t s - t E Tee "In. W e will show

by i n d u c t i o n on n t ha t t - s is a l so an e l emen t o f TEe T n. The case n = 1 be ing t r ivia l

(i.e. s = t) we tu rn to the i n d u c t i o n s tep a n d a s s u m e t h a t the resul t h o l d s fo r n - 1.

l f s - t e L E e ( T e e T ( n - 1)), then we f ind a ~ • O(s - t) a n d a g r o u n d in s t ance

v - w ~ D o f a c lause in E P s u c h tha t (s - t)lTt] = v a n d D w {(s - t)]~ ~ wl} ~-

Tee T (n - 1). W i t h o u t loss o f gene ra l i t y we m a y a s s u m e t h a t ~z is o f the f o r m 1 • 7r'.

F r o m the i n d u c t i o n h y p o t h e s i s we lea rn t h a t (t - s l 2 • 7z' ~ w[) e Tee T ( n - 1) and ,

hence, t - s • Tee "f n. Since TEe is c o n t i n u o u s , we c o n c l u d e t - s • l fp(Tep ).

I f s - t ~ R e e ( T e e "f (n - 1)), then the resul t ho lds in a n a l o g y to the p r e v i o u s case.

N o w , i f { s - t, t - u} ~ l fp(Tee) , t hen there exis t m a n d n such t h a t

s - t • T e e T m a n d t - u • T e e ' f n . C l e a r l y , { s - t , t - u} ~_ T e e ' r ( m + n ) . T h e

resul t is p r o v e d by i n d u c t i o n on n. The case n = 1 be ing t r iv ia l (t = u) we tu rn to the

i n d u c t i o n s tep a n d a s s u m e the resul t h o l d s for n - 1.

I f t - u • L E e ( T e e T (n - 1)), then we find a n e O ( t - u) a n d a g r o u n d ins tance

v - w ~ D o f a c l a u s e i n E P s u c h t h a t ( t - u)t~l = v a n d D w {(t - u)lTz +-- wl} _~

Tee "f (n - 1). W e d i s t i ngu i sh two cases w.r . t . ~. I f 7r is o f the f o r m 1 • re', t hen

(s - t) l 2.7r'1 = v. Since w - v ~ D is a g r o u n d in s t ance o f a c lause in E P we f ind

(s - t )12 .7c ' , - wl e T e e T ( ( m + 1) + (n - 1)) a n d f r o m the i n d u c t i o n h y p o t h -

esis we lea rn t h a t s - u e l fp(Tee) . I f ~ is o f the f o r m 2 • 7z', t hen the i n d u c t i o n

h y p o t h e s i s ensures t h a t (s - u)lrc +-- w[ ~ l f p ( T e e ) . Hence , we f ind a k such tha t

O w {(s - u ) l~ ~- wl} -- T e e ~ k and , thus , s - u ~ T e p T ( k + 1). The re fo re ,

s - u • l fp(Tee) . I f t - u • R e e ( T e e T (n - 1)) t hen the resul t h o l d s in a n a l o g y to the p r e v i o u s case.

F ina l ly , i f s j - tj • l f p ( T e e ) , j • [1, m] a n d j a r b i t r a r y b u t fixed, t hen there exis ts an

n such t h a t sj - tj ~ Tee T n. W i t h o u t loss o f gene ra l i t y we p r o v e the resul t for an

a r b i t r a r y b u t f ixed m - a r y f u n c t i o n s y m b o l f o c c u r r i n g in E P by i n d u c t i o n o n n. T h e

case n = 1 b e i n g t r iv ia l (sj = tj) we tu rn to the i n d u c t i o n s tep a n d a s s u m e t h a t the

resul t h o l d s fo r n - 1.

HORN EQUATIONAL THEORIES AND PARAMODULATION 319

I f s j = tj E L e p ( 7 ) e "F (n - 1)), t hen we f ind arc ~ O(sj - tj) a n d a g r o u n d in s t ance

v - w ~ D o f a c l ause in E P such t ha t (sj - tj)lTtl = v a n d O w {(sj - ti)lrc ,--

wl} ~- TLI~ "~ (n -- 1). W i t h o u t loss o f gene ra l i t y we m a y a s s u m e tha t ~ is o f the f o r m

1 • rr'. F r o m the i n d u c t i o n h y p o t h e s i s we l ea rn t ha t

f ( t l , • • • , sj[Tz' +-- w[ . . . . , t , ,) - f ( t l . . . . . tj . . . . . G )

= ( f ( f i , . . . , sj, . . . , tin) -- f ( t I . . . . . t i . . . . . G))I1 " j " ~ ' *-- wl~ ifp(Tep).

Hence , there exis ts a k such t ha t

D u { ( f ( t ~ , . . . ,~j . . . . , tin) ~ f ( h . . . . , t j , . . . , G ) ) ] I " j " 7z' *-- w]} ~_ TEe~fk . Thus ,

( f ( h . . . . . sj . . . . . tm) ~ f ( h . . . . . tj . . . . . tin))[ 1 " j " ~ ' *-- VIE TEp ~'(k + 1)

and , hence ,

f ( t r . . . . , sj, . . . , tin) "-- f ( h . . . . , tj, . . . , tin) ~ l fp(Tep).

I f s j -- t j ~ REe(TEe T (n - 1)), then the resu l t h o l d s in a n a l o g y to the p r e v i o u s case.

Q . E . D .

F ina l ly , we can s ta te the equ iva l ence o f the d e c l a r a t i v e a n d f ixpo in t s eman t i c s o f an

e q u a t i o n a l p r o g r a m .

C O R O L L A R Y lO. l fp(TEe) ~ M e e

P r o o f F r o m T h e o r e m 9 we k n o w tha t l fp(Tep ) is an E - m o d e l for E P , hence

lfp(Tep ) is an e l emen t o f the set o f all E - m o d e l s fo r E P , w h o s e in t e r sec t ion is MEp.

Q . E . D .

3.4. PARAMODULATION

A s Slagle [37] has p o i n t e d ou t , " in ference rules shou ld be f a s t e r than resolu t ion

p r o g r a m s c o m p u t i n g the correspond ing a x i o m s (here: the a x i o m s o f equa l i ty ) by

avoid ing cer tain t roub le some in ferences m a d e by reso lu t ion" . In this sec t ion we will

i n t r o d u c e the in fe rence rules p a r a m o d u l a t i o n , de f ined to m e c h a n i z e the s u b s t i t u t i o n

rule, a n d ref lect ion, def ined to m e c h a n i z e the a x i o m o f ref lexivi ty .

Le t G be the goal c lause *--D /x E, P = v - w , - D ' be a new v a r i a n t o f a

p r o g r a m clause, ~ ~ O ( E ) , a n d u = (E) I rcl. I f u a n d v (resp. u a n d w) are uni f iable wi th

m g u a , t h e n G ' = +--~(D /x E l ~ ~ wl /x D ' ) ( r e s p . ~ a ( D /x El~z*-- vl /~ D ' ) ) i s

ca l led p a r a m o d u l a n t o f G and P a t ~z using ~r, in s y m b o l s G ~p~e.~.p.o)G'.

A s an e x a m p l e c o n s i d e r the e q u a t i o n a l p r o g r a m

FUN: g - a* - -

f ( c ( g ) , c(a)) - d (e (g) , c(a))

(g)

(f)

320 ULRICH FURBACH ET AL.

and the goal clause G = ~ f ( x , y) - d(x , y). Then ~-f(c(g)), c(a)) - f (c(g)) , c(a)) is a paramodulant of G and (f) at 2 using mgu (x ~ c(g), y ~ c(a)}. Observe that the

program clause has been used from right-to-left, in that an instance of the right-hand side of the head of (f) has been replaced by the corresponding instance of the left hand

side in the goal clause. We could also apply paramodulat ion to G and (f) at 1 from left-to-right, obtaining the goal clause *-d(c(g), c(a)) - d(c(g), c(a)). Hence, para-

modulation is undirected. Sometimes paramodulat ion has been defined from left-to-right only. It seems that

this approach has been taken in [4], unfortunately some of its subsequent lemmas and

theorems use paramodulat ion from right to left in contrast to its definition, e.g.

Lemma 8.2 in [4], p. 306.

It should be noted that we have defined paramodulat ion to be only applicable upon

goal clauses but not upon program clauses. Since we intend to treat Horn equality theories alone there is no need to introduce

the resolution rule except for the case, where resolution is applied using the axiom of

reflexivity as input clause. The other case, where resolution is applied using a program clause other than the axiom of reflexivity, can be modelled by a paramodulat ion step using the same program clause and applying resolution with the axiom of reflexivity

afterwards. As an example consider the program clause g - a +- and the goal clause *--g - y. Resolving ~-g - y against g - a +- yields the empty clause and the

substitution { y +-- a}. However, the paramodulant of ~-g - y and g - a ~- at 1

using e is the goal clause ~- a - y, which can be resolved against the axiom of

reflexivity yielding the empty clause and substitution { y *-- a}. Hence, adding the resolution rule leads to the generation of many redundant goal clauses.

Keeping with Fribourg's approach [7], we introduce a new inference rule called reflection. Let E = s - t and G be the goal clause ~ D /x E. I f s and t are unifiable

with mgu a, then G' = ~ a D is called reflectant of G using a, in symbols G ~(e,~) G'.

In our example f (e(g) , c(a)) and f (c(g) , c(a)) are unifiable with empty unifier e. Hence the empty clause is a reflectant of ~f (c (g ) ) , c(a)) - f(c(g)) , c(a)). In contrast to the resolution rule using the axiom of reflexivity x - x ~ as input clause we are not introducing a new variable x, whose binding is in general neglected.

Let EP be an equational program, and G be a goal clause. G' is derived from G using

0 iff G' is a paramodulant of G and some program clause P in E P using 0 or G' is a reflectant of G using 0. A derivation of EP w {G} is a (possibly infinite) sequence

Go = G, G1 . . . . of goal clauses and a sequence 0~, 02 . . . . of mgus such that Gi+l is derived from Gi using 0i+1. A refutation of EP w {G} is a finite derivation of

EP w {G} which has the empty clause as the last goal clause. I f G, = 13, we say the refutation has length n.

The computed answer substitution 0 for EP w {G} is the substitution obtained by restricting the substitution 0n" • • 01 to the variables of G, where 0~, . . . , 0,, is the

sequence of mgus used in the refutation of EP w ~G }. Observe, the last step in a refutation must be a reflection step, since a paramodu-

lation step never decreases the number of subgoals in a goal clause.

HORN EQUATIONAL THEORIES AND PARAMODULATION 321

W h e n wri t ing p a r a m o d u l a t i o n or reflection steps we will often omi t the subscr ipts

s - t, a, etc., if they can be determined by the context. Fur thermore , we will depict the

selected subterm (resp. subgoal) in a pa ramodu la t i on (resp. reflection) step in bold type.

Let E P be an equa t iona l p rog ram. The success set of EP, SSEp, is the set o f all

s "- t ~ B(EP) such that E P u {*--s - t} has a refutat ion. To show that an inference

system based on p a r a m o d u l a t i o n and reflection is sound and comple te we show that

each c o m p u t e d answer subs t i tu t ion is correct and tha t for each correct answer

subs t i tu t ion there exists a (eventual ly more general) c o m p u t e d one.

T H E O R E M 11 (Soundness o f paramodulat ion and reflection). Let G be a goal clause.

Even, computed answer substitution f o r E P w {G } is a correct answer substitution f o r

cEP u {G}. Proof. Let 0~ . . . . ,0,, be the sequence o f m g u s used in the refu ta t ion o f E P u {G }.

Suppose G = ~ D. We have to show that 0n • • " 0~D is a logical consequence o f cEP.

The result will be shown by induct ion on the length n o f the refutat ion.

I f n = 1, then G is of the form ~ s - t and s and t are unifiable with mgu G. Since

O~(s - t) is an instance of the ax iom of reflexivity, it follows that O~(s - t) is a logical

consequence o f cEP and, hence, 0~ is a correct answer subst i tut ion.

Next we assume that the result holds for c o m p u t e d answer subst i tu t ions which

come from refuta t ions o f length n - 1. Suppose 01 . . . . . 0,, is the sequence o f mgus

used in the refuta t ion o f E P • {G} o f length n. Let G = ~ D A S -- t and assume

that E = s - t is the first selected equat ion. We dis t inguish three cases wrt to the first

step in the refuta t ion o f E P u {G}:

If reflection has been appl ied, then by the induct ion hypothesis , 0,, - , • O~D is a

logical consequence o f cEP. Since 0~ is a unifier for s and t, so is 0 n • - • G . Hence,

0, • • • 0~ (s - t) is an instance o f the ax iom of reflexivity and it follows that 0,, • • -

0~ (s ~- t) is a logical consequence o f cEP.

Suppose p a r a m o d u l a t i o n has been appl ied f rom lef t- to-r ight at ~ ~ O(E). Let

u --- E[~I and v - w ~ D ' be the first input clause. By the induct ion hypothesis ,

0 n " " " OI(D A E[~r ~ w] A D') is a logical consequence o f cEP. Consequent ly ,

0,, • - • 01 (v - w) is a logical consequence of cEP and, hence, 0,, • - • 0~ (El zr , - w J) is

a logical consequence o f cEP. Fur the rmore , since 0~ is a unifier for u and v, we find

0n " • • 01, = 0n • " • 0~v. Thus, by P ropos i t ion 6, we learn that 0, - • • 0~ E is a logical

consequence o f cEP.

Final ly , if p a r a m o d u l a t i o n has been appl ied from right-to-left , then the result

follows in ana logy to the previous case. Q.E.D.

It is an immedia ted consequence o f Theorem l I tha t the success set o f an equat iona l

p r og ram is con ta ined in its least E-model .

C O R O L L A R Y 12. SSL.e ~ Mep

Proof. Let s - t ~ B(EP). Suppose E P ~ {*--s - t} has a refutat ion. By Theorem

11, s _'- t is a logical consequence o f c E P . Thus, by Propos i t ion 2, s - t is in the least

E -mode l o f EP. Q.E.D.

322 ULRICH FURBACH ET AL.

It is also possible to be more precise than Corol lary 12. We can show that if

s - t ~ B (EP) and E P w { +- s - t} has a re fu ta t ion o f l e n g t h n, then s _+_ t ~ TEe Tn.

To state this in the following theorem we introduce the notat ion [s - t]: Let [s - t]

be the set o f all g round instances of s - t contained in the Herbrand base o f the

equational p rogram in consideration.

T H E O R E M 13. L e t G be a goal clause. I f E P u { G } has a refutat ion o f length n using

mgus 01 . . . . . 0 , , then .for every equation s - t in 0, " . " 01G, we f i n d [s - t] ~_

TEe ~n. Proof . The result is shown by induction on the length n of the refutation.

If n = 1, then G is a goal o f the form s - t and 01 is a mgu for s and t. Hence,

Ol(S - t) is an instance o f the axiom of reflexivity. Clearly, [O~(s - t)] ~_ TEe "[ 1.

Next suppose the result holds for refutations o f length n - 1 and consider a

refutation o f E P • {G} of length n. Let G be of the form ,--D /x s - t.

I f s - t is not the first selected equation, then 0~ (s - t) is an equation contained

in the second goal clause in the refutation. The induction hypothesis implies that

[0 ,1 " " " 0 1 (S ~ t)] ~ Tep ]" (n -- 1) and, by the monotonic i ty o f T~p, TEp T (n - 1) ~_

TEe Tn. N o w suppose that s - t is the first selected equation. We distinguish three

cases:

If reflection has been applied, then, since 0~ is a unifier for s and t, so is 0n • " " 01.

Clearly, [0,, • • • 0t (s - t)] ~_ TEe ~ n.

Suppose paramodula t ion has been applied from left-to-right at 7r e O(s "- t). Let

u = (s - t) lrt[ and v - w ~ D ' be the first input clause. The induction hypothesis

implies that [0, . . . Ol((s "= t)lrc ~ wl)] __%_ TFp i '(n -- 1)and, i f D ' ¢ ~ , for every

equation E in D', [ O , . . . O ~ E ] ~_ T~.:pT(n - 1). Hence, by the definition of TEe,

[ 0 , , . . . O~((s -- t)lTz ~ vl)] ~ TFe Tn. Since 01 is a unifier for v and u we find

[ 0 , , ' ' " O,(s - t)] _~ TEe l"n. Finally, if paramodula t ion has been applied from left-to-right then the result

follows in analogy to the previous case. Q.E.D.

To examplify Theorem 13 and to emphasize the difference between the fixpoint

characterization of an equational p rogram and its characterization in terms of

refutation consider the equational program E P = { f - a *--}. There exists a refu-

tation o f E P u { o f - a} of length 2: First paramodula t ion can be applied at 1 using

f - a ~ from left-to-right yielding the goal clause , - a - a. Finally, the empty

clause can be derived by a reflection. Obviously, a - a ~ TL.p i" 1. We can now replace

the a at 1 in a - a by f using the program clause f - a ~ from right-to-left. It

follows, that f _~ a ~ Tep "r 2.

From Corol lary 10 and Corol lary 12 follows immediately that the success set of an

equational program E P is contained in the least fixpoint o f TEe.

C O R O L L A R Y 14. SSEe ~ l fp(Tee)

HORN EQUATIONAL THEORIES AND PARAMODULATION 323

To achieve a completeness result we have to show that the least fixpoint of TEe is

contained in the success set of E P . To prove such a result we need a lifting lemma for

paramodulation and reflection. The following two technical lemmata are concerned

with special cases within the lifting lemma. Lemma 15 shows that if paramodulation

has been applied to a goal clause aG containing a(s - t) at an occurrence of s - t,

then paramodulation can also be applied to G using the same program clause.

LEMMA 15. L e t G = ~ D /x s - t b e a g o a l c l a u s e , T z ~ O ( s - t ) , P = v - w ~- D '

be a new var iant o f a p r o g r a m clause, a n d cr be a subs t i tu t ion . I f ~rG ~p(~,p,o) G' , then

there e x i s t 0', 7, a n d G* such tha t G ~ p(~,p,o') G* a n d 7G* = G'.

Proo f . Let u = (s - t)JT~J. Suppose first that paramodulation has been applied

from left-ro-right in a G --'p(~.~,o) G' . Since P is a new variant of a program clause we

find Dora(a) c~ Var (P) = ~ and, hence, a v = v. It follows that au and av are

unifiable with mgu 0 and G' = ~-0a(D /~ (s - t)Jrc ~ w l /x D' ) . Since 0a is a

unifier ofu and v, we find an mgu 0' ofu and v and a substitution 7 such that 70' = 0a.

The result follows immediately.

If paramodulation has been applied from right-to-left, then the result follows in

analogy to the previous case. Q,E.D.

In Figure 2a we depict a paramodulation step from aG to G', whereas the corres-

ponding paramodulation step from G to G* is presented in Figure 2b.

As we will see, to lift a refutation of aG to a refutation of G we need in general the

functional reflexive axioms o f E P , F(EP). This is the set containing all program clauses

f(x~ . . . . . x , ) - f ( x I . . . . . x,) +--, w h e r e f i s an n-ary function symbol occurring in EP. Let EP + = E P w F ( E P ) . Note, E P + is an equational program. Hence,

,g

Fig. 2a.

P

Fig. 2b.

324 ULRICH FURBACH ET AL.

Corollaries 10, 12 and 14 hold also for E P + , i.e. the least E-model o f E P + is contained

in the least fixpoint of TEe+, and the success set of E P + is contained in the least

E-model o f E P + as well as in the least fixpoint of Tee+, and the success set of E P +

is contained in the least E-model of E P + as well as in the least fixpoint o f Tee+.

Furthermore, since each E-model I for E P contains all g round instances of the axiom

of reflexivity, I is also an E-model for E P + and vice versa. Thus, ME~ = MEe+ and,

likewise, lfp(TEp) = lfp(Tee+).

Lemma 16 is concerned with the case that paramodula t ion has been applied upon

the selected subgoal (rE in a goal clause aG at an occurrence ~ e O((rE) \O(E) . It

shows that in this case a goal clause 6G with 7r e O ( 3 E ) and (6E) l~zl being a variable

can be derived f rom G by repeated applications o f paramodula t ion using functional

reflexive axioms.

Before turning to the lemma itself we need one more definition. The size o f a term

(resp. substitution) is defined inductively as follows:

size(x) : 0

size ( f ( t l . . . . . t,,)) = 1 + Y~ size (ti) i

size(e) = 0

size({xi ~ ti . . . . , x~ ~ t~}) = ~ size(t/). i

Remember that constants are 0-ary functions.

L E M M A 16. L e t ~r be a substi tution. There exis ts a derivation f r o m e- D to ~ a D using

only paramodulat ion and program clauses f r o m F ( E P ) .

Proof . The result is shown by induction on the size n o f a. The case n = 0 being

trivial (a = e) we turn to the induction step and assume that the result holds for

17 - 1.

If size (a) = n, then we find a binding x ~ t in (r and ~ O ( t ) such that

size(ti l l) = 1. Let t' = tl~[ and y be a new variable. Furthermore, let 0 be the

substitution obtained from o- by replacing the binding x ~ t with x +- t l~ ~ Y l.

Clearly, 0 is a substitution of size (n - 1). By the induction hypothesis there exists a

derivation from ~ D to ~-OD using only paramodula t ion and program clauses from

F ( E P ) . Now, if y does not occur in OD then OD = ~D. Otherwise, let ~' be an

occurrence of y in OD. Then ~ (rD is a paramodulan t o f +-OD and t' - t ' ~ at ~'

using { 3 , ~ t'}. Q.E.D.

Figure 3 illustrates this lemma.

L E M M A 17 (Lifting lemma for paramodulation and reflection). Let G be a goal clause

and ~ be a substitution. I f E P ~ [c~G} has a refutation o f length n using mgus 01, • • • ,

0,~, then E P + • {G} has a refutation o f length m >~ n using mgus e l , . . . , ~ .

Furthermore, there exists a substi tut ion 7 such that O, • • • 016 = 7a m • • " (rl.

Proof . The p roof is by induction on the length n of the refutation of E P u {6G }.

If t7 = 1, then G is of the form e-s - t and 6s and 6t are unifiable with mgu 0~.

H O R N E Q U A T I O N A L T H E O R I E S A N D P A R A M O D U L A T I O N 325

× ×

"p

F i g . 3.

Since 0j c~ is a unifier for s and t, we find an mgu a~ for s and t and a subs t i tu t ion y

such that 0~f = 7a~. Clearly, there exists a refuta t ion o f E P u { ~ s - t} o f length

I app ly ing reflection.

N o w assume the result holds for n. Suppose E P u {f 'G '} has a refuta t ion o f length

n + 1 u s i n g m g u s 0~ . . . . . 0n+~. Let G ' be o f t h e form ~ D A S -- t and assume that

E = s - t is the first selected equat ion. We dis t inguish three cases.

If the first s tep was reflection, then 0~ f ' is a unifier for s and t. Hence, we find an

mgu a~ o f s and t and a subs t i tu t ion 3 such that ba~ = 013'. Let G = ~-at D. Since

there exists a re fu ta t ion o f E P u {fG} o f length n using mgus 02 . . . . . 0,,+1, by the

induct ion hypothesis , there exists a refuta t ion of E P + • {G } o f length m >~ n using

mgus cr 2 . . . . . cr +~ and a subs t i tu t ion y such that , '%+t • " • or2 = 0,,+1 " • • 02&

Clearly, there exists a re fu ta t ion o f E P + w {G'} using mgus ~1 . . . . , c%+~ and

0,7+1 " " . Ol f / = 0 n + I " " ' 0 2 3 0 - I = ~ /O 'm+ 1 " ' " a l .

If the first step was a p a r a m o d u l a t i o n f rom lef t - to-r ight at ~ using the p r o g r a m

clause P = v - w ~ D ' , then

f ' G ' -~,~.p.o,i Ot f ' (D A EI£ ~ w{ A D') .

Suppose first that x e O(E) and let u = Et~I . By L e m m a 15, we find an mgu ~r~ of

,, and v and a subs t i tu t ion f s u c h t h a t G ' ~ , p , ~ t ) ~ cr~(D A ElTr ~ w[ A D ' ) = G

and fiG : O~3'.(D A EITr ~ wl A D') . Hence, &r~ = 01f ' and the result follows by

the induct ion hypothes is in ana logy to the first case. Otherwise if ~ e O(3"E)\O(E),

then we find rCl, ~2 e O ( f ' E ) such that EJ ~1] is a var iable , say x, and rc = ~j • ~ . Let

# be the restr ic t ion o f f to {x}. By L e m m a 16 we find a der iva t ion f rom G ' to # G ' using

only p a r a m o d u l a t i o n and p rog ram clauses f rom F(EP) . Thus, we can proceed as in

the previous case.

F ina l ly if p a r a m o d u l a t i o n has been appl ied from right- to-lef t , then the result holds

in ana logy to the second case. Q.E.D.

Note , whenever in the refuta t ion o f E P • {crG } p a r a m o d u l a t i o n has been appl ied

from lef t - to-r ight (resp. r ight- to-lef t) then in the co r respond ing refu ta t ion o f

E P + w {G} p a r a m o d u l a t i o n has also been appl ied from lef t - to-r ight (resp. r ight - to-

left) using the same p r o g r a m clause.

Fu r the rmore , whenever p a r a m o d u l a t i o n has been appl ied upon a goal clause G at

a non-var iab le occurrence ~ using a funct ional reflexive axiom, the goal clause G itself

326 ULRICH FURBACH ET AL.

is the pa ramodulan t . Hence, to be refutat ion complete it suffices to use a functional reflexive axiom only if pa ramodu la t ion is applied at a variable occurrence.

The functional reflexive axioms are only needed if in the refutat ion of E P u (6G }

paramodu la t ion has been applied at an occurrence in some goal clause g/G' that is not an occurrence of G'. As an example consider the equat ional p r o g r a m FUN, the

substi tution c5 = {x ~ c(a)} and the goal clause G = ~ f ( x , x) - d (x , x). We obtain the refutat ion

6G = +--f(c(a), c(a)) - d(c(a), c(a))

--+p(g) ~ f ( c ( g ) , c(a)) - d(c(a), c(a)) --+pcg) ~f (e (g) , e(a)) - d(c(g), c(a))

~p(f) *-d(e(g) , e(a)) - d(e(g), e(a))

--+r [-]"

The corresponding refutat ion using in the first step the functional reflexive axiom c ( y ) - c ( y ) , - i s

G = +-f (x , x) - d(x , x)

~ p *--f(e(y), e(y)) ._+_ d(c(y ) , c(y))

~p(g~ ~ f ( c ( g ) , c(a)) - d(c(a), c(a))

where --,* denotes several derivat ion steps. However , there does not exist a refutat ion of F U N w { ~ f ( x , x) - d (x , x)}. In such a refutat ion the p rog ram clause (f) must

be used at least once, since otherwise reflection cannot be applied to the 'successor '

o f the e q u a t i o n f ( x , x) - d(x , x). To use (f), x must be instantiated to c(g) (or c(a))

and one of the g (resp. a) must be replaced by a (resp. g) using pa ramodu la t ion and (g). However , there is no way to instantiate x to a term that can be pa ramodu la t ed

to c(g) or c(a) except using the axiom c(y) "- c(y) ~ .

Using the lifting l emma we can show that, whenever an equat ion E is in TL.p T n, E

is also in the success set of E P + .

T H E O R E M 18. I f E e TEe ~ n , then there exists a refutation o f EP + vo {+--E}. Proof. The result is shown by induction on n. I f n = 1, then E e Tee j" l implies that

E is a ground instance of the ax iom of reflexivity. Clearly, EP vo { ~ E } has a

refutat ion of length 1 applying reflection. N o w assume that the result holds for n - 1. Let E e TEp 1" n. With respect to the

definition of TEp we distinguish three cases. I f E is a ground instance of the ax iom of reflexivity, then, clearly, EP w { +--E} has

a refutat ion of length 1 applying reflection. I f E ~ Lee(Tee T ( n - 1)), then we find a ~ e O(E) and a ground instance

of a clause v - w ~- D in EP such that Et~L = Ov and O(D w {EITz ,-- wL}) ~_

TEe ~ (n -- 1), for some 0. By the induction hypothesis there exists a refutat ion of E P u {+--U} for each E' ~ O(D u {El~z ~ wl}). Because each E ' is ground, these refutat ions can be combined into a refutat ion of E P ~ { ~ O(D /x El ~z ,-- w I)}. N o w

HORN EQUATIONAL THEORIES AND PARAMODULATION 327

let u = E]~]. Since 0 is a unifier of u and v, we find a mgu ~ of u and v and a

substitution y such that 7~r = 0. By the lifting lemma, there exists a refutation of

E P + w {*--a(D /~ Elrc ,,- wl)}.

Thus, E P w { ~ E } has a refutation.

Finally, i f E e Rep(Tep ~ (n -- 1)), then the result holds in analogy to the previous

case. Q.E.D.

It should be observed, that the lifting lemma must be applied, since the substitution 0 which 'grounds ' the input clause v - w ~ D is not necessarily the same as the

mgu a of u and v. This is due to the fact that w and D may contain variables that do not occur in v and, hence, will not be bound to a ground term by a.

From Theorem 18 follows that the least fixpoint of Tee is contained in the success

set of E P + .

C O R O L L A R Y 19. lfp(Tep) ~_ SSL.e+

Proof. I f E E lfp(TEp), then, by Theorem E P + w { ~ E } . Hence, E ~ S S ( E P + ) .

18, there exists a refutation of

Q.E.D.

Corollary 20 is an immediate consequence of the Corollaries l0 and 19:

C O R O L L A R Y 20. MEp ~ SSL.e+.

Obviously, the success set of E P is contained in the success set of E P +. The opposite, however, is not true. For example, consider the equational program

E P = F U N w {h - b ~ f ( x , x) - d(x , x)}.

h - b ~ S S ( E P + ) since

~ h "-- b + p ~ b - b /x f ( x , x) - d ( x , x) + r ~ f ( x , x) - d ( x , x) ~ * 71.

However, as we have shown above, there does not exist a refutation of E P w

{ ~ f ( x , x) - d(x , x)}. Hence, h - b ~ SSEp.

C O R O L L A R Y 21.

(1) SSLp ~_ SSL.p+,

(2) SSEe+ is not a subset o f SSL. e,

(3) lfp(TEp) is not a subset o f SSL.e,

(4) Mep is not a subset o f SSee.

P r o o f (1) and (2) follow from the above remarks. To prove (3), suppose that lfp(TEp) _~ SS~p. Then, by Corollary 10 and Corollary 12, Ifp(TEp) = SSL-p. Hence,

by lfp(TL-p) = lfp(TEp+) (cf. remark after Lemma 15), SSep = SSI~:p+, contradicting (2). Likewise, (4) follows from (3) and Corollaries 8 and 10. Q.E.D.

Figure 4 gives an overview over the results obtained so far. Now we turn our attention to correct answer substitutions.

328 ULRICH FURBACH ET AL.

. . . . • :: ; ' : "N 10 ( . . . . . . : " - : ' ; '5, 19 . t . . . . . . . . . . . . . . . . M EP:=:}I: M E p + ~ i , = ! fp(TEP)=: l fp( , .TEp+) i l L : i :

Fig. 4.

L E M M A 22. I f E is a logical consequence o f EP, then there exists a refutation o[

E P + ~) {*--E} with the empty substitution as computed answer substitution.

Proof. Suppose E has variables x~ . . . . . x,. Let a~ . . . . . a, be distinct constants not

appearing in E P and E a n d let 0 be the substitution {xi *-- ail I ~< i ~< n}. Clearly, OE

is a logical consequence o f EP. Since OE is ground, Corol lary 20 shows that E P u

{*--OE} has a refutation. Since the ai do not appear in EP or E, by textually replacing

a~ by xi, 1 ~< i ~< n, in this refutation, we obtain a refutation o f E P u { ~ E } with

computed answer substitution e. Q.E.D.

Finally, we can prove that an inference system based on paramodula t ion and

reflection is complete.

T H E O R E M 23 (Completeness of paramodulation and reflection) Let G be a goal

clause. For each correct answer substitution 0 f o r E P u {G } there exists a computed

answer substitution a obtained by a refutation o f E P + u {G } and a substitution 7 such

that 0 = ~)~r.

Proof. Suppose G = *-- D. Since 0 is correct, OD is a logical consequence o f EP. By

Lemma 22, there exists a refutation of E P u {*--OE} with the empty substitution as

computed answer substitution for all E ~ D. These refutations can be combined into

a refutation of E P u {OG} using mgus 0~ . . . . . 0,, such that the computed answer

substitution is e. By the lifting lemma, there exists a refutation of E P + u {G} using

mgus a ~ , . . . , a,~, m ~> n, and a substitution 7' such that 7'or,, • - - cr~ = 0,, . • • O~ O.

Let a be the restriction o f % . . • al to the variables in G and observe that 0 is the

restriction o f 0, • • • 0~ 0 to the variables in G. Then 0 = 7a, where 7 is an appropriate

restriction o f 7'. Q.E.D.

4. Special Forms of Paramodulation

It is well-known that automat ic theorem provers based on paramodula t ion are far

f rom being efficient, since they have to explore a search space which contains in general many redundant and irrelevant der ivat ions There have been many proposals

HORN EQUATIONAL THEORIES AND PARAMODULATION 329

tO overcome these difficulties which are mainly based on the idea of restricting the class of equational theories in order to prune the search space. In this section we will

briefly mention some of these suggestions and we will show how these restrictions

affect the search space. We will also demonstrate, that the commonly used techniques for doing 'logic programming ' using term rewriting systems can be very easily derived

from the system discussed so far. For a more elaborate discussions of these topics the

reader is referred to [20].

4.I. DIRECTED PARAMODULATION

Recall that paramodulat ion can be applied from left-to-right as well as from right-to-

left. A first restriction is to direct paramodulat ion and to allow only applications from left-to-right. For increased intellegibility we will also direct program clauses in this

case and write s ~ t ~ D instead o f s - t ~ D. Obviously, directed paramodulat ion and reflection is sound. However, it is incomplete: Consider the directed equational

program E P = { f ~ a + - - , f ~ b ~ } and the equation a - b. Clearly, a - b is a logical consequence of cEP. However, there does not exist a directed refutation of {+--a - b} v o E P .

Hence, what condition has to be imposed on E P such that completeness can be

recovered? It is the gound eonflueney: Let ~ * denote a directed derivation using program clauses from E P . E P is said to be ground confluent iff for all ground goal

clauses G, G1, G2 such that G --+* G~ and G ~ * G2, there exists a goal clause G' such

that GI --+* G' and G ~ * G2. Now suppose that E P + is a confluent equational program. It can easily be shown

that - in analogy to Theorem 18 - E e TEe 1" n implies the existence of a directed refutation of E P + w {~-E}. As an immediate consequence we find that directed paramodulat ion and reflection is sufficient to compute the success set of E P + . Along

the lines of Lemma 22 we can now show that E being a logical consequence of E P

implies the existence of a directed refutation of E P + w {+--E} with empty sub-

stitution as computed answer substitution. Finally, an application of the lifting lemma which holds also for directed refutations - ensures that for each correct answer

f substitution 0 for E P w , G , there exists a computed answer substitution a obtained

by a directed refutation o f E P + w {G} and a substitution 7 such that 0 = 7~r. Hence, directed paramodulat ion and reflection is complete if E P + is a ground confluent equational program.

However, if we want to show that an equation E is a logical consequence of a ground confluent equational program, we still have to use the functional reflexive

axioms. This can be seen, if we consider a modification of the equational program F U N from Section 3.4, which is ground confluent:

FUN': g ~ a +- a ~ g ~

f ( c ( g ) , c(a)) ~ d(c(g), c(a)) +--

(g) (a) (f)

Then there does not exist a directed refutation of F U N ' w {+- f ( x , x) "-_ d (x , x)}.

330 U L R I C H F U R B A C H ET A L .

Another difficulty arises for program clauses l ~ r ~ D, where r and D may contain variables that do not occur in 1. A paramodulation step applied upon a

ground goal clause and using such a program clause introduces new variables. As an

example consider the confluent equational program

G M : a ~ b +-

a ~ c ~--

b ~ c ~ g ( x , c ) "-- g ( b , x )

(ab)

(ac)

(bc)

which is due to Giovannetti and Moiso [13]. b - c is a logical consequence of G M ,

since

~- b - c ~pcb,.) ~ c - c A g(X, C) -- g(b, x)

--+r ~ g(x, c) - g(b, x)

--*p~h) ~ g(b, c) - g(b, a)

--*p~,.i ~ g(b, c) - g(b, c)

--->r [-],

However, to obtain this result we had to solve the problem of whether there exists a substitution 0 such that O(g(x, c) - g(b, x)) is a logical consequence of G M . To

avoid this equation solving [30] we impose a condition on the variables occurring in a program clause.

4.2. C O N D I T I O N A L T E R M R E W R I T I N G S Y S T E M S

A directed equational program E P is a condit ional term rewrit ing system iff for all

l ~ r ~ D E E P we have Var(D) u Var(r) ~_ Var(l) . In the sequel let R denote a

conditional term rewriting system. Now suppose that R is ground confluent and that

E is a logical consequence of R. From the previous section we learn that there exists

a directed refutation of R + w {~-E} with empty substitution as computed answer

substitution. Let 0 ~ , . . . , 0n be the sequence of mgus used in this refutation. Since no

0i binds a variable in E and for all I ~ r ~- D e R we find Var(D) u Var(r) ~_ Var(1),

we conclude that Dom(Oi) = Var(l~) if the program clause li ~ r~ *-- Di has been used

in the ith derivation step and 0~ = ~ if reflection has been applied in the ith derivation

step. (A directed paramodulation step where Dom(O) = Var(l) is often called a

rewriting step.) Since a functional reflexive axiom is only used if paramodulation is

applied upon a variable in E, we find that the success set of R is equal to the success

set of R +

4.3. N A R R O W I N G

However, a theorem prover, based on directed paramodulation and reflection and

taking into account program clauses from a confluent term rewriting system, still

generates many redundant and irrelevant derivations. This is especially the case if the 'selected' occurrence is a variable occurrence. In this case directed paramodulation

has to be applied possibly using each program clause from E P + as input clause.

HORN EQUATIONAL THEORIES AND PARAMODULATION 331

Hence, the search space would be considerably pruned if refutation completeness

could be achieved without selecting a variable occurrence. Recall, in this case the

functional reflexive axioms are no longer needed. I f we restrict directed paramodu-

lation to be applicable only at non-variable occurrences, we will call it narrowing.

Let R be a conditional term rewriting system. A term t is said to be in normal form wrt R iffthere does not exist a ~ e O(t), a new variant I ~ r ~- D of a program clause in R, and a substitution a such that t[~l = a l and each ground instance of aD is a

subset of the success set of R. A substitution 0 is said to be in normal form wrt R iff each term in the codomain of 0 is in normal form wrt R.

We can now show that narrowing and reflection is complete if we consider only

correct answer substitutions in normal form and assume that each clause of a ground

confluent term rewriting system is of the fo rmf ( f i . . . . . t,,) ~ t ~ D. This follows

immediately from the lifting lemma: if the correct answer substitution 0 for R u {G } is in normal form wrt R then there exists a directed refutation of R u {OG } with

empty substitution as computed answer substitution. Hence, we obtain a sequence of

goal clauses OG = OGo, OG~ . . . . . OGn = D. Note, 0 is normalized and the answer sub- stitution is e. Furthermore, each rule has the formf(t~ . . . . . t~,) ~ t ~- D. Hence, if in the ith step rewriting has been applied at ~i, it follows that ~i is a non-variable

occurrence of Gt_~. Hence, by the lifting lemma, there exists a narrowing refutation of

E P u {G} with computed answer substitution a and a substitution y such that 0 = ycr. This generalizes results obtained by Hullot [23] for unconditional canonical term

rewriting systems and by Kaplan [30] for confluent and fair conditional term rewriting

systems, where canonical means that the term rewriting system is ground confluent

and each term is equal to another one in normal form and fair means that there exists

a simplification ordering > on the set of terms such that for each program clause l ~ r ~ D and for each substitution a we have al > err and al > ~rs and al > at,

for all s - t e D .

Observe, if there exists a program clause l ~ r ~ D, where r or D contains a variable

not occurring in l, then narrowing and reflection is not complete. As an example

consider the directed equational program G M and the goal clause G = ~-g(x , c) -

g(b, x). The interested reader may verify that {x ~ c} is a correct answer substitution

for G M • {G} in normal form but it cannot be computed using narrowing and

reflection: reflection cannot be applied to G since c and b are not unifiable. Narrowing

can only be applied upon b using program clause (bc) and deriving the new goal clause G' = ~ g(x , c) - g(c, x) /x g( y, c) - g(b, y). It is easy to see that reflection applied

upon the first subgoal of G' generates a variant of G and, therefore, the derivation will be infinite. Hence, Hussmanns completeness result for narrowing and reflection [24] holds only if we impose the variable condition on the program clauses.

5. Discussion

We have presented the language of equational programs together with an inference system, containing only paramodulat ion and reflection. The semantics of equational

332 ULRICH FURBACH ET AL.

programs has been given declaratively and by using fixpoint theory. The equivalence of these two approaches has been proven. The main part of this paper was concerned with the proof of soundness and completeness of the inference system. For this we did

not refer to other work but gave all proofs in full detail. The necessity of the functional

reflexive axioms has been investigated in [he context of least fixpoint, least model and

success set. Furthermore, we have briefly discussed some commonly used techniques which were applied to make term rewriting systems behave logically.

A similar approach has been taken by Gallier and Raatz [9, 10]. They introduce SLDE-resolution to compute answers to queries posed to equational logic programs,

i.e. Horn clause programs which are built from equations as well as atoms. Each atom

of the form P ( s ~ , . . . , sn) is transformed into the equation P(s~ . . . . , sn) - true, where ' true' is a new constant. Then, the authors use essentially the following inference rule: let ~ D /x s -" t be a goal clause, v - w ~- D' be a new variant of a program clause, a and 0 be substitutions, and ~ e O ( a ( s - t ) ) . If(r(s - t)]~[ -- Or,

then infer +--crD A a(s - t)lrc ~ Owl /x OD" from *--D /x s - t. This rule differs from the paramodulat ion rule defined herein as follows: since ~ and 0 are arbitrary

substitutions, a can be used to instantiate a goal clause and 0 can be used to instantiate

variables in a program clause that do not occur in the left-hand-side of its head.

Hence, these substitutions achieve the same effect as the functional reflexive axioms in our approach. Gallier and Raatz apply their inference rule successively upon a

subgoal s - t until s and t are syntactically unifiable. In other words, the subgoal

s - t is 'solved' before any other subgoal is considered as a candidate for the next inference step. This strategy corresponds to Morris [29] and Anderson's [1] E-resolution

rule. To show the completeness of their system, Gallier and Raatz introduce the notion

of a congruence closure for Horn clauses which is equal to the least fixed point of our

mapping TEe. However, the congruence closure is computed by interleaving steps in which congruence is propagated from implicational reasoning, and steps in which

congruence is propagated from purely equational reasoning. This technique can be

examplified by the equational program E P = { a - b ~ , a - c ~ b - a} . Starting

with the empty set we obtain

{a -- b}

by implicational reasoning, since a - b *-- occurs in E P . Using the axioms of equality we can compute the equational closure of {a - b}, i.e. the set

{ a - a , b - b , c - c , a "- b , b - a} .

Usinga - c ~ b - a w e f i n d

{a - a , b - b , c - c , a "-- b , b - a , a - c }

by implicational reasoning and, finally, by equational reasoning we obtain

{ a - a , b - b , c - c , a " - b , b "- a , a "- c , c - a , b - c , c " - b } .

HORN EQUATIONAL THEORIES AND PARAMODULATION 333

The interested reader may verify that this set is equal to the least fixpoint of Tep. The completeness of SLDE-resolution is then shown by relating the steps of the construc- tion of the congruence closure to SLDE-resolution steps. Finally, Gallier and Raatz

show that in order to 'solve' a subgoal of the form s - t it suffices to consider an E-unifier of s and t computed by a complete E-unification procedure if the clauses in an equational logic program are either of the form P(s~ . . . . . s,,) ~ D, where D is a conjunction of atoms and equations, or of the form v - w ~ . This restriction seems to be unnecessary, since there is no principal difference between an E-unification procedure for unconditional equational theories and one for conditional equational

theories (see [22]). Jaffar et al. [25, 26] have shown that the principal semantic properties of logic

programs such as the existence of a canonical domain of computation, the existence of a least and greatest model semantics, the existence of a least and greatest fixpoint semantics, etc, hold also for equational logic programs, i.e. logic programs that are augmented with Horn equality theories. To compute the success set of an equational logic program, the authors use resolution, but replace the unifier of two expressions by an E-unifier of these expressions. Unfortunately, E-unifiers are only defined semantically and, in fact, the authors state that they "do not address in this paper the

issue o f corresponding computational methods implementing them". Thus, paramodu- lation and its special forms can be seen as an E-unification procedure within the framework defined by Jaffar et al.

Goguen and Meseguer [14, 15] have developed EQLOG, an equational logic programming language comprising logic programming, equational reasoning, term rewriting, order-sorded typing, and generic modules. Though the authors refer to narrowing as an inference rule for computing answers to queries posed to EQLOG, they do not provide a rigorous proof for the completeness of their system.

Peterson [32] has proven the completeness of factoring, resolution and unrestricted paramodulation without using the functional reflexive axioms. In his proof he requires a simplification ordering on atoms, equations, and terms which is order isomorphic to positive integers on ground expressions. The functional reflexive axioms are not needed since Peterson does not restrict his paramodulation rule to linear paramodulation. In our FUN-example , suppose the simplification ordering is based on the ordering

g > f > d > c > a

of the function symbols. We can now apply paramodulation upon the program clause

f (c(g) , c(a)) - d(c(g), c(a)) ~-

using the program clause

g - a * - -

and obtain the new program clause

f (c(a) , c(a)) - d(c(g), c(a)) +--,

(f)

(g)

(f')

334 ULRICH FURBACH ET AL.

which is simpler than (f). The interested reader may verify that the goal ~ f ( x , x) "-

d (x , x) can now be solved without the functional reflexive axioms by using the program clauses (f') and (g) instead of (f) and (g). Furthermore, Peterson shows that in his framework paramodulation has to be applied only upon non-variable occur- rences and subsumption as well as rewriting (using an equation s - t and substitution o- such that at is simpler than as) can be applied as simplification rules. A similar result has been obtained by Hsiang and Rusinowitch [19] for unconditional equational theories, however they require only a simplification ordering which is total on ground terms.

Brand [3] has also shown the completeness of resolution and unrestricted para- modulation without using the functional reflexive axioms. The main issue of Brand, however, are results concerning his modification method. Thus the completeness proof of unrestricted paramodulation is not given directly, but a completeness result of the modification method is used. Since the modification method does not use a paramodulation rule it is difficult to really understand why the functional reflexive axioms are not needed in his case.

Since one aim of this paper is the revival of paramodulation in the context of logic programming we shortly have to comment on an approach which claims to avoid this

rule. In Cox and Pietrzykowski [5] a deduction mechanism, called surface deduction, is

introduced, which "uses equality at the lowest possible l e v e l . . . As a result no special

rules are required to handle the equali ty relation in its f u l l generali ty". However, this is only possible for a simple form of Horn clauses, namely flat clauses. The same idea can be found in Brand [3], where the motivation is made explicit: From the clauses

p(a) +--

a - b ~

the goal ~'p(b) can be proven by paramodulation and resolution. If these clauses are transformed into

p(x) ~ a - x

a - b ~

the same goal +--p(b) is provable by resolution alone. The above transformation, which is called flattening in [5], can be understood as an

anticipation of all possible paramodulation steps during 'compile-time'. A flattened version of the (f)-rule from our example F U N (Section 3.4) looks like the following:

x - d ( y , z ) ~ x - f ( y , z ) A y - e(u) A z - e(v) A u - g A v - a

The flattened version of the goal d(x ' , x ' ) - f ( x ' , x ' ) , which we used for a demonstration of paramodulation and reflection is

~ z ' - d (x ' , x ' ) A z' - f ( x ' , x ' )

HORN EQUATIONAL THEORIES AND PARAMODULATION 335

One resolution step using the substitution { x *-- ~ , ) * - - x , z ~ - " , ' x'} on these clauses

gives us

~ - z ' - f ( x ' , x ' ) A x ' - c(u) A x" - c ( v ) / , u - g / , v - a A z ' - f i x ' , x ' )

from which the clause

*--x" - c(u) A x ' - - C(v) A U -- g A U "-- a

can be derived using factoring and an extra rule, called compression, which simply eliminates literals of the form x - s, whenever x occurs only once within the clause.

This goal clause can easily be solved using the flattened version of our rule g - a ~-. We want to point out that this method does not really avoid equality handling;

however a lot of possibly unnecessary (equality handling) flattening steps have to be

performed. Another drawback of this method seems to be the low-level equality handling: whereas paramodulat ion directly refers to the idea of 'substitution of

something equal' a single surface deduction step does not have such an intuitive meaning. Therefore we can hardly imagine a user of such a logic programming system

really understanding a trace of such a surface deduction based system.

Finally, in [21] it has been shown that each refutation, with respect to paramodu- lation and reflection can be transformed into a refutation with respect to a set of

transformations. These transformations are extensions of the rules introduced by Herbrand [17] and later used by Martelli and Montanari [27] to compute the most

general unifier of two expressions. It is interesting to note, that among the set of transformations there is no rule which corresponds to the use of a functional reflexive

axiom. However, there is a rule such that in our F U N - e x a m p l e , the initial goal clause

, - f ( x , x ) - d ( x , x )

would be transformed into

e -x - c(g), x - c(a) , d ( c ( g ) , c(a)) - d ( x , x )

using program clause

f ( c ( g ) , c(a)) "-- d ( c ( g ) , c(a)) , ,- .

Since the new goal clause contains the equation x - c(g) we can infer that x must be bound to a term equal to c(g) by eliminating the variable x, i.e. we deduce

*--c(g) - c(a) , d ( c ( g ) , c(a)) "-- d ( c ( g ) , c(g)) .

By repeated applications of the term decomposition rule we obtain

* - - g - a , a - g,

which can be solved by using the program clause (g). Similar results have been obtained by Gallier and Snyder [11, 12] and Martelli e t al. [28] for unconditional equational theories.

336 ULRICH FURBACH ET AL.

References

I. Anderson, R., 'Completeness Results for E-resolution', Proc. AFIPS Spring Joint Computer Conference, 36, 653-656 (1970).

2. Apt, K. A., and van Emden, M. H., 'Contributions to the Theory of Logic Programming', J. ACM, 841-862 (1982).

3. Brand, D., 'Proving Theorems With The Modification Method', SIAMJ. Comput. 4, 412-430 (1975). 4. Chang, C. L., and Lee, R. C. T., Symbolic Logic and Mechanical Theorem Proving, Academic Press:

1973. 5. Cox, P. T., and Pietrzykowski, T., 'Incorporating Equality in Logic Programming via Surface Deduc-

tion', Annals of Pure and Applied Logic 31, 177-189 (1986). 6. van Emden, M. H., and Kowaslki, R. A., 'The Semantics of Predicate Logic as a Programming

Language', J. ACM 733-742 (1976). 7. Fribourg, L., 'Oriented Equational Clauses as a Programming Language', J. Logic Programming,

165-177 (1984). 8. Furbach, U., 'Oldy but Goody: Paramodulation Revisited' Proc. GWAI '87 (Morik ed.), Informatik

Fachberichte 152, 195-200 (I987). 9. Gallier, J. H., and Raatz, S., 'SLD-resolution Methods for Horn Clauses with Equality based on

E-unification', Proc. Symposium on Logic Programming, 168-179 (1986). t0. Gallier, J. H., and Raatz, S., 'Extending SLD-resolution to Equational Horn Clauses Using

E-unification'.To appear in J. Logic programming: 1988. 11. Gallier, J. H., and Snyder, W., 'A Complete E-Unification Procedure', Proc. RTA, LNCS 256 (1987). 12. Gallier, J. H., and Snyder, W., 'Complete Sets of Transformations for General E-Unification.' Univ.

of Pennsylvania, Philadelphia: 1987. 13. Giovannetti, E., and Moiso, C., 'A Completeness Result for E-Unification Algorithms Based on

Conditional Narrowing', Proc. Workshop on Foundations of Logic and Functional programming (to appear in LNCS) (1987).

14. Goguen, J. A., and Meseguer, J., 'Equality, Types, and Generics for Logic programming.' J. Logic Programming 179-210 (1984).

15. Goguen, J. A., and Meseguer, J., 'EQLOG: Equality, Types, and Generic Modules for Logic Pro- gramming', in: Logic Programming (DeGroot, Lindstrom, eds.), Prentice Hall, 295-363 (1986).

16. Henschen, L., and Wos, L., 'Unit refutations and Horn sets', J. ACM, 21, 590-604 (1974). 17. Herbrand, J., 'Sur la Th6orie de la D6monstration', Logical Writings (Goldfarb, ed.), Cambridge

(1971). 18. Hill, R., 'LUSH-Resolution and its Completeness', DCI Memo 78, University of Edinburgh (1974). 19. Hsiang, J., and Rusinowitch, M., 'On Word Problems in Equational Theories', Proe. ICALP, LNCS

267, 54-71 (1987). 20. H611dobler, S., 'From Paramodulation to Narrowing'. Proc. 5th International Conference Symposium

on Logic Programming, 327-342 (1988). 21. H611dobler, S.0 'Horn Equality Theories and Complete Sets of Transformations'. Proc. International

Conference on the Fifth Generation Computer Systems, 405-412 (1988). 22. H611dobler, S., 'SLDE-resolution', UniBwM (1988) (submitted). 23. Hullot, J. M., 'Canonical Forms and Unification', Proc. 5th Conf. Automated Deduction, 318-334

(1980). 24. Hussmann, H., 'Unification in Conditional Equational Theories', LNCS 204, 543-553 (1985). 25. Jaffar, L, Lassez, J-L., and Maher, M., 'A Theory of Complete Logic Programs with Equality'. Proe.

FGCS '84, 175-184 (1984). 26. Jaffar, J., Lassez, J-L., and Maher, M., 'A Logic Programming Language Scheme'. In: Logic Program-

ming (DeGroot, Lindstrom, eds.), Prentice Hall, 441-467 (1986). 27. Martelli, A., and Montanari, U., 'An Efficient Unification Algorithm', ACM TOPLAS, 258-282

(1982). 28. Martelli, A., Moiso, C., and Rossi, C. F., 'An Algorithm for Unification in Equational Theories',

Proc. SLP '86, 180-186 (1986), 29. Morris, J., 'E-resolution: An Extension of Resolution to include the Equality Relation'. Proe. IJCAI,

287-294 (1987).

HORN EQUATIONAL THEORIES AND PARAMODULATION 337

30. Kaplan, S., "Fair Conditional Term Rewriting Systems: Unification, Termination and Confluence', IFB 116, 136-155 (1986).

31. Lloyd, J. W., Foundations of Logic Programming, Springer (1984), 32. Peterson, G. E., 'A Technique for Establishing Completeness Results in Theorem Proving With

Equality, SIAM J. Comput. 12, 82-100 (1983). 33. Plotkin, G. D., 'Building-ln Equational Theories', in: Machine Intelligence 7 (Meltzer, Mitchie, eds.),

73-90 (1972). 34. Robinson, G. A. and Wos, L., ~Paramodulation and Theorem Proving in First Order Theories with

Equality', in: Machine Intelligence 4 (Meltzer, Michie, eds.), 135-150 (1969). 35. Robinson, J. A., 'A Machine Oriented Logic based on the Resolution Principle', J. ACM, 23-41

(1965). 36. Robinson, J. A., 'A Review on Automatic Theorem Proving', Annual Symposia in AppliedMathematies,

1-18 (1967). 37. Slagle, J, R., 'Automatic Theorem Proving with Built-in Theories including Equality, Partial Orderings

and Sets', J. ACM 120-135 (1972). 38. Wos, L., 'The Problem of Finding a Strategy to Control Binary Paramodulation', J. Automated

Reasoning, 101 107 (1988). 39. Wos, L., and Robinson, G. A., "Maximal Models and Refutation Completeness: Semidecision

Procedures in Automatic Theorem Proving', in: Word Problems (Boone, Cannonito, Lyndon, eds.), 609-639 (1973).

40. Wos, L., Robinson, G. A., Carson, D., and Shalla, L., "The Concept of Demodulation in Theorem Proving', J. ACM 698-709 (1967).