a nondeterministic well-founded semantics

37
Annals of Mathematics and Artificial Intelligence 14(1995)37-73 37 A nondeterministic well-founded semantics Alberto Torres Computer Science Department, Stanford University, Stanford, CA 94305-2140, USA e-mail: torres @cs.stanford.edu In order to define the meaning of a collection of rules forming a database or logic program, we have to consider a number of alternative interpretations. In the case of stratified and locally stratified programs, researchers agree that a single such interpretation captures the intended semantics [16]. Nevertheless, nonstratified datalog databases and logic programs can be seen as descriptions of a set of"alternative scenarios". Sacch and Zaniolo [20] have shown that the nondeterministic nature of these programs can be used to model several useful queries such as those involving the choice operator. They introduced partial stable models, a semantics that exhibits the desired nondeterministic behavior. This work opened the problem of finding efficient ways to compute these nondeterministic scenarios. Papadimitriou and Yannakakis [18] introduced a tie-breaking procedure that nondeterministically computes fixpoints for some programs and has polynomial data complexity. However, this algorithm does not handle many programs including choice programs. In this paper, we introduce the notion of well-founded hypothesis, an intuitive account based on hypothetical reasoning that captures the same semantics as Sacch and Zaniolo's partial stable models. We introduce a notion of linearity that can be used in a skeptical or nondeterministic fashion. We show that the skeptical case corresponds to the well-founded semantics and that the nondeterministic case computes a sound subclass of well-founded hypotheses. We show that this latter subclass has polynomial data complexity, correctly handles choice programs, and is universally defined. We develop a simple nondeterministic procedure that computes these linear hypotheses, and we extend it to compute a strict superclass of the well- founded tie-breaking fixpoints in polynomial time. 1. Introduction Monotonic deductive systems are unable to express several important queries such as the difference of two sets. The closed world assumption [19] associates these nonmonotonic queries with a form of negation as failure (NAF). In spite of the simplicity and usefulness of NAF, the semantics of this device is still open. Researchers agree that the intended meaning of stratified [6] and locally stratified [16] databases is captured by the perfect model semantics. However, many programs are not stratified. 1) l)In this paper, we use the terms (logic) program and database interchangeably. J.C. Baltzer AG, Science Publishers

Upload: alberto-torres

Post on 10-Jul-2016

212 views

Category:

Documents


0 download

TRANSCRIPT

Annals of Mathematics and Artificial Intelligence 14(1995)37-73 37

A nondeterministic well-founded semantics

A l b e r t o Tor res

Computer Science Department, Stanford University, Stanford, CA 94305-2140, USA

e-mail: torres @ cs.stanford.edu

In order to define the meaning of a collection of rules forming a database or logic program, we have to consider a number of alternative interpretations. In the case of stratified and locally stratified programs, researchers agree that a single such interpretation captures the intended semantics [16]. Nevertheless, nonstratified datalog databases and logic programs can be seen as descriptions of a set of"alternative scenarios". Sacch and Zaniolo [20] have shown that the nondeterministic nature of these programs can be used to model several useful queries such as those involving the choice operator. They introduced partial stable models, a semantics that exhibits the desired nondeterministic behavior. This work opened the problem of finding efficient ways to compute these nondeterministic scenarios. Papadimitriou and Yannakakis [18] introduced a tie-breaking procedure that nondeterministically computes fixpoints for some programs and has polynomial data complexity. However, this algorithm does not handle many programs including choice programs. In this paper, we introduce the notion of well-founded hypothesis, an intuitive account based on hypothetical reasoning that captures the same semantics as Sacch and Zaniolo's partial stable models. We introduce a notion of linearity that can be used in a skeptical or nondeterministic fashion. We show that the skeptical case corresponds to the well-founded semantics and that the nondeterministic case computes a sound subclass of well-founded hypotheses. We show that this latter subclass has polynomial data complexity, correctly handles choice programs, and is universally defined. We develop a simple nondeterministic procedure that computes these linear hypotheses, and we extend it to compute a strict superclass of the well- founded tie-breaking fixpoints in polynomial time.

1. Introduction

Monotonic deductive systems are unable to express several important queries such as the difference of two sets. The closed world assumption [19] associates these nonmonotonic queries with a form of negation as failure (NAF). In spite of the simplicity and usefulness of NAF, the semantics of this device is still open. Researchers agree that the intended meaning of stratified [6] and locally stratified [16] databases is captured by the perfect model semantics. However, many programs are not stratified. 1)

l)In this paper, we use the terms (logic) program and database interchangeably.

�9 J.C. Baltzer AG, Science Publishers

38 A. Torres, A nondeterministic well-founded semantics

The semantics of nonstratified programs is particularly difficult to characterize since frequently no single model captures the intended semantics of such programs. In fact, nonstratified programs can be seen as specifications of a set of "alternative scenarios". Therefore, these programs are capable of expressing knowledge that can be used in a skeptical, credulous or nondeterministic manner. To illustrate this point, let us consider the following examples:

Example 1.1

In a network of buildings, we have to decide which buildings will have cafeterias and which ones will have lounges. Each building will have either a lounge or a cafeteria, but not both. Any building without a cafeteria should be adjacent to one with a cafeteria and no adjacent buildings should both have cafeterias. The solution to this problem can be given by the following program:

lounge(X) ~-- adjacent(X, Y) A cafeteria(Y)

cafeteria(X) ~-- --1 lounge(X)

where adjacent(a, b) means "Building a is adjacent to Building b". The semantics of this program is naturally expressed as a collection of "possible scenarios", i.e., viable assignments. We can then pose queries of three different kinds:

(1) Skeptical: Queries about propositions being true in all scenarios (e.g., must Building a have a cafeteria?)

(2) Credulous: Queries about propositions being true in some scenarios (e.g., can Building a have a cafeteria?)

(3) Nondeterministic: Queries about one particular scenario (e.g., construct one assignment satisfying the given rules).

Example 1.2

Sacc~t and Zaniolo [20] have shown that the nondeterministic nature of nonstratified programs can be used to model choice operations. For instance, if we have a database of students and courses with a stored relation enrolls(Student, Course), the intended scenarios described by the program

a_student(S, C) ~-- enrolls(S, C) A --1 other_student(S, C)

other_student(S1, C) ~ enrolls(S1, C) A S1 ~ $2 A a_student(S2, C)

corresponds to the different possibilities of choosing a student in every class. For instance, if the database consists of the facts

enrolls(sean, cs105)

enrolls(mary, cs l 01)

enrolls(peter, csl01)

A. Torres, A nondeterministic well-founded semantics 39

there are two intended scenarios in which the extension of the choice predicate a_student are, respectively, {a_student(sean, cs105), a_student(mary, csl01)} and {a_student(sean, cs105), a_student(peter, csl01) }.

Well-founded semantics [8] and stable models [7] are two important attempts to assign a meaning to all programs. Well-founded semantics generalizes the perfect model, is defined for all programs, and has polynomial data complexity. However, the well-founded model is not able to express the nondeterministic nature of nonstratified programs. Stable models are capable of modeling alternative scenarios and non- determinism, but are not defined for all programs and their computation is intractable [14]. Sacch and Zaniolo [20] introduced partial stable models, a generalization of stable models that is defined for all programs, but this semantics does not convey a strong intuition. Moreover, [20] left open the problem of efficiently computing such partial stable models. Papadimitriou and Yannakakis [18] introduced a well-founded tie- breaking procedure that nondeterministically computes stable models for some programs and has a polynomial data complexity. However, this procedure does not handle choice programs and many others.

The semantic foundation described in this paper is based on a slightly restricted version of the hypothetical semantics presented in [23]. For a given program, a hypothesis is a set of assumptions, and an assumption is a negative literal of that program. We characterize the valid conclusions from a given hypothesis in a program through the notion of support of that program. An atom is supported by a hypothesis if it can be proved by applying the rules of the program "forward", using only the negative literals in the hypothesis. We can then see a program as a "ground for debate" among different hypothesis.

A hypothesis attacks another if it supports the contrary of some assumptions in the latter hypothesis. A well-founded hypothesis is one that attacks all the hypotheses that attack it. The maximal well-founded hypothesis with all their supported conclusions define the interpretations that correspond to our notion of "possible scenarios".

Through the use of the support relation, we can concentrate on the study of the negative part of an interpretation and study its structure. This approach is the dual of the one used to define pure models [13]. We believe that studying the negative part leads to a more intuitive presentation. Moreover, we can exploit the structure of the hypotheses to derive useful results. For instance, we introduce a graph-theoretical representation of the "essential" hypotheses of a program and use it to derive sufficient conditions for totality that strictly generalize local stratification and structural totality.

We introduce a skeptical class of defensive hypothesis which is included in all maximal well-founded hypotheses. We prove that the maximal hypothesis is unique and that with its supported conclusions constitutes the well-founded model of the given program.

We study the class of well-founded hypotheses that can be computed incrementally by adding assumptions one by one. We present a deterministic procedure that computes

40 A. Torres, A nondeterministic well-founded semantics

linear defensive hypotheses and show that it computes the well-founded model of datalog programs. We then introduce a nondeterministic version of this algorithm and prove that it has polynomial data complexity. We show that even though the procedure is incomplete, it correctly handles a large class of programs including the ones presented in the preceding examples. This procedure is based on a form of linear hypothetical reasoning and is able to handle the choice programs. We show in this paper that such a procedure fundamentally works as a nondeterministic version of the well-founded semantics. We then extend the nondeterministic algorithm with a tie- breaking strategy that strictly generalizes the well-founded tie-breaking procedure of [18].

The rest of this paper is organized as follows. In section 2, we introduce our notation and the basic notions of support and attack. In section 3, we define the class of well-founded hypotheses. In section 4, we study the relation between our approach and

(1) The pure models of [13], and

(2) The main proposals for logic programming semantics.

In section 5, we study the relations between this approach and other hypothetical semantics. In section 6, we introduce a graph-theoretical representation for logic programs and study some sufficient conditions for totality of maximal well-founded hypotheses. In section 7, we lay down the fundamentals of incremental computation that provide the foundation for the basic algorithms described later. In section 8, we introduce defensive hypotheses that capture a pattern of skeptical reasoning equivalent to the well-founded semantics. In section 9, we present the linear deterministic and nondeterministic well-founded derivation procedures, and the extension of the latter with the tie-breaking strategy. Finally, in section 10, we summarize our results and outline some directions for further work.

2. Preliminaries

In this section, we introduce the basic notation used in the rest of the paper. We also introduce the notion of support that characterizes the valid conclusions from a given hypothesis. This notion captures all the relevant syntactical information about a logic program, and is the basis for all the semantical constructs introduced in this paper.

A program or database P is a set of first-order rules of the form: Head ~-- Body, where Head is an atom and Body is a possibly empty conjunction of literals or subgoals. If r is a rule, then head(r) denotes the atom in its head and body(r) the set of literals in its body. A trivial rule is one with no subgoals. A trivial rule is considered identical to the atom in its head. All variables are implicitly universally quantified. A Horn or positive program is one where every rule has only positive subgoals. A datalog program is a program with no occurrences of function symbols.

A. Torres, A nondeterministic well-founded semantics 41

When necessary, we will distinguish between the extensional database (EDB) which contains all the trivial rules defining predicates that do not occur in the head of a nontrivial rule, and the intensional database (IDB) that contains the remaining rules.

Let P be a logic program. We denote by H ( P ) the Herbrand base of P and by P~ the Herbrand instantiation of P, that is, the ground program obtained by replacing the variables in P by terms in its Herbrand universe in all possible ways. If A is a set of literals, then -7 A is the set of literals corresponding to the negation of elements in A. We denote by A + and A-, respectively, A A H ( P ) and A f-) -7 H ( P ) . We also denote by A the set H ( P ) - (A + t3 -~A-). An assumption is a ground negative literal in -7 H ( P ) , and a hypothesis is a set of assumptions.

A (Herbrand) interpretation I for a program P is a subset of H ( P ) U 7 H ( P ) such that If-) 7 1 = 0 . We say that a ~ H ( P ) is defined in I if a E I § t3 7 1 - and undefined if a E i . An interpretation I is total if H ( P ) = I + U 7 I - , otherwise it is partial. An atom a is true in I if a E I, false if --1 a ~ I , and undefined if a ~ I + U 71- . An interpretation I is a partial model for a program P if P U I is consistent. A model is a total partial model.

We denote by PA the ground program resulting from deleting all assumptions in a given hypothesis A from the body of rules in P~, and P~ the program resulting from deleting all rules with negative subgoals from Pa. Since Pz~ is a ground Horn program for any A, deduction can be limited to forward deduction without loss of expressive power.

DEFINITION 2.1 (SUPPORT)

A hypothesis A is a support for an atom a in a program P (denoted by A P c~) P

if Pz~ ~ a. We denote by A ~ the set of atoms supported by a hypothesis A. Furthermore, ffain, P , , ,

a support A is minimal for a (denoted by A ~ a ) ~) if no subset of A supports a.

p ~-- -~q A -~ t

q ~-- -~ p A -~ t r~--~p r ~ - - ~ r

t 6 - - s

Fig. 1. Program P1.

Consider the program P1 of fig. 1 and A = {--1 q, --1 t, --1 r}. Then Plzx is the program:

2) Notation: We omit the superscript P from the above notation as well as others introduced later when it is clear from the context. A min superscript over a binary relation always indicates the minimality of the left operand (with respect to set inclusion). When definitions and results based on support do not specify otherwise, we assume they refer to any given program.

42 A. Torres, A nondeterministic well-founded semantics

p <----

q ~-- -~p

r ~ - - - ~ p

r e -

t ~ - - s

Now we obtain P~-A by removing the second and third rule from P1A:

p<---

r~--

t~ - -S

Since we can derive only the atoms p and r from program P~-A above, A supports p and q in P1 and nothing else. Notice that A is not a minimal support for either p or r. There is only one minimal support for p: {~q , ~ t} . There are two minimal supports for r: { -~p} and { ~ r } . Notice that there is no A' that supports t in P1 even though there is a rule with t in its head.

Intuitively, an assumption set supports an atom if the latter can be proved by applying the rules "forward", assuming true all the negative atoms in the former. Notice the support is then a monotonic operator.

THEOREM 2.2

P I f A ~ - ~ a , t h e n A U P ~ a .

Proof P

If A ~ a , then there is a proof of tz in P~. This proof can be easily modified to be a proof of a in P U A. []

However, not all conclusions entailed by A U P are supported by A in P. For instance, the hypothesis { ~q} does not support p in the program {q <--- --,p} even though {q <--- ~p , -~ q} ~ p. Notice that the notion of support captures the directionality of the rules. In the next sections, we show that this directionality encompasses all the relevant syntactical information about any given program.

In order to determine if a given atom is supported by a hypothesis A, we only need to perform deduction in Pz~. Since deduction in a Horn program can be done in linear time, we can state the following proposition.

PROPOSITION 2.3

Let P be a propositional logic program, A a hypothesis for P and a an atom. P Determining if A ~ a can be done in time proportional to the size of P.

A. Torres, A nondeterministic well-founded semantics 43

Now we introduce support dags that are graphical representations of "proofs".

DEFINITION 2.4

Let P be a logic program and a E .7-/(P). A support dag (directed acyclic graph) for a in P is a labeled finite rooted dag with root a such that:

(1) label(o:) = r for some r E P ~ such that head(r) = a.

(2) The children of a in the dag are the literals in body(r).

(3) Every child of a correspionding to a negative literal -~ fl is a leaf and has no label.

(4) The sub-dag rooted at each child of a corresponding to a positive literal fl is a support dag for ti-

The fringe of a support dag is the set of negative literals that occur as leaves in it. 3) We say that a support graph is enabled by a hypothesis A if its fringe is included in A.

The relation between supports and support dags is rather straightforward. A hypothesis is a support for a given atom if it enables a support dag for such an atom.

THEOREM 2.5

A hypothesis A supports an atom a in a program P if and only if A enables a support dag a in P.

Proof

Notice that since P~ is a positive program, A P a if and only if there is a classical forward proof of a in P~. It is easy to see that such a proof exists if and only if a support dag exists for a in P~. (Notice that this dag does not have any negative leaf.) We then need to prove that such a dag exists if and only if there is a support for a in P whose fringe is included in A. But this follows from the fact that any rule in P~ corresponds to a rule in P~ whose negative subgoals all belonged to a and were deleted. []

COROLLARY 2.6 min,P

If A ~ a , then there is a support dag for a in P whose fringe is exactly A.

COROLLARY 2.7 min,P

If A ~ a , then A is finite.

3) Notice that every leaf is either a negative literal or a positive literal labeled by a trivial rule.

44 A. Torres, A nondeterministic well-founded semantics

Finally, we introduce the attack relation that allows us to detect conflicting hypotheses and to establish a preference relation among them.

DEFINITION 2.8 (ATTACK)

A hypothesis A attacks another hypothesis A' in a program P (denoted by A--~e A ') if A supports the negation of some assumption in A', i.e. if A m f3 --,A' ~ 0 . In this case, we then say that A is an attack for A'.

DEFINITION 2.9 (SELF-CONSISTENCY)

A hypothesis A is self-consistent in a program P if it does not attack itself. The supported interpretation of a self-consistent hypothesis A is Ia = A U A " . We say that an interpretation is supported if it is the supported interpretation of some hypothesis A.

For example, in P1 of fig. 1, we have {--, t, ~ p} ~ {9 p, --1 q}. Thehypothes i s

{-~p, ~ t} is self-consistent, but { ~ p , ~q , ~ t} is not since {~p,~q,-- , t} D {q,p}.

3. Well-founded hypotheses

In this section, we introduce well-founded hypotheses. These hypotheses are able to counter-attack any attacking hypotheses. We introduce an alternative definition based on the notion of unfounded assumptions. Finally, we show that every program has at least one maximal well-founded hypothesis that defines a natural semantic for logic programs.

DEFINITION 3.1 (WELL-FOUNDED HYPOTHESIS)

A hypothesis is a well-founded hypothesis (WFH) if it is self-consistent and attacks every attack. A maximal WFH (w.r.t. set inclusion, is denoted MWFH.

For instance, P1 of fig. 1 has the following eight WFH: 0, { ~s}, { ~t} , { ~s , ~ t} , { ~p,--1 t}, { ~q, - - , t}, { ~ p , ~s,--1 t}, {-1 q, ~s , ~ t} . The last two of these WFH are the only MWFH of P1.

Notice that O is a WFH since no hypothesis can attack it. This is obviously true for any program. For instance, the empty hypothesis corresponds to assigning no cafeterias in the cafeteria/lounge program of example 1.1. Although this hypothesis does not form a complete assignment, it is obviously compatible with any other assignment.

PROPOSITION 3.2

The empty set is a WFH for every program. We call O the trivial WFH.

A. Torres, A nondeterministic well-founded semantics 45

Even though the definition of "well-founded hypothesis" requires that the given hypothesis attack every attack, we can limit this criterion to the minimal supports of the negation of the assumptions it contains.

THEOREM 3.3

A hypothesis is a WFH if and only if it is self-consistent and attacks every minimal attack.

Proof

The "only if" part follows directly from definition 3.1. To prove the "if" part, we need to show that if a hypothesis attacks every minimal a .t-tack, it attacks any attack. Let us than assume that A ~ A~ for every A' such that A' ~-~ A. If A" ~ A, then there is a A'" C A" such that A " ~ A. But since A ~ A", it follows that A ~ A". []

For instance, in table 1 we show the eight WFH for P1 of fig. 1 and three other hypotheses. For each of these hypotheses, we indicate the atoms supported by it and its minimal attacks. For the non well-founded hypotheses, we show in boldface those minimal attacks that are not attacked by the given hypothesis.

Table 1

WFH for PI of fig. 1.

Pl A ' rein'P1 A A ~ {A' : ~ A} WFH? MWFH?

O O O / {-~s} ~ O r {-~t} ~ O /

{-~s, -~t} O ~3 / {-~p,-~t} {q,r} { {-,q, ~t}} / {-~q, -~t} {p} { {~p, -~t}} /

{'~p,-~s, ~t} {q,r} {{~q, ~t}} / {~q, "~s, --,t} {p} {{~p, ~t}} /

{-~p} 0 {{-~q, ~t}} {~r} {r} {{-~ r}, {'~p} }

{-~p, ~q} ~ {{'~q, -,t}, {-~p, "~t}}

/ /

Notice that minimal attacks of a self-consistent hypothesis A have to be minimal supports of the negation of some assumption in A. We can then guarantee that if A attacks all such supports, it is a WFH. This fact is recorded in the next proposition.

46 A. Torres, A nondeterministic well-founded semantics

PROPOSITION 3.4

A self-consistent hypothesis A is a WFH if and only if for every A" such that A' ~ fl for some --1 fl E A we have A ----> A'.

We now show that at least one MWFH exists for any given program.

LEMMA 3.5

Let {Ai}i~ N be a set inclusion chain 4) of WFH in P, that is, for every i E :N, A i is a WFH and Ai C Ai+ 1. The hypothesis A = UieNA i is a WFH.

Proof

First, notice that if A is not self-consistent, then there is a finite A' C A such

that A' ~-~' fl for some --1 fl ~ A. Since A' U { --1 fl} is a finite set, there is some Aj that

includes it. But this situation can not occur since every A i is self-consistent. Finally,

consider some A' such that A' P A. There is some --1 fl E A such that A' ~-> ft. Let Aj

be some hypothesis in the chain such that ~ fl E Aj. Since Aj is a WFH, Aj ~ A'.

Therefore, A ~ A'. []

THEOREM 3.6

The set of WFH of a given logic program is a complete partial order (CPO) w.r.t, set inclusion.

Proof Lemma 3.5 implies that every set inclusion chain of WFH has an LUB. []

COROLLARY 3.7

Every program has at least one MWFH.

In the following, we show that WFH can be characterized in terms of an "unfounded" assumption operator.

DEFINITION 3.8

An assumption -1 fl is unfounded with respect to a hypothesis A if for every A' such that A' r--> fl we have A ----> A'. We denote by Up(A) the set of all unfounded assumptions w.r.t. A in program P. Notice that Up is a monotonic operator.

4) Notice that in this and the following theorems we need to consider infinite sets and chains, since the Herbrand instantiation of a logic program with function symbolds is generally not finite.

A. Torres, A nondeterministic well-founded semantics 47

THEOREM 3.9

A self-consistent hypothesis A is a WFH if and only if A----> A' for every A' such that A' ~ fl for some --1 fl �9 A. That is, A is a WFH if and only if A _C Up(A).

Proof

The "only if" part is trivial since every minimal support of an assumption in A attacks A. To prove the "if" part, notice that if A' "---> A, then there is a A" C A' such that A" ~ A. Therefore, A" is a minimal support of an assumption in A. But then A ~ A", and therefore A ~ A'. []

DEFINITION 3.10

We say that a hypothesis A is a complete WFH (CWFH) if it is a WFH and A = Up(A).

For instance, we show in table 2 the unfounded assumptions for the eight well- founded hypotheses of P1 of fig. 1. We indicate the complete and maximal WFH. Notice that all the MWFH are complete. We now prove that this property is true for any given program.

Table 2

Complete and maximal WFH for P1 of fig. 1.

A Up,(A) CWFH? MWFH?

O {'~s, "~t} {~s} {~s, ~t} {-~t} {-~s, -~t}

{'~s, ~t} {'~s, ~t} r {~p, ~t} {-~p, "~s, ~t} {~q, ~t} {~q, ~s, "~t}

{'~p, ~s, ~t} {~p, ~s, "~t} ~/ J {~q, ~s, -~t} {-~q, "~s, -~t} ,/ ~/

LEMMA 3.11

Let A be a WFH. If ~ f l � 9 Up(A), then A U {-~fl} is a WFH.

Proof

Since A C_ Up(A) and --1 fl �9 Up(A), then A t_J { --1 fl} C_ Up(A). But since Up is monotonic, A U { ~fl} C_ Up(A t_J { ~fl}). Now we have to show that A U { ~fl} is self-consistent. If we assume it is not, we have to consider two cases depending on whether A U {-~fl} supports fl or not.

48 A. Torres, A nondeterministic well-founded semantics

1. If A U { ~fl} ~ fl, since -~ fl E U p ( A ) , then A ----> A U { -~fl}. But since A is self-consistent, it must be the case that A ~-+ ft. Again, since fl ~ U,o(A), we would have A----> A, contradicting the fact that A is self-consistent.

2. I fA U {~fl} is not self-consistent, but A U {-~fl} bt->fl, then A U {~fl} ----> A. Since A is a WFH, then A ,---> A tO { ~fl}. But A U { ~fl} ~/+fl implies that A ----> A, which again contradicts the supposition that A is self-consistent. []

THEOREM 3.12

If A is a WFH, then so is Up(A).

Proof

Let f b e a function from N o n t o Up(A) - A. For any i E N , let A i = A U { f ( j ) : j E N A j < i}. It is an easy induction using lemma 3.11 to show that every A i is a WFH. But then lemma 3.5 implies that Up(A) = UieNAi is a WFH. []

COROLLARY 3.13

Every maximal WFH is complete.

Finally, we associate with every WFH a supported interpretation. In the next section, we show that these interpretations can be used to define several major proposals for logic program semantics.

DEFINITION 3.14

Let IA be a supported interpretation of P. We say that la is a well-founded interpretation (WFI) of P is A is a WFH. We also say that IA is a complete WFI (CWFI) or a maximal WFI (MWFI) if A is, respectively, a CWFH or a MWFH. 5)

For instance, Pa of fig. 1 has two MWFIs: { ~p, q, r, --1 s, --1 t } and { p, -1 q, -1 s, --1 t}. Notice that the former is a total model but the latter is not.

4. Well-founded interpretations and pure models

In this section, we show that well-founded hypotheses are strongly related to several major approaches to logic programming semantics. We do so by proving that CWFIs correspond to pure models [13] and use this equivalence to establish a relation to other major approaches.

5) Notation: We will assume similar definitions for all of the classes of hypotheses later introduced. For instance, a defensive interpretation (DI) is one supported by a defensive hypothesis (DH).

A. Torres, A nondeterministic well-founded semantics 49

The definition of pure models relies on those of unfounded and assumption sets. In the following results, we identify the relation between these concepts and those of unfounded assumptions and complete well-founded hypotheses. We apologize to the reader for the duplication of the terminology in this section.

DEFINITION 4.1 [8]

Let P be a logic program, I an interpretation of P and F C M(P) . We say that F is an unfounded set w.r.t. I if and only if for every rule r ~ P l such that head(r) ~ F, we have that one of the following conditions apply:

(1) body(r) f) ~I;~(~

(2) body(r) f) F ;~ 0

The greatest unfounded set of P w.r.t. I, denoted by Up(l), is the union of all the unfounded sets w.r.t.I. It is easy to show that Up(l) is itself an unfounded set.

Now we study the relation between the condition for well-founded hypotheses and unfounded sets [8].

THEOREM 4.2

If A is a WFH of P, then Up(IA) = Up(A ~>) = ~' t / t ,(A).

Proof Let us first prove that --1 U p ( A ) is an unfounded set. Consider a rule r ~ P such

that head(r) ~ --1 q-/e(A). Let us suppose that r does not satisfy either of the conditions

of definition 4.1. Therefore, for every negative subgoal - f l in body(r) it is the case

that A ~-> ft. Moreover, for every positive subgoal a (since -7 a is not an unfounded e

assumption), there is a hypothesis A a such that Aa ~-> a but A 4--> Aa. But then the

hypothesis ([Ja~ boay(r)+Aa) U body(r)- supports head(r) and it is not attacked by A. But this contradicts the supposition that ~head(r) is an unfounded assumption.

p , min,P Now consider a ~ Up(Ia). If ~ a ~ Up(A), then there is a A such that A ~-> a

and A - ~ A'. By corollary 2.6, there is a support dag for a in P whose fringe is

exactly A'. If r = label(a) in such a dag, then head(r) = a ~ Up(IA). Therefore, either there is a -1 ]3 ~ body(r) f3 A ~, or there is an a' E body(r) N Ue(la ). In the former

case, A-~PA '. In the latter case, a ' i s not in --1 Up(A) since A' supports a ' but is not attacked by A. We can then inductively proceed in this manner and find a maximal sequence a, tz', . . . . a ( i ) . . . . , where a (i+l) is a child of tz (i) in the dag and belongs to

Up(IA) -- -~ %/e(A). But since the dag is finite and acyclic, there is a last element tz (n) in the sequence. If r (n) is the label of a (n), t h e n body(r (n)) cannot contain any positive subgoal, since otherwise the sequence could be extended. Therefore, body(r (n)) A Up(IA) = 0 . Moreover, since body(r (n)) C -~((P), then body(r (~) ) f-> O~ (n) and A ~ A'.

50 A. Torres, A nondeterministic well-founded semantics

Therefore, body(r (n)) 71 --11 x = ~ . And this contradicts the supposition that a (n) is in

Up(IO. We have then proved that Up(Ix) = -1 Ue(A). But notice that all the subgoals

we find in the above proof to be "contradicted" by I x are in fact negative subgoals

whose negation appear in I,~ = A ~ . Therefore, Up (A ~ ) = ~ Up (A). []

LEMMA 4.3

If A is a WFH of program P, then P U Up(A) is a consistent theory.

Proof

Let I = U e ( A ) U Ue(A) . Let us show that I is a model for P~ (obviously, it

is a model for Ue(A)). We have to prove that every rule r ~P~ is satisfied by I. This

is trivially true if head(r) ~ -1 Ue(A). If head(r) ~ -7 Ue(A), then head(r) ~ Ue(IA), but then there is a literal y ~ body(r) fq ( 7 1 U --, Up(A)) - body(r) M -~I. Therefore,

body(r) is false according to I and r is satisfied. 6) []

THEOREM 4.4

If A is a WFH of program P, then P U A is a consistent theory, i.e. Ix is a

partial model.

Proof

Since A ___ Up(A), the above lemma shows that P t_J A is consistent. Moreover,

by theorem 2.2, P U A ~ Ix, so Ia is a partial model. []

Let us now introduce the notions of assumption set and pure models.

DEFINITION 4.5 [13]

Let P be a logic program, I be a positive interpretation (A positive interpretation

is one that contains exclusively positive literals) of P and F C H ( P ) . We say that F i san assumption set w.r.t. I if and only if for every rule r E P~ such that head(r) E F, one of the following conditions apply:

(1) body(r) fq ~ I ~ 0

(2) body(r) f~ F ~ 0

(3) body(r) ~_ I U -~ Up(I)

6) This proof is essentially the same as that of proposition 1 in [20].

A. Torres, A nondeterministic well-founded semantics 51

The greatest assumption set of P w.r.t. I, denoted by Ap(I), is the union of all the assumption sets w.r.t.I. It is easy to see that Ap(I) is itself an assumption set. An interpretation I of a program P is assumption-free if I f3 Ap(I) = 0 .

DEFINITION 4.6 [13]

Let P be a logic program and I be a positive interpretation. I is a positive pure model of P if i = At, (I). Equivalently, I is a positive pure model if i is an assumption set and I is assumption-free. If I is an interpretation of P, we say that I is a pure model 7) if

(1) I - = Up(I + )

(2) I + = A p ( I +), i.e., I + is a positive pure model.

We now prove a series of results that lead to the main theorem in this section - the equivalence between CWFI and pure models.

LEMMA 4.7

If I is a CWFI of P, then I is a pure model.

Proof

By theorem 4.2, we know that I-- = Up(l+). We then have to prove that I § is a positive pure model. We prove that I + = Ap (I § by showing that every rule r ~ P such that head(r) ~ I § satisfies condition (3) of definition 4.5. Notice that since I is a WFI, I = I § U Up(l) = I § t_J ~Up(I+), and we can rewrite this condition to body(r) 9[= L It takes an easy induction on the minimal height of a support dag enabled by I - to show that there is a rule r E P such that body(r) C_ I and head(r) = tz if tz E I § Moreover, if a rule's body i s included in /, then the atom in its head must be supported by I- . Therefore, I + = Ap (I +). []

LEMMA 4.8

If I is a pure model of P, then I is supported.

Proof

We first show that I I- C I, i.e. ( I - ) & C I + by a simple induction of the height

of the minimal height support dag enabled by I- . We show that for any a in ( I - ) ~ ,

there is a rule r with head tt and body included in the union of I - with the set of

atoms with lower minimal heights.

7) The original definition of pure models corresponds to our positive pure models.

52 A. Torres, A nondeterministic welt-founded semantics

Finally, notice that if a ~ I + - ( I - ) A , then there is a rule r such that head(r) = a and body(r) C_ 1 (since I is assumption-free). But if body(r) C_ I - (3 ( l - ) & , then

a E I + - ( I - ) ~ . Thus, it must be the case that there is a subgoal in r that belongs

to l + - ( I - ) ~ . But this implies that I + - ( I - ) A is an assumption (unfounded) set. But

since I is assumption-free, then I + - ( I - ) ~ = O. Therefore, I = ( I - ) f* tA I-. []

LEMMA 4.9

If I is a pure model of P, then I - = q.le(l ).

Proof It suffices to show that every support dag for an atom in -1 I - has a fringe that

is attacked by I- . We proceed by induction on height of the dag. Notice that no atom in -7 I - has a support dag of height 0, since that would imply that the atom is the head of a trivial rule, thus not being unfounded. Let us then assume that for any support dag for an atom in -1 I - of height n, its fringe is attacked by I-. Consider then any dag of height n + 1. Since the head of the rule is in -7 I - = Up(l+), then either one of its children is a negative literal in 71 + or a positive literal in 7 1 +. In the former case, the fringe of the dag is attacked since by lemma 4.8, I - supports every atom in I § In the latter case, the inductive supposal ensures that the fringe of the sub-dag rooted by the unfounded atom is attacked by I-, but since the fringe of the dag contains the fringe of the sub-dag, the first is also attacked. []

THEOREM 4.10

An interpretation I is a pure model of P if and only if I is a CWFI of P.

Proof The "if" part follows directly from lemma 4.7. The "only if" part is a consequence

of lemmas 4.8 and 4.9. []

Once we have established a connection with pure models, we can use the results in [13] to clarify the relation between WFI and other approaches to logic programming semantics. We summarize the most important results in the following propositions.

PROPOSITION 4.11

Let P be a logic program and let C(P) be the set of CWFI of P. The following propositions are true:

(1) C(P) is the set of pure models [13] of P.

A. Torres, A nondeterministic well-founded semantics 53

(2) C(P) is the set of three-valued stable models [17] of P.

(3) The total elements in C(P) (which are all the total WFI) are exactly the stable models [7] 8~ of P.

Moreover, in the partially ordered set (C(P), C):

(4) There is a unique minimal element that is the well-founded model [8] of P. Equivalently, the well-founded model is the interpretation supported by the minimal fixpoint of Ue.

(5) If the minimal CWFI of P is total, then it is the only MWFI and corresponds to the unique stable model of P. In particular, if P is stratified or locally stratified, then it has a unique MWFI that is equal to its perfect model [16].

(6) The greatest lower bound in (C(P), C) of all MWFI exists and corresponds to the maximal deterministic model [20] of P.

(7) The maximal elements in (C(P), C) (MWFI) are exactly the partial stable models [20] of P.

5. Stable and well-founded hypotheses

In this section, we explore the relation between well-founded hypotheses and other hypothetical-reasoning semantics for logic programs. We show that maximal well-founded interpretations are equivalent to preferred extensions [4]. We also prove that well-founded hypotheses capture a strictly weaker reasoning pattern than that of stable hypotheses [23] and weakly-stable theories [10, 11].

Well-founded interpretations correspond to Dung's admissible scenarios [4], with MWFI being equivalent to preferred extensions. The equivalence with definition 3.1 was independently discovered in [9]. In fact, we have borrowed from them the term "attack". It has been shown [12] that these preferred extensions are equivalent to Sacc~t and Zaniolo's partial stable models. Using proposition 4.11, we can then prove the equivalence between MWFI and preferred extensions.

PROPOSITION 5.1

The MWFI's of a given program correspond exactly to its preferred exten- sions [4].

A more powerful hypothetical mechanism was introduced by Kakas and Mancarella in their weakly-stable theories [10, 11]. We have presented and further developed the equivalent formalism of stable hypotheses. 9) We now show that every WFI is stable but not vice versa.

s) Using the original definitions, we would say I § is a stable model. 9) We also introduce the skeptical subclass of strong hypotheses. We introduce an equivalent subclass

of WFH in section 8.

54 A. Torres, A nondeterministic well-founded semantics

DEFINITION 5.2

A hypothesis A rebuts another hypothesis A' in a program P (denoted by A L A' * P *t

if A U A ~ zx. We then say that A is a rebuttal for A'.

DEFINITION 5.3

A hypothesis is stable if and only if it rebuts every rebuttal.

THEOREM 5.4

Every WFH is stable.

Proof

Let A be a WFH. If A' ~ A, then A" U A ----> A. Since A is a WFH, we than have A ~ A' U A. Therefore, there is some -1 fl ~ A' U A such that A ~ ft. But --1 fl can not belong to A, because otherwise A would not be self-consistent. It follows that A ----> A', and since support is monotonic, A' U A ----> A, i.e. A '--, A'. []

While every WFH is stable, not every stable hypothesis is a WFH. The added power stems from the fact that while a WFH has to support the negation of some assumption in every contradicting hypotheses, stable hypotheses are capable of exploiting the internal inconsistencies of such conflicting hypotheses. While this power can sometimes capture more intended conclusions, it can also lead to inconsistencies. We illustrate both of these points in the following examples.

Example 5.5

Consider the program P following:

p ~--- -~p

q ~-- -~p

It is easy to show that P has no nontrivial WFH. Nevertheless, the hypotheses { --1 q } is stable since it rebuts its two rebuttals { ~p} and { ~p , --,q}. It is arguable that --,q is a natural conclusion from P since { -1 q} is self-consistent and the only support for q, { ~p} , is not self-consistent.

Example 5.6

Consider now the program P', a slight variation of program P above:

p ~--. -~p

q~--p

A. Torres, A nondeterministic well-founded semantics 55

Again, P has no nontrivial WFH, but { --1 q} is a stable hypothesis. The same argument applies, {-7 q} is self-consistent and the only support for q is not self-consistent. Nevertheless, { -7 q} is inconsistent with P ' with P ' N q.

Even though stable hypotheses capture a stronger reasoning pattern and are defined for all programs, they are not always classically consistent. In [23], we have shown that classical soundness is guaranteed for totally stable programs where the maximal stable interpretations are stable models. We show in the following section that for such programs, the WFHs capture exactly the same conclusions. The above, together with the extra complexity of stable hypotheses, l~ makes us believe that WFHs are a more practically useful semantics for logic programming. It is also interesting that many of the intended conclusions captured by stable semantics can also be captured by WFH without inconsistencies by adopting a slightly more powerful notion of support as the one introduced in [21].

6. Well-founded hypotheses and graph semikernels

In this section, we introduce a graph-theoretical representation for logic programs and show that well-founded hypotheses correspond to graph semikernels. 11) We use this equivalence to show that the computation of WFI is intractable even for propositional logic programs. We also introduce the class of totally stable programs for which all of the MWFIs are total (stable models). We present some sufficient properties for a program to be totally stable in terms of the graph representation. These conditions are strict generalizations of the notions of stratification [ 1,6], local stratification [ 16], and structural totality [18].

Let us first introduce some basic notation for graphs. A graph 12) is a pair (V, E), where V is a set and E is a subset of V x V. Elements in V are called nodes and members of E are called arcs.

DEFINITION 6.1 (KERNELS AND SEMIKERNELS)

Let (V, E) be a graph and V ' a subset of V. We say that V ' is independent if there are no arcs between elements of V' . We say that V ' is dominant if for all v E V - V ' there is a v" E V ' such that (v', v) E E. We also say that V ' is semidominant if for all v ~ V - V' , such that (v, v ' ) ~ E with v' ~ V ' , then there is a v" E V ' such that (v", v) ~ E.

10) While both classes are intractable, linear approximations of WFH will be proved to have a polynomial data complexity in section 7, while linear stable hypotheses are still intractable.

11) For a complete graph-theoretic framework for logic programming, see [3]. 12)In this paper, the term graph refers exclusively to directed graphs.

56 A. Torres, A nondeterministic well-founded semantics

We say that V is a kernel if it is independent and dominant. We also say that V is a semikernel if it is independent and semidominant. 13~

We now associate two graphs to each logic program. The extended minimal attack graph (EMAG) captures all the relevent information about a program's attack relation. The support dependency graph (SDG) is a smaller graph whose vertices are atoms and not hyptheses. While the SDG does not contain all the relevant informtion about a program, it is of practical use to establish sufficient conditions for total stability.

DEFINITION 6.2

Let M S ( P ) = {A" A ~ e o t for some a ~ H ( P ) } (minimal supports) and let

s H ( P ) = { { --1 fl} : fl ~ H ( P ) } (singleton hypotheses).

The extended minimal attack graph (EMAG) of P is the graph (MS(P) tA t min P

s H ( P ) , E), where (A, A ) ~ E if A ~-4 A'.

The support dependency graph (SDG) of P is the graph ( H ( P ) , E ' ) , where

(a, a ' ) ~ E ' if ~ a belongs to a minimal support of ~ ' .

We have shown in [23] that kernels in the EMAG of P correspond to stable models. We state this fact precisely in the following proposition.

PROPOSITION 6.3

Let P be a logic program. The following propositions are true:

(1) A program has a stable model if and only if its EMAG has a kernel.

(2) If I is a stable model of P, then { A" A C_C_ I- ) is a kernel of the EMAG of P.

(3) If K is a kernel of the EMAG of P and A K = UA~cA, then IaK is a stable model of P.

Now we extend the above results to show that the WFHs of a program correspond to semikemels of its EMAG.

THEOREM 6.4

Let P be a logic program. If I is a WFI of P, then K = {A' �9 A C_ I - ] is a semikernel of the EMAG of P.

13~Kernels and semikernels are usually defined [2l in terms of absorbance which is the symmetric of dominance, so our definition actually corresponds to a kernel or semikernel in the reverse graph.

A. Torres, A nondeterministic well-founded semantics 57

Proof

Let G be the EMAG of P. Since I - is self-consistent, K is an independent set.

Now, if there is an arc (A', A) in G with A EK, then A ' ~ P A and then A'--~P I - . But

since I - is a WFH, I - ~ A' and therefore I - contains a minimal attack A" of A'. Since

A" E K, and (A", A') is an arc in G, K is semidominant and hence a semikernel. []

THEOREM 6.5

Let P be a logic program, Kbe a semikemel of the EMAG of P, and Ax = Uzx~ KA. The interpretation IA~ is a WFI of P.

Proof

We have to show that AK is a WFH. Let us first prove that AK is not self-

defeating. If AK is self-defeating, then there is a hypotheses A C A r and A ~_~e A K.

Therefore, there is an arc from A to some hypothesis K. Since K is a semikemel, then

there is a hypothesis A' E K such that there is an arc (A', A) in the EMAG of P. But

this means that A' is a minimal support of an assumption in A C At. There should

then be an arc from A' to some A" in K, but this arc would contradict the fact that

K is independent.

Now we have to prove that Ax C 'Ue(Ar). Let ~ fl ~ AK and A ~.~e ft. Then A

attacks some hypothesis in K. Since K is a semikernel, there is an arc from some A" rain P

in K to A'. Then A" ~ A' and therefore AK "-~P A, and ~ f l is unfounded w.r.t. AK.

[]

It is known that determining if a given finite graph has a nontrivial semikernel

is an NP-complete problem. 14) We can then use the above theorems to prove the intractability of computing WFH.

THEOREM 6.6

The following problems are NP-complete and co-NP-complete, respectively:

(1) Given a propositional program P, does P have a nontrivial WFH?

(2) Given a propositional program P and a WFH A, is A an MWFH of P?

Both problems remain in the same complexity classes even if P is restricted to have only rules with one single negative subgoal.

14~Apparently, this fact was first proved by Chv~tal. A new proof is provided in [3].

58 A. Torres, A nondeterministic well-founded semantics

Proof

Let us first consider problem L Obviously, the problem is in NP, since it is polynomial to check if a guessed hypothesis is a nontrivial WFH. Given a finite graph G, we can associate to each vertex v a unique proposition atom p~,. Then we construct a program PG containing a rule of the form Po ~-- P~" if and only if (v, v') is an arc in G. It is a direct consequence of theorems 6.4 and 6.5 that G has a nontrivial semikernel if and only if Pc has a nontrivial WFH. Notice that all rules in Pc have only one negative subgoal.

Problem (2) is co-NP-complete, since A is an MWFH of P if and only if PA has no nontrivial WFH. []

We now address the issue of totality. Notice that some programs, like P1 of fig. 1, have nontotal MWFI (see table 1). In the following, we introduce the class of totally stable programs [23] and show that all their MWFIs are total, i.e. stable models.

DEFINITION 6.7

A program P is totally stable if for every hypothesis A, the program PA has a stable model.

THEOREM 6.8

If a program is totally stable, all its MWFIs are total, i.e. they are stable models.

Proof

Let A be an MWFH of a totally stable program P. Since P is totally stable, Pa

has a stable model M. If A ~ M-, then M - ~ A (because M is total and supported).

But since A' ~-~ t~ if and only if A' U A ~-> a , we have that A U M - ~ A. But since

A is a WFH, A ~ A U M - . Hence, A-g>e M - (because A is self-consistent). But then

O fA, M - , which contradicts that M is a stable model. Therefore, it must be the case

that A C M-, and since A is maximal, it must be the case that A = M-. []

In [23], we have shown that a sufficient condition for a program to be totally stable is the acyclicity of its SDG. Moreover, in this case there is a unique stable model. This result is a direct consequence of the fact, whose proof is due to von Neumann [15], that an acyclic graph has a unique kernel. In [3], we have shown that this acyclicity condition strictly generalizes local stratification [16]. We have also shown in [23] that a program whose SDG has no odd-length cycle is totally stable. This condition generalizes structural totality [18] much in the same way that local stratification extends the predicate-level notion of stratification to the atomic level. The above results are recorded in the following proposition.

A. Torres, A nondeterministic well-founded semantics 59

PROPOSITION 6.9 [23]

Let P be a logic program and G be its SDG. The following propositions are true:

(1) (2)

If G is acyclic, then P is totally stable. Moreover, P has a unique stable model.

If G does not include any odd-length cycle, then P is totally stable.

7. Incremental computation

In this section, we explore the means for computing WFHs. We introduce the notion of well-founded extension that characterizes the admissible hypotheses that can be added to a given WFH. Although the computation of arbitrary extensions is intractable, we explore two kinds of extensions that can be computed efficiently. Linear extensions are those that can be constructed by adding assumptions one-at- a-time. Tie extensions can be constructed by breaking a tie between two competing hypotheses.

First, we introduce a characterization of WFHs that allows us to incrementally compute them.

DEFINITION 7.1

Let A be a WFH, AWFH A' is a well-founded extensison (WFE) to A if A C A'.

DEFINITION 7.2

Let A be a WFH of program P. A hypothesis A', disjoint from A, is admissible w.r.t. A if:

(1) A t_J A ' -~A' .

(2) A' C_ Up(A U A').

We also say that an assumption --~fl is admissible w.r.t. A if {-~fl} is admissible w.r.t.A.

THEOREM 7.3

Let A be a WFH of the program P. Then A' is a WFE to A if and only if A ' - A is admissible w.r.t. A'.

Proof

Consider any WFE A' to A. Condition (1) of definition 7.2 follows from A' is self-consistent. Condition (2) follows from A' C_ Up(A').

60 A. Torres, A nondeterministic well-founded semantics

Now, if A" = A" - A is admissible w.r.t. A', we have to show that A' is a WFH, i.e. that A' is self-consistent and A' C_ Uj,(A'). If A' were not self-consistent, then A' "-~ A', but since A' ~/~ A", it must be the case that A' "-~ A. Since A is a WFH, then A ~ A', and since A is self-consistent, it must be the case that A ~ A". But in this case, A' ~ A", contradicting condition (1) of definition 7.2.

Finally, since A" C_ Up(A ' ) and A _ Up(A) C Up(A ' ) , it fol lows that A' C Up(A'). []

Two interesting subcases of the above result are those where A = O and A ' - A = {-~ fl}. These cases are covered in the next corollaries.

COROLLARY 7.4

A hypothesis is a WFH if and only if it is a WFE to the trivial WFH.

COROLLARY 7.5

Let A be a WFH and --1 fl an assumption not included in A. The hypothesis A U { -~ fl} is a WFE to A if and only if ~ fl is admissible w.r.t. A, that is, if and only if:

(1) A U {-~fl}~-~ ft.

(2) - ~ f l E U e ( A t_J {-~fl}), i.e. A U {-~fl} attacks every minimal support of ft.

In the following, we study a linear subclass of WFH. This subclass characterizes hypotheses that can be constructed by adding assumptions one-at-a-time.

While in the finite case linear extensions amount to a list of assumptions, we consider the more general structure of well-order sets. Let (A, <) be a well-order and let ~ fl be a given assumption in A. The --1 fl-prefix of A (denoted by A-~/~,_<) is the set { --1 fl" : -~ fl' < --1 fl} and the strict -1 fl-prefix of A (denoted by A~-g,_< ) is the set { - ~ f l ' : ~ f l ' < -~fl}, that is, A:~#,_< = A_~#,___ - { ~ f l } . Whenever clear from the context, we will drop < from the subscript in the above notion.

DEFINITION 7.6

A hypothesis A" is a linear well-founded extension (LWFE) to a WFH A if A C_ A' and there is a well-order of A' - A such that every --1 fl-prefix of A' - A is admissible w.r.t.A.

THEOREM 7.7

If A' is an LWFE to a WFH A, then A' is a WFH.

A. Torres, A nondeterministic well-founded semantics 61

Proof

Let A" = A' - A and --,/3 ~ A". Since AL# is admissible w.r.t. A, theorem 7.3 implies that A U A'~# is a WFH. But then lemma 3.5 implies that A'= U-~p~A"(A U A"-~/~) is a WFH. []

DEFINITION 7.8

A hypothesis A is a linear well-founded hypothesis (LWFH) if there is a well- order of A such that every --lfl-prefix is a WFH.

THEOREM 7.9

A hypothesis is an LWFH if and only if it is an LWFE to the trivial WFH.

Proof

This proposition follows from corollary 7.4 and the definitions of LWFH and LWFE. []

COROLLARY 7.10

A hypothesis A is an LWFH if and only if there is a well-ordering of A such that every ~f l ~ A is admissible w.r.t. A T

A direct consequence of theorem 7.7. is the following proposition.

PROPOSITION 7.11

Every LWFH is a WFH.

Example 7.12

The converse of the above proposition is not true since some WFHs are not linear. For instance, in the following program:

p ~--- ~ q

q 4 - - ~ r

r ~.-- --nS

s 4- --np

{ ~p , ~r} is a WFH but not an LWFH since neither { ~p} nor { ~r} is a WFH.

We now show that the set of LWFHs of a given program is a complete partial order (CPO) and show that every WFH has at least one maximal linear well-founded extension.

62 A. Torres, A nondeterministic welt-founded semantics

THEOREM 7.13

The class of LWFE to a given hypothesis is a complete partial order with respect to set inclusion.

Proof

Let {Ao}~lt be an inclusion chain of LWFE to a given WFH A. Let A~o = A t ~Jt~1 o, and AI=Ao~-A. Let (~/,~)be the well-order such that t ~ t ' if A r C A c,

and let " r (~ f l )= nfln~{z'-~fl ~ A t} for ~ f l E A I. Let also At=A~o-A for every t E ~/and let (A t , t_) be<any well-order of A t satisfying the condition of definition 7.6. Consider then the followin~ well-order (A 1, <) where --1B < -~ B' if "r(~ fl) ~ ~(~ fl ')

- - " t ( ~ B ~ " - - - - - - - - - - -

or if "r(~fl) = "r(~fl ') and ~ f l ,_<r, fl,. It is an easy induction (using corollary 7.5) to show that _< satisfy the condition of definition 7.6. Therefore, A1o is an LWFE to A. []

COROLLARY 7.14

Every WFH has at least one (set-inclusion) maximal WFE.

In the following, we show that maximal LWFEs to a given WFH are complete WFHs.

THEOREM 7.15

Let P be a logic program, A be a WFH of P. If A' is a maximal WFE to A, then A' is a CWFH.

Proof

Notice that if A' is not a CWFH, there is some --,fl E q./p(A') - A, but then --, fl is admissible w.r.t. A' and A' U { --,fl} is an LWFE to A. But this fact would contradict A' is a maximal WFE to A. []

We finish our discussion on linear extensions by showing that finding 2 maximal LWFEs is tractable for propositional and datalog programs.

LEMMA 7.16

Let P be a propositional logic program, A a hypothesis for P and ~ f l an assumption. Determining if ~ fl ~ Up(A) can be done in time proportional to the size of P.

Proof A simple procedure to accomplish the above is the following:

A. Torres, A nondeterministic well-founded semantics 63

(1) Compute some superset A' of {--1 ]~'" qAo~ fl' ~ Ao A Ao ~-~P fl}. This, for example, can be done in linear time by performing a dfs transversal of the program's dependency graph [16].

(2) Compute A" = A' - A ~e . Proposition 2.3 implies this step can be performed in linear time.

(3) It is easy to see that --1/7 ~ '//e(A) if and only if A" ~ ft. Again, proposition 2.3 implies this step can be performed in linear time. []

In order to determine if an assumption is admissible w.r.t, a given hypothesis, we only need to check if it is supported and if it is unfounded with respect to the given hypothesis after adding the assumption considered. Therefore, we can state the following proposition.

PROPOSITION 7.17

Let P be a propositional logic program, A a hypothesis for P and --117 an assumption. Determining if --1 ]7 is admissible w.r.t. A can be done in time proportional to the size of P.

THEOREM 7.18

Let P be a propositional logic program and A be a WFH. A maximal LWFE to A can be computed in polynomial time w.r.t, the size of P.

Proof

A naive iterative procedure for the above problem would check in each round if there is any admissible assumption. If there is one, we add it to the given hypothesis and start again. If there is no admissible assumption, the computed hypothesis is already a maximal LWFE to A. Since the program is finite, the number of such rounds is linear with respect to the size of P. []

COROLLARY 7.19

Let P be a propositional logic program and A be a WFH. A CWFH including A can be computed in polynomial time w.r.t, the size of P.

Given a fixed datalog IDB and variable datalog EDB, the Herbrand universe of the resulting program is polynomial in the size of a variable EDB [24]. Therefore, we can extend the above results to datalog programs.

PROPOSITION 7.20

Given a fixed datalog EDB, the complexity of computing a maximal WLFE (or a CWFI) to a given WFH is polynomial w.r.t, the size of a variable datalog EDB,

64 A. Torres, A nondeterministic well-founded semantics

Finally, we introduce tie extensions that are based on the tie-breaking procedures introduced in [18]. The pure tie-breaking procedure is not always sound w.r.t, our semantics, since it often computes interpretations (fixpoints) that are not supported. For instance, in the program { p ~ q, q ~-- p}, the algorithm computes two interpretations: { ~ p , ~ q} and {p, q}. Since the program above is stratified, most researchers agree that only the first fixpoint, the perfect model, captures the meaning of the program. Nevertheless, the nondeterministic well-founded tie-breaking algorithm is sound with respect to our semantics. We use this strategy to efficiently compute a class of nonlinear WFEs.

DEFINITION 7.21

Let P be a program, G its SDG, and A a WFH of P. A well-founded tie in P w.r.t. A is a subset AT of --1 (IA) such that:

(1) No assumption in AT is unfounded w.r.t.A.

(2) The subgraph of G induced by AT is bipartite and strongly connected with all incoming arcs originating with atoms defined in la.

A solution to a tie AT is a maximal subset As of Ar independent in G. A tie extension to a WFH A is a hypotheis of the form A U As, where As is

a solution to a well-founded tie w.r.t.A.

The above definition captures the same ties found by Papadimitriou and Yannakakis' well-founded tie-breaking procedure. Given a program with a finite SDG, a tie can be found in polynomial time. We now prove that tie extensions are indeed WFE.

THEOREM 7.22

Let P be a program and A a WFH. If As is a solution to a well-founded tie, AT w.r.t.A. The hypothesis A' = A U As is a WFE to A, i.e. A s is admissible w.r.t.A.

Proof

Let us first show that A' is self-consistent. If A' "~e A', then there is a --1 fl E A' such that A' F-~ ft. We can assume that ~f l E A s (because if ~f l E A, then As U A .~e A; using theorem 5.4, we have that A' .~e As). But this can not be the case since A' ~ fl and no assumption in A s belongs to a minimal support of an assumption in As.

In order to show that A' is a WFH, let us first observe that every atom in F = ~ (A T - As) is supported by A' (because no atom in F is unfounded w.r.t. A and every minimal support contains only assumptions in As or defined in IA). NOW, if ~f l ~ As and A" ~-> fl, then A" C_ A U --1 (A ~ U F) C_ A U ~ A' ~ . But since A ~ fl,

P then A" (q A ' ~ O, and therefore A'-~e A ". []

A. Torres, A nondeterministic well-founded semantics 65

Since the SDG of a propositional program can be constructed in polynomial time in the size of the program, the problems of finding well-founded ties and computing their solutions are tractable. 15)

PROPOSITION 7.23

Let P be a propositional logic program and A be a WFH. The problems of determining if there is a tie extension to A and finding one if it exists can be solved in polynomial time w.r.t, the size of P.

COROLLARY 7.24

Given a fixed datalog IDB and a WFH A, the problems of determining if there is a tie extension to A and finding one if it exists can be solved in polynomial time w.r.t, the size of a variable EDB.

8. Defensive hypotheses

In [23], we introduced strong hypotheses, a skeptical subclass of stable hypotheses. In this section, we use a similar idea to define defensive hypotheses. We show that defensive hypotheses are strong and define a skeptical subclass of WFH. We introduce a class of defensive extensions that capture a restricted form of linear extensions. We also show that defensive hypotheses are always linear and that a unique maximal defensive hypothesis exists for every program and corresponds to the well-founded model [8].

DEFINITION 8.1 [23]

Let P be a logic program. A hypothesis A strictly rebuts a conflicting

hypothesis A' (denoted by A ~--~> A') if A L A' but A' ~ A.

A hypothesis A is stronger than a rebuttal A' (denoted by A ~eA') if there is a A" C A such that A"~--~> A'.

A hypothesis is strong if it is stronger than every rebuttal.

We have shown in [23] that strong hypotheses are stable hypotheses and that they are contained in every maximal stable hypothesis. Subsequently, we introduce the analogous definition of defensive hypotheses. We show that defensive hypotheses are strong, well-founded and contained in every MWFH.

15)It is shown in [18] that if A s is a solution to hr, so is A r - A s. Notice that this fact implies that the problem of finding a solution is nondeterministic since at least two solutions exist for every well- founded tie.

66 A. Torres, A nondeterministic well-founded semantics

DEFINITION 8.2 (DEFENSIVE HYPOTHESIS) P

We say that A strictly attacks A" in a program P (denoted by A"--~> A') if

A"~P A ' but A ' 4 A. P

A hypothesis A is shielded from an attack A' (denoted by A--~> A') if there is a A" C_ A such that A" "-~> A'.

A hypothesis is a defensive hypothesis (DH) if it is shielded from every attack.

A maximal defensive hypothesis is denoted MDH.

Notice that since support is a monotonic relation, the strict attack relation is indeed a strict restriction of the attack relation. This implies that a DH attacks every attack, that is, that every DH is a WFH. Notice also that O is a DH since no hypothesis can attack it.

PROPOSITION 8.3

Every DH is a WFH.

PROPOSITION 8.4

The empty set is a DH for every program. We call O the trivial DH.

Let us now show that every DH is also a strong hypothesis.

THEOREM 8.5

Every DH is strong.

Proof

Let A be a DH. If A' ~ A, then A' U A ----> A. Since A is a DH, we then have that there is a A" C A such that A"'---~> A ' U A. Since A is self-consistent (it is a WFH), it must be the case that A" ----> A' and A" U A' ---> A'. Now, since A' U A --~ A" and A" C A, then A' U A"~>A". Therefore, A"'--~> A' and A is stronger than A'. []

Example 8.6

The converse of the above theorem is not true. For example, in the program

p ~ - - ~ q

q ~---~p

r e - ~ p A ~ q

the hypothesis { -~ r} is strong since its only support is rebutted by the empty hypothesis. The only DH of the above program is the trivial one. As in the case of stable

A. Torres, A nondeterministic well-founded semantics 67

hypotheses, strong hypotheses capture a more powerful reasoning pattern than DH but are sometimes not classically sound.

We now show that the class of well-founded hypotheses is closed under union. Therefore, every program has a unique MDH.

THEOREM 8.7

The class of DH of a given program is closed under union.

Proof Let {At}~e~ be a collection of DH of a program P, and let A~= Ut~IA t. Let

, v . , v . . A , , _ AZ A ~ A I . There is some t E ~/such that A ~ A z . Since A t is a DH, there is a C

such that A " - ~ > A'. But since A" _ A t, then A ~ is shielded from A'. Hence, A 7 is a

DH. []

COROLLARY 8.8

Every program has a unique MDH.

In order to show that all DH have a linear structure, we introduce the notion of defensive extensions.

DEFINITION 8.9

A hypothesis A' is a defensive extension (DE) to a WFH A if A C A' and there is a well-order of A" = A' - A such that every assumption --1 fl in A" is unfounded w.r.t. AU A"

THEOREM 8.10

If A' is a DE to a WFH A, then A'is a WFH.

Proof

Let A" = A' - A. It is an easy induction using lemma 3.11 to show that every

A U A~# is a WFH. But then, lemma 3.5 implies that A' -- U-~#~ A"(A U A".#) is a

WFH. []

LEMMA 8.11

Let A be a DH. Then ~ f l ~ 'U(A) if and only if A U {-~fl} is a DH.

Proof Let us first prove the "only if" part. Lemma 3..11 implies that A U {--,fl} is

a WFH. Obviously, A U { --1 fl} is shielded from any attack of A. Now if A' supports

68 A. Torres, A nondeterministic well-founded semantics

fl but A' ~ A, since --1/3 is unfounded w.r.t. A, we have A --~ A'. Therefore, A strictly attacks A', and A U {--1 fl} is shielded from A'.

To prove the "if" part, notice that if -1 fl ~ '/./(A) there is a hypothesis A' such that A ~ fl, but then A U { --1/3 } is not shielded from A'. []

A simple induction using the above lemma leads to the following corollary.

COROLLARY 8.12

If A' is a DE to a DH, then A' is a DH.

We now show that the class of DE to any given WFH is closed under union. Therefore, there is a unique maximal DE (MDE) for every WFH.

THEOREM 8.13

The class of DE to a given WFH is closed under union.

Proof Let t {Ao}t~ be a family of DE to a given WFH A. Let Ao~= Ut~IAZo and

A ~ = Ao 1 - A. Let also A t - - A o - A for every t ~ 7. Let (I , ~) be any well-order of ~/, and

let "r -1 fl) = min~ {t �9 --1 fl E A t } for --1 fl ~ A 7. Let (A ~ , ~) be the well-order satisfying <

the condition of aefinition 8.9. Consider then the following well-order (A ~, _<) where

-~fl< -~fl'if T(~fl) ~_ 1;(~fl') ori f "t(~fl) -- "r(~fl ') and -~fl r~_~)-~fl'. Le tus now

show that Ao ~ is a DE to A and that < satisfy the condition of definition 8.9. It is direct

f rom the definition o f < that for any -~ fl E A ~ the hypothesis A ~ / ~ is included in

A ~ . But since Aro (~ ) is a DE to A, then ~ fl E '/./(A U A~/~)) . ~ []

COROLLARY 8.14

Every WFH has a unique MDE.

In the following, we show that the unique MDE to a given hypothesis is in fact the minimal CWFI that includes it.

THEOREM 8.15

Let A be a WFH and A' its MDE. A' is the minimal CWFI containing A.

Proof Let A "= A ' - A . Notice that every assumption --1/3 in A" is unfounded w.r.t.

A U A'L~. We can then prove by induction that every assumption in A" must be contained in any CWFI that includes A.

A. Torres, A nondeterministic well-founded semantics 69

To show that A" is complete, notice that if there is some ~ f l in "//(A'), then A' U { ~/3 } is a proper superset of A' that is also a DE to A. []

We now introduce linear defensive hypotheses that correspond to DE to the trivial DH.

DEFINITION 8.16

A hypothesis A is a linear defensive hypothesis (LDH) is there is a well-order of A such that every -~ t-prefix is a DH.

THEOREM 8.17

A hypothesis is an LDH is and only if it is an LDE to the trivial DH.

Proof

This result follows from a simple induction using lemma 8.11. []

As a consequence of the above result and proposition 4.11, we can conclude that the MDH of a program is its well-founded model, which is included in all MWFI (partial stable models).

THEOREM 8.19

A hypothesis is an LDH if and only if it is a DH. 16>

Proof

Let A be any DH. Theorem 8.13 implies there is a unique maximal LDH A' included in A. Now, every assumption ~ fl E A - A' has a support A -~t~ that is not attacked by A' (otherwise, A' U { ~ t } would be an LDH). But then A cannot be shielded from U-~fleA_A,A -~fl. But since A is a DH, it must be the case that A = A'. []

It is well known that the data complexity of the well-founded semantics is polynomial. The above theorem then implies that computing LDH and DH is tractable for propositional and datalog programs.

9. Derivation procedures

In this section, we present a series of bottom-up algorithms for computing well-founded hypotheses. We first explore two deterministic (skeptical) procedures that compute defensive hypotheses. We then introduce a simple algorithm that can

16)This result was first introduced in [22] as a definition for well-founded semantics.

70 A. Torres, A nondeterministic well-founded semantics

be used to compute linear well-founded hypotheses. Finally, we extend this latter algorithm with a tie-breaking strategy. We show that all of the above algorithms have polynomial data complexity. 17)

9.1. DETERMINISTIC PROCEDURES

In this subsection, we introduce two procedures that are sound with respect to the MDI, that is, the well-founded semantics. These procedures are complete for datalog programs.

Procedure SD (Set-at-a-time Deterministic), given a program P, computes its MDI when finite:

Procedure SD(P)

A : = O while Up(A) ;~ A

A := "Ue(A) end while return 1 A

end

Given that the Herbrand universe of a datalog program is finite, the above procedure always terminates for these programs. Notice that if the MDI is not finite, this procedure does not terminate. Moreover, some assumptions in the MDI may never enter A. When the procedure terminates, it computes the MDI of P. Moreover, this procedure has polynomial data complexity.

Since the class of LDH has the same power as the whole class of DH, procedure LD (Linear Deterministic) 18) is equivalent to procedure SD above:

Procedure LD(P)

A : = O while there exists some --1 fl unfounded w.r.t. A

A:=AU 1-131 end while return la

end

9.2. NONDETERMINISTIC PROCEDURES

In this subsection, we introduce the two central procedures of this paper. These procedures are nondeterministic since the final result computed may depend on the

]7)Recall that the data complexity, introduced in [24], is the complexity of determining the truth value for a ground atom given a fixed datalog IDB with respect to the size of a variable datalog EDB.

18)This procedure is a reformulation of Geffner's X1NAF [5].

A. Torres, A nondeterministic well-founded semantics 71

choices made at each step. Procedure LN (Linear Nondeterministic) computes LWFI when finite. Procedure (Linear + Tie-breaking Nondeterministic) extends procedure LN by including a tie-breaking strategy.

We first introduce procedure SN (Set-at-a-time Nondeterrninistic) that computes arbitrary MWFI.

Procedure SN(P)

A : = O while there exists some A' admissible w.r.t. A

A : = A U A ' end while return Ia

end

Notice that while the above procedure is complete for datalog programs, it is not a polynomial time procedure (unless P = NP).

We now introduce a linear version of the above procedure. We can obtain procedure LN by replacing the condition of unfoundedness for admissibility in procedure LD:

Procedure LN(P)

A : = ~ while there exists some ~ fl admissible w.r.t. A

A : = A U end while return I a

end

We can prove that the above procedure terminates for datalog programs, has polynomial data complexity and nondeterrninistically computes an LMWFI.

Procedure LN correctly handles Sacch and Zaniolo's choice programs (such as example 1.2). It also computes the correct semantics for the lounge/cafeteria program of example 1.1 when the adjacent relation is symmetrical. Since procedure LN computes LWFH, it is clear that it is sound but not complete with respect to WFH. For example, procedure LN returns the empty set when applied to the program of example 7.12.

Since solutions to well-founded ties are admissible, adding one such solution to a WFH will produce a larger WFH. This is the principle used in the well-founded tie-breaking procedure of [18]. We can combine this criterion with procedure LN. The result is the following procedure:

Procedure LTN(P)

A : = O while there exists some A' that is either

72 A. Torres, A nondeterministic well-founded semantics

(i) a singleton admissible w.r.t. A o r

(ii) a solution to a tie w.r.t. A A : = A U A '

end while return I•

e n d

We can prove that the above procedure terminates for datalog programs, non- deterministically computes a class of interpretations that are included in some MWFI and strictly extends both LMWFI and the well-founded tie-breaking semantics.

Procedure LTN computes the intended semantics of a larger class of programs than procedure LN, including all structurally total programs such as example 7.12. Nevertheless, procedure LTN is not complete with respect to the well-founded hypothesis semantics. For example, if we add to the program of example 7.12, the rule p <---- --1 r (which introduces an odd-length cycle), the above procedure computes the empty interpretation, while the resulting program has a single MWFI: { p, -~ q, r, ~ s }.

10. Concluding remarks

In this paper, we have introduced well-founded hypotheses and interpretations, a simple hypothetical semantics for logic programs. We have shown that the maximal well-founded interpretations are partial models that correspond to "alternative scenarios" described by nonstratified programs. We have shown that these partial models are total for the class of totally stable programs introduced in [23]. When well-founded interpretations are total, they are stable models.

We have provided a complete procedure (for datalog programs) to compute a linear subclass of well-founded hypotheses. We have shown that these linear hypotheses can be seen as a nondeterministic form of well-founded semantics. We have also extended such a procedure to include a tie-breaking strategy.

We believe that the hypothetical approach described in this paper will yield benefits to logic programming. This approach unifies most of the prevalent proposals and provides both a simpler, higher level intuition and a tool for developing new inference procedures.

Acknowledgements

The author would like to thank Jeffrey Ullman for his guidance, and Hector Geffner and Yannis Dimopolous for their useful comments.

References

[1] K.R. Apt, H. Blair and A. Walker, Towards a theory of declarative knowledge, Workshop on Foundations of Deductive Databases and Logic Programming, Washington, DC, ed. J. Minker (1986) pp. 89-148.

A. Torres, A nondeterministic well-founded semantics 73

[2] C. Berge and P. Duchet, Recent problems and results about kernels in directed graphs, Discr. Math. (1990)27-31.

[3] Y. Dimopoulos and A. Torres, Graph theoretical structures in logic programs and default theories, Technical Report MPI-I-93-264, Max-Planck Institute for Informatik (1993).

[4] Ph.M. Dung, Negation as hypothesis: An abductive foundation to logic programming, Proc. 8th Int. Conf. on Logic Programming (1991) pp. 3-17.

[5] H. Geffner, Beyond negation as failure, Proc. 2nd Int. Conf. on Principles of Knowledge Representation and Reasoning (Kaufman, 1991) pp. 218-229.

[6] A. van Gelder, Negation as failure using tight derivations for general logic programs, Proc. 3rd IEEE Symp. on Logic Programming (Springer, 1986).

[7] M. Gelfond and V. Lifschitz, The stable model semantics for logic programming, Proc. 5th Int. Conf. and Syrup. on Logic Programming (MIT Press, Cambridge, MA, 1988).

[8] A. van Gelder, K.A. Ross and J.S. Schlipf, Unfounded sets and well-founded semantics for general logic programs, Proc. 7th ACM Syrup. on Principles of Database Systems (1988) pp. 221-230. (Full version appeared in J. ACM 38(1992)620-650.

[9] A.C. Kakas, R.A. Kowalski and E Toni, Abductive logic programming, J. Logic Comput. 2(1992) 719-770.

[10] A.C. Kakas and P. Mancarella, Negation as stable hypotheses, Proc. 1st Int. Workshop on Logic Programming and non-monotonic reasoning, eds. W. Marek and V.S. Subrahmanian (1991) pp. 275-288.

[11 ] A.C. Kakas and P. Mancarella, Stable theories for logic programs, Proc. 8th Int. Conf. and Symp. on Logic Programming (1991) pp. 85-100.

[I2] A.C. Kakas and P. Mancarella, Preferred extensions are partial stable models, J. Logic Progr. 14(1992)341- 348.

[13] E. Laenens, D. Vermeir and C: Zaniolo, Logic programming semantics made easy, Proc. 19th Int. Colloq. on Automata, Languages and Programs, LNCS (Springer, 1992) pp. 499-508.

[14] A. Marek and M. Truszczynski, Autoepitemic logic, J. ACM 38(1991)588-619. [15] J. yon Neumann and O. Morgenstern, Theory of Games and Economic Behavior (Princeton

University Press, Princeton, 1944). [16] H. Przymusinska and T. Przymusinski, Semantic issues in deductive databases and logic programs,

in: Sourcebook on the Formal Approaches in Artificial Intelligence, ed. A. Banerji (North- Holland, Amsterdam, 1989).

[ 17] T.C. Przymusinski, Well-founded semantics coincides with three-values stable semantics, Fundamenta Informaticae XIII(1990)445-463.

[18] C. Papadimitriou and M. Yannakakis, Tie-breaking semantics and structural totality, Proc. 11th Syrup. on Principles of Database Systems (1992) pp. 16-22.

[19] R. Reiter, On closed world databases, in: Logic and Databases, eds. H. Gallaire and J. Minker (Plenum Press, New York, 1978) pp. 55-76.

[20] D. Sacc~t and C. Zaniolo, Stable models and non-determinism in logic programs with negation, Proc. 9th ACM Symp. on Principles of Database Systems (1990) pp. 205-217.

[21] A. Torres, Generalized supports for stable and well-founded semantics, in preparation. [22] A. Torres, Is there a "right" semantics for negation as failure, Proc. 3rd Int. Workshop on the

Deductive Approach to Information Systems and Databases, Universitat Polit~cnica de Catalunya (1992) pp. 157-166. Technical Report LSI/92/19.

[23] A. Torres, Negation as failure to support, Proc. 2nd Workshop on Logic Programming and Non- monotonic Reasoning (MIT Press, 1993) pp. 223-243.

[24] M.Y. Vardi, The complexity of relational query languages, Proc. 14th ACM Symp. on Theory of Computing (1982) pp. 137-145.