43

Building a knowledge base: an example

  • Upload
    cmu

  • View
    0

  • Download
    0

Embed Size (px)

Citation preview

Annals of Mathematics and Arti�cial Intelligence 0 (2000) ?{? 1Building a knowledge base: an exampleMichael Gelfond a Alfredo Gabaldon ba Department of Computer ScienceUniversity of Texas at El PasoEl Paso, TX 79968, USAE-mail: [email protected] Department of Computer ScienceUniversity of TorontoToronto, Canada M5S 3G4E-mail: [email protected] main goal of this paper is to illustrate applications of some recent develop-ments in the theory of logic programming to knowledge representation and reasoningin common sense domains. We are especially interested in better understanding theprocess of development of such representations together with their speci�cations.We build on the previous work of Gelfond and Przymusinska in which the authorssuggest that, at least in some cases, a formal speci�cation of the domain can be ob-tained from speci�cations of its parts by applying certain operators on speci�cationscalled speci�cation constructors and that a better understanding of these operatorscan substantially facilitate the programming process by providing the programmerwith a useful heuristic guidance. We discuss some of these speci�cation construc-tors and their realization theorems which allow us to transform speci�cations builtby applying these constructors to declarative logic programs. Proofs of two suchtheorems, previously announced in a paper by Gelfond and Gabaldon, appear herefor the �rst time. The method of specifying knowledge representation problems viaspeci�cation constructors and of using these speci�cations for the development oftheir logic programming representations is illustrated by design of a simple, butfairly powerful program representing simple hierarchical domains.Keywords: knowledge representation, logic programming, program correctness.AMS Subject classi�cation: Primary: 68T30, 68N1; Secondary: 68Q601. Introduction\The only e�ective way to raise the con�dence level of a program signi�cantly is

2 M. Gelfond, A. Gabaldon / Building a knowledge base: an exampleto give a proof of its correctness. But one should not �rst make the program andthen prove its correctness, because then the requirement of providing the proofwould only increase the poor programmer's burden. On the contrary: the pro-grammer should let correctness proof and program grow hand in hand. ...If one�rst asks oneself what the structure of a convincing proof would be and, havingfound this, then construct a program satisfying this proof 's requirements, thenthese correctness concerns turn out to be a very e�ective heuristic guidance."E. Dijkstra, The Humble ProgrammerThe main goal of this paper is to illustrate applications of some recent devel-opments in the theory of logic programming to knowledge representation andreasoning in common sense domains. The paper is written in the framework ofthe declarative logic programming paradigm which strives to reduce a substan-tial part of the programming process to the description of objects comprising thedomain of interest and relations between these objects. After such a descrip-tion is produced by a programmer, it can be queried to establish truth or falsityof statements about the domain or to �nd objects satisfying various properties.The software development process in this paradigm starts with a natural languagedescription of the domain which, after a necessary analysis and elaboration, isdescribed in mathematical terms. The main purpose of this initial mathematicalspeci�cation is to be understood by the people involved in the development ofthe system and to serve as a contract between the system speci�ers and imple-mentors. This speci�cation is then gradually transformed by implementors intoan executable program satisfying the speci�cation. (The process will of coursenormally require more than one iteration.) There are many languages which canbe used during various stages of this transformation. This paper adopts the viewfrom [24] where the authors argue that for a rather broad class of knowledge rep-resentation problems the process of representing knowledge can be divided intothree (mutually dependent) parts:� Elaboration of a natural language description of the domain can be done in alanguage of functional speci�cations - possibly incomplete de�nitions of newrelations between objects of the domain of discourse given in terms of theold, known relations.1 These speci�cations can be de�ned by a speci�er di-1 In precise terms, a functional speci�cation consists of two signatures �i and �o and a (possiblypartial) function f which maps sets of ground literals over �i into sets of ground literals over

M. Gelfond, A. Gabaldon / Building a knowledge base: an example 3rectly in a simple set-theoretic language, or they can be built from previouslyde�ned speci�cations with the help of speci�cation constructors - simple func-tions from speci�cations to speci�cations. This method is applicable when ourknowledge representation problem can be parameterized with respect to somepossible inputs. (A good discussion on the importance of explicitly specifyinginput and output of knowledge representation problems in AI can be found in[29].)� On the second stage implementors of the system are given the functional spec-i�cation f constructed during the �rst stage of the process. Now they areconfronted with the task of representing f in a logical language with a pre-cisely described entailment relation. Gelfond and Przymusinska [24] advocatethe use of a language A-Prolog of logic programs with two types of negationand the answer set semantics. The choice is determined by the ability ofA-Prolog to represent default assumptions, i.e., statements of the form \Ele-ments of the class A normally (typically, as a rule) have property P", epistemicstatements \P is unknown", \P is possible", and other types of statementsneeded for describing commonsense domains. Other important factors are thesimplicity of the semantics, strong expressive power of the language, existenceof a mathematical theory providing a basis for proving properties of programsin A-Prolog, and the availability of query answering systems which can beused for rapid prototyping2. There are other reasons but we will not discussthem in this paper. The alternative approach which uses logic programs withwell-founded semantics and its extensions can be found in [1].At the end of the second stage the implementor will have a logic program �which, taken in conjunction with a collection X of facts about known relations�o.2There is a variety of query-answering systems which can be used to compute answers toqueries in A-Prolog. A simple meta-interpreter build on top of Prolog or XSB [10] proved tobe su�cient for the purposes of this paper. Description of such a meta-interpreter build on topof SLDNF of Prolog can be found in section 4. For more complicated programs, especially forthose which have multiple stable models, this interpreter will go into a loop or answer unknownto too many interesting queries. Roughly speaking this happens because Prolog and XSB donot allow reasoning by cases. This type of reasoning is incorporated in a more powerful system,called SLG [9], which was successfully used to answer queries in the presence of multiple stablemodels. A di�erent type of engine, [36,16,35], are based on algorithms for computing stablemodels of programs without function symbols.

4 M. Gelfond, A. Gabaldon / Building a knowledge base: an exampleof f , will entail exactly those facts about the new relations which belongto f(X). Programs of this sort are called lp-functions. In [24] the authorssuggest that the construction of � from f can be substantially facilitated bymathematical results relating speci�cation constructors to some operations onlogic programs. Such results are called realization theorems. They can providean implementor with a useful heuristic guidance and the means to establishcorrectness of his programs. Several examples of such theorems and theirapplications will be given in the following sections.� At the last stage of the process, the lp-function � representing functionalspeci�cation f will be transfered into an e�cient logic program � computing(or approximating) the entailment relation of �. Unlike �, the constructionof � will depend signi�cantly on the choice of query answering system usedby the implementors. For instance, the use of standard Prolog interpretermay require modi�cation of � which includes the cut operator of Prolog toavoid loops or to improve e�ciency. The use of XSB will avoid some of theseproblems but will require the choice of predicates to be tabled, etc.Space limitations preclude us from giving any serious comparison of our approachwith other methodologies of representing knowledge. Moreover, we believe thatsuch a comparison can only be done when all of these methodologies are morefully developed. Still a short remark is in order. At the moment, the speci�ca-tion language most frequently used for the �rst formal re�nement of a problemis probably the language of �rst-order logic (FOL). As others before us we con-jecture that FOL is not fully adequate for our purpose. Its expressive power isinsu�cient to de�ne even fairly simple f-speci�cations such as transitive closure ofdatabase relations. It also doesn't seem to be the best language for representingdefaults, epistemic statements, and other types of \commonsense" knowledge.These observations are well known and led to various extensions of FOL whichallow nonmonotonic reasoning. Our preference for a less powerful language Lof logic programs under the answer set semantics is similar to our preference ofModula 2 over ADA. Since, as was shown in [7,20], programs of L can be viewedas theories of Reiter's default logic [40], we hope that those who prefer powerover simplicity can still bene�t from this work. The next question to answer is\Why not to use the language of logic programming during the �rst stage of thedevelopment process?" What are the advantages of �rst formulating the problemin terms of functional speci�cations? There are two reasons why we do that. The

M. Gelfond, A. Gabaldon / Building a knowledge base: an example 5�rst advantage of the language of f-speci�cations over L is its simplicity. Theconstruction of f requires knowledge of a simple set-theoretic notation togetherwith de�nitions of a (hopefully small) collection of speci�cation constructors. Thespeci�er involved at the �rst stage of the process does not need to know anythingabout the semantics of L. Another possible advantage of translating a naturallanguage description of a problem into an f-speci�cation f is the ability to usethe structure of f and the corresponding realization theorems for reducing theconstruction of �f to the construction of simpler programs. One of the main goalsof this paper is to demonstrate, by way of example, how this can be achieved.Finally, we want to mention that in this paper we are mainly interested in the�rst two stages of the development process. In this sense our approach is comple-mentary to the work on program development in Prolog (see for instance [12]).(See however Proposition 13).The paper is organized as follows. In the next two sections we review the answerset semantics of logic programs and the notions of f-speci�cation and lp-function.In the next section we give a �rst example of applying our methodology to solv-ing a knowledge representation problem associated with a simple type of tax-onomic hierarchy. (This and other problems related to inheritance reasoningare commonly used to test strengths and weaknesses of various nonmonotonicformalisms.) We start with specifying the problem in terms of functional spec-i�cations, representing it by a declarative logic program, and showing that thisprogram can be correctly executed by the Prolog interpreter. In the process weintroduce a speci�cation constructor, called incremental extension, and give arealization theorem for it. The knowledge representation problem discussed inthis section assumes completeness of knowledge. In the next section we considerthe situation when this assumption is relaxed and our knowledge of some rela-tions from the domain of the problem becomes incomplete. The new speci�cationis obtained from the original one by applying a speci�cation constructor calledinput opening. We discuss the de�nition of this constructor, its decompositioninto two simpler constructors, interpolation and domain completion, and the cor-responding realization theorems. (These theorems were stated in [25] withoutproofs, and hence their proofs are included in this paper.) Finally, in the last sec-tion, we discuss one more knowledge representation problem de�ned in terms ofanother speci�cation constructor, called input extension. Somewhat surprisingly,the resulting class of programs formalizes inheritance reasoning with incomplete

6 M. Gelfond, A. Gabaldon / Building a knowledge base: an exampleinformation which was not previously considered.2. Logic ProgramsIn this section we give a brief introduction to the answer set semantics forlogic programs with two kinds of negation [21]3. For a more detailed discussionsee [5] and [30].The language of a logic program, like a typed �rst-order language, is determinedby its signature �, consisting of types (types(�)), object constants for each type� (obj(�; �)), and typed function and predicate constants (func(�) and pred(�)respectively). Signature �1 is a sub-signature of signature �2 if types(�1) �types(�2), func(�1) � func(�2), pred(�1) � pred(�2), and for each type � whichbelongs to both signatures, obj(�; �1) = obj(�; �2); � = �1 [ �2 if elements of� are unions of the corresponding elements of �1 and �2. Terms are built as inthe corresponding typed �rst-order language; positive literals (or atoms) have theform p(t1; : : : ; tn), where t's are terms of proper types and p is a predicate symbolof arity n; negative literals are of the form :p(t1; : : : ; tn). (Logical connective : inthe context of logic programming is called \classical", or \explicit", or \strong"negation.) Literals of the form p(t1; : : : ; tn) and :p(t1; : : : ; tn) are called contrary.By l we denote a literal contrary to l. Literals and terms not containing variablesare called ground. The sets of all ground terms, atoms and literals over � will bedenoted by terms(�), atoms(�) and lit(�) respectively. For a set P of predicatesymbols from �, atoms(P; �) (lit(P; �)) will denote the sets of ground atoms(literals) of � formed with predicate symbols from P . Consistent sets of groundliterals over signature � are called states of � and denoted by states(�).A rule is an expression of the forml0 l1; : : : ; lm; not lm+1; : : : ; not ln (1)where n � 0, li's are literals and not is a logical connective called negation asfailure [11,39].A pair f�; �g where � is a signature and � is a collection of rules over � is called3 For programs without classical negation the answer set semantics coincides with the stablemodel semantics of [19].

M. Gelfond, A. Gabaldon / Building a knowledge base: an example 7a logic program. (We often denote such pairs by their second element �. Thecorresponding signature will be denoted by �(�).)If r is a rule of type (1) then head(r) = fl0g; pos(r) = fl1; : : : ; lmg; neg(r) =flm+1; : : : ; lng. For any program �, head(�) = Sr2� head(r). Similarly, for posand neg. Sometimes, not li; : : : ; not li+k will be denoted by not (fli; : : : ; li+kg).Unless otherwise stated, we assume that l0s in rule (1) are ground. Rules withvariables will be used as a shorthand for the sets of their ground instantiations.Variables will be denoted by capital letters.The answer set semantics of a logic program � assigns to � a collection of answersets - sets of ground literals over signature �(�) of � corresponding to beliefswhich can be built by a rational reasoner on the basis of rules of �. Under thissemantics the rule (1) can be viewed as a constraint on such beliefs and is readas \if literals l1; : : : ; lm are believed to be true and there is no reason to believethat literals lm+1; : : : ; ln are true then the reasoner must believe l0." We say thatliteral l 2 lit(�(�)) is true in an answer set S of � if l 2 S; l is false in S if l 2 S;� entails l (� j= l) if l is true in all answer sets of �. We say that �'s answer to aquery l 2 lit(�(�)) is yes if � j= l, no if � j= l, and unknown otherwise.To give a de�nition of answer sets of logic programs, let us �rst consider programswithout negation as failure.� The answer set of a program � not containing negation as failure not is thesmallest (in the sense of set-theoretic inclusion) subset S of lit(�(�)) such that(i) for any rule l0 l1; : : : ; lm from �, if l1; : : : ; lm 2 S, then l0 2 S;(ii) if S contains a pair of contrary literals, then S = lit(�(�)).It can easily be shown that every program � that does not contain negation asfailure has a unique answer set, which will be denoted by ans(�).� Now let � be an arbitrary logic program without variables. For any set S ofliterals, let �S be the logic program obtained from � by deleting(i) each rule that has an occurrence of not l in its body with l 2 S, and(ii) all occurrences of not l in the bodies of the remaining rules.Clearly, �S does not contain not , and hence its answer set is already de�ned. If

8 M. Gelfond, A. Gabaldon / Building a knowledge base: an examplethis answer set coincides with S, then we say that S is an answer set of �. Inother words, the answer sets of � are characterized by the equationS = ans(�S): (2)A logic program is said to be consistent if it has a consistent answer set.4It is notdi�cult to show that any answer set of a consistent program is consistent.We conclude our short introduction by presenting a theorem useful for computingthe set of consequences of logic programs. This process can be sometimes simpli-�ed by \splitting" the program into parts. We say that a set U of literals splitsa program � if, for every rule r of �, pos(r)[neg(r) � U whenever head(r) 2 U .If U splits � then the set of rules in � whose heads belong to U will be called thebase of � (relative to U). We denote the base of � by base(�; U). The rest of theprogram (called the top of �) will be denoted by top(�; U). Whenever possiblethe reference to U will be omitted.Consider for instance a program �1 consisting of the rulesq(a) not q(b); q(b) not q(a); r(a) q(a); r(a) q(b)Then U = fq(a); q(b)g is a splitting set of �1, base(�1; U) consists of the �rst tworules while top(�1; U) consists of the last two.Let U be a splitting set of a program �. For any set V � U , by red(�; V ) wedenote the program obtained from top(�; U) by1. deleting each rule r s.t. pos(r) \ (U n V ) 6= ; or neg(r)\ V 6= ;;2. replacing the body of each remaining rule r by pos(r) nU [ not (neg(r) nU).Theorem 1 (Splitting Set Theorem, [31]).Let U be a splitting set of a program�. A consistent set of literals is an answer set of � i� it can be represented in theform S1 [ S2, where S1 is an answer set of base(�; U) and S2 is an answer set ofred(�; S1).The theorem suggests the following approach to computing consistent answer setsof a program � which is split by some set U . First �nd all the answer sets ofthe program base(�; U). For each such set S1, compute the program red(�; S1),and �nd all its answer sets. For each such sets S2 form a union S1 [ S2. The4 A set of literals is consistent if it does not contain contrary literals.

M. Gelfond, A. Gabaldon / Building a knowledge base: an example 9consistent unions found in this way are the consistent answer sets of �. Consider,for instance, program �1 above. Then the programq(a) not q(b); q(b) not q(a)is the base of �1 w.r.t. U . It has answer sets S1 = fq(a)g and S2 = fq(b)g. Thecorresponding reducts arered(�1; S1) = red(�1; S2) = r(a) and, by the splitting set theorem, the answer sets of �1 are fq(a); r(a)g andfq(b); r(a)g. In the context of logic programming, the splitting set theorem andits generalizations �rst appeared in [31]. Similar results for autoepistemic logiccan be found in [23].3. F-speci�cations and lp-functionsIn some cases a knowledge representation problem consists in representinga (possibly partial) de�nition of new relations between objects of the problemdomain which is given in terms of previously known relations between these ob-jects. Such a de�nition can be mathematically described as a function f whichmaps states of an input signature �i into the states of an output signature �o.The states of �i are called input states. They contain all the currently availableinformation about the old, given relations. Similarly, the states of �o are calledoutput states; f(X) contains all we may know about de�ned relations given aninput state X . We follow [23] and call a triple consisting of such a function ftogether with input and output signatures �i(f) and �o(f) a functional speci�-cation; dom(f) will denote the domain of f5.The following example shows how a simple knowledge representation problemcan be re�ned in terms of f-speci�cations.Example 2. Consider the following informal speci�cation of a knowledge repre-sentation problem:5This view is common in databases where one of the most important knowledge representationproblems consists in de�ning new relations (views) in terms of basic relations stored in thedatabase tables. Unlike our case however databases normally assume the close world assump-tion and hence only need to represent positive information. As a result, views can be viewedas functions from sets of atoms to sets of atoms.

10 M. Gelfond, A. Gabaldon / Building a knowledge base: an exampleFormalize the assertion \x has a PhD i� x is a faculty". Given a complete list offaculty your formalization should entail all the available information about PhDdegrees of people from this list. Use unary predicate constants faculty and phd.Despite its simplicity, the above speci�cation is slightly ambiguous. Its possiblere�nements may depend on the form of representation of a \complete list offaculty." We look at two di�erent representations of this list de�ned by twof-speci�cations f0 and g0. The speci�cations have the same signatures:- input signature �i consisting of individual names, say, mike, john and maryand a unary relation symbol faculty;- output signature �o consisting of the same individual names and a unarypredicate symbol phd;Function f0 is de�ned on complete states of �i6. Obviously, for any X 2 dom(f0)f0(X) = fphd(c) : faculty(c) 2 Xg [ f:phd(c) : :faculty(c) 2 XgSimilarly, function g0 is de�ned on sets of ground atoms of �i.g0(X) = fphd(c) : faculty(c) 2 Xg [ f:phd(c) : faculty(c) 62 XgMaking an early distinction between these two speci�cations of our informal prob-lem helps to eliminate possible di�culties which may appear later in the devel-opment process.Example 3. Now let us look at a slightly di�erent informal speci�cation. As-sume that the language of our domain is determined, as in Example 2, by signa-tures �i and �o but, unlike that example, the available information about facultycan be incomplete. For instance, we may know that Mike is a faculty, John isnot, but have no relevant information about Mary. This can be represented by anincomplete set of literals ffaculty(mike);:faculty(john)g. In general, the inputof the corresponding f-speci�cation ~f0 consists of (possibly incomplete) states of�i and ~f0 can be de�ned as follows:6 A set X of literals over signature � is called complete if for any l 2 lit(�), l 2 X or l 2 X.

M. Gelfond, A. Gabaldon / Building a knowledge base: an example 11~f0(X) = \X̂2c(X)f0(X̂)where c(X) is the set of all complete supersets ofX from dom(f0). Notice that thenew speci�cation is de�ned in terms of f0 and can be viewed as an interpolationof function f0 from complete to all input states. (See Section 5 for more details).It is easy to see that ~f0 computes all possible information about PhD degreeswhich can be obtained from X and f0.To further re�ne the above f-speci�cations we will use the notion of lp-functionfrom [6].De�nition 4. A four-tuple � = f�; �i(�); �o(�); dom(�)g where1. � is a logic program (with some signature �(�));2. �i(�); �o(�) are sub-signatures of �(�) called input and output signatures of� respectively;3. dom(�) � states(�i(�))is called lp-function if for any X 2 dom(�) program � [X is consistent, i.e., hasa consistent answer set.For any X 2 dom(�),�(X) =def fl : l 2 lit(�o(�)); � [X j= lg:We say that an lp-function � represents an f-speci�cation f if � and f havethe same input and output signatures and domain and for any X 2 dom(f),f(X) = �(X).Let E be an inference engine which takes as an input a logic program � and aground literal l. We will say that an lp-function � is computable by E if for anyquery l 2 lit(�o) and any X 2 dom(�), E(� [X; l) returns yes if l 2 �(X), no ifl 2 �(X), and unknown otherwise.Example 5. It is easy to show that f-speci�cation f0 from Example 2 can berepresented by lp-function �f0 with signature � consisting of types, objects, andpredicate symbols of �i(f0) and predicate symbol phd and the rules:

12 M. Gelfond, A. Gabaldon / Building a knowledge base: an examplephd(P ) faculty(P ):phd(P ) :faculty(P )) �f0The input and output signatures of �f0 are the same as those of f0 and dom(�f0) =dom(f0). An alternative representation �0(f0) can also be given by replacing therules of �f0 by the rulesphd(P ) faculty(P ):phd(P ) not faculty(P )) �0f0It is also easy to see that the restriction �g0 of �0f0 on the dom(g0) is an lp-functionrepresenting g0.Now let us consider f-speci�cation ~f0 from Example 3. One can show that thelp-function � ~f0 whose rules are those of �f0 and signatures and domain are thoseof ~f0, represents ~f0. This means that �f0 is elaboration tolerant with respect toallowing new, incomplete inputs, i.e. the change of speci�cation from f0 to ~f0does not require any changes in �f0 . This is certainly not the case for the secondrepresentation of f0. In this sense, �f0 is superior to �0f0 .Since all the lp-functions above are (e�ciently) computable by a slight modi�ca-tion of the Prolog interpreter the re�nement process stops here.7To complete this section we give several de�nitions and results which proved tobe useful for reasoning about lp-functions.An lp-function � is called monotonic if for any X; Y from dom(�) such thatX � Y , �(X) � �(Y ).The absolute value of a literal l (symbolically, jlj) is l if l is positive, and lotherwise.De�nition 6. Let � be a logic program with signature �. A signing of � is a setS � atoms(�) s.t.7Of course, by considering only ground queries we limit ourself to a very restricted notion ofcomputability of lp-function f by inference engine E. It can of course be extended to allowqueries from �o(f) with variables but then the function �g0 will stop being computable due to oundering. This again can be remedied by introducing types like person, degree, etc., andmodifying our program accordingly or by using a query answering system with constructivenegation [8,38]. For the sake of readability we will only consider ground queries.

M. Gelfond, A. Gabaldon / Building a knowledge base: an example 131. for any rule (1) from �, either jl0j; : : : ; jlmj 2 S, jlm+1j; : : : ; jlnj 62 S orjl0j; : : : ; jlmj 62 S, jlm+1j; : : : ; jlnj 2 S;2. for any atom l 2 S, :l does not appear in �.If a program has a signing, we say that it is signed [28,44]. The notion of signingfor �nite logic programs without classical negation was introduced by Kunen [28],who used it as a tool in his proof that, for a certain class of program, two di�erentsemantics of logic programs coincide. Turner in [44] extends the de�nition to theclass of logic programs with two kinds of negation. Obviously, programs withoutnegation as failure are signed with an empty signing.Signed programs enjoy several important properties which make them attractivefrom the standpoint of knowledge representation. In particular,1. Signed programs without explicit negation are consistent. This is a specialcase of a more general theorem by Fages [18].2. If � is signed and consistent then the set of consequences of the programunder the answer set semantics coincides with its set of consequences underthe well-founded semantics [46,37]. Notice this result shows that interpreters,such as XSB, which compute the well founded semantics of logic programs,can also be used to compute the consequences of such programs under theanswer set semantics.We will however be especially interested in the following monotonicity theorem.Theorem 7. (Monotonicity Theorem, Turner) If an lp-function � has a signingS s.t. S \ (lit(�i) [ lit(�o)) = ; then � is monotonic.This result is a special case of a substantially more general result from [45].Example 8. Consider an lp-function �2 with input signature �i = ffa; b; cg; fp; rgg,output signature �o = ffa; b; cg; fqgg, dom(�2) = states(�i) and logic program�2 consisting of the following rules:q(X) p(X); not ab(X):q(X) r(X)ab(X) not :r(X) 9>>=>>; �2It is easy to see that lp-function �2 has a signing consisting of atoms formedby predicate ab. The signing satis�es the condition of Theorem 7, and hence

14 M. Gelfond, A. Gabaldon / Building a knowledge base: an examplep

(a)

d1

d2

c 1 c

c c

c

2

3

5

4

p

(b)

d1

d2

o o

c c

c c

c

1 2

21

3 4

5

p

(c)

d

d

1

2

o o

c co

c c

c

1 2

213

3 4

5

Figure 1. A simple taxonomic hierarchy�2 is monotonic. It's worth noticing that �2 considered as a logic program isnonmonotonic. The addition of extra rules (or facts) about ab can force us towithdraw previous conclusions about q. Monotonicity is however preserved forinputs from �i.4. An Example: is-nets on closed domainsIn this section, we illustrate the notions of functional speci�cation and lp-function by using them to solve a knowledge representation problem associatedwith a simple type of taxonomic hierarchy, called is-nets. The problem of specify-ing and representing is-nets is commonly used to test strengths and weaknesses ofvarious nonmonotonic formalisms. Logic programming approaches to this prob-lem (which assume completeness of its domain) can be found in [1] and [32].Modi�cations of this example will be used throughout the rest of the paper.An is-net N can be viewed as a combination of graphs Ns and Nd where Nsdescribes the (proper) subclass relation between classes and Nd consists of posi-tive and negative defeasible links connecting classes with properties. The latterrepresent defaults: \elements of class c normally satisfy (do not satisfy) propertyp". As usual we assume that Ns is acyclic and that a class c and a property p canbe connected by at most one link. We use (possibly indexed) letters o, c, p, andd to denote objects, classes, properties and defaults respectively. Fig. 1a gives apictorial representation of a net. Here c1; : : : ; c5 are classes and p is a property.Links from c5 to p and from c4 to p represent positive and negative defaults whilethe other links represent the subclass relationship.

M. Gelfond, A. Gabaldon / Building a knowledge base: an example 15There are many knowledge representation problems which can be associated witha net N . We start with the simplest one, when N is viewed as an informalspeci�cation of a function fN which takes as an input the links of N togetherwith a collection I of positive links from objects to classes (see Fig. 1b). Wedenote the resulting graph by N(I) and assume that for any object o and class cfromN(I), o is an element of c i�N(I) contains a path from o to c. Similarly, c1 isa (proper) subclass of c2 i� there is a path from c1 to c2. Given N(I), the functionfN computes all possible conclusions about relations subclass; is and has whicha rational agent can obtain from this net.8 Our ability to represent an input offN by positive links only is justi�ed by our assumption that, at least with respectto objects included in N(I), the net N(I) contains complete information aboutrelations is and subclass. Accordingly, we call fN a closed domain speci�cationof N .In what follows we will be interested in applying our methodology for providing arigorous speci�cation of this function and for �nding its logic programming rep-resentation. Later we consider more complex knowledge representation problemswhich can also be associated with N .Specifying the problemWe start by playing the role of a speci�er and give a precise de�nition offunction fN using the language of f-speci�cations. To this goal, we �rst �x threecollections of object constants for objects, classes and properties of the nets. Thecorresponding types will be denoted by �o; �c, and �p. Constants of the fourth type(�d) will be used to name the nets default links. Next we identify graphs Ns andNd with the collection of literals of the form subclass0(c1; c2), default(d; c; p;+),and default(d; c; p;�) which correspond to the links of these graphs. (The lastparameter in default is used to distinguish positive and negative links.) A setI of links from objects to classes will be identi�ed with the collection of thecorresponding statements of the form is0(o; c). Function fN will be constructedas a combination of three simpler functions fs, fi and fd:a. An f-speci�cation fs will take as an input a net Ns - a collection of atomssubclass0(ci; cj) where ci, cj are classes connected by a link of Ns and returnthe complete set of literals, formed by the predicate symbol subclass, de�ning8 is(o; c) stands for \object o is an element of class c"; has(o;p) means that \object o hasproperty p". Both predicates are typed.

16 M. Gelfond, A. Gabaldon / Building a knowledge base: an examplethe transitive closure of the input; both, input and output signatures offs have the same object constants of the type �c, and predicate symbolssubclass0 and subclass respectively.b. An f-speci�cation fi takes as an input a complete set of subclass-literals(representing transitive and asymmetric relations subclass) together with theset I of atoms is0(o; c) representing links from objects to classes; fi returnsthe complete set of is-literals representing the membership relation de�nedby the input. Input and output signatures of fi have object constants of twotypes, �o and �c; pred(�i(fi)) = fis0; subclassg while pred(�o(fi)) = fisg.c. We also need a more complex f-speci�cation fd de�ned as follows:� The input signature �i(fd) of fd consists of object constants of three types,�o; �c, and �d and predicate symbols is; subclass, and default. The outputsignature �o(fd) consists of object constants of the types �o and �p andpredicate symbol has.� dom(fd) consists of states of �i(fd) which are complete with respect to isand subclass and satisfy the constraints:9 is(o; c1);subclass(c1; c2);:is(o; c2): subclass(c; c): default(d; c; p;+);default(d; c; p;�):� For any X 2 dom(fd), has(o; p) 2 fd(X) i� there are d1 and c1 s.t.(a) default(d1; c1; p;+) 2 X(b) is(o; c1) 2 X(c) for any default(d2; c2; p;�) 2 X ,:is(o; c2) 2 X or subclass(c1; c2) 2 XThis condition corresponds to the Inheritance Principle [43] which saysthat more speci�c defaults override less speci�c ones.9 A constraint is a rule of the form � where � is a list of literals from some signature �. A setX 2 states(�) satis�es the constraint � if � 6� X. X satis�es a collection C of constraintsif it satis�es every constraint in C.

M. Gelfond, A. Gabaldon / Building a knowledge base: an example 17Similarly for :has(o; p).d. To complete the construction of fN we will need the following notation: forany � � pred(�) and X � lit(�) by [X ]� we denote the set of literals fromX formed by predicate symbols from �.Now the f-speci�cation fN will be de�ned as follows:� the input signature of fN consists of object constants of the types �o; �c; �dand predicate symbols is0; subclass0; default;� the output signature of fN consists of objects constants of the types�o; �c; �p and predicate symbols subclass; is; has;� dom(fN ) = fX : X � atoms(�i(fN))g10;� fN is de�ned by combining functions fs; fi and fd as follows:Y0(X) = fs([X ]subclass0)Y1(X) = fi(Y0(X)[ [X ]is0)Y2(X) = fd(Y0(X)[ Y1(X)[ [X ]default)fN (X) = Y0(X)[ Y1(X)[ Y2(X)Note that this de�nition does not require any sophisticated mathematics. Inparticular, it presupposes no knowledge of logic programming.It is worth noticing that we can view fN as being constructed from f-speci�cationsfd; fs and fi by a speci�cation constructor called incremental extension [24]. Sincethis fact will be useful later in our search for an lp-function representing fN werecall the corresponding de�nition11 . For simplicity we only consider signatureswhich agree on their common types, i.e., if � 2 �1\�2 then obj(�; �1) = obj(�; �2).De�nition 9. The f-speci�cation f � g is called the incremental extension of gby f if it satis�es the following conditions:1. �i(f � g) = �i(g)[ �i(f);2. �o(f � g) = �o(g)[ �o(f);3. X 2 dom(f � g) if[X ]pred(�i(g)) 2 dom(g) and10The domain of fN can be alternatively represented by complete sets of literals of �i(fN ). Theresulting speci�cation will be isomorphic to fN and used when convenient.11The de�nition we give in this paper actually extends that in [24]

18 M. Gelfond, A. Gabaldon / Building a knowledge base: an example[X ]pred(�i(f))npred(�o(g)) [ g([X ]pred(�i(g))) 2 dom(f)4. f � g(X) = f([X ]pred(�i(f))npred(�o(g)) [ g([X ]pred(�i(g))))[ g([X ]pred(�i(g)))It is easy to see that the de�nition of fN above can be rewritten asfN = fd � (fi � fs) (3)Building the declarative representationNow let us assume the role of an implementor, who just received the abovede�nition of fN and is confronted with the task of building a computable lp-function representing fN . (Recall that we will only be interested in getting an-swers to ground queries formed by predicates subclass; is; and has.) According toour methodology, we will �rst ignore the computability requirement and concen-trate on correctness of our representation viewed as a declarative logic program.We start with a representation for fs. Since Ns is acyclic, it is easy to show thatfs can be represented by the program �ssubclass(C1; C2) subclass0(C1; C2):subclass(C1; C2) subclass0(C1; C3);subclass(C3; C2)::subclass(C1; C2) not subclass(C1; C2):9>>>>>>>>>=>>>>>>>>>; �sIt is equally easy to show that fi can be represented by a an lp-functionis(O;C) is0(O;C):is(O;C2) is0(O;C1);subclass(C1; C2)::is(O;C) not is(O;C): 9>>>>>>>>>=>>>>>>>>>; �iIn our next step we need to �nd a representation �fi�fs of the speci�cation fi �fs.For simple lp-functions like �s and �f we can directly check that this can bedone by combining the rules of �i and �s. As was shown in [23], however, this isnot always the case, i.e. there are f-speci�cations f; g represented by lp-functions

M. Gelfond, A. Gabaldon / Building a knowledge base: an example 19�f and �g such that �f [ �g does not represent f � g. The following realizationtheorem (which is a slight modi�cation of a similar theorem from [23]) is usefulfor eliminating this possibility.Theorem 10. (Realization theorem for incremental extension) Let f and g bef-speci�cations represented by lp-functions �f and �g respectively and let �f�g =�f [ �g12. A four tuple �f�g = f�f�g; �i(f � g); �o(f � g); dom(f � g)g is an lp-function representing f � g if �f and �g satisfy the following conditions:1. for any X 2 dom(�g) and any answer sets A1 and A2 of �g [X ,A1 \ lit(�o(�g)) = A2 \ lit(�o(�g))2. lit(�(�f))\ lit(�(�g)) � lit(�o(�g));3. head(�f) \ lit(�(�g)) = ;.It is easy to see that functions �i and �s de�ned above satisfy the conditions ofthe Theorem, which justi�es our construction.To continue our search for an lp-function representing the speci�cation fN weneed to �nd a representation of fd. To this goal let us consider a program �d:has(X;P ) default(D;C; P;+);is(X;C);not exceptional(X;D;+)::has(X;P ) default(D;C; P;�);is(X;C);not exceptional(X;D;�)exception(E;D1;+) default(D1; C; P;+);default(D2; E; P;�);not subclass(C;E):exception(E;D1;�) default(D1; C; P;�);default(D2; E; P;+);not subclass(C;E):exceptional(X;D; S) exception(E;D; S);is(X;E):9>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>=>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>; �d12Recall that � = �1 [�2 if �(�) = �(�1)[�(�2) and the rules of �f�g consist of rules of �f and�g. Note that this de�nition is applicable to programs with and without variables.

20 M. Gelfond, A. Gabaldon / Building a knowledge base: an exampleThe signature of this program is obtained from �fd by adding predicate con-stants exception and exceptional. The statement exception(e; d;+) reads as\the positive default d is not applicable to elements of the class e"; the statementexceptional(o; d;+) states that \the positive default d is not applicable to theobject o of the domain"; similarly for negative defaults. The program uses astandard logic programming representation of defaults and their exceptions (seefor instance [5]). We would like �d to be viewed as an lp-function whose inputand output signatures are the same as those of fd and whose domain is dom(fd),i.e., we need the following:Proposition 11. For any X 2 dom(fd), program �d [X is consistent.Proof (sketch). A program �d [ X can be viewed as a logic program � with-out classical negation in a language which contains new predicate symbols:is;:subclass;:has. This program is strati�ed [2] and has therefore a uniqueanswer set A [19]. As shown in [20], A is also the unique answer set of �d [ Xi� A doesn't contain contrary literals. Since literal l belongs to an answer setA of a program � (not containing classical negation) i� there is a rule in �whose head is l and whose body is satis�ed by A [33], we need to show thatthere are no rules r1 and r2 with the heads has(o; p);:has(o; p) whose bodies aresatis�ed by A. Suppose that there are c1 and c2 s.t. default(d1; c1; p;+) 2 A,default(d2; c2; p;�) 2 A, is(x; c1) 2 A and is(x; c2) 2 A. Since a class c and prop-erty p can be connected by at most one link, c1 6= c2. Since the net Ns is acyclic,subclass(c1; c2) 62 A or subclass(c2; c1) 62 A. Therefore, exceptional(x; d1;+) orexceptional(x; d2;�) is also in A, i.e., at least one of the rules r1, r2 has a bodywhich is not satis�ed by A.Now we can show correctness of our construction.Proposition 12. Lp-function �d represents fd, i.e., for any X 2 dom(fd),�d(X) = fd(X).Proof (Sketch). In the previous proof we showed that �d [ X has a uniqueconsistent answer set. Let us denote it by A.Since a literal l belongs to a consistent answer set A of the program i� there is arule with l in the head whose body is satis�ed by A, we have that has(o; c1) 2 A

M. Gelfond, A. Gabaldon / Building a knowledge base: an example 21i� there are literals default(d1; c1; p;+); is(o; c1) 2 A and exceptional(o; d1;+) 62A. This happens i� default(d1; c1; p;+) 2 Nd, is(o; c1) 2 X and for anydefault(d2; c2; p;�) 2 Nd, is(o; c2) 62 X or subclass(c1; c2) 2 Ns. Since X iscomplete, is(o; c2) 62 X i� :is(o; c2) 2 X and therefore, has(o; p) 2 �d(X) i�has(o; p) 2 f(X). A similar argument works for negative literals.To complete our search for a representation of fN we use the construction fromTheorem 10. It is easy to see that programs �fi�fs and �d satisfy the conditionsof the theorem and hence �fN = f�fN ; �i(fN); �o(fN ); dom(fN)g where�fN = �s [ �i [ �d (4)represents fN .Answering queriesNow we are ready for the implementation stage of our design. This stagecrucially depends on the choice of inference engine we use to answer queries to�fN . Since Prolog is the most popular logic programming language to date, webase this engine on the Prolog interpreter. To do that we must �rst replaceall occurrences of negative literals :p(t1; : : : ; tn) in �fN by np(t1; : : : ; tn). Theresulting program can be viewed as a Prolog program with variables. We consideran inference engine A de�ned as a simple meta-interpreter which takes a queryq and a program � as an input. If q is an atom, A makes two calls to the Prologinterpreter; one with parameters q and � and another with parameters nq; �.If the �rst query is answered yes, the meta-interpreter A returns yes; if yes isthe answer to the second query, A returns no; otherwise the answer is unknown.Similarly, if q is a negative literal. The meta-interpreter is de�ned for programswhich do not entail q and :q (for any query q).Proposition 13. The lp-function �fN is computable by A.Proof (Sketch). Let us start by listing the questions which need to be addressedto prove this proposition. First, it is well known that, for some programs, theProlog interpreter may produce unsound results. This may happen because of theabsence of the occur-check which, in some cases, is necessary for soundness of theSLDNF resolution, or because the interpreter may ounder, i.e. may select for

22 M. Gelfond, A. Gabaldon / Building a knowledge base: an exampleresolution a goal of the form not q where q contains an uninstantiated variable.Second, the interpreter may fail to terminate. Even if we show that for anyX 2 dom(fN) and ground query q, the interpreter which takes �fN [X and q asan input terminates, does not ounder, and does not require the occur-check, thesoundness of our result is guaranteed only with respect to the unsorted groundingof �fN , i.e. the grounding of �fN by terms of signature �u obtained from signature�(fN) by removing types and type information. In what follows we brie y discusshow these questions can be addressed.(a) We show that for any X 2 dom(�fN ) and query q 2 lit(�o(fN)) the program�fN [X [ f qg is occur-check free, i.e., the uni�cation algorithm used byProlog interpreters never selects a step requiring the occur-check. To provethis we need a notion of mode [13] { a function assigning + or � to eachparameter of a predicate symbol p from the language of program �. If theparameter in a position i of p is assigned +, then i is called an input position.Otherwise it is called an output position. In our further discussion we needthe following mode m0 of the program �fN :has(+;+):has(+;+)default(�;�;�;�)is0(�;�)is(+;+):is(+;+)subclass0(�;�)subclass(+;+):subclass(+;+)exceptional(+;+;+)exception(�;�;�)A rule r of a program � is called well-moded with respect to a mode m ifi) every variable occurring in an input position of a literal l from the bodyof r occurs either in an input position of the head or in an output positionof some literal from the body that precedes l.(ii) Every variable occurring in an output position of the head occurs in aninput position of the head, or in an output position of a literal from thebody.

M. Gelfond, A. Gabaldon / Building a knowledge base: an example 23A program � is well-moded with respect to m if all its rules are. It is notdi�cult to check that the program �fN [ X is well-moded with respect tomode m0.Apt and Pellegrini in [4] showed that if a program � is well-moded withrespect to some mode m and there is no rule in � whose head contains morethan one occurrence of the same variable in its output positions then � isoccur-check free with respect to any ground query. The mode m0 satis�esthese conditions and therefore answering query q to �fN [X does not requirethe occur-check.(b) To prove that a query q 2 lit(�o(fN )) to �fN [ X does not ounder weuse another theorem from [4,42]: if program � is well-moded with respect tosome mode assignmentm and all predicate symbols occurring in � under notare moded completely by input then a ground query to � does not ounder.Again, the modem0 satis�es this property. From (a) and (b) we can concludethat if the Prolog interpreter terminates on query q to program � then thereis an SLDNF resolution derivation of q from �.(c) The termination of �fN[X follows from [3] where the authors gave a notion ofacceptable program and proved that for such programs the Prolog interpreterterminates on ground queries. It is easy to check that �fN [X is acceptable.(d) Let gr(�; �) denote the set of all ground instantiations of � by groundterms of �. From soundness of SLDNF resolution with respect to stablemodel semantics of logic programs we can now conclude that, given a queryq 2 lit(�o(fN)) and the program �fN [X , the Prolog interpreter answers yesi� gr(�fN ; �u(fN))[X j= q. We need to show that gr(�fN ; �u(fN))[X j= qi� gr(�fN ; �(fN)) [ X j= q. In [34] McCain and Turner showed that toguarantee this property we need to check that �fN is stable and predicate-order-consistent. The notion of stability is based on the program having amode satisfying certain properties. It is easy to check that the mode m0 de-�ned above satis�es these conditions. The predicate-order-consistency of thisprogram follows immediately from the absence of function symbols and theabsence of negative edges from a predicate symbol to itself in the dependencygraph of �fN .

24 M. Gelfond, A. Gabaldon / Building a knowledge base: an example5. Opening closed domain speci�cationsIn this section we introduce another knowledge representation problem asso-ciated with is-nets and demonstrate how a speci�cation constructor, called inputopening, can be used to specify and represent this problem.Specifying the problemSo far we have assumed that net N(I) contains complete information aboutrelations default; subclass and is. In the process of development and modi�ca-tion of the system this assumption may become too strong and the speci�er maydecide to limit it to some of the relations or even to completely remove it fromthe speci�cation. In this section we will consider a case when information aboutdefaults and subclasses is still complete but information about the membershiprelation can be incomplete. Pictorially, the input to a net will be represented bypositive and negative links from objects to classes (see Fig. 1c). These links willbe recorded by literals of the form is(o; c) and :is(o; c). (Notice that here weuse is instead of is0 which was used in the previous speci�cation. This change isnot essential and is done only to simplify the presentation). Obviously, not anycollection I of such links is consistent with our interpretation of the net N . Toensure consistency I must not contain contrary literals, and the is and subclassrelations de�ned by N(I) must satisfy the constraint: is(o; c1);subclass(c1; c2);:is(o; c2): (5)Now the net N can be viewed as an informal speci�cation of the function f�Nwhich takes as an input the links of N together with I 2 lit(is) and returns allconclusions about relations subclass; is and has which a rational agent can obtainfrom N and I . (Such a function f�N will be called the open domain speci�cationof N .) The problem is to precisely de�ne the set of all such conclusions. To dothat we use the representation of N and functions fs and fd from the previoussection. Function fs remains unchanged; fd however needs to be modi�ed sincewe do not necessarily have enough information to provide it with input completewith respect to is. To modify fd the speci�er may use a speci�cation constructorcalled input opening which removes the closed world assumption from (some or

M. Gelfond, A. Gabaldon / Building a knowledge base: an example 25all) input predicates of a speci�cation. To de�ne this constructor we �rst needthe following terminology.Let D be a collection of states over some signature � and let � � pred(�).Predicates from � are called open; the other predicates from pred(�) are calledclosed. A state X of � is called an �-state if for any l 2 lit(pred(� n �)), l 2 Xor l 2 X . The set of all �-states of � will be denoted by �-states(�). A setX 2 states(�) is called D-consistent if there is X̂ 2 D s.t. X � X̂; X̂ is called aD-cover of X .For instance, in our example the only open predicate of �i(fd) will be is; D willbe the set of all possible complete inputs X to fd such that(i) [X ]subclass;default = N [Nwhere N � atoms(default; subclass) which represents the net N andN = f:l : l 2 atoms(default; subclass)^ l 62 Ng;(ii) X satis�es the constraint (5).It is easy to see that for the netN from Fig. 1c the setN[N[fis(o1; c1); is(o2; c2)gis D-consistent while N [N [ fis(o1; c1); is(o2; c2);:is(o2; c3)g is not.The set of all D-covers of a set X is denoted by c(D;X). The set of all D-consistent �-states of � is called the �-interior of D and is denoted by D�. Anf-speci�cation f de�ned on a collection of complete states of �i(f) is called closeddomain speci�cation.De�nition 14. (Input Opening) Let f be a closed domain speci�cation withdomain D and � � pred(�(f)). An f-speci�cation f� is called the input openingof f with respect to � if�i(f�) = �i(f) �o(f�) = �i(f) [ �o(f) (6)dom(f�) = D� (7)f�(X) = \X̂2c(D;X)f(X̂) [ \X̂2c(D;X) X̂ (8)

26 M. Gelfond, A. Gabaldon / Building a knowledge base: an exampleThe open domain f-speci�cation f�N of a net N can be de�ned asf�N = f�d � fs (9)As was shown in [25] the input opening f� of f can be further decomposed usingtwo simpler speci�cation constructors called interpolation and domain comple-tion. To de�ne these constructors we need the following de�nitions.De�nition 15. A set X 2 states(�) is called maximally informative w.r.t. a setD � states(�) if X is D-consistent andX = \X̂2c(D;X) X̂ (10)Consider, for instance, the net N from Fig. 1b. The setNs [Ns [ fis(o1; c1); is(o1; c3); is(o1; c5); is(o2; c2); is(o2; c3); is(o2; c5)gis maximally informative w.r.t. the set of all complete input states of N , whilethe set Ns [Ns [ fis(o1; c1); is(o2; c2)gis not.De�nition 16. (Interpolation) Let f be a closed domain f-speci�cation withdomain D and � � pred(�i(f)). By ~D we denote the set of all �-states of �i(f)which are maximally informative with respect to D. F-speci�cation ~f� with thesame signatures as f and the domain ~D is called the interpolation of f if~f�(X) = \X̂2c(D;X)f(X̂) (11)This is a slight generalization of the notion of interpolation introduced in [6],where the authors only considered interpolations of functions de�ned by generallogic programs.De�nition 17. (Domain Completion) Let D be a collection of complete statesover signature � and � � pred(�). The domain completion of D with respect to

M. Gelfond, A. Gabaldon / Building a knowledge base: an example 27� is a function ~f�D which maps D-consistent �-states of � into their maximallyinformative supersets.The following proposition follows almost immediately from the de�nitions.Proposition 18. For any closed domain f-speci�cation f with domain D,f� = ~f� � ~f�D : (12)Proof. First note that by de�nition of f� and ~f�D, X 2 dom(f�) i� X 2 D�.Let X 2 D� and Y = ~f�D(X). By de�nition of ~f�D and ~f�, Y 2 dom( ~f�).By de�nition of incremental extension ~f� � ~f�D(X) = Y [ ~f�(Y ) Moreover, byde�nition of ~f�, ~f�(Y ) = TX̂2c(D;Y ) f(X̂). Clearly, c(D; Y ) = c(D;X) andhence ~f�(Y ) = TX̂2c(D;X) f(X̂). Finally, by de�nition of domain completion,f�(X) = ~f� � ~f�D(X):From Proposition 18 and equation (9) we have that the open domain speci�cationf�N can be given by equation f�N = ~g� � ~g�D � fs (13)where g = fd, � = fisg and D = dom(fd).Realization theorems for domain completion and interpolationThe equation (13) above suggests that a representation for f�N can be con-structed from lp-functions representing ~g� and ~g�D. In the construction of thesefunctions we will be aided by realization theorems for domain completions andinterpolations.Domain CompletionLet C be a collection of constraints over signature �, � � pred(�), and Dbe a collection of complete states of � satisfying C. We will be interested in rep-resenting the domain completion of D with respect to �. Such a representationis especially simple for constraints which are binary with respect to �, i.e. con-straints whose bodies contain exactly two literals from lit(�). By the disjunctiveimage d(c) of a binary constraint

28 M. Gelfond, A. Gabaldon / Building a knowledge base: an examplec = l1; l2;� (14)where l1; l2 2 lit(�) we mean the disjunction l1 _ l2; by d(C) we denote the setof disjunctive images of constraints from C. A set C of binary constraints is saidto be inde�nite if there is no l 2 lit(�) such that d(C) j= l or d(C) j= l.Notice that the set of constraints f p; q; :p; qg (where p; q 2 �) is notinde�nite.Let ~�D be a program obtained from C by replacing each constraint l1; l2;� bythe rules l1 l2;�l2 l1;�9>>=>>; ~�DTheorem 19. (Realization Theorem for Domain Completion) Let C be a collec-tion of binary constraints over signature �, � � pred(�) andD a collection of com-plete states of � satisfying C. If C is inde�nite then a four-tuple f~�D; �; �;D�gis an lp-function which represents the domain completion ~f�D of D.In the proof of this theorem, which appears below, we use the followinglemmas.Lemma 20. Let X 2 D�. Then for any X̂ 2 c(D;X) there is a set A � X̂which is the answer set of ~�D [X .Proof. Since X 2 D� we have that c(D;X) is not empty. Let X̂ 2 c(D;X). Byde�nition of c(D;X), X̂ is complete and satis�es the constraints from C. Thisimplies that X̂ is closed under the rules of ~�D. Consider a (possibly in�nite)sequence Xi of sets of literals such that� X0 = X̂;� Xi+1 is a proper subset of Xi, which contains X and is closed under the rulesof ~�D.Let A = TXi. A contains X and is closed under the rules of ~�D. (Supposel1 l2;� is a rule from ~�D and �; l2 2 A. Then, for every i, l2;� 2 Xi. Since Xiis closed under the rules, l1 is also in Xi and hence in A). Obviously, there is no

M. Gelfond, A. Gabaldon / Building a knowledge base: an example 29smaller set of literals closed under ~�D [X , i.e. A is one of its answer sets. Sinceour program does not contain negation as failure, A is its only answer set.The following corollary follows immediately from this lemma.Corollary 21. For all X 2 D�,� ~�D [X is consistent;� ~�D(X) � TX̂2c(D;X) X̂.Lemma 22. If X 2 D�, then for every X̂ 2 c(D;X), ~�D(X̂) = X̂.Proof. By de�nition of c(D;X), X̂ is consistent. Thus to prove the lemma itonly remains to show that X̂ is closed under the rules of ~�D. Let l l0;� be anyrule in ~�D and assume that �; l0 2 X̂. By de�nition of ~�D there is a constraint l; l0;� 2 C. Hence l 62 X̂. By de�nition of D, X̂ is complete and thereforel 2 X̂.Lemma 23. For all X 2 D�, ~�D(X) � TX̂2c(D;X) X̂ .Proof. Consider an arbitrary X 2 D� and suppose that the lemma is false, i.e.,that there is a literal l such thatl 2 \X̂2c(D;X) X̂ but l 62 ~�D(X): (15)By Lemma 22 the above is equivalent to:l 2 \X̂2c(D;X) ~�D(X̂) but l 62 ~�D(X): (16)We will �rst show that, under this assumption,l 62 ~�D(X): (17)Suppose it does, i.e., l 2 ~�D(X). Then, since X 2 D�, there is X̂ 2 D containingX . Since ~�D does not contain negation as failure, we have that~�D(X) � ~�D(X̂):

30 M. Gelfond, A. Gabaldon / Building a knowledge base: an exampleThis implies that l 2 ~�D(X̂) which contradicts assumption (16). Hence (17)holds.Now we will construct a set Z 2 c(D;X) containing l. By Corollary 21, ~�D(X)is consistent. Since it contains no negation as failure it has exactly one answerset, say, A. Let C 0 = f l1; l2 : l1; l2;� 2 C;� � Ag;P1 = fli : li 2 ~�D(X) or li 2 ~�D(X)g; andP2 = lit(�) n P1:Let C1 be a collection of constraints from C 0 such that l1 or l2 is in A, and letC2 = C 0 nC1.Notice that no literal li occurring in constraints from C2 belongs to P1. (If itwere the case then we would have that li 2 A or li 2 A. The former is impossiblesince it would place the constraint containing this literal into C1. The latter isalso impossible since in this case the second literal from this constraint wouldbe falsi�ed by A, again placing it in C1). By construction, P2 is closed under:, i.e., for any li 2 lit(�) if li 2 P2 then so is li. This implies that if li belongsto a constraint of C2 then li; li 2 P2 and, therefore, interpretations of C2 can beviewed as complete and consistent sets of literals from P2. From (16) and (17)we have that l 2 P2. Since C is inde�nite so is C2 and therefore there is aninterpretation B of C2 which makes d(C2) true and l false. Now letZ = A [B:To show that Z is complete consider two cases: If li 62 lit(�) then, since X 2 D�,we have that li 2 X or li 2 X and hence either li or li is in A. Otherwise, li 2 P1or li 2 P2. If li 2 P1 then, by de�nition of P1, li 2 A or li 2 A. For li 2 P2completeness follows from the construction of B.Consistency follows from consistency of A and B and the fact that if li 2 B thenli 62 A.It is also easy to check that, by construction, Z satis�es the constraints C andhence, Z 2 c(D;X). This contradicts our assumption that l 2 TX̂2c(D;X) X̂ andtherefore the lemma holds.Proof of Theorem 19. We need to show that for all X 2 D�, ~f�D(X) = ~�D(X).By de�nition of domain completion, this is equivalent to:

M. Gelfond, A. Gabaldon / Building a knowledge base: an example 31~�D(X) = \X̂2c(D;X) X̂which follows immediately from Corollary 21 and Lemma 23.InterpolationNow we discuss a realization theorem for interpolation of f-speci�cations.Let � be a signature, � � pred(�), and D be a collection of complete �-states of�. Function f de�ned on the interior D� of D is called separable if\X̂2c(D;X)f(X̂) � f(X)or, equivalently, if for any X 2 dom(f) and any output literal l s.t. l 62 f(X)there is X̂ 2 c(D;X) s.t. l 62 f(X̂).The following propositions give simple su�cient conditions for separability whichmay help to better understand this notion.Proposition 24. Let D be the set of complete states over some signature �i,� = pred(�i), and let � be an lp-function de�ned on D� = states(�i), s.t.1. The sets of input and output predicates of � are disjoint and input literalsdo not belong to the heads of �;2. for any l 2 �i, l 62 lit(�) or l 62 lit(�). (Here by lit(�) we mean the collectionof all literals which occur in the rules of the ground instantiation of �.)Then � is separable.Proof. (Sketch). Let X 2 dom(�) and consider the setX� = X[fl : l 62 X; l 2 lit(�)g[fl : l 2 atoms(�i); :l 62 X; l 62 lit(�); :l 62 lit(�)gBy condition (2), X� is consistent. Since it is also complete by construction wehave that X� 2 dom(�). By condition (1) lit(�i) is a splitting set of programs�[X and �[X�. By the splitting set theorem and condition (1) we have that forany output literal l, l 2 �(X) i� red(�;X) j= l and l 2 �(X�) i� red(�;X�) j= l.But by construction of X� and the de�nition of red, red(�;X) = red(�;X�),hence l 2 �(X) i� l 2 �(X�) and therefore, � is separable.

32 M. Gelfond, A. Gabaldon / Building a knowledge base: an exampleThe next example shows that the last condition is essential.Example 25. Let �i be a signature consisting of object constant a and predicateconstant p, and consider D = ffp(a)g; f:p(a)gg and a function f1 de�ned on D�by the program q(a) p(a)q(a) :p(a)where �o(f1) consists of a and q. Let X = ;. Obviously, f1(X) = ; whileTX̂2c(D;X) f1(X̂) = fq(a)g and hence f1 is not separable.In some cases, to establish separability of an lp-function � it is useful to represent� as the union of its independent components and to reduce the question ofseparability of � to separability of these components. This can be done in thefollowing way:Let � be an lp-function with input signature �i and output signature �o. Weassume that the input literals of � do not belong to the heads of rules of �. We saythat � is decomposable into independent components �0; : : : ; �n if � = �0[: : :[�nand lit(�m) \ lit(�k) � lit(�i) for any k 6= m.Proposition 26. Let �0; : : : ; �n be independent components of lp-function �.Then(i) for any 0 � k � n, four-tuple f�k; �i; �o; dom(�)g is an lp-function;(ii) If �k is separable for any 0 � k � n then so is �.Proof. The proposition follows immediately from the splitting set theorem andde�nition of separability.Example 27. Consider �; � and D from Example 25 and let function f2 withthe output signature consisting of a; q1 and q2 be de�ned by a program1. q1(a) p(a)2. q2(a) :p(a)Obviously, � can be decomposed into independent components �1 and �2 consist-ing of rules (1) and (2) respectively. By Proposition 24 �1 and �2 are separable,and hence, by Proposition 26, so is �.

M. Gelfond, A. Gabaldon / Building a knowledge base: an example 33The following simple observation proves to be useful for constructing interpola-tions.Theorem 28. (Realization Theorem for Interpolation) Let f be a closed do-main speci�cation with domain D represented by an lp-function � and let ~� bethe result of replacing some occurrences of input literals l in pos(�) by not l. Iff~�; �i(f); �o(f); dom( ~f)g is a separable and monotonic lp-function then it repre-sents the interpolation ~f of f .Proof. Let ~� be a separable and monotonic lp-function. To show that it repre-sents ~f , we need to show that~�(X) = \X̂2c(D;X)�(X̂):From the separability of ~� we have one direction, namely that:\X̂2c(D;X)�(X̂) � ~�(X):By monotonicity, if X � X̂, then ~�(X) � ~�(X̂). Hence,~�(X) � \X̂2c(D;X) ~�(X̂):Clearly, for any complete set X̂, ~�(X̂) = �(X̂). Therefore,~�(X) � \X̂2c(D;X)�(X̂):Corollary 29. Let f , � and ~� be as in Theorem 28. If ~� = f~�; �i(f); �o(f); dom( ~f)gis a separable lp-function with a signing S such that S \ (lit(�i) [ lit(�o)) = ;then it represents the interpolation ~f of f .The corollary follows immediately from Theorems 7 and 28.The declarative representation of open netsIn this section we will go back to the task of building a computable lp-function �� representing the open domain speci�cation f�N . Recall that f�N is

34 M. Gelfond, A. Gabaldon / Building a knowledge base: an examplede�ned via incremental extension and three f-speci�cations: ~g�, ~g�D and fs whereg = fd and � = fisg (13). We start with �nding a representation ~� of ~g�.Theorem 28 will provide an important heuristic guidance for this construction.In particular, we will look for a transformation from this theorem which will turnthe lp-function � (page 19) representing g into a monotonic lp-function. The onlytransformation achieving this goal is that of replacing the rule de�ning predicateexceptional in � by the ruleexceptional(X;D; S) exception(E;D; S);not :is(X;E): (18)Let us denote the resulting program by ~� and use Corollary 29 to prove thefollowing proposition.Proposition 30. ~� represents ~g�.Proof. (Sketch). We need to show that ~� is an lp-function and that it is separableand monotonic.1. (Consistency). Let D be the domain of g = fd and ~D be the domain of ~g.(Recall that dom(g) consists of complete states of �i(g) which satisfy the con-straints (5) and dom(~g) is the set of all fisg-states of �i(g) which are maximallyinformative with respect to D). Let X 2 dom(~�). To show that �0 = ~� [ X isconsistent we use an argument similar to that which we used to prove consistencyof � [X in Proposition 11. We use renaming to reduce ~� to a program without:; use its strati�ability to entail existence of a unique answer set and show thatthis answer set is consistent.2. (Separability). Let X 2 ~D and consider an output literal l 62 ~�(X). Let us�rst assume that l = has(x; p). We need to construct a cover X̂ of X such thatl 62 ~�(X̂). We say that a class e is p-negative if there is a negative link from e top in N ; a p-negative class e can defeat has(x; p) if :is(x; e) 62 X . Let E0 be theset of all classes which can defeat has(x; p) and considerE = E0 [ fc : 9 e (e 2 E0 and subclass(e; c) 2 N)g;U = X [ fis(x; e) : e 2 Eg; andX̂ = U [ f:is(o; c) : is(o; c) 62 Ug:We show that

M. Gelfond, A. Gabaldon / Building a knowledge base: an example 35(a) X̂ is a cover of X ;(b) l 62 ~�(X̂).(a) By construction, X̂ is complete and consistent. We need to show that itsatis�es the constraints (5).Consider arbitrary o, c1 and c2 such that subclass(c1; c2) 2 N and is(o; c1) 2 X̂ .First let us consider the case when is(o; c1) 2 X . Then any cover of X mustcontain is(o; c2). Since X is maximally informative, is(o; c2) 2 X , and hence byconsistency of X̂ the constraints (5) are satis�ed. Suppose now that is(o; c1) 62 X .If o is not x, then :is(o; c1) 2 X̂ and constraints (5) are satis�ed by consistencyof X̂. If o is x, then c1; c2 2 E and, by construction, is(x; c2) 2 X̂. Consistencyof X̂ again guarantees that constraints (5) are satis�ed.(b) Since X̂ is complete and consistent and lit(is) is a splitting set of ~�, we havethat red(�; X̂) = red(~�; X̂) and hence � [ X̂ is consistent i� ~� [ X̂ is consistent.Consistency of � [ X̂ was established before and hence ~� [ X̂ is also consistentand has a consistent answer set S. As shown in [33], has(x; p) 2 S i� there isclass c such that default(d; c; p;+) 2 N , is(x; c) 2 X̂ , exceptional(x; d;+) 62 S.Let c satisfy this condition and consider two cases:(i) is(x; c) 2 X .Then, since l 62 ~�(X), we have that for every class e such that exception(e; d;+) 2S, :is(x; e) 62 X . By construction of X̂ this implies that :is(x; e) 62 S,exceptional(x; d;+) 2 S, and therefore has(x; p) 62 ~�(X̂).(ii) is(x; c) 62 X .Then is(x; c) 2 U . By construction of U we have that there is a class e such thatdefault(d2; e; p;�) 2 N , :is(x; e) 62 X and either e = c or subclass(e; c) 2 N . Byconstruction we have that is(x; e) 2 U . Since our graph is acyclic, we have thatexception(e; d;+) 2 S, exceptional(x; d;+) 2 S and therefore has(x; p) 62 ~�(X̂).A similar argument works for l = :has(x; p).3. (Monotonicity). Let X1; X2 2 dom(~�) and X1 � X2. To show that(i) ~�(X1) � ~�(X2)we �rst use the splitting set theorem to eliminate from �1 = ~�[X1 and �2 = ~�[X2all the occurrences of literals from lit(default). Since X1 and X2 are is-states of�i we have that [X1]fdefaultg = [X2]fdefaultg and hence

36 M. Gelfond, A. Gabaldon / Building a knowledge base: an example(ii) top(�1; lit(default)) = top(�2; lit(default)).Let us denote this program by �0. By the splitting set theorem(iii) �0(X) = ~�(X)for any X 2 dom(~�).Now observe that the set S = atoms(fexception; exceptional)g is a signing for �0and that S\(lit(�i(�)[lit(�o(�))) = ;. The monotonicity condition follows from(iii) and Theorem 7 and the conclusion of our proposition becomes an immediateconsequence of Theorem 28.To complete the construction of representation �� of f�N we need to �nd a repre-sentation ~�D of the domain completion of D = dom(g) with respect to � = fisg.Recall that D is the collection of complete states of �i(g) satisfying constraints(5). These constraints are binary with respect to �. It is also easy to see thatthey are inde�nite and hence we can use the construction from Theorem 19. Thecorresponding program ~�D consists of the rulesis(O;C2) is(O;C1); subclass(C1; C2) (19):is(O;C1) :is(O;C2); subclass(C1; C2) (20)Proposition 31. ~�D represents ~g�D.Proof. Follows immediately from Theorem 19.Finally we can show thatProposition 32. �� = ~� [ ~�D [ �s represents f�N .Proof. Follows immediately from the equation (13), Propositions 30, 31, Theo-rem 10, and the fact that ~�, ~�D and �s have unique answer sets.As in the case of closed nets, Proposition 32 shows the correctness of �� w.r.t.our speci�cation if �� is viewed as a declarative program. However, due to theleft recursion in rules (19) and (20), �� is not computable with respect to our

M. Gelfond, A. Gabaldon / Building a knowledge base: an example 37interpreter A. To achieve computability we need to change the order of literalsin the bodies of these rules. The resulting program �� will look as follows:has(X;P ) default(D;C; P;+);is(X;C);not exceptional(X;D;+)::has(X;P ) default(D;C; P;�);is(X;C);not exceptional(X;D;�)exception(E;D1;+) default(D1; C; P;+);default(D2; E; P;�);not subclass(C;E):exception(E;D1;�) default(D1; C; P;�);default(D2; E; P;+);not subclass(C;E):exceptional(X;D; S) exception(E;D; S);not :is(X;E):is(O;C2) subclass(C1; C2);is(O;C1)::is(O;C1) subclass(C1; C2);:is(O;C2):subclass(C1; C2) subclass0(C1; C2):subclass(C1; C2) subclass0(C1; C3);subclass(C3; C2)::subclass(C1; C2) not subclass(C1; C2):

9>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>=>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>;��

Its computability can be shown by an argument similar to that in Proposition 13.Notice that if we were to use an inference engine based on XSB which includesa form of loop checking, no changes in the rules (19) and (20) would be needed.6. A simple generalizationIn this section we generalize the knowledge representation problem asso-ciated with a net N by allowing strict (non-defeasible) links from objects to

38 M. Gelfond, A. Gabaldon / Building a knowledge base: an examplepd1

d2

o o

c co

c c

c

1

1

2

23

3 4

5

Figure 2. Hierarchy with links from objects to propertiesproperties to belong to the net's input (see Fig. 2). We show that this general-ization can be easily incorporated into the design. To do that we use anotherspeci�cation constructor from [24], called input extension.De�nition 33. Let f be a functional speci�cation with disjoint sets of input andoutput predicates. An f-speci�cation f� with input signature �i(f) + �o(f) andoutput signature �o(f) is called input extension of f if1. f� is de�ned on elements of dom(f) possibly expanded by consistent sets ofliterals from �o(f),2. for every X 2 dom(f), f�(X) = f(X),3. for any Y 2 dom(f�) and any l 2 lit(�o(f)),(i) if l 2 Y then l 2 f�(Y )(ii) if l 62 Y and l 62 Y then l 2 f�(Y ) i� l 2 f(Y \ lit(�i(f)).A new problem associated with a net N can be de�ned by f-speci�cationf� = g� � ~g�D � fs (21)where g� is the input extension of ~g�.To �nd an lp-function representing g� we will use the following transformationfrom [24].

M. Gelfond, A. Gabaldon / Building a knowledge base: an example 39De�nition 34. Let � be an lp-function. The result of replacing every rulel0 l1; : : : ; lm; not lm+1; : : : ; not lnof � with l0 2 lit(��(f)) by the rulel0 l1; : : : ; lm; not lm+1; : : : ; not ln; not l0is called the guarded version of � and is denoted by �̂.The following theorem is useful for constructing lp-functions representing inputextensions.Theorem 35 (Realization Theorem for Input Extension [24]). Let f be a speci�-cation represented by lp-function � with signature �. If the set U = lit(�)nlit(��)is a splitting set of � dividing � into two components �2 = top(�; U) and�1 = base(�; U), then lp-function �� = �1 [ �̂2 represents the input extension f�of f .The representation �� of input extension g� of ~g� is obtained by replacing thehas rules in �� (page 37) byhas(x; p) default(d; c; p;+);is(x; c);not exceptional(x; d;+);not :has(x; p)::has(x; p) default(d; c; p;�);is(x; c);not exceptional(x; d;�)not has(x; p): 9>>>>>>>>>>>>>>=>>>>>>>>>>>>>>;The following proposition follows immediately from equation (21), the construc-tion of ��, and Theorems 35 and 10.Proposition 36.i) �� represents g�;ii) �� [ ~�D [ �s represents f�.

40 M. Gelfond, A. Gabaldon / Building a knowledge base: an exampleThis example again demonstrates that speci�cation constructors and their real-ization theorems provided a useful heuristic guidance for specifying knowledgerepresentation problems and for building program provenly satisfying these spec-i�cations.7. ConclusionsIn this paper we discussed a systematic methodolgy of solving certain typesof knowledge representation problems in logic programming. The methodologywas illustrated by a detailed development of solutions of several knowledge rep-resentation problems associated with simple taxonomic hierarchies. In each casewe started with a functional speci�cation of a problem constructed from speci�-cations of simpler problems with the help of speci�cation constructors, and usedvarious realization theorems to guide the process of representing these speci�-cations by declarative programs of A-Prolog. We also demonstrated how theseprograms can be transformed into executable programs of Prolog and XSB. Thepaper also contains previously unpublished proofs of several realization theorems.Even though the formalization of inheritance reasoning was extensively studied inthe AI literature [17,22,27,41,26,14,15,47], the emphasis on precise speci�cationsof the problems allowed us to come up with a clearer picture of dependences ofvarious types of inheritance reasoning on the closed and open world assumptionsabout the problem domain and on the type of the allowed updates. In particular,we addressed the question of reasoning in open nets, which, to the best of ourknowledge, was never investigated before. We are currently working on studyingthe applicability of our approach to more general forms of inheritance, to reason-ing about actions and change, and to several other domains. The results so farseem to be rather promising.AcknowledgmentsMany people contributed to the development of ideas presented in this paperand we cannot name all of them here. We would like to mention however ourcollaborators who directly contributed to this approach - H. Przymusinska, C.Baral, and O. Kosheleva. Our thanks to them and to all the others. The authorsare grateful to the anonymous referees for their comments and suggestions for

M. Gelfond, A. Gabaldon / Building a knowledge base: an example 41improving the paper. The �rst author acknowledges the support of NASA undergrant NCCW-0089.References[1] J.J. Alferes and L.M. Pereira. Reasoning with Logic Programming, Lecture Notes in Arti-�cial Intelligence. Springer. 1996.[2] K. Apt, H. Blair, and A. Walker. Towards a theory of declarative knowledge. In Minker,J., ed., Foundations of Deductive Databases and Logic Programming, Morgan Kaufmann,San Mateo, CA, pp. 89{148, 1988.[3] K. Apt and D. Pedreschi. Proving termination in general Prolog programs. Proc. of theInt'l Conf. on Theoretical Aspects of Computer Software LNCS 526, Springer Verlag, pages265-289, 1991.[4] K. Apt and A. Pellegrini. On the Occur-check Free Logic Programs. ACM Transaction onProgramming Languages and Systems, 16,3: 687-726, 1994.[5] C. Baral and M. Gelfond. Logic programming and knowledge representation. Journal ofLogic Programming, 12:1{80, 1994.[6] C. Baral, M. Gelfond, and O. Kosheleva. Expanding queries to incomplete databases byinterpolating general logic programs. Journal of Logic Programming, 35:195{230, 1998.[7] N. Bidoit and C. Froidevaux. Minimalism subsumes default logic and circumscription. InProc. of LICS-87,pages 89{97, 1987.[8] D. Chan. Constructive Negation Based on the Completed Databases. In Proc. Fifth Inter-national Conference and Symposium on Logic Programming, pp. 111{125, 1988.[9] W. Chen. Extending Prolog with Nonmonotonic Reasoning. Journal of Logic Programming,27,2:169{183, 1996.[10] W. Chen, T. Swift and D. Warren. E�cient top-down computation of queries under thewell-founded semantics. Journal of Logic Programming, 24,3:161{201, 1995.[11] K. Clark. Negation as failure. In H. Gallaire and J. Minker, eds., Logic and Data Bases,pp. 293{322. Plenum Press, NY, 1978.[12] Y. Deville. Logic Programming: systematic program development, Clark, K., series editor,Addison-Wesley Publishing Co., 1990.[13] P. Dembinski and J. Maluszynski. AND-parallelism with intelligent backtracking for anno-tated logic programs. In V. Saraswat and K. Ueda, editors, Logic Programming: Proc. ofthe International Symposium on Logic Programming, pages 25{38,1985.[14] P.M. Dung, and T.C. Son. Nonmonotonic inheritance , argumentation, and logic program-ming. In Proceedings of LPNMR, pages 316{329, 1995.[15] P.M. Dung, and T.C. Son. An argumentation-theoretic approach to reasoning with speci-�city. In Proceedings of KR'96, pages 407{418, 1996.[16] T. Eiter,N. Leone, C, Mateis,G, Pfeifer, and F. Scarcello. A deductive system for non-monotonic reasoning. In Proc. 4th LPNMR, pp. 363{374, 1997, Springer LN in ComputerScience 1265

42 M. Gelfond, A. Gabaldon / Building a knowledge base: an example[17] D. Etherington and R. Reiter. On inheritance hierarchies with exceptions. In Proceedingsof AAAI-83, pages 104{108, 1983.[18] Fran�cois Fages. Consistency of Clark's completion and existence of stable models. Journalof Methods of Logic in Computer Science, 1(1):51{60, 1994.[19] M. Gelfond and V. Lifschitz. The stable model semantics for logic programming. InRobert Kowalski and Kenneth Bowen, editors, Logic Programming: Proc. of the Fifth Int'lConf. and Symp., pages 1070{1080, 1988.[20] M. Gelfond and V. Lifschitz. Logic programs with classical negation. In David Warren andPeter Szeredi, editors, Logic Programming: Proc. of the Seventh Int'l Conf., pages 579{597,1990.[21] M. Gelfond and V. Lifschitz. Classical negation in logic programs and disjunctive databases.New Generation Computing, 9:365-385, 1991.[22] Formalization of Inheritance Reasoning in autoepistemic logic. Fundamenta Informaticae,vol. XIII, pages 403{445, 1990.[23] M. Gelfond and H. Przymusinska. On consistency and completeness of autoepistemictheories. Fundamenta Informaticae, 16(1):59{92, 1992.[24] M. Gelfond and H. Przymusinska. Towards a theory of elaboration tolerance: logic pro-gramming approach. Int'l Journal of Software Engineering and Knowledge Engineering,6(1):89-112, 1996.[25] M. Gelfond and A. Gabaldon. From functional speci�cations to logic programs. InJ. Maluszynski, editor, Logic Programming: Proc. of the 1997 Int'l Symposium., pages355{371, 1997.[26] J.F. Horty. Some direct theories of non-monotonic inheritance. In D. Gabbay, C. Hogger andJ.A. Robinson, editors, Handbook of Logic in Arti�cial Intelligence and Logic Programming,1994.[27] J.F. Horty, R.H. Thomason and D.S. Touretzky. A skeptical theory of inheritance innonmonotonic semantic networks. Arti�cial Intelligence, 42(2{3):311{348, 1990.[28] K. Kunen. Signed data dependencies in logic programs. Journal of Logic Programming,7(3):231-245, 1989.[29] V. Lifschitz. Restricted Monotonicity. In Proc. of AAAI-93, pp. 432{437, 1993.[30] V. Lifschitz. Foundations of logic programming. In Gerhard Brewka, editor, Principles ofKnowledge Representation, pages 69{128. CSLI Publications, 1996.[31] V. Lifschitz and H. Turner. Splitting a Logic Program. In P. Van Hentenryck, editor, Proc.11th ICLP, pp. 23{38, 1994.[32] F. Lin. A study of nonmonotonic reasoning, Ph.D. Thesis, Stanford U., 1991.[33] W. Marek and V.S. Subrahmanian. The relationship between logic program semantics andnon{monotonic reasoning. In Georgio Levi and Maurizio Martelli, editors, Proc. of theSixth Int'l Conf. on Logic Programming, pages 600{617, 1989.[34] N. McCain and H Turner. Language Independence and Language Tolerance in Logic Pro-grams. In Proc. of the Eleventh Intl. Conference on Logic Programming, pages 38-57, 1994.[35] P. Cholewinski,W. Marek and M. Truszczynski. Default reasoning system DeReS, InProc. of KR-96,pages 518-528, 1996.

M. Gelfond, A. Gabaldon / Building a knowledge base: an example 43[36] L. Niemela and P. Simons. E�cient implementation of the well-founded and stable modelsemantics, In Proc. of JICSLP-96, MIT press, 1996.[37] L. ereira and J. Alferes. Well-founded semantics for logic programs with explicit negation.In Proc. of the Tenth European Conference on Arti�cial Intelligence, pages 102{106, 1992.[38] T. Przymusinki. On constructive negation in logic programming. In Proc. of the NorthAmerican Conference of Logic Programming, pp. 16-20, 1989.[39] R. Reiter. On closed world data bases. In H. Gallaire and J. Minker, eds., Logic and DataBases, Plenum Press, NY, pp. 119{140, 1978.[40] R. Reiter. A Logic for Default Reasoning. Arti�cial Intelligence, 13(1,2):81{132.[41] L.A. Stein. Resolving ambiguity in non-monotonic inheritance hierarchies. Arti�cial Intel-ligence, 55(2{3):259{310, 1992.[42] K. Stroetmann. A completeness result for SLDNF-resolution. Journal of Logic Program-ming, 15(4):337{355, 1993.[43] D. Touretzky. The mathematics of inheritance systems. Morgan Koufmann, Los Altos,CA, 1986.[44] H. Turner. A monotonicity theorem for extended logic programs. In D. S. Warren, ed.,Proc. 10th ICLP, pp. 567{585, 1993.[45] H. Turner. Signed Logic Programs. In Bruynooghe, M., ed., Proc. ILPS, pp. 61{75, 1994.[46] A. Van Gelder, K. Ross, and J. Schlipf. The well-founded semantics for general logicprograms. Journal of ACM, 38(3):620{650, 1991.[47] X. Wang, J.H. You and L.Y. Yuan. A default interpretation of defeasible network. InProceedings of the 15th International Joint Conference on Arti�cial Intelligence (IJCAI-97), pages 156{161, 1997.