Semantics for Disjunctive Logic Programs with ... - Semantic Scholar

Report 2 Downloads 146 Views
Semantics for Disjunctive Logic Programs with Explicit and Default Negation Jack Minker

Carolina Ruiz

Department of Computer Science Institute for Advanced Computer Studies University of Maryland. College Park, MD 20742 U. S. A. fminker, [email protected]

Abstract

The use of explicit negation enhances the expressive power of logic programs by providing a natural and unambiguous way to assert negated information about the domain being represented. We study the semantics of disjunctive programs that contain both explicit negation and negationby-default, called extended disjunctive logic programs. General techniques are described for extending model, xpoint, and proof theoretic characterizations of an arbitrary semantics of normal disjunctive logic programs to cover the class of extended programs. Illustrations of these techniques are given for stable models, disjunctive well-founded and stationary semantics. The declarative complexity of the extended programs, as well as the algorithmic complexity of the proof procedures and xpoint operators, are discussed.

1 Introduction The purpose of this paper is to study, in a comprehensive manner, di erent aspects of extended disjunctive logic programs (edlps for short), that is, programs whose clauses are of the form l1 _ ::: _ lk lk+1 ; :::; lm; not lm+1 ; :::; not ln , where l1 ; :::; ln are literals (i.e. atoms and explicitly negated atoms), and not is a negation-by-default operator. The use of explicit negation in logic programs has been motivated by the need to deal with negated information in a natural and unambiguous way. It  This

paper is an extended version of [MR93].

1

constitutes another step in the development of logic programming as an approach to the use of logic in knowledge representation and reasoning. When initially conceived, logic programs containing only Horn clauses were considered. A Horn clause is a clause either of the form: \a b1 ; : : :; bm " called a de nite Horn clause, or of the form: \ b1 ; : : :; bm " where a; b1; : : :; bm are atoms and m  0. The semantics of de nite Horn programs is well understood (see [vEK76, Llo87]) and is captured by the unique minimal Herbrand model of the program. It is clear that since only positive atoms may occur in (the heads of) Horn clauses, no negated information can be inferred from these programs unless some strategy or rule for deriving negated information is adopted. Two rules for negation were proposed initially for de nite Horn programs: The Closed World Assumption (CWA) [Rei78] which states that an atom can be assumed to be false if it does not belong to the minimal Herbrand model of the program; and the Clark completion theory [Cla78] which assumes that the de nition of each atom in a program is complete in the sense that it speci es all the circumstances under which the atom is true and only such circumstances, so the atom can be inferred false otherwise. Having a rule for negation, it is plausible to extend Horn clauses to make use of negated information. This is the purpose of the so-called negation-by-default operator not , which may appear in the bodies of clauses. These clauses are called normal clauses and are of the form: \a b1 ; : : :; bm; not c1 ; : : :; not cn " where a; b1; : : :; bm ; c1; : : :; cn are atoms and m; n  0. This kind of negation is limited, however, in the sense that not p does not refer to the presence of knowledge asserting the falsehood of the atom p but only to the lack of evidence about its truth. Indeed, some authors have translated not p as \p is not believed" [IKH92], \p is not known" [Gel87], and \there is no evidence that p is true " [FLMS93], in addition to the common interpretation \p is not provable from the program in question". In contrast to the Horn case, there is no agreement on a unique semantics for normal programs since there can be as many di erent semantics as there are ways to interpret the meaning of not. Among the proposed semantics are the stable model semantics [GL88], the well-founded semantics (WFS) [VGRS88] and the generalized well-founded semantics (GWFS) [BLM89]. There is, however, a special subclass of normal logic programs for which there is agreement on the semantics. The programs in this subclass are called strati ed and are characterized by the fact that the set of clauses of each of them can be partitioned into strata in such a way that all the positive (resp. negated-bydefault) atoms in the body of a clause in the ith stratum are de ned in strata lower than or equal to (resp. strictly lower than) i. This property enables a strati ed evaluation of negated information to take place. Apt, Blair and Walker [ABW88] and Van Gelder [VG88] described this class of logic programs. Chandra and Harel [CH85] described strati ed theories earlier. The meaning of strati ed programs is given by the perfect Herbrand model semantics [Prz88b]. 2

In fact, all the semantics previously mentioned for general normal logic programs coincide with the perfect Herbrand model semantics on the subclass of strati ed programs. Another generalization of Horn clauses that allows disjunctions of atoms in the heads of clauses has been studied extensively (see [LMR92]). These clauses are called disjunctive clauses and are of the following form: \a1 _ : : : _ ak b1; : : :; bm " where a1 ; : : :; ak; b1; : : :; bm are atoms and k; m  0. The meaning of such a program is captured by its set of minimal Herbrand models. Several rules for negation have been introduced for disjunctive logic programs: the Generalized Closed World Assumption (GCWA) [Min82] which assumes that an atom is false when it does not belong to any of the minimal Herbrand models of the program, the Extended Generalized Closed World Assumption (EGCWA) [YH85] which applies exactly the same criterion of the GCWA but to conjunctions of atoms instead of only atoms (see Sect. 2.2) and the Weak Generalized Closed World Assumption (WGCWA) [RLM89] (or equivalently, the Disjunctive Database Rule (DDR) [RT88]) which states that an atom can be assumed to be false when it does not appear in any disjunction derivable from the program. Negated information can be introduced in disjunctive clauses in the same fashion as in Horn clauses. The resulting clauses are called normal disjunctive clauses and are of the form: \a1 _ : : : _ ak b1; : : :; bm ; not c1; : : :; not cn " where a1; : : :; ak ; b1; : : :; bm; c1; : : :; cn are atoms and k; m; n  0. There are also various di erent semantics proposed for normal disjunctive logic programs (henceforth, denoted by ndlps), among others, the stable disjunctive model semantics [Prz91], the disjunctive well-founded semantics (DWFS) [Bar91], the generalized disjunctive well-founded semantics (GDWFS) [BLM90a, BLM90b], WF 3 [BLM91], and the stationary semantics [Prz90b]. It is worth noting that normal clauses are particular cases of disjunctive normal clauses. Therefore any semantics de ned for the class of normal disjunctive logic programs is also a semantics for the class of normal logic programs. As mentioned before, negation-by-default is limited and an alternative to overcome some of the diculties of dealing with negated information is to make use of explicit negation in addition to negation-by-default. In this way, the expressive power of logic programs is increased since the user is now allowed to state not only when an atom is true but also when it is false (without any ambiguity or default interpretation). Clauses obtained by using the explicit negation operator ()1 are called extended disjunctive clauses and are of the following form: \l1 _ ::: _ lk lk+1 ; :::; lm; not lm+1 ; :::; not ln ;" where l1 ; :::; ln are literals (i.e. atoms and explicitly negated atoms), 0  k  m  n. Hence, extended disjunctive clauses contain two forms of negation: explicit and default. Previous contributions in the area of extended logic programming include 1 Explicit negation () di ers from classical negation (:) as will be described later. This negation has also been called strong negation (see e.g. [Wag91]) because of its closeness to the negation introduced by Nelson [Nel49]. It has also been called classical negation by Gelfond and Lifschitz [GL90].

3

the following: Pearce and Wagner [PW89] added explicit negated information to Prolog programs. They showed that there is no need to alter the computational structure of Prolog to include explicit negation since there is a way to transform extended programs to programs free of explicit negation which preserves their meaning. Gelfond and Lifschitz [GL90] extended the stable model semantics to cover explicit negation. Przymusinski [Prz90b] generalized this extended version of the stable model semantics to include disjunctive programs. Alferes and Pereira [AP92] provided a framework to compare the behavior of the di erent semantics in the presence of these two kinds of negation. Table 1 summarizes the main developments in logic programming described above. This table adds to similar tables appearing in [Lob91, LMR92]. In this paper we describe an improved way to translate edlps into (explicit negation-free) ndlps which captures naturally the intended meaning of the original programs. This translation, called the prime{?-transformation , makes it possible to give simple and elegant model, xpoint and proof theoretical characterizations of a semantics of edlps and makes it easy to prove that these three characterizations are equivalent. Furthermore, inconsistencies in the semantics of an edlp are pinpointed by the transformation making them easy to locate and to correct. Integrity constraints external to the program are no longer necessary to detect these inconsistencies. Also, the complexity of computing a semantics of an edlp can be straightforwardly expressed in terms of the complexity of computing the meaning of the translation of the program. Similarly, complexity results known for the class of ndlps can be easily generalized to the extended case. The paper is organized as follows: Section 2 explains how to obtain alternative semantics for edlps by extending the semantics known for the class of ndlps. Since the techniques used are general enough to be applied to any semantics of ndlps we will describe them in terms of a generic such semantics which we call SEM . Section 2.1 describes a standard procedure to extend the model theoretical characterization of SEM to the whole class of edlps. It includes also an illustration of this technique for the case of the stable model semantics. Section 2.2 constructs a xpoint operator to compute the extended version of a semantics SEM in terms of a xpoint operator which computes the restriction of this semantics to ndlps. Existence of xed-points and the complexity of the extended xpoint operator are discussed. Illustrations are given for the minimal Herbrand models semantics of disjunctive logic programs, the DWFS and the stationary semantics. Section 2.3 describes a procedure to answer queries with respect to edlps and an arbitrary semantics SEM . This procedure uses as a subroutine, a procedure to answer queries with respect to the restriction of SEM to ndlps. Also, the algorithmic complexity of the extended proof procedure is analyzed. Section 3 studies the complexities of some fundamental problems related to edlps. Finally, Section 4 contains a table summarizing the results of this paper and some conclusions. 4

SEMANTICS

THEORY

Positive Consequences Fixpoint Model

Proof Proc.

Negation

TP

HORN REFERENCE [vEK76] [vEK76]

Least Model SLD

[Hil74]

Theory

CWA

[Rei78]

Rule

NAF

[Cla78]

SLDNF

[Cla78]

TP

[ABW88]

Proof Proc.

Standard Perfect SLS

[ABW88] [Prz88b] [Prz89b]

Fixpoint Model

Well-Founded [VGRS88] MW F (P ) [VGRS88]

Proof Proc.

Strati ed Programs Fixpoint Model

Normal Programs

Proof Proc. Fixpoint Model Proof Proc. Fixpoint Model Proof Proc.

I1

SLS [Ros89a, Prz89a] General Well-Founded IE [BLM89] MPE [BLM90a] SLIS [BLM90b] Stable Models TPM [FLMS93, IKH92] Stable [GL88] SLP [FL93]

Extended Programs

DISJUNCTIVE THEORY REFERENCE

TPI

Min. Models Model-State SLI/SLO Case Based

[MR90] [Min82] [LMR89] [MZ82, LMR89] [RLS91]

GCWA WGCWA SN-rule NAFFD-rule SLONF

[Min82, MR90] [RT88, RLM89] [MR88] [RLM89] [LMR89]

TPC TPI

[MR90] [RT88, MR89] [MR89] [Prz88a] [FL93]

Stable State Perfect SLP

Strong/Weak Well-F/Stationary

MWS=W F (P ) MP

General Disjunctive Well-Founded S ED [BLM90b] MSPED [BLM90a] SLIS [Prz90b] Stable Models TPM [FLMS93, IKH92] Stable [Prz90a, Prz91] SLP [FL93]

Stable Models

Fixpoint Model Proof Proc.

Stable

Fixpoint Model Proof Proc.

Stationary

[Ros89b] [Prz90b]

Stable Models

[GL90, GL91] Stationary

Stable

[Prz90a, Prz91] Stationary

[AP92]

Figure 1: Summary of Results in Logic Programming 5

2 Semantics for Edlps Alternative semantics for edlps can be obtained by extending the semantics known for the class of ndlps. In this section we describe how this may be accomplished. First, we formalize the de nition of extended disjunctive logic programs and introduce notation needed in the following sections. De nition 2.1 An extended disjunctive logic program, edlp, is a (possibly in nite) set of clauses of the form: l1 _ ::: _ lk lk+1 ; :::; lm; not lm+1 ; :::; not ln , where l1 ; :::; ln are literals (i.e. atoms and explicitly negated atoms), 0  k  m  n and not is the negation-by-default operator. Example 2.1 The following is an extended disjunctive logic program: P = f a_e c a ; not b ; b e ; b e ; not c ; a not a g: Since a non-ground clause is equivalent to the set of all its ground instances, we consider here only ground programs (i.e. propositional programs). This is done only to simplify the notation without any loss of generality. Given a propositional program P, LP denotes the underlying propositional language of P, and L denotes the set of all literals (i.e. propositional symbols and explicitly negated propositional symbols) that can be constructed from LP . In the context of ndlps, DHB P (resp. CHB P ) denotes the disjunctive Herbrand base (resp. conjunctive Herbrand base ) of P, that is, the set of equivalence classes of disjunctions (resp. conjunctions) of propositional symbols appearing in P modulo logical equivalence. This notion is generalized to edlps by DLP (resp. CLP ), the set of equivalence classes of disjunctions (resp. conjunctions) of literals in L modulo logical equivalence.2 We assume the convention that any occurrence of p is simpli ed to p and that explicit negation satis es the De Morgan laws, namely, (p _ q) =p^ q and (p ^ q) =p_ q for every propositional symbols p and q. Since there are now two di erent notions of falsehood in extended programs, we distinguish between them by saying that, with respect to some semantics SEM , a sentence ' is false-by-default in an edlp P if P j=SEM not ('), i.e. when ' is assumed to be false by the particular default rule for negation used by the semantics; and is explicitly false (or simply false ) if P j=SEM  '. Thus, we extend each semantics to include a new truth value: explicit falsehood . Notice, however, that these two truth values may overlap, i.e., there may be cases in which a sentence ' is simultaneously false and false-by-default. In particular, it is the case that P j=SEM ' implies P j=SEM not (') as it will be clear later in this paper. 2 For simplicity, we write d as an abbreviation for the equivalence class [d].

6

It is important to remark here that an edlp may contain three kinds of data: propositional symbols, negated-by-default propositional symbols, and explicitly negated propositional symbols, whereas an ndlp only contains data of the rst two kinds. Therefore in order to extend an ndlp semantics SEM to edlps we need to expand it to work also with explicit negation. There are two alternatives to do so: either we explicitly add to the de nition of SEM how to deal with explicitly negated propositional symbols, or we nd some way to transform an edlp into one without explicit negation, i.e. an ndlp, in such a way that the semantics of the obtained ndlp under SEM corresponds to the intended meaning of the original edlp. We describe standard techniques to accomplish both approaches in such a way that the results coincide. Since the techniques to be explained are general enough to be applied to any semantics of ndlps we describe them in terms of a generic such semantics which we call SEM . For clarity, we will call XSEM the extended version of SEM obtained by using the rst approach. In addition, we will illustrate the application of these techniques to the stable model semantics (covering in this way the perfect model semantics), the minimal models semantics for disjunctive logic programs, the DWFS (which covers the WFS), and the stationary semantics.

EDLP

Prime{? Transformation

NDLP SEM

XSEM

SEMANTICS OF THE NDLP

SEMANTICS OF THE EDLP

REVISED SEMANTICS OF THE NDLP

Neg Transformation

Figure 2: Approaches to extend ndlps Semantics to edlps. Figure 2 schematizes the two approaches. There are two di erent paths in the diagram from an edlp to its semantics: The left-hand path corresponds 7

to the rst approach in which we take the edlp and we apply the extended semantics XSEM to it, whereas on the right-hand path we rst transform the program into a normal disjunctive one, we compute the meaning of this program with respect to SEM , then we revise it to detect inconsistencies and nally we translate the result back to the original language of the edlp as described in the second approach above. We say that this diagram commutes when the results of both approaches coincide, i.e., when both paths yield the same semantics for the original edlp. In what follows we explain in detail each step in Figure 2. On the right-hand path we transform an edlp into an ndlp using the fact that extended programs enable us not only to state when a propositional symbol p holds but also when  p holds, and in this sense one can regard p and  p as di erent propositional symbols which happen to be opposite (i.e. they cannot both be true or both be false at once). Using this idea, Pearce and Wagner in [PW89] and Gelfond and Lifschitz in [GL91] showed how to transform extended normal clauses into normal clauses. This is done by representing every negated literal p in a program by a new propositional symbol, say p0 . Formally, we de ne the prime transformation l0 of a literal l to be:  0l = p;0 if l = p for some p 2 LP p ; if l =p for some p 2 LP Notice that if we apply this prime transformation to every literal occurring in an edlp P, we obtain a normal disjunctive logic program P 0. By convention, the underlying language of P 0 is taken to be L0 = fl0 : l 2 Lg. However, the obtained P 0 is not enough to capture the intended meaning of P since, with the introduction of negated propositional symbols in the heads of the clauses, it is possible to specify inconsistent theories, that is, to describe situations in which some propositional symbol p and its negation  p (or p0 ) are true simultaneously. Therefore, we must state the restriction that p and p0 are in fact opposite propositional symbols. To do so, we introduce the prime{? transformation on edlps as follows: Given an edlp P, the prime{? transformation of P, P?0 , is de ned as the following ndlp: P?0 = P 0 [ f? p; p0 jp is a predicate symbol in LP g where ? is a new predicate symbol not in LP . Informally, ? represents falsehood or inconsistency. The purpose of introducing the symbol ? is to explicitly mark when an inconsistency has been reached in the semantics of the program. The underlying language of P?0 is taken to be L0? = L0 [ f?g. Therefore, once the semantics SEM of P?0 is obtained, we need to revise it in order to detect and correct inconsistencies. Finally, we translate the revised semantics of P?0 to the original language of P using the neg transformation (:) which is de ned on elements l of L0 by:  if l = p for some p 2 LP l = p; p; if l = p0 for some p 2 LP 8

and can be extended to clauses in the usual way. Since we want both paths of the diagram to coincide, the de nition of XSEM should simulate, somehow, the right-hand path of the diagram (without using the transformations). It can be easily achieved by extending the de nition of SEM in such a way that negated atoms are treated just as if they were new propositional symbols, and solving inconsistencies as it is done in the revision step on the right-hand path of the diagram. An advantage of having a separate step to correct inconsistencies instead of correcting them simultaneously with the computation of the semantics of the program is that di erent approaches to deal with inconsistencies may be incorporated at this stage without altering the general structure of Figure 2. The speci c details of each step of the process vary according to the characterization (model theoretic, xpoint or proof theoretic) of SEM being used and are the topic of the following subsections. We concentrate on the study of 3-valued semantics for edlps. In this way, the results in this paper apply also to the case of reasoning with incomplete knowledge. The use of 3-valued semantics clearly implies that the law of the excluded middle does not necessarily hold for explicit negation, i.e., there may be cases in which P 6j=SEM p_  p. Obviously then, explicit negation di ers from classical negation which, being de ned for a 2-valued logic (namely, classical logic), satis es the mentioned law. More fundamental di erences between explicit and classical negation are noted in the following sections3 .

2.1 Model Theory Semantics

In this section we describe a standard procedure to extend an arbitrary model theoretic semantics of normal disjunctive logic programs to the whole class of extended disjunctive logic programs. In Section 2.1.1 we illustrate the use of the technique for the stable model semantics. We denote by interpretation any subset of the set of literals L, and we call an interpretation consistent only if it does not contain any pair of opposite literals, say p and  p. The prime and neg transformations of interpretations are de ned as expected: if M  L then M 0 = fl0 : l 2 M g and if N  L0 then N  = fl : l 2 N g. Interpretations which agree with a given program (in the sense of the following de nition) are called models of the program.

De nition 2.2 Let P be an edlp and let M  L. Then M is a model of P i 1. M is consistent, and

3 Indeed, if desired, the law of the excluded middle for explicit negation could be forced to hold by simply adding to P the set of clauses fp_ p j p 2 LP g.

9

2. for each program clause l1 _ ::: _ lk lk+1 ; :::; lm; not lm+1 ; :::; not ln in P, if lk+1 ; :::; lm 2 M and lm+1 ; :::; ln 62 M then there exists i; 1  i  k, such that li 2 M. The following lemma establishes some relationships between the models of an edlp P and the models of P 0.

Lemma 2.1 Let P be an edlp, Q be an ndlp, M be an interpretation of P , and N be an interpretation of Q. The following statements hold: 1. M is a model of P i M 0 is a model of P 0. 2. N is a model of Q i N  is a model of Q .

Proof: Immediate consequence of De nition 2.2. Notice that an inconsistent edlp P (i.e. a program from which some p and its negation  p are both derivable) has no models. In classical logic, every formula is deducible from an inconsistent set of axioms and, in accordance with it, we declare the set of all literals L as the meaning of an inconsistent program. Hence, we must extend the de nition of a model to cover such cases.

De nition 2.3 Let P be an edlp and let M  L. Then M is an extended{model of P i either M = L, or M is a model of P. Using this de nition, it is easy to characterize the inconsistent edlps as those whose only extended{model is L. Let Q be an ndlp and let P be an edlp; MSEM denotes the set of models Q which characterizes the semantics SEM of Q and MXSEM denotes the set of P extended{models which characterizes the semantics XSEM of P. For instance, if SEM is the stable model semantics then Mstable is the set of all stable models of Q xstable Q and MP is the set of all stable extended{models of P (see Section 2.1.1). We now describe in detail the steps in Figure 2 corresponding to the model theoretic characterization of SEM . For an illustration see Section 2.1.1. On the right-hand path of the diagram, applying the de nition of SEM to the prime{? transformation of an edlp P corresponds to computing MSEM P . This set can be partitioned into two parts: one containing the consistent models and the other containing the inconsistent models, i.e. the ones in which ? appears, as follows: SEM consistent(MSEM P ) = fM 2 MP j? 62 M g SEM inconsistent(MSEM P ) = fM 2 MP j? 2 M g 0 ?

0 ?

0 ?

0 ?

0 ?

SEM After computing MSEM P , the revision step can be described as: If MP 0 is not empty and all the models in it are inconsistent then P? is inconsistent 0 ?

0 ?

10

and so its revised semantics is fL0g. Otherwise, only the consistent models in are kept in the revised semantics of P?0 . More formally, the revised MSEM P semantics of P?0 is de ned as: 8 > = ;: If MSEM P ) 6= ;: P : fL0g Otherwise. On the left-hand path of the diagram, the model theoretic de nition of XSEM to compute MXSEM is obtained by modifying the corresponding defP inition of SEM by means of the following set of instructions: 1. Apply the de nition of SEM to P as if each literal in P were a propositional symbol (that is, as if P were an ndlp containing some propositional symbols which happen to begin with the character ) to obtain a set I of interpretations of P. 2. Replace the inconsistent interpretations in I by L. 3. The set of extended{models characterizing the meaning of P under XSEM is de ned by:  fLg If I = fLg: MXSEM = P I ? fLg Otherwise. 0 ?

0 ?

0 ?

0 ?

0 ?

In the case that MXSEM = fLg we say that P is inconsistent w.r.t. XSEM , P and in the case that MXSEM = ; we say that P is incoherent w.r.t. XSEM . P Not surprisingly we obtain the following result. Proposition 2.2 For any edlp P , the following diagram commutes:

P

Prime{? Transf.

P?0 SEM

XSEM

MXSEM P

MSEM P?0

Neg Transf. 11

revised(MSEM P?0 )

 i.e. MXSEM = (revised(MSEM P P )) . 0 ?

Proof: Clear from the de nitions of XSEM and the revision of the semantics of P?0 .

Since MXSEM captures the meaning of P under XSEM , a propositional P sentence is a logical consequence of P under the semantics XSEM if and only if it holds in every extended{model in MXSEM . Below, we give an inductive P de nition of what we mean by a propositional sentence in this context. De nition 2.4 Given a set of propositional symbols LP , the propositional sentences of LP are de ned as follows: 1. Every literal (i.e. propositional symbol and explicit negation of a propositional symbol) is a propositional sentence. 2. The negation-by-default, not l, of a literal l is a propositional sentence. 3. If ' and are propositional sentences then ' ^ is a propositional sentence. 4. If ' and are propositional sentences then ' _ is a propositional sentence. 5. A nite sequence of symbols is a propositional sentence only if it can be shown to be a propositional sentence by a nite number of applications of 1 - 4 above.

In order to de ne whether a propositional sentence ' holds in an extended{ model M of P we think of M as being a valuation of the propositional symbols in LP assigning to each p 2 LP the truth value: true if p 2 M, false if p 2 M, unknown if p 62 M and p 62 M, and false-by-default if p 62 M. Formally, we de ne:

De nition 2.5 Given an edlp P and a propositional sentence ', we de ne: 1. M j= ', where M is an interpretation of P , as:  If ' = l, where l is a literal: M j= l i l 2 M .  If ' = not l, where l is a literal: M j= not l i l 62 M .  If ' = ' ^ '2, where ' and ' are propositional sentences: M j= ' ^ ' i M j= ' and M j= ' .  If ' = ' _ '2, where ' and ' are propositional sentences: M j= ' _ ' i M j= ' or M j= ' . . 2. MXSEM j= ' i M j= ' for all M 2 MXSEM P P 1

1

2

1

2

1

2

1

1

2

1

2

1

2

12

3. P j=XSEM ' i MXSEM j= '. P

Notice that, in particular, for any p 2 LP , P j=XSEM ( p) if and only if  p is present in every extended{model in MXSEM . This constitutes a critiP

cal di erence between explicit negation and classical negation since in classical propositional logic P j= :p if and only if :p holds in every model of the propositional theory P (not only in a restricted set of models like MXSEM ). It is easy P to see that the following relation among classical, explicit and default negations holds: P j= :p implies that P j=XSEM (p) implies that P j=XSEM not p. The following lemma is an immediate consequence of De nition 2.5. Lemma 2.3 Let M be an interpretation and let ' be a propositional sentence. Then, M j= ' i M 0 j= '0 . As mentioned before, the purpose of introducing the symbol ? is to mark the models of P?0 that are inconsistent. An additional bene t of this is that the satis ability of the propositional sentence ' with respect to P is equivalent to the satis ability of the sentence '0 _ ? with respect to P?0 as the following proposition states. Proposition 2.4 Let P be an edlp and let ' be a propositional sentence. Then, 0 SEM j= ('0 _ ?). MXSEM j= ' i consistent(MSEM P P ) j= ' i MP 0 ?

0 ?

Proof: 0 1. MXSEM j= ' i consistent(MSEM P P ) j= ' . \)" Clear from Lemma 2.3 and the fact that  XSEM . (consistent(MSEM P ))  MP 0 \(" Suppose now that consistent(MSEM P ) j= ' . XSEM XSEM Case 1: If MP = ; or MP = fLg, then trivially every satis es '. model in MXSEM P 6 fLg. Then by Prop. 2.2 = Case 2: Otherwise, suppose ; 6= MXSEM P SEM  SEM  MXSEM PXSEM = (revised(MP )) = (consistent(MP )) and hence MP j= '. SEM j= ('0 _?). It follows from the obser2. consistent(MP ) j= '0 i MSEM P vation that for all M 2 MSEM P ; M j= ? i M is inconsistent. 0 ?

0

0

0

0

0 ?

0 ?

0 ?

The preceding proposition guarantees that evaluating ('0 _ ?) in MSEM P can be thought of as evaluating '0 in exactly the consistent models in MSEM P . The following example illustrates this remark. 0 ?

0 ?

13

Example 2.2 Consider the edlp P = fa _ b ; a_  b ;  a _ bg. The stable model semantics of P; P 0; and P?0 are shown below. Program

Stable Model Semantics

P = fa _ b ; a_ b ; a _ bg Mxstable = ffa; bgg P 0 0 0 stable P = fa _ b ; a _ b ; a _ bg MP = ffa; bg; fa; a0g; fb; b0gg = ffa; bg; fa; a0; ?g; fb; b0; ?gg P?0 = fa _ b ; a _ b0 ; a0 _ b; Mstable P ? a; a0 ; ? b; b0g 0

0 ?

Notice that Mxstable j= a but Mstable 6j= a (resp. Mstable 6j= a) since a fails P P P 0 0 to hold in fb; b g (resp. fb; b ; ?g). It is clear, however, that a holds in every stable j= (a _ ?). (resp. Mstable consistent model in Mstable P P ). Therefore MP 0

0

0 ?

0 ?

0 ?

2.1.1 Stable Model Semantics

The stable model semantics for normal logic programs was introduced by Gelfond and Lifschitz in [GL88] and then generalized by them to the class of extended logic programs (see [GL90]). Przymusinski [Prz90a] enlarged this extended version to include disjunctive programs. Recently, Inoue et al. [IKH92] developed a bottom-up procedure to compute stable models of edlps. The model theoretic characterization of xstable can be understood intuitively as follows: M  L is a stable extended{model of an edlp P if M is a minimal extended{model of the disjunctive program obtained from P by interpreting each negation-by-default of the form not l , l 2 L, according to M in such a way that not l is false if l 2 M and not l is true if l 62 M. In the rst case, each clause containing not l in its body may be erased from P, and in the second case, any occurrence of not l may be deleted from clauses in P without altering the meaning of P in the context of M. More formally:

De nition 2.6 Let P be an edlp and let M  L. The Gelfond-Lifschitz transformation of P w.r.t. M , P M , is de ned as: P M = fl1 _ ::: _ lk lk+1 ; :::; lmjl1 _ ::: _ lk lk+1 ; :::; lm; not lm+1 ; :::; not ln is a clause in P and flm+1 ; :::; lng \ M = ;g De nition 2.7 Let P be an edlp and let M  L. Let consistent(xstable,P ) = fM  LjM is consistent and M is a minimal extended-model of P M g inconsistent(xstable,P ) = fM  LjM is inconsistent and M is a minimal extended-model of P M g

14

The set of stable extended{models characterizing the stable model semantics of P is given by: 8 If consistent(xstable,P) = ; and > > consistent(xstable,P) Ifinconsistent(xstable,P) consistent(xstable,P) 6= ;: : fLg Otherwise.

Example 2.3 Consider the following diagram: 8 e > < e P = > ab _ not d :

c

Prime{?

a

8 > > > > > > >
> > > > > > :

e0 a _ e b0 not d c a ? a; a0 ? b; b0 ? c; c0 ? d; d0 ? e; e0

stable

xstable

0 0 0 0 Mstable P?0 = ffa; c; b ; e g; fe; e ; b ; ?gg

Mxstable = ffa; c; b; egg P

Neg

0 0 revised(Mstable P?0 ) = ffa; c; b ; e gg

Here, consistent(xstable,P) = ffa; c;  b;  egg and inconsistent(xstable,P) =

ffe; e; bgg.

The question of how to e ectively nd all stable extended{models of a given

edlp P can be answered using the previous set of instructions and an e ective procedure to compute the stable models for ndlps (see [FLMS93]).

The following proposition is an easy corollary of Proposition 2.2. However, we give a direct proof of it as an illustration of how to prove such a result for a particular semantics. First we need a technical lemma stating that the Gelfond-Lifschitz transformation and the prime transformation commute. Lemma 2.5 Let P be an edlp and let M  L. Then (P M )0 = P 0M . 0

15

Proof:

(P M )0 = (fl1 _ ::: _ lk lk+1 ; :::; lm j l1 _ ::: _ lk lk+1 ; :::; lm;not lm+1 ; :::; not ln is a clause in P and flm+1 ; :::; lng \ M = ;g)0. = fl10 _ ::: _ lk0 lk0 +1 ; :::; lm0 j l1 _ ::: _ lk lk+1; :::; lm;not lm+1 ; :::; not ln is a clause in P and flm+1 ; :::; lng \ M = ;g. () = fl10 _ ::: _ lk0 lk0 +1 ; :::; lm0 j l10 _ ::: _ lk0 lk0 +1; :::; lm0 ;not lm0 +1 ; :::; not ln0 is a clause in P 0 and flm0 +1 ; :::; ln0 g \ M 0 = ;g. = P 0M . Equality (*) holds since clearly l1 _ ::: _ lk lk+1 ; :::; lm; not lm+1 ; :::; not ln is a clause in P if and only if l10 _ ::: _ lk0 lk0 +1 ; :::; lm0 ; not lm0 +1 ; :::; not ln0 is a clause in P 0; and flm+1 ; :::; lng \ M = ; if and only if flm0 +1 ; :::; ln0 g \ M 0 = ;. 0

Proposition 2.6 For any edlp P , the following diagram commutes: P

Prime{? Transf.

P?0 stable

xstable

Mstable P?0

Mxstable P

revised(Mstable P?0 )

Neg Transf.

)) . i.e. Mxstable = (revised(Mxstable P P 0 ?

Proof: It is enough to show that:  and consistent(xstable,P) = (consistent(Mstable P )) . inconsistent(xstable,P) = (inconsistent(Mstable )) P Since the prime and neg transformations are the inverse of each other, this is equivalent to proving that: 0 ?

0 ?

16

and (consistent(xstable,P))0 = consistent(Mstable P ) ) (inconsistent(xstable,P))0 = inconsistent(Mstable P 0 ?

0 ?

Notice rst that the following statements hold: 1. M is a model of P M i M 0 is a model of P 0M : By Lemma 2.1, M j= P M 0

i M 0 j= (P M )0 and by Lemma 2.5, (P M )0 = P 0M . 0

2. M is a minimal model of P M i M 0 is a minimal model of P 0M : We prove 0

the contrapositive: M is a model of P M but is not minimal i there is some N  M such that N j= P M i there is some N 0  M 0 such that N 0 j= (P M )0 , by Lemma 2.1 i there is some N 0  M 0 such that N 0 j= P 0M , by Lemma 2.5 i M 0 is a model of P 0M but is not minimal. 3. M is consistent i ? 62 M 0: Which follows from: M is consistent i there is no literal l such that l; l 2 M i there is no literal l such that l; l0 2 M 0 i ? 62 M 0. 0

0

We now prove that (consistent(xstable,P))0 = consistent(Mstable P ). 0 ?

(consistent(xstable,P))0 = (fM  Lj M is consistent and M is a minimal model of P M g)0 = fM 0  L0j M is consistent and M is a minimal model of P M g = fM 0  L0j M 0 is consistent and M 0 is a minimal model of P 0M g by statements 2 and 3 above. 0 stable = fM 2 MP jM 0 is consistent g = consistent(MSEM P ) 0

0

0 ?

The proof of the other equation (involving inconsistent interpretations) is similar and hence omitted.

2.2 Fixpoint Semantics

In this section we construct a xpoint operator to compute XSEM assuming the existence of a xpoint operator which computes the semantics SEM . In what follows, we call F a xpoint operator whenever F is an operator de ned from some domain to itself; we say that an element A of such a domain is a xed-point of F whenever F(A) = A; and the notation F , where F is a 17

xpoint operator and is an ordinal, stands for the composition of F with itself in the order speci ed by , that is, if A belongs to the domain of F, then 8 If = 0: < A ?1 (A)) If is a succesor ordinal: F (A) = : F(F S (F (A)) If is a limit ordinal. <

To simplify the following discussion, without any loss of generality, we x an arbitrary propositional language L and consider only edlps written in it. Remember that L denotes the set of all literals that can be constructed from L. In addition, we consider only ndlps written in the corresponding propositional language L0 ? . Let T be a xpoint operator used to compute the semantics SEM of ndlps. T is de ned on some domain < DT ; >, where  is a partial order, and the elements of DT may be sets of atoms in the language L0? , or sets of clauses in the same language, or some other structure depending on the semantics SEM . There is a distinguished element bT in DT that is used as the starting point for the iterations of T in such a way that, for every ndlp Q, there exists an ordinal Q such that TQ Q (bT ) is the xed-point of T characterizing the semantics SEM of Q. For simplicity, we sometimes denote by mQ this xed-point capturing the meaning of Q. Since each element of DT is a potential meaning for an ndlp, there is a notion of truth determining whether a sentence holds in it. Based on this, we de ne a binary relation j=DT between elements S in DT and sentences ' in the language L0? by: S j=DT ' i ' is true on S (see Example 2.4 for illustrations). We say that S is inconsistent if there is a propositional symbol p such that S j=DT p and S j=DT  p. When S models P?0 , ? must hold in S since ? p; p0 2 P?0 and hence, this condition can be simpli ed to S j=DT ?. Finally, we make the assumption that there is a maximal (w.r.t. ) inconsistent element in DT , called tT .

Example 2.4 Table 3 illustrates the notions and terminology introduced pre-

viously for two well known semantics: The minimal model semantics of Horn programs (see [vEK76]) and the minimal models semantics of disjunctive programs (see [MR90, LMR92]) for the particular case of propositional programs.

Yet another advantage of having the set of clauses f? p; p0jp 2 LP g inside 0 P? is that it guarantees that for every element M of DT modeling this program and for every propositional symbol p, if M j=DT p _ ' and M j=DT p0 _ then M j=DT ? _ ' _ . In other words, it forces the models of P?0 to be closed under resolution of opposite propositional symbols (up to the presence of ? in 18

SEM

MINIMAL MODEL SEMANTICS MINIMAL MODELS SEMANTICS OF HORN PROGRAMS OF DISJUNCTIVE PROGRAMS

T

van Emden/Kowalski xpoint oper- Minker/Rajasekar xpoint operator ator TP . TPS .

DT

< P (HB ); >: Complete lattice of < P (C + ); >: Complete lattice of subsets of the Herbrand base HB of subsets of the set C + of all positive

Def.

bT

P, ordered under set inclusion.

clauses in the language of P, ordered under set inclusion.

Let S 2 P (HB ). TP (S ) = fA 2 HB j A A1 ; : : : ; An is a ground instance of a program clause in P and

fA1 ; : : : ; An g  S g

Let S 2 P (C + ). TPS (S ) = fC 2 DHB j A B1 ; : : : ; Bn is a ground instance of a program clause in P , for each i; 1  i  n, there is a (possible null) clause Ci such that Bi _ Ci 2 S and C is the smallest factor of A _ C1 _ : : : _ Cn g

;: Bottom element of the lattice.

;: Bottom element of the lattice.

j=DT Let S 2 P (HB ) and l 2 HB . S j=DT l i l 2 S . S j=DT not l i l 62 S (CWA). j=DT is extended to arbitrary sentences in the usual way.

tT

Let S 2 P (C + ) and l; l1 ; : : : ln 2 L0 . S j=DT l i l 2 S . S j=DT l1 _ : : : _ ln i S contains a subclause of l1 _ : : : _ ln . S j=DT not l i for all positive (possible null) clauses K , if S j=DT l _ K then S j=DT K (GCWA). j=DT is extended to arbitrary sentences in the usual way.

HB : Top element of the lattice. C + :0 Top element of the lattice. 0 p; p 2 HB for every propositional p; p 2 C + for every propositional symbol p. symbol p.

Figure 3: Fixpoint Operators for Horn and Disjunctive Propositional Logic Programs. 19

the resolvants). This is true regardless of the semantics chosen for P?0 . Hence, ? may be replaced by the empty clause 2 in all the sentences derivable from M, which allows us to express the previous result more naturally as M j=DT ' _ . We will need to apply this substitution systematically during the construction of xed-points and so we introduce one more transformation de ned on elements of DT as follows: Let S 2 DT , the 2{transformation of S, denoted by S 2 , is obtained from S by replacing every occurrence of ? by the empty clause 2 in all sentences contained in S. The 2{transformation is extended to DT in the natural way. This transformation corresponds exactly to the revision step in the model theoretic characterization of SEM in which every extended-model of P?0 containing ? was (see Section 2.1). It is clear then, that for any sentence discarded from MSEM P ' in the language L, S j=DT ' _ ? i S 2 j=DT ' : Having described the domain of the operator T, we can now re ne the general schema outlined in Figure 2 to extend the xpoint theoretic characterization of SEM to the corresponding characterization of XSEM . The right-hand path of Figure 2 is divided into three steps: 1. The operator TP is iterated until the xed-point mP is reached. 2. Every occurrence of ? in mP is substituted by the empty clause to obtain m2P . 3. The revision step takes care of the inconsistencies that may appear in m2P : ( 2 If m2P j= 2 (or equivalently, mP j= ?): t 2 revised(mP ) = mT2 Otherwise. 0 ?

0 ?

0 ?

0 ?

0 ?

0 ?

0 ?

P

0 ?

0 ?

0 ?

The de nition of XSEM on the left-hand path of Figure 2 consists of two steps: 1. The operator TPE is iterated until the xed-point mEP is reached: The de nition of T E is obtained by mimicking the de nition of T but working now with literals instead of only positive atoms and with the empty clause instead of ?. Therefore, T E must apply resolution to all suitable pairs of sentences in its domain to simulate the e ect caused by the presence of ? in P?0 . Other than that, the negated atoms are treated as if they were positive atoms which happen to begin with the character . The domain DT E of T E is built isomorphic to DT but containing negated propositional symbols instead of primed propositional symbols and the 20

empty clause instead of ? (in particular we want that DT E = DT 2 ). The starting point bT E for the iterations of T E is taken as the isomorphic element to bT in DT E (and so bT E should be equal to bT 2 ). Likewise, the notion of truth in DT E is inherited from the notion of truth in DT (we force that for any element S E 2 DT E and any sentence ' in the language L, S E j=DT E ' if and only if S j=DT '0 _ ?, where S is the isomorphic element to S E in DT ). We denote by mEP the meaning of P computed by iterating T E from the starting point bT E until a xed-point of the operator is reached. In other words, mEP = (TPE ) P (bT E ), where P is the smallest ordinal for which TPE [(TPE ) P (bT E )] = (TPE ) P (bT E ). 2. The revision step detects and corrects inconsistencies in mEP . That is, if mEP is inconsistent (i.e. there is a propositional letter p such that mEP j=DT E p and mEP j=DT E p, or equivalently, mEP j=DT E 2 since mEP is closed under resolution), then the extended revised semantics of P is taken as the maximal inconsistent element tT E of DT E (again, tT E is forced to be equal to tT 2 ):  tT E If mEP is inconsistent, i.e., mEP j=DT E 2: E xrevised(mP ) = m E Otherwise. P More speci c details of the construction of TPE depend upon the particular semantics SEM being used. Example 2.5 Let SEM be the minimal Herbrand models semantics de ned for disjunctive logic programs and consider the Minker/Rajasekar xpoint operator TQS computing SEM (see its de nition in Example 2.4). Let P be the edlp free of negation-by-default: P = fa _ b; a_  b;  a _ b; c a; bg. The meaning of P under XSEM can be obtained by using the right-hand path of Figure 2 as follows (see also Figure 4): TPS (;) = fa _ b; a _ b0; a0 _ bg (TPS )2(;) = fa _ b; a _ b0; a0 _ b; c _ b _ a; c _ b _ a0 ; c _ b0 _ a; c _ b0 _ a0 ; ? _ b; ? _ b0 _ b; ? _ a; ? _ a0 _ ag (TPS )3(;) = fa _ b; a _ b0; a0 _ b; c _ b _ a; c _ b _ a0; c _ b0 _ a; c _ b0 _ a0; ?_ b; ?_ b0 _ b; ? _ a; ? _ a0 _ a; ? _ c; ? _ c _ b _ b0; ? _ c _ a _ a0; c _ b _ ?; c _ b0 _ ?; c _ ? _ a; c _ ? _ a0 ; c _ ? _ a0 _ b0 ; ? _ b _ a; ? _ b0 _ a; ? _ c _ b _ a; ? _ c _ b0 _ a; ? _ a0 _ b; ? _ a0 _ c _ bg mP = (TPS )3 (;) revised(m2P ) = m2P = fa_b; a_b0; a0_b; c_b_a; c_b_a0; c_b0_a; c_b0_a0; b; b0_ b; a; a0 _ a; c; c _ b _ b0; c _ a _ a0 ; c _ a; c _ a0 ; c _ b; c _ b0g 0 ?

0 ?

0 ?

0 ?

0 ?

0 ?

0 ?

21

and therefore the meaning of P under XSEM is given by: fa _ b; a_  b;  a _ b; c _ b _ a; c _ b_ a; c_ b _ a; c_ b_ a; b; b _ b; a; a _ a; c; c _ b_  b; c _ a_ ac _ a; c_ a; c _ b; c_ bg which is clearly equivalent to fa; b; cg.4 An alternative way of computing xrevised(mEP ) is by extending the de nition of the xpoint operator to deal with explicit negation. The extended operator should mimic the computation of mP but without the need of using ? or primed propositional letters. For this purpose, observe the role played by ? in the computation of mP : it causes the operator to resolve clauses. For instance, the presence of (?_ b) in (TPS )2(;) represents the resolvant of (a _ b) with (a0 _ b) (i.e. (a _ b)), clauses which belong to TPS (;). In the same way, (? _ a0 _ a) appears in (TPS )2 (;) as the result of resolving (a _ b0) with (a0 _ b). Thus, the extended operator must resolve clauses and so is de ned as follows: De nition 2.8 The extended Minker/Rajasekar xpoint operator computing the minimal Herbrand models semantics of an edlp free of negation-by-default P is de ned on the domain DT E =< P (C ); > (the complete lattice of subsets of 0 ?

0 ?

0 ?

0 ?

0 ?

C ordered under set inclusion, where C is the set of all clauses in the language of P), as follows: Given S E 2 DT E , TPE (S E ) = fC 2 DHBP jA B1 ; : : :; Bn is a ground instance of a program clause in P , for each i; 1  i  n, there is a (possible null) clause Ci such that Bi _ Ci 2 S E and C is the smallest factor of A _ C1 _ : : : _ Cn g [ fC1 _ C2j there is a propositional letter p s.t. p _ C1; p _ C2 2 S E g. The starting point for iterating the extended operator is bT E = ; and the maximal inconsistent element of DT E is tT E = C . The computation of the semantics of P using this extended xpoint operator is the following: TPE (;) = fa _ b; a_ b; a _ bg (TPE )2 (;) = fa _ b; a_ b; a _ b; b; a;a_ a; b_ b; c _ b _ a;c _ b_ a; c_  b _ a; c_ b_ ag (TPE )3 (;) = ffa _ b; a_  b;  a _ b; c _ b _ a; c _ b_  a; c_  b _ a; c_  b_ a; b; b _ b; a; a _ a; c; c _ b_ b; c _ a_ ac _ a; c_  a; c _ b; c_ bg mEP = (TPE )3 (;) xrevised(mEP )) =mEP .

4 In this particular case, since the xed-points are sets of clauses, they could be simpli ed in the revision step by deleting from them all the clauses which are subsumed by other clauses in the set.

22

8 a _ b > > < P = > aa __ bb > :

c

Prime{?

a; b

8 > > > > > > < 0 P? = > > > > > > :

a _ b a _ b0 a0 _ b c a; b ? a; a0 ? b; b0 ? c; c0 Minker/Rajasekar Fixpoint Operator

8 a _ b; a _ b0; a0 _ b; c _ b _ a; c _9 > > > 0 ; c _ b0 _ a; c _ b0 _ a0; ? _> > > b _ a > > > > 0 0 > > b; ?_ b _ b; ?_ a; ?_ a _ a; ?_ > = mP?0 = >b _ ?; c _ b0 _ ?; c _ ? _ a; c _> > > > ? _ a 0 ; c _ ? _ a 0 _ b0 ; ? _ b _ > > > 0 > > > a; ? _ b _ a; ? _ c _ b _ a; ? _ :c _ b0 _ a; ?_ a0 _ b; ?_ a0 _ c _ b> ;

Extended Minker/Rajasekar Fixpoint Operator

2{Transf.

8a _ b; a_ b; a _ b; c _ b _ a; c _9 > > > > > = mEP = >a; b; b _ b; a; a _ a; c; c _ b_ > > :b; c _ a_  ac _ a; c_  a; c _> ;

8a _ b; a _ b0; a0 _ b; c _ b _ a; c _9 > > > = 2 mP?0 = >b; a; a0 _ a; c; c _ b _ b0; c _ a _> :0 ; 0 0

xrevised(mEP ) = mEP

revised(m2P?0 ) = m2P?0

a ; c _ a; c _ a ; c _ b; c _ b

b; c_ b

Neg

Figure 4: Fixpoint Semantics of program P in Example 2.5. 23

This extended operator inherits the properties of the Minker/Rajasekar xpoint operator, namely, it is monotonic and continuous as Lemma 2.7 proves. The extended xpoint operator coincides with the one de ned by Belegrinos in [Bel88]. Notice that the xpoint characterization of XSEM has been built in such a way that it coincides exactly with the right-hand path of the diagram. Hence, the following results are self-evident. Lemma 2.7 Let T be a xpoint operator de ned on DT and let T E be the corresponding xpoint operator de ned on DT E . Then, the following statements hold: 1. If T is monotonic (resp. continuous) on DT then T E is monotonic (resp. continuous) on DT E . 2. For any ordinal , (TPE ) (bT E ) = [TP (bT )]2 . 0 ?

3. In particular, for any ordinal , if TP (bT ) is a (resp. the minimal, the maximal) xed-point of T then (TPE ) (bT E ) is also a (resp. the minimal, the maximal) xed-point of T E . Since the de nition of XSEM was given in two steps we can re ne Figure 2 0 ?

as shown in the following proposition. Proposition 2.8 For any edlp P , the following diagram commutes:

P

Prime{?Transf.

P?0 SEM

0

mP?0 = TP?0P? (bT )

XSEM

2-Transf.

mEP = (TPE ) P (bT E )

Neg Transf.

m2P?0

xrevised(mEP )

Neg Transf.

revised(m2P?0 )

24

i.e. mEP = [mP ]2 and xrevised(mEP ) = [ revised(m2P )] 0 ?

0 ?

Proof: The fact that mEP = [mP ]2 , follows from Part 3 of Lemma 2.7, 0 ?

and that = [ revised(m2P )] is clear from the de nitions of the revision of the meaning of an ndlp and the extended revision of the meaning of an edlp. xrevised(mEP )

0 ?

The following result is a computational consequence of Proposition 2.8. For simplicity, we abbreviate revised(m2P ) as rm2P and xrevised(mEP ) as rmEP . 0 ?

0 ?

Corollary 2.9 The complexity of computing rmEP can be bounded as follows: complexity(computing rmEP )  complexity(applying prime{? transf. to P ) + complexity(computing rm2P ) + complexity(applying neg transf. to rm2P ) 0 ?

0 ?

Proof: The corollary follows from the fact that rmEP = [rm2P ]. 0 ?

The inequality in the previous corollary should be understood as saying that one way to compute rmEP is by computing [rm2P ], but there may be more ecient ways to do so. Notice that, for some measurements of the size of P (e.g. the number of clauses in the program), the complexity of transforming P to P?0 is linear on the size of P. Also, applying the neg transformation to rm2P is not more complex than computing m2P . Thus, loosely speaking, we can simplify the inequality in Corollary 2.9 to: complexity(computing rmEP )  complexity(computing rm2P ). It is important to remark that the complexity of revising m2P to detect inconsistencies is equal to the complexity of searching for the empty clause 2 in m2P . Finally, we prove that the model theoretic and xpoint characterizations of XSEM are equivalent. 0 ?

0 ?

0 ?

0 ?

0 ?

0 ?

Theorem 2.10 If the model theoretic and xpoint characterizations of SEM

are equivalent so are the extended model theoretic and xpoint characterizations of XSEM . In other words, for every edlp P and every propositional sentence ',

j= ' xrevised(mEP ) j= ' i MXSEM P 25

Proof: Fix an arbitrary edlp P and an arbitrary propositional sentence '. Case 1: Assume P is inconsistent. Then, rmEP j= ' and MXSEM j= ' by P

de nition. Case 2: Assume P is consistent. In this case rmEP = mEP and rm2P = m2P . Then, mEP j= ' i m2P j= ('0) By Lemma 2.1 and Proposition 2.8: i mP j= ('0 _ ?) 0 ?

0 ?

0 ?

0 ?

j= ('0 _ ?) Since by hypothesis the model theoretic i MSEM P and xpoint characterizations of SEM are equivalent. i MXSEM j= ' By Proposition 2.4 P 0 ?

The following two subsections explicitly construct the extended xpoint characterizations of the DWFS and the stationary semantics respectively.

2.2.1 Disjunctive Well-Founded Semantics

The disjunctive well-founded semantics (DWFS) was de ned by Baral [Bar91] as an extension of the well-founded semantics (WFS) [VGRS88] to the class of normal disjunctive logic programs. It is also equivalent to the Minker/Rajasekar xpoint operator on the class of disjunctive logic programs [MR90]. In the same spirit of WFS, DWFS is a 3-valued semantics which associates to each normal disjunctive logic program P a state{pair, i.e., a tuple S =< TS ; FS > where TS is a set of disjunctions of atoms (TS  DHB P ) and FS is a set of conjunctions of atoms (FS  CHB P ) with the closure properties that if D 2 TS ; C 2 FS and a is an atom then D _ a 2 TS and C ^ a 2 FS . The intended meanings of TS and FS are as follows: TS contains all the positive disjunctions that are assumed to be true in P under this semantics and FS contains all the positive conjunctions that are assumed to be false-by-default in P, i.e. the conjunctions produced by the particular default rule for negation used by this semantics. We describe the extension of DWFS to the class of edlps by mimicking the de nition of the xpoint operator S to compute the DWFS for the class of ndlps (see [LMR92]) but working now with literals instead of only positive propositional symbols5. To do so, we need the following de nitions:

De nition 2.9 Let P be an edlp. An extended state{pair S is a tuple < TS ; FS > where TS  DLP , FS  CLP such that TS is closed under disjunctions with

5 The de nition of S in [LMR92] works for non-ground programs. However, since we are considering only (possibly in nite) ground programs we extend its de nition only for the propositional case.

26

literals in L, that is, for all literals l 2 L, if D 2 TS then D _ l 2 TS ; and FS is closed under conjunctions with literals in L, i.e. for all literals l 2 L, if C 2 FS then C ^ l 2 FS . Notice that since in the extended framework with explicit negation we are allowed to state when a propositional symbol p is true as well as when it is false (i.e. when p is true ), it is no longer adequate to say that a sentence ' is false with respect to an extended state{pair S =< TS ; FS > if FS j= '. Instead, we de ne:

De nition 2.10 Let S =< TS ; FS > be an extended state{pair and let ' be a sentence. The truth value of ' with respect to S is given by: ' is true if TS j= '; ' is false if TS j='; ' is unknown if TS 6j= ' and TS 6j='; and ' is false-by-default if FS j= '. We say that an extended state{pair S is inconsistent if there exists a sentence ' such that TS j= ' and TS j='. The extended state{pair associated with an edlp P by DWFS is constructed as the smallest xed-point of an operator S E de ned on the collection of extended state{pairs. Given an extended state{pair S =< TS ; FS >, S E augments TS with all the disjunctions that can be deduced from P in one or more steps (i.e. in one or more applications of an immediate consequence operator de ned below) under the assumption that the sentences in TS are true and the ones in FS are false-by-default . Similarly, S E augments FS with all the conjunctions which can be proved to be false-by-default in one or more steps (i.e. either the conjunction is assumed to be false-by-default or for each rule in P capable of deducing the conjunction, it is possible to prove that its body is false or falseby-default ) supposing again that the sentences in TS are true and the ones in FS are false-by-default . Formally:

De nition 2.11 Given an edlp P , 1. the extended state{pair assigned by DWFS to P is the smallest xed-point of the operator S E de ned on extended state-pairs in such a way that for any extended state{pair S =< TS ; FS >:

S E (S) =< TS [ [

[

n
1

(TSE )n (;)] ; FS [ [

where6: 6 \)" will denote logical implication.

27

\

(FSE )n (CLP )] >

n
1

TSE (T) = fD 2 DLP j there is a clause D0

l1 ; : : :; lm ; not lm+1 ; : : :; not ln in P such that for all i; 1  i  m; li _ Di 2 TS [ T for some (possibly null) Di 2 DLP , flm+1 ; : : :; ln g  FS and D0 _ D1 _ : : : _ Dm ) Dg [ fD1 _ D2 j there is a prop. letter p s.t. p _ D1 ; p _ D2 2 T g. FSE (F) = fC 2 CLP j for all clauses of the form A _ E l1 ; : : :; lm ; not lm+1 ; : : :; not ln in P , where E is a (possible null) disjunction of literals and C ) A, at least one of the following cases holds: (a) m  1 and l1 ^ : : : ^ lm 2 FS [ F (b) n  m + 1 and lm+1 _ : : : _ ln 2 TS g.

2. the revised extended state{pair characterizing the semantics DWFS of P is de ned as the extended state{pair S assigned by DWFS to P if S is consistent and as < DLP ; CLP > otherwise. In the latter case, the program P is called inconsistent w.r.t. DWFS.

In order to simplify the notation in the following examples, we use the following convention: If T  DLP then disj-closureL (T) denotes the smallest subset of DLP containing T that is closed under disjunctions with literals in L. If F  CLP then conj-closureL (F) denotes the smallest subset of CLP containing F that is closed under conjunctions with literals in L.

Example 2.6 The revised extended state{pair characterizing the DWFS of the

edlp given in Example 2.1 is:

S =< disj-closureL (fa _ eg) ; conj-closureL (fb; c; eg) >; which is obtained from:

T<E;;;> (;) F<E;;;> (CLP ) (F<E;;;> )2(CLP ) S E (< ;; ; >)

= = = = =

disj-closureL (fa _ eg) = (T<E;;;> )2(;) conj-closureL (fb; b; c; c; eg) conj-closureL (fb; c; eg) = (F<E;;;> )3 (CLP ): Then, < disj-closureL (fa _ eg) ; conj-closureL (fb; c; eg) > (S E )2 (< ;; ; >):

Corollary 2.11 (Of Proposition 2.8) For any edlp P , the following diagram commutes:

28

Prime{?Transf.

P

P?0 DWFS

mP?0 = (SP?0 ) P?0 (< ;; ; >)

XDWFS

2-Transf.

mEP = (SPE ) P (< ;; ; >)

xrevised(mEP )

Neg Transf.

m2P?0

Neg Transf.

revised(m2P?0 )

i.e. mEP = [m2P ] and xrevised(mEP ) = [ revised(m2P )] 0 ?

0 ?

A similar approach can be followed to extend the generalized disjunctive well-founded semantics (GDWFS) [BLM90a, BLM90b], and WF 3 [BLM91] to the class of edlps.

2.2.2 Stationary Semantics

The stationary semantics introduced by Przymusinski [Prz90b] also associates to each ndlp a state-pair. The construction of this state{pair is achieved using a xpoint operator called S S (see [LMR92]) whose de nition relies on the notions of Extended Generalized Closed World Assumption (EGCWA) [YH85] and stationary transformation, which we generalize to the extended case as follows:

De nition 2.12 Let P be an edlp and let S be an extended state{pair. The

stationary transformation of P with respect to S , denoted by Sta(P,S), is the edlp free of negation-by-default7 obtained from P by: 1. removing each clause in P whose body is false8 or false-by-default with respect to S . 2. removing the bodies of the remaining clauses in P .

7 By this, we mean that the operator not does not appear in the program. 8 The truth value of a sentence with respect to an extended state{pair is given in Def. 2.10.

29

An easy way to enlarge the EGCWA to the class of edlps free of negationby-default is by using the prime transformation. De nition 2.13 Let P be an edlp free of negation-by-default. We de ne the EGCWAE (P) as (EGCWA(P 0)) , i.e. EGCWAE (P) = fnot l1 _ : : : _ not ln jl1 ; : : :ln 2 L and not l10 _ : : : _ not ln0 is true in every minimal model of P 0g: The extended state{pair which is associated by the stationary semantics to an edlp P is the smallest xed-point of an operator S SE de ned on the set of extended state-pairs in such a way that for any given extended state{pair S =< TS ; FS >, S SE adds to TS the set TSSE of all the disjunctions that are logical consequences of the union of P with TS and the negation of the conjunctions in FS . On the other hand, S SE adds to FS all the conjunctions that can be assumed to be false-by-default under the EGCWAE from the stationary transformation of P with respect to S and TSSE . In what follows, not l1 _ : : : _ not ln is abbreviated as not(l1 ^ : : : ^ ln); if C is a set of conjunctions of literals then not(C) will denote the set fnot(c)jc 2 C g; and not(not p) = p. De nition 2.14 Given an edlp P , 1. the extended state{pair assigned by the stationary semantics to P is the smallest xed-point of the operator S SE de ned on extended state-pairs in such a way that for any extended state{pair S =< TS ; FS >:

S SE (S) =< TS [ TSSE ; FS [ FSSE > where:

TSSE = fD 2 DLP jP [ TS [ not(FS ) j= Dg [ fD1 _ D2 j there is a prop. letter p s.t. p _ D1 ; p _ D2 2 TS g, FSSE = (not(EGCWAE (Sta(P; < TSSE [ TS ; FS >) [ TSSE [ TS ))). 2. the revised extended state{pair characterizing the stationary semantics of P is de ned as the extended state{pair S assigned by the stationary semantics to P if S is consistent and as < DLP ; CLP > otherwise. In the latter case, the program P is called inconsistent w.r.t. the stationary semantics.

Example 2.7 The revised extended state{pair which characterizes the stationary semantics of the edlp P given in Example 2.1 is: S =< disj-closureL (fa _ eg) ; conj-closureL (fb; c; e; a ^ eg) >; 30

which is obtained from: T<SE;;;> = disj-closureL (fa _ eg): Let us call this set D: SE = not(EGCWAE (fa _ e; c; b; b; ag[ fa _ eg)) F = conj-closureL (fc; e; a ^ eg): Let us call this set C : S SE (< ;; ; >) = < D; C > and T<SED;C> = disj-closureL (fa _ eg) F<SED;C> = not(EGCWAE (fa _ e; c; b; ag [ fa _ eg)) = conj-closureL (fb; c; e; a ^ eg): Therefore, (S SE )2(< ;; ; >) = S SE (< D; C >) = < disj-closureL (fa _ eg); conj-closureL (fb; c; e; a ^ eg) > = (S SE )3 (< ;; ; >):

Corollary 2.12 (Of Proposition 2.8) For any edlp P , the following diagram commutes:

P

Prime{?Transf.

P?0 stationary

xstationary

mP?0 = (SPS?0 ) P?0 (< ;; ; >) 2-Transf.

mEP = (SPSE ) P (< ;; ; >)

Neg Transf.

m2P?0

xrevised(mEP )

Neg Transf.

revised(m2P?0 )

i.e. mEP = [m2P ] and xrevised(mEP ) = [ revised(m2P )] 0 ?

0 ?

2.3 Proof Theory Semantics

In this section we describe a procedure to answer queries w.r.t. edlps and XSEM . This procedure uses as a subroutine, a procedure to answer queries w.r.t. ndlps 31

and SEM . We construct it using a mixture of both approaches described in Figure 2 instead of concentrating on each approach separately. Notice that to obtain an e ective proof procedure we must restrict ourselves to work with programs containing only a nite number of clauses. Therefore, we must work with non-ground logic programs possibly containing function symbols. In this context, given an edlp P, LP denotes the underlying language of P; L denotes the set of all ground literals that can be constructed from LP ; and UP denotes the Herbrand universe associated with LP and the de nition of P?0 is extended to non-ground programs as follows: ~ p0(X) ~ j p is an n-ary predicate symbol in LP ; n > 0; P?0 = P 0 [ f? p(X); and X~ =< X1 ; : : :; Xn >g where ? is a new predicate symbol not in LP . Finally, the de nition of the set MXSEM of models characterizing the semantics of P is generalized to nonP ground programs in the usual way. We rst describe the proof procedure for ground queries and then we generalize it to answer non-ground queries as well. Even though it is unnecessary to discuss the ground case separately, we choose to do so in order to describe the basic ideas without the need for excessive technicality.

2.3.1 Ground Queries

We allow ground queries q of the following sort:  q = l, where l is a ground literal.  q = not l, where l is a ground literal.  q = q1 ^ q2, where q1 and q2 are ground queries.  q = q1 _ q2 where q1 and q2 are ground queries. We de ne the correct answer to a ground query with respect to an edlp as true, false, or unknown according to the following de nition. De nition 2.15 Given a ground query q we de ne the correct answer to the query with respect to a consistent edlp P and semantics XSEM to be the truth

value determined as follows:

8 MXSEM j= q < true; P MXSEM answer(P; q) = : false; j=q P unknown; otherwise where q denotes the logically equivalent query to q in which  appears only in

front of atomic formulas (it is obtained by applying De Morgan's laws as needed). Also, (not l) will be simpli ed to l since not l is certainly false whenever l is true.

32

In the event that false-by-default is to be given as an answer to the user, it can be de ned as answer(P; q) = false-by-default if answer(P; not(q)) = true , where not(q) stands for the logically equivalent query to not q in which the operator not appears only in front of atomic formulas. Our main purpose now is to de ne a sound and complete proof procedure PPXSEM , to answer ground queries w.r.t. edlps and XSEM . To do so, we assume we have a proof procedure to answer (ground) queries w.r.t. ndlps and SEM , which we call PPSEM . For clarity, we denote by PPSEM (Q; q), the answer of the procedure PPSEM to query q w.r.t. ndlp Q and by PPXSEM (P; q), the answer of the procedure PPXSEM to query q w.r.t. edlp P. Remember that an edlp (in contrast with an ndlp) can be inconsistent and in that case, according to our convention, the answer to any query should be true. Given an edlp P, we can determine whether or not this program is inconsistent w.r.t. XSEM using a sound and complete proof procedure PPSEM and the following characterization: P is inconsistent w.r.t. XSEM i PPSEM (P?0 ; ?) = true which says that the program is inconsistent if and only if every M 2 MSEM P is inconsistent (i.e. M j= ?). In this way, determining whether the program is inconsistent can be done as preprocessing, previous to any attempt to answer queries. The extended proof procedure is based on Proposition 2.4 which guarantees can be thought of as evaluating q0 in exactly that evaluating (q0 _ ?) in MSEM P the consistent models in MSEM P . 0 ?

0 ?

0 ?

De nition 2.16 Let PPSEM be a proof procedure to answer (ground) queries

w.r.t. ndlps and SEM . We de ne an extension of this procedure, called PPXSEM , which answers ground queries w.r.t. edlps and XSEM as follows: Given an edlp P and a ground query q do:  If P is inconsistent w.r.t. XSEM then PPXSEM (P; q) = true.  Otherwise: 1. Simultaneously apply PPSEM to the query ((q)0 _ ?) and the query ((q)0 _ ?) w.r.t. program P?0 . 2. If PPSEM (P?0 ; (q)0 _ ?) = true then PPXSEM (P; q) = true. 3. If PPSEM (P?0 ; (q)0 _ ?) = true then PPXSEM (P; q) = false. 4. Otherwise PPXSEM (P; q) = unknown.

Example 2.8 Consider the edlp P = fr(a); r(b); p(X) r(b); s(c)g. In this case P?0 = fr0(a); r(b); p0(X) r(b); s(c); ? p(X); p0 (X); ? r(X); r0 (X); ? s(X); s0 (X)g The following table shows how the proof procedure behaves 33

with di erent queries: q1 = q 0 _ ? PPSEM (P?0 ; q1) PPXSEM (P; q) 0 q2 = (q) _ ? PPSEM (P?0 ; q2) r(a) r(a) _ ? false false r0(a) _ ? true r(b)^ r(a) [r(b) ^ r0 (a)] _ ? true true [r0(b) _ r(a)] _ ? false p(a) p0(a) _ ? true true p(a) _ ? false not r(a) not r(a) _ ? true true r(a) _ ? false not r(a) not r0 (a) _ ? false false r0(a) _ ? true r(c) r(c) _ ? false unknown r0(c) _ ? false

Query q

Our next theorem shows that PPXSEM is well de ned and gives the correct answer in the sense of Def. 2.15. Theorem 2.13 Let PPSEM and PPXSEM be as in Def. 2.16. The following

statements hold: 1. If PPSEM is well de ned 9 and sound then PPXSEM is well de ned. 2. If PPSEM is a sound proof procedure w.r.t. SEM so is PPXSEM w.r.t. XSEM . 3. If PPSEM is a complete proof procedure w.r.t. SEM so is PPXSEM w.r.t. XSEM .

Proof: This follows from the more general Theorem 2.15 in the next section. The complexity of the extended proof procedure will be discussed in the following section for the general case of non-ground queries.

2.3.2 Non-Ground Queries

The non-ground queries that we consider are syntactically similar to the ground queries de ned in the previous section but they may now contain variables, i.e., ~ of the following sort: we consider queries q(X)

9 By well de ned we mean that the procedure is indeed a function in the mathematical sense, i.e. that given a program P and a query q, the procedure produces an answer and always the same answer to input (P; q).

34

~ = l(X), ~ where l is a literal. q(X) q = not l, where l is a ground10 literal. ~ = q1(X) ~ ^ q2(X), ~ where q1 and q2 are queries. q(X) ~ = q1(X) ~ _ q2(X), ~ where q1 and q2 are queries. q(X) where X~ =< X1 ; : : :; Xn > lists all the free variables in q which, as usual, are interpreted as being existentially quanti ed. ~ is interpreted as being equivalent to 9Xq( ~ X), ~ Since a non-ground query q(X) one is tempted to de ne the correct answer to a query with respect to an edlp as: 8 true; if there exists ~a 2 UPn s.t. > > < MXSEM j= q(~an) P ~ = false; if for all ~ a 2 UP answer(P; q(X)) > XSEM M j = q(~a) > P : unknown; otherwise However, such a de nition for false answers would have two drawbacks. First, if the Herbrand universe UP is in nite, there is no e ective way to check whether or not MXSEM j=q(~a) for all ~a 2 UPn . Second and more importantly, P ~ X) ~ is assumed to be false just because 8~a 2 UPn  q(~a) is true and not 9Xq( ~ holds. Such an assumption would be valid only if we restrict because 8X~ q(X) ourselves to Herbrand models. Taking that into consideration, we de ne the correct answer to a non-ground ~ is false only when 8X~ q(X) ~ query in such a way that the correct answer to q(X) ~ is explicitly stated in P, i.e. when there exists some renaming Y of the variables in X~ such that either q(Y~ ) 2 P, or q(Y~ ) is deducible from P. Example 2.9 Consider the following edlps: P1 = fq(a); q(b); p(a); p(b) q(b) g P2 = fq(a); q(b); p(X)g P3 = fq(a); q(b); p(X) q(b) g Here UP1 = UP2 = UP2 = fa; bg. Note that  p(a) and  p(b) are both deducible from P1. However, we can not conclude that 8Xp(X) holds in every ~ from P2 (non-Herbrand) model of P1 . On the other hand we can deduce p(X) and from P3 and so it holds in every model of P2. Hence, answer(P1 ; p(X)) 6= false and answer(P2 ; p(X)) = answer(P3 ; p(X)) = false. The question now is how to de ne the correct answer for a non-ground query with respect to an edlp P in a declarative way, that is, by refering just to the

   

10 l is restricted to be ground to avoid oundering, i.e., an in nite sequence of derivations due to the presence of free variables in the query (see e.g. [Llo87]). This restriction can be removed when the Herbrand universe of the program is nite which allows the use of constructive negation (see [Cha88]).

35

set MXSEM of (ground) models characterizing the semantics of P. Somehow P we need to enlarge each model in MXSEM to keep memory of whether or not P a non-ground formula is deducible from P. In order to do so, we introduce new constants in the language of P and compute MXSEM with respect to this P enlarged language.

De nition 2.17 Given an edlp P and given n  0, let  ; : : :; n be n new 1

constant symbols not occurring in P . We de ne: 1. [LP ]n, the n-expanded language of P , as: [LP ]n = LP [ f1; : : :; ng. 2. [UP ]n , the n-expanded Herbrand universe of P , as: [UP ]n = UP [ f1; : : :; ng. 3. [MXSEM ]n as the set of models characterizing the meaning of P under P XSEM obtained by taking [LP ]n (instead of LP ) as the underlying language of P .

The value of n in the previous de nition is determined during the process ~ to be answered with of answering queries. Given an edlp P and a query q(X) respect to P, n is taken as the number of free variables in q and we answer the query with respect to P but considering the program as if it were written in the enlarged language [LP ]n (and so its meaning is captured by [MXSEM ]n). P The n free variables in q will be substituted by the n new constants 1; : : :; n introduced in the enlarged language.

Example 2.10 Consider programs P1; P2 and P3 described in example 2.9. It is easy to see that Mxstable = Mxstable = Mxstable = ffq(a); q(b); p(a); p(b)gg. P1 P2 P3 By the previous de nition: [LP1 ]1 = [LP2 ]1 = [LP3 ]1 = fconstant symbols: fa; b; 1g; predicate symbols:fp; qgg, [UP1 ]1 = [UP2 ]1 = [UP3 ]1 = fa; b; 1g, and xstable]1 = [Mxstable]1 = [Mxstable P2 P1 ]1 = ffq(a); q(b);  p(a);  p(b)gg and [MP2 ffq(a); q(b); p(a); p(b); p(1)gg. Note that, in the previous example, the presence of  p(1 ) in [Mxstable P2 ]1 xstable and in [MP3 ]1 indicates that p(X) is deducible from P2 and from P3. This fact is just a consequence of the universal generalization theorem of classical logic which states that if a sentence '(~c) is deducible from a set of axioms in ~ X) ~ is deducible from the set of which the constants ~c do not occur then 8X'( axioms as well (see e.g. [Sho67]). This is the basis for our de nition of correct answer to a non-ground query. ~ X~ = X1 ; : : :; Xn listing all De nition 2.18 Given a non-ground query q(X); the free variables in q, we de ne the correct answer to the query with respect to a consistent edlp P and semantics XSEM to be the truth value determined as 36

follows:

8 true; if there exist ~a =< a1; : : :an >2 UPn s.t. > > < MXSEM j= q(~a) P ~ answer(P; q(X)) = > false; if there exist ~ =< 1; : : :; n >2 ([UP ]n ? UP )n s.t. [MXSEM ]n j=q(~ ) > P : unknown; otherwise Clearly the previous de nition of correct answer coincides with de nition 2.15 when dealing with ground queries since [MXSEM ]0 = MXSEM . P P Because of the universal generalization theorem, we are able to extend proposition 2.4 to formulas with free variables. ~ be a formula in the language Proposition 2.14 Let P be an edlp and let '(X) of P , where X~ lists all the free variables in '. Then, ~ 0 _ ?) ~ 0 i MSEM ~ i consistent(MSEM j= ('(X) MXSEM j= '(X) P P P ) j= '(X) ~ X) ~ Proof: It follows from Proposition 2.4 and the fact that MXSEM j= 8X'( P i [MXSEM ] j = '(~  ) where ~  consists of n new constant symbols not appearn P ing in P. 0 ?

0 ?

~ 0 _?) in MSEM The preceding proposition guarantees that evaluating ((q(X)) P ~ 0 in exactly the consistent models in can be thought of as evaluating (q(X)) MSEM P . Now we are ready to describe the extended proof procedure. De nition 2.19 Let PPSEM be a proof procedure to answer queries w.r.t. ndlps and SEM . We de ne an extension of this procedure, called PPXSEM , which answers queries w.r.t. edlps and XSEM as follows: ~ where X~ = X1 ; : : :; Xn lists all the free Given an edlp P and a query q(X) variables in q, do: ~ = true.  If P is inconsistent w.r.t. XSEM then PPXSEM (P; q(X))  Otherwise: Let ~ =< 1; : : :; n > be a tuple of n new constants not appearing in P . ~ 0 _?) and the query 1. Simultaneously apply PPSEM to the query ((q(X)) 0 0 ((q(~ )) _ ?) w.r.t. program P? . ~ 0 _ ?) = true11 then PPXSEM (P; q(X)) ~ = 2. If PPSEM (P?0 ; (q(X)) true. 0 ?

0 ?

11 If P PSEM returnsalso, as part of the answer, a set of substitutions f1 ; : : : ; k g; k  0 such that MSEM j= [(q0(X~ ) _ ?)1 _ : : : _ (q0 (X~ ) _ ?)k ] then P PXSEM can return f1 ; : : : ; k g P as a witness for q(X~ ) for which MXSEM j= [q(X~ )1 _ : : : _ q(X~ )k ]. P 0 ?

37

~ = false. 3. If PPSEM (P?0 ; (q(~ ))0_?) = true then PPXSEM (P; q(X)) ~ = unknown. 4. Otherwise PPXSEM (P; q(X)) It is clear that the restriction of this procedure to ground queries agrees with the proof procedure described in the previous section. Our next theorem shows that PPXSEM is well de ned and gives the correct answer, in the sense of Def. 2.18, which implies that the model theoretic and the proof theoretic characterizations of XSEM coincide.

Theorem 2.15 Let PPSEM and PPXSEM be as in Def. 2.19. The following

statements hold: 1. If PPSEM is well de ned and sound then PPXSEM is well de ned. 2. If PPSEM is a sound proof procedure w.r.t. SEM so is PPXSEM w.r.t. XSEM . 3. If PPSEM is a complete proof procedure w.r.t. SEM so is PPXSEM w.r.t. XSEM .

Proof:

~ where X~ = X1 ; : : :; Xn Fix an arbitrary edlp P and an arbitrary query q(X), lists all the free variables in q, n  0. ~ since by 1 It is clear that PPXSEM produces an answer to input (P; q(X))

hypothesis PPSEM is well de ned. We need to show that PPXSEM always produces the same answer for that input. The only possible case that may lead to di erent answers is that when (i) P is consistent, ~ 0 _ ?) = true and (ii) PPSEM (P?0 ; (q(X)) 0 (iii) PPSEM (P? ; (q(~))0 _ ?) = true simultaneously. (i) implies that P has in fact consistent models. Since PPSEM is sound, (ii) and proposition 2.14 imply that there exists ~a 2 UP s.t. for every consistent M 2 MXSEM ; M j= q(~a); also (iii) and P the universal generalization theorem imply that for every consistent M 2 ~ and in particular M j= q(~a) which yields a MXSEM ; M j= 8X~  q(X) P contradiction. 2,3 In order to show that PPXSEM is sound w.r.t. XSEM we need to show that: ~ = true ) answer(P; q(X)) ~ = true PPXSEM (P; q(X)) ~ = false ) answer(P; q(X)) ~ = false PPXSEM (P; q(X)) 38

~ = unknown ) answer(P; q(X)) ~ = unknown PPXSEM (P; q(X)) To show that PPXSEM is complete w.r.t. XSEM we need to prove the converse implications. For brevity we show both directions simultaneously. ~ Case 1: Assume P is inconsistent. Then, for every query q(X), ~ PPXSEM (P; q(X)) = true and so PPXSEM is sound and complete w.r.t. P and XSEM . Case 2: Assume P is consistent. Then, ~ = true  PPXSEM (P; q(X)) 0 ~ _ ?) = true i PPSEM (P? ; q0(X) j= q0 (~a) _ ? since by hypothesis i there exists ~a 2 UPn s.t. MSEM P PPSEM is ()) sound and (() complete w.r.t. SEM . i there exists ~a 2 UPn s.t. MSEM j= q(~a) by Prop. 2.4 P i there exists ~a 2 UPn s.t. answer(P; q(~a)) = true by Def 2.18 ~ = true by Def 2.18. i answer(P; q(X))  PPXSEM (P; q) = false i PPSEM (P?0 ; (q(~ ))0 _ ?) = true 0 i [MSEM P ]n j= ((q(~ )) _ ?) since by hypothesis, PPSEM is ()) sound and (() complete. i [MXSEM ]n j= (q(~ )) by Prop. 2.4 P ~ = false by Def 2.18. i answer(P; q(X)) ~ = unknown  PPXSEM (P; q(X)) 0 ~ 0 _?) 6= true and PPSEM (P?0 ; (q(~ ))0 _?) 6= i PPSEM (P? ; (q(X)) true i for all ~a 2 UPn and all ~ 2 ([UP ]n)n ? UPn there are models 0 0 and N 0 2 [MSEM M 0 2 MSEM P ]n, s.t. M 6j= ((q(~a)) _ ?) and P N 0 6j= ((q(~ ))0 _ ?) since by hypothesis, PPSEM is ()) sound and (() complete. i for all ~a 2 UPn and all ~ 2 ([UP ]n)n ? UPn there are consistent 0 0 and N 0 2 [MSEM models M 0 2 MSEM P ]n, s.t. M 6j= (q(~a)) and P 0 0 N 6j= (q(~ )) i for all ~a 2 UPn and all ~ 2 ([UP ]n)n ? UPn there are models M 2 ]n, s.t. M 6j= q(~a) and N 6j= q(~ ) by and N 2 [MXSEM MXSEM P P Proposition 2.14 i there is no ~a 2 UPn s.t. MXSEM j= q(~a) and there is no ~ 2 P ([UP ]n)n ? UPn s.t. [MXSEM ] j =  q(~  ) n P ~ = unknown by Def 2.18. i answer(P; q(X)) 0 ?

0 ?

0 ?

0 ?

0 ?

0 ?

0 ?

0 ?

0 ?

0 ?

0 ?

0 ?

39

Proposition 2.16 The algorithmic complexity of PPXSEM can be expressed in terms of the algorithmic complexity of PPSEM as follows: complexity(PPXSEM ) = 2 complexity(PPSEM ) + O(n), where n denotes the size of the input measured as the size of the query q plus the size of the edlp P .

~ Proof: O(n) corresponds to the complexity of translating P to P?0 and q(X) ~ and to (q(~ ))0 . The equation is evident from the algorithm described to q0 (X) in Def. 2.19 under the assumption that determining whether or not P is inconsistent is done as preprocessing.

This general extension may be applied, for instance, to the proof procedure developed by Fernandez and Lobo [FL93] which answers queries w.r.t. ndlps and the stable model semantics.

3 Complexity The complexities of di erent problems related to normal logic programs have been studied extensively (see e.g. [CS92],[Sch92]). In this section we show how to express the complexities of three fundamental problems for edlps in terms of the corresponding complexities for ndlps. Also, some complexity results for the stable model semantics are surveyed here and extended to cover logic programs with explicit negation. In what follows, P denotes a nite edlp, and n denotes the size of the program (which can be measured, for instance, as the number of clauses in the program). Also, a normal literal denotes either a literal l 2 L or the negation-by-default, not l, of such a literal.

Determining if a ground normal literal is true in some model in MXSEM . P We denote the problem of determining if a ground normal literal is true in some model in MXSEM by credulous-truth(XSEM, edlps). P As shown in Sect. 2.3, a ground normal literal g is true in some M 2 MXSEM P if and only if (g0 _ ?) is true in some N 2 MSEM P . Therefore, to determine , it is enough to transform P to P?0 and g to g0 credulous-truth of g in MXSEM P (which clearly can be done in linear time on the size of the program), and then to check the credulous-truth of g0 and (if necessary) the credulous-truth of ? in MSEM P . Then, 0 ?

0 ?

complexity(credulous-truth(XSEM ,edlps))  2 complexity(credulous-truth(SEM ,ndlps) + O(n) 40

and since any ndlp is also an edlp we have the following bound: complexity(credulous-truth(XSEM ,edlps))  complexity(credulous-truth(SEM ,ndlps)). As an illustration, consider the stable model semantics. Marek and Truszczynski showed in [MT91b] that for propositional normal logic programs, (propnlps), credulous-truth(stable, prop-nlps) is NP-complete. Therefore, for propositional extended logic programs, (prop-elps), credulous-truth(stable,prop-elps) is also NP-complete.

Determining if a ground normal literal is true in every model in MXSEM . P We denote the problem of determining if a ground normal literal is true in every model in MXSEM by skeptical-truth(XSEM, edlps). P Notice that a ground normal literal g is true in every model in MXSEM if P and only if not g does not hold in any model in MXSEM . Hence, P complexity(skeptical-truth(XSEM,edlps)) = complexity(complement(credulous-truth(XSEM,edlps))). Then, for the stable model semantics and propositional extended logic programs: complexity(skeptical-truth(XSEM,prop-elps)) = co-NP-complete, which generalizes the result in [MT91b] to extended logic programs.

Determining if a program has a model w.r.t. XSEM.

Notice that by Theorem 2.2, an edlp P has a model w.r.t. XSEM if and only if P?0 has a model w.r.t. SEM . Therefore: complexity(checking existence of a model of P w.r.t. XSEM ) = complexity(checking existence of a model of P?0 w.r.t. SEM ) + O(n).

O(n) in the previous equation comes from translating P to P?0 . For propositional normal logic programs, Marek and Truszczynski [MT91a] proved that determining the existence of stable models is NP-complete, hence, for the class of propositional extended logic programs this problem is also NP-complete. Marek, Nerode and Remmel [MNR92] showed that the set of Godel numbers of nite predicate normal logic programs having stable models is a 11 -complete set. It is easy to see that their result also holds for the set of Godel numbers of nite predicate extended logic programs having stable models since the prime transformation is recursive and indeed can be performed in polynomial time.

41

4 Conclusions

The following table summarizes the main results related to extended disjunctive logic programs including the contributions of this paper: SEMANTICS

THEORY

Extended Programs Fixpoint Model Proof Proc. Fixpoint Model Proof Proc.

HORN REFERENCE

DISJUNCTIVE THEORY REFERENCE

Stable Models

Stable

Stable Models

[GL90, GL91] Stationary

Stationary

Stable

S SE

[AP92]

[Prz90a, Prz91] Stationary This Paper

SEMANTICS

HORN/DISJUNCTIVE THEORY REFERENCE

Fixpoint Model Proof Proc.

TPE MSEM P EPPSEM

SEM

This Paper This Paper This Paper

Two critiques have been made about the use of explicit negation in logic programming. The rst one states that there may be cases in which it is not feasible to include every piece of negative information in the domain of the problem. In answer to that, we mention that Gelfond and Lifschitz [GL90] have pointed out that when the positive information about some predicate p is complete in a program it is enough to de ne  p as \ p not p". This remark also justi es to some extent keeping negation-by-default in extended logic programs. The second critique addresses the potential inconsistency of extended logic programs. In this respect we have described here concrete mechanisms to deal with inconsistent extended logic programs. In our view, these diculties are a small price to pay for the increased expressive power gained by the use of explicit negation.

5 Acknowledgements Support for this paper was provided by the Air Force Oce of Scienti c Research under grant number 91-0350, and the National Science Foundation under grant numbers IRI-8916059 and IRI 9300691. 42

References [ABW88] K.R. Apt, H.A. Blair, and A. Walker. Towards a theory of declarative knowledge. In J. Minker, editor, Foundations of Deductive Databases and Logic Programming, pages 89{148. Morgan Kaufmann Pub., Washington, D.C. USA, 1988. [AP92] J.J. Alferes and L.M. Pereira. On logic program semantics with two kinds of negation. In K. Apt, editor, Proceedings of the Joint International Conference and Symposium on Logic Programming, pages 574{588, Washington, D.C. USA, Nov 1992. The MIT Press. [Bar91] C. Baral. Issues in Knowledge Representation: Semantics and Knowledge Combination. PhD thesis, Dept. of Computer Science University of Maryland, College Park, MD. 20742 USA, 1991. [Bel88] N. Belegrinos. Clauses, Partial Interpretations and the Closed World Assumption. PhD thesis, Dept. Of Computer Science. University of Melbourne, Parkville, Victoria. Australia, 1988. [BLM89] C. Baral, J. Lobo, and J. Minker. Generalized well-founded semantics for logic programs. In Proceedings of the Tenth International Conference on Automated Deduction, pages 102{116, Germany, 1989. Springer Verlag. [BLM90a] C. Baral, J. Lobo, and J. Minker. Generalized disjunctive wellfounded semantics: Declarative semantics. In Proceedings of the Fifth International Symposium on Methodologies for Intelligent Systems, pages 465{473, Knoxville TN, USA, 1990. [BLM90b] C. Baral, J. Lobo, and J. Minker. Generalized disjunctive wellfounded semantics: Procedural semantics. In Proceedings of the Fifth International Symposium on Methodologies for Intelligent Systems, pages 456{464, Knoxville TN, USA, 1990. [BLM91] C. Baral, J. Lobo, and J. Minker. WF3 : A semantics for negation in normal disjunctive logic programs. In Proceedings of the Sixth International Symposium on Methodologies for Intelligent Systems, pages 459{468, Charlotte NC, USA, 1991. [CH85] A. Chandra and D. Harel. Structure and complexity of relational queries. Journal of Logic Programming, 2(1):1{15, April 1985. [Cha88] D. Chan. Constructive negation based on the completed database. In R. Kowalski and K. Bowen, editors, Proceedings of the Fifth International Conference and Symposium on Logic Programming, pages 111{125, Seattle, WA. USA, Aug. 1988. The MIT Press. 43

[Cla78]

K.L. Clark. Negation as failure. In H. Gallaire and J. Minker, editors, Logic and Data Bases, pages 293{322. Plenum, New York, USA, 1978. [CS92] M. Cadoli and M. Schaerf. A survey on complexity results for nonmonotonic logics. Preprint, Universita di Roma \La Sapienza", via Salaria 113, 00198 Roma, Italy. To appear in the Journal of Logic Programming, special issue edited by T. Przymusinski on Logic Programming and Nonmonotonic Reasoning, 1992. [FL93] J.A. Fernandez and J. Lobo. A proof procedure for stable theories. Technical Report CS-TR-3034, UMIACS-TR-93-14, University of Maryland, College Park, MD 20742 USA, 1993. [FLMS93] J.A. Fernandez, J. Lobo, J. Minker, and V.S. Subrahmanian. Disjunctive lp + integrity constrains = stable model semantics. Annals of Mathematics and Arti cial Intelligence, 8(3-4), 1993. [Gel87] M. Gelfond. On strati ed autoepistemic theories. In Proceedings of AAAI-87, pages 207{211, 1987. [GL88] M. Gelfond and V. Lifschitz. The stable model semantics for logic programming. In R. Kowalski and K. Bowen, editors, Proceedings of the Fifth International Conference and Symposium on Logic Programming, pages 1070{1080, Seattle, WA. USA, Aug. 1988. The MIT

Press. [GL90] M. Gelfond and V. Lifschitz. Logic programs with classical negation. In D.H.D. Warren and P. Szeredi, editors, Proceedings of the Seventh International Conference on Logic Programming, pages 579{ 597, Jerusalem, Israel, June 1990. The MIT Press. [GL91] M. Gelfond and V. Lifschitz. Classical negation in logic programs and disjunctive databases. New Generation Computing, 9:365{385, 1991. [Hil74] R. Hill. Lush resolution and its completeness. Technical Report DCL Memo 78, Department of Arti cial Intelligence, University of Edinburgh, August 1974. [IKH92] K. Inoue, M. Koshimura, and R. Hasegawa. Embedding negation as failure into a model generation theorem prover. In D. Kapur, editor, Proceedings of the Eleventh International Conference on Automated Deduction, pages 400{415, Saratoga Springs NY, USA, June 1992.

[Llo87]

Springer-Verlag. J.W. Lloyd. Foundations of Logic Programming. Springer-Verlag, second extended edition, 1987. 44

[LMR89] J. Lobo, J. Minker, and A. Rajasekar. Extending the semantics of logic programs to disjunctive logic programs. In G. Levi and M. Martelli, editors, Proceedings of the Sixth International Conference on Logic Programming, pages 255{267, Cambridge, Massachusetts., June 1989. MIT Press. [LMR92] J. Lobo, J. Minker, and A. Rajasekar. Foundations of Disjunctive Logic Programming. The MIT Press, 1992. [Lob91] J. Lobo. Semantics for Normal Disjunctive Logic Programs. PhD thesis, Dept. of Computer Science. Univ. of Maryland., College Park, MD 20742. USA, 1991. [Min82] J. Minker. On inde nite databases and the closed world assumption. In Proceedings of the Sixth Conference on Automated Deduction, pages 292{308, 1982. Also in: Lecture Notes in Computer Science 138, pages 292-308. Springer Verlag, 1982. [MNR92] V. W. Marek, A. Nerode, and J.B. Remmel. The stable models of a predicate logic program. In K. Apt, editor, Proceedings of the

Joint International Conference and Symposium on Logic Programming, pages 446{460, Washington D.C., USA, Nov 1992. The MIT

[MR88]

[MR89]

Press. J. Minker and A. Rajasekar. Procedural interpretation of non-Horn logic programs. In E.L. Lusk and R.A. Overbeek, editors, Proceedings of the Ninth International Conference on Automated Deduction, pages 278{293, Argonne, IL. USA, May 1988. J. Minker and A. Rajasekar. Disjunctive logic programming. In

Proceedings of the International Symposium on Methodologies for Intelligent Systems, pages 381{394, 1989. (Invited Lecture).

[MR90]

J. Minker and A. Rajasekar. A xpoint semantics for disjunctive logic programs. Journal of Logic Programming, 9(1):45{74, July 1990. [MR93] J. Minker and C. Ruiz. On extended disjunctive logic programs. In J. Komorowski and Z.W. Ras, editors, Proceedings of the Seventh International Symposium on Methodologies for Intelligent Systems, pages 1{18. Lecture Notes in AI. Springer-Verlag, June 1993. (Invited Paper). [MT91a] V. W. Marek and Truszczynski. Autoepistemic logic. Journal of the ACM, 38(3):588{619, 1991. [MT91b] V. W. Marek and Truszczynski. Computing intersection of autoepistemic expansions. In Proceedings of the Fifth International Workshop 45

on Logic Programming and Non-monotonic Reasoning, pages 37{50. The MIT Press, 1991. [MZ82] J. Minker and G. Zanon. An extension to linear resolution with selection function. Information Processing Letters, 14(3):191{194, June 1982. [Nel49] D. Nelson. Constructive falsity. Journal of Symbolic Logic, 14(1):16{ 26, March 1949. [Prz88a] T.C. Przymusinski. On the declarative semantics of deductive databases and logic programming. In J. Minker, editor, Foundations of Deductive Databases and Logic Programming, pages 193{216. Morgan Kaufmann, 1988. [Prz88b] T.C. Przymusinski. Perfect model semantics. In R. Kowalski and K. Bowen, editors, Proceedings of the Fifth International Conference and Symposium on Logic Programming, pages 1081{1096, Seattle, WA. USA, Aug. 1988. The MIT Press. [Prz89a] T.C. Przymusinski. Every logic program has a natural strati cation and an iterated xed point model. In Proceedings of the Eighth ACM SIGACT-SIGMOD-SIGART Symposium on Principle of Database Systems, pages 11{21, Philadelphia, PA. USA, 1989.

[Prz89b] T.C. Przymusinski. On the declarative and procedural semantics of logic programs. Journal of of Automated Reasoning, 5(2), June 1989. [Prz90a] T.C. Przymusinski. Extended stable semantics for normal and disjunctive programs. In D.H.D. Warren and P. Szeredi, editors, Pro-

ceedings of the Seventh International Conference on Logic Programming, pages 459{477, Jerusalem, Israel, June 1990. The MIT Press.

[Prz90b] T.C. Przymusinski. Stationary semantics for disjunctive logic programs and deductive databases. In S. Debray and M. Hermenegildo, editors, Proceedings of the North American Conference on Logic Programming, pages 42{59, Austin, TX. USA, Oct. 1990. The MIT Press. [Prz91] T. C. Przymusinski. Stable semantics for disjunctive programs. New Generation Computing, 9:401{424, 1991. [PW89] P. Pearce and G. Wagner. Logic programming with strong negation. In P. Schroeder-Heister, editor, Proceedings of the International Workshop on Extensions of Logic Programming, pages 311{ 326, Tubingen, FRG, Dec. 1989. Lecture Notes in Arti cial Intelligence, Springer -Verlag. 46

[Rei78]

R. Reiter. On closed world data bases. In H. Gallaire and J. Minker, editors, Logic and Data Bases, pages 55{76. Plenum, New York, 1978. [RLM89] A. Rajasekar, J. Lobo, and J. Minker. Weak generalized closed world assumption. Journal of Automated Reasoning, 5:293{307, 1989. [RLS91] D.W. Reed, D.W. Loveland, and B.T. Smith. An alternative characterization of disjunctive logic programs. In Proceedings of the International Logic Programming Symposium, Cambridge, Massachusetts, 1991. MIT Press. Also: Technical Report, CS-1991-11. Dept. of Computer Science. Duke University. [Ros89a] K.A. Ross. A procedural semantics for well-founded negation in logic programs. In Proceedings of the Eighth ACM SIGACT-SIGMODSIGART Symposium on Principle of Database Systems, Philadelphia, PA. USA, 1989. [Ros89b] K.A. Ross. Well-founded semantics for disjunctive logic programs. In Proceedings of the First International Conference on Deductive and Object Oriented Databases, pages 352{369, Kyoto, Japan, 1989. [RT88] K. A. Ross and R. W. Topor. Inferring negative information from disjunctive databases. Journal of Automated Reasoning, 4(2):397{ 424, December 1988. [Sch92] J.S. Schlipf. A survey of complexity and undecidability results in logic programming. In H. Blair, V.W. Marek, A. Nerode, and J. Remmel, editors, Informal Proceedings of the Worshop on Structural Complexity and Recursion-theoretic Methods in Logic Programming., pages 143{164, Washington, D.C. USA, Nov. 1992. [Sho67] J. Shoen eld. Mathematical Logic. Addison-Wesley, 1967. [vEK76] M.H. van Emden and R.A. Kowalski. The semantics of predicate logic as a programming language. Journal of the ACM, 23(4):733{ 742, 1976. [VG88] A. Van Gelder. Negation as failure using tight derivations for general logic programs. In J. Minker, editor, Foundations of Deductive Databases and Logic Programming, pages 1149{1176. Morgan Kaufmann, 1988. [VGRS88] A. Van Gelder, K.A. Ross, and J.S. Schlipf. Unfounded sets and well-founded semantics for general logic programs. In Proceedings of the Seventh ACM Symposium on Principles of Database Systems., pages 221{230, 1988. 47

[Wag91] G. Wagner. A database needs two kinds of negation. In B. Thalheim, J. Demetrovics, and H.D. Gerhardt, editors, Proceedings of the Third Symposium on Mathematical Fundamentals of Database and Knowledge Base Systems, pages 1{15, Rostock,Germany, May

[YH85]

1991. Lecture Notes in Computer Science, Springer -Verlag. A. Yahya and L.J. Henschen. Deduction in non-Horn databases. Journal of Automated Reasoning, 1(2):141{160, 1985.

48