On Constructive Negation in Logic Programming Teodor Przymusinski
Department of Mathematical Sciences The University of Texas at El Paso (
[email protected])
March 3, 1995
1 Introduction Procedural negation as failure used in logic programming is known to have two important drawbacks: it can only handle ground negative subgoals and it can only be used as a test, i.e., it cannot generate any new bindings for query variables. Although various attempts to correct this problem have been made in the past, only recently a natural and yet powerful solution of this important problem has been proposed in [Cha88] for programs using Clark's completion semantics. In this paper we signi cantly extend Chan's approach and provide it with a more thorough theoretical foundation.1 We rst observe that query answering in logic programming can be viewed as a translation procedure, whose purpose is to translate a given formula Q (a query) into an equivalent equality formula EQ (an answer), where by an equality formula we mean a formula which involves only the equality predicate. The equivalence of Q and EQ is relative to the selected semantics (i.e., the intended meaning) SEM(P) of the program P. For example, the fact that we consider it natural to regard the equality formula EQ(x; y) x = y ^ x 6= a as a full answer to the query Q(x; y) = p(x; y) Partially supported by the National Science Foundation grant #IRI-89-10729, the Army Research Oce grant #27079-ML-SAH and the Swedish National Board for Technical Development grant #90-1676. 1 Following Chan, we refer to the modi ed negation as failure rule as constructive negation to stress the fact that this form of negation is capable of constructing new bindings for query variables. This terminology is not to be confused with constructivism and related notions.
1
about the program P given by fp(x; x) :r(x); r(a) g means that we consider the two formulae Q and EQ as equivalent, subject to the intended meaning SEM(P) that we choose to assign with P. In other words, this means that SEM (P ) j= 8x; y(Q(x; y) EQ (x; y)). This view of query answering in logic programming is strictly more general than the standard one, which is based on answers having the form of individual substitutions. Indeed, on the one hand, answers like the one given above cannot be represented as substitutions. In fact, individual substitutions, in general, cannot represent non-ground negative conditions. On the other hand, if i is one of the substitutions returned by SLD (or SLDNF)resolution in answer to a query Q(x1 ; : : : ; xn ) then we can view it as an equality formula: Ei x1 = x1 i ^ : : : ^ xn = xn i which (if it is sound) must satisfy: SEM (P ) j= 8(Ei ) Q): If 1 ; : : : ; n are all substitutions returned, then the full answer to the query Q is obtained as a disjunction EQ = E1 _ E2 _ : : : _ Em of such individual answers (substitutions) and (if complete) it must satisfy the condition: SEM (P ) j= 8(EQ Q): It is the role of a procedural mechanism to nd { for a given query Q { its equivalent equality formula EQ (an answer) and to establish their equivalence. Unfortunately, given a program P and its semantics SEM(P), not necessarily all formulae (queries) from the language of P are semantically equivalent to equality formulae. This means that not all queries can be { even theoretically { expected to have complete answers. It is therefore crucial to nd out which formulae (queries) are semantically equivalent to equality formulae, i.e. which queries can be fully answered. We call such formulae equality-de nable. Programs with the property that all of its formulae (all queries) are equality-de nable are called equality-de nable programs. In Section 3 we give examples of equality-de nable and non-equalityde nable formulae w.r.t. three semantics of logic programs: Clark's predicate completion COMP(P) [Cla79], the perfect model semantics PERF(P) [Prz88, Prz89b] and the rst order logic semantics FO(P). We also show that a closed formula G is equality-de nable if and only if either G or :G is implied by the semantics. 2
In Section 4, we de ne normal equality formulae { a natural and simple class of equality formulae { and we show that every equality formula is equivalent to a normal equality formula, which we call its normal form. Normal equality formulae are much easier to deal with than general equality formulae. In Section 5 we discuss equality-de nability w.r.t. the three above mentioned semantics. Our rst result shows that if a given formula F is equalityde nable w.r.t. the rst order logic semantics then it is also equalityde nable w.r.t. Clark's semantics and that if F is equality-de nable w.r.t. Clark's semantics then it is also equality-de nable w.r.t. the perfect model semantics. In other words, every query answerable by classical logic is also answerable by Clark's semantics and every query answerable by Clark's semantics is also answerable by the perfect model semantics. The converses of these implications are false. Our second result proves that a rather broad class of programs, namely the class of programs with the bounded term property (cf. [VG89]), is equality-de nable w.r.t. the perfect model semantics. This class includes, in particular, all functionless programs. This means that all queries about such programs admit complete answers, when programs are considered with the perfect model semantics. A similar result for Clark's semantics is false. In Sections 6 and 7 we assume that programs are strati ed and that the perfect model semantics is used. We extend the SLS-resolution (Linear resolution with Selection function for Strati ed programs) de ned in [Prz89b] to SLS-resolution with Constructive negation (SLSC-resolution), by augmenting it with the constructive negation, de ned similarly as in [Cha88]. Individual answers produced by SLSC-resolution (i.e. answers obtained at success nodes of the resolution tree) are simple equality formulae and full SLSC-answers are disjunctions of individual answers. The Subsumption Theorem shows that for equality-de nable programs there are only nitely many (essential) individual answers. We show that SLSC-resolution is always sound w.r.t. the perfect model semantics. Moreover, for equality-de nable programs SLSC-resolution is sound and complete. Since for a resolution procedure (producing answers in the form of equality formulae) equality-de nability is also a necessary condition for completeness, the last result shows that SLSC-resolution is complete whenever it can possibly be so. All these results can be suitably extended onto the class of all logic programs, considered with the wellfounded semantics (see [VGRS90, Prz89a]). In the Appendix we de ne the class of strictly normal equality formulae, 3
a yet more narrow class of equality formulae than the class of normal equality formulae. We show that every equality formula is equivalent to a strictly normal equality formula. Section 2 describes the terminology and notation used. The full version of the paper, including proofs, will appear elsewhere.
2 Notation and De nitions The following two de nitions are essentially taken from [Cha88].
De nition 2.1 (cf. [Cha88]) By an extended literal L we mean any of the following:
(i) an atom p(t1 ; : : : ; tl ) or its negation :p(t1 ; : : : ; tl ), where p is a nonequality predicate; (ii) an equality t1 = t2 , where t1 and t2 are terms; (iii) an inequality 8(t1 6= t2 ), where 8 quanti es some (perhaps none) of the variables occurring in the inequality, and t1 and t2 are terms. Extended literals described in (ii) and (iii) are called (positive or negative, respectively) equality literals.
Clearly, 8(t1 6= t2 ) is equivalent to :9 (t1 = t2 ).
Example 2.1 The following are examples of equality literals: x1 = f (y; g(x2 )); x2 = x3 ; x1 = 6 x3; x =6 g(y; f (t)); 8y (x =6 f (g(y; z))): De nition 2.2 ([Cha88]) By a general logic program P we mean a nite set of universally quanti ed clauses of the form
A
L1 ; :::; Lm
where m 0, A is an atom (not an equality) and Li 's are extended literals. A logic program is positive if none of its clauses contains negative premises.
4
The alphabet of a program P consists of all the constant, predicate, variable and function symbols that appear in P and { in addition { the equality predicate =, predicates true > and false ?, in nitely many variable symbols and in nitely many constant and/or function symbols. It also contains the usual punctuation symbols, connectives (^; _; :) and quanti ers (9; 8). The language LP of P consists of all the well-formed formulae of the so obtained rst order theory. By Clark's Equational Theory (CET) ([Llo84, Kun87]) we mean the following set of (universally quanti ed) axioms, called CET axioms: CET1. X = X ; CET2. X = Y Y = X ; CET3. X = Y ^ Y = Z X = Z ; CET4. X1 = Y1 ^ ::: ^ Xm = Ym f (X1; :::; Xm ) = f (Y1; :::; Ym );for any function f; CET5. X1 = Y1 ^ ::: ^ Xm = Ym (p(X1 ; :::; Xm ) p(Y1 ; :::; Ym )); for any predicate p; CET6. f (X1; :::; Xm ) 6= g(Y1 ; :::; Yn ); for any two dierent function symbols f and g; CET7. f (X1; :::; Xm ) = f (Y1; :::; Ym ) X1 = Y1 ^ ::: ^ Xm = Ym ; for any function f; CET8. t[X ] 6= X; for any term t[X ] dierent from X, but containing X. The rst ve axioms describe the usual equality axioms and the remaining three axioms are called unique names axioms or freeness axioms. De nition 2.3 By a semantics SEM(P) of a program P we mean any consistent ( nite or in nite) set of rst order sentences of LP such that SEM(P) logically implies P and CET, i.e. SEM (P ) j= P [ CET: The semantics of P is thought of as providing the meaning of P. For example, SEM(P) may denote Clark's predicate completion COMP(P) of P [ CET (Clark's semantics [Cla79]) or the set PERF(P) of all sentences satis ed in all perfect models of P [ CET (perfect model semantics [Prz89b]; see also [ABW88, VG89, Prz88]) or SEM(P) may simply be equal to FO(P ) = P [ CET ( rst order logic semantics). 5
3 Equality De nable Formulae and Programs
De nition 3.1 We will call a formula of LP an equality formula if it does
not contain any other predicate symbols except equality, true, and false. As we pointed out before, query answering in logic programming can be viewed as a translation procedure, translating a given formula F (a query) into an equality formula EF (an answer), which is equivalent to F modulo the given semantics SEM(P). It is therefore crucial to know which formulae (queries) admit such a translation in the rst place. We will call such formulae equality-de nable. A program P and its semantics SEM(P) with the property that all of its formulae (i.e., all possible queries) are equalityde nable will be called equality-de nable programs. More formally: De nition 3.2 Let P be a general logic program and let SEM(P) be its semantics. We will say that a formula F of LP with n free variables x1 ; : : : ; xn is equality-de nable w.r.t. SEM(P) if there exists an equality formula EF such that SEM (P ) j= 8x1 ; : : : ; 8xn(F EF ): We will say that the program P is equality-de nable w.r.t. the semantics SEM(P) of P if all formulae of LP are equality-de nable w.r.t. SEM(P). As we will see in the following examples, de nability of formulae greatly depends on the chosen semantics. Example 3.1 Suppose that the program P consists of a single clause: fp(a) g and let the query F be p(x). It easily follows from Corollary 3.2 and Proposition 3.1(ii) that the formula F is not equality de nable w.r.t. FO(P). On the other hand, F is equality-de nable with respect to both COMP(P) and PERF(P), because: COMP (P ) j= 8x (p(x) x = a) and PERF (P ) j= 8x (p(x) x = a): By Proposition 3.1(iii), the program P is equality de nable w.r.t. both Clark's semantics COMP(P) and the perfect model semantics PERF(P). Example 3.2 Suppose that P consists of a single clause: fp(a) p(a)g and let F be p(x). Again, it follows from Corollary 3.2 and Proposition 3.1(ii) that the formula F is not equality de nable w.r.t. FO(P) or COMP(P), but it is equality-de nable with respect to PERF(P), namely: PERF (P ) j= 8x ( p(x) ? ):
6
By Proposition 3.1(iii), the program P is equality de nable w.r.t. the perfect model semantics PERF(P). Example 3.3 Suppose that P consists of clauses: fp(a) g and fp(f (x)) p(x)g and let F be p(x). It can be shown using Theorem 4.1 that the formula F is not equality de nable w.r.t. any of the three semantics PERF(P), COMP(P) or FO(P). Intuitively, there is no way to provide a nite description of all instances of p(x) implied by the semantics. The program P violates the so called bounded term property (see 5.2). Observe, that an instance F of a formula F may be equality-de nable even though F itself is not. For example the formula p(a) in the above example is true and thus it is equality de nable w.r.t. all semantics. Proposition 3.1 (i) A formula F of LP is equality-de nable w.r.t. SEM(P) if all of its atomic subformulae are equality-de nable. (ii) If F is an equality-de nable formula w.r.t. SEM(P) and is a substitution, then F is also equality-de nable. (iii) A program P is equality-de nable w.r.t. the semantics SEM(P) if and only if every atomic formula p(x1 ; : : : ; xn ) of LP is equality-de nable w.r.t. SEM(P). The converse of implication (i) in Proposition 3.1 does not hold as the following example shows. Example 3.4 If P is given by r :p(x) r :q(x) p(a) p(f (x)) p(x) q(b) q(g(x)) q(x) then under both COMP(P) and PERF(P) r 9x (:p(x) _ :q(x)): Since both semantics imply :q(a) the formula F = 9x (:p(x) _:q(x)) is true and therefore it is equality-de nable. Yet, none of its atomic subformulae p(x) or q(x) is equality-de nable (see Example 3.3). 7
A formula is ground if it does not contain any variables and it is closed if all of its variables are bound. Closed formulae are called sentences. The following known result shows that for every closed equality formula E either E or :E is implied by CET. In other words, it states that CET is a complete theory. Theorem 3.1 ([Mal71, KKu87, Mah88]) For every closed equality formula E we have: CET j= E or CET j= :E: Corollary 3.2 A sentence F is equality de nable w.r.t. SEM(P) if and only if either SEM (P ) j= F or SEM (P ) j= :F: The assumption that there are in nitely many constants or functions in the language LP is essential for the validity of Theorem 3.1 and Corollary 3.2 and for the validity of most of the results presented in the paper. However, as recently shown in [She89], some of the results presented in this paper can be obtained without this assumption or by replacing it by some other assumptions (e.g., domain closure assumption). Generally, though, the resulting theory is more complex. Example 3.5 Suppose that the closed equality formula E is given by 9x (x 6= a) and suppose that LP contains only one constant a and no functions. Clearly, E is neither true nor false under CET . Moreover, even though E is clearly an equality de nable sentence, is neither true nor false under any of the three semantics. 2
4 Normal Equality Formulae In this section we de ne normal equality formulae and we show that every equality formula E is equivalent to a normal equality formula NE , which we will call a normal form of E. Normal equality formulae are special forms of equality formulae, which are much easier to deal with than general equality formulae. The results contained in this section are closely related to those obtained independently by M. Maher [Mah88] and can also be viewed as a re nement of the previous work by Malcev [Mal71] (see also [KKu87]). Consult [She89] for an interesting comparison of various approaches. In the Appendix we de ne a yet more narrow class of equality formulae, called strictly normal equality formulae and we show that every equality 8
formula is equivalent to a strictly normal equality formula. However, the notion of a strictly normal formula is not essential for the understanding of the rest of the paper. The following de nition is inspired by [Cha88].
De nition 4.1 A formula S of LP will be called a simple equality formula if it has the form: S = 9 (L1 ^ : : : ^ Ln); n 0; where the Li 's are equality literals (see De nition 2.1 ) and 9 quanti es over some (perhaps none) of the variables occurring in the Li 's. An empty conjunction is identi ed with true. A disjunction F of simple equality formulae:
F = S1 _ : : : _ Sm ; m 0; is called a normal equality formula. An empty disjunction is identi ed with false.
Clearly, every normal equality formula is an equality formula.
Example 4.1 The following is an example of a normal equality formula: N (x; y) = 9t (x = f (t) ^ 8s(x 6= f (g(s; y)))) _ 9z (z = f (y) ^ x 6= g(z)): The next theorem shows that every equality formula can be equivalently represented as a normal equality formula. This generalizes a similar result obtained in [Cha88] for special types of equality formulae.
Theorem 4.1 (Equality Transformation Theorem) For every equality formula E with n free variables x1 ; : : : ; xn there exists a normal equality formula NE such that:
CET j= 8x1 ; : : : ; 8xn(E NE ): Moreover, there exists an algorithm which for any equality formula E produces an equivalent normal equality formula NE . We will call NE a normal form of F.
9
Example 4.2 The equality formula: E (x; y) = 9z8t((x = g(z) ^ z 6= f (t)) _ (x = z ^ z 6= g(t)))
is equivalent to a normal formula: NE (x; y) = 9z(x = g(z) ^ 8t(z 6= f (t))) _ 9x(x = z ^ 8t(z 6= g(t))): Every equality-de nable formula must therefore be equivalent to a normal equality formula. Corollary 4.2 Let P be a general logic program and let SEM(P) be its semantics. A formula F of LP with n free variables x1 ; : : : ; xn is equality-de nable w.r.t. SEM(P) if and only if there exists a normal equality formula NF such that SEM (P ) j= 8x1; : : : ; 8xn (F NF ): A program P is equality-de nable w.r.t. the semantics SEM(P) if and only if all formulae of LP are de nable w.r.t. SEM(P) by means of normal equality formulae.
5 De nability of Programs vs. Their Semantics In this section we compare equality-de nability for three semantics: Clark's predicate completion semantics COMP(P) [Cla79], the perfect model semantics [Prz89b] and the rst order logic semantics FO(P). Our rst theorem shows that every formula which is equality-de nable w.r.t. rst order semantics is also equality-de nable w.r.t. Clark's semantics and that every formula which is equality-de nable w.r.t. Clark's semantics is also equality-de nable w.r.t. the perfect model semantics. Theorem 5.1 Suppose that P is a general logic program and F is a formula of LP . If F is equality-de nable w.r.t. FO(P) then F is equality-de nable w.r.t. COMP(P). If F is equality-de nable w.r.t. COMP(P) then F is equality-de nable w.r.t. PERF(P). In particular, if the program P is equality-de nable w.r.t. Clark's semantics, then it is also equality-de nable w.r.t. the perfect model semantics. Examples 3.1 and 3.2 show that the converse of the above theorem is false. Our second result proves that a rather broad class of programs, namely the class of programs with the bounded term property (cf. [VG89]), is equality-de nable w.r.t. the perfect model semantics. This class, in particular, includes all functionless programs. 10
Theorem 5.2 Suppose that P is a functionless general logic program or {
more generally { suppose that P has the bounded term property. Then, the program P is equality-de nable w.r.t. the perfect model semantics PERF(P).
Example 3.2 shows an analogous result is false for both Clark's semantics and the classical semantics.
6 SLS-resolution with Constructive Negation In this section we extend the SLS-resolution (Linear resolution with Selection function for Strati ed programs) de ned in [Prz89b] to SLS-resolution with Constructive negation (SLSC-resolution), by augmenting it with the constructive negation, de ned similarly as in [Cha88]. SLSC-resolution can be viewed as a procedure to translate a given query Q into an equality formula FQ , which is equivalent to Q, w.r.t the perfect model semantics PERF(P). The formula FQ is called the full SLSC-answer to Q and is de ned as a disjunction of (individual) SLSC-answers, which are simple equality formulae generated at all success nodes of the resolution tree. Therefore, full SLSC-answers are normal equality formulae. Throughout this and the following section we consider only strati ed programs [ABW88, VG89] and de nability always refers to de nability w.r.t. the perfect model semantics PERF(P) [Prz89b]. As shown in the next section, SLSC-resolution is always sound w.r.t. the perfect model semantics and it is sound and complete for equality-de nable programs. Since a query must be equality-de nable in order to be equivalent to an equality formula, the latter result shows that SLSC-resolution is complete for all programs for which it can possibly be complete. Suppose that P is a strati ed program, S is the set of all non-equality predicate symbols of P and fS1 ,...,Sn g is a strati cation of P2 . For any nonequality atom A let stratum(A)=i, where i is the unique integer such that the predicate symbol of A belongs to Si and let stratum(:A) = stratum(A)+1. For equality literals L we de ne stratum(L)=1. A goal G is a headless clause L1 ,..., Lk , where k0 and Li 's are extended literals. We also write, G = Q, where Q = L1 ,..., Lk . We call Q a query and often use it interchangeably with G. When de ning strati cation of P we take into consideration only non-equality predicates. 2
11
We de ne stratum(G) as follows:
(
; stratum(G) = 0max fstratum(Li) : i = 1; :::; kg;
if G is empty; otherwise.
For example, if G = A(x); :B (x; g(y)), x 6= y and stratum(A) = stratum(B) = 2, then stratum(G) = 3.
De nition 6.1 ([Cha88]) Suppose that is some substitution for free variables in 8(t1 = 6 t2 ). The inequality 8(t1 6= t2) is valid if t1 and t2
cannot be uni ed. It is satis able if t1 and t2 cannot be uni ed by binding only universally quanti ed variables.
Example 6.1 If is fxjg(t)g then the inequality 8y (x 6= f (y)) is valid. The inequality 8y (x 6= g(f (y))) is satis able, but not valid. The inequality 8y(x = 6 g(y)) is not satis able. From now on we assume that R is any xed computation rule (see [Llo84]), i.e. a rule that selects exactly one literal from every non-empty goal G. The only restriction imposed on R is that it never selects inequalities 8 (t1 6= t2 ), which are satis able, but not valid, relative to the current substitution for the free variables in 8 (t1 6= t2 ). Now we are ready to de ne SLSC-resolution. For simplicity, we will assume that the program P is equality-de nable. However, as it will be pointed out at the and of this section, this assumption is not necessary.
De nition 6.2 (De nition of SLSC-resolution) Let P be a strati ed
program, R any xed computation rule and let G = Q be any goal with variables x1 ; : : : ; xn . By induction on the stratum(G), we will de ne the following:
| SLSC-tree T(G) for G; | Success leaves of T(G); | SLSC-answers A(x1 ; : : : ; xn ) for G, which are simple equality formulae associated with success leaves of T(G); and
| Full SLSC-answer FG(x1 ; : : : ; xn ) for G, which is a normal equality
formula that provides a complete answer to G, and is obtained by taking a disjunction of all relevant SLSC-answers.
12
If stratum(G)=0, then G must be an empty clause 2. In this case, we de ne the SLSC-tree T(G) to consist of only one node, namely G itself. Its only leaf, G, is a success leaf with the associated SLSC-answer true. The full SLSC-answer FG is also de ned to be true. Assume now that G is a goal such that stratum(G)=m, m > 0, and that SLSC-trees { and the associated notions listed above { have already been de ned for all goals G0 , whose strata are less than m. The root node of T(G) is G itself. If H = L1 ; : : : ; Lk is any node of T and L = Li is the literal selected from H using the rule R, then the immediate descendents (successors) of H in T(G) are de ned as follows:
If L is a positive, non-equality literal, then the immediate descendents
of H are { as usual { all goals K that can be obtained from the goal H by resolving H with (a variant of) one of the program clauses upon the literal L, using most general uni ers. If there are no such K's, then H has no immediate descendents;
If L is the equality t1 = t2, and t1 and t2 are uni able by a most general
uni er , then the immediate descendent of H is the goal K obtained by applying the substitution to H and removing L. If t1 and t2 are not uni able, then H has no immediate descendents;
If L is the inequality 8(t1 6= t2) and if L is valid (relative to the current substitution), then the only descendent of H is K = H ? fLg, i.e. H with L removed. If L is unsatis able, then H has no descendents3 ;
If the selected literal L is negative and is not an inequality, then L = :A, where A is a non-equality atom with variables z1 ; : : : ; zl .
By the de nition of strati cation, stratum(A) < m, and therefore stratum(G0) < m, where G0 is the goal G0 = A. Consequently, the SLSC-tree T 0 = T (G0 ) for G0 and the full answer FG0 (z1 ; : : : ; zl ) for G0 have already been de ned. By Theorem 4.1 there is an algorithm that enables us to nd a normal equality formula K (z1 ; : : : ; zl ) = 9K1 _ : : : _ 9Kq equivalent to :FG0 , i.e. such that
CET j= 8z1 : : : 8zl (K (z1 ; : : : ; zl ) :FG0 (z1 ; : : : ; zl )); where 9Ki 's are simple equality formulae. We consider three cases:
3
Recall that R selects only valid or unsatis able inequalities.
13
{ if K = true, then the only immediate descendent of H is H ?fLg,
i.e. the goal H with L removed; { if K = false, then H has no immediate descendents; { otherwise, q > 0 and H has q immediate descendents Hj , 1 j q, of the form:
Hj = L1 ; : : : ; Li?1 ; Kj ; Li+1 ; : : : ; Lk :
Finally, if H = L1 ; : : : ; Lk is empty or contains only satis able, but
not valid inequalities Lj , then H has no immediate descendents and is a success leaf. Its associated SLSC-answer A(x1 ; : : : ; xn ) for G is a simple equality formula de ned as:
A(x1 ; : : : ; xn ) = 9 (x1 = x1 ^ : : : ^ xn = xn ^ L1 ^ : : : ^ Lk ) where is the substitution, obtained as a composition of the previously applied most general uni ers, and 9 quanti es over all free variables not in G. We now de ne the full SLSC-answer formula FG (x1 ; : : : ; xn ) for G. By Theorem 6.1 below there exist nitely many SLSC-answers Ai (x1 ; : : : ; xn ); 1 i r, for G such that any other answer A for G is a logical consequence of the disjunction of the answers Ai , 1 r. We de ne the full SLSC-answer FG (x1 ; : : : ; xn ) for G to be the normal equality formula obtained as a disjunction of the Ai 's:
FG (x1 ; : : : ; xn) = A1 (x1 ; : : : ; xn ) _ : : : _ Ar (x1 ; : : : ; xn ):
Theorem 6.1 (The Answer Subsumption Theorem) Let P be an
equality-de nable strati ed program, R any xed computation rule and let
G = Q be any goal with variables x1 ; : : : ; xn . There exist nitely many SLSC-answers A1 (x1 ; : : : ; xn ); : : : ; Ar (x1 ; : : : ; xn ) for G such that for any other SLSC-answer A(x1 ; : : : ; xn ) for G: _r CET j= 8 ( Aj (x1 ; : : : ; xn) A(x1 ; : : : ; xn )): j =1
Any two full answers produced by SLSC-resolution are equivalent. 14
Theorem 6.2 Suppose that P is an equality-de nable strati ed program and
Q is a query. Any two full SLSC-answers FQ and FQ0 to a query Q are equivalent, i.e. CET j= 8 (FQ FQ0 ):
Example 6.2 Suppose that the program P is de ned as follows (cf. [VG89,
Prz89b]):
edge(a; b) edge(c; d) edge(d; c) reachable(a) reachable(x) unreachable(x)
reachable(y); edge(y; x) :reachable(x)
and suppose that the top goal is G = unreachable(x). Then we obtain the following SLSC-derivation: G |