Using a back-up semantics for revising and updating nonmonotonic databases Report 96-57 Cees Witteveen Wiebe van der Hoek Technische Universiteit Delft Delft University of Technology Faculteit der Technische Wiskunde en Informatica Faculty of Technical Mathematics and Informatics ISSN 0922-5641 Copyright c 1996 by the Faculty of Technical Mathematics and Informatics , Delft , The Netherlands . No part of this Journal may be reproduced in any form , by print , photoprint , microfilm , or any other means without permission from the Faculty of Technical Mathematics and Informatics , Delft University of Technology , The Netherlands . Copies of these reports may be obtained from the bureau of the Faculty of Technical Mathematics and Informatics , Julianalaan 132 , 2628 BL Delft , phone +31152784568 . A selection of these reports is available in PostScript form at the Faculty 's anonymous ftp-site . They are located in the directory / pub/publications/tech-reports at ftp.twi.tudelft.nl Using a Back-up Semantics for Revising and Updating Nonmonotonic Databases Cees Witteveen Delft University of Technology Department of Mathematics and Computer Science , P.O.Box 356 , 2600 AJ Delft , The Netherlands . witt@cs.tudelft.nl Wiebe van der Hoek Utrecht University , Department of Computer Science , PO Box 80089 , 3508 TB Utrecht , The Netherlands . wiebe@cs.ruu.nl Abstract We introduce a novel approach to revision and updating where two semantics are used for the same class of databases . One semantics , the intended semantics , is used to give a database its intended meaning , while the other , the back-up semantics , is used as a fall back whenever the intended semantics fails to provide a meaning to the database . Almost nothing will be assumed about the exact properties of both the intended and the back-up semantics , except for the following relations between them : -LRB- i -RRB- the entailment relation based on the intended semantics is stronger than the entailment relation based on the back-up semantics and -LRB- ii -RRB- the back-up semantics is defined for a broader class of databases than the intended semantics . If , for some database D , the intended semantics is not defined , revision of the database is asked for . Like in the framework of classical database revision and updating , we apply revision by transforming the current database D to another database D0 , such that the intended semantics is defined for D0 . In that case , the backup semantics is used to guarantee that as far as this latter semantics concerns , there occurs no loss in inferential power in transforming D to D0 . Using this framework we develop some fairly intuitive postulates for -LRB- nonmonotonic -RRB- database revision and updating . Together with some well-known abstract properties of entailment relations we then investigate which theory transformations are suitable for doing revision and updating of -LRB- nonmonotonic -RRB- databases . The main conclusions of this paper are : 1 . In general , for database revision , revision by retraction is not suitable and , in less , but still many , cases , minimal revision can only be achieved by applying revision by expansion . 2 . When dealing with updating , revision by retraction is not suitable for most nonmonotonic interpretations of databases . Even for nontrivial deletions , retracting information will not suffice if the back-up semantics is strong enough , i.e. satisfies some additional abstract properties . We conclude by showing that this framework offers a possibility for refining some existing approaches to revision of nonmonotonic databases . 1 Introduction and Motivation Updating databases as conceived by e.g. -LSB- 6 , 4 -RSB- is essentially inconsistency driven . Its main objective is to maintain a consistent database if some new information f has to be included even if this new information is inconsistent with the current database D . The basic idea behind updating is simple : we include the new piece of information into a smaller database that is consistent with the new information . This means that some information has to be retracted from the old database in order to restore consistency . From a more general point of view , the result of an update then is described by a transformation R -LRB- D + f -RRB- of the -LRB- possibly inconsistent -RRB- database D + f in such a way that -LRB- assuming f to be satisfiable -RRB- R -LRB- D + f -RRB- is always consistent and contains f . In other words , the intended meaning of the possibly inconsistent database D + f is derived from the meaning of its transformation R -LRB- D + f -RRB- . In the literature , these ideas mainly have been applied to classical databases , i.e. databases represented by a classical theory T . In this paper we look into nonmonotonic databases , i.e. databases represented by a theory that is interpreted by a nonmonotonic semantics , and the special problems of updating them . To avoid cumbersome wording , in the following sections we will make no distinction between a theory T describing a database D and the database D itself . Nonmonotonic databases Nonmonotonic interpretations are used if classical reasoning is too weak , for example if the database represents incomplete or uncertain knowledge . In such cases a nonmonotonic semantics gives rise to the selection of certain acceptable or preferred models of the theory instead of considering the total class of ordinary -LRB- classical -RRB- models of the theory . Using a smaller set of models means that more conclusions can be obtained from the theory than can be obtained by classical reasoning . While nonmonotonic reasoning often extends some standard form of reasoning , it also has a drawback in the sense that these more informative reasoning methods are not always defined for every set of premises . Indeed , there are several well - known examples of nonmonotonic reasoning systems where the stronger the reasoning system is , the more restrictions it imposes on the theories for which it can be used1 . If a theory T is such that according to some semantics S , T can not be used to draw acceptable conclusions , we say that T is S-inconsistent , else we say that T is S - consistent . Note that it very well may be the case that T is S-inconsistent for some semantics S but S0-consistent according to another , perhaps weaker , semantics S0 . If S is our intended semantics and T is S-inconsistent , it is our intention to make as much sense of it as is possible . This seems only to be possible if we are prepared to change T in such a way that the intended semantics S can be used to interpret the changed theory . The problem we are confronted with here , closely resembles the problem of theory revision for classical theories : there we are forced to revise our interpretation of a theory T if T turns out to be classically inconsistent . The solution chosen in classical theory revision consists of -LRB- i -RRB- transforming the theory T in a minimal way to a consistent theory T and then -LRB- ii -RRB- using the classical meaning of T to derive a meaning for T . In classical theory revision , the requirement of restoring consistency in a minimal way does not leave much room in determining the way T will be adapted : the only sensible way is to narrow T down to T by retracting some information from T . So all transformations are retractions . Revision and updates in nonmonotonic databases The picture in revising nonmonotonic databases , however , is not so clear . First of all , it might be very well the case that the theory T representing such a database is inconsistent w.r.t. a given semantics S , but consistent with respect to another semantics S0 . So it is not a priori clear that revision by retraction is the only way to restore S-consistency . This has already been noticed by -LSB- 2 , 9 -RSB- . Later on , some revision by expansion approaches 1For example , compare the notions of minimal , weak and Reiter extensions in default logic , the semantics for auto-epistemic logic based on different notions of groundedness and the various semantics for logic programming with negation . have been advocated by , among others , -LSB- 10 -RSB- and the authors -LSB- 11 -RSB- . In a recent paper by -LSB- 5 -RSB- a mixed approach is proposed , where both retractions and expansions can be used to restore S-consistency for a given -LRB- nonmonotonic -RRB- theory T . Secondly , in nonmonotonic theory revision there is no clear idea about what should constitute a minimal change of the current theory , i.e. what should be done to keep as much information from the original theory as is possible . Again , in classical revision this problem is comparatively easy : roughly speaking , we look for a maximal consistent theory contained in T to reduce the information loss . That is , the same semantics as is used to give T its intended meaning is used as a yardstick to measure the amount of information that has to be given up . Note that here we can only use a syntactical criterion to measure the information loss , since that is the only way to compare several retractions . In using a nonmonotonic semantics S , we also want to minimize the loss of information . But here we often also have semantical criteria to minimize the information loss . For , suppose there exists some other , somehow related but weaker , semantics S0 such that T is S-consistent . This weaker semantics then may be used to provide a yardstick to measure and restrict the information loss in changing T . The advantage is that this second back-up semantics S0 may constitute a kind of lower bound on the conclusions obtainable from T that in any case we would like to keep in the revised theory . Goal of the paper Using this back-up semantics as a yardstick , we propose some rationality postulates for revision and updates in nonmonotonic theories . These rationality postulates will be used , together with some abstract properties of the entailment relations involved , to provide a -LRB- partial -RRB- characterization of suitable theory transformations . In particular , we would like to point out some -LRB- dis -RRB- similarities between revision of classical and revision of nonmonotonic theories . The idea of using a twin semantics constitutes a significant generalization of our earlier attempts -LRB- see -LSB- 11 , 12 -RSB- -RRB- to provide rationality postulates for nonmonotonic theory revision and to look for properties of nonmonotonic semantics that would characterize revision methods like revision by expansion . In these papers , the framework was restricted to using classical reasoning as the only form of back-up semantics In this paper , we will assume very little about the properties of the back-up semantics and the intended semantics ; they are only related by assuming that the entailment relation based on the intended semantics extends the entailment relation based on the back-up semantics . Overview of the paper First , we will give an overview of the framework . Then we will discuss some necessary abstract properties of entailment relations . We show which properties both the intended and back-up semantics have to satisfy in order to guarantee that revision by retraction can not be applied successfully . We prove that for minimal revision , revision by expansion requires a cumulative and reflexive back-up semantics . This shows that there may be room for the mixed revision proposal such as proposed by Inoue and Sakama -LRB- -LSB- 5 -RSB- -RRB- . To show the generality of the framework proposed , we also apply it to updating in nonmonotonic theories and prove similar results . 2 Preliminaries Let L be a -LRB- nonempty -RRB- language . An inference relation j ? : 2L ! L is a relation between a set of propositions A and a proposition f . We will often extend it in a natural way to a relation between two sets of propositions . Since we want to deal with nonmonotonic inference relations , we will first look upon these inference relations from a liberal point of view : Given an inferential system -LRB- L ; j ? -RRB- , A j ? f means that there is some extension of the system in which the conclusion f can be inferred from the set of premises A . We do not need to be very precise here . A j ? f simply means that there is some set E that is somehow related with A and that sanctions us to conclude f . Such a set E may be thought of as some set of models of A , or a belief set for A or some extension E for A as in , for example default logic or auto-epistemic logic . In the limiting case that j ? is based on classical reasoning , A j ? f means that A j = f. Thus , in this setting , the ` belief set ' E associated with the set of formulas A is just Cn -LRB- A -RRB- , the set of classical consequences of A. Generalizing this observation , we note that in many real nonmonotonic logics , j ? is not defined for every set of propositions A. To denote that for a given set A , there is at least one j ? - extension , we will use A j ? > . Then A 6j ? > denotes that there are no j ? - extensions for A , i.e. reasoning collapses for A. So , for default logic A 6j ? > means that there exists no extension E for A. Note that for every set of premises A , A j ? > holds if j ? is based on classical reasoning . Besides the liberal view , we will also deal with the skeptical perspective : A skeptical inferential system is a pair -LRB- L ; j?sk -RRB- . Here A j?sk f holds if for all possible extensions which determine an inference relation j ? , the relation A j ? f holds . So , if j ? is classical , j?sk equals j = and if j ? is based on a default semantics A j?sk f just means that f is true in every extension of A . There is a simple connection between a statement f true in an extension and f being true in every extension : A j ? > ; A j?sk f implies A j ? f A theory T is an arbitrary , not necessarily closed , set of formulas over L . We will denote a class of theories by T . A theory transformation is a function R : T ! T associating a theory T with its transformation R -LRB- T -RRB- . Let -LRB- k ? , j ? -RRB- be a pair of entailment relations . We call R = -LRB- T ; k ? ; j ? -RRB- a twin semantics and we say that S is supra-inferential if it satisfies the following condition : Supra : For all T 2 T , T k?sk f implies T j?sk f . This means that j?sk is at least as strong as k?sk or is supra-inferential2 with respect to k ? for all elements of T . We say that S is a consistency preserving twin semantics if it satisfies the following condition : 2In a previous paper we have discussed the case where the back-up semantics was restricted to the classical semantics . In these papers , Supra was restricted to supraclassicality which not always is desirable . Cons : For all T 2 T , T k ? > implies T j ? > . i.e. if there exists a k ? - extension for T , then T also has a j ? - extension . Remark . Our framework superficially resembles the inferential frames discussed in -LSB- 3 -RSB- . Apart from a different motivation , another difference is that we do not require our backup entailment relation to be deductive , i.e. it does not have to satisfy idempotence , monotony and compactness . It is not difficult to come up with examples of twin semantics for which Supra holds ; it is , however , more difficult to come up with examples of twin semantics for which both Supra and Cons hold . In case R = -LRB- T ; k ? ; j ? -RRB- satisfies Supra but does not satisfy Cons , there is a possibility for revision : it might occur that for some theory T , no extension can be found under the intended semantics while the back-up semantics is defined for T . In that case3 we would propose to transform T to a theory R -LRB- T -RRB- such that R -LRB- T -RRB- has an j ? - extension , i.e. , R -LRB- T -RRB- j ? > . The back-up semantics then is used to guide the revision process by determining which transformations R are allowed . Given a twin semantics -LRB- T ; k ? ; j?sk -RRB- and a revision operator R on T , we call the tuple -LRB- T ; k ? ; j ? ; R -RRB- a revision framework . We will now investigate which properties such a theory transformation R in a revision framework should satisfy . 2.1 Postulates for belief revision We propose the following postulates for a revision framework -LRB- T ; k ? ; j ? ; R -RRB- : P1 . R -LRB- T -RRB- j ? > if T k ? > . P2 . R -LRB- T -RRB- = T if T j ? > . P3 . R -LRB- T -RRB- k?sk f iff T k?sk f. 3In fact , we will only deal with the case that the backup semantics is defined for the theory . Postulate P1 formalizes success of the revision operator R : if there is some extension in the back-up semantics for a theory T -LRB- i.e , if in this back-up semantics , one can attach a meaning to T -RRB- this postulates guarantees that one can also associate at least one extension in the intended semantics with the revised theory R -LRB- T -RRB- . The second postulate , P2 , guarantees that revisions are done in a liberal way : a revision only leads to changing the theory T if necessary , i.e , if one is unable to assign T a meaning under the intended semantics . Finally , postulate P3 requires that a revision of a theory T should be neutral with respect to the back-up semantics : i.e , a skeptical reasoner using the back-up semantics should be unable to note any difference between T and R -LRB- T -RRB- . Note that this postulate does not require T and R -LRB- T -RRB- to be completely indistinguishable w.r.t. the back-up semantics : it may still be the case that T k ? f , while R -LRB- T -RRB- does not have any extension in which f is true . The intention of a belief revision framework is to characterize theory transformations that are both intuitively acceptable and successful : Definition 2.1 We say that a revision framework R = -LRB- T ; j ? ; k ? ; R -RRB- is successful if for every T 2 T such that T k ? > , R -LRB- T -RRB- satisfies the postulates P1 , P2 and P3 . Remark . Note that such a revision framework R = -LRB- T ; j ? ; k ? ; R -RRB- generates a new twin semantics -LRB- T ; k ? ; j ?? -RRB- where for every T 2 T , T j ?? f iff R -LRB- T -RRB- j ? f . It is clear that if -LRB- T ; j ? ; k ? -RRB- satisfies Supra and R is successful , then -LRB- T ; k ? ; j ?? -RRB- will satisfy both Supra and Cons . To show that the back-up semantics always constitutes a lower bound for the revised entailment relation , we have the following simple result : Observation 2.2 Let -LRB- T ; j ? ; k ? -RRB- be a twin semantics satisfying Supra . Let R = -LRB- T ; k ? ; j ? ; R -RRB- be the corresponding revision framework . Then , for all T 2 T , if T k ? > , T k?sk f and R satisfies the postulates , it follows that 1 . R -LRB- T -RRB- j ? > , i.e. R -LRB- T -RRB- has at least one j ? - extension . 2 . R -LRB- T -RRB- j?sk f , i.e. f is true in every j ? - extension of R -LRB- T -RRB- . PROOF Since T k?sk f , by postulate P3 , it follows that R -LRB- T -RRB- k?sk f. By Supra , it follows that R -LRB- T -RRB- j?sk f . Since T k ? > , by postulate P1 we have R -LRB- T -RRB- j ? > . 2.2 Abstract Properties of entailment relations We will use the framework developed together with the -LRB- rationality -RRB- postulates to investigate which properties a transformation function should satisfy in order to make the revision framework successful . We want to have these results as general as possible . Therefore , we will rely on some general abstract properties of the entailment relations based on both the intended and the back-up semantics . Except for some well-known properties , we will also introduce some new properties based on liberal entailment relations . In -LSB- 7 -RSB- some general properties of inference relations have been investigated . In these and other studies , attention has been given exclusively to skeptical inference relations . Among the most important ones we only mention here the following conditions : T j?sk T -LRB- Reflexivity -RRB- T j?sk f and T j?sk y imply T + f j?sk y -LRB- Cautious monotony -RRB- T + f j?sk y and T j?sk f imply T j?sk y -LRB- Cut -RRB- An inference relation j?sk is called Cumulative if both Cut and Cautious monotony hold for j?sk . Note that if j?sk is cumulative and T j?sk f then T and T + f have the same j?sk - consequences . In this paper we also investigate liberal forms of inference relations , therefore we study two liberal variants of cautious monotony : T j ? f and T j ? y imply T + f j ? y -LRB- Liberal monotony -RRB- T j ? > and T j ? f imply T + f j ? > -LRB- Liberal preservation -RRB- Note that Liberal preservation is implied by Liberal monotony , but not vice versa , so the latter one is a stronger principle than Liberal preservation4 . For special purposes5 , we need the following property : T 6j ? sk f implies T j ? : f -LRB- Determinacy -RRB- We do not have the intention to give a full treatment of these abstract properties . We only mention them here since we will give some results about the relation between these abstract properties and the suitability of certain types of theory revision operations . 3 Revising theories 3.1 Pure and weak retractions We will now discuss some general properties of theory transformations and investigate whether they can be used in our revision framework . To relate them to classical theory revision , we will first discuss an important class of theory transformations used in the classical framework . In classical theory revision , whenever a theory is inconsistent , theory contraction is applied to give it a meaning . If the theory is consistent , the theory is left unchanged . So let us define the following notion of a pure retraction function : Definition 3.1 -LRB- Pure retraction -RRB- Let T be a class of theories and R : T ! T be a theory-transformation . Then R is a pure retraction function iff 8T 2 T : R -LRB- T -RRB- ? T and there exists some T 2 T such that R -LRB- T -RRB- < > T . It might be that pure retraction functions are not useful for updating nonmonotonic theories , while for some -LRB- but not all -RRB- theories a mixture of adding some information 4This principle is also weaker than the principle of Consistency Preservation mentioned in -LSB- 8 -RSB- . 5We will need it only for deletions . and retraction is more appropriate . Therefore , we will allow for the more liberal notion of weak retraction functions : Definition 3.2 -LRB- Weak retraction -RRB- Let T be a class of theories and R : T ! T be a theory-transformation . Then R is a weak retraction function iff 9T 2 T : R -LRB- T -RRB- ae T and T < > R -LRB- T -RRB- . Note that the class of pure expansion functions is contained in the class of weak expansion functions . In the following sections , we will investigate under which conditions weak retraction methods are not suitable for performing revision with a back-up semantics . 3.2 Revision and weak retraction We will now prove that weak retraction is not suitable for -LRB- nonmonotonic -RRB- theory revision if the postulates above are satisfied , even if very almost nothing is assumed about the exact properties of the back-up semantics and the intended semantics : Theorem 3.3 Let -LRB- T ; j ? ; k ? -RRB- be a twin semantics satisfying Supra and let j ? satisfy Liberal Preservation . Then the revision framework R = -LRB- T ; j ? ; k ? ; R -RRB- can not be successful if R is a weak retraction function . PROOF Suppose , on the contrary , that R is a weak retraction function in R = -LRB- T ; j ? ; k ? ; R -RRB- , where -LRB- T ; j ? ; k ? ; -RRB- satisfies Supra and Liberal Preservation and R is successful . Since R is a weak retraction , there is a T 2 T , such that R -LRB- T -RRB- ae T , R -LRB- T -RRB- < > T . Since the revision framework R is assumed to be successful , we can assume that the postulates for revision are satisfied for R and we also can assume that T k ? > -LRB- 1 -RRB- Hence , by postulate P1 , R -LRB- T -RRB- j ? > -LRB- 2 -RRB- By Reflexivity of k?sk , we have T k?sk T -LRB- 3 -RRB- Hence , by postulate P3 , it follows that R -LRB- T -RRB- k?sk T -LRB- 4 -RRB- But then , by Supra , it follows from -LRB- 4 -RRB- that R -LRB- T -RRB- j?sk T -LRB- 5 -RRB- From -LRB- 2 -RRB- and -LRB- 5 -RRB- , we have R -LRB- T -RRB- j ? T -LRB- 6 -RRB- Applying Liberal Preservation to -LRB- 2 -RRB- and -LRB- 6 -RRB- gives R -LRB- T -RRB- + T j ? > -LRB- 7 -RRB- But , since R -LRB- T -RRB- ae T , T = R -LRB- T -RRB- + T and -LRB- 7 -RRB- implies that T j ? > , contradicting the assumption -LRB- 1 -RRB- . Therefore R can not be a weak retraction function . Since , as far as we know , Liberal Preservation is satisfied by every -LRB- nonmonotonic -RRB- semantics , this result shows that , in general , weak and pure retraction functions can not be used if a theory T has to be revised using a back-up semantics . Furthermore , observe that almost nothing has to be assumed with respect to the properties of the back-up semantics : only Reflectivity is required . 3.3 Pure Expansion functions and minimal revision We have seen that in almost every case pure and weak retractions can be excluded from the range of possible transformations to be applied if a theory has to be revised . In this section we therefore take a look at mixed revisions and pure expansion functions for revision of theories . Definition 3.4 -LRB- Pure expansion -RRB- A pure expansion function is a theory transformation R such that for all T 2 T , R -LRB- T -RRB- ? T . Definition 3.5 -LRB- Mixed revision -RRB- We call a revision function R a mixed revision function if for some T 2 T , R -LRB- T -RRB- ? T < > / 0 and T ? R -LRB- T -RRB- < > / 0 . It turns out that given some additional properties of the back-up semantics , the class of mixed revisions is obsolete in the following sense : the class of mixed revision functions can be represented by the class of pure expansion functions , i.e. for every mixed revision function R satisfying the postulates , there exists a pure expansion function R0 such that R0 -LRB- T -RRB- = R -LRB- T -RRB- + T and R0 also satisfies the postulates . Lemma 3.6 Let R = -LRB- T ; k ? ; j ? ; R -RRB- be a revision framework satisfying the postulates , where 1 . -LRB- T ; k ? ; j ? -RRB- satisfies Supra , 2 . j ? satisfies Liberal Preservation , 3 . k?sk satisfies Cumulativity and Reflexivity and 4 . R is a mixed revision . Then the revision framework R = -LRB- T ; k ? ; j ? ; R0 -RRB- , where R0 is a pure expansion function defined as R0 -LRB- T -RRB- = R -LRB- T -RRB- + T , also satisfies the postulates . PROOF We show that R0 satisfies the postulates P1-P3 . -LRB- ad P1 -RRB- Assume that T k ? > . We have to show that R0 -LRB- T -RRB- j ? > . Since R satisfies P1 , R -LRB- T -RRB- j ? > -LRB- 8 -RRB- By Reflexivity , T k?sk T and , since R satisfies P3 , R -LRB- T -RRB- k?sk T . By Supra , R -LRB- T -RRB- j?sk T . Hence , by -LRB- 8 -RRB- , R -LRB- T -RRB- j ? T -LRB- 9 -RRB- Applying Liberal Preservation to -LRB- 8 -RRB- and -LRB- 9 -RRB- gives R0 -LRB- T -RRB- = R -LRB- T -RRB- + T j ? > . -LRB- ad P2 -RRB- Since R -LRB- T -RRB- = T whenever T j ? > , it follows immediately that R0 satisfies Postulate P2 . -LRB- ad P3 -RRB- By Reflexivity , it follows that T k?sk T and , since R satisfies postulate P3 , we also have R -LRB- T -RRB- k?sk T . Hence , by Cumulativity , R -LRB- T -RRB- and R0 -LRB- T -RRB- = R -LRB- T -RRB- + T have the same set of k?sk - consequences . Since R satisfies P3 , we have therefore , R0 -LRB- T -RRB- k?sk f iff R -LRB- T -RRB- k?sk f iff T k?sk f showing that R0 satisfies P3 . Like in revising classical theories , we usually also require nonmonotonic revisions to be minimal in some respect . Definition 3.7 -LRB- Minimal revision -RRB- We say that R = -LRB- T ; k ? ; j ? ; R -RRB- is a framework for minimal revision if R satisfies the postulates P1-P3 and the following minimality postulate : P4 For every R0 < > R satisfying the postulates P1-P3 , if -LRB- R -LRB- T -RRB- ? T -RRB- ? -LRB- R0 -LRB- T -RRB- ? T -RRB- then R -LRB- T -RRB- = R0 -LRB- T -RRB- . Here , ? is the symmetrical set-difference operator . This postulate expresses that successful revision should minimize the necessary additions to and retractions from the original theory . As an almost direct consequence of the preceding lemma we have : Theorem 3.8 Let R = -LRB- T ; k ? ; j ? ; R -RRB- be a minimal revision framework satisfying the postulates P1-P4 , where 1 . -LRB- T ; k ? ; j ? -RRB- satisfies Supra , 2 . j ? satisfies Liberal Preservation 3 . k?sk satisfies Cumulativity and Reflexivity Then R has to be a pure expansion function . PROOF According to Theorem 3.3 , the possible candidates for revision functions satisfying the postulates P1-P3 are mixed and pure expansion functions . According to the previous lemma , every mixed expansion function R can be represented by a smaller pure expansion function R0 also satisfying the postulates . Therefore , only pure expansion functions will satisfy the postulates P1-P4 . It is interesting to note that in contrast to the results obtained in the previous section , for minimal revision by expansion , especially the back-up semantics has to satisfy stronger properties , while the properties required for the intended semantics remain the same . 4 Updating theories While for revision we have seen that , in general , retraction is not suitable , we will show now that the picture is not so clear if we change to updating information in a nonmonotonic back-up framework . We will restrict our attention to inserting and deleting information in a skeptical semantics . Let us first discuss a generalization of the postulates for revision in order to adapt them to updating . Like in the revision case , we will concentrate on updating a theory T when the back-up semantics does not require T to be changed , but the intended semantics may require some adaptation . A theory T is said to be adequate with respect to the update operation update -LRB- f -RRB- to be performed , notation adequate -LRB- T ; update -LRB- f -RRB- -RRB- , if the following holds : adequate -LRB- T ; insert -LRB- f -RRB- -RRB- ? T k?sk f ^ T k ? f adequate -LRB- T ; delete -LRB- f -RRB- -RRB- ? T 6k ? sk f We say that a theory T is nonmonotonically successful with respect to the update operation update -LRB- f -RRB- , notation success -LRB- T ; update -LRB- f -RRB- -RRB- iff success -LRB- T ; insert -LRB- f -RRB- -RRB- ? T j?sk f ^ T j ? f success -LRB- T ; delete -LRB- f -RRB- -RRB- ? T 6j ? sk f Note that adequate -LRB- T ; update -LRB- f -RRB- -RRB- does not imply success -LRB- T ; update -LRB- f -RRB- -RRB- . Now the postulates for -LRB- skeptical -RRB- updates can be formulated analogously to the postulates for revision as follows : UP1 . success -LRB- R -LRB- T -RRB- ; update -LRB- f -RRB- -RRB- whenever adequate -LRB- T ; update -LRB- f -RRB- -RRB- This postulate specifies that updates should be successful : R should be such that R -LRB- T -RRB- meets the requirements of the update operation with respect to the intended semantics , whenever T meets the requirements with respect to the backup semantics . UP2 . R -LRB- T -RRB- = T if success -LRB- T ; update -LRB- f -RRB- -RRB- . This postulate prevents R to change the theory in trivial cases : only in those cases in which T does not meet the requirements , it is allowed to apply a nontrivial transformation to T . UP3 . R -LRB- T -RRB- k?sk y iff T k?sk y for all y 2 L. Again , the last postulate requires T and R -LRB- T -RRB- to be skeptically indistinguishable w.r.t. the back-up semantics . Theorem 4.1 Let -LRB- T ; j ? ; k ? -RRB- be a twin semantics satisfying Supra . Let U = -LRB- T ; update -LRB- f -RRB- ; j ? ; k ? ; R -RRB- be the corresponding update framework satisfying the postulates UP1-UP3 . Then R can not be a weak retraction function if 1 . U is an insertion framework and j ? satisfies Liberal Preservation ; 2 . U is a deletion framework and j ? satisfies Liberal Monotony and Determinacy . PROOF We apply the same technique as in the proof of Theorem 3.3 . Here , it will suffice to give the main lines . We start with proving -LRB- 1 -RRB- . Suppose R is a weak retraction . We then may assume that there is some T such that adequate -LRB- T ; insert -LRB- f -RRB- -RRB- holds , success -LRB- T ; insert -LRB- f -RRB- -RRB- does not hold and R -LRB- T -RRB- ae T . Since , by Supra , T k?sk f implies T j?sk f , and we know that not both T j?sk f and T j ? f can hold , we have to conclude that T 6j ? > . The update framework satisfies the postulates , so we have R -LRB- T -RRB- j ? f and R -LRB- T -RRB- j?sk f. Assuming that R -LRB- T -RRB- ae T , we derive a contradiction : Since by Reflexivity of k ? and postulate UP3 , we can infer that R -LRB- T -RRB- k?sk T and by Supra we have R -LRB- T -RRB- j ? sk T . From R -LRB- T -RRB- j ? f it follows that R -LRB- T -RRB- j ? > . Applying Liberal Preservation on R -LRB- T -RRB- j ? T and R -LRB- T -RRB- j ? > gives R -LRB- T -RRB- + T = T j ? > . Note that by Supra we also have T j?sk f from the assumption that T k?sk f . But then we have T j ? > ^ T j?sk f ? success -LRB- T ; insert -LRB- f -RRB- -RRB- contradicting our assumption that success -LRB- T ; insert -LRB- f -RRB- -RRB- does not hold . For -LRB- 2 -RRB- , wemay assume that adequate -LRB- T ; delete -LRB- f -RRB- -RRB- holds , that success -LRB- T ; delete -LRB- f -RRB- -RRB- does not hold and R -LRB- T -RRB- ae T . Since the framework is assumed to be successful , it follows that success -LRB- R -LRB- T -RRB- ; delete -LRB- f -RRB- -RRB- holds . Hence , R -LRB- T -RRB- 6j ? sk f. By Determinacy , it follows that R -LRB- T -RRB- j ? : f. Following the same line of reasoning as we did in the proof of Theorem 3.3 we can infer that R -LRB- T -RRB- j ? T . Hence , applying Liberal Monotony , it follows that R -LRB- T -RRB- + T j ? : f . This implies that there is an j ? - extension of T = R -LRB- T -RRB- + T such that f is true in this extension . Hence T 6j ? sk f , implying that success -LRB- T ; delete -LRB- f -RRB- -RRB- holds ; contradiction . Noting that Liberal Preservation is weaker than Liberal Monotony , we will show now that this last condition can not be weakened in the condition for successful deletion , showing that the inadequacy of retraction requires somewhat stronger principles for deletions than for insertions . Example 4.2 Consider the class T of normal logic programs over a fixed set of atoms At . We take a twin semantics -LRB- T ; j = ; j ? -RRB- , where j = is the classical entailment relation and j ? is based on the inflationary semantics -LRB- -LSB- 1 -RSB- -RRB- for normal logic programs . The inflationary semantics is based on the fixpoint of the inflationary operator T in f P defined as T in f P -LRB- I -RRB- = TP -LRB- I -RRB- -LSB- I , where TP is the well-known immediate consequence operator . Since Tin f P is progressive , i.e. I ? T in f P -LRB- I -RRB- , it has a unique least fixpoint l f p -LRB- T in f P -RRB- for every normal logic program . Since T in f P -LRB- I -RRB- = I implies TP -LRB- I -RRB- ? I , l f p -LRB- T in f P -RRB- = Min f P , the inflationary model of P , is a -LRB- classical -RRB- model of P. For every program P 2 T , let P j ? f iff Min f P j = f . Since the inflationary model is uniquely defined for every normal logic program , it follows that j?sk = j ? . It is also easy to see that both Determinacy and Liberal Preservation hold for j ? with respect to T . Now we show that for the inflationary semantics , it is possible to perform deletions by applying contractions , showing that Liberal Preservation is not sufficient to exclude deletion by weak contraction . Let us consider the following program P : b : a a : b and suppose we would delete b from P . Since P 6j = b , adequate -LRB- P ; delete -LRB- b -RRB- -RRB- is true . Since Min f P = fa ; bg , P j?sk b and therefore , success -LRB- P ; delete -LRB- b -RRB- -RRB- does not hold . Now let R -LRB- P -RRB- be the following contraction of P : R -LRB- P -RRB- = fa : bg We verify that R satisfies the postulates UP1-UP3 : 1 . Since Min f R -LRB- P -RRB- = fag , R -LRB- P -RRB- 6j ? b , hence success -LRB- R -LRB- P -RRB- ; delete -LRB- b -RRB- -RRB- holds . So UP1 is satisfied . 2 . UP2 is satisfied since success -LRB- T ; delete -LRB- b -RRB- -RRB- does not hold . 3 . Since P j = R -LRB- P -RRB- and R -LRB- P -RRB- j = P , UP3 is also satisfied . Hence , we have a retraction function R satisfying the postulates in case both Determinacy and Liberal Preservation are the abstract properties j ? has to satisfy . 4.1 Minimal Updates Completely analogous to the definition of minimal revision , we can also define a notion of minimal updates by stating a postulate UP4 identical to P4 . A close inspection of Lemma 4.3 and the differences between updates and revisions then shows that the following result should hold : Theorem 4.3 Let -LRB- T ; j ? ; k ? -RRB- be a twin semantics satisfying Supra but not Cons . Let U = -LRB- T ; update -LRB- f -RRB- ; j ? ; k ? ; R -RRB- be the corresponding minimal update framework satisfying the postulates UP1-UP4 , where k ? satisfies Reflexivity and Cumulativity and 1 . if U is an insertion framework , j ? satisfies Liberal Preservation 2 . if U is a deletion framework , j ? satisfies Liberal Monotony and Determinacy then R has to be a pure expansion function . 5 Conclusions and Related work The idea of revision by expansion in nonmonotonic theory revision has been discussed before . In Auto-Epistemic Logic -LRB- AEL -RRB- for example , Morris -LRB- -LSB- 9 -RSB- -RRB- has suggested something like theory expansion for auto-epistemic theories that do not have an AE-extension . The simple idea is : if there is no AE-extension for a set of premises S , then a set-inclusion minimal set of ordinary -LRB- i.e. modal-operator-free -RRB- premises is added to S such that an AE-extension exists . In logic programming , the work of Pereira et al. -LRB- -LSB- 10 -RSB- -RRB- on Contradiction Removal Semantics can be seen as a special expansion method , allowing for revision of assumptions . We have presented a framework and some postulates for revision and updating of theories . We have shown that under very mild conditions on both the back-up and the intended semantics , revision of the intended semantics can not be accomplished by retraction functions . If we want to replace retraction by pure expansion , our results show that the backup semantics also has to satisfy Cumulativity . This shows that the expansion approach of Pereira et al. -LRB- -LSB- 10 -RSB- -RRB- on Contradiction Removal Semantics is justified since his back-up semantics is restricted to a classical semantics . It also shows that this approach might be extended by taking into account a weaker than classical semantics . Recently , Inoue and Sakama in -LSB- 5 -RSB- proposed a very general approach to revision of nonmonotonic theories by proposing to revise a theory T by a minimal set of additions I and removals O such that T + I?O has an acceptable model . Their proposal thus comes down to advocating a mixed revision approach . Our results show that such an approach might be useful if the back-up semantics is not cumulative . In other cases , a pure expansion approach should be preferred . Acknowledgments The authors are grateful to H. Herre and D. Pearce for their suggestions to improve the revision framework . Part of this report has been completed while the first author was at the Department of Computer Science , University of Utrecht . The second author was partially supported by ESPRIT III BRWG project No. 8319 ` ModelAge ' . References -LSB- 1 -RSB- N. Bidoit , Negation in rule-based database languages : a survey , Theoretical Computer Science , 78 , -LRB- 1991 -RRB- , 3 ? 83 . -LSB- 2 -RSB- J. Doyle , A Truth Maintenance System , Artificial Intelligence , vol . 12 , pp. 231 ? 272 , 1979 . -LSB- 3 -RSB- J. Dietrich and H. Herre , Outline of a nonmonotonic model theory . Technical Report NTZ-5 :94 , Universitaet Leipzig , Institut fuer Informatik , Leipzig , 1994 . -LSB- 4 -RSB- R. Fagin , G. Kuper , J. D. Ullman and M.Y. Vardi , Updating Logical Databases . In : Advances in Computing Research , 3 , 1986 , pp. 1 ? 18 . -LSB- 5 -RSB- K. Inoue , C. Sakama , Abductive Framework for Nonmonotonic Theory Change . Proceedings IJCAI ' 95 , 1995 . -LSB- 6 -RSB- H. Katsuno and A. Mendelzon . Propositional Knowledge Base Revision and Minimal Change , Artificial Intelligence , 52 , 1991 , pp. 263 ? 294 . -LSB- 7 -RSB- D. Makinson , General Patterns in Nonmonotonic Reasoning , in : D.M. Gabbay , C.J. Hogger , J.A. Robinson , editors , Handbook of Logic in Artificial Intelligence and Logic Programming , Vol . 3 , Nonmonotonic Reasoning , Oxford Science Publications , Oxford , 1994 . -LSB- 8 -RSB- V. Marek and M. Truszczy?nski , Nonmonotonic Logic , Springer Verlag , Heidelberg , 1993 . -LSB- 9 -RSB- Morris , P. , Stable Closures , Defeasible Logic and Contradiction Tolerant Reasoning , Proceedings of the 7th National Conference on Artificial Intelligence , 1988 . -LSB- 10 -RSB- L. M. Pereira , J. J. Alferes and J. N. Aparicio . Contradiction Removal within well-founded semantics . In : A. Nerode , W. Marek and V. S. Subrahma - nian , editors , First International Workshop on Logic Programming and Nonmonotonic Reasoning , MIT Press , 1991 . -LSB- 11 -RSB- C. Witteveen and W. van der Hoek , Revision by Communication . In : V. Marek , A. Nerode and M. Truszczy?nski , editors , Logic Programming and NonMonotonic Reasoning , LNAI 928 , pp. 189 ? 202 , Springer Verlag , 1995 . -LSB- 12 -RSB- C. Witteveen and W. van der Hoek , Some Postulates for Nonmonotonic Theory Revision Applied to Logic Programming . In : R. Dyckhoff , H. Herre and P. Schroeder-Heister , editors , Extensions of Logic Programming , LNAI 1050 , pp. 303 ? 318 , Springer Verlag , 1996 .

O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O

nonmonotonic reasoning
theory revision
updating databases


Implementing Elements of the Spec-Calculus : An Example H.T.G. Weffers Department of Mathematics and Computing Science Eindhoven University of Technology HG 6.57 , P.O.Box 513 , 5600 MB Eindhoven , The Netherlands <haroldw@win.tue.nl> December 15 , 1993 Abstract The spec-calculus is a programming algebra which is based on a relational calculus . In this article we present one example of the implementation of elements of the spec-calculus . 1 Introduction Programming is a mathematical activity . Its successful practice requires determined and meticulous application of traditional methods of mathematical understanding , calculation and proof -LRB- cf. -LSB- Hoa86 -RSB- -RRB- . Program construction and its theory are developing -LRB- slowly but -RRB- steadily towards an algebraic discipline combining methods from category theory , lattice theory and regular algebra -LRB- cf. -LSB- VvdW93 -RSB- -RRB- . Calculational type theory and transformational program derivation play a major role in this development . Over the last few years R.C. Backhouse and his colleagues have been developing a theory of datatypes based on a point-free axiomatisation of the calculus of relations -LRB- cf. -LSB- BHVvdW92 -RSB- -RRB- . The primary goal of this research has been to develop an algebra that expedites the calculation of programs manipulating non-trivial datatypes . The spec-calculus is a programming algebra that supports and even encourages the construction of relational programs in a clear and calculational style . In this algebra programs are parameterised by datatypes . This means that properties can be derived that hold for all datatypes and that programs can be constructed that do not depend on the types of the arguments to which these programs are applied . These programs all exhibit a truly polymorphic behaviour . An important part of the introduction of a new programming calculus is showing that it is powerful enough to solve the problems it has been designed for . From a theoretical point of view this has been done in -LSB- BHVvdW92 -RSB- . From a practical point of view this has partly been done in -LSB- Kna93 -RSB- . The goal of the spec-calculus is to construct implementations of a given specification . In -LSB- Wef93 -RSB- we present some issues related to the implementation of elements of the spec-calculus using the functional programming language Gofer -LRB- cf. -LSB- Jon91 , Jon93a -RSB- -RRB- . In particular we present and discuss the implementation of relators , functional catamorphisms and witnesses to isomorphisms . We aim at polymorphic implementations that have a maximal resemblance to the spec-expressions whilst using methods and techniques that are used by functional programmers . In functional programming types are -LRB- still -RRB- not first class citizens -LRB- cf. -LSB- Dav91 -RSB- -RRB- . This implies that in functional programming we can not construct programs that are parameterised by types . Thus , for all functions that are defined over a specific datatype we have to write out the recursion pattern over and over again . In the speccalculus types are first class citizens and we can use catamorphisms to encapsulate a particular recursion pattern in a very concise and elegant notation . Catamorphisms are functions that are parameterised by datatypes . One of the consequences of this disparity is that using a functional programming language we can only implement instances of our spec-programs . 2 Example The datatype join-list -LRB- cf. -LSB- Bir87 -RSB- -RRB- in the Boom-hierarchy -LRB- cf. -LSB- Jeu93 -RSB- -RRB- is one way to implement the intuitive idea people have of lists . Another way is by means of the datatype cons-list . A cons-list -LRB- ` cons ' is an abbreviation of ` construct ' -RRB- is a list which is constructed from right to left , i.e. new elements are appended to the left . In the literature -LRB- cf. -LSB- Mal89 -RSB- -RRB- we also find the term forward lists for lists that are constructed in this way . In the spec-calculus the datatype cons-list over type R is specified as the least solution of the equation X : : X = 1 + -LRB- R?X -RRB- : Thus , the datatype is specified as the relator List which is defined by : List : R = ? -LRB- X 7 ! 1 + R?X -RRB- : In categorical approaches to type theory , a parallel is drawn between the notion of type constructor and the categorical notion of functor -LRB- cf. -LSB- PAPR86 -RSB- -RRB- , emphasising that a type constructor is not just a function from types to types but also comes equipped with a function that maps morphisms to morphisms , i.e. functions to functions . The latter function is called a ` map function ' . In the spec-calculus , a relator is only a modest extension to the notion of functor -LRB- cf. -LSB- BHVvdW92 -RSB- -RRB- . In category theory and the spec-calculus , both the function from types to types and the function that maps morphisms to morphisms are denoted by the same symbol . However , to clearly distinguish between these two functions we introduce the relator m which is defined as by m : R = List : R , for all R . We will use List to denote the function from types to types and m to denote the corresponding function that maps morphisms to morphisms , i.e. functions to functions . Given a datatype in the spec-calculus we get the corresponding map function for free , whereas in functional programming we have to explicitly construct this function . We can prove that m : R can be defined as a specific catamorphism , i.e. , m : R = -LRB- ? List ; 1 + R?I -RRB- : In the spec-calculus catamorphisms are the counterpart of recursive functions in functional programming , which are defined by means of simple structural recursion over a datatype . In fact , catamorphisms simply encapsulate a particular recursion pattern in a very concise and elegant notation . However , not all recursion patterns can be encapsulated in a catamorphism , e.g. the recursion pattern corresponding to the well known ` factorial ' function can not be captured by a catamorphism . For situations where a catamorphism does not suffice , there are other possibilities , e.g. paramorphisms -LRB- cf. -LSB- Jeu93 -RSB- -RRB- . Since we are only interested in polymorphic implementations we do not want our implementation to depend in any way on the details of any specific base -LRB- mono -RRB- type . Therefore we will consider List : I. For List : I we can prove that List : I = -LRB- , ! ffi 1 -RRB- 5 -LRB- - ffi I?List : I -RRB- : Using a data-definition we can implement the function from types to types of relator List by : data List a = Nilc | Cons -LRB- a -RRB- -LRB- List a -RRB- By its very nature a functional programming language always results in the ` least ' datatype , i.e. an object of type List a is constructed out of nothing and is Nilc or it is constructed -LCB- in a finite number of steps -LCB- by applying Cons to an element of a and an element of List a and by no other means at all . The type constructor List exhibits parametric polymorphic behaviour -LRB- cf. -LSB- WB89 , ACC93 -RSB- -RRB- , that is , its behaviour does not depend on the type at which it is instantiated . Note that the implementation of a relator is only unique ` modulo identifiers ' , i.e. , there is a large number of -LRB- isomorphic -RRB- implementations possible . For relator List we have the following constructors : ae o List = , ! ffi 1 ; ? List = - ffi -LRB- I?List : I -RRB- : These constructors correspond to the constructor functions in the above implementation . They are implicitly defined by the data-definition . Finally we have to implement the corresponding map function . We can actually construct this implementation . For relator List we have : ae o List = , ! ffi 1 ; ? List = - ffi -LRB- I?List : I -RRB- : Using the computation rules for -LRB- ; -RRB- we get for m : R : ae m : R ffi o List = o List ; m : R ffi ? List = -LRB- - ffi -LRB- R?I -RRB- -RRB- ffi -LRB- I?m : R -RRB- : The computation rules for -LRB- F ; -RRB- correspond to saying that an F-catamorphism may be implemented by means of simple structural recursion over the data structure which may be associated with relator F , i.e. over ? F. Can we see this ? Recall that the spec-constructors o F and ? F correspond to the constructor functions that come with the type constructor representing the function from types to types of relator F . In functional programming these constructor functions are used for the recursive definition of functions over the class of types corresponding to the type constructor . In fact , an F-catamorphism ` breaks down ' an F-structure and recursively applies the F-catamorphism . For m : R ffi ? List we have : m : R ffi ? List = f Computation rules for -LRB- ; -RRB- g -LRB- - ffi -LRB- R?I -RRB- -RRB- ffi -LRB- I?m : R -RRB- = f Associativity ffi g - ffi -LRB- -LRB- R?I -RRB- ffi -LRB- I?m : R -RRB- -RRB- = f ?? fusion g - ffi -LRB- R ? m : R -RRB- = f -LRB- * -RRB- g - ffi -LRB- -LRB- I?List : I -RRB- ffi -LRB- R?m : R -RRB- -RRB- = f Definition ? List g ? List ffi -LRB- R?m : R -RRB- At -LRB- * -RRB- we use explicitly that m = List and thus that m is a relator . Since m is a relator we also have : m : R = f I is unit element of ffi g m : -LRB- I ffiR -RRB- = f m is a relator g m : I ffi m : R = f m = List g List : I ffi m : R Consequently , R ? m : R = f above g R ? -LRB- List : I ffi m : R -RRB- = f I is unit element of ffi g -LRB- I ffiR -RRB- ? -LRB- List : I ffi m : R -RRB- = f ?? fusion g -LRB- I?List : I -RRB- ffi -LRB- R?m : R -RRB- So , we get for m : R : ae m : R ffi o List = o List ; m : R ffi ? List = ? List ffi -LRB- R?m : R -RRB- : From these computation rules we can very easily construct the following implementation of m : map : : -LRB- a - > b -RRB- - > -LRB- List a - > List b -RRB- map f -LRB- Nilc -RRB- = Nilc map f -LRB- Cons v lv -RRB- = Cons -LRB- f v -RRB- -LRB- map f lv -RRB- So , using the spec-calculus we can very easily construct the implementation of relators , i.e. , of the function from types to types and the associated map function . A functional programmer will recognise that similar map functions are also used with a wide range of other datatypes . This implies that there are several functions -LRB- with different names -RRB- that implement a map function for a particular datatype . With this in mind it seems a shame that we have to use different names for each of the map functions . A more attractive solution would allow the use of a single name , say map , relying on the types of the objects involved to determine which particular version of the map functions is required in a given situation . The ability to use a single function symbol with an interpretation that depends on the type of its arguments is commonly known as overloading . In Gofer , overloading is implemented using type classes -LRB- cf. -LSB- WB89 , Jon92 -RSB- -RRB- . Type classes permit the systematic overloading of function names while retaining the advantages of the Hindley/Milner system : every expression which has a type , has a most general type which can be inferred automatically -LRB- cf. -LSB- NP93 -RSB- -RRB- . Unfortunately , the system of type classes is not sufficiently powerful -LRB- cf. -LSB- Jon93b -RSB- -RRB- to give a satisfactory treatment of the map function . Another approach is to notice that for all types for which we require map to exist , map has the following signature map : : -LRB- a - > b -RRB- - > -LRB- f a - > f b -RRB- . The variables a and b here represent arbitrary types while f ranges over the set of type constructors for which a suitable map function has been defined . Using constructor classes -LRB- cf. -LSB- Jon93b , Jon93a -RSB- -RRB- we can implement map by class Functor f where map : : -LRB- a - > b -RRB- - > -LRB- f a - > f b -RRB- instance Functor List where map f Nilc = Nilc map f -LRB- Cons x xs -RRB- = Cons -LRB- f x -RRB- -LRB- map f xs -RRB- We can instantiate the constructor class Functor for all kinds of datatypes . However , all these datatypes have to be defined using a unary relator . We have to define a new Functor-like constructor class for each arity . 3 Conclusions and research perspectives In this article we discussed one particular example of implementing elements of the spec-calculus using the functional programming language Gofer . We have seen that we can very easily construct an implementation for a relator . However , when we want to construct polymorphic implementations we are hampered by the restrictions imposed by the functional programming language . In -LSB- Wef93 -RSB- we also find that -LRB- purely -RRB- functional programming languages give an unsatisfactory treatment of non-determinism and isomorphism . Although some work has been done on non-determinism in functional programming languages -LRB- cf. -LSB- HO89 -RSB- -RRB- , in practice we still can not really use non-deterministic constructs in a functional programming language . In the spec-calculus we can have equal types -LRB- cf. -LSB- Bac93 -RSB- -RRB- and not just types up to isomorphism -LRB- cf. -LSB- Poi86 -RSB- -RRB- . In functional programming languages , however , we do not have true type equality . We have to use type coercions . Clearly a functional programming language is not an ideal language for constructing polymorphic implementations of expressions in the spec-calculus . Of course the applicative style of programming is not a palliative for all the ills of the programming world any more than any other programming paradigm . Clearly each style of programming has its own adherents and is better for certain tasks than others . There are several other possibilities that might be usable for implementing elements from the spec-calculus in a systematic way . We can only mention them here briefly . Further research will be necessary to investigate whether these alternatives actually give us the possibility to construct implementations in an elegant and concise way . Alternatives are : ffl Relational programming : Relational programming is becoming more and more a topic in modern day computing science . Since the spec-calculus is a relational calculus , we suggest that future research also investigates the possibilities of implementing spec-expressions in a relational programming language like Ruby -LRB- cf. -LSB- She90 -RSB- , -LSB- Hut92 -RSB- -RRB- . ffl Categorical programming : Since the spec-calculus has so much in common with category theory we should also consider investigating Charity which is a programming language specifically suited for implementing elements from category theory -LRB- cf. -LSB- CF92 -RSB- -RRB- . ffl Parameterised programming : Since in the spec-calculus programs are constructed which are parameterised by datatypes , it might also be a good idea to investigate the parameterised programming paradigm as it is used in , for instance , OBJ -LRB- cf. -LSB- Gog84 -RSB- -RRB- . Although this research may result in new problems or different restrictions with respect to the possibility of implementing our spec-expressions , it may instigate new directions in research . References -LSB- ACC93 -RSB- Mart ?? n Abadi , Luca Cardelli , and Pierre-Louis Curien . Formal parametric polymorphism . In Conference Record of the 20 ` th Annual ACM SIG - PLAN - SIGACT Symposium on Principles of Programming Languages , Charleston , South Carolina . January 10 - 13 , 1993 , pages 157 -LCB- 170 . ACM Press , 1993 . -LSB- Bac93 -RSB- R.C. Backhouse . Constructive Lattice Theory . Department of Mathematics and Computing Science , Eindhoven University of Technology , July 1993 . -LSB- BHVvdW92 -RSB- R.C. Backhouse , P. Hoogendijk , T.S. Voermans , and J. van der Woude . A Relational Theory of Datatypes , Part II . In Lecture Notes of the STOP 1992 Summerschool on Constructive Algorithmics : Part 3 , 1992 . -LSB- Bir87 -RSB- Richard S. Bird . An introduction to the theory of lists . In M. Broy , editor , Logic of Programming and Calculi of Discrete Design , volume F36 of NATO ASI Series . Springer-Verlag , 1987 . -LSB- CF92 -RSB- Robin Cockett and Tom Fukushima . About Charity . Department of Computer Science , University of Calgary , May 1992 . -LSB- Dav91 -RSB- A.J.T. Davie . An Introduction to Functional Programming Systems using Haskell , volume 27 of Cambridge Computer Science Texts . Cambridge University Press , 1991 . -LSB- Gog84 -RSB- Joseph Goguen . Parameterized Programming . Center for the Study of Language and Information , Ventura Hall , Stanford University , August 1984 . Report No . CSLI - 84 - 10 . -LSB- HO89 -RSB- John Hughes and John O'Donnel . Expressing and reasoning about nondeterministic functional programs . In Kei Davis and John Hughes , editors , Functional Programming : Proceedings of the 1989 Glasgow Workshop , 21-23 August 1989 , Fraserburgh , Scotland , Workshops in computing . Springer-Verlag / British Computer Society , 1989 . -LSB- Hoa86 -RSB- C.A.R. Hoare . The Mathematics of Programming . Clarendon Press , Oxford , 1986 . Inaugural Lecture . -LSB- Hut92 -RSB- Graham Hutton . Between functions and relations in calculating programs . PhD thesis , University of Glasgow , October 1992 . -LSB- Jeu93 -RSB- Johan Jeuring . Theories for Algorithm Calculation . PhD thesis , Utrecht University , February 1993 . -LSB- Jon91 -RSB- Mark P. Jones . Introduction to Gofer , included as part of the Gofer distribution , September 1991 . -LSB- Jon92 -RSB- Mark P. Jones . Qualified Types : Theory and Practice . PhD thesis , Programming Research Group , Oxford University Computing Laboratory , July 1992 . -LSB- Jon93a -RSB- Mark P. Jones . Gofer 2.28 release notes , February 1993 . -LSB- Jon93b -RSB- Mark P. Jones . A system of constructor classes : overloading and implicit higher-order polymorphism . In Proceedings of the 6 ` th ACM Conference on Functional Programming Languages and Computer Architecture , Copenhagen , Denmark . ACM Press , June 1993 . -LSB- Kna93 -RSB- Ed Knapen . Relational programming , program inversion and the derivation of parsing algorithms . Graduating dissertation , Department of Mathematics and Computing Science , Eindhoven University of Technology , November 1993 . -LSB- Mal89 -RSB- Grant Malcolm . Homomorphisms and promotability . In J.L.A. van de Snepscheut , editor , Conference on the Mathematics of Program Construction , volume 375 of Lecture Notes in Computer Science , pages 335 -LCB- 347 . Springer-Verlag , 1989 . -LSB- NP93 -RSB- Tobias Nipkov and Christian Prehofer . Type checking type classes . In Conference Record of the 20 ` th Annual ACM SIGPLAN - SIGACT Symposium on Principles of Programming Languages , Charleston , South Carolina . January 10 - 13 , 1993 , pages 409 -LCB- 418 . ACM Press , 1993 . -LSB- PAPR86 -RSB- David Pitt , Samson Abramsky , Axel Poign?e , and David Rydeheard . Category Theory and Computer Programming : Tutorial and Workshop , Guildford , U.K. , September 1985 . Proceedings , volume 240 of Lecture Notes in Computer Science . Springer-Verlag , 1986 . -LSB- Poi86 -RSB- Axel Poign?e . Elements of categorical reasoning : products and coproducts and some other -LRB- co - -RRB- limits . In David Pitt , Samson Abramsky , Axel Poign?e , and David Rydeheard , editors , Category Theory and Computer Programming : Tutorial and Workshop , Guildford , U.K. , September 1985 . Proceedings , Lecture Notes in Computer Science . Springer-Verlag , 1986 . -LSB- She90 -RSB- M. Sheeran . Ruby -LCB- a language of relations and higher-order functions . In G. Birtwistle , editor , Proceedings of the 3rd Banff workshop on hardware verification . Springer-Verlag , 1990 . -LSB- VvdW93 -RSB- T.S. Voermans and J. van der Woude . A relational perspective in types with laws . 1993 . -LSB- WB89 -RSB- Philip Wadler and Stephen Blott . How to make ad-hoc polymorphism less ad-hoc . In Proceedings of the 16 ` th ACM Annual symposium on Principles of Programming Languages , Austin , Texas , 1989 . ACM , ACM Press . -LSB- Wef93 -RSB- H.T.G. Weffers . Implementing Elements of the Spec-Calculus . Graduating dissertation , Department of Mathematics and Computing Science , Eindhoven University of Technology , August 1993 .

O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O B I O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O


The New World of Mechanisms Angel R. Puerta , Samson W. Tu , and Mark A. Musen Medical Computer Science Group Knowledge Systems Laboratory Stanford University Stanford , CA 94305-5479 , USA puerta@camis.stanford.edu ABSTRACT A goal of second-generation expert systems is to supply knowledge engineers with common frameworks to develop expert systems , thus , eliminating the need to build entirely new systems for each application . A mechanism is a unit of problem-solving knowledge from which such a framework can be developed . We define what a mechanism is and how it can be engineered to compose models of problem solving for expert systems . We also introduce PROT?G ? - II , an expert-system development environment based on mechanisms . Using PROT?G ? - II , knowledge engineers can implement all the elements of an expert system , from the problem-solving specifications , through the definition of knowledge-acquisition tools , to the editing of the domain knowledge in the knowledge base . The use of PROT?G ? - II is demonstrated with an example from the medical domain of AIDS therapy . 1 . Second-Generation Expert Systems Research on knowledge-based systems during the 1970s resulted , during the following decade , in the first generation of commercially available expert systems . The construction of expert systems in this period concentrated on two implementational aspects of knowledge-based systems : -LRB- 1 -RRB- the representation of knowledge -LRB- e.g. , as rules , frames , or semantic networks -RRB- , and -LRB- 2 -RRB- the reasoning strategy of the inference engine . One of the crucial shortcomings of this generation of expert systems was the brittleness of the resulting implementations ; that is , a system designed for a particular task could not be adapted easily to provide expertise for a different task . Consequently , researchers now developing the second generation of expert systems are examining how knowledge is used in an expert system , as opposed to how knowledge is implemented . One of the paradigms being studied is that of using models of problem solving , or problem-solving methods , as a foundation to build expert systems . Problem-solving methods determine how a task is to be solved , and can be applied to a class of tasks , thus partially overcoming brittleness . There are numerous examples of models of problem solving , and of knowledge-based systems implemented using those models . Skeletal-plan refinement -LSB- Friedland and Iwasaki , 1985 -RSB- is a method that solves problems by elaborating a general -LRB- skeletal -RRB- solution plan , and by then recursively refining the general plan into more detailed plans until a final , fully detailed plan is produced . Heuristic classification -LSB- Clancey , 1985 -RSB- is a method that determines solutions to given tasks by evaluating to which category the solution belongs . SALT -LSB- Marcus and McDermott , 1989 -RSB- is a knowledge-acquisition tool that generates problem solvers based on the propose-and-revise model of problem solving . ROGET -LSB- Bennett , 1985 -RSB- is a system that performs diagnostic tasks using a version of the heuristic-classification model . Although expert systems built around problem-solving methods are not limited to performing a single task , they are still restricted to the class of tasks that can be modeled under the particular problem-solving method . There are two alternatives to overcome this limitation . The first one is to define more general models of problem solving , which would result in methods that can solve a larger class of tasks . Since there is a certain cost in effort in specializing from a general method to a specific implementation , the drawback with this option is that making models more general also makes them more difficult to apply to specific problems -LSB- Klinker et al. , 1991 -RSB- . The second alternative?the one that we advocate in this paper?is to develop architectures that , with a single inference engine , can support multiple models of problem solving , and that thus potentially place no limit on the kinds of tasks that they can perform . But because each method requires a different inference engine , to build such architectures , we need a unit of knowledge different from the problem-solving method . We call such a unit a mechanism . The unit serves both as a building block for assembling problem-solving methods , and as a basis for developing an inference engine that can process mechanisms , or combinations of mechanisms . In this paper , we introduce the concept of mechanisms and their usefulness to the knowledgeengineering endeavor . In Section 2 , we explain how mechanisms can be combined to form problem-solving methods . Section 3 contains an overview of PROT?G ? - II?a shell to build problem solvers for methods assembled with mechanisms that is under development at our laboratory . Section 4 demonstrates the use of PROT?G ? - II in building an advice system for AIDS therapy . Finally , in Section 5 , we discuss how the availability of mechanisms , and of architectures based on them , changes the role of knowledge engineers in developing knowledge-based systems . 2 . What Is a Mechanism ? The concept of a mechanism is closely related to that of a task . The word task is defined differently throughout the literature , and its meaning is dependent on the context in which it is applied . We call a task a representation of a real-world problem . A task has a set of inputs and a set of outputs . A mechanism is then a procedure that solves the problem represented by the task . Thus , a task specifies what is the problem to be solved , whereas a mechanism specifies how to solve that problem -LRB- Fig. 1a -RRB- . Note that , in the definition of a mechanism , there is no restriction regarding the implementation form that the procedure takes -LRB- e.g. , as rules or frames -RRB- . The relationship between mechanisms and tasks is many-to-many . A mechanism can solve any task whose inputs and outputs can be mapped to those of the mechanism , and vice versa . The task?mechanism correspondence constitutes the basis for the idea of using mechanisms as building blocks to compose models of problem solving . By definition , a problem-solving method decomposes a task into subtasks , and then solves each subtask separately to reach a final solution . Consequently , if each one of these subtasks can be mapped to a mechanism , we can state that methods are in fact decomposable into mechanisms -LRB- Fig. 1b -RRB- . The result is that we have an unit of control knowledge that is appropriate for assembling problem-solving methods . In addition , since each mechanism is a black box that encloses its own control flow , an inference engine for mechanisms would need only to execute mechanisms as dictated by the decomposition set by the method , and to have access to a knowledge base that satisfies the input requirements of the mechanisms . Figure 1 . Tasks , methods , and mechanisms . -LRB- a -RRB- A mechanism is a unit of control knowledge that completely solves the problem represented by a task . -LRB- b -RRB- A method is a composite unit of control knowledge that subdivides tasks into subtasks . The subtasks are then performed by mechanisms . Consequently , methods can be viewed as being composed of mechanisms . To formalize how mechanisms and problem-solving methods relate to each other , we declare two operations : method configuration and method assembly . These operations correspond respectively to top-down and bottom-up approaches to the implementation of methods . In method configuration , we start with an existing method ; examine the decomposition of tasks into subtasks that such method imposes ; and configure that method by finding , for each subtask , a mechanism whose inputs and outputs map to those of the subtask . On the other hand , in method assembly , we begin with individual mechanisms , and assemble them by matching the output of one to the input of another , thus producing a new method . Obviously , the assembly of methods is a much more complex process than is that of configuration because assembly involves the creation of a new decomposition of tasks into subtasks that must be applicable to a whole class of tasks if the created method is to be useful . Based primarily on method configuration , expert systems can be developed that apply the notions of mechanisms and problem-solving methods . A method provides a proper decomposition of tasks , a method-configuration operation assigns mechanisms to each subtask , a knowledgeacquisition tool obtains the knowledge required by the mechanisms , and an inference engine reasons about the knowledge base according to the control flow dictated by the mechanisms and the task decomposition . Perhaps even more important , those same notions can be the foundation for complete development environments that support all facets of expert-system construction from mechanisms . In the next section , we describe such an environment : PROT?G ? - II , a system under development at our laboratory . 3 . Overview of PROT?G ? - II The PROT?G ? - II environment -LSB- Puerta et al. , 1992 ; Tu et al. , 1992 -RSB- is a descendant of PROT?G ? -LSB- Musen , 1989 -RSB- , which was a knowledge-acquisition tool founded on a single problem-solving method , but that did not incorporate the concept of a mechanism . PROT?G ? - II is designed Task Mechanism Method Mechanism Mechanism Mechanism Subtask Subtask Subtask

O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O B I O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O

artificial intelligence
generic tasks
knowledge acquisition
knowledge engineering
problem-solving methods