Lecture Notes in Artificial Intelligence Edited by J. G. Carbonell and J. Siekmann
Subseries of Lecture Notes in Computer Science
3662
Chitta Baral Gianluigi Greco Nicola Leone Giorgio Terracina (Eds.)
Logic Programming and Nonmonotonic Reasoning 8th International Conference, LPNMR 2005 Diamante, Italy, September 5-8, 2005 Proceedings
13
Series Editors Jaime G. Carbonell, Carnegie Mellon University, Pittsburgh, PA, USA J¨org Siekmann, University of Saarland, Saarbr¨ucken, Germany Volume Editors Chitta Baral Arizona State University Department of Computer Science and Engineering Fulton School of Engineering Brickyard Suite 572, 699 S. Mill Avenue, Tempe, AZ 85281, USA E-mail:
[email protected] Gianluigi Greco Nicola Leone Giorgio Terracina Universit`a della Calabria Dipartimento di Matematica via P. Bucci 30B, I-87030 Rende (CS), Italy E-mail: {ggreco, leone, terracina}@mat.unical.it
Library of Congress Control Number: 2005931127
CR Subject Classification (1998): I.2.3, I.2, F.4.1, D.1.6 ISSN ISBN-10 ISBN-13
0302-9743 3-540-28538-5 Springer Berlin Heidelberg New York 978-3-540-28538-0 Springer Berlin Heidelberg New York
This work is subject to copyright. All rights are reserved, whether the whole or part of the material is concerned, specifically the rights of translation, reprinting, re-use of illustrations, recitation, broadcasting, reproduction on microfilms or in any other way, and storage in data banks. Duplication of this publication or parts thereof is permitted only under the provisions of the German Copyright Law of September 9, 1965, in its current version, and permission for use must always be obtained from Springer. Violations are liable to prosecution under the German Copyright Law. Springer is a part of Springer Science+Business Media springeronline.com c Springer-Verlag Berlin Heidelberg 2005
Printed in Germany Typesetting: Camera-ready by author, data conversion by Scientific Publishing Services, Chennai, India Printed on acid-free paper SPIN: 11546207 06/3142 543210
Preface
These are the proceedings of the 8th International Conference on Logic Programming and Nonmonotonic Reasoning (LPNMR 2005). Following the previous ones held in Washington, DC, USA (1991), Lisbon, Portugal (1993), Lexington, KY, USA (1995), Dagstuhl, Germany (1997), El Paso, TX, USA (1999), Vienna, Austria (2001) and Ft. Lauderdale, FL, USA (2004), the eighth conference was held in Diamante, Italy, from 5th to 8th of September 2005. The aim of the LPNMR conferences is to bring together and facilitate interactions between active researchers interested in all aspects concerning declarative logic programming, nonmonotonic reasoning, knowledge representation, and the design of logic-based systems and database systems. LPNMR strives to encompass theoretical and experimental studies that lead to the implementation of practical systems for declarative programming and knowledge representation. The technical program of LPNMR 2005 comprised three invited talks that were given by J¨ urgen Angele, Thomas Eiter and Michael Kifer. All papers presented at the conference and published in these proceedings went through a rigorous review process which selected 25 research papers and 16 papers for the system and application tracks. Many individuals worked for the success of the conference. Special thanks are due to all members of the Program Committee and to additional reviewers for their efforts to produce fair and thorough evaluations of submitted papers. A special thanks is due to the University of Calabria Organizing Committee which made this event possible. Last, but not least, we thank the sponsoring institutions for their generosity.
June 2005
Chitta Baral and Nicola Leone Program Co-chairs LPNMR’05
Organization
LPNMR 2005 was organized by the Department of Mathematics at the University of Calabria, Italy.
Program Co-chairs Chitta Baral (Arizona State University, USA) Nicola Leone (University of Calabria, Italy)
Program Committee Jose Alferes (New University of Lisbon, Portugal) Leopoldo Bertossi (Carleton University, Canada) Pedro Cabalar (Corunna University, Spain) Gerhard Brewka (University of Leipzig, Germany) Juergen Dix (Technical University of Clausthal, Germany) Wolfgang Faber (University of Calabria, Italy) Norman Foo (University of New South Wales, Australia) Michael Gelfond (Texas Tech University, USA) Antonis Kakas (University of Cyprus, Cyprus) Katsumi Inoue (Kobe University, Japan) Vladimir Lifschitz (University of Texas at Austin, USA) Fangzhen Lin (Hong Kong University of Science and Technology, China) Ilkka Niemel¨ a (Helsinki University of Technology, Finland) David Pearce (Rey Juan Carlos University, Spain) Alessandro Provetti (University of Messina, Italy) Francesco Scarcello (University of Calabria, Italy) Torsten Schaub (University of Potsdam, Germany) Hans Tompits (Vienna University of Technology, Austria) Francesca Toni (Imperial College London, UK) Mirek Truszczynski (University of Kentucky, USA) Marina de Vos (University of Bath, United Kingdom)
Committee for the System and Application Tracks Gerald Pfeifer (SUSE/Novell) - [chair] Marcello Balduccini (Texas Tech University) Yuliya Lierler (Universit¨ at Erlangen) Ilkka Niemel¨ a (Helsinki University of Technology) Yuting Zhao (Istituto Trentino di Cultura)
VIII
Organization
Publicity Chair Gianluigi Greco (University of Calabria, Italy)
Organizing Co-chairs Giovambattista Ianni (University of Calabria, Italy) Giorgio Terracina (University of Calabria, Italy)
Organizing Committee Francesco Calimeri Mina Catalano Chiara Cumbo Tina Dell’Armi
Stefania Galizia Gianluigi Greco Giuseppe Ielpa Vincenzino Lio
Simona Perri Veronica Policicchio Francesco Ricca Paola Sdao
Paolo Ferraris Michael Fink Martin Gebser Gianluigi Greco Keijo Heljanko Koji Iwanuma Tomi Janhunen Joohyung Lee Jo˜ ao Leite Lengning Liu Massimo Marchi Victor Marek Yves Martin Thomas Meyer Rob Miller
Emilia Oikarinen Philip Reiser Fariba Sadri Chiaki Sakama Ken Satoh Juan Manuel Serrano Tommi Syrj¨anen Giorgio Terracina Satoshi Tojo Richard Watson Gregory Wheeler Stefan Woltran Ester Zumpano
External Referees Jo˜ ao Alcˆantara Christian Anger Marcello Balduccini Federico Banti Andrea Bracciali Martin Brain Loreto Bravo Andreas Bruening Francesco Buccafurri Stefania Costantini Carlos Damasio Yannis Dimopoulos Phan Minh Dung Ulle Endriss Esra Erdem
Table of Contents
Invited Papers Nonmonotonic Reasoning in FLORA-2 Michael Kifer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1
Data Integration and Answer Set Programming Thomas Eiter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
13
Halo I: A Controlled Experiment for Large Scale Knowledge Base Development J¨ urgen Angele, Eddie Moench, Henrik Oppermann, Dirk Wenke . . . . .
26
ASP Foundations Unfounded Sets for Disjunctive Logic Programs with Arbitrary Aggregates Wolfgang Faber . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
40
Loops: Relevant or Redundant? Martin Gebser, Torsten Schaub . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
53
Approximating Answer Sets of Unitary Lifschitz-Woo Programs Victor W. Marek, Inna Pivkina, Miroslaw Truszczy´ nski . . . . . . . . . . . . .
66
On Modular Translations and Strong Equivalence Paolo Ferraris . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
79
ASP Extensions Guarded Open Answer Set Programming Stijn Heymans, Davy Van Nieuwenborgh, Dirk Vermeir . . . . . . . . . . . . .
92
External Sources of Computation for Answer Set Solvers Francesco Calimeri, Giovambattista Ianni . . . . . . . . . . . . . . . . . . . . . . . . . 105 Answer Sets for Propositional Theories Paolo Ferraris . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
X
Table of Contents
Applications An ID-Logic Formalization of the Composition of Autonomous Databases Bert Van Nuffelen, Ofer Arieli, Alvaro Cort´es-Calabuig, Maurice Bruynooghe . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132 On the Local Closed-World Assumption of Data-Sources Alvaro Cort´es-Calabuig, Marc Denecker, Ofer Arieli, Bert Van Nuffelen, Maurice Bruynooghe . . . . . . . . . . . . . . . . . . . . . . . . . . 145 Computing Dialectical Trees Efficiently in Possibilistic Defeasible Logic Programming Carlos I. Ches˜ nevar, Guillermo R. Simari, Lluis Godo . . . . . . . . . . . . . 158
Actions and Causations An Approximation of Action Theories of AL and Its Application to Conformant Planning Tran Cao Son, Phan Huy Tu, Michael Gelfond, A. Ricardo Morales . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172 Game-Theoretic Reasoning About Actions in Nonmonotonic Causal Theories Alberto Finzi, Thomas Lukasiewicz . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185 Some Logical Properties of Nonmonotonic Causal Theories Marek Sergot, Robert Craven . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 198 Modular-E: An Elaboration Tolerant Approach to the Ramification and Qualification Problems Antonis Kakas, Loizos Michael, Rob Miller . . . . . . . . . . . . . . . . . . . . . . . . 211
Algorithms and Computation Platypus: A Platform for Distributed Answer Set Solving Jean Gressmann, Tomi Janhunen, Robert E. Mercer, Torsten Schaub, Sven Thiele, Richard Tichy . . . . . . . . . . . . . . . . . . . . . . . 227 Solving Hard ASP Programs Efficiently Wolfgang Faber, Francesco Ricca . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 240 Mode-Directed Fixed Point Computation Hai-Feng Guo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 253
Table of Contents
XI
Lookahead in Smodels Compared to Local Consistencies in CSP Jia-Huai You, Guohua Liu, Li Yan Yuan, Curtis Onuczko . . . . . . . . . . 266
Foundations Nested Epistemic Logic Programs Kewen Wang, Yan Zhang . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 279 An Algebraic Account of Modularity in ID-Logic Joost Vennekens, Marc Denecker . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 291 Default Reasoning with Preference Within Only Knowing Logic Iselin Engan, Tore Langholm, Espen H. Lian, Arild Waaler . . . . . . . . . 304
Semantics A Social Semantics for Multi-agent Systems Francesco Buccafurri, Gianluca Caminiti . . . . . . . . . . . . . . . . . . . . . . . . . . 317 Revisiting the Semantics of Interval Probabilistic Logic Programs Alex Dekhtyar, Michael I. Dekhtyar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 330 Routley Semantics for Answer Sets Sergei Odintsov, David Pearce . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 343 The Well Supported Semantics for Multidimensional Dynamic Logic Programs Federico Banti, Jos´e J´ ulio Alferes, Antonio Brogi, Pascal Hitzler . . . . . 356
Application Track Application of Smodels in Quartet Based Phylogeny Construction Gang Wu, Jia-Huai You, Guohui Lin . . . . . . . . . . . . . . . . . . . . . . . . . . . . 369 Using Answer Set Programming for a Decision Support System Christoph Beierle, Oliver Dusso, Gabriele Kern-Isberner . . . . . . . . . . . . 374 Data Integration: A Challenging ASP Application Nicola Leone, Thomas Eiter, Wolfgang Faber, Michael Fink, Georg Gottlob, Luigi Granata, Gianluigi Greco, Edyta Kalka, Giovambattista Ianni, Domenico Lembo, Maurizio Lenzerini, Vincenzino Lio, Bartosz Nowicki, Riccardo Rosati, Marco Ruzzi, Witold Staniszkis, Giorgio Terracina . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 379
XII
Table of Contents
Abduction and Preferences in Linguistics Kathrin Konczak, Ralf Vogel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 384 Inference of Gene Relations from Microarray Data by Abduction Irene Papatheodorou, Antonis Kakas, Marek Sergot . . . . . . . . . . . . . . . . 389
System Track nomore< : A System for Computing Preferred Answer Sets Susanne Grell, Kathrin Konczak, Torsten Schaub . . . . . . . . . . . . . . . . . . 394 Integrating an Answer Set Solver into Prolog: ASP − PROLOG Omar Elkhatib, Enrico Pontelli, Tran Cao Son . . . . . . . . . . . . . . . . . . . . 399 circ2dlp — Translating Circumscription into Disjunctive Logic Programming Emilia Oikarinen, Tomi Janhunen . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 405 Pbmodels — Software to Compute Stable Models by Pseudoboolean Solvers Lengning Liu, Miroslaw Truszczy´ nski . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 410 KMonitor – A Tool for Monitoring Plan Execution in Action Theories Thomas Eiter, Michael Fink, J´ an Senko . . . . . . . . . . . . . . . . . . . . . . . . . . 416 The nomore++ System Christian Anger, Martin Gebser, Thomas Linke, Andr´e Neumann, Torsten Schaub . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 422 SmodelsA — A System for Computing Answer Sets of Logic Programs with Aggregates Islam Elkabani, Enrico Pontelli, Tran Cao Son . . . . . . . . . . . . . . . . . . . 427 A DLP System with Object-Oriented Features Francesco Ricca, Nicola Leone, Valerio De Bonis, Tina Dell’Armi, Stefania Galizia, Giovanni Grasso . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 432 Testing Strong Equivalence of Datalog Programs - Implementation and Examples Thomas Eiter, Wolfgang Faber, Patrick Traxler . . . . . . . . . . . . . . . . . . . . 437 SELP - A System for Studying Strong Equivalence Between Logic Programs Yin Chen, Fangzhen Lin, Lei Li . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 442
Table of Contents
XIII
cmodels – SAT-Based Disjunctive Answer Set Solver Yuliya Lierler . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 447 Author Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 453
Nonmonotonic Reasoning in FLORA-2 Michael Kifer Department of Computer Science, State University of New Your at Stony Brook, Stong Brook, NY 11794, USA
[email protected] Abstract. FLORA-2 is an advanced knowledge representation system that integrates F-logic, HiLog, and Transaction Logic. In this paper we give an overview of the theoretical foundations of the system and of some of the aspects of nonmonotonic reasoning in FLORA-2. These include scoped default negation, behavioral inheritance, and nonmonotonicity that stems from database dynamics.
1
Introduction
FLORA-2 is a knowledge base engine and a complete environment for developing knowledge-intensive applications. It integrates F-logic with other novel formalisms such as HiLog and Transaction Logic. FLORA-2 is freely available on the Internet1 and is in use by a growing research community. Many of the features of FLORA-2 have been adopted by the recently proposed languages in the Semantic Web Services domain: WSML-Rule2 and SWSL-Rules.3 One of the main foundational ingredients of FLORA-2, F-logic [20], extends classical predicate calculus with the concepts of objects, classes, and types, which are adapted from object-oriented programming. In this way, F-logic integrates the paradigms of logic programming and deductive databases with the objectoriented programming paradigm. Most of the applications of F-logic have been in intelligent information systems, but more recently it has been used to represent ontologies and other forms of Semantic Web reasoning [14,12,27,1,11,2,19]. HiLog [8] is an extension of the standard predicate calculus with higherorder syntax. Yet the semantics of HiLog remains first-order and tractable. In FLORA-2, HiLog is the basis for simple and natural querying of term structures and for reification (or objectification) of logical statements, which is an important requirement for a Semantic Web language. Transaction Logic [6] provides the basis for declarative programming of “procedural knowledge” that is often embedded in intelligent agents or Semantic Web services. In this paper we first survey the main features of FLORA-2 and then discuss three forms of nonmonotonic reasoning provided by the system. 1 2 3
This work was supported in part by NSF grant CCR-0311512 and by U.S. Army Medical Research Institute under a subcontract through Brookhaven National Lab. http://flora.sourceforge.net/ http://www.w3.org/Submission/WSML/ http://www.daml.org/services/swsl-rules/1.0/
C. Baral et al. (Eds.): LPNMR 2005, LNAI 3662, pp. 1–12, 2005. c Springer-Verlag Berlin Heidelberg 2005
2
M. Kifer
2
Overview of F-Logic
F-logic extends predicate calculus both syntactically and semantically. It has a monotonic logical entailment relationship, and its proof theory is sound and complete with respect to the semantics. F-logic comes in two flavors: the firstorder flavor and the logic programming flavor. The first-order flavor of F-logic can be viewed as a syntactic variant of classical logic [20]. The logic programming flavor uses a subset of the syntax of F-logic, but gives it a different, non-firstorder semantics by interpreting the negation operator as negation-as-failure. The relationship between the first-order variant of F-logic and its logic programming variant is similar to the relationship between predicate calculus and standard logic programming [23]: object-oriented logic programming is built on the rule-based subset of F-logic by adding the appropriate non-monotonic extensions [32,33,24]. These extensions are intended to capture the semantics of negation-as-failure (like in standard logic programming [28]) and the semantics of multiple inheritance with overriding (which is not found in standard logic programming). F-logic uses first-order variable-free terms to represent object identity (abbr., OID); for instance, John and father(Mary) are possible Ids of objects. Objects can have attributes. For instance, Mary[spouse -> John, children -> {Alice,Nancy}]. Mary[children -> Jack]. Such formulas are called F-logic molecules. The first formula says that object Mary has an attribute spouse whose value is the OID John. It also says that the attribute children is set-valued and its value is a set that contains two OIDs: Alice and Nancy. We emphasize “contains” because sets do not need to be specified all at once. For instance, the second formula above says that Mary has an additional child, Jack. In earlier versions of F-logic, set-valued attributes were denoted with ->> instead of -> . However, subsequently the syntax was modernized and simplified. Instead of using different arrows, cardinality constraints (to be explained shortly) were introduced to indicate that an attribute is single-valued. While some attributes of an object are specified explicitly, as facts, other attributes can be defined using deductive rules. For instance, we can derive John[children -> {Alice,Nancy,Jack}] using the following deductive rule: ?X[children -> {?C}] :- ?Y[spouse -> ?X, children -> {?C}]. In the new and simplified syntax, alphanumeric symbols prefixed with the ?sign denote variables and unprefixed alphanumeric symbols denote constants (i.e., OIDs). The earlier versions of FLORA-2 used Prolog conventions where variables were capitalized alphanumeric symbols. F-logic objects can also have methods, which are functions that take arguments. For instance, John[grade(cs305,fall2004) -> 100, courses(fall2004) -> {cs305,cs306}].
Nonmonotonic Reasoning in FLORA-2
3
says that John has a method, grade, whose value on the arguments cs305 (a course identifier) and fall2004 (a semester designation) is 100; it also has a set-valued method courses, whose value on the argument fall2004 is a set of OIDs that contains course identifiers cs305 and cs306. Like attributes, methods can be defined using deductive rules. The F-logic syntax for class membership is John:student and for subclass relationship it is student::person. Classes are treated as objects and it is possible for the same object to play the role of a class in one formula and of an object in another. For instance, in the formula student:class, the symbol student plays the role of an object, while in student::person it appears in the role of a class. F-logic also provides means for specifying schema information through signature formulas. For instance, person[spouse {0:1} => person, name {0:1} => string, child => person] is a signature formula that says that class person has three attributes: single-valued attributes spouse and name (single-valuedness is indicated by the cardinality constraint 0:1) and a set-valued attribute child. It further says that the first attribute returns objects of type person, the second of type string, and the last returns sets of objects such that each object in the set is of type person.
3
HiLog and Meta-information
F-logic provides simple and natural means for exploring the structure of object data. Both the schema information associated with classes and the structure of individual objects can be queried by simply putting variables in the appropriate syntactic positions. For instance, to find the set-valued methods that are defined in the schema of class student and return objects of type person, one can ask the following query: ?- student[?M => person]. The next query is about the type of the results of the attribute name in class student. This query also returns all the superclasses of class student. ?- student::?C and student[name => ?T]. The above are schema-level meta-queries: they involve the subclass relationship and the type information. One can also pose meta-queries that involve object data (rather than schema). The following queries return the methods that have a known value for the object John: ?- John[?Meth -> ?SomeValue]. However, the meta-query facilities of F-logic are not complete. For instance, there is no way in such queries to separate method names from their arguments. Thus, if we had a fact of the form John[age(2005) -> 20].
4
M. Kifer
then the first of the above queries will bind ?Meth to age(2005)—we cannot separate age from 2005. This is where HiLog [8] comes into picture. In HiLog, second-order syntax is allowed and so variables can appear in positions of function and predicate symbols. For instance, queries such as ?- person[?M(?Arg) -> ?SomeValue]. ?- person[?M(?Arg) => integer]. are allowed and ?M would be bound to age and, possibly, to other values as well. The semantics for this second-order syntax is first order, however. Roughly it means that variables get bound not to the extensional values of the symbols (i.e., the actual relations that are used to interpret the function and predicate symbols), but to the symbols themselves. Details of these semantics can be found in [8]. HiLog does not stop at allowing variables over function and predicate symbols—it also permits them over atomic formulas. For instance, the following query is legal and will succeed with ?X bound to p(a). p(a). q(p(a)). ?- q(?X), ?X. What happens here is that the proposition p(a) is reified (made into an object) and so it can be bound to a variable. HiLog’s reification of atomic formulas can be extended to arbitrary quantifier-free formula of the rule-based subset of HiLog and F-logic, and this has been done in [31,19]. For instance, one can say that John believes that Mary likes Sally as follows: John[believes -> ${Mary[likes -> Sally]}].
(1)
Here ${...} is the syntax that FLORA-2 uses to denote reified statements. An example of a more complicated reified statement is this: John[believes -> ${Bob[likes -> ?X] : − Mary[likes -> ?X]}].
(2)
This sentence reifies a rule (not just a fact) and states that John also believes that Bob likes anybody who is liked by Mary. Combined with the previous statement that John believes that Mary likes Sally, one would expect that John would also believe that Bob likes Sally. However, we cannot conclude this just yet because we do not know that John is a rational being who applies modus ponens in his daily life. But this rational principle can be stated rather easily: John[believes -> ?A] : − John[believes -> {${?Head : − ?Body}, ?Body}].
4
(3)
Transaction Logic
Knowledge intensive applications, such as those in semantic Web services and intelligent agents, often require primitives for modifying the underlying state
Nonmonotonic Reasoning in FLORA-2
5
of the system. Prolog provides the well-known assert and retract operators, which are non-logical and are therefore widely viewed as problematic. Various attempts to formalize updates in a logic programming language have had only a limited success (e.g., [21,26,22]). A detailed discussion of this subject appears in [5,6]. Some of the most serious problems with these approaches is that they impose special programming styles (which is a significant burden) and that they do not support subroutines — one of the most fundamental aspects of any programming language. Transaction Logic [4,5,6] is a comprehensive solution to the problem of updates in logic programming. This solution has none of the above drawbacks and it fits nicely with the traditional theory of logic programming. The use of Transaction Logic has been illustrated on a vast variety of applications, ranging from databases to robot action planning to reasoning about actions to workflow analysis and Web services [5,7,10,19]. An important aspect of the update semantics of Transaction Logic is that updates are atomic, which means that an update transaction executes in its entirety or not at all. In contrast, in Prolog, if a post-condition of a statechanging predicate is false, the execution “fails” but the changes made by assert and retract would stay and the knowledge base is left in a inconsistent state. This property is responsible for many complications in Prolog programming. This and related problems are rectified by Transaction Logic semantics. FLORA-2 integrates F-logic and Transaction Logic along the lines of [18] with certain refinements that distinguish queries from transactions and thus enable a number of compile-time checks. In Transaction Logic, both actions (transactions) and queries are represented as predicates. In FLORA-2, transactions are expressed as object methods that are prefixed with the special symbol “%”. The following program is an implementation of a block-stacking robot in FLORA-2. Here, the action stack is defined as a Boolean method of the robot. ?R[%stack(0, ?X)] : − ?R:robot. ?R[%stack(?N, ?X)] : − ?R:robot, ?N > 0, ?Y[%move(?X)], ?R[%stack(?N − 1, ?Y)]. ?Y[%move(?X)] : − ?Y:block, ?Y[clear], ?X[clear], ?X[widerThen(?Y)], btdelete{?Y[on -> ?Z]}, btinsert{?Z[clear]}, btinsert{?Y[on -> ?X]}, btdelete{?X[clear]}. The primitives btdelete and btinsert are FLORA-2’s implementations of the insert and delete operators with the Transaction Logic semantics. Informally, the above rules say that to stack a pyramid of N blocks on top of block ?X, the robot must find a block ?Y, move it onto ?X, and then stack N-1 blocks on top of ?Y. To move ?Y onto ?X, both blocks must be “clear” (i.e., with no other block sitting on top of them), and ?X must be wider than ?Y. If these conditions are met, the database will be updated accordingly. If any of the conditions fails, it means that the current attempted execution is not a valid try and another attempt will be made. If no valid execution is found, the transaction fails and no changes will be made to the database.
6
M. Kifer
A simple-minded translation of the above program into Prolog is incorrect, since such a program might leave the database in an inconsistent state. A correct version of the above FLORA-2 program in Prolog is more complicated and much less natural.
5
Scoped Default Negation
Closed world assumption [25] is an inference rule for negative information. It states that in the absence of a positive proof that a fact, F, is true one must conclude that not F is true. Negation that obeys such an inference rule is not classical and is often called default negation.4 Various forms of the closed-world assumption (CWA) have been successfully used in database and logic programing applications for over thirty years now and vast experience has been accumulated with the use of this paradigm in knowledge representation [9,28,16]. In contrast, classical logic is based on the open-world assumption (OWA), and this has been the sine qua non in, for example, the description logic community. Each community allowed the other to continue to believe in its respective heresy until the Semantic Web came along. The advent of the Semantic Web caused heated discussions about the one and only kind of negation that is suitable for this emerging global knowledge base (see, e.g., http://robustai.net/papers/Monotonic Reasoning on the Semantic Web. html for a compendium). The main argument against closed-world assumption goes like this. The Web is practically infinite and failure to derive some fact from the currently obtained information does not warrant the conclusion that this fact is false. Nevertheless, thirty years of experience in practical knowledge representation cannot be dismissed lightly and even the proponents of the openworld assumption are beginning to realize that. One idea that is beginning to take hold is that CWA is acceptable—even in the Web environment—as long as the scope of the closure is made explicit and concrete [17]. A simplified form of this idea was recently added to the N3 rule language [3] (whose author, Tim Berners-Lee, previously resisted the use of default negation). Scoped default negation was introduced in FLORA-2 as part of its innovative architecture for knowledge base modules. It is related to (but is different from) the so called local closed world assumption [13]. In FLORA-2, a module is a container for a concrete knowledge base (or a part of it). Modules isolate the different parts of a knowledge base and provide a clean interface by which these parts can interact. Modules can be created dynamically, associated with knowledge bases on the fly, and they support a very powerful form of encapsulation. For our discussion, the relevant aspect of the FLORA-2 modules is that they provide a simple and natural mechanism for scoped default negation. Consider the statements (1), (2), and (3) about John’s beliefs from the end of Section 3. To use these statements, one must insert them into a module, 4
Some researchers also sometimes call this type of negation negation-as-failure. We avoid this terminology because negation-as-failure was originally used to denote a specific proof strategy used in the Prolog language.
Nonmonotonic Reasoning in FLORA-2
7
let us call it johnmodule, by, for instance, loading the file that contains these statements into the module. To query the information about John’s beliefs one would now pose queries such as ?- John[believes -> ${Mary[likes->Sally]}]@johnmodule. Similarly, to inquire whether John does not believe that Bob is Sally’s husband one would ask the query ? − not John[believes -> ${Sally[spouse ->Bob]}]@johnmodule.
(4)
The scope of the above query is limited to the module johnmodule only. If it cannot be derived that John[believes->${Sally[spouse->Bob]}] is true from the knowledge base residing in the module then (and only then) the answer will be “Yes.” The answer to (4) will remain the same even if some other module asserts that John[believes->${Sally[spouse->Bob]}] because the scope of the default negation in the query is limited to the module johnmodule. It is, however, possible to ask unrestricted negative queries by placing a variable in the module position: ?- not John[believes -> ${Sally[spouse->Bob]}]@?Mod. This query returns “Yes” iff John is not known to believe that Sally[spouse-> Bob] is true in every module (that is registered with the system). The semantics of FLORA-2 modules is very simple. The attribute and method names of the formulas that are loaded into a module, such as john module, are uniquified so that the same attribute name in the program will be given different and unique real names in different modules. For instance, a formula such as John[believes->abc] might become John[believes#foo->abc] in module foo and John[believes#bar->abc] in module bar. Due to this transformation, the query (4) turns into the following query in the actual knowledge base: ?- not John[believes#johnmodule-> ${Sally[spouse#johnmodule->Bob]}].
Since other modules cannot have facts or rules whose heads have the form ...[believes#johnmodule->...], the answer “Yes” or “No” depends only on the information stored in module johnmodule.
6
Nonmonotonic Inheritance
F-logic supports both structural and behavioral inheritance. The former refers to inheritance of method types from superclasses to their subclasses and the latter deals with inheritance of method definitions from superclasses to subclasses. Structural inheritance is defined by very simple inference rules: If subcl::cl, cl[attr => type] then subcl[attr => type] If obj:cl, cl[attr => type] then obj[attr => type]
8
M. Kifer
The statement cl[attr => type] above says that attr is an inheritable attribute, which means that both its type and value are inheritable by the subclasses and members of class cl. Inheritability of the type of an attribute is indicated with the star attached to the arrow: => . In all of our previous examples we have been dealing with non-inheritable attributes, which were designated with star-less arrows. Note that when the type of an attribute is inherited to a subclass it remains inheritable. However, when it is inherited to a member of the class it is no longer inheritable. Type inheritance, as defined by the above rules, is monotonic and thus is peripheral to the subject of this paper. Behavioral inheritance is more complex. To get a flavour of behavioral inheritance, consider the following knowledge base: royalElephant::elephant. clyde:royalElephant. elephant[color ->grey]. royalElephant[color -> white]. As with type definitions, a star attached to the arrow -> indicates inheritability. For instance, color is an inheritable attribute in classes elephant and royalElephant. The inference rule that guides behavioral inheritance can informally be stated as follows. If obj is an object and cl is a class, then obj:cl, cl[attr -> value]
should imply
obj[attr -> value]
unless the inheritance is overwritten by a more specific class. The meaning of the exception here is that the knowledge base should not imply the formula obj[attr -> value] if there is an intermediate class, cl , which overrides the inheritance, i.e., if obj : cl , cl :: cl are true and cl [attr -> value] (for some value = value) is defined explicitly.5 A similar exception exists in case of multiple inheritance conflicts. Note that inheritable attributes become non-inheritable after they are inherited by class members. In the above case, inheritance of the color grey is overwritten by the color white and so clyde[color -> white] is derived by the rule of inheritance. This type of inheritance is clearly nonmonotonic. For instance, if in the above example we add the fact clyde[color->yellow] to the knowledge base then clyde[color->white] is no longer inferred by inheritance (the inference is said to be overwritten). Model-theoretic semantics for nonmonotonic inference by inheritance is rather subtle and has eluded researchers for many years. Although the above informal rules for inference by inheritance seem natural, there are subtle problems when behavioral inheritance is used together with deductive rules. To understand the problem, consider the following example: cl[attr -> v1]. subcl::cl. 5
The notion of an explicit definition seems obvious at first but, in fact, is quite subtle. Details can be found in [29].
Nonmonotonic Reasoning in FLORA-2
9
obj:subcl. subcl[attr -> v2] :- obj[attr -> v1]. If we apply the rule of inheritance to this knowledge base, then obj[attr -> v1] should be inherited, since no overriding takes place. However, once obj[attr -> v1] is derived by inheritance, subcl[attr -> v2] can be derived by deduction—and now we have a chicken-and-egg problem. Since subcl is a more specific superclass of obj, the derivation of subcl[attr -> v2] appears to override the earlier inheritance of obj[attr -> v1]. But this, in turn, undermines the very reason for deriving subcl[attr -> v2]. The above is only one of several suspicious derivation patterns that arise due to interaction of inheritance and deduction. The original solution reported in [20] was not model-theoretic and was problematic in several other respects as well. A satisfactory and completely model-theoretic solution was proposed in [29,30].
7
Database Dynamics and Nonmonotonicity
In [5], a generalization of the perfect-model semantics was defined for Transaction Logic programs with negation in the rule body. This semantics was implemented in FLORA-2 only partially, with negation applicable only to non-transactional formulas in the rule body. For instance, the following transaction logs all unauthorised accesses to any given resource, and default negation, not, is applied only to a query (not an action that has a side effect): ?Rsrc[%recordUnauthAaccess(?Agent)] : − not ?Rsrc[eligible -> ?Agent], insert{unAuthLog(?Agent, ?Rsrc)}.
(5)
Nonmonotonicity comes into play here in a somewhat different sense than in standard logic programming (ignoring the non-logical assert and retract). In the standard case, nonmonotonicity means that certain formulas that were derivable in a database state, s1, will not be derivable in the state obtained from s1 by adding more facts. In the above example, however, no inference that was enabled by rule (5) can become invalidated by adding more facts, since this rule is not a statement about the initial database state. In our example, nonmonotonicity reveals itself in a different way: the transaction of the form ?- mySecrets[%recordUnauthAaccess(John)] can be executable in the initial state (if mySecrets[eligible->John] is not derivable) and non-executable in the state obtained by adding mySecrets[eligible->John] to the original state. This kind of non-monotonicity can be stated formally in the logic as: there are database states D and D , where D⊆ D , such that D--- |= mySecrets[%recordUnauthAaccess(John)] but
D |= not ♦ mySecrets[%recordUnauthAaccess(John)]
10
M. Kifer
The first statement above is called executional entailment ; it means that there is a sequence of states, beginning with the given state D, which represents an execution path of the transaction mySecrets[%recordUnauthAaccess(John)]. The second statement says that there is no execution path, which starts at state D , for the transaction mySecrets[%recordUnauthAaccess(John)]. Another instance of nonmonotonic behavior that is different from the classical cases occurs when enlarging the initial state of transaction execution leads to a possible elimination of facts in the final state of transaction execution. To illustrate this, consider a slightly modified version of transaction (5): ?Rsrc[%recordUnauthAaccess(?Agent)] :not ?Rsrc[eligible->?Agent], insert{unAuthLog(?Agent,?Rsrc)}. ?Rsrc[%recordUnauthAaccess(?Agent)] :- ?Rsrc[eligible->?Agent].
In this case, the transaction ?- mySecrets[%recordUnauthAaccess(John)] can be executed regardless of whether John is eligible or not. If John is not eligible then unAuthLog(John,mySecrets) becomes true in the final state of the execution of this transaction. If John is already eligible then nothing changes. Now, if we add the fact that John is eligible to access mySecrets then the transaction executes without changing the state. Therefore, unAuthLog(John,mySecrets) is no longer derivable in the final state. Thus, enlarging the initial state of transaction execution does not necessarily lead to a monotonic enlargement of the final state.
8
Conclusion
This paper presents an overview of the formal foundations of the FLORA-2 system with a focus on various forms of nonmonotonic reasoning in the system. Three aspects have been considered: scoped default negation, behavioral inheritance, and nonmonotonicity that stems from database dynamics. Scoped negation is believed to be the right kind of negation for the Semantic Web. Behavioral inheritance is an important concept in object-oriented modeling; in FLORA-2 it has been extended to work correctly (from the semantic point of view) in a rule-based system. Finally, we discussed database dynamics in FLORA-2 and have shown how it can lead to of nonmonotonic behavior.
References 1. J. Angele and G. Lausen. Ontologies in F-logic. In S. Staab and R. Studer, editors, Handbook on Ontologies in Information Systems, pages 29–50. Springer Verlag, Berlin, Germany, 2004. 2. D. Berardi, H. Boley, B. Grosof, M. Gruninger, R. Hull, M. Kifer, D. Martin, S. McIlraith, J. Su, and S. Tabet. SWSL: Semantic Web Services Language. Technical report, Semantic Web Services Initiative, April 2005. http://www.daml.org/services/swsl/. 3. T. Berners-Lee. Primer: Getting into RDF & Semantic Web using N3, 2004. http://www.w3.org/2000/10/swap/Primer.html.
Nonmonotonic Reasoning in FLORA-2
11
4. A. Bonner and M. Kifer. An overview of transaction logic. Theoretical Comput. Sci., 133:205–265, October 1994. 5. A. Bonner and M. Kifer. Transaction logic programming (or a logic of declarative and procedural knowledge). Technical Report CSRI-323, University of Toronto, November 1995. http://www.cs.toronto.edu/˜bonner/ transaction-logic.html. 6. A. Bonner and M. Kifer. A logic for programming database transactions. In J. Chomicki and G. Saake, editors, Logics for Databases and Information Systems, chapter 5, pages 117–166. Kluwer Academic Publishers, March 1998. 7. A. Bonner and M. Kifer. Results on reasoning about action in transaction logic. In [15]. Springer-Verlag, 1998. 8. W. Chen, M. Kifer, and D. Warren. HiLog: A foundation for higher-order logic programming. Journal of Logic Programming, 15(3):187–230, February 1993. 9. K. Clark. Negation as failure. In H. Gallaire and J. Minker, editors, Logic and Data Bases, pages 292–322. Plenum Press, 1978. 10. H. Davulcu, M. Kifer, C. Ramakrishnan, and I. Ramakrishnan. Logic based modeling and analysis of workflows. In ACM Symposium on Principles of Database Systems, pages 25–33, Seattle, Washington, June 1998. 11. J. de Bruijn, H. Lausen, R. Krummenacher, A. Polleres, L. Predoiu, and D. Fensel. The WSML family of representation languages. Technical report, DERI, March 2005. http://www.wsmo.org/TR/d16/d16.1/. 12. S. Decker, D. Brickley, J. Saarela, and J. Angele. A query and inference service for RDF. In QL’98 - The Query Languages Workshop, December 1998. 13. O. Etzioni, K. Golden, and D. Weld. Sound and effcient closed-world reasoning for planning Artificial Intelligence. Artificial Intelligence, 89(1-2):113–148, 1997. 14. D. Fensel, M. Erdmann, and R. Studer. OntoBroker: How to make the WWW intelligent. In Proceedings of the 11th Banff Knowledge Acquisition for KnowledgeBased Systems Workshop, Banff, Canada, 1998. 15. B. Freitag, H. Decker, M. Kifer, and A. Voronkov, editors. Transactions and Change in Logic Databases, volume 1472 of LNCS. Springer-Verlag, Berlin, 1998. 16. M. Gelfond and V. Lifschitz. The stable model semantics for logic programming. In Logic Programming: Proceedings of the Fifth Conference and Symposium, pages 1070–1080, 1988. 17. S. Hawke, S. Tabet, and C. de Sainte Marie. Rule Language Standardization: Report from the W3C Workshop on Rule Languages for Interoperability, May 2005. http://www.w3.org/2004/12/rules-ws/report/. 18. M. Kifer. Deductive and object-oriented data languages: A quest for integration. In Int’l Conference on Deductive and Object-Oriented Databases, volume 1013 of Lecture Notes in Computer Science, pages 187–212, Singapore, December 1995. Springer-Verlag. Keynote address at the 3d Int’l Conference on Deductive and Object-Oriented databases. 19. M. Kifer, R. Lara, A. Polleres, and C. Zhao. A logical framework for web service discovery. In ISWC 2004 Semantic Web Services Workshop. CEUR Workshop Proceedings, November 2004. 20. M. Kifer, G. Lausen, and J. Wu. Logical foundations of object-oriented and framebased languages. Journal of ACM, 42:741–843, July 1995. 21. R. Kowalski. Database updates in event calculus. Journal of Logic Programming, 12(1&2):121–146, January 1992. 22. G. Lausen and B. Lud¨ ascher. Updates by reasoning about states. In 2-nd International East/West Database Workshop, Klagenfurt, Austria, September 1994.
12
M. Kifer
23. J. W. Lloyd. Foundations of Logic Programming (Second, extended edition). Springer series in symbolic computation. Springer-Verlag, New York, 1987. 24. Ontoprise, GmbH. OntoBroker Manual. http://www.ontoprise.com/. 25. R. Reiter. On closed world databases. In H. Gallaire and J. Minker, editors, Logic and Databases, pages 55–76. Plenum Press, New York, 1978. 26. R. Reiter. Formalizing database evolution in the situation calculus. In Conference on Fifth Generation Computer Systems, 1992. 27. S. Staab and A. Maedche. Knowledge portals: Ontologies at work. The AI Magazine, 22(2):63–75, 2000. 28. A. Van Gelder, K. Ross, and J. S. Schlipf. The well-founded semantics for general logic programs. J. ACM, 38(3):620–650, July 1991. 29. G. Yang and M. Kifer. Well-founded optimism: Inheritance in frame-based knowledge bases. In Intl. Conference on Ontologies, DataBases, and Applications of Semantics for Large Scale Information Systems (ODBASE), October 2002. 30. G. Yang and M. Kifer. Inheritance and rules in object-oriented semantic Web languages. In Rules and Rule Markup Languages for the Semantic Web (RuleML03), volume 2876 of Lecture Notes in Computer Science. Springer Verlag, November 2003. 31. G. Yang and M. Kifer. Reasoning about anonymous resources and meta statements on the Semantic Web. Journal on Data Semantics, LNCS 2800, 1:69–98, September 2003. 32. G. Yang, M. Kifer, and C. Zhao. FLORA-2: A rule-based knowledge representation and inference infrastructure for the Semantic Web. In International Conference on Ontologies, Databases and Applications of Semantics (ODBASE-2003), November 2003. 33. G. Yang, M. Kifer, and C. Zhao. FLORA-2: User’s Manual. http://flora.source forge.net/documentation.php, March 2005.
Data Integration and Answer Set Programming Thomas Eiter Knowledge Based Systems Group, Institute of Information Systems, Vienna University of Technology, A-1040 Vienna, Austria
[email protected]
Abstract. The rapid expansion of the Internet and World Wide Web led to growing interest in data and information integration, which should be capable to deal with inconsistent and incomplete data. Answer Set solvers have been considered as a tool for data integration systems by different authors. We discuss why data integration can be an interesting model application of Answer Set programming, reviewing valuable features of non-monotonic logic programs in this respect, and emphasizing the role of the application for driving research.
1 Introduction Triggered by the rapid expansion of the Internet and the World Wide Web, the integration of data and information from different sources has emerged as a crucial issue in many application domains, including distributed databases, cooperative information systems, data warehousing, or on-demand computing. However, the problem is complex, and no canonical solution exists. Commercial software solutions such as IBM’s Information Integrator [1] and academic systems (see e.g. [2]) fulfill only partially the ambitious goal of integrating information in complex application scenarios. In particular, handling inconsistent and/or incomplete data is, both semantically and computationally, a difficult issue, and is still an active area of research; for a survey of query answering on inconsistent databases, see [3]. In recent years, there has been growing interest in using non-monotonic logic programs, most prominently answer set solvers like DLV [4], Smodels [5], or Cmodels-2 [6] as a tool for data integration, and in particular to reconcile data inconsistency and incompleteness, e.g. [7,8,9,10,11,12,13,14,15]. In our opinion, data integration can in fact be viewed as an interesting model application of Answer Set Programming (ASP), for a number of different reasons: 1. The problem is important. There is rapidly growing interest in data and information integration, and this was estimated to be a $10 Billion market by 2006 [16]. 2. Some of the key features of non-monotonic logic programming and ASP in particular, namely declarativity, expressiveness, and capability of nondeterminism can be fruitfully exploited. 3. Interest in ASP engines as a tool for solving data integration tasks emerged with people outside the ASP community, and in fact by different groups [7,8,11,12,13]. 4. The application has raised new research problems and challenges, which have driven research to enhance and improve current ASP technology. C. Baral et al (Eds.): LPNMR 2005, LNAI 3662, pp. 13–25, 2005. c Springer-Verlag Berlin Heidelberg 2005
14
T. Eiter
global (user) database B
player : ?
? ...
?
team : ?
? ...
?
? ...
?
coach : ?
source database D
s1 : 10 Totti RM 27 9 Beckham MU 28 s2 : RM Roma 10 ManU 8 s3 : MU RM Real Madrid 10 s4 : 7 Camacho RM
Fig. 1. Simple soccer data integration scenario – global and source relations
Example 1. To illustrate the problem, we consider a simple scenario of a data integration system which provides information about soccer teams. At the global (user) level, there are three relations player (Pcode, Pname, Pteam), team(Tcode, Tname, Tleader ), and coach(Ccode, Cname, Cteam), which are interrelated with source relations s1 (A1, A2, A3, A4), s2 (B1, B2, B3), s3 (C1, C2, C3), and s4 (D1, D2, D3) in the following way: – player correlates with the projection of s1 to first three attributes; – team correlates with the union of s2 and s3 ; and – coach correlates with s4 . (The precise form of correlation will be detailed later.) Now given the instance of the source database shown in Figure 1, how should a corresponding global database instance look like? In particular, if there are key constraints for the user relations, and further constraints like that a coach can neither be a player nor a team leader. Furthermore, if we want to pose a query which retrieves all players from the global relations (in logic programming terms, evaluate the rules q(X) ← player (X, Y, Z) q(X) ← team(V, W, X) where q is a query predicate), how do we semantically determine the answer?
Different approaches to data integration have been considered; see [17,2] for discussion. The most prominent ones are the Global As View approach (GAV), in which the relations at the user level are amount to database views over the sources, and Local As View approach (GAV), in which conversely the relations of the source database are
Data Integration and Answer Set Programming
15
database views on the global relations. For both approaches, the usage of ASP has been explored, cf. [7,8,10,11,12,13,15]. In this remainder of this paper, we shall first briefly present a framework for data integration from the literature [17,18] which accommodates both GAV and LAV, along with proposals for semantics to deal with data inconsistencies. We then discuss why employing non-monotonic logic programs for this application is attractive, but also what shortcomings of ASP technology have been recognized, which have been driving (and still do so) research to improve ASP technology in order to meet the needs of this application. This is further detailed on the example of the INFOMIX information integration project, in which ASP has been adopted as the core computational technology to deal with data inconsistencies. We conclude with some remarks and issues for future research.
2 Data Integration Systems While semi-structured data formats and in particular XML are gaining more and more importance in the database world, most of the theoretical work on advanced data integration has considered traditional relational databases, in which a database schema is modeled as a pair Ψ, Σ of a set Ψ of database relations and a set Σ of integrity constraints on them. The latter are first-order sentences on Ψ and the underlying (finite or infinite) set of constants (elementary values) Dom. A database instance can be viewed as a finite set of ground facts on Ψ and Dom, and is legal if it satisfies Σ. A commonly adopted high-level structure of a data integration system I in a relational setting is a triple G, S, M with the following components [17,18]: 1. G = Ψ, Σ is a relational schema called the global schema, which represents the user’s view of the integrated data. The integrity constraints Σ are usually from particular constraint classes, since the interaction of constraints can make semantic integration of data undecidable. Important classes of constraints are key constraints and functional dependencies (as well-known from any database course), inclusion dependencies (which enforce presence of certain tuples across relations), and exclusion dependencies (which forbid joint presence of certain tuples). 2. S is the source schema, which is given by the schemas of the various sources that are part of the data integration system. Assuming that they have been standardized apart, we can view S as a relational schema of the form S = Ψ , Σ . The common setting is that Σ is assumed to be empty, since the sources are autonomous and schema information may be not disclosed to the integration system. 3. M is the mapping, which establishes the relationship between G and S in a semantic way. The mapping consists of a collection of mapping assertions of the forms (1) qG (x) qS (x) and (2) qS (x) qG (x), where qG (x) and qS (x) are database queries (typically, expressible in first-order logic) with the same free variables x, on G respectively S. In the above framework, the GAV and LAV approach result as special cases by restricting the queries qG (x) respectively qS (x) to atoms r(x).
16
T. Eiter
Example 2. (cont’d) Our running example scenario is represented as a data integration system I = G, S, M, where G consists of the relations player , team, and coach. The associated constraints Σ are that the keys of player , team, and coach are the attributes {Pcode, Pteam}, {Tcode}, and {Ccode, Cteam}, respectively, and that a coach can neither be a player nor a team leader. The source schema S comprises the relations s1 , s2 , s3 and s4 . Finally, the GAV mapping M is defined in logic programming terms as follows (where qS qG amounts to qG ← qS ): player (X, Y, Z) ← s1 (X, Y, Z, W ) team(X, Y, Z) ← s2 (X, Y, Z) team(X, Y, Z) ← s3 (X, Y, Z) coach(X, Y, Z) ← s4 (X, Y, Z)
The formal semantics of a data integration system I is defined with respect to a given instance D of the source schema, S, in terms of the set sem(I, D) of all instances B of the global schema, G, which satisfy all constraints in G and, moreover, – {c | B |= qG (c)} ⊆ {c | D |= qS (c)} for each mapping assertion of form (1), and – {c | D |= qS (c)} ⊆ {c | B |= qG (c)} for each mapping assertion of form (2), where for any constants c on Dom, DB |= q(c) denotes that q(c) evaluates to true on the database DB. The notions of sound, complete, and exact mapping between query expressions qG (x) and qS (x) [17], reflecting assumptions on the source contents, are then elegantly captured as follows: – sound mapping: qS (x) qG (x) (intuitively, some data in the sources is missing), – complete mapping: qG (x) qS (x) (intuitively, the sources contain excess data), – exact mapping: qS (x) qG (x) ∧ qG (x) qS (x) The answer to a query Q with out query predicate q(x) against a data integration system I with respect to source data D, is given by the set of tuples ans(Q, I, D) = {c | B |= q(c), for each B ∈ sem(I, D)}; that is, ans(Q, I, D) collects all tuples c on Dom such that q(c) is a skeptical consequence with respect to all “legal” global databases. In a GAV setting under sound mappings, the smallest candidate database B for sem(I, D), is given by the retrieved global database, ret(I, D), which is the materialization of all the views on the sources. Under exact mappings, ret(I, D) is in fact the only candidate database for sem(I, D). Example 3. (cont’d) Note that the mapping M in our running example is a sound mapping. The global database B0 = ret(I, D) for D as in Figure 1 is shown in Figure 2. It violates the key constraint on team, witnessed by the two facts team(RM, Roma, 10) and team(RM, Real Madrid, 10), which coincide on Tcode but differ on Tname. Since this key constraint is violated in every database B which contains B0 , it follows that sem(I, D) is empty, i.e., the global relations can not be consistently populated.
Data Integration and Answer Set Programming global database B0 = ret (I, D)
player : 10 9
Totti Beckham
7
Camacho
s1 : 10 Totti RM 27 9 Beckham MU 28
RM MU
team : RM Roma 10 MU ManU 8 RM Real Madrid 10 coach :
source database D
17
s2 : RM Roma 10 ManU 8 s3 : MU RM Real Madrid 10
RM
s4 : 7 Camacho RM Fig. 2. Global database B0 = ret (I, D) for the soccer scenario as retrieved from the sources repair R1
player : 10 Totti RM 9 Beckham MU team : RM Roma MU ManU coach :
10 8
7 Camacho RM
repair R2
player : 10 9
Totti Beckham
RM MU
team : MU ManU 8 RM Real Madrid 10 coach :
7
Camacho
RM
Fig. 3. Repairs in the example data integration scenario I w.r.t. D
Since “ex-falso-quodlibet” is not a desirable principle for database query answers (e.g., in our scenario (Roma) would be a query answer), relaxations aim at adopting global databases B which (1) satisfy all constraints and (2) satisfy the mapping assertion M with respect to D as much as possible. The latter may be defined in terms of a preference ordering (i.e., a reflexive and transitive relation) over global databases B, such that those B are accepted which are most preferred. Different possibilities for instantiating exist and have been considered in a number of papers [7,8,19,10,11,12,20,13,21,15]. A popular one with GAV mappings is the one which prefers databases B which are as close as possible, under symmetric set difference, to the retrieved global databases ret (I, D); it amounts to the smallest set of tuples to be added and/or deleted. Other orderings are based on giving preferences to retaining tuples in ret (I, D) over adding new ones (as in loosely sound semantics [20,13]), or even demand that only deletion of tuples is allowed (guided by some completeness assumption [21]). These databases are commonly referred to as “repairs” of the global database ret(I, D). Example 4. (cont’d) Let us adopt the preference relation B0 which prefers B1 over B2 if the symmetric difference B1 B0 is a subset of B2 B0 . Then the retrieved global database B0 for the running example has two repairs R1 and R2 shown in Figure 3.
18
T. Eiter
Accordingly, the example query Q evaluates to ans(Q, I, D) = {(8), (9), (10)}, since the respective facts q(c) are derived over both repairs. For a more rigorous discussion of the above model, in particular from the perspective of logic, we refer to [18], where it is also shown that a number of different orderings used by different authors can be generically captured.
3 Employing Non-monotonic Logic Programs Recently, several approaches to formalize repair semantics by using non-monotonic logic programs have been proposed, cf. [7,8,9,19,10,11,12,13,14,15]. The idea common to most of these works is to encode the constraints Σ of the global schema G into a function-free logic program, Π, using unstratified negation and/or disjunction, such that the answer sets of this program [22] yield the repairs of the global database. Answering a user query, Q, then amounts to cautious reasoning over the logic program Π augmented with the query, cast into rules, and the retrieved database B. For an elaborated discussion of these proposals, we refer to [23]. In [19], the authors consider data integration via abductive logic programming, where, roughly speaking, the repairs of a database are computed as abductive explanations. In the following, we discuss some key features of answer set programs which can be fruitfully exploited for doing data integration via ASP. High expressiveness. ASP is a host for complex database queries. ASP with disjunction has Π2P -expressiveness, which means that each database query with complexity in Π2P can be expressed in this formalism [24]. Such expressiveness is strictly required for query answering in some settings [13,21,25]; for example, under loosely-exact semantics in the presence of inclusion dependencies for fixed queries, but also for ad hoc queries under absence of such dependencies. And, ASP with disjunction has coNEXPNP program complexity [24], and thus very complex problems can be polynomially reduced to it (as for query answering, however, not always in a data-independent manner). For more on complexity and expressiveness of ASP, see [26,27]. Declarative language. ASP supports a fully declarative, rule-based approach to information integration. While languages such as Prolog also support declarative integration, the algorithm-oriented semantics makes it more difficult to design and understand integrations policies for the non-expert. Nondeterminism. ASP engines have been originally geared towards model generation (i.e., computation of one, multiple, or all answer sets) rather than towards theorem proving. This is particularly useful for solving certain AI problems including model-based diagnosis, where given some observations and a background theory, a model is sought which reconciles the actual and predicted observations in terms of assumptions about faulty components applying Occam’s Razor. Repair semantics for query answering from inconsistent data bases and integration systems [7,8,10,11,12,13,15] is closely related to this diagnostic problem. Using an ASP engine, a particular repair for a corrupted database might be computed and installed in its place.
Data Integration and Answer Set Programming
19
Proximity to database query languages. ASP programs are close to logic-based database query languages such as conjunctive queries, union of conjunctive queries, (plain) SQL, and datalog. This in particular facilitates a seamless integration of various components of a data integration system – query evaluation, database “repair”, and database mapping – into a uniform language. Executable specifications. Given the seamless integration of various components of a data integration system, an ASP program for information integration tasks can be regarded as an executable specification, which can be run on supplied input data. This has been elaborated in [14,23] where abstract logic specification for querying a GAV data integration I with a query Q has been considered in terms of a hierarchically composed disjunctive datalog program ΠI (Q) = ΠM ∪ ΠΣ ∪ ΠQ such that (in simplified notation): 1. ret(I, D) AS(ΠM ∪ D), where ΠM is a stratified normal datalog program, computing the mapping M; 2. rep I (D) AS(ΠΣ ∪ ret(I, D)), where ΠΣ is an (unstratified resp. disjunctive) program computing the repairs, and 3. ans(Q, I, D) = {c | q(c) ∈ M for each M ∈ AS((ΠM ∪ ΠΣ ∪ ΠQ ∪ D)}, where ΠQ is a non-recursive safe datalog program with negation (defining the query output predicate q); here, AS(P) are the answer sets of a program P and denotes a polynomial-time computable correspondence between two sets. Language constructs. The original ASP language [22] has been enriched with a number of constructs, including different forms of constraints such as DLV’s weak constraints, Smodels’s choice rules and weight constraints, rule preferences (see e.g. [28] for a survey), and more recently aggregates (see [29,30,31] and references therein). Aggregates, for instance, are very desirable for querying databases (SQL provides many features in this respect). Weak and weight constraints are convenient for specifying certain integration semantics, such as repairs based on cardinality (Hamming) distance of changes to the retrieved global database. Rule preferences might be exploited to expressing preferences in repair, and e.g. help to single out a canonical repair. Therefore, refinements and variants of standards proposals for integration semantics can be accomodated well. Knowledge representation capability. ASP provides, thanks to the availability of facts and rules, different kinds of negation (strong and weak i.e. default negation), a rich language for representing knowledge. This makes ASP attractive for crafting special, domain dependent integration policies, in which intuitively a knowledge-base is run for determining the best integration result.
4 Emerging ASP Research Issues While ASP is attractive as a logic specification formalism for data integration, and available ASP engines can be readily applied for rapid prototyping of experimental systems
20
T. Eiter
that work well on small examples, it becomes quickly apparent that ASP technology needs to be seriously improved in order to meet the requirements of this application and make its usage feasible in practice. Among others, the following important issues emerge: Scalability. In real data integration scenarios, one needs to deal with massive amounts of data (in the Gigabytes and beyond), rather than with a few tuples. A graceful scaling of an integration system’s response time with respect to the amount of data processed is desired. A problem in this respect is that current ASP technology builds on program grounding, i.e., the reduction of non-ground programs to ground (propositional) programs which are then evaluated with special algorithms. Even though the grounding strategies of DLV and Smodels’ grounder Lparse are highly sophisticated and avoid as much as possible the generation of “unnecessary rules,” the grounding of a repair program over a large dataset will be ways too large to render efficient query answering. Therefore, optimization methods are needed which allow for handling large amounts of data. A call for this has been made e.g. in [11]. Nonground queries. Another issue is that as seen in the example scenario, queries to an integration system typically contain variables, all whose instances should be computed. ASP solvers, however, have been conceived for model computation rather than for query answering. Query answering, e.g. as originally supported in DLV, was limited to ground (variable-free) queries (which can be reduced to model computation resp. checking program consistency by simple transformations). The straightforward method of reducing a non-ground query by instantiation to a series of (separate) ground queries is not efficient, since roughly the system response time will be O(#gq ∗ srt), where #gq is the number of ground queries and srt is the response time for a single ground query. Therefore, efficient methods for answering non-ground queries are needed. Software interoperability. In data integration settings in practice, data is stored in multiple repositories, and often in heterogeneous formats. In a relational setting, such repositories will be managed by a commercial DBMS such as Oracle, DB2, SQLServer etc. Data exchange between a DBMS and an ASP engine via files or other operating systems facilities, as was the only possibility with early ASP systems, requires extra development effort and, moreover, is an obvious performance bottleneck. To facilitate efficient system interoperability, suitable interfaces from ASP solvers to DBMS must be provided, such as an ODBC interface as available in other languages. Furthermore, interfaces to other software for carrying out specific tasks in data integration (e.g., data cleaning, data presentation) are desirable. These issues are non-trivial and require substantial foundational and software development work. Scalability and non-ground query answering are particularly challenging issues, which are not bound to the data integration application. Advances on them will be beneficial to a wide range of other applications as well. The above issues have been driving some of the research on advancing and enhancing ASP technology in the last years, and in particular of the ASP groups at the University of Calabria and at TU Vienna. A number of results have been achieved, which are briefly summarized as follows.
Data Integration and Answer Set Programming
21
– As for scalability and optimization, the magic set method (introduced in [32]) has been extended to disjunctive programs and tuned for data integration [33,34,35]; focusing techniques and optimization methods genuine to data integration are presented in [14,23]; different variants of repair programs have been examined for their suitability, in this context, recent notions and results on program equivalence [36,37,38,39] turned out to be a useful tool. – Non-ground query answering is supported in the current releases of DLV. – Interfacing of relational DBMS is supported by an ODBC interface in DLV [40], and a tight coupling between ASP engines and relational DBMSs has been conceived [41]. These results have been obtained in the course of the INFOMIX project, which is briefly presented in the next subsection, since to our knowledge it is the most comprehensive initiative to employ ASP in a data integration system. 4.1 The INFOMIX Project INFOMIX [42] has been launched jointly by the ASP groups of the University of Calabria and TU Vienna, the data integration group at the University of Rome “La Sapienza,” and Rodan Systems S.A., a Polish database software house, with the objective to provide powerful information integration for handling inconsistent and incomplete information, using computational logic tools as an implementation host for advanced reasoning tasks. The usage of an ASP engine like DLV or Smodels which is capable of handling non-ground programs and provides the expressiveness needed, appeared to be well-suited. However, the research issues mentioned above had to be addressed in order to make employment of ASP in realistic integration scenarios feasible beyond toy examples. The INFOMIX prototype [43,44] is built on solid theoretical foundations, and implements the GAV approach under sound semantics. It offers the user a powerful query language which, as a byproduct of the usage of ASP, allows in certain cases also queries beyond recursion-free positive queries (which are those expressed by non-recursive ASP programs without negation), in particular stratified queries or queries with aggregates, depending on the setting of the integrity constraints of the global schema; the underlying complexity and undecidability frontier has been charted in [20]. Furthermore, INFOMIX provides the user with tools for specifying and managing a data integration scenario, as well as with a rich layer for accessing and transforming data from sources (possibly dispersed on the Internet) in heterogeneous formats (including relational format, XML, and HTML under constraints) into a homogenous format (conceptually, into a fragment of XML Schema) by data wappers. At the INFOMIX core are repair logic programs for handling data inconsistencies, which are dynamically compiled by rewriting algorithms. Pruning and optimization methods are applied which aim at reducing the portion of data which need to be accessed for query answering. In particular, the usage of the ASP engine is constrained to the inconsistent data part which needs repair. Details about this can be found in paper and reports [42,13,14,35]. Compared to data integration systems with similar semantics, of which the most prominent are the Hippo [45] and ConQuer [46], INFOMIX is capable of handling a
22
T. Eiter
much larger range of queries and constraint settings which are realistic in practice. This is exemplified by the INFOMIX Demo Scenario, in which data from various legacy databases and web pages of the University of Rome “La Sapienza” are integrated into a global view which has 14 relations and about 30 integrity constraints, including key constraints, inclusion and exclusion dependencies. Most of the 9 typical user queries in the Demo Scenario can’t be handled by Hippo; ConQuer can only handle key constraints, and thus is not applicable to the scenario. On the other hand, Hippo and ConQuer are very efficient and faster than INFOMIX on the specific settings which they can handle. Thanks to improved ASP technology and the optimization techniques, INFOMIX is able to handle the queries in the Demo Scenario reasonably efficient within a few seconds for core integration time, and tends to scale gracefully. Without these improvements and optimizations, the performance is much worse and the system response time barely acceptable.
5 Discussion and Conclusion As argued above, data integration can be seen as an interesting model application of Answer Set Programming. The results which have been obtained so far are encouraging, and show clear benefits of using ASP. We remark that an experimental comparison of computing database repairs with different logic-based methods – QBF, CLP, SAT, and ASP solvers – in a propositional setting is reported in [9], which shows that ASP performs very well. We suspect that in the realm of a relational setting (in which QBF and SAT solvers can’t be directly applied and require preliminary grounding), it behaves even more advantageous. In spite of the advances that have been achieved on the issues in Section 4, research on them is by no means closed, and in fact a lot of more work is necessary. Optimization of ASP programs is still at a rather early stage, and there is room for improvement. Currently, optimization is done at the level of ASP solvers, which employ internal optimization strategies that to some extent build on heuristics. Optimization at the “external” level, independent of a concrete ASP solver, is widely unexplored. Recent results on program equivalences (cf. [36,37,38,47,39] and references therein) might provide a useful basis for optimization methods. However, as follows from classic results in database theory, basic static optimization tasks for ASP programs are undecidable in very plain settings (cf. [48]), and thus a detailed study and exploration of decidable cases is needed. Efficient non-ground query answering is an issue which is perhaps tied to a more fundamental issue concerning the architecture of current state-of-the-art answer set engines: it is unclear whether their grounding approach is well-suited as a computational strategy. Indeed, for programs in which predicate arities are bounded by a constant, non-ground query answering can be carried out in polynomial space (as follows from results in [49]) while current answer set engines use exponential space for such queries in general. As for software interoperability, ASP engines need to interface a large range of other data formats besides relational data, including popular formats like XML and, more recently, also RDF. For XML data, ASP extensions are desired which allow to manipulate them conveniently. The Elog language [50] may be a guiding example in
Data Integration and Answer Set Programming
23
this direction. In turn, integration of ASP solvers into more complex software systems needs also better support. As for future developments of ASP and data integration, one interesting issue would be to realize an operational data integration system which is deployed in a concrete application. The results of INFOMIX are encouraging in this direction. Here, a hybrid system combining complementary approaches like those of Hippo, ConQuer, and INFOMIX would be an intriguing idea. As for the perspective of advanced data integration at the level of a full-fledged commercial DBMS, we feel that research is still at an early stage and industry seems not to be ready for immediate takeup. There are several interesting directions for further research on the usage of ASP in data integration. Among them is powerful mediated data integration, as discussed e.g. in [19], and peer-to-peer data integration in a network of information systems [51]. Furthermore, applications of ASP in advanced integration of information sources which contain information beyond factual knowledge, and in data model and ontology management might be worthwhile to explore. Thanks to its rich knowledge representation capabilities, ASP might prove to be a valuable tool for developing declarative formalisms in these areas. Acknowledgments. I am very grateful to Wolfgang Faber for comments on a draft of this paper. I would like to thank all the many colleagues with whom I had the pleasure to discuss about and work on issues on data integration using non-monotonic logic programming, and here in particular the INFOMIX project team. The views expressed here are, however, personal and not necessarily in line with those of INFOMIX folks. Furthermore, I am very grateful to the support of the European Commission of this work under contracts IST-2001-33570 INFOMIX, FET-2001-37004 WASP, and IST2001-33123 CologNeT, and the Austrian Science Fund (FWF) project P18019-N04.
References 1. Hayes, H., Mattos, N.: Information on demand. DB2 Magazine 8 (2003) 2. Halevy, A.Y.: Data integration: A status report. In: Proc. 10. Conference on Database Systems for Business, Technology and Web (BTW 2003), LNI 26, GI (2003) 24–29 3. Bertossi, L., Chomicki, J.: Query answering in inconsistent databases. In Chomicki, J., van der Meyden, R., Saake, G., eds.: Logics for Emerging Applications of Databases. Springer (2003) 43–83 4. Leone, N., Pfeifer, G., Faber, W., Eiter, T., Gottlob, G., Perri, S., Scarcello, F.: The DLV System for Knowledge Representation and Reasoning. ACM Transactions on Computational Logic, to appear. Available via http://www.arxiv.org/ps/cs.AI/0211004. 5. Simons, P., Niemel¨a, I., Soininen, T.: Extending and Implementing the Stable Model Semantics. Artificial Intelligence 138 (2002) 181–234 6. Lierler, Y., Maratea, M.: Cmodels-2: Sat-based answer set solver enhanced to non-tight programs. In: Proc. 7th Int’l Conf. on Logic Programming and Nonmonotonic Reasoning (LPNMR-7). LNCS 2923, Springer (2004) 346–350 7. Arenas, M., Bertossi, L.E., Chomicki, J.: Specifying and querying database repairs using logic programs with exceptions. In: Proc. 4th Int. Conf. on Flexible Query Answering Systems (FQAS 2000), Springer (2000) 27–41 8. Arenas, M., Bertossi, L.E., Chomicki, J.: Answer sets for consistent query answering in inconsistent databases. Theory and Practice of Logic Programming 3 (2003) 393–424
24
T. Eiter
9. Arieli, O., Denecker, M., Nuffelen, B.V., Bruynooghe, M.: Database repair by signed formulae. In: Proc. 3rd Int’l Symp. on Foundations of Information and Knowledge Systems (FoIKS 2004). LNCS 2942, Springer (2004) 14–30 10. Bertossi, L.E., Chomicki, J., Cortes, A., Gutierrez, C.: Consistent answers from integrated data sources. In: Proc. 6th Int’l Conf. on Flexible Query Answering Systems (FQAS 2002). (2002) 71–85 11. Bravo, L., Bertossi, L.: Logic programming for consistently querying data integration systems. In: Proc. 18th Int’l Joint Conf. on Artificial Intelligence (IJCAI 2003). (2003) 10–15 12. Bravo, L., Bertossi, L.: Deductive databases for computing certain and consistent answers to queries from mediated data integration systems. Journal of Applied Logic 3 (2005) 329–367 13. Cal`ı, A., Lembo, D., Rosati, R.: Query rewriting and answering under constraints in data integration systems. In: Proc. IJCAI 2003. (2003) 16–21 14. Eiter, T., Fink, M., Greco, G., Lembo, D.: Efficient evaluation of logic programs for querying data integration systems. In: Proc. 19th Int’l Conf. on Logic Programming (ICLP 2003). LNCS 2916, Springer (2003) 163–177 15. Greco, G., Greco, S., Zumpano, E.: A logic programming approach to the integration, repairing and querying of inconsistent databases. In: Proc. ICLP 2001. (2001) 348–364 16. Mattos, N.M.: Integrating information for on demand computing. In: Proc. 29th Int’l Conf. on Very Large Data Bases (VLDB 2003). (2003) 8–14 17. Lenzerini, M.: Data integration: A theoretical perspective. In: Proc. 21st ACM Symposium on Principles of Database Systems (PODS 2002). (2002) 233–246 18. Andrea Cal´ı, D.L., Rosati, R.: A comprehensive semantic framework for data integration systems. Journal of Applied Logic 3 (2005) 308–328 19. Arieli, O., Denecker, M., Nuffelen, B.V., Bruynooghe, M.: Coherent integration of databases by abductive logic programming. J. Artificial Intelligence Research 21 (2004) 245–286 20. Cal`ı, A., Lembo, D., Rosati, R.: On the decidability and complexity of query answering over inconsistent and incomplete databases. In: Proc. PODS 2003. (2003) 260–271 21. Chomicki, J., Marcinkowski, J.: Minimal-change integrity maintenance using tuple deletions. Information and Computation 197 (2005) 90–121 22. Gelfond, M., Lifschitz, V.: Classical negation in logic programs and disjunctive databases. New Generation Computing 9 (1991) 365–385 23. Eiter, T., Fink, M., Greco, G., Lembo, D.: Optimization methods for logic-based consistent query answering over data integration systems. Tech. Report INFSYS RR-1843-05-05, Institute of Information Systems, TU Vienna, Austria (2005). Extends [14] 24. Eiter, T., Gottlob, G., Mannila, H.: Disjunctive Datalog. ACM Trans. on Database Systems 22 (1997) 364–417 25. Greco, G., Greco, S., Zumpano, E.: A logical framework for querying and repairing inconsistent databases. IEEE Trans. Knowl. Data Eng. 15 (2003) 1389–1408 26. Dantsin, E., Eiter, T., Gottlob, G., Voronkov, A.: Complexity and Expressive Power of Logic Programming. ACM Computing Surveys 33 (2001) 374–425 27. Marek, V.W., Remmel, J.B.: On the expressibility of stable logic programming. Journal of the Theory and Practice of Logic Programming 3 (2003) 551–567 28. Delgrande, J.P., Wand, K., Schaub, T., Tompits, H.: A classification and survey of preference handling approaches in nonmonotonic reasoning. Computational Intelligence 20 (2004) 308– 334 29. Gelfond, M.: Representing Knowledge in A-Prolog. In Kakas, A.C., Sadri, F., eds.: Computational Logic. Logic Programming and Beyond. LNCS 2408, Springer (2002) 413–451 30. Pelov, N.: Semantics of Logic Programs with Aggregates. PhD thesis, Katholieke Universiteit Leuven, Leuven, Belgium (2004)
Data Integration and Answer Set Programming
25
31. Faber, W., Leone, N., Pfeifer, G.: Recursive Aggregates in Disjunctive Logic Programs: Semantics and Complexity. In: Proc. 9th European Conference on Logics in Artificial Intelligence (JELIA 2004). LNCS 3229, Springer (2004) 200–212 32. Bancilhon, F., Maier, D., Sagiv, Y., Ullman, J.D.: Magic Sets and Other Strange Ways to Implement Logic Programs. In: Proc. PODS 1986. (1986) 1–16 33. Greco, S.: Binding Propagation Techniques for the Optimization of Bound Disjunctive Queries. IEEE Trans. Knowledge and Data Engineering 15 (2003) 368–385 34. Cumbo, C., Faber, W., Greco, G.: Enhancing the magic-set method for disjunctive datalog programs. In: Proc. ICLP 2004 (2004) 371–385 35. Faber, W., Greco, G., Leone, N.: Magic sets and their application to data integration. In: Proc. 10th Int’l Conf. on Database Theory (ICDT 2005). LNCS 3363, Springer (2005) 306–320 36. Lifschitz, V., Pearce, D., Valverde, A.: Strongly equivalent logic programs. ACM Transactions on Computational Logic 2 (2001) 526–541 37. Lin, F.: Reducing strong equivalence of logic programs to entailment in classical propositional logic. In: Proc. 8th Int’l Conf. on Principles of Knowledge Representation and Reasoning (KR 2002), (2002) 170–176 38. Eiter, T., Fink, M., Tompits, H., Woltran, S.: Simplifying logic programs under uniform and strong equivalence. In: Proc. LPNMR-7. LNCS 2923, Springer (2004) 87–99 39. Eiter, T., Fink, M., Woltran, S.: Semantical characterizations and complexity of equivalences in answer set programming. ACM Transactions on Computational Logic, to appear. Tech. Rep. INFSYS RR-1843-05-01, TU Vienna, Austria (2005) 40. Calimeri, F., Citrigno, M., Cumbo, C., Faber, W., Leone, N., Perri, S., Pfeifer, G.: New DLV features for data integration. In: Proc. JELIA 2004. LNCS 3229, Springer (2004) 698–701 41. Leone, N., Lio, V., Terracina, G.: DLV DB: Adding efficient data management features to ASP. In: Proc. LPNMR-7. LNCS 2923, Springer (2004) 341–345 42. INFOMIX homepage (since 2001) http://sv.mat.unical.it/infomix. 43. Leone, N., et al.: The INFOMIX system for advanced integration of incomplete and inconsistent data. In: Proc. ACM SIGMOD 2005 Conference, ACM (2005) 915–917 44. Leone, N., et al.: Data integration: a challenging ASP application. In: Proc. LPNMR 2005. LNCS, Springer (2005). This volume 45. Chomicki, J., Marcinkowski, J., Staworko, S.: Computing consistent query answers using conflict hypergraphs. In: Proc. 13th ACM Conference on Information and Knowledge Management (CIKM-2004), ACM Press (2004) 417–426 46. Fuxman, A., Fazli, E., Miller, R.J.: ConQuer: Efficient management of inconsistent databases. In: Proc. ACM SIGMOD 2005 Conference, ACM (2005) 155-166 47. Eiter, T., Fink, M., Tompits, H., Woltran, S.: Strong and uniform equivalence in answer-set programming: Characterizations and complexity results for the non-ground case. In: Proc. 20th National Conference on Artificial Intelligence (AAAI ’05) (2005) 48. Halevy, A.Y., Mumick, I.S., Sagiv, Y., Shmueli, O.: Static analysis in datalog extensions. Journal of the ACM 48 (2001) 971–1012 49. Eiter, T., Faber, W., Fink, M., Pfeifer, G., Woltran, S.: Complexity of model checking and bounded predicate arities for non-ground answer set programming. In: Proc. KR 2004 (2004) 377–387 50. Baumgartner, R., Flesca, S., Gottlob, G.: The Elog web extraction language. In: Proc. 8th Int’l Conf. on Logic for Programming, Artificial Intelligence, and Reasoning (LPAR 2001). LNCS 2250, Springer (2001) 548–560 51. Calvanese, D., Giacomo, G.D., Lenzerini, M., Rosati, R.: Logical foundations of peer-to-peer data integration. In: Proc. PODS 2004 (2004) 241–251
Halo I: A Controlled Experiment for Large Scale Knowledge Base Development* Jürgen Angele, Eddie Moench, Henrik Oppermann, and Dirk Wenke Ontoprise GmbH, Amalienbadstr. 36, D-76228 Karlsruhe, Germany {angele, moench, oppermann, wenke}@ontoprise.de
Abstract. Project Halo is a multi-staged effort, sponsored by Vulcan Inc, aimed at creating the Digital Aristotle (DA), an application that will encompass much of the world's scientific knowledge and be capable of applying sophisticated problem solving to answer novel questions. Vulcan envisions two primary roles for the Digital Aristotle: as a tutor to instruct students in the sciences, and as an interdisciplinary research assistant to help scientists in their work. As a first step towards this goal, there was a six-month Pilot phase, designed to assess the state of the art in applied Knowledge Representation and Reasoning (KR&R). Vulcan selected three teams, each of which was to formally represent 70 pages from the Advanced Placement (AP) chemistry syllabus and deliver knowledge based systems capable of answering questions on that syllabus. The evaluation quantified each system’s coverage of the syllabus in terms of its ability to answer novel, previously unseen questions and to provide human-readable answer justifications. These justifications will play a critical role in building user trust in the question-answering capabilities of the Digital Aristotle.Despite differences in approach, all three systems did very well on the challenge, achieving performance comparable to the human median. The analysis also provided key insights into how the approaches might be scaled, while at the same time suggesting how the cost of producing such systems might be reduced.
1 Introduction Today, the knowledge available to humankind is so extensive that it is not possible for a single person to assimilate it all. This is forcing us to become much more specialized, further narrowing our worldview and making interdisciplinary collaboration increasingly difficult. Thus, researchers in one narrow field may be completely unaware of relevant progress being made in other neighboring disciplines. Even within a single discipline, researchers often find themselves drowning in new results. MEDLINE®1, for example, is an archive of 4,600 medical journals in thirty languages, containing over twelve million publications, with 2,000 added daily. * 1
Full support for this research was provided by Vulcan Inc. as part of Project Halo. MEDLINE is the National Library of Medicine's premier bibliographic database covering the fields of medicine, nursing, dentistry, veterinary medicine, the health care system, and the preclinical sciences.
C. Baral et al. (Eds.): LPNMR 2005, LNAI 3662, pp. 26 – 39, 2005. © Springer-Verlag Berlin Heidelberg 2005
Halo I: A Controlled Experiment for Large Scale Knowledge Base Development
27
The final Digital Aristotle DA will differ from classical expert systems in four important ways: •
Speed and ease of knowledge formulation: Classical expert systems required years to perfect and highly skilled knowledge engineers to craft them; the DA will provide tools to facilitate rapid knowledge formulation by domain experts with little or no help from knowledge engineers. • Coverage: Classical expert systems were narrowly focused on the single topic for which they were specifically designed; the DA will over time encompass much of the world’s scientific knowledge. • Explanations: Classical expert systems produced explanations derived directly from inference proof trees; the DA will produce concise explanations, appropriate to the domain and the user’s level of expertise. The Pilot phase of Project Halo was a 6-month effort to set the stage for a longterm research and development effort aimed at creating the Digital Aristotle. The primary objective was to evaluate the state of the art in applied KR&R systems. Understanding the performance characteristics of these technologies was considered to be especially critical to the DA, as they are expected to form the basis of its reasoning capabilities. The first objectives were to develop suitable evaluation methodologies; the project was also designed to help in the determination of a research and development roadmap for KR&R systems. Finally, the project adopted principles of scientific transparency aimed at producing understandable, reproducible results. Three teams were contracted to participate in the evaluation: a team led by SRI International with substantial contributions from Boeing Phantom Works and the University of Texas at Austin; a team from Cycorp; and our team at ontoprise. Significant attention was given to selecting a proper domain for the evaluation. In the end, a 70-page subset of introductory college-level Advanced Placement (AP) chemistry was selected because it was reasonably self-contained and did not require solutions to other hard AI problems, such as representing and reasoning with uncertainty, or understanding diagrams. Fig. 1 lists the topics in the chemistry syllabus. Topics included: stoichiometry calculations with chemical formulas; aqueous reactions and solution stoichiometry; and chemical equilibrium. Background material was also identified to make the selected chapters more fully self-contained2. Subject Stoichiometry: Calculations with Chemical Formulas
Aqueous Reactions and Solution Stoichiometry Chemical Equilibrium
Chapters 3
Sections 3.1 – 3.2
Pages 75 - 83
4
4.1 – 4.4
113 - 133
16
16.1 – 16.11
613 - 653
Fig. 1. Course Outline for the Halo Challenge 2
Sections 2.6-2.9 in chapter two provide detailed information. Chapter 16 also requires the definition of moles, which appears in section 3.4 pp 87-89, and molarity, which can be found on page 134. The form of the equilibrium expression can be found on page 580, and buffer solutions can be found in section 17.2.
28
J. Angele et al.
This scope was large enough to support a large variety of novel, and hence unanticipated, question types. One analysis of the syllabus identified nearly 100 distinct chemistry laws, suggesting that it was rich enough to require complex inference. It was also small enough to be represented relatively quickly – which was essential because the three Halo teams were allocated only four months to create formal encodings of the chemistry syllabus. This amount of time was deemed sufficient to construct detailed solutions that leveraged the existing technologies, yet was too brief to allow significant revisions to the teams’ platforms. Hence, by design, we were able to avoid undue customization to the task domain and thus to create a true evaluation of the state-of-the-art of KR&R technologies.
2 The Technology The three teams had to address the same set of issues: knowledge formation, question answering, and explanation generation, [3], [4], [5]. They all built knowledge bases in a formal language and relied on knowledge engineers to encode the requisite knowledge. Furthermore, all the teams used automated deductive inference to answer questions. 2.1 Knowledge Formation For testing purposes in the dry run Vulcan Inc. provided 50 syllabus questions for each team. The encoding of the corpus (70 pages from (Brown, LeMay and Bursten (2003))) has been done in the ontoprise team in three different phases. During the first phase the knowledge within the corpus has been encoded into the ontology and into rules, not regarding the 50 syllabus questions. This knowledge has been tested with some 40 exercises from (Brown, LeMay and Bursten (2003)). For each of these exercises an encoded input file containing the question in their formal language representation, and an output file containing the expected answer have been created. These pairs have been used for regression tests of the knowledge base. In the next phase the syllabus questions have been tested with a covering of around 30% of these questions. During this phase the knowledge base has been refined until coverage of around 70% of these questions has been reached. Additionally, in parallel during this phase, the explanation rules have been encoded. In the so-called dry run itself, the encoded syllabus questions have been sent to Vulcan to test the installed systems. The remaining time to the challenge run has been used to refine the encoding of the knowledge base and the explanation rules. During the entire process, the library of test cases has been extended and used for automatic testing purposes. This ensured stability of the knowledge base against changes. Cycorp used a hybrid approach by first concentrating on representing the basic concepts and principles of the corpus, and gradually shifting over to a question-driven approach. SRI’s approach for knowledge formation was highly question driven. Starting from the 50 sample questions, they worked backwards to identify what pieces of knowledge will be needed to solve them.
Halo I: A Controlled Experiment for Large Scale Knowledge Base Development
29
2.2 The Architecture of the Knowledge Base The resulting knowledge base has a three layered architecture. The upper level contains the ontological information about concepts like elements, reactions, substances and mixtures together with their attributes and relationships. This layer provides the domain vocabulary and the domain structure and is target of the queries posed to the system. This small ontology layer consisted of around 40 concepts, and 60 attributes and relations. For the second layer we identified around 35 basic chemical operations which are represented in around 400 F-Logic rules [19]. The third layer contains the basic facts like elements and the like represented in instances. Let us illustrate this by an example. The ontology defines the concept mixture with attributes hasPHValue, hasHConcentration, hasComponent, hasMole, and hasQuantitiy. These attributes describe the formulae of components, the moles of the components and the quantities of the components. The attribute hasPHValue represents the ph-value of the mixture. Given such a mixture the following query queries for the Hconcentration of the mixture: FORALL X <- m1:Mixture[hasHConcentration->>X]. For the different types of mixtures different rules compute this H-concentration. E.g. for buffer solutions the H-concentration is described by the following rule which represents one basic chemical operation rule3: FORALL BF,MB,SF,MS,H,B,Kb,S,KbMB,KbMBminus,MSKb,OH bufferPh(BF,MB,SF,MS,H) <- B:WeakBase[hasFormula->>BF; hasKb->>Kb] and …. This basic chemical operation is now attached to the ontology and defines the attribute hasHConcentration of a mixture (there is an additional rule to compute the pH-value from this H-concentration): rule2: FORALL M,H,F1,F2,M1,M2 M:BufferSolution[hasHConcentration->>H] <M:Mixture[hasComponents->>{F1,F2}; hasMoles>>{c(F1,M1),c(F2,M2)}] and bufferPh(F1,M1,F2,M2,H). The advantages of this three level architecture are twofold. First the basic chemical operations are nearly independent from each other and can therefore be developed and tested independently. So each chemical operation is a stand-alone knowledge chunk. Accessing the values using an ontology on the other hand frees the encoder from knowing all the specialized predicates and enables an access to the different information pieces in a way that is much closer to natural language than the predicates of the basic chemical operations. 2.3 The Inferencing Process Figure 2 shows question 44 from the Multiple Choice section of the exam along with the answer generated by the ontoprise system.
30
J. Angele et al.
Question 44 Original question Given is an aqueous solution containing equimolar ratios of the following pairs of substances. a. CH3COOH and NaCH3COO b. HClO4 and NaCl c. KOH and HCl d. NH3 and KOH e. CH3NH2 and CH3NH3Cl Which is a buffer with a pH > 7 ? Answer: E Fig. 2. Question 44 from the Multiple Choice section of the Challenge Exam, and the answer generated by our system
This question of the challenge run focuses on acid-base reactions (ch. 4.3 Brown, LeMay and Bursten (2003)) and on buffer solutions (ch. 17.2 Brown, LeMay and Bursten (2003)). In the following we present those parts of the knowledge base which contributed to the correct answer E and the chemical knowledge behind them. First of all this question has been encoded in F-Logic. For each possible choice, the encoding looks like the following example for E: m:Mixture[hasComponents->>{"CH3NH2"," CH3NH3Cl"}; hasMoles->>{c("CH3NH2",1),c("CH3NH3Cl",1)}]. FORALL M answer("E") <- M:Mixture[hasPHValue->>Ph] and M:BufferSolution and greater(Ph,7). The first two lines encode the premise, viz. that a mixture m exists consisting of two substances with 1 mole each. The third and fourth lines constitute a query asking for the pH-value of the buffer and whether this pH-value is greater than 7. There is a rule in the KB which computes the Ph-value of a mixture from the Hconcentration using the well-known equation Ph = -log H (eq.4): rule1: FORALL M,Ph,H M[hasPHValue->>Ph] <- M:Mixture[hasHConcentration->>H] and phH(H,Ph). The H-concentration is computed by rule3: rule3: FORALL BF,MB,SF,MS,H,B,Kb,S,KbMB,KbMBminus,MSKb,OH bufferPh(BF,MB,SF,MS,H)
>BF; hasKb->>Kb] and S:IonicMolecule[hasFormula->>SF] and isSaltOf(SF,BF) and multiply(Kb,MB,KbMB) and multiply(KbMB,-1,KbMBminus) and add(MS,Kb,MSKb) and quadratic(OH,1,MSKb,KbMBminus) and multiply(H,OH,1.0E-14).
Halo I: A Controlled Experiment for Large Scale Knowledge Base Development
31
Consider this rule in more detail. The first three lines of the body of the rule determine whether BF is the formula of a weak base and whether SF is a salt of this weak base BF and thus checks whether we have a buffer solution consisting of a weak base and its salt. The second part of the rule body then determines first the OHconcentration and then uses the relation H * OH = 1.0E-14 (eq.3) to determine the Hconcentration. The OH-concentration is given by the Kb-value of the weak acid and by the moles of the base MB and the salt MS (cf. ch. 17.2 Brown, LeMay and Bursten (2003), eq. 1,2): OH = -(Kb+MS) + sqrt((Kb+MS)2+4*Kb*MB))/2 This formula computes the OH-concentration in our case to 4.4 E-4 (eq.2). This results in an H-concentration of 2.27E-11 according to the formula H = 1.0E-14/OH (eq.3). Finally the pH-value is thus determined to 10.64 according to Ph = -log H (eq.4). Rule 3 gets its input BF=CH3NH2, MB=1, SF=CH3NH3Cl, MS=1 top-down propagated over the head, determining whether we have a buffer solution consisting of a weak base and its salt and then computes the H-concentration. This Hconcentration is then propagated bottom-up to rule2 which assigns the Hconcentration to the mixture. Finally rule2 computes the pH-value from the Hconcentration and assigns this pH-value to the mixture and thus delivers the first part of the query. This proof tree together with the intermediate instantiations of the variables is shown in figure 3. query
M,Ph
Rule 1: computes pH-value from H-concentration in a mixture M,H
Rule
M,BF,SF,MB
Input facts
2: assigns H-concentration to mixture and calls rule 3 H BF,SF,MB,
Rule 3: determines buffer type, computes H-concentration
Fig. 3. The proof tree shows the rule dependencies in our example case
32
J. Angele et al.
An analysis of the proof trees for the syllabus questions showed that the depth of these proof trees ranged from 1 up to 20. These proof trees are stored in a infrencing protocol (as F-Logic facts) to be used for generating explanations. Our inference system OntoBroker™ provides means for efficient reasoning with instances and for the capability to express arbitrary powerful rules, e.g. ones that quantify over the set of classes. As F-Logic relies on the well-founded semantics [17] a possible implementation is the alternating fixed point procedure. This is a forward chaining method which computes the entire model for the set of rules, i.e. the set of true and unknown facts. For answering a query according to its implementation, the entire model must be computed (if possible) to derive the variable substitutions for the query. In contrast, our inference engine OntoBroker™ performs a mixture of forward and backward chaining based on the dynamic filtering algorithm [18] to compute (the smallest possible) subset of the model for answering the query. In most cases this is much more efficient than simple evaluation strategies. These techniques stem from the deductive data base community and are optimized to deliver all answers instead of one single answer as e.g. resolution does. 2.4 The Answer Justification The mentioned inferencing process generated for question 44 the following justification: If 1 moles of the weak base CH3NH2 are mixed with 1 moles of its salt CH3NH3Cl, the concentration of OH−atoms in the resulting buffer solution is 4.4E−4 and thus the ph−value is 10.64 The [H+] concentration multiplied with the [OH−] concentration is always the ion−product constant of water 1.0E−14. In this case the values are [H+]=2.27E−11 and [OH−]=4.4E−4. The equation for calculating the ph−value is ph=−log[H+]. Thus we get ph−value ph = 10.64, H+ concentration [H+] = 2.27E−11. The explanations are generated in a second inference run by explanation rules working on the inference protocol (F-Logic facts). To each of the important rules in the knowledge base such an explanation rule is assigned: FORALL I,EX1,HP,OHM explain(EX1,I) >phvaluephOH; instantiatedVars>>{i(H,HP),i(OH,OHM)}] and EX1 is ("The [H+] concentration multiplied with the [OH-] concentration is always the ion-product constant of water 1.0E-14. In this case the values are [H+]="+HP+" and [OH-]="+OHM+"."). The first two lines of the rule body access the fact generated by the first inference run, i.e. the variables of the original rule and its instantiations. The second part generates the textual explanation. These explanation rules resemble the explanation templates of the SRI system.
Halo I: A Controlled Experiment for Large Scale Knowledge Base Development
33
Our system formatted the answers and the justifications into a pdf document which was the input for grading by the chemistry professors after the challenge run. Figure 4 shows the concrete output for question 20.
Fig. 4. Output for multiple choice question 20. Note the output’s format: the question number is indicated at the top; followed by the full English text of the original question; next, the letter answer is indicated; finally, the answer justification is presented. The graders written remarks are included.
3 Evaluation 3.1 The Experiment At the end of four months, knowledge formulation was stopped, even though the teams had not completed the task. All three systems were sequestered on identical servers at Vulcan. Then the challenge exam, consisting of 100 novel AP-style English questions, was released to the teams. The exam consisted of three sections: 50 multiple-choice questions and two sets of 25 multipart questions—the detailed answer and free form sections. The detailed answer section consisted mainly of quantitative questions requiring a “fill in the blank” (with explanation) or short essay response. The
34
J. Angele et al.
free form section consisted of qualitative, comprehension questions, which exercised additional reasoning tasks such as meta-reasoning, and relied more, if only in a limited way, on commonsense knowledge and reasoning. Due to the limited scope of the Pilot, there was no requirement that questions be input in their original, natural language form. Thus, two weeks were allocated to the teams for the translation of the exam questions into their respective formal languages. Upon completion of the encoding effort, the formal question encodings of each team were evaluated by a program-wide committee to guarantee high fidelity to the original English. Once the encodings were evaluated, Vulcan personnel submitted them to the sequestered systems. The evaluations ran in batch mode. Each of the three systems produced an output file in accordance with a pre-defined specification. Vulcan engaged three chemistry professors to evaluate the exams. Adopting an AP-style evaluation methodology, they graded each question for both correctness and the quality of the explanation. The exam encompassed 168 distinct gradable components consisting of questions and question sub-parts. 3.2 Empirical Results In general, all teams showed up with similar good scores in the challenge run. There was no time limit for the answering process, so that the teams’ systems did not take an AP exam under original conditions. The aim of the run was to test the general ability of the systems to answer questions of a complex domain. 3.3 Performance Processing performance of OntoNova (the ontoprise system[4]) has been much faster than its competitors, depending on the systems used to perform the challenge run. Our system for the official challenge run required about an hour to process the encodings. For a second, optional and not sequestrated run we slightly improved the knowledge base and brought down processing time to less than 10 minutes.
Challenge Answer Scores 60,00
Scores (%)
50,00 40,00 CYCORP ONTOPRISE SRI
30,00 20,00 10,00 0,00 SME1
SME2
SME3
Fig. 5. Challenge answer scores
Halo I: A Controlled Experiment for Large Scale Knowledge Base Development
35
Challenge Justification Scores 45,00 40,00
Scores (%)
35,00 30,00 CYCORP ONTOPRISE SRI
25,00 20,00 15,00 10,00 5,00 0,00 SME1
SME2
SME3
Fig. 6. Challenge justification scores
Run Times 30
27
Times (h)
25 CYCORP
20 15
ONTOPRISE
12
SRI
10 5
5 2
0,15 0,633
0 1
2
Challenge Run
Improved System
Fig. 7. Run times
4 Lessons Learned The analysis of failures showed that ontoprise lost points for mainly the following reasons: 1.
2. 3. 4.
The knowledge base contained a lot of typos, like wrongly or undefined variables in rules, faulty connections from explanation rules to their corresponding rules, lacking explanation rules etc., which prevented rules and explanation rules from firing. The knowledge base contains faults of the contents itself, like faulty assignments of substances to categories. The knowledge base did not entirely cover the domain. The knowledge base contained the knowledge in principle but this knowledge could not be exploited.
36
J. Angele et al.
5. 6.
7.
Explanations have been sometimes too lengthy and redundant. The knowledge base did not contain enough “common sense” knowledge to answer unexpected or very general queries. This especially holds for the free form section. Some of the questions where out of scope in the opinion of ontoprise.
The first point will in future be tackled by improving the modeling environment OntoStudioTM and by introspection. OntoStudioTM will in future allow parallel formation of axioms and their justification and will support tracking changes from rules into explanation rules and vice versa. This will solve many cases of justification brittleness. The reasoning capabilities of OntoBrokerTM cannot “only” be used for inferencing proper and answer justification, but also for maintaining consistency in the ontology and the knowledge base. In particular, we have investigated the Halo I knowledge base and found that reification of inference rules together with some simple checks (“Does every justification rule have a core inference rule?”, “Is every constant declared to be a constant and not a misspelled variable?” etc.) would have discovered simple errors. The removal of these simple errors would have improved correctness of answers by about 20% – to a record of around 50% correct answers overall! The points 2 and 3 will in future be supported by an enhanced testing environment. We used test cases consisting of queries to the knowledge base and expected answers to keep the knowledge base stable after modifications. This testing will be integrated into OntoStudioTM making it easier for the knowledge engineer to collect test cases and to run them against the knowledge base. Additionally it became clear that the knowledge base must be tested against a lot more examples which could not be done in Halo I due to the time restriction. Basically rules in F-Logic allow a lot of flexibility in different ways to query them. One major problem for failures of point 4 has been the built-ins used. OntobrokerTM contains around 150 builtins and a lot of these built-ins are exploitable in a restricted way only. For instance the builtin for solving a quadratic equation could only be used for computing the resulting x-values, given the values a,b,c. Computing the value a, given x,b, and c was not incorporated. These built-ins will be reengineered to make them as flexible as possible. Point 5 will be tackled by advanced answer justification. Additional steps will be: (i) integration of additional knowledge, (ii) reduction of redundancies of explanations, and (iii) abstraction from fine-grained explanations. In detail: (i), when the proof tree does not contain enough information in itself, additional information will be needed to create comprehensible explanations. In the context of chemistry, e.g., the proof tree contains the formulae of the different substances. However, in the explanations the names of the formulae are often necessary to produce understandable justifications. The generation of names from formulae then requires additional information not found within the proof tree. (ii), in knowledge bases different paths often lead to the same result. In chemistry, e.g., the acidity order of two substances may be determined by the pH-values that may be computed from the amount of substances in aqueous solutions – or they may be given by qualitative criteria like the number of oxygen elements in the formulae of the substances. Both criteria lead to the same ordering. As a consequence there are two different explanation paths for the same result. An explanation rule may rank these two explanation paths and ignore one of them when formulating the justification.
Halo I: A Controlled Experiment for Large Scale Knowledge Base Development
37
(iii), often it is necessary to come to different abstractions of explanations. For example for the purpose of debugging the knowledge base a very fine grained explanation level is necessary while for the grader a lower grained explanation level is more reasonable. The single inference steps and thus the proof tree which is a representation of these single inference steps provide the finest resolution of explanations. Additional rules may summarize these steps and may thus produce higher abstracted explanations. E.g. in the chemistry domain such rules may summarize the three different steps of a reaction like the (a) decomposition of the substances into their ionic compounds, (b) the composition of an insoluble substance out of these compounds and (c) the precipitation of the resulting substance from the solution as a precipitation reaction. Point 6 can to our opinion only be tackled by modeling more “common sense” knowledge. Still it has to be proven whether this is really true. Cycorp says that it incorporates a lot of such “common sense” knowledge in his knowledge base, but they have not been much better in the free form section compared to ontoprise. At least it is clear that the inference engine must be able to handle a larger knowledge base. The performance results have shown that ontoprise has an inference engine with a very high performance compared to the other teams.
5 Next Steps As we noted at the beginning of this article, Project halo is a multi-staged effort. In the foregoing, we have described Phase I, which assessed the capability of knowledge-based systems to answer a wide variety of unanticipated questions with coherent explanations. Phase II of Project Halo will examine whether tools can be built to enable domain experts to build such knowledge based systems with an ever-decreasing reliance on knowledge engineers. In 2004, ontoprise entered Phase II of Project Halo with a multi-national team, bringing together best-of-breed cutting edge technology and expertise: the DARKMATTER team (Deep Authoring, Answering and Representation of Knowledge by Subject Matter Experts). The DARKMATTER approach to the Halo-2 challenge can be described as a Semantic Web in the Small. Tim Berners-Lee, the inventor of the World Wide Web, envisions the Semantic Web as a global cooperation of individuals contributing data, ontology and logical rules to support sophisticated machine-generated answers from the Web. The DARKMATTER team adopts relevant Semantic Web principles to be applied in the small, while abstracting from some of the riskier and more intricate issues associated with the Semantic Web (like dynamic trust). The Semantic Web in the small is document-rooted, i.e. a lot of knowledge is acquired from existing content by reformulating it in formal terms. The DARKMATTER approach improves upon existing technology, allowing subject matter experts to interact with formal scientific knowledge by themselves in an intuitive way. The goal of DARKMATTER STUDIO, the system we are proposing, is to allow knowledge formation by subject matter experts (SMEs) at a cost of less than $1000 per page of input text — comparable to the costs estimated by publishers for producing a page of textbook text. The DARKMATTER QUERYINTERFACE has been designed to support questioning of the system by users with no training in knowledge formalization. Together, the DARKMATTER components will provide a system
38
J. Angele et al.
able to answer AP-like exam questions, achieving at least an AP level 3 score — the sophistication achieved by Halo-1 systems. To reach these objectives, DARKMATTER STUDIO and DARKMATTER QUERYINTERFACE are designed along four dimensions. First, our analysis has shown what knowledge types occur in AP exams in biology, chemistry and physics. Second, SMEs have different cognitive abilities they may draw upon when working with knowledge, for example interacting with texts, diagrams or visualizations of conceptual structures. Correspondingly, we provide user interfaces that support these different modalities. Third, formulating knowledge and utilizing it constitutes a knowledge life cycle with a number of steps, viz. knowledge entry, justification authoring, testing, debugging, validation, querying and presentation. Configurations of user interfaces (so called Perspectives) work together to support the major different steps in the knowledge formation and questioning life cycle. Fourth, Semantic Web technologies provide the representation and reasoning platform in which knowledge formation is restricted to instantiating and refining ontologies and linking between knowledge modules aka Semantic Web pages in the small. Each member of the DARKMATTER team has been selected in order to reflect the challenging nature of the Halo-2 undertaking: Ontoprise for system integration, knowledge representation and reasoning as well as knowledge acquisition, CarnegieMellon University (CMU) for natural language processing; DFKI (German institute for AI) for intelligent user interfaces and usability; Georgia Institute of Technology for understanding and reasoning with diagrams; and University of Brighton, UK, for intuitive querying. Project Halo in general, and DARKMATTER in particular, may become for the field of knowledge representation what the World Wide Web became for hypertext. Just as the WWW protocols built in an clever way on top of existing infrastructure, DARKMATTER builds on existing frameworks with over 30 years of research to make the theoretical achievements of knowledge representation and reasoning available for a wide audience in a Semantic Web in the Small. Just as the WWW was of immediate value to its users, even at the time when only one single Web server existed, it will be crucial to the success of DARKMATTER that it provides immediate added value to its users. To do so, DARKMATTER builds on a comprehensive analysis investigating the capabilities and possible needs of its future user base. Halo-2 starts at an appropriate time. At present, the Semantic Web at large targets a representational infrastructure with objectives that coincide with those of project Halo. It must not be forgotten, however, that the value of the original WorldWideWeb was not created just by the defined protocols, but also by tools that were easy to use, like Mosaic. In this sense, DARKMATTER represents the knowledge formulation and question answering system of a future scientific SemanticWeb. Being an interface used to teach and interact 15 with the Digital Aristotle, DARKMATTER may become the equivalent of Front Page and Internet Explorer for the Semantic Web. Just as the WWW has changed the way we retrieve texts and work online, a system like DARKMATTER has the potential to change the way that scientists and engineers do research or teaching in the future.
Halo I: A Controlled Experiment for Large Scale Knowledge Base Development
39
References 1. Voorhees, E.M., The TREC-8 Question Answering Track Report, in The Eighth Text REtrieval Conference (TREC-8). 1999. p. 77-82. 2. Brown, T.L., et al., Chemistry: The Central Science. 2003, New Jersey: Prentice Hall. 3. Barker, K., et al. A Question-answering System for AP Chemistry: Assessing KRR Technologies. in 9th International Conference on Principles of Knowledge Representation and Reasoning. 2004. Whistler, Canada. 4. Angele, J., et al., Ontology-based Query and Answering in Chemistry: Ontonova @ Project Halo, . 2003. 5. Witbrock, M. and G. Matthews, Cycorp Project Halo Final Report. 2003. 6. Barker, K., B. Porter, and P. Clark, A Library of Generic Concepts for Composing Knowledge Bases, in Proc. 1st Int Conf on Knowledge Capture (K-Cap'01). 2001. p. 14--21. 7. Novak, G., Conversion of Units of Measurement. IEEE Transactions on Software Engineering, 1995. 21(8): p. 651-661. 8. Clancey, W.J., The epistemology of a rule-based expert system: A framework for explanation. Artificial Intelligence, 1983. 20: p. 215-251. 9. Voorheese, E.M., Overview of TREC Question Answering Task, . 2001. 10. Chaudhri, V. and R. Fikes, eds. AAAI Fall Symposium on Question Answering Systems. . 1999, AAAI. 11. Neches, R., et al., Enabling Technology for Knowledge Sharing. AI Magazine, 1991. 12(3): p. 36--56. 12. Cohen, P., et al., The DARPA High Performance Knowledge Bases Project. AI Magazine, 1998. 19(4): p. 25--49. 13. Brachman, R.J., et al., Reducing CLASSIC to ``Practice'': Knowledge Representation Theory Meets Reality. Artificial Intelligence Journal, 1999. 114: p. 203-237. 14. Keyes, J., Why Expert Systems Fail? IEEE Expert, 1989. 4: p. 50-53. 15. Batanov, D. and P. Brezillon, eds. First International Conference on Successes and Failures of Knowledge-based Systems in Real World Applications. . 1996, Asian Institute of Technology: Bangkok, Thailand. 16. Pool, M., J.F. K. Murray, M. Mehrotra, R. Schrag, J. Blythe,, and H.C. J. Kim, P. Miraglia, T. Russ, and D. Schneider. Evaluation of Expert Knowledge Elicited for Critiquing Military Courses of Action. in Proceedings of the Second International Conference on Knowledge Capture (KCAP-03). 2003. 17. A. Van Gelder, K. A. Ross, and J. S. Schlipf. The well-founded semantics for general logic programs. Journal of the ACM, 38(3):620–650, July 1991. 18. M. Kifer and E. Lozinskii. A framework for an efficient implementation of deductive databases. In Proceedings of the 6th Advanced Database Symposium, pages 109–116, Tokyo, August 1986. 19. M. Kifer, G. Lausen, and J.Wu. Logical foundations of object-oriented and framebased languages. Journal of the ACM, 42:741–843, 1995.
Unfounded Sets for Disjunctive Logic Programs with Arbitrary Aggregates Wolfgang Faber Department of Mathematics, University of Calabria, 87030 Rende (CS), Italy [email protected]
Abstract. Aggregates in answer set programming (ASP) have recently been studied quite intensively. The main focus of previous work has been on defining suitable semantics for programs with arbitrary, potentially recursive aggregates. By now, these efforts appear to have converged. On another line of research, the relation between unfounded sets and (aggregate-free) answer sets has lately been rediscovered. It turned out that most of the currently available answer set solvers rely on this or closely related results (e.g., loop formulas). In this paper, we unite these lines and give a new definition of unfounded sets for disjunctive logic programs with arbitrary, possibly recursive aggregates. While being syntactically somewhat different, we can show that this definition properly generalizes all main notions of unfounded sets that have previously been defined for fragments of the language. We demonstrate that, as for restricted languages, answer sets can be crisply characterized by unfounded sets: They are precisely the unfounded-free models. This result can be seen as a confirmation of the robustness of the definition of answer sets for arbitrary aggregates. We also provide a comprehensive complexity analysis for unfounded sets, and study its impact on answer set computation.
1 Introduction The introduction of aggregate atoms [1,2,3,4,5,6,7,8] is one of the major linguistic extensions to Answer Set Programming of the recent years. While both semantic and computational properties of standard (aggregate-free) logic programs have been deeply investigated, relatively few works have focused on logic programs with aggregates; some of their semantic properties and their computational features are still far from being fully clarified. The proposal for answer set semantics in [8] seems to be receiving a consensus. Recent works, such as [9,10] give further support for the plausibility of this semantics by relating it to established constructs for aggregate-free programs. In particular, [9] presented a semantics for very general programs, and showed that it coincides with both answer sets of [8] and Smodels answer sets (the latter holds for weight constraints with positive weights only). In [10] the notion of unfounded sets is extended from aggregatefree programs to programs with aggregates in a conservative way, retaining important
This work was supported by an APART grant of the Austrian Academy of Sciences and the European Commission under projects IST-2002-33570 INFOMIX, IST-2001-37004 WASP.
C. Baral et al. (Eds.): LPNMR 2005, LNAI 3662, pp. 40–52, 2005. c Springer-Verlag Berlin Heidelberg 2005
Unfounded Sets for Disjunctive Logic Programs with Arbitrary Aggregates
41
semantical and computational properties. It should be noted that unfounded sets are the basis of virtually all currently available ASP solvers [11,4,12,13,14,15]. Extending this notion to programs with aggregates should therefore be seen as paving the way to effective and efficient systems for programs with aggregates. However, in [10] only a fragment of the language has been considered, namely nondisjunctive programs with monotone and antimonotone aggregates. In this paper we lift this restriction and define unfounded sets for disjunctive programs with arbitrary aggregates. To this end, some substantial change in the definition is necessary to account for nonmonotone aggregates. Nevertheless, we are able to prove that our definition is a clean extension of all main previous notions of unfounded sets: On the respective fragments, our unfounded sets always coincide with the previously proposed ones. Importantly, we can show that our notion of unfounded sets crisply characterizes both models and answer sets of [8] for arbitrary programs. We also study complexity issues for unfounded sets and put them into perspective with respect to complexity of reasoning tasks on answer sets for various fragments of programs with aggregates. Finally, we discuss the impact of our results on computation. Summarizing, our contributions are as follows: – We define the notion of unfounded sets for disjunctive logic programs with arbitrary aggregates. We demonstrate that this notion is a sound generalization of all main previous concepts of unfounded sets. – We analyze the properties of our unfounded sets, which parallel those of previous definitions. We show that a unique greatest unfounded set always exists for the class of unfounded-free interpretations. – We characterize answer sets in terms of unfounded sets. One of the results is that a model is an answer sets iff it is unfounded-free. – We study the complexity of determining unfounded-freeness of an interpretation, and deduce the complexity for answer set checking, which turns out to be a crucial factor for the complexity of query answering. – We indicate applications of our results; in particular, they allow to conceive how to build efficient systems for computing answer sets for programs with aggregates.
2 Logic Programs with Aggregates 2.1 Syntax We assume that the reader is familiar with standard LP; we refer to the respective constructs as standard atoms, standard literals, standard rules, and standard programs. Two literals are said to be complementary if they are of the form p and not p for some atom p. Given a literal L, ¬.L denotes its complementary literal. Accordingly, given a set A of literals, ¬.A denotes the set {¬.L | L ∈ A}. For further background, see [16,17]. Set Terms. A DLPA set term is either a symbolic set or a ground set. A symbolic set is a pair {Vars : Conj }, where Vars is a list of variables and Conj is a conjunction of
42
W. Faber
standard atoms.1 A ground set is a set of pairs of the form t : Conj , where t is a list of constants and Conj is a ground (variable free) conjunction of standard atoms. Aggregate Functions. An aggregate function is of the form f (S), where S is a set term, and f is an aggregate function symbol. Intuitively, an aggregate function can be thought of as a (possibly partial) function mapping multisets of constants to a constant. Example 1. In the examples, we adopt the syntax of DLV to denote aggregates. Aggregate functions currently supported by the DLV system are: #count (number of terms), #sum (sum of non-negative integers), #times (product of positive integers), #min (minimum term), #max (maximum term)2 . Aggregate Literals. An aggregate atom is f (S) ≺ T , where f (S) is an aggregate function, ≺∈ {=, <, ≤, >, ≥} is a predefined comparison operator, and T is a term (variable or constant) referred to as guard. Example 2. The following aggregate atoms are in DLV notation, where the latter contains a ground set and could be a ground instance of the former: #max{Z : r(Z), a(Z, V )} > Y
#max{2 : r(2), a(2, k), 2 : r(2), a(2, c)} > 1
An atom is either a standard atom or an aggregate atom. A literal L is an atom A or an atom A preceded by the default negation symbol not; if A is an aggregate atom, L is an aggregate literal. DLPA Programs. A DLPA rule r is a construct a1 ∨ · · · ∨ an :− b1 , . . . , bk , not bk+1 , . . . , not bm .
where a1 , · · · , an are standard atoms, b1 , · · · , bm are atoms, and n ≥ 1, m ≥ k ≥ 0. The disjunction a1 ∨ · · · ∨ an is referred to as the head of r while the conjunction b1 , ..., bk , not bk+1 , ..., not bm is the body of r. We denote the set of head atoms by H(r), and the set {b1 , ..., bk , not bk+1 , ..., not bm } of the body literals by B(r). B + (r) and B − (r) denote, respectively, the set of positive and negative literals in B(r). Note that this syntax does not explicitly allow integrity constraints (rules without head atoms). They can, however, be simulated in the usual way by using a new symbol and negation. A DLPA program is a set of DLPA rules. In the sequel, we will often drop DLPA , when it is clear from the context. A global variable of a rule r appears in a standard atom of r (possibly also in other atoms); all other variables are local variables. Safety. A rule r is safe if the following conditions hold: (i) each global variable of r appears in a positive standard literal in the body of r; (ii) each local variable of r appearing in a symbolic set {Vars : Conj } appears in an atom of Conj ; (iii) each guard of an aggregate atom of r is a constant or a global variable. A program P is safe if all r ∈ P are safe. In the following we assume that DLPA programs are safe. 1
2
Intuitively, a symbolic set {X : a(X, Y ), p(Y )} stands for the set of X-values making a(X, Y ), p(Y ) true, i.e., {X | ∃Y s.t. a(X, Y ), p(Y ) is true}. The first two aggregates roughly correspond, respectively, to the cardinality and weight constraint literals of Smodels. #min and #max are undefined for empty set.
Unfounded Sets for Disjunctive Logic Programs with Arbitrary Aggregates
43
2.2 Answer Set Semantics Universe and Base. Given a DLPA program P, let UP denote the set of constants appearing in P, and BP be the set of standard atoms constructible from the (stanX dard) predicates of P with constants in UP . Given a set X, let 2 denote the set of all multisets over elements from X. Without loss of generality, we assume that aggregate functions map to I (the set of integers). UP
N
N+
Example 3. #count is defined over 2 , #sum over 2 , #times over 2 , #min and N #max are defined over 2 − {∅}. Instantiation. A substitution is a mapping from a set of variables to UP . A substitution from the set of global variables of a rule r (to UP ) is a global substitution for r; a substitution from the set of local variables of a symbolic set S (to UP ) is a local substitution for S. Given a symbolic set without global variables S = {Vars : Conj }, the instantiation of S is the following ground set of pairs inst(S): {γ(Vars) : γ(Conj ) | γ is a local substitution for S}.3 A ground instance of a rule r is obtained in two steps: (1) a global substitution σ for r is first applied over r; (2) every symbolic set S in σ(r) is replaced by its instantiation inst(S). The instantiation Ground(P) of a program P is the set of all possible instances of the rules of P. Interpretations. An interpretation for a DLPA program P is a consistent set of standard ground literals, that is I ⊆ (BP ∪ ¬.BP ) such that I ∩ ¬.I = ∅. A standard ground literal L is true (resp. false) w.r.t I if L ∈ I (resp. L ∈ ¬.I). If a standard ground literal is neither true nor false w.r.t I then it is undefined w.r.t I. We denote by I + (resp. I − ) the set of all atoms occurring in standard positive (resp. negative) literals in I. We denote by I¯ the set of undefined atoms w.r.t. I (i.e. BP \ I + ∪ I − ). An interpretation I is total if I¯ is empty (i.e., I + ∪ ¬.I − = BP ), otherwise I is partial. An interpretation also provides a meaning for aggregate literals. Their truth value is first defined for total interpretations, and then generalized to partial ones. Let I be a total interpretation. A standard ground conjunction is true (resp. false) w.r.t I if all its literals are true (resp. false). The meaning of a set, an aggregate function, and an aggregate atom under an interpretation, is a multiset, a value, and a truth-value, respectively. Let f (S) be a an aggregate function. The valuation I(S) of S w.r.t. I is the multiset of the first constant of the elements in S whose conjunction is true w.r.t. I. More precisely, let I(S) denote the multiset [t1 | t1 , ..., tn : Conj ∈ S∧ Conj is true w.r.t. I ]. The valuation I(f (S)) of an aggregate function f (S) w.r.t. I is the result of the application of f on I(S). If the multiset I(S) is not in the domain of f , I(f (S)) = ⊥ (where ⊥ is a fixed symbol not occurring in P). An instantiated aggregate atom A of the form f (S) ≺ k is true w.r.t. I if: (i) I(f (S)) = ⊥, and, (ii) I(f (S)) ≺ k holds; otherwise, A is false. An instantiated aggregate literal not A = not f (S) ≺ k is true w.r.t. I if (i) I(f (S)) = ⊥, and, (ii) I(f (S)) ≺ k does not hold; otherwise, A is false. 3
Given a substitution σ and a DLP A object Obj (rule, set, etc.), we denote by σ(Obj) the object obtained by replacing each variable X in Obj by σ(X).
44
W. Faber
If I is a partial interpretation, an aggregate literal A is true (resp. false) w.r.t. I if it is true (resp. false) w.r.t. each total interpretation J extending I (i.e., ∀ J s.t. I ⊆ J, A is true (resp. false) w.r.t. J); otherwise it is undefined. Example 4. Consider the atom A = #sum{1 : p(2, 1), 2 : p(2, 2)} > 1. Let S be the ground set in A. For the interpretation I = {p(2, 2)}, each extending total interpretation contains either p(2, 1) or not p(2, 1). Therefore, either I(S) = [2] or I(S) = [1, 2] and the application of #sum yields either 2 > 1 or 3 > 1, hence A is true w.r.t. I. Remark 1. Our definitions of interpretation and truth values preserve “knowledge monotonicity”. If an interpretation J extends I (i.e., I ⊆ J), then each literal which is true w.r.t. I is true w.r.t. J, and each literal which is false w.r.t. I is false w.r.t. J as well. Minimal Models. Given an interpretation I, a rule r is satisfied w.r.t. I if some head atom is true w.r.t. I whenever all body literals are true w.r.t. I. A total interpretation M is a model of a DLPA program P if all r ∈ Ground(P) are satisfied w.r.t. M . A model M for P is (subset) minimal if no model N for P exists such that N + ⊂ M + . Note that, under these definitions, the word interpretation refers to a possibly partial interpretation, while a model is always a total interpretation. Answer Sets. We now recall the generalization of the Gelfond-Lifschitz transformation and answer sets for DLPA programs from [8]: Given a ground DLPA program P and a total interpretation I, let P I denote the transformed program obtained from P by deleting all rules in which a body literal is false w.r.t. I. I is an answer set of a program P if it is a minimal model of Ground(P)I . Example 5. Consider interpretation I1 = {p(a)}, I2 = {not p(a)} and two programs
P1 = {p(a) :− #count{X : p(X)} > 0.} and P2 = {p(a) :− #count{X : p(X)} < 1.}. Ground(P1 ) = {p(a) :− #count{a : p(a)} > 0.} and Ground(P1 )I1 = Ground(P1 ), Ground(P1 )I2 = ∅. Furthermore, Ground(P2 ) = {p(a) :− #count{a : p(a)} < 1.}, and Ground(P2 )I1 = ∅, Ground(P2 )I2 = Ground(P2 ) hold.
I2 is the only answer set of P1 (since I1 is not a minimal model of Ground(P1 )I1 ), while P2 admits no answer set (I1 is not a minimal model of Ground(P2 )I1 , and I2 is not a model of Ground(P2 ) = Ground(P2 )I2 ). Note that any answer set A of P is also a model of P because Ground(P)A ⊆ Ground(P), and rules in Ground(P) − Ground(P)A are satisfied w.r.t. A. Monotonicity. Given two interpretations I and J we say that I ≤ J if I + ⊆ J + and J − ⊆ I − . A ground literal is monotone, if for all interpretations I, J, such that I ≤ J, we have that: (i) true w.r.t. I implies true w.r.t. J, and (ii) false w.r.t. J implies false w.r.t. I. A ground literal is antimonotone, if the opposite happens, that is, for all interpretations I, J, such that I ≤ J, we have that: (i) true w.r.t. J implies true w.r.t. I, and (ii) false w.r.t. I implies false w.r.t. J. A ground literal is nonmonotone, if it is neither monotone nor antimonotone. Note that positive standard literals are monotone, whereas negative standard literals are antimonotone. Aggregate literals may be monotone, antimonotone or nonmonotone, regardless whether they are positive or negative. Nonmonotone literals include the sum over (possibly negative) integers and the average.
Unfounded Sets for Disjunctive Logic Programs with Arbitrary Aggregates
45
3 Unfounded Sets We now give a definition of unfounded set for arbitrary DLPA programs. It should be noted that it is not possible to just take over the previous definitions in [18,11,10], as all of them make a distinction on the kind of atoms, be it positive and negative atoms, or the generalized version of monotone and antimonotone atoms. Just as in [8], where the same problem with the transformation of the program was lifted, we need to introduce a novel definition, which does not distinguish between the kinds of atoms. In the following we denote by S1 ∪˙ ¬.S2 the set (S1 \ S2 ) ∪ ¬.S2 , where S1 and S2 are sets of standard ground literals. Definition 1 (Unfounded Set). A set X of ground atoms is an unfounded set for a program P w.r.t. an interpretation I if, for each rule r in Ground(P) having some atoms from X in the head, at least one of the following conditions holds: 1. some literal of B(r) is false w.r.t. I, 2. some literal of B(r) is false w.r.t. I ∪˙ ¬.X, or 3. some atom of H(r) \ X is true w.r.t. I. Intuitively, conditions 1 and 3 state that rule satisfaction does not depend on the atoms in X, while condition 2 ensures that the rule is satisfied also if the atoms in X are switched to false. Note that ∅ is always an unfounded set, independent of interpretation and program. Example 6. Let interpretation I0 = ∅ and P = {a(0) ∨ a(1) :− #avg{X : a(X)} = 1., a(2) ∨ a(1) :− #avg{X : a(X)} = 1.}. The unfounded sets w.r.t. I0 are ∅, {a(0), a(1)}, {a(1), a(2)}, and {a(0), a(1), a(2)}. Only condition 2 applies in these cases. For I1 = {a(0)}, {a(1), a(2)}, and {a(0), a(1), a(2)} are unfounded sets. For I2 = {a(1)}, {a(0)}, {a(2)}, {a(0), a(2)}, and {a(0), a(1), a(2)} are unfounded sets. For I3 = {not a(0), not a(1)}, {a(0), a(1), a(2)} and all of its subsets are unfounded sets. In the sequel, we will demonstrate the robustness of Def. 1, and show that some crucial properties of unfounded sets of nondisjunctive, aggregate-free programs continue to hold, while a few others do not, basically mirroring unfounded sets for disjunctive, aggregate-free programs. We first show that Def. 1 is a generalization of a previous definition of unfounded sets for aggregate-free programs: Theorem 1. For an aggregate-free program P and interpretation I, any unfounded set w.r.t. Def. 1 is an unfounded set as defined in [11]. Proof. Recall that a set X of ground atoms is unfounded w.r.t. Def. 3.1 of [11], if at least one of the following conditions holds for each rule r in Ground(P ) having some atoms from X in the head: (a) B(r) ∩ ¬.I = ∅, or (b) B + (r) ∩ X = ∅, or (c) (H(r) \ X) ∩ I = ∅. On the other hand, in the aggregate-free case, Def. 1 amounts to: (1) B(r) ∩ ¬.I = ∅, or (2) B(r) ∩ ¬.(I ∪˙ ¬.X) = ∅, or (3) (H(r) \ X) ∩ I = ∅. Obviously, (a) is equivalent to (1), and (c) is equivalent to (2). Now observe that B + (r) ∩ X = ∅ implies B(r) ∩ X = ∅, which implies B(r) ∩ (¬.(I \ X) ∪ X) = ∅ which is equivalent to B(r) ∩ ¬.((I \ X) ∪ ¬.X) = ∅ ⇔ B(r) ∩ ¬.(I ∪˙ ¬.X) = ∅, so
46
W. Faber
(b) implies (2). On the other hand, (2) is equivalent to B(r) ∩ ((¬.I \ ¬.X) ∪ X) = ∅, and therefore (A) B(r) ∩ (¬.I \ ¬.X) = ∅ or (B) B(r) ∩ X = ∅ holds. (A) clearly implies (a), and (B) implies (b) because X contains only atoms, hence B − (r) ∩ X = ∅. In total, (2) implies (a) or (b). 2 By Proposition 3.3 in [11], unfounded sets of [11] generalize the “original” unfounded sets of [18], which were defined for nondisjunctive programs. Therefore it follows from Theorem 1 that also unfounded sets of Def. 1 generalize those of [18] on nondisjunctive programs without aggregates. Corollary 1. For a nondisjunctive, aggregate-free program P and interpretation I, any unfounded set w.r.t. Def. 1 is a standard unfounded set (as defined in [18]). Recently, unfounded sets have been defined for nondisjunctive programs with monotone and antimonotone aggregates in [10]. Def. 1 also generalizes this notion. Theorem 2. For a nondisjunctive program P with only monotone and antimonotone aggregates and interpretation I, any unfounded set w.r.t. Def. 1 is an unfounded set w.r.t. [10]. Proof. A set X of ground atoms is unfounded w.r.t. [10], if at least one of the following conditions holds for each rule r in Ground(P ) having some atoms from X in the head: (a) some antimonotone body literal of r is false w.r.t. I, and (b) some monotone body literal of r is false w.r.t. I ∪˙ ¬.X. We first observe that condition 3 is always false for nondisjunctive programs, as H(r) \ X = ∅, since H(r) ∩ X = ∅ and |H(r)| ≤ 1. Now, observe that I ∪˙ ¬.X ≤ I holds. So, if a monotone body literal of r is false w.r.t. I, it is also false w.r.t. I ∪˙ ¬.X, and if an antimonotone body literal of r is false w.r.t. I ∪˙ ¬.X, it must be false w.r.t. I. Therefore, if condition 1 holds for a monotone literal, also condition 2 and (b) hold for this literal; conversely, if condition 2 holds for an antimonotone literal, also condition 1 and (a) hold for it. So, since (a) and (b) trivially imply condition 1 and 2, respectively, we obtain equivalence. 2 The union of two unfounded sets of nondisjunctive, aggregate-free programs is guaranteed to be an unfounded set as well. For disjunctive programs, this does not hold; also the addition of nonmonotone aggregates invalidates this property. Observation 3. If X1 and X2 are unfounded sets for a program P w.r.t. I, then X1 ∪X2 is not necessarily an unfounded set for P w.r.t. I, even if P is nondisjunctive. Example 7. Consider I = {a(0), a(1), a(−1)} and P ={a(1) :− #avg{X : a(X)} = 0., a(−1) :− #avg{X : a(X)} = 0., a(0).}. Both {a(1)} and {a(−1)} are unfounded sets for P w.r.t. I, while {a(1), a(−1)} is not unfounded. In this example, some elements in unfounded sets occur also in the interpretation. This is not a coincidence, as shown by the following proposition. Proposition 1. If X1 and X2 are unfounded sets for a program P w.r.t. I and both X1 ∩ I = ∅ and X2 ∩ I = ∅ hold, then X1 ∪ X2 is an unfounded set for P w.r.t. I.
Unfounded Sets for Disjunctive Logic Programs with Arbitrary Aggregates
47
Proof. Consider a rule r where H(r) ∩ X1 = ∅ (symmetric arguments hold for X2 ). At least one of the conditions of Def. 1 holds w.r.t. X1 . We will show that the conditions also hold w.r.t. X1 ∪ X2 . If condition 1 holds w.r.t. X1 , then it trivially holds also for X1 ∪ X2 . If condition 2 holds, a body literal is false w.r.t. I ∪˙ ¬.X1 , so it is false w.r.t. I ∪¬.X1 (since I ∩X1 = ∅). Because of Remark 1, it is then also false w.r.t. I ∪¬.X1 ∪¬.X2 = I ∪˙ ¬.(X1 ∪ X2 ). If condition 3 holds, some atom a of H(r) \ X1 is true w.r.t. I, so a ∈ I. It follows that a ∈ X2 , and so a ∈ H(r) \ (X1 ∪ X2 ) is still true w.r.t. I. 2 We next define interpretations which never contain any element of their unfounded sets. Definition 2 (Unfounded-free Interpretation). Let I be an interpretation for a program P. I is unfounded-free if I ∩ X = ∅ for each unfounded set X for P w.r.t. I. For unfounded-free interpretations, Prop. 1 holds for all unfounded sets. Corollary 2. If X1 and X2 are unfounded sets for a program P w.r.t. an unfounded-free interpretation I, then also X1 ∪ X2 is an unfounded set for P w.r.t. I. We can therefore define the Greatest Unfounded Set (GUS) for unfounded-free interpretations as the union of all unfounded sets. Note that for non-unfounded-free interpretations, there is in general no unique GUS, as demonstrated in Ex. 7. Definition 3. Given a program P and an unfounded-free interpretation I, let GUSP (I) (the GUS for P w.r.t. I) denote the union of all unfounded set for P w.r.t. I. These features are shared with disjunctive logic programs without aggregates, as discussed in [11]. However, while aggregate- and disjunction-free programs possess a unique GUS for arbitrary interpretations, Ex. 7 shows that this does not hold for disjunction-free programs with aggregates. By virtue of Thm. 2 and Thm. 10 of [10], which states that a unique GUS exists for nondisjunctive programs with monotone and antimonotone aggregates, we can infer that the presence of nonmonotone aggregates or disjunction and a non-unfounded-free interpretation is necessary to invalidate the existence of a unique GUS.
4 Unfounded Sets and Answer Sets We will now use the notion of unfounded sets to characterize models and answer sets. We begin with models and show that the negative part of a model is an unfounded set and vice versa. Theorem 4. Given a total interpretation I and program P, I − is an unfounded set for P w.r.t. I iff I is a model of P. Proof. (⇒) : For any rule, either (i) H(r) ∩ I − = ∅, or (ii) H(r) ∩ I − = ∅. If (i), then H(r) ∩ I = ∅, i.e. the head is true and r is satisfied w.r.t. I. If (ii) then one of the conditions of Def. 1 must hold. If condition 1 holds, the body is false w.r.t. I and r is satisfied w.r.t. I. If condition 2 holds, a body literal is false w.r.t. I ∪˙ ¬.I − = I, so it
48
W. Faber
coincides with condition 1. If condition 3 holds, H(r) ∩ I = ∅, and therefore the rule is satisfied w.r.t. I. In total, if I − is an unfounded set for P w.r.t. I, all rules are satisfied w.r.t. I, hence I is a model of P. (⇐) : If I is a model, all rules are satisfied, so for any rule r, either (i) H(r) ∩ I = ∅ or (ii) if H(r) ∩ I = ∅ then a body literal l is false w.r.t. I. So also for any rule r with H(r) ∩ I − = ∅, either (i) or (ii) holds. If (i), then condition 3 of Def. 1 applies. If (ii), then condition 1 (and also condition 2, since I ∪˙ ¬.I − = I) applies. Therefore I − is an unfounded set. 2 We now turn to answer sets. Each answer set is a model, so its negative part is an unfounded set. We can show that it is the greatest unfounded set. Conversely, if the negative part of a total interpretation is its greatest unfounded set, it is an answer set. Theorem 5. A total interpretation I is an answer set of P iff I − = GUSP (I)4 . Proof. (⇒) : If I is an answer set, it is also a model of P, so by Thm. 4, I − is an unfounded set for P w.r.t. I. We next show that I is unfounded-free w.r.t. P, from which I − = GUSP (I) follows. Let us assume an unfounded set X for P w.r.t. I exists such that I ∩ X = ∅. We can show that then I ∪˙ ¬.X is a model of P I , contradicting the fact that I is an answer set of P. First note that for any rule r in P I , all body literals are true w.r.t. I (by construction of P I ), and H(r) ∩ I = ∅ (since I is a model of P I ). We differentiate two cases: (i) H(r) ∩ (I ∪˙ ¬.X) = ∅ and (ii) H(r) ∩ (I ∪˙ ¬.X) = ∅. For (i), r is trivially satisfied by I ∪˙ ¬.X. For (ii), since we know H(r) ∩ I = ∅, H(r) ∩ X = ∅ must hold. Since X is an unfounded set w.r.t P and I (and r ∈ P), a body literal of r must be false w.r.t. I ∪˙ ¬.X (note that neither a body literal of r is false w.r.t. I since r ∈ P I , nor (H(r) \ X) ∩ I = ∅ holds, otherwise H(r) ∩ (I ∪˙ ¬.X) = ∅). So r is satisfied also in case (ii). I ∪˙ ¬.X is therefore a model of P I , and since (I ∪˙ ¬.X)+ ⊂ I + , I is not a minimal model of P I , contradicting that I is an answer set of P. (⇐) : By Thm. 4 if I − is an unfounded set for P w.r.t. I, I is a model of P, so it is also a model of P I . We show by contradiction that it is in fact a minimal model of P I . Assume that a total interpretation J, where J + ⊂ I + , is a model of P I . Since both J and I are total, J − ⊃ I − . Again by Thm. 4, J − is an unfounded set for P I w.r.t. J. We can then show that J − is also an unfounded set for P w.r.t. I, contradicting the fact that I − is GUSP (I). For any rule in P \ P I , a body literal is false w.r.t. I, so condition 1 of Def. 1 holds. For a rule r ∈ P I such that H(r) ∩ J − = ∅, (a) a body literal of r is false w.r.t. J (note that J ∪˙ ¬.J − = J) or (b) an atom a in H(r) \ J − is true w.r.t. J. Concerning (a), observe that I ∪˙ ¬.J − = J so (a) holds iff a body atom is false w.r.t. I ∪˙ ¬.J − . Concerning (b), since J + ⊂ I + , atom a is also true w.r.t. I. In total, we have shown that J − is an unfounded set for P w.r.t. I, a contradiction to I − = GUSP (I). So I is indeed a minimal model of P I , and hence an answer set of P. 2 Since the existence of the GUS implies that the interpretation is unfounded-free, we obtain also: Corollary 3. A model I of a program P is unfounded-free iff I is an answer set of P. 4
Note that by Def. 3, the existence of GUSP (I) implies that I is unfounded-free.
Unfounded Sets for Disjunctive Logic Programs with Arbitrary Aggregates
49
5 Computational Complexity We will now study the complexity involved with unfounded sets. In particular, we are interested in the question whether a total interpretation is unfounded-free, as by Cor. 3 this notion can be fruitfully used for computing answer sets. Throughout this section, we assume that the truth value of aggregates can be established in polynomial time, which is feasible for all aggregates currently available in ASP systems. If, however, aggregate truth valuation has a higher complexity, the total complexity will increase accordingly. We first show membership for the full language, and then hardness for a restricted fragment, implying completeness for both languages and anything in between. Theorem 6. Given a ground disjunctive logic program P, and a total interpretation I, deciding whether I is unfounded-free w.r.t. P is in co-NP. Proof. The complementary problem (deciding whether I is not unfounded-free) is in NP: Guess X ⊆ BP and check that 1. X is an unfounded set for P w.r.t. I, and 2. that X ∩ I = ∅. Both 1. and 2. are feasible in polynomial time, assuming that determining the truth value of an aggregate literal can be done in polynomial time. 2 Next we show that deciding unfounded-freeness is a hard problem even for a simple class of programs, provided that nonmonotone aggregates may be present. Theorem 7. Given a ground nondisjunctive, negation-free logic program P with arbitrary aggregates, and a total interpretation I, deciding whether I is unfounded-free w.r.t. P is co-NP-hard. Proof. We give a reduction from the problem of unsatisfiability of a propositional 3CNF m m i φ = (c11 ∨ c12 ∨ c13 ) ∧ . . . ∧ (cm 1 ∨ c2 ∨ c3 ) where each cj is a literal over one of n variables V = {x1 , . . . , xn }. We construct a program P(φ): x1 (1) :− #avg{X : x1 (X)} = 0. x1 (−1) :− #avg{X : x1 (X)} = 0. .. . xn (1) :− #avg{X : xn (X)} = 0. xn (−1) :− #avg{X : xn (X)} = 0.
x1 (1) :− w. x1 (−1) :− w. .. . xn (1) :− w. xn (−1) :− w.
x1 (0). . . . xn (0). w :− ρ(c11 ), ρ(c12 ), ρ(c13 ). .. . m m w :− ρ(cm 1 ), ρ(c2 ), ρ(c3 ).
where ρ(xi ) = xi (1) and ρ(¬xi ) = xi (−1). Then φ is unsatisfiable iff the interpretation I(φ) = {w, x1 (1), x1 (0), x1 (−1), . . . , xn (1), xn (0), xn (−1)} is unfounded-free. Indeed, if σ is a satisfying truth assignment for V , then X σ = {w} ∪ {xi (1) | xi true in σ} ∪ {xi (−1) | xi false in σ} is unfounded for P(φ) w.r.t. I(φ). It is easily checked that for each rule in P(φ) with a head in X σ at least one body literal is false w.r.t. I(φ) ∪˙ ¬.X σ . On the other hand, let X be a non-empty unfounded set for P(φ) w.r.t. I(φ). Clearly, xi (0) ∈ X. If xi (1) ∈ X, then xi (−1) ∈ X and vice versa, because if both xi (1) ∈ X and xi (−1) ∈ X, #avg{X : xi (X)} = 0 is true w.r.t. I(φ) and I(φ) ∪˙ ¬.X. Furthermore, if some xi (1) ∈ X or xi (−1) ∈ X, then also w ∈ X. If w ∈ X, then for each clause in φ some corresponding xj (1) or xj (−1) must be in X. It is easy to see that
50
W. Faber
this corresponds to a (possibly) partial truth assignment satisfying φ, which can always be extended to a total truth assignment satisfying φ. So any non-empty unfounded set X (hence X ∩ I(φ) = ∅) implies the existence of a satisfying truth assignment for φ. 2 These results allow us to give a complete picture of the complexity of model checking, reported on the left of Table 1. There, the rows indicate the kinds of aggregates (m – monotone, a – antimonotone, n – nonmonotone) allowed in programs, while the columns vary over the presence of negation and disjunction. All co-NP entries are completeness results. The results in the first row are well-known results of the literature (cf. [19]), the P entries for {m, a} follow from recent results in [10], while the other results are consequences of Thms. 5, 6, 7, Cor. 3, with results from the literature. It becomes clear from this table that a complexity increase occurs with the presence of either disjunction or nonmonotone aggregates, and, importantly, that these two factors together do not cause a further increase. Also in Table 1, on the right hand side, we have summarized results from the literature (see [19,8,10]) for the problem of cautious reasoning. We observe that the complexity increase occurs at the same places, and indeed one can blame the necessity of co-NP checks for the Π2P results. Concerning computation, we conjecture that, given the symmetries in properties and complexity, techniques analogous to those described in [11] can be used in order to effectively and efficiently compute answer sets of programs with arbitrary aggregates. We will briefly discuss an important issue concerning computation, though. It is striking that from Table 1 it appears that a single, apparently “innocent”, aggregate like #count{< 1 : a >, < 2 : b >} = 1 will increase the reasoning complexity. Obviously, this is not the case, as this aggregate can be rewritten to an equivalent conjunction #count{< 1 : a >, < 2 : b >} ≤ 1, #count{< 1 : a >, < 2 : b >} ≥ 1, thus eliminating the nonmonotone aggregate. In fact, such a decomposition is possible for each nonmonotone aggregate, if one allows the use of custom aggregates (rather than a set of fixed aggregates) and the introduction of new symbols. However, this operation is only polynomial (and hence effective) if the number of the truth value changes of the nonmonotone aggregate in the lattice of total interpretations induced by < is polynomially bounded. Note that all currently implemented nonmonotone aggregates of DLV (#avg is not) and Smodels are polynomially decomposable.
6 Related Work To our knowledge, the only other works in which the notion of unfounded set has been defined and studied for programs with aggregates are [1,10]. However, both works consider only nondisjunctive programs, and the latter restricts itself to monotone and antimonotone aggregates. As discussed in [10], the definition of [1] seems to ignore aggregates at crucial points of the definition, and appears to be incomparable with the one in [10], and therefore also with Def. 1. Unfounded sets for disjunctive (aggregate-free) programs had been defined and studied in [11]. In fact, several of our results parallel those of [11]. We believe that for this reason the computational techniques reported therein can be adapted to the aggregate setting. Since unfounded sets have originally been used for defining the well-founded semantics, one could do this also with our unfounded sets. This was done (to some ex-
Unfounded Sets for Disjunctive Logic Programs with Arbitrary Aggregates
51
Table 1. Complexity of Answer Set Checking (left) and Cautious Reasoning (right) Checking ∅ {not } ∅ P P {m, a} P P {m, a, n} co-NP co-NP
{∨} {not , ∨} co-NP co-NP co-NP co-NP co-NP co-NP
Cautious ∅ {not } ∅ P co-NP {m, a} co-NP co-NP {m, a, n} Π2P Π2P
{∨} {not , ∨} Π2P Π2P P Π2 Π2P P Π2 Π2P
tent) in [11], but the recent work in [20] argues that for disjunctive programs a somewhat refined version of unfounded sets based on so-called model sets rather than interpretations. Recently, a unifying framework for unfounded sets and loop formulas has been defined in in [15]. Also this work does not consider aggregates, but we believe that the results with aggregates should be generalizable in a similar way. Concerning semantics for programs with aggregates, especially the last few years have seen many proposals. We refer to [8] (the definition on which our work is based) and [21] for overviews and comparisons.
7 Conclusion and Future Work The semantics of logic programs with aggregates is not straightforward, especially in presence of recursive aggregates. The characterizations of answer sets, provided in Sec. 4, allow for a better understanding of the meaning of programs with aggregates. Our results give confidence in the appropriateness of answer sets as defined in [8]. Furthermore, our results provide a handle on effective methods for computing answer sets for disjunctive programs with (possibly recursive and nonmonotone) aggregates. An approach with a separation of model generation and model checking (which is co-NP in the worst case) is indicated by the complexity results of Sec. 5. By defining suitable operators analogously to [11], one can obtain powerful means for pruning in the generation phase, along with an effective instrument for model checking, as described in [13,14]. Our results should also be adaptable to be used for SAT-based ASP systems, all of which rely on loop formulas, along the lines described in [15]. Our complexity results provide a clear picture of the various program fragments from the computational viewpoint. This is very useful for picking the appropriate techniques to be employed for the computation. In particular, it became clear that in the presence of only monotone and antimonotone aggregates and absence of disjunctions, an NP computing scheme can be chosen. That is, there the focus should be on answer set generation, while answer set checking is a simpler task. As soon as nonmonotone aggregates or disjunctions are present, a two-level schema has to be employed, which must focus on both answer set generation and checking, as both tasks are hard. Importantly, the presence of both nonmonotone aggregates and disjunction does not further raise the complexity. It should be noted that, as pointed out at the end of Sec. 5, many nonmonotone aggregates can be decomposed into monotone and antimonotone ones, including Smodels cardinality and weight constraints with positive weights. A main concern for future work is therefore the exploitation of our results for the implementation of recursive aggregates in ASP systems, along with a study on how to generalize the notion for defining the well-founded semantics for the full language.
52
W. Faber
References 1. Kemp, D.B., Stuckey, P.J.: Semantics of Logic Programs with Aggregates. In: ISLP’91, MIT Press (1991) 387–401 2. Denecker, M., Pelov, N., Bruynooghe, M.: Ultimate Well-Founded and Stable Model Semantics for Logic Programs with Aggregates. In Codognet, P., ed.: ICLP-2001, (2001) 212–226 3. Gelfond, M.: Representing Knowledge in A-Prolog. In: Computational Logic. Logic Programming and Beyond. LNCS 2408 (2002) 413–451 4. Simons, P., Niemel¨a, I., Soininen, T.: Extending and Implementing the Stable Model Semantics. Artificial Intelligence 138 (2002) 181–234 5. Dell’Armi, T., Faber, W., Ielpa, G., Leone, N., Pfeifer, G.: Aggregate Functions in DLV. In: ASP’03, Messina, Italy (2003) 274–288 Online at http://CEUR-WS.org/Vol-78/. 6. Pelov, N., Truszczy´nski, M.: Semantics of disjunctive programs with monotone aggregates an operator-based approach. In: NMR 2004. (2004) 327–334 7. Pelov, N., Denecker, M., Bruynooghe, M.: Partial stable models for logic programs with aggregates. In: LPNMR-7. LNCS 2923 8. Faber, W., Leone, N., Pfeifer, G.: Recursive aggregates in disjunctive logic programs: Semantics and complexity. In: JELIA 2004. LNCS 3229 9. Ferraris, P.: Answer Sets for Propositional Theories. http://www.cs.utexas.edu/ users/otto/papers/proptheories.ps (2004) 10. Calimeri, F., Faber, W., Leone, N., Perri, S.: Declarative and Computational Properties of Logic Programs with Aggregates. In: Nineteenth International Joint Conference on Artificial Intelligence (IJCAI-05). (2005) To appear. 11. Leone, N., Rullo, P., Scarcello, F.: Disjunctive Stable Models: Unfounded Sets, Fixpoint Semantics and Computation. Information and Computation 135 (1997) 69–112 12. Calimeri, F., Faber, W., Leone, N., Pfeifer, G.: Pruning Operators for Answer Set Programming Systems. In: NMR’2002. (2002) 200–209 13. Koch, C., Leone, N., Pfeifer, G.: Enhancing Disjunctive Logic Programming Systems by SAT Checkers. Artificial Intelligence 15 (2003) 177–212 14. Pfeifer, G.: Improving the Model Generation/Checking Interplay to Enhance the Evaluation of Disjunctive Programs. In: LPNMR-7. LNCS, (2004) 220–233 15. Lee, J.: A Model-Theoretic Counterpart of Loop Formulas. http://www.cs.utexas. edu/users/appsmurf/papers/mtclf.pdf (2004) 16. Baral, C.: Knowledge Representation, Reasoning and Declarative Problem Solving. CUP (2002) 17. Gelfond, M., Lifschitz, V.: Classical Negation in Logic Programs and Disjunctive Databases. NGC 9 (1991) 365–385 18. Van Gelder, A., Ross, K., Schlipf, J.: The Well-Founded Semantics for General Logic Programs. JACM 38 (1991) 620–650 19. Dantsin, E., Eiter, T., Gottlob, G., Voronkov, A.: Complexity and Expressive Power of Logic Programming. ACM Computing Surveys 33 (2001) 374–425 20. Wang, K., Zhou, L.: Comparisons and Computation of Well-founded Semantics for Disjunctive Logic Programs. ACM TOCL 6 (2005) 21. Pelov, N.: Semantics of Logic Programs with Aggregates. PhD thesis, Katholieke Universiteit Leuven, Leuven, Belgium (2004)
Loops: Relevant or Redundant? Martin Gebser and Torsten Schaub Institut f¨ur Informatik, Universit¨at Potsdam, Postfach 900327, D–14439 Potsdam
Abstract. Loops and the corresponding loop formulas play an important role in answer set programming. On the one hand, they are used for guaranteeing correctness and completeness in SAT-based answer set solvers. On the other hand, they can be used by conventional answer set solvers for finding unfounded sets of atoms. Unfortunately, the number of loops is exponential in the worst case. We demonstrate that not all loops are actually needed for answer set computation. Rather, we characterize the subclass of elementary loops and show that they are sufficient and necessary for selecting answer sets among the models of a program’s completion. Given that elementary loops cannot be distinguished from general ones in atom dependency graphs, we show how the richer graph structure provided by body-head dependency graphs can be exploited for this purpose.
1 Introduction The success of Answer Set Programming (ASP) is largely due to the availability of efficient solvers, e.g. [1,2]. A similar situation is encountered in the area of satisfiability checking (SAT), in which manifold solvers show an impressive performance. This has led to ASP solvers mapping answer set computation to model generation via SAT solvers [3,4,5]. Since the answer sets of a program form a subset of its classical models, however, additional measures must be taken for eliminating models that are no answer sets. To this end, a program is transformed via Clark’s completion [6]. The models of the resulting completed program are called supported models; they are generally still a superset of the program’s answer sets. However, supported models coincide with answer sets on tight programs, that is, programs having an acyclic positive atom dependency graph [7]. For example, the program {p ← p} is non-tight; it admits a single empty answer set, while its completion, {p ≡ p}, has two models, ∅ and {p}. While early SAT-based ASP solvers [3] reject non-tight programs, the next generation of solvers, e.g. [4,5], exploits the circular structures within the atom dependency graph for handling non-tight programs. As put forward in [4], the idea is to extend a program’s completion by loop formulas in order to eliminate the supported models that are no answer sets. Loop formulas are generated from loops, which are sets of atoms that circularly depend upon each other in a program’s atom dependency graph. Unfortunately, a program may yield exponentially many loops in the worst case [8], so that exponentially many loop formulas may be necessary for filtering out the program’s answer sets. We show that not all loops are needed for selecting the answer sets among the models of a program’s completion. Rather, we introduce the subclass of elementary loops, whose corresponding loop formulas are sufficient for determining the answer sets of a program from its completion. Moreover, elementary loops are essential in the sense that C. Baral et al. (Eds.): LPNMR 2005, LNAI 3662, pp. 53–65, 2005. c Springer-Verlag Berlin Heidelberg 2005
54
M. Gebser and T. Schaub
generally none on their loop formulas can be omitted without reintroducing undesired supported models. Given that elementary loops cannot be distinguished from general ones in atom dependency graphs, we show how the richer graph structure provided by body-head dependency graphs [9] can be exploited for recognizing elementary loops. Body-head dependency graphs extend atom dependency graphs by an explicit representation of rules’ bodies. Their richer graph structure allows for identifying elementary loops in an efficient way. Finally, we show that the set of elementary loops lies between the set of ⊆-minimal loops and the set of all loops. As a consequence, there may still be an exponential number of elementary loops, since there may already be an exponential number of ⊆-minimal loops in the worst case. On the other hand, we show that there may also be exponentially fewer elementary loops than general ones in the best case. The next section provides the background of this paper. In Section 3, we characterize elementary loops and show that they are sufficient and, generally, necessary for capturing answer sets. Section 4 introduces body-head dependency graphs as a device for recognizing elementary loops. In Section 5, we provide lower and upper bounds for programs’ elementary loops. We conclude with Section 6.
2 Background A logic program is a finite set of rules of form a ← b1 , . . . , bm , not c1 , . . . , not cn where a, b1 , . . . , bm , c1 , . . . , cn are atoms for m ≥ 0, n ≥ 0. Given such a rule r, we denote its head a by head (r) and its body {b1 , . . . , bm , not c1 , . . . , not cn } by body (r). Furthermore, we let body + (r) = {b1 , . . . , bm } and body − (r) = {c1 , . . . , cn } be the positive and negative body of r, respectively. The set of bodies in logic program Π is body(Π) = {body(r) | r ∈ Π}. The set of atoms appearing in Π is given by atom(Π). A logic program Π is basic, if body − (r) = ∅ for every rule r ∈ Π. The smallest set of atoms closed under basic program Π is denoted by Cn(Π). The reduct of a logic program Π relative to a set X of atoms is the basic program Π X = {head (r) ← body + (r) | r ∈ Π, body − (r) ∩ X = ∅}. An answer set of a logic program Π is a set X of atoms satisfying X = Cn(Π X ). The Clark completion of a program can be defined as follows [6]. For a logic program Π and a rule r ∈ Π, define comp(r) = b∈body + (r) b ∧ c∈body − (r) ¬c , comp(Π) = {a ≡ r∈Π,head(r)=a comp(r) | a ∈ atom(Π)} . An answer set of Π is also a model1 of comp(Π). Models of comp(Π) are also called supported models of Π. As shown in [4], answer sets can be distinguished among the supported models by means of loops in atom dependency graphs (cf. [10,11]). To be precise, the positive atom dependency graph of a program Π is the directed graph (atom(Π), E(Π)) where E(Π) = {(b, a) | r ∈ Π, b ∈ body + (r), head (r) = a}. A set L ⊆ atom(Π) is a loop in Π, if (L, E(Π, L)) is a strongly connected subgraph2 of the positive atom 1 2
That is, an interpretation is represented by its entailed set of atoms. A (sub)graph is strongly connected, if there is a path between any pair of contained nodes.
Loops: Relevant or Redundant? 8 ¯ > > a ← not d > > > d ← not d¯ > > :¯ d ← not d
b ← not e¯ b←c c ← b, not e ← not e¯ e¯ ← not e
(a) Logic program Π1
9 > > > > = e
55
{b, not e} {a, not d} - cj
- cj - bj aj > > > > ; (b) Atom dependency graph of Π1 (restricted to connected nodes)
6 aj
6 ?
{c}
- bj
(c) Body-head dependency graph of Π1 (restricted to connected nodes)
Fig. 1. Logic program Π1 yielding loop(Π1 ) = {{a, c}, {b, c}, {a, b, c}}
dependency graph (atom(Π), E(Π)) such that E(Π, L) = E(Π) ∩ (L × L) = ∅. Given a loop L in Π, we partition the rules whose heads are in L into two sets, namely R+ (Π, L) = {r ∈ Π | head (r) ∈ L, body + (r) ∩ L = ∅} , R− (Π, L) = {r ∈ Π | head (r) ∈ L, body + (r) ∩ L = ∅} . The loop formula associated with loop L is LF (Π, L) = ¬ r∈R− (Π,L) comp(r) → a∈L ¬a .
(1)
We denote the set of all loops in Π by loop(Π). The set of all loop formulas of Π is LF (Π) = {LF (Π, L) | L ∈ loop(Π)}. As shown in [4], a set X of atoms is an answer set of a logic program Π iff X is a model of comp(Π) ∪ LF (Π). For illustration, consider Program Π1 in Figure 1(a). This program has four answer ¯ e}, {a, d, e¯}, and {d, ¯ e¯}. Apart from these, Π1 has three addisets: {a, b, d, e}, {b, d, ¯ ¯ e¯}. Observe that tional supported models: {a, b, c, d, e}, {a, b, c, d, e¯}, and {a, b, c, d, each additional supported model is a superset of some answer set. A closer look reveals that all of them contain atoms a, b, and c, which are the ones being involved in loops. In fact, the loops are responsible for the supported models that are no answer sets since they allow for a circular support among atoms. To see this, consider the pos¯ e, and e¯ since itive atom dependency graph of Π1 in Figure 1(b). (We omit atoms d, d, they are not involved in any positive dependencies.) We can identify three loops: {a, c}, {b, c}, and {a, b, c}. Each of them induces a strongly connected subgraph that reflects the possibility of circular derivations among these atoms (via rules in R+ (Π1 , {a, c}), R+ (Π1 , {b, c}), and R+ (Π1 , {a, b, c})). This circular behavior can be counterbalanced by the corresponding loop formulas LF (Π1 , {a, c}) = ¬(¬d¯ ∨ (b ∧ ¬e)) → ¬a ∧ ¬c ≡ d¯ ∧ (¬b ∨ e) → ¬a ∧ ¬c , LF (Π1 , {b, c}) = ¬(¬¯ e ∨ (a ∧ ¬d)) → ¬b ∧ ¬c ≡ e¯ ∧ (¬a ∨ d) → ¬b ∧ ¬c , LF (Π1 , {a, b, c}) = ¬(¬d¯ ∨ ¬¯ e) → ¬a ∧ ¬b ∧ ¬c ≡ d¯ ∧ e¯ → ¬a ∧ ¬b ∧ ¬c . While these formulas are satisfied by all answer sets of Π1 , one of them is falsified by each of the additional supported models. In this way, LF (Π1 , {a, c}) elimi¯ e}, LF (Π1 , {b, c}) excludes {a, b, c, d, e¯}, and LF (Π1 , {a, b, c}) fornates {a, b, c, d,
56
M. Gebser and T. Schaub
8 ¯ > > a ← not d > > a ← c, not d < Π2 = c ← a, b > > d ← not d¯ > > :¯ d ← not d
b ← not e¯ b ← c, not
9 > > > e> =
{c, not d} cj- {c, not e}
j - cj - bj > a e ← not e¯ > > > ; e¯ ← not e
(a) Logic program Π2
(b) Atom dependency graph of Π2 (restricted to connected nodes)
6 ?
aj - {a, b}
?
bj
(c) Body-head dependency graph of Π2 (restricted to connected nodes)
Fig. 2. Logic program Π2 , where eloop(Π2 ) = {{a, c}, {b, c}} ⊂ loop(Π2 )
¯ e¯}. Observe that each loop formula prohibits a different supported model bids {a, b, c, d, and can, thus, not be omitted (although loop {a, b, c} contains the two other ones).
3 Elementary Loops Our main focus lies in characterizing a set of relevant loops, whose loop formulas are sufficient and necessary for capturing a program’s answer sets (together with the completed program). Sufficiency simply means that each model is an answer set. The meaning of necessity is not that straightforward and needs some clarification (see below). Based on these preliminaries, we introduce the notion of an elementary loop. Definition 1 (Elementary Loop). Let Π be a logic program and let L ∈ loop(Π). We define L as an elementary loop in Π, if, for each loop L ∈ loop(Π) such that L ⊂ L,3 we have R− (Π, L ) ∩ R+ (Π, L) = ∅. In words, a loop is elementary if each of its strict sub-loops possesses a non-circular support that positively depends on the loop. This characterization is inspired by the structure of loop formulas in (1), according to which non-circular supports form loop formulas’ antecedents. If a sub-loop has no non-circular support from the genuine loop, its loop formula’s antecedent is satisfied independently. Notably, Section 4 gives a direct characterization of elementary loops that avoids the inspection of sub-loops. As with loops, we denote the set of all elementary loops in a program Π by eloop(Π). The set of all elementary loop formulas of Π is denoted by eLF (Π) = {LF (Π, L) | L ∈ eloop(Π)}. Obviously, we have eloop(Π) ⊆ loop(Π) and eLF (Π) ⊆ LF (Π). Program Π1 in Figure 1(a) yields the ⊆-minimal loops {a, c} and {b, c}. Such loops are by definition elementary. Moreover, {a, b, c} is an elementary loop: Its strict subloops, {a, c} and {b, c}, yield R− (Π1 , {a, c}) ∩ R+ (Π1 , {a, b, c}) = {c ← b, not e} and R− (Π1 , {b, c}) ∩ R+ (Π1 , {a, b, c}) = {c ← a, not d}. The difference between elementary and non-elementary loops shows up when looking at Program Π2 in Fig¯ e}, ure 2(a). Similar to Π1 , Program Π2 has four answer sets: {a, b, c, d, e}, {b, d, ¯ e¯}. Also, both programs share the same positive atom dependency {a, d, e¯}, and {d, graph, as witnessed by Figures 1(b) and 2(b), respectively. Hence, given that Programs Π1 and Π2 are indistinguishable from their positive atom dependency graphs, 3
We use ‘⊂’ to denote the strict subset relation; that is, L ⊂ L iff L ⊆ L and L = L.
Loops: Relevant or Redundant?
57
both programs yield the same set of loops, namely, loop(Π2 ) = loop(Π1 ) = {{a, c}, {b, c}, {a, b, c}}. Unlike this, both programs yield a different set of elementary loops. To see this, observe that for loop {a, b, c} and its sub-loops {a, c} and {b, c}, we have ¯ ∩ R+ (Π2 , {a, b, c}) = ∅ , R− (Π2 , {a, c}) ∩ R+ (Π2 , {a, b, c}) = {a ← not d} − + R (Π2 , {b, c}) ∩ R (Π2 , {a, b, c}) = {b ← not e¯} ∩ R+ (Π2 , {a, b, c}) = ∅ . Thus, {a, b, c} is not an elementary loop in Π2 , and eloop(Π2 ) = {{a, c}, {b, c}} is a strict subset of loop(Π2 ). As mentioned above, we are interested in a minimal set of essential loops such that their loop formulas in addition to a program’s completion capture the program’s answer sets. Our next result is a step towards characterizing a sufficient set of loops. Proposition 2. Let Π be a logic program and let L∈ loop(Π) such that L ∈eloop(Π). Let I be an interpretation of atom(Π) such that L ⊆ I and I |= ¬LF (Π, L). Then, there is a loop L ∈ loop(Π) such that L ⊂ L and I |= ¬LF (Π, L ). This shows that non-elementary loops are prone to redundancy. Our first major result is an enhancement of [4, Theorem 1]. That is, elementary loop formulas are, in addition to a program’s completion, sufficient for capturing the program’s answer sets. Theorem 3. Let Π be a logic program and let X ⊆ atom(Π). Then, X is an answer set of Π iff X is a model of comp(Π) ∪ eLF (Π). Let us illustrate the two last results by Π2 in Figure 2(a). Recall that we have eloop(Π2 ) = {{a, c}, {b, c}}
⊂
{{a, c}, {b, c}, {a, b, c}} = loop(Π2 ) .
For Program Π2 , the set loop(Π2 ) of general loops induces the loop formulas ¯ → ¬a ∧ ¬c LF (Π2 , {a, c}) = ¬(¬d) ≡ d¯ → ¬a ∧ ¬c , LF (Π2 , {b, c}) = ¬(¬¯ e) → ¬b ∧ ¬c ≡ e¯ → ¬b ∧ ¬c , LF (Π2 , {a, b, c}) = ¬(¬d¯ ∨ ¬¯ e) → ¬a ∧ ¬b ∧ ¬c ≡ d¯ ∧ e¯ → ¬a ∧ ¬b ∧ ¬c . Observe that LF (Π2 , {a, c}), LF (Π2 , {b, c}) |= LF (Π2 , {a, b, c}) . That is, loop formula LF (Π2 , {a, b, c}) is redundant and can be removed from LF (Π2 ) without any risk of producing models of comp(Π2 ) ∪ (LF (Π2 ) \ {LF (Π2 , {a, b, c})}) that are no answer sets of Π2 . This outcome is directly obtained when considering elementary loop formulas because eLF (Π2 ) = LF (Π2 ) \ {LF (Π2 , {a, b, c})}. In what follows, we consider the “necessity” of elementary loops. The problem here is that whether or not a loop formula eliminates unwanted supported models is context dependent because of possible interactions with the completed program and/or among loop formulas. To see this, consider Program Π = {a ← ; b ← a ; b ← c ; c ← b}. We have eloop(Π) = {{b, c}}, but loop formula LF (Π, {b, c}) = ¬a → ¬b ∧ ¬c is
58
M. Gebser and T. Schaub
not violated in the single supported model {a, b, c} of Π because atom b is supported anyhow by rule b ← a. Furthermore, consider Program Π = {a ← not b ; b ← not a ; c ← d, not a, not b ; d ← c, not a, not b} having elementary loop {c, d}. The supported models of Π are {a} and {b} such that LF (Π , {c, d}) = → ¬c ∧ ¬d is not needed for inhibiting circular support among atoms c and d. In order to capture elementary loops that really produce unwanted supported models, we introduce the notion of an active elementary loop. Definition 4 (Active Elementary Loop). Let Π be a logic program and let I be an interpretation of atom(Π). We define L ∈ eloop(Π) as an active elementary loop with respect to I, if 1. for each rule r ∈ R− (Π, L), we have I |= ¬comp(r), and 2. L is an elementary loop in Π \ {r ∈ Π | I |= ¬comp(r)}. By Condition 1. an active elementary loop is not non-circularly supported. Condition 2. ensures that an active elementary loop is still elementary with respect to the rules satisfied by an interpretation; i.e. the rules connecting the elementary loop are not falsified. The distinguishing property of elementary loops that are active with respect to an interpretation I, as opposed to general loops, is that I “automatically” satisfies the loop formula of any of their sub-loops. Theorem 5. Let Π be a logic program, let L ∈ eloop(Π), and let I be an interpretation of atom(Π) such that L is active with respect to I. Then, we have I |= ¬LF (Π, L) , and, for each loop L ∈ loop(Π) such that L ⊂ L, we have I |= LF (Π, L ). For illustration, reconsider Programs Π1 and Π2 (cf. Figures 1(a) and 2(a)). Both programs yield the loops {a, c}, {b, c}, and {a, b, c}. The difference between Π1 and Π2 is that {a, b, c} is an elementary loop in Π1 , but not in Π2 . For Π1 , this means that, if {a, b, c} is active with respect to a supported model M of comp(Π1 ), M is also model of comp(Π1 ) ∪ eLF (Π1 ) \ {LF (Π1 , {a, b, c})}. In fact, the supported model ¯ e¯} violates M = {a, b, c, d, LF (Π1 , {a, b, c}) = ¬(¬d¯ ∨ ¬¯ e) → ¬a ∧ ¬b ∧ ¬c ≡ d¯ ∧ e¯ → ¬a ∧ ¬b ∧ ¬c but satisfies LF (Π1 , {a, c}) = ¬(¬d¯ ∨ (b ∧ ¬e)) → ¬a ∧ ¬c ≡ d¯ ∧ (¬b ∨ e) → ¬a ∧ ¬c , LF (Π1 , {b, c}) = ¬(¬¯ e ∨ (a ∧ ¬d)) → ¬b ∧ ¬c ≡ e¯ ∧ (¬a ∨ d) → ¬b ∧ ¬c . Hence, we cannot skip LF (Π1 , {a, b, c}) without producing a supported model that is no answer set. In contrast to this, no model of comp(Π2 ) violates LF (Π2 , {a, b, c}) and satisfies both LF (Π2 , {a, c}) and LF (Π2 , {b, c}). This follows directly from Theorem 3, as {a, b, c} is not an elementary loop in Π2 .
4 Graph-Theoretical Characterization of Elementary Loops We have seen in the previous section that elementary and non-elementary loops cannot be distinguished using atom dependency graphs (cf. Figures 1(b) and 2(b)). Furthermore, Definition 1 suggests examining all strict sub-loops for finding out whether a
Loops: Relevant or Redundant?
59
loop is elementary. This is intractable as a loop may have exponentially many strict sub-loops. In what follows, we show that identifying elementary loops can be done efficiently based on a refined concept of a dependency graph. First of all, we introduce the body-head dependency graph of a program. Definition 6 (Positive Body-Head Dependency Graph). Let Π be a logic program. We define the positive body-head dependency graph of Π as the directed graph (atom(Π) ∪ body (Π) , E0 (Π) ∪ E2 (Π)) where E0 (Π) = {(b, B) | r ∈ Π, b ∈ body + (r), body(r) = B} , E2 (Π) = {(B, a) | r ∈ Π, body(r) = B, head (r) = a} . Body-head dependency graphs were introduced in [9] as a formal device for characterizing answer set computation. In fact, fully-fledged body-head dependency graphs constitute the primary data structure of the nomore answer set solver [12]. In addition to the edges in E0 (Π) and E2 (Π), they contain a type of edges for negative dependencies, namely, E1 (Π) = {(c, B) | r ∈ Π, c ∈ body − (r), body(r) = B}.4 In what follows, we often drop the attribute ’positive’ and simply write body-head or atom dependency graph, respectively, since loops exclusively rely on positive dependencies. Definition 7 (Induced Subgraph). Let Π be a logic program and let A ⊆ atom(Π). We define the induced subgraph of A in Π as the directed graph (A ∪ body(Π, A), E0 (Π, A) ∪ E2 (Π, A)) where body(Π, A) = {B ∈ body(Π) | b ∈ A, (b, B) ∈ E0 (Π), a ∈ A, (B, a) ∈ E2 (Π)} , E0 (Π, A) = E0 (Π) ∩ (A × body(Π, A)) , E2 (Π, A) = E2 (Π) ∩ (body (Π, A) × A) . Note that, in the induced subgraph of a set A of atoms, we only include those bodies that contain an atom in A and that also occur in a rule whose head is in A. That is, the bodies, which are responsible for edges in atom dependency graphs, are made explicit in body-head dependency graphs as nodes in-between atoms. Figure 1(c) shows the body-head dependency graph of Π1 . As in Figure 1(b), we leave out isolated nodes, that is here, purely negative bodies and atoms not occurring in positive bodies. Unlike this, atom a is contained in the graph since it occurs in the positive body of rule c ← a, not d; accordingly, the edge (a, {a, not d}) belongs to the set of edges E0 (Π1 ) of the body-head dependency graph. Among the edges in E2 (Π1 ), we find ({a, not d}, c) because of rule c ← a, not d. The induced subgraph of {a, c} in Π1 contains atoms a and c, bodies {a, not d} and {c}, and their connecting edges. As with atom dependency graphs, a set of atoms is a loop if its induced subgraph is a non-trivial strongly connected graph. Proposition 8. Let Π be a logic program and let L ⊆ atom(Π). L is a loop in Π iff the induced subgraph of L in Π is a strongly connected graph such that body (Π, L) = ∅. 4
The notation traces back to [13]; the sum of labels in a cycle indicates whether the cycle is even or odd.
60
M. Gebser and T. Schaub
In order to describe elementary loops graph-theoretically, we introduce the elementary subgraph of a set of atoms, which is more fine grained than the induced subgraph. Definition 9 (Elementary Subgraph). Let Π be a logic program, let A ⊆ atom(Π), and let (A ∪ body(Π, A) , E0 (Π, A) ∪ E2 (Π, A)) be the induced subgraph of A in Π. We define the elementary closure of A in Π as the set eCl (Π, A) of edges where eCl 0 (Π, A) = ∅ , eCl i+1 (Π, A) = eCl i (Π, A) ∪ {(b, B) ∈ E0 (Π, A) | there is a path in (A ∪ body (Π, A) , eCl i (Π, A) ∪ E2 (Π, A)) eCl (Π, A) =
from b ∈ A to each b ∈ A such that (b , B) ∈ E0 (Π, A) } , 5 i i∈IN eCl (Π, A) .
We define the elementary subgraph of A in Π as the directed graph (A ∪ body(Π, A), eCl (Π, A) ∪ E2 (Π, A)). The general purpose of elementary subgraphs is to distinguish essential from superfluous dependencies. Let us illustrate this by rule c ← a, b in Π2 and consider the bodyhead dependency graph of Π2 in Figure 2(c). Here, atom c positively depends on atoms a and b through body {a, b}. In Π2 , c is unfounded if either a or b and c itself are not non-circularly supported; that is, the other atom cannot help in non-circularly supporting a and c or b and c, respectively. The situation changes if a and b take part in a loop independently from c. Then, a and b non-circularly support c if there is a non-circular support for either a or b. The elementary closure reflects these issues by stipulating that there is already a path from one to the other predecessors of a body before an edge to the body can be added. This allows for distinguishing essential dependencies from superfluous ones. Our next major result shows that elementary subgraphs make the difference between elementary loops and non-elementary ones. Theorem 10. Let Π be a logic program and let L ⊆ atom(Π). L is an elementary loop in Π iff the elementary subgraph of L in Π is a strongly connected graph such that body(Π, L) = ∅. For illustrating the previous result, reconsider Figure 1(c) showing the connected part of the body-head dependency graph of Program Π1 . Observe that each contained body is reached by precisely one edge. Therefore, we have eCl 1 (Π1 , A) = E0 (Π1 , A) for every A ⊆ atom(Π1 ), and elementary subgraphs coincide with induced subgraphs. The body-head dependency graph of Program Π2 is different from the one of Program Π1 , as witnessed by Figures 1(c) and 2(c). In Figure 2(c), we see the connected part of the body-head dependency graph of Π2 , which coincides with the induced subgraph of loop {a, b, c} in Π2 . Regarding the elementary closure of {a, b, c}, we have eCl (Π2 , {a, b, c}) = eCl 1 (Π2 , {a, b, c}) = {(c, {c, not d}), (c, {c, not e})} . 5
Note that the path from b to b can be trivial, i.e. b = b .
Loops: Relevant or Redundant?
61
Observe that eCl (Π2 , {a, b, c}) does not contain edges (a, {a, b}) and (b, {a, b}). This is because a as well as b must have a path to the other atom before the respective edge can be added to the elementary closure. Since there are no such paths, none of the edges can ever be added. As a consequence, atoms a and b have no outgoing edges in the elementary subgraph of {a, b, c} in Π2 , which is not strongly connected. This agrees with the observation made in Section 3 that {a, b, c} is not an elementary loop in Π2 . In contrast to {a, b, c}, the elementary subgraphs of loops {a, c} and {b, c} in Π2 are strongly connected, verifying eloop(Π2 ) = {{a, c}, {b, c}}. As observed on Program Π1 , elementary subgraphs coincide with induced subgraphs on unary programs, having at most one positive body atom. For such programs, every general loop is also an elementary one. Proposition 11. Let Π be a logic program such that |body + (r)| ≤ 1 for all r ∈ Π. Then, we have eloop(Π) = loop(Π). Note that unary programs are strictly less expressive than general ones, as shown in [14]. The analysis of elementary subgraphs yields that each contained atom must be the unique predecessor of some body; otherwise, the atom has no outgoing edge in the elementary closure. Moreover, the induced subgraph of an elementary loop cannot be torn apart by removing edges to bodies, provided that each body is still reachable. Proposition 12. Let Π be a logic program and let L ∈ eloop(Π). Then, the induced subgraph of L in Π, (L ∪ body(Π, L) , E0 (Π, L) ∪ E2 (Π, L)) , has the following properties: 1. For each atom b ∈ L, there is a body B ∈ body(Π, L) such that {b} = {b ∈ L | (b , B) ∈ E0 (Π, L)}. 2. For every set E0⊆ ⊆ E0 (Π, L) of edges such that {B ∈ body(Π, L) | b ∈ L, (b, B) ∈ E0⊆ } = body(Π, L), we have that (L ∪ body (Π, L) , E0⊆ ∪ E2 (Π, L)) is a strongly connected graph. Although we refrain from giving a specific algorithm, let us note that the concept of elementary subgraphs allows for computing elementary loops efficiently by means of standard graph algorithms. In particular, deciding whether a set of atoms is an elementary loop can be done in linear time.
5 Elementary Versus Non-elementary Loops This section compares the sets of a program’s elementary and general loops. By Theorem 3, loop formulas for non-elementary loops need not be added to a program’s completion in order to capture the program’s answer sets. With this information at hand, we are interested in how many loop formulas can be omitted in the best or in the worst case, respectively. First, we determine a lower bound on the set of a program’s elementary loops. Such a bound is immediately obtained from Definition 1, because a loop is trivially elementary if it has no strict sub-loops. Thus, we have mloop(Π) ⊆ eloop(Π) where mloop(Π) denotes the set of ⊆-minimal loops in a program Π. Second, the set of a
62
M. Gebser and T. Schaub
program’s loops constitutes an upper bound for the program’s elementary loops, also by Definition 1. Thus, we have eloop(Π) ⊆ loop(Π). Finally, the question is how the set of a program’s loops can be bound from above. In order to answer it, we define the set of loops that are ⊆-minimal for an atom a ∈ atom(Π) as aloop(Π, a) = {L ∈ loop(Π) | a ∈ L, there is no loop L ∈ loop(Π) such that a ∈ L and L ⊂ L}. For a program Π, we let aloop(Π) = a∈atom(Π) aloop(Π, a). In the worst case, any non-empty combination of loops in aloop(Π) is a loop, and we obtain the following upper bound for a program’s loops. Proposition 13. Let Π be a logic program. Then, we have loop(Π) ⊆ { L∈A L | A ∈ 2aloop(Π) \ {∅}}. Taking the above considerations together, we obtain the following estimation. Corollary 14. Let Π be a logic program. Then, we have mloop(Π) ⊆ eloop(Π) ⊆ loop(Π) ⊆ { L∈A L | A ∈ 2aloop(Π) \ {∅}} . In what follows, we give some schematic examples with programs Π for which loop(Π) = { L∈A L | A ∈ 2aloop(Π) \ {∅}}. Our first program sketches the worst case, i.e. eloop(Π) = { L∈A L | A ∈ 2aloop(Π) \ {∅}}, whereas the second program reflects the best case that eloop(Π) = mloop(Π). The programs show that the set of elementary loops can vary significantly between the given lower and the upper bound. For illustrating the worst case, consider Program Π3 in Figure 3(a). First observe that |body + (r)| = 1 for every rule r ∈ Π3 . Thus by Proposition 11, each loop in Π3 is elementary. The atom dependency graph of Π3 is a complete graph because there is a rule ai ← aj for every pair of distinct atoms ai ∈ atom(Π3 ), aj ∈ atom(Π3 ). As a consequence, any combination of distinct elementary loops gives a new elementary loop, and we have eloop(Π3 ) = { L∈A L | A ∈ 2aloop(Π3 ) \ {∅}}. Program Π4 in Figure 3(c) is complementary to Π3 . Here |body + (r)| = |atom(Π4 )| −1 for every rule r ∈ Π4 . However, the atom dependency graph of Π4 is identical to that of Π3 . As observed with Π1 and Π2 (cf. Figures 1(a) and 2(b)), Π3 and Π4 are thus indistinguishable from their atom dependency graphs. Again the body-head dependency graphs reveal the different natures of Π3 and Π4 . We have that, similar to Π3 , every two-elementary subset of atom(Π4 ) forms a ⊆-minimal and, thus, elementary loop. However, looking at the body-head dependency graph of Π4 in Figure 3(d), we see that each atom has a single body as predecessor (i.e. there is a single supporting rule) such that distinct elementary loops can only be “glued” at bodies. In the resulting induced subgraph, bodies have several predecessors. Such an induced subgraph does not satisfy property 1. from Proposition 12, and the obtained loop is non-elementary. Thus, we have eloop(Π4 ) = mloop(Π4 ) and can omit loop formulas for all loops in { L∈A L | A ∈ 2aloop(Π4 ) \ {∅}} \ mloop(Π4 ). The achievements obtainable through using elementary instead of general loops can be underpinned by looking at the approaches of assat [4] and smodels [1] for dealing with unfounded sets. The assat system is based on a program’s completion and identifies loops, whose loop formulas are violated, on demand, that is, whenever a
Loops: Relevant or Redundant? ⎧ a 1 ← a2 ⎪ ⎪ ⎪. ⎪ ⎪ .. ⎪ ⎪ ⎪ ⎨ ai ← a1 Π3 = ⎪ ai+1 ← a1 ⎪ ⎪ ⎪ .. ⎪ ⎪ ⎪ ⎪ ⎩. an ← a1
. . . a1 ← an
⎫ ⎪ ⎪ ⎪ ⎪ ⎪ ⎪ ⎪ ⎪ ⎬
ak 1
... k H Y * an H H - ai+1 {ai }
6 ? ak {ai+1 } i 1 P iP P
. . . a i ← an . . . ai+1 ← an ⎪ ⎪ ⎪ ⎪ ⎪ ⎪ ⎪ ⎪ ⎭ . . . an ← an−1
(a) Schematic program Π3
{a1 }
...
{an }
(b) Schematic body-head dependency graph of Π3
⎧ ⎫ a1 ← a2 , . . . , a n ⎪ ⎪ ⎪ ⎪ ⎪ ⎪ .. ⎪ ⎪ ⎪ ⎪ ⎪ ⎪ . ⎪ ⎪ ⎪ ⎪ ⎨ ⎬ ai ← a1 , . . . , ai−1 , ai+1 , . . . , an Π4 = ai+1 ← a1 , . . . , ai , ai+2 , . . . , an ⎪ ⎪ ⎪ ⎪ ⎪ ⎪ ⎪ ⎪ ⎪ ⎪ ⎪ ... ⎪ ⎪ ⎪ ⎪ ⎪ ⎩ ⎭ an ← a1 , . . . , an−1 (c) Schematic program Π4
63
ak 1 H
... n ak HH j ai+1 {a1 , . . . , an } \ {ai }
6 ? ak i - {a1 , . . . , an } \ {ai+1 } HH j H
{a2 , . . . , an }
...
{a1 , . . . , an−1 }
(d) Schematic body-head dependency graph of Π4
Fig. 3. Logic programs Π3 and Π4 , where loop(Πi ) = { L∈A L | A ∈ 2aloop(Πi ) \ {∅}}, aloop(Π3 ) eloop(Π3 ) = { L∈A L | A ∈ 2 \ {∅}}, and eloop(Π4 ) = mloop(Π4 )
supported model not representing an answer set has been found. The circular support of such loops is in future prohibited by loop formulas such that an unwanted supported ¯ e¯} is model cannot be recomputed. Now assume that the supported model {a, b, c, d, found first for Program Π2 in Figure 2(a). Then assat identifies {a, b, c} as a socalled terminating loop [4] and adds loop formula LF (Π2 , {a, b, c}) = ¬(¬d¯ ∨ ¬¯ e) → ¬a ∧ ¬b ∧ ¬c ≡ d¯ ∧ e¯ → ¬a ∧ ¬b ∧ ¬c to comp(Π2 ) before searching for another supported model. The problem is that loop {a, b, c} is non-elementary and that circular support within elementary loops {a, c} and {b, c} is not prohibited by LF (Π2 , {a, b, c}). Consequently, assat may find sup¯ e} and {a, b, c, d, e¯} next, necessitating additional loop forported models {a, b, c, d, mulas ¯ → ¬a ∧ ¬c ≡ d¯ → ¬a ∧ ¬c and LF (Π2 , {a, c}) = ¬(¬d) LF (Π2 , {b, c}) = ¬(¬¯ e) → ¬b ∧ ¬c ≡ e¯ → ¬b ∧ ¬c , before finding the first answer set. The possibility of computing the supported models ¯ e} and {a, b, c, d, e¯} can be avoided by splitting the non-elementary loop {a, b, c, d, {a, b, c} into its elementary sub-loops {a, c} and {b, c}. Besides {a, c} and {b, c}, LF (Π2 , {a, c}) and LF (Π2 , {b, c}) prohibit circular support within loop {a, b, c}, and assat may treat three loops using only two loop formulas. In general, the elementary closure, as given in Definition 9, can be used for checking whether a terminating loop is
64
M. Gebser and T. Schaub
elementary. If not, an elementary sub-loop, whose loop formula also prohibits circular support within the genuine terminating loop, can be determined.6 The smodels answer set solver falsifies greatest unfounded sets in its function atmost. At the implementation level, atmost is restricted to strongly connected components of a program’s positive atom dependency graph (but may spread over different components if an unfounded set is detected) [1]. When atmost is applied to Program Π4 in Figure 3(c) (or a program having a comparable body-head dependency graph), it has to take the whole strongly connected component induced by atom(Π4 ) into consideration, since the atom dependency graph of Π4 is complete. The efforts of atmost can be restricted by concentrating on elementary loops, which are pairs of atoms in case of Π4 . That is, any pair of unfounded atoms is sufficient for falsifying the bodies of all rules that contribute to the strongly connected component induced by atom(Π4 ). Finally, it is noteworthy to mention that [15] describes how the computation of a program’s well-founded model [16] simplifies based on certain properties of the program’s full atom dependency graph (i.e. both positive and negative edges are included). The simplifications can be applied if a strongly connected component contains either only positive edges or if no atom depends positively on itself. The first case reflects that the contained atoms are involved in a loop and the second that circular support is impossible. An interesting topic for future investigation is whether the above conditions can be refined using the richer structure of body-head dependency graphs, which, for instance, allows for distinguishing between elementary and non-elementary loops.
6 Conclusion The purpose of loop formulas is to falsify unfounded sets whose atoms circularly depend upon each other in a given program. The detection of unfounded sets traces back to well-founded semantics [16]. Basically, the well-founded semantics infers atoms that are consequences of a program’s rules and falsifies unfounded sets. In accord with the well-founded semantics, all atoms in an answer set are consequences and no atom is unfounded. Complementary to [16] concentrating on greatest unfounded sets, this paper investigates indispensable unfounded sets whose falsification is essential for answer set computation. To this end, we have introduced the notion of an elementary loop and have described it using body-head dependency graphs. Although we cannot avoid the theoretical barrier of exponentially many loops in the worst case, we have shown that elementary loops provide necessary and sufficient criteria for characterizing answer sets. Apart from their theoretical importance, our results have furthermore a practical impact since they allow to focus the computation in ASP solvers to ultimately necessary parts. An interesting topic for future research will be generalizing our new concept of elementary loops to disjunctive programs, as has been done for general loops in [17]. Acknowledgments. We are grateful to Enno Schultz and the anonymous referees for their helpful comments, leading to a new presentation of our contribution. This work 6
A non-elementary loop may yield exponentially many elementary sub-loops. Thus, identifying all elementary sub-loops might be intractable. However, the number of elementary loops needed to cover the atoms in a (general) terminating loop of size n is bound by n.
Loops: Relevant or Redundant?
65
was supported by DFG under grant SCHA 550/6-4 as well as the EC through IST-200137004 WASP project.
References 1. Simons, P., Niemel¨a, I., Soininen, T.: Extending and implementing the stable model semantics. Artificial Intelligence 138 (2002) 181–234 2. Leone, N., Faber, W., Pfeifer, G., Eiter, T., Gottlob, G., Koch, C., Mateis, C., Perri, S., Scarcello, F.: The DLV system for knowledge representation and reasoning. ACM Transactions on Computational Logic (2005) To appear. 3. Babovich, Y., Lifschitz, V.: Computing answer sets using program completion. Unpublished draft. (2003) 4. Lin, F., Zhao, Y.: Assat: computing answer sets of a logic program by sat solvers. Artificial Intelligence 157 (2004) 115–137 5. Lierler, Y., Maratea, M.: Cmodels-2: Sat-based answer sets solver enhanced to non-tight programs. In Lifschitz, V., Niemel¨a, I., eds.: Proceedings of the Seventh International Conference on Logic Programming and Nonmonotonic Reasoning. Springer (2004) 346–350 6. Clark, K.: Negation as failure. In Gallaire, H., Minker, J., eds.: Logic and Data Bases. Plenum Press (1978) 293–322 7. Fages, F.: Consistency of clark’s completion and the existence of stable models. Journal of Methods of Logic in Computer Science 1 (1994) 51–60 8. Lifschitz, V., Razborov, A.: Why are there so many loop formulas? ACM Transactions on Computational Logic (To appear.) 9. Linke, T.: Suitable graphs for answer set programming. In Vos, M.D., Provetti, A., eds.: Proceedings of the Second International Workshop on Answer Set Programming. CEUR Workshop Proceedings (2003) 15–28 10. Apt, K., Blair, H., Walker, A.: Towards a theory of declarative knowledge. In Minker, J., ed.: Foundations of Deductive Databases and Logic Programming. Morgan Kaufmann Publishers (1987) 89–148 11. Przymusinski, T.: On the declarative semantics of deductive databases and logic programs. In Minker, J., ed.: Foundations of Deductive Databases and Logic Programming. Morgan Kaufmann Publishers (1988) 193–216 12. (http://www.cs.uni-potsdam.de/∼linke/nomore) 13. Papadimitriou, C., Sideri, M.: Default theories that always have extensions. Artificial Intelligence 69 (1994) 347–357 14. Janhunen, T.: Comparing the expressive powers of some syntactically restricted classes of logic programs. In Lloyd, J., Dahl, V., Furbach, U., Kerber, M., Lau, K., Palamidessi, C., Pereira, L., Sagiv, Y., Stuckey, P., eds.: Proceedings of the First International Conference on Computational Logic. Springer (2000) 852–866 15. Dix, J., Furbach, U., Niemel¨a, I.: Nonmonotonic reasoning: Towards efficient calculi and implementations. In Robinson, J., Voronkov, A., eds.: Handbook of Automated Reasoning. Elsevier and MIT Press (2001) 1241–1354 16. van Gelder, A., Ross, K., Schlipf, J.: The well-founded semantics for general logic programs. Journal of the ACM 38 (1991) 620–650 17. Lee, J., Lifschitz, V.: Loop formulas for disjunctive logic programs. In Palamidessi, C., ed.: Proceedings of 19th International Conference on Logic Programming. Springer (2003) 451–465
Approximating Answer Sets of Unitary Lifschitz-Woo Programs Victor W. Marek1 , Inna Pivkina2 , and Mirosław Truszczy´nski1 1
2
Department of Computer Science, University of Kentucky, Lexington, KY 40506-0046, USA Department of Computer Science, New Mexico State University, P.O. Box 30001, MSC CS, Las Cruces, NM 88003, USA
Abstract. We investigate techniques for approximating answer sets of general logic programs of Lifschitz and Woo, whose rules have single literals as heads. We propose three different methods of approximation and obtain results on the relationship between them. Since general logic programs with single literals as heads are equivalent to revision programs, we obtain results on approximations of justified revisions of databases by revision programs.
1 Introduction General logic programs were introduced by Lifschitz and Woo [LW92]. Their syntax follows closely that of disjunctive logic programs but there is one essential difference. The operator not, representing the default negation is no longer confined to the bodies of program rules but may appear in their heads, as well. Lifschitz and Woo [LW92] showed that the semantics of answer sets introduced for disjunctive logic programs in [GL91] can be lifted to the class of general logic programs. In this paper, we study the class of those general programs that do not contain disjunctions in the heads of their rules. We call such programs unitary. Unitary general programs are of interest for two reasons. First, they go beyond the class of normal logic programs by allowing the default-negation operator in the rule heads. Second, in a certain precise sense, unitary general programs are equivalent to the class of revision programs [MT98, MPT02], which provide a formalism for describing and enforcing database revisions. Consequently, results for unitary general programs extend to the case of revision programs. The problem we focus on in this paper is that of approximating answer sets of unitary general programs. The problem to decide whether a unitary logic program has an answer set is NP-complete1 . Consequently, computing answer sets of unitary general programs is hard and it is important to establish efficient ways to approximate them. On one hand, such approximations can be sufficient for some reasoning tasks. On the other hand, they can be used by programs computing answer sets to prune the search space and can improve their performance significantly. 1
Without the restriction to unitary programs (and assuming that the polynomial hierarchy does not collapse) the problem is even harder — Σ2P -complete.
C. Baral et al. (Eds.): LPNMR 2005, LNAI 3662, pp. 66–78, 2005. c Springer-Verlag Berlin Heidelberg 2005
Approximating Answer Sets of Unitary Lifschitz-Woo Programs
67
In the case of normal logic programs the well-founded model [VRS88] provides an effective approximation to all answer sets2 . It can be computed in polynomial time and is known to provide an effective pruning mechanism for programs computing stable models [SNV95, SNS02]. An obvious approach to the problem at hand seems to be then to extend the well-founded model and its properties to the class of unitary programs. However, despite similarities between normal and unitary programs, no counterpart of the well-founded model has been proposed for the latter class so far, and whether it can be done remains unresolved. Thus, we approach the problem not by attempting to generalize the well-founded semantics but by exploiting this semantics in some other, less direct ways. Namely, we introduce three operators for unitary general programs and use them to define the approximations. The first two operators are antimonotone and are closely related to operators behind the well-founded semantics of normal logic programs. Iterating them yields alternating sequences. We use the limits of these sequences to construct our first two approximations to answer sets of unitary general programs. The two approximations we obtain in this way are not comparable (neither is stronger than the other one). The third operator is not antimonotone in general. However, in the case of unitary general programs that have answer sets, iterating this operator results in an alternating sequence and the limit of this sequence yields yet another approximation to answer sets of unitary general programs. We show that this third approximation is stronger than the other two. We also show that all three approaches imply sufficient conditions for the non-existence of answer sets of unitary programs. As we noted, unitary programs are related to revision programs [MT98, MPT99]. Having introduced approximations to answer sets of unitary general programs, we show that our results apply in a direct way to the case of revision programming. All programs we consider in the paper are finite. That assumption simplifies arguments. However, all our results can be extended to the case of infinite programs.
2 Preliminaries Atoms and literals. In the paper we consider a fixed set U of (propositional) atoms. Expressions of the form a and not(a), where a ∈ U , are literals (over U ). We denote the set of all literals over U by Lit (U ). A set of literals L ⊆ Lit (U ) is coherent if there is no a ∈ U such that both a ∈ L and not(a) ∈ L. A set of literals L ⊆ Lit (U ) is complete if for every a ∈ U , a ∈ L or not(a) ∈ L (it is possible that for some a, both a ∈ L and not(a) ∈ L). For a set M of atoms, M ⊆ U , we define not(M ) = {not(a) : a ∈ M } and M c = M ∪ not(U \ M ). The mapping M → M c is a bijection between subsets of U and coherent and complete sets of literals contained in Lit (U ). 2
In the context of normal logic programming, answer sets are more commonly known as stable models.
68
V.W. Marek, I. Pivkina, and M. Truszczy´nski
Unitary general programs. A unitary general logic program, or UG-program is a collection of rules of the form: α ← α1 , . . . , αm
(1)
where α, α1 , . . . , αm are literals from Lit (U ). The literal α is the head of the rule. The set of literals {α1 , . . . , αm } is the body of the rule. Let P be a UG-program. We write P + (respectively, P − ) to denote programs consisting of all rules in P that have an atom (respectively, a negated atom) as the head. Satisfaction and models. A set of atoms M ⊆ U satisfies (is a model of) an atom a ∈ U (respectively, a literal not(a) ∈ Lit (U )), if a ∈ M (respectively, a ∈ / M ). The concept of satisfaction (being a model of) extends in a standard way to rules and programs. As usual, we write |= to denote the satisfaction relation. Sets of literals closed under UG-programs. In addition to models, we also associate with a UG-program P sets of literals that are closed under rules in P . A set L of literals is closed under a UG-program P if for every rule r = α ← Body ∈ P such that Body ⊆ L, α ∈ L. One can show that every UG-program P has a least set of literals closed under its rules3 . We denote it by P ∗ . We observe that if P is a definite Horn program, P ∗ consists of atoms only and coincides with the least model of P . Stable models of normal logic programs. Models are too weak for knowledge representation applications. In the case of normal logic programs, the appropriate semantic concept is that of a stable model. We recall that according to the original definition [GL88], a set of atoms M is a stable model of a normal logic program P if [P M ]∗ = M,
(2)
where P M is the Gelfond-Lifschitz reduct of P with respect to M . The following characterization of stable models is well known [BTK93]: M is a stable model of a normal logic program P if and only if [P ∪ not(U \ M )]∗ ∩ U = M.
(3)
Answer sets of UG-programs. Lifschitz and Woo [LW92] extended the concept of a stable model to the case of arbitrary general programs and called the resulting semantic object an answer set. Rather than to give the original definition from [LW92], we recall a basic characterization of answer sets of UG-programs that will be of use in the paper. Its proof can be found in [Lif96, MPT99]. Proposition 1. Let P be a UG-program. A set of atoms M is an answer set to P if and only if M is a stable model of P + and a model of P − . In particular, if M is an answer set to P then M is a model of P . Alternating sequences. All approximations to answer sets of UG-programs we study in this paper are defined in terms of alternating sequences and their limits. A sequence (Xi ) of sets of literals is alternating if 3
If we treat literals not(a) as new atoms, P becomes a Horn program and its least model is the least set of literals closed under P .
Approximating Answer Sets of Unitary Lifschitz-Woo Programs
69
1. X0 ⊆ X2 ⊆ X4 ⊆ . . . 2. X1 ⊇ X3 ⊇ X5 ⊇ . . . 3. X2i ⊆ X2i+1 , for every non-negative integer i.
∞ ∞ If (Xi ) is an alternating sequence, we define X l = i=0 X2i and X u = i=0 X2i+1 . We call the pair (X l , X u ) the limit of the alternating sequence (Xi ). It follows directly from the definition that for every non-negative integers i and j, X2i ⊆ X l ⊆ X u ⊆ X2j+1 Alternating sequences are often defined by means of operators that are antimonotone. An operator γ defined on Lit (U ) is antimonotone if for every two sets X ⊆ Y ⊆ Lit (U ), γ(Y ) ⊆ γ(X). Let γ be antimonotone. We define X0 = ∅ and Xi+1 = γ(Xi ). It is well known (and easy to show) that the sequence (Xi ) is alternating. We call (Xi ) the alternating sequence of γ. We will consider in the paper the following two operators: γP,U (X) = [P ∪ not(U \ X)]∗ ∩ U and γP (X) = [P ∪ not(U \ X)]∗ . Both operators are antimonotone and give rise to alternating sequences, say (Wi ) and (Yi ). Let (W l , W u ) and (Y l , Y u ) be the limits of these sequences, respectively. One can verify that these limits form alternating pairs. That is, we have
and
γP,U (W l ) = W u and γP,U (W u ) = W l
(4)
γP (Y l ) = Y u and γP (Y u ) = Y l .
(5)
One can show that if P is a normal logic program then the alternating sequence of γP,U is precisely the alternating sequence defining the well-founded semantics of P [VRS88, Van93]. One can also show that the limit of the alternating sequence of γP is the wellfounded model of the normal logic program P obtained from P by replacing every literal not(a) with a new atom, say a , and adding rules of the form a ← not(a) (the claim holds modulo the correspondence a ↔ not(a)). The mapping P → P was introduced and studied in [PT95] in the context of revision programs. Approximating sets of atoms. Let M be a set of atoms. Every pair of sets (T, S) that approximates M , that is, such that T ⊆ M ⊆ S, implies a lower bound on the complete representation M c of M : T ∪ {not(U \ S)} ⊆ M c . Conversely, every set L of literals such that L ⊆ M c determines an approximation (T, S) of M , where T = U ∩ L and S = {a ∈ U : not(a) ∈ / L}. Indeed, U ∩ L ⊆ M ⊆ {a ∈ U : not(a) ∈ / L}. In this way, we establish a bijection between approximations to a set of atoms M and subsets of M c . It follows that approximations of answer sets can be represented as subsets of their complete representations. We have the following fact.
70
V.W. Marek, I. Pivkina, and M. Truszczy´nski
Proposition 2. Let P be a UG-program and let T and S be two sets of atoms. For every answer set M of P , if T ⊆ M ⊆ S then [P ∪ T ∪ not(U \ S)]∗ ⊆ M c . Proof: We have T ⊆ M ⊆ S. Thus, T ∪ not(U \ S) ⊆ M c . Let r = α ← Body be a rule in P such that Body ⊆ M c . It follows that M satisfies the body of r. Since M is an answer set of P , M satisfies α and so, α ∈ M c . Thus, T ∪ not(U \ S) ⊆ M c and M c is closed under P . Consequently, [P ∪ T ∪ not(U \ S)]∗ ⊆ M c . 2 In the case of normal logic programs, the well-founded model, that is, the limit (W l , W u ) of the alternating sequence (Wi ) of the operator γP,U , approximates every stable model (if they exist) and, in some cases determines the existence of a unique stable model. Theorem 1 ([VRS88, Lif96]). Let (W l , W u ) be the well-founded model of a normal logic program P . 1. For every stable model M of P , W l ∪ not(U \ W u ) ⊆ M c . 2. If W l = W u , then W l is a unique stable model for P . In the remainder of the paper, we will propose approximations to answer sets of UG-programs generalizing Theorem 1.
3 Approximating Answer Sets Using Operators γP,U and γP Our first approach exploits the fact that every answer set of a UG-program P is a stable model of P + (Proposition 1). Let P be a UG-program and let (W l , W u ) be the limit of the alternating sequence of the operator γP + ,U . As we observed, (W l , W u ) is the well-founded model of P + . We define Appx 1 (P ) = [P ∪ not(U \ W u )]∗ . By (4), W l = [P ∪ not(U \ W u )]∗ ∩ U . Hence, W l ⊆ Appx 1 (P ) and so, Appx 1 (P ) contains all literals that are true in the well-founded model (W l , W u ). Theorem 2. Let P be a UG-program. For every answer set M of P , Appx 1 (P ) ⊆ M c . In addition, if Appx 1 (P ) is incoherent then P has no answer sets. Proof: Let M be an answer set of P . By Proposition 1, M is a stable model of P + . Let (W l , W u ) be the well-founded model of P + . By Theorem 1, not(U \ W u ) ⊆ M c . Moreover, since M is an answer set of P , M is a model of P (Proposition 1, again) and so, M c is closed under P . Since Appx 1 (P ) is the least set of literals containing not(U \ W u ) and closed under P , Appx 1 (P ) ⊆ M c , as claimed. The second part of the assertion follows from the first one. 2 We will illustrate this approach with an example. Example 1. Let us consider the following UG-program P : a ← not(b), not(c) c ← c, not(b) b ← not(d)
d ← not(b) not(b) ←
Approximating Answer Sets of Unitary Lifschitz-Woo Programs
71
All but the last rule belong to P + . The operator γP + ,U determines the following alternating sequence (Wi ) of sets: ∅ → {a, b, d} → ∅... . It follows that the well-founded model of P + is (W l , W u ) = (∅, {a, b, d}). Consequently, Appx 1 (P ) = [P ∪ {not(c)}]∗ = {a, d, not(b), not(c)}. In this case, the well-founded model of P + alone provides a weak bound on answer sets of P . The improved bound Appx 1 (P ), which closes the model under P , provides a much stronger approximation. In fact, only one set M is approximated by {a, d, not(b), not(c)}. This set is {a, d} and it happens to be a unique answer set of P . Let Q = P ∪ {not(a) ← d}. Since Q+ = P + , it follows that Appx 1 (Q) = [Q ∪ {not(c)}]∗ = {a, d, not(a), not(b), not(c)}. Since Appx 1 (Q) is incoherent, Q has no answer sets, a fact that can be verified directly. 2 The approximation Appx 1 (P ), where P is the first program from Example 1, is complete and coherent, and we noted that the unique set of atoms that Appx 1 (P ) approximates is a unique answer set of P . It is a general property extending Theorem 1(2). Corollary 1. Let P be a UG-program. If Appx 1 (P ) is coherent and complete then Appx 1 (P ) ∩ U is a unique answer set of P . Proof: Since Appx 1 (P ) is coherent and complete, Theorem 2 implies that P has at most one answer set. To prove the assertion it is then enough to show that M = Appx 1 (P ) ∩ U is an answer set of P . Let (W l , W u ) be the well-founded model of P + . Since Appx 1 (P ) = [P ∪not(U \ W u )]∗ , [P ∪ not(U \ W u )]∗ is coherent and complete. Consequently, M c = [P ∪ not(U \ W u )]∗ . It follows that not(U \ W u ) ⊆ not(U \ M ). Thus, M c ⊆ [P ∪ not(U \ M )]∗ . It also follows that M c is closed under the rules in P . Since not(U \ M ) ⊆ M c , [P ∪ not(U \ M )]∗ ⊆ M c . Thus, M c = [P ∪ not(U \ M )]∗ . It follows now that M is a model of P − . Moreover, it also follows that M = [P + ∪ not(U \ M )]∗ and so, M is a stable model of P + . Thus, M is an answer set of P . 2 We will now introduce another approximation to answer sets of a UG-program P . This time, we will use the operator γP . Let Yi be the alternating sequence of the operator γP and let (Y l , Y u ) be the limit of (Yi ). We define Appx 2 (P ) = Y l . Theorem 3. Let P be a UP-program. If M is an answer-set for P then Appx 2 (P ) ⊆ M c . In addition, if Appx 2 is incoherent, then P has no answer sets.
72
V.W. Marek, I. Pivkina, and M. Truszczy´nski
Proof: Let M be an answer set of P and let (Yi ) be the alternating sequence for the operator γP . We will show by induction that for every i ≥ 0, Y2i ∩ U ⊆ M ⊆ Y2i+1 . Since Y0 = ∅, Y0 ∩ U ⊆ M . We will now assume that Y2i ∩ U ⊆ M and show that M ⊆ Y2i+1 . Our assumption implies that not(U \ M ) ⊆ not(U \ Y2i ). Thus, since M is a stable model of P + , it follows from (3) that M = [P + ∪ not(U \ M )]∗ ∩ U ⊆ [P ∪ not(U \ M )]∗ ⊆ [P ∪ not(U \ Y2i )]∗ = Y2i+1 . Next, we assume that M ⊆ Y2i+1 and show that Y2i+2 ∩ U ⊆ M . The assumption implies that not(U \ Y2i+1 ) ⊆ not(U \ M ). Thus, Y2i+2 ∩ U = [P ∪ not(U \ Y2i+1 )]∗ ∩ U ⊆ [P ∪ not(U \ M )]∗ ∩ U = [P + ∪ not(U \ M )]∗ ∩ U = M. The last but one equality follows from the fact that M is a model of P − and the last inequality follows from the fact that M is a stable model of P + . From the claim it follows that M ⊆ Y u . Thus, not(U \ Y u ) ⊆ M c . Since M is a model of P , M c is closed under P . Thus, Y l = [P ∪ not(U \ Y u )]∗ ⊆ M c . 2 As before, if the approximation provided by Appx 2 (P ) is complete and coherent, P has a unique answer set. Corollary 2. Let P be a UG-program such that Appx 2 (P ) is complete and coherent. Then, Appx 2 (P ) ∩ U is a unique answer set of P . The following example illustrates our second approach. Example 2. Let U = {a, b}. Let P be a UG-program consisting of rules: not(a) ← not(b) b ← not(a) a← Iterating the operator γP results in the following alternating sequence: ∅ → {a, b, not(a), not(b)} → {a} → {a, b, not(a), not(b)} → ... . Its limit is ({a}, {a, b, not(a), not(b)}) and so, Appx 2 (P ) = {a}.
2
We conclude this section by showing that the approximations Appx 1 and Appx 2 are, in general, not comparable. The following example shows that there is a UG-program P such that Appx 1 (P ) and Appx 2 (P ) are coherent and Appx 2 (P ) is a proper subset of Appx 1 (P ). Example 3. Let U = {a, b, c, d, e} and let P be a UG-program consisting of the rules: a ← not(a) b ← not(a) c ← not(d)
d ← not(c), not(e) e← a ← c, e not(e) ← a, b
Approximating Answer Sets of Unitary Lifschitz-Woo Programs
73
Computing Appx 1 (P ). The program P + consists of all rules of P except the last one. The alternating sequence of γP + ,U starts as follows: ∅ → a, b, c, d, e → {e} → a, b, c, e → a, c, e → a, c, e → ... . Thus, its limit is ({a, c, e}, {a, c, e}) and Appx 1 (P ) = [P ∪ {a, c, e} ∪ {not(b), not(d)}]∗ = {a, c, e, not(b), not(d)}. Computing Appx 2 (P ). Iterating the operator γP yields the following sequence: ∅ → Lit (U ) → {e} → Lit (U ) → ... . Thus, the limit is ({e}, Lit(U )) and so, Appx 2 (P ) = {e}.
2
The next example shows that for some programs the opposite is true and the second approximation is strictly more precise. Example 4. Let U = {a, b, c} and let P be a UG-program consisting of the rules: a ← not(b) b ← not(a)
c ← a, b not(a) ←
Computing Appx 1 (P ). The alternating sequence of the operator γP + ,U is ∅ → {a, b, c} →∅ → ... . Thus,
Appx 1 (P ) = P ∗ = {not(a), b}.
Computing Appx 2 (P ). Iterating γP yields: ∅ → Lit (U ) → {not(a), b} → {not(a), b, not(c)} → {not(a), b, not(c)} → ... . Thus, Appx 2 (P ) = {not(a), b, not(c)}.
2
4 Strong Approximation Let P be a UG-program and Z ⊆ Lit (U ) a set of literals (not necessarily coherent). By the weak reduct of P with respect to Z we mean the program PwZ obtained from P by: 1. removing all rules that contain in the body a literal not(a) such that a ∈ Z and not(a) ∈ / Z; 2. removing from the bodies of the remaining rules all literals not(a) such that a ∈ / Z. Let us note that if a ∈ Z and not(a) ∈ Z, not(a) will not be removed from the rules that remain after Step 1. Let Z be a set of literals, Z ⊆ Lit (U ). We define γPw (Z) = [PwZ ]∗ . In general, the operator γPw is not antimonotone. Thus, the sequence (Zi ) obtained by iterating γPw (starting with the empty set) in general is not alternating.
74
V.W. Marek, I. Pivkina, and M. Truszczy´nski
Example 5. Let P be a UG-program consisting of the rules: a ← not(b) b←
c ← not(d) d←
not(b) ← not(c) By the definition, Z0 = ∅. When computing P Z0 , no rule is removed in Step 1 of the definition of the weak reduct, and every literal of the form not(a) is removed from the bodies of rules in P . Thus, Z1 = {a, b, c, d, not(b)}. When computing PwZ1 , we observe that not(b) ∈ Z1 . Thus, the first rule is not removed despite the fact that b ∈ Z1 . Hence, we have: ⎧ ⎫ ⎨ a ← not(b) ⎬ PwZ1 = b ← , and so, Z2 = {b, d}. ⎩ ⎭ d← In the next step, we compute: ⎧ ⎫ b← ⎬ ⎨ PwZ2 = not(b) ← , and so, Z3 = {b, d, not(b)}. ⎩ ⎭ d← When computing PwZ3 , the rule a ← not(b) is again not removed in Step 1. Thus, ⎧ ⎫ a ← not(b) ⎪ ⎪ ⎪ ⎪ ⎨ ⎬ b← PwZ3 = , and so, Z4 = {a, b, d, not(b)}. not(b) ← ⎪ ⎪ ⎪ ⎪ ⎩ ⎭ d← We note that Z4 is not a subset of Z3 . Thus, for this program P , the sequence (Zi ) is not alternating. 2 In the remainder of this section we show that under some conditions the sequence (Zi ) is alternating and may be used to approximate answer sets of UG-programs. We first establish a lemma providing conditions, under which [PwX ]∗ is antimonotone in X. Lemma 1. Let P be a UG-program, X and X be sets of literals such that X ⊆ X . Moreover, let at least one of the following conditions hold: 1. 2. 3. 4.
X is coherent X ⊆ [PwX ]∗ and [PwX ]∗ is coherent. X ∗ [Pw ] ⊆ X X ⊆ [PwX ]∗ and [PwX ]∗ is coherent.
Then [PwX ]∗ ⊆ [PwX ]∗ . The next lemma describes two properties of [PwX ]∗ under the assumption that X is coherent.
Approximating Answer Sets of Unitary Lifschitz-Woo Programs
75
Lemma 2. Let P be a UG-program and X a coherent set of literals, X ⊆ Lit (U ). 1. [PwX ]∗ = [PwX∩U ]∗ . 2. [PwX ]∗ = [(P + )X∩U ]∗ ∪ not(X ) = [(P + )X∩U ]∗ ∪ not(X ), w where X is the set of atoms such that a ∈ X if and only if there is a rule not(a) ← + X∩U ∗ Body in (P − )X ] |= Body . w such that [(P )w We can now prove the following characterization of answer sets of UG-programs. Lemma 3. Let P be a UG-program, M ⊆ U a set of atoms, and N a set of atoms consisting of all atoms a ∈ U such that a ∈ / M and there is a rule not(a) ← Body in P such that M |= Body . Then M is an answer set of P if and only if [PwM ]∗ = M ∪ not(N ). Proof: (⇒) By Proposition 1, M is a stable model of P + and a model of P − . In particular, [(P + )M ]∗ = M . Let X be the set specified in Lemma 2(2), defined for X = M . Since [(P + )M ]∗ = M and M is a model of P − , for every a ∈ X , a ∈ / M . Thus, X = N and the assertion follows from Lemma 2(2). (⇐) It follows from Lemma 2(2) that M = [(P + )M ]∗ . Thus, M is stable model of P + . Let us consider a rule not(a) ← Body from P − such that M satisfies Body . Let Body consist of all atoms in Body . It follows that not(a) ← Body is a rule in M ∗ (P − )M w . Since M |= Body , M |= Body . Thus, by Lemma 2(2), not(a) ∈ [Pw ] . M ∗ Since [Pw ] = M ∪ not(N ), a ∈ not(N ) which, in turn, implies a ∈ / M . It follows that M is a model of P − and so, an answer set of P . 2 The results we presented above allow us to prove that as long as the lower (even) terms of the sequence (Zi ) are coherent, the sequence behaves as an alternating one. Proposition 3. Let i be an integer, i ≥ 0, such that Z2i is coherent. Then 1. Z0 ⊆ Z2 ⊆ . . . ⊆ Z2i 2. Z1 ⊇ Z3 ⊇ . . . ⊇ Z2i+1 3. Z2i ⊆ Z2i+1 . This last proposition is crucial for the definition of our third approximation. Let us consider the sequence (Zi ). If for every i, Z2i is coherent, Proposition 3 implies that the sequence (Zi ) is alternating. Let (Z l , Z u ) be the limit of (Zi ). We define Appx 3 (P ) = Z l ∪ {not(a) : a ∈ U \ Z u }. Otherwise, there is i such that Z2i is incoherent. In this case, we say that Appx 3 (P ) is undefined. Theorem 4. Let P be a UG-program. If M is an answer set of P then Appx 3 (P ) is defined and Appx 3 (P ) ⊆ M c . If Appx 3 (P ) is not defined, then P has no answer sets. Proof: The second part of the assertion follows from the first one. To prove the first part of the assertion, we will show that for every i ≥ 0, Z2i ⊆ M c , and M ⊆ Z2i+1 . We proceed by induction on i. If i = 0, then Z0 = ∅ ⊆ M c . We now assume that Z2i ⊆ M c and prove that M ⊆ Z2i+1 .
76
V.W. Marek, I. Pivkina, and M. Truszczy´nski
Since Z2i ⊆ M c and M c is coherent, Z2i is coherent, too. By Lemma 1 (applied c to X = Z2i and X = M c , under the assumption (4)), [PwM ]∗ ⊆ [PwZ2i ]∗ . Thus, c [PwM ]∗ ⊆ Z2i+1 . By Lemma 2(1), [PwM ]∗ ⊆ Z2i+1 . By Lemma 3, M ⊆ [PwM ]∗ . Therefore, M ⊆ Z2i+1 . Next, we assume that M ⊆ Z2i+1 and prove that Z2i+2 ⊆ M c . Let us note that Z Z2i+2 = [Pw 2i+1 ]∗ and that by Lemma 3, [PwM ]∗ ⊆ M c . Thus, it will suffice to show Z that [Pw 2i+1 ]∗ ⊆ [PwM ]∗ . To this end, we note that by Lemma 3, M ⊆ [PwM ]∗ and so Lemma 1 applies (under the condition (4)) to X = M and X = Z2i+1 , and implies the required inclusion. It follows that Z l ⊆ M c and that M ⊆ Z u . If a ∈ / Z u , then a ∈ / M and so, c l u not(a) ∈ M . Thus, Appx 3 (P ) = Z ∪ not(U \ Z ) ⊆ M c . 2 Example 6. Let P be a UG-program consisting of the rules: not(a) ← a ← not(b)
not(d) ← not(c) d ← not(e)
b ← not(a) c ← a, b
e ← not(d) f ← d, e
Iterating the operator γPw results in the following sequence: ∅ → {a, b, c, d, e, f, not(a), not(d)} → {not(a), b} → {b, d, e, f, not(a), not(d)} → {b, e, not(a), not(d)} → {b, e, not(a), not(d)} → ... . Thus, the sequence (Zi ) is alternating. Its limit is (Z l , Z u ), where Z l = Z u = {b, e, not(a), not(d)}. Thus, Appx 3 (P ) = Z l ∪ not(U \ Z u ) = {b, e, not(a), not(c), not(d), not(f )}. Since Appx 3 (P ) is coherent and complete, P has a unique answer set, {b, e}. This example also demonstrates that Z u can improve on the bound provided by Z l itself. 2
5 Properties of Appx 3 In this section we will show that if Appx 3 is defined then it is stronger than the other two approximations. We recall that if Appx 3 (P ) is undefined, then P has no answer sets, that is, P is inconsistent. It follows that for all consistent UG-programs, Appx 3 is stronger than the the other two approximations. Theorem 5. LetP be a UG-program. If Appx 3 (P ) is defined then Appx 1 (P ) ∪ Appx 2 (P ) ⊆ Appx 3 (P ) There are programs which show thatAppx 3 is strictly stronger. Example 7. Let P be the UG-program from Example 4. We recall that Appx 1 (P ) = P {not(a), b}. Let us compute Appx 3 (P ). By iterating the operator γw , we obtain the following sequence:
Approximating Answer Sets of Unitary Lifschitz-Woo Programs
77
Z0 = ∅ → Z1 = {a, b, c, not(a)} → Z2 = {not(a), b} → Z3 = {not(a), b} . . . . Hence, Appx 3 (P ) = {not(a), b, not(c)} and Appx 1 (P ) is a proper subset of Appx 3 (P ). 2 Example 8. Let P be the UG-program from Example 3. We recall that Appx 2 (P ) = P {e}. To compute Appx 3 (P ), we note that by iterating the operator γw we get the following sequence: Z0 = ∅ → Z1 = {a, b, c, d, e, not(e)} → Z2 = {e} → Z3 = {a, b, c, e, not(e)} → Z4 = {a, c, e} → Z5 = {a, c, e} . . . . Hence, Appx 3 (P ) = {a, not(b), c, not(d), e} and Appx 2 (P ) is a proper subset of Appx 3 (P ). 2 Finally, we show that if Appx 3 (P ) is defined and complete then P has a unique answer set. Corollary 3. Let P be a UG-program such that Appx 3 (P ) is defined and complete. Then Appx 3 (P ) ∩ U is an answer set of P and P has no other answer sets.
6 Corollaries for the Case of Revision Programs Revision programming [MT98] is a formalism for describing and enforcing constraints on databases. The main concepts in the formalism are an initial database, a revision program, and justified revisions. Expressions of the form in(a) and out(a) (a ∈ U ) are revision literals. Intuitively, in(a) (respectively, out(a)) means that atom a is in (respectively, is not in) a database. A revision program consists of rules α ← α1 , . . . , αn , where α, αi , . . . , αn are revision literals. Given a revision program P and an initial database I, [MT98] defined P -justified revisions of I to represent revisions that satisfy the constraints of P , are “grounded” in P and I, and differ minimally from the initial database. As we mentioned earlier, unitary general programs are equivalent to revision programs. The equivalence is established by the so called shifting theorem [MPT99], which allows us to reduce any pair (P, I), where P is a revision program and I is an initial database, to a unitary general program so that P -justified revisions of I correspond to answer sets of the unitary general program. Consequently, all results of our paper imply results about approximations of justified revisions. Formal descriptions of Appx 1 , Appx 2 , and Appx 3 for revision programs can be found in [Piv05]. Approximations Appx 1 and Appx 2 for revision programs were originally described in [Piv01]. Acknowledgments. Inna Pivkina was supported by the NSF-funded ADVANCE Institutional Transformation Program at New Mexico State University, Grant No. 0123690, and NMSU College of Arts and Sciences Research Center Grant No. 01-3-43891. The other two authors were supported by the NSF Grants No. 0097278 and 0325063.
78
V.W. Marek, I. Pivkina, and M. Truszczy´nski
References [BTK93] A. Bondarenko, F. Toni, and R.A. Kowalski. An assumption-based framework for non-monotonic reasoning. In A. Nerode and L. Pereira, editors, Logic programming and non-monotonic reasoning (Lisbon, 1993), pages 171–189, Cambridge, MA, 1993. MIT Press. [GL88] M. Gelfond and V. Lifschitz. The stable semantics for logic programs. In Proceedings of the 5th International Conference on Logic Programming, pages 1070–1080. MIT Press, 1988. [GL91] M. Gelfond and V. Lifschitz. Classical negation in logic programs and disjunctive databases. New Generation Computing, 9:365–385, 1991. [Lif96] V. Lifschitz. Foundations of logic programming. In Principles of Knowledge Representation, pages 69–127. CSLI Publications, 1996. [LW92] V. Lifschitz and T.Y.C. Woo. Answer sets in general nonmonotonic reasoning. In Proceedings of the 3rd international conference on principles of knowledge representation and reasoning, KR ’92, pages 603–614, San Mateo, CA, 1992. Morgan Kaufmann. [MPT99] V. W. Marek, I. Pivkina, and M. Truszczy´nski. Revision programming = logic programming + integrity constraints. In G. Gottlob, E. Grandjean, and K. Seyr, editors, Computer Science Logic, 12th International Workshop, CSL’98, volume 1584 of Lecture Notes in Computer Science, pages 73–89. Springer, 1999. [MPT02] V. W. Marek, I. Pivkina, and M. Truszczy´nski. Annotated revision programs. Artificial Intelligence Journal, 138:149–180, 2002. [MT98] W. Marek and M. Truszczy´nski. Revision programming. Theoretical Computer Science, 190(2):241–277, 1998. [Piv01] I. Pivkina. Revision programming: a knowledge representation formalism. PhD dissertation, University of Kentucky, 2001. [Piv05] I. Pivkina. Defining well-founded semantics for revision programming Technical Report NMSU-CS-2005-001, New Mexico State University, Computer Science Department, 2005. [PT95] T.C. Przymusi´nski and H. Turner. Update by means of inference rules. In Logic programming and nonmonotonic reasoning (Lexington, KY, 1995), volume 928 of Lecture Notes in Computer Science, pages 156–174, Berlin, 1995. Springer. [SNS02] P. Simons, I. Niemel¨a, and T. Soininen. Extending and implementing the stable model semantics. Artificial Intelligence, 138:181–234, 2002. [SNV95] V.S. Subrahmanian, D. Nau, and C. Vago. WFS + branch bound = stable models. IEEE Transactions on Knowledge and Data Engineering, 7:362–377, 1995. [Van93] A. Van Gelder. The alternating fixpoint of logic programs with negation. Journal of Computer and System Sciences, 47(1):185–221, 1993. [VRS88] A. Van Gelder, K.A. Ross, and J.S. Schlipf. Unfounded sets and well-founded semantics for general logic programs. In ACM Symposium on Principles of Database Systems, pages 221–230, 1988.
On Modular Translations and Strong Equivalence Paolo Ferraris Department of Computer Sciences, The University of Texas at Austin, Austin TX 78712, USA [email protected]
Abstract. Given two classes of logic programs, we may be interested in modular translations from one class into the other that are sound with respect to the answer set semantics. The main theorem of this paper characterizes the existence of such a translation in terms of strong equivalence. The theorem is used to study the expressiveness of several classes of programs, including the comparison of cardinality constraints with monotone cardinality atoms.
1
Introduction
The notion of an answer set (or “stable model”), originally defined in [Gelfond and Lifschitz, 1988], was extended to more general logic programs in various ways. In Fig. 1 we see some examples of extensions of the class of “traditional” rules studied in that paper, and also some subclasses of that class. The language in each line of the table contains the languages shown in the previous lines. When we compare the expressiveness of two classes of rules R and R , several criteria can be used. First, we can ask whether for any R-program (that is, a set of rules of the type R) one can find an R -program that has exactly the same answer sets. (That means, in particular, that the R -program does not use “auxiliary atoms” not occurring in the given R-program.) From this point of view, the classes of rules shown in Fig. 1 can be divided into three groups: a UR- or PR-program has a unique answer set; TR-, TRC- and DR-programs may have many answer sets, but its answer sets always have the “anti-chain” property (one cannot be a proper subset of another); a NDR- or RNE-program can have an arbitrary collection of sets of atoms as its collection of answer sets. Another comparison criterion is based on the computational complexity of the problem of the existence of an answer set. We pass, in the complexity hierarchy, from P in case of UR- and PR-programs, to NP in case of TR- and TRCprograms [Marek and Truszczy´ nski, 1991], and finally to Σ2P for more complex kinds of programs [Eiter and Gottlob, 1993]. A third criterion consists in checking whether every rule in R is strongly equivalent [Lifschitz et al., 2001] to an R -program. From this point of view, PR is essentially more expressive than UR: we will see at the end of Sect. 3 that C. Baral et al. (Eds.): LPNMR 2005, LNAI 3662, pp. 79–91, 2005. c Springer-Verlag Berlin Heidelberg 2005
80
P. Ferraris class of rules UR PR TR TRC DR NDR RNE
syntactic form unary rules: a ← (also written as simply a) and a ← b positive rules: a ← b1 , . . . , b n traditional rules: a ← b1 , . . . , bn , not c1 , . . . , not cm TRs + constraints: TRs and ← b1 , . . . , bn , not c1 , . . . , not cm disjunctive rules: a1 ; . . . ; ap ← b1 , . . . , bn , not c1 , . . . , not cm negational disjunctive rules: a1 , . . . ; ap ; not d1 ; . . . ; not dq ← b1 , . . . , bn , not c1 , . . . , not cm rules with nested expressions: F ←G
Fig. 1. A classification of logic programs under the answer set semantics. Here a, b, c, d stand for propositional atoms. F , G stand for nested expressions without classical negation [Lifschitz et al., 1999], that is, expressions formed from atoms, and ⊥, using conjunction (,), disjunction (;) and negation as failure (not).
a ← b, c is not strongly equivalent to any set of unary rules. Furthermore, TRC and DR are essentially different from each other, since no program in TRC is strongly equivalent to the rule p; q in DR [Turner, 2003, Proposition 1]. A fourth comparison criterion is based on the existence of a translation from R-programs to R -programs that is not only sound (that is, preserves the program’s answer sets) but is also modular: it can be applied to a program rule-byrule. For instance, [Janhunen, 2000] showed that there is no modular translation from PR to UR and from TR to PR 1 . On the other hand, RNE can be translated into NDR by a modular procedure similar to converting formulas to conjunctive normal form [Lifschitz et al., 1999]. The main theorem of this paper shows that under some general conditions, the last two criteria — the one based on strong equivalence and the existence of a sound modular translation — are equivalent to each other. This offers a method to prove that there is no modular translation from R to R by finding a rule in R that is not strongly equivalent to any R -program. For instance, in view of the Proposition 1 from [Turner, 2003] mentioned above, no modular translation exists from DR to TRC. To apply the main theorem to other cases, we need to learn more about the strong equivalence relations between a single rule of a language and a set of rules. We show that for many rules r in NDR, any NDR-program that is strongly equivalent to r contains a rule that is at least as “complex” as r. This fact will allow us to conclude that all classes UR, PR, TR, TRC, DR and NDR are essentially different from each other in terms of strong equivalence. In view 1
His results are actually stronger, see Sect. 7 below.
On Modular Translations and Strong Equivalence
81
of the main theorem, it follows that they are essentially different from each other in the sense of the modular translation criterion as well. Finally, we show how to apply our main theorem to programs with weight constraints [Simons et al., 2002]. As a result, we find that it is not possible to translate programs with weight constraints into programs with monotone cardinality atoms [Marek and Niemel¨a, 2004] in a modular way (unless the translation introduces auxiliary atoms). The paper continues with the statement of our main theorem (Sect. 2). In Sect. 3, we study the expressiveness of subclasses of NDR in terms of strong equivalence and modular translations. We move to the study of cardinality constraints in Sect. 4. Section 5 provides some background needed for the proof of some of the claims of this paper (Sect. 6).
2
Modular Transformations and Strong Equivalence
We assume that the reader is familiar with the concept of an answer set for the classes of logic programs in Fig. 1 (the semantics for the class RNE, which is applicable to all its subclasses, is reproduced in Sect. 5.1). A program is a subset of RNE. Two programs Π1 and Π2 are strongly equivalent if, for every program Π, Π1 ∪ Π and Π2 ∪ Π have the same answer sets. A (modular) transformation is a function f such that – Dom(f ) ⊆ RNE, and – for every rule r ∈ Dom(f ), f (r) is a program such that every atom occurring in it occurs in r also. A transformation f is sound if, for every program Π ⊆ Dom(f ), Π and r∈Π f (r) have the same answer sets. For example, the transformation defined in the proof of Proposition 7 from [Lifschitz et al., 1999], which eliminates nesting from a program with nested expressions, is a sound transformation. For instance, for this transformation f , f (a ← b; c) = {a ← b, a ← c}. As another example of a sound transformation, consider the transformation f with Dom(f ) = N DR, where f (not d1 ; . . . ; not dq ← b1 , . . . , bn , not c1 , . . . , not cm ) = {← b1 , . . . , bn , d1 , . . . , dq , not c1 , . . . , not cm } and f (r) = {r} for the other rules r in NDR. On the other hand, the familiar method of eliminating constraints from a program that turns ← p into q ← p, not q is not a transformation in the sense of our definition, because it introduces an atom q that doesn’t occur in ← p.
82
P. Ferraris
This is the theorem that relates strong equivalence and modular transfomations: Theorem 1 (Main Theorem). For every transformation f such that Dom(f ) contains all unary rules, f is sound iff, for each r ∈ Dom(f ), f (r) is strongly equivalent to r. Our definition of transformation requires that all atoms that occur in f (r) occur in r also. The following counterexample shows that without this assumption the assertion of the Main Theorem would be incorrect. Let p and q be two atoms, and, for each rule r = F ← G in RNE, let f1 (r) be F ← G, not p F ← G, not q Fp↔q ← Gp↔q , not not p, not not q. where Fp↔q and Gp↔q stand for F and G with all the occurrences of p replaced by q and vice versa. Note that f1 is not a transformation as defined in this paper since q occurs in f1 (p ← ). It can also be shown that p ← and f1 (p ← ) are not strongly equivalent. However, the “transformation” is sound: Proposition 1. For any program Π, Π and r∈Π f1 (r) have the same answer sets. Without the assumption that UR ⊆ Dom(f ), the Main Theorem would not be correct either. We define a transformation f2 such that Dom(f2 ) consists of all rules of DR where all atoms in the body are prefixed by negation as failure, and the head is nonempty: the rules have the form a1 ; . . . ; ap ← not c1 , . . . , not cm .
(1)
with p > 0. For each rule r of the form (1), f2 (r) is defined as {ai ← not a1 , . . . , not ai−1 , not ai+1 , . . . , not ap , not c1 , . . . , not cm : 1 ≤ i ≤ p}. It is easy to see that f2 (p; q) is not strongly equivalent to p; q. However, this transformation is sound: Proposition 2. For any program Π ⊆ Dom(f2 ), Π and r∈Π f2 (r) have the same answer sets.
3
Applications: Negational Disjunctive Rules
In order to apply the Main Theorem to modular translations, we first need to study some properties of strong equivalence. We focus on the class NDR. If r is a1 , . . . ; ap ; not d1 ; . . . ; not dq ← b1 , . . . , bn , not c1 , . . . , not cm
On Modular Translations and Strong Equivalence
define
head + (r) = {a1 , . . . , ap } body + (r) = {b1 , . . . , bn }
83
head − (r) = {d1 , . . . , dq } body − (r) = {c1 , . . . , cm }.
We say that r is basic if every pair of these sets, except possibly for the pair head + (r), head − (r), is disjoint. Any nonbasic rule can be easily simplified: it is either strongly equivalent to the empty program or contains redundant terms in the head. A basic rule, on the other hand, cannot be simplified if it contains at least one nonnegated atom in the head: Theorem 2. Let r be a basic rule in NDR such that head + (r) = ∅. Every program subset of NDR that is strongly equivalent to r contains a rule r such that head + (r) ⊆ head + (r ) body + (r) ⊆ body + (r ) − − head (r) ⊆ head (r ) body − (r) ⊆ body − (r ) This theorem shows us that for most basic rules r (the ones with at least one positive element in the head), every program strongly equivalent to r must contain a rule that is at least as “complex” as r. Given two subsets R and R of RNE, a (modular) translation from R to R is a transformation f such that Dom(f ) = R and f (r) is a subset of R for each r ∈ Dom(f ). Using Theorems 1 and 2, we can differentiate between the classes of rules in Fig. 1 in terms of modular translations: Proposition 3. For any two languages R and R among UR, PR, TRC, TR, DR and NDR such that R ⊂ R, there is no sound translation from R to R . Theorems 1 and 2 allow us also to differentiate between subclasses of NDR described in terms of the sizes of various parts of the rule. Define, for instance PBRi (“positive body of size i”) as the set of rules r of NDR such that |body + (r)| ≤ i. We can show that, for every i ≥ 0, there is no sound translation from PBRi+1 to PBRi (or even from PBRi+1 ∩ PR to PBRi ). Similar properties can be stated in terms of the sizes of body − (r), head + (r) and head − (r). Another consequence of Theorem 2 is in terms of (absolute) tightness of a program [Erdem and Lifschitz, 2003, Lee, 2005]. Tightness is an important property of logic programs: if a program is tight then its answer sets can be equivalently characterized by the satisfaction of a set of propositional formulas of about the same size. Modular translations usually don’t make nontight programs tight: Proposition 4. Let R be any subset of NDR that contains all unary rules, and let f be any sound translation from R to NDR. For every nontight program Π ⊂ R consisting of basic rules only, r∈Π f (r) is nontight.
4 4.1
Applications: Programs with Cardinality Constraints Syntax
We briefly review the syntax of programs with cardinality constraints [Simons et al., 2002].
84
P. Ferraris
A rule element is an atom possibly prefixed with negation as failure symbol not. A cardinality constraint is an expression of the form L{c1 , . . . , cm }U
(2)
where – each of L, U is (a symbol for) an integer or −∞, +∞, – m ≥ 0, and – c1 , . . . , cm are rule elements. As an abbreviation, L can be omitted if L = −∞; similarly, we can drop U if U = +∞. A rule with cardinality constraints is an expression of the form C0 ← C1 , . . . , Cn
(3)
where C0 , . . . , Cn (n ≥ 0) are cardinality constraints. A program with cardinality constraints is a set of rules with cardinality constraints. Let CCR denote the set of all rules with cardinality constraints. A straightforward generalization of the definition of a transformation allows us to talk about sound translations between subclasses of CCR, and also between a class of CCR and a subclass of RNE. The concept of (modular) transformations and translations can be extended to programs with cardinality constraints: we can have translations between subclasses of CCR, and from/to subclasses of RNE. The definition of the soundness for those translations follows as well. Another class of programs similar to the one with cardinality constraints — programs with monotone cardinality atoms — has been defined in [Marek and Niemel¨a, 2004]. The results of that paper show that rules with monotone cardinality atoms are essentially identical to rules with cardinality constraints that don’t contain negation as failure; we will denote the set of all such rules by PCCR (“positive cardinality constraints”). 4.2
Translations
First of all, we show how programs with cardinality constraints are related to the class NDR. Let SNDR (Simple NDR) be the language consisting of rules of the form a; not d1 ; . . . ; not dq ← b1 , . . . , bn , not c1 , . . . , not cm (4) and ← b1 , . . . , bn , not c1 , . . . , not cm .
(5)
Proposition 5. There exist sound translations from SNDR to CCR, and back. If we don’t allow negation in cardinality constraints, another relationship holds. We define the class VSNDR (Very Simple NDR) consisting of rules of the form a; not a ← b1 , . . . , bn , not c1 , . . . , not cm (6) and of the form (5).
On Modular Translations and Strong Equivalence
85
Proposition 6. There exist sound translations from VSNDR to PCCR, and back. Using Theorems 1 and 2, we can prove: Proposition 7. There is no sound translation from CCR to PCCR. Since the class PCCR is essentially identical to the class of rules with monotone cardinality atoms, we have that programs with cardinality constraints are essentially more expressive than programs with monotone cardinality atoms.
5 5.1
Background for Proofs Answer Set Semantics for RNE
The semantics of programs is characterized by defining when a set X of atoms is an answer set for a program Π. As a preliminary step, we define when a set X of atoms satisfies a formula F (symbolically, X |= F ), as follows: – – – – – –
for an atom a, X |= a if a ∈ X X |= X |= ⊥ X |= (F, G) if X |= F and X |= G X |= (F ; G) if X |= F or X |= G X |= not F if X |= F .
We say that X satisfies a program Π (symbolically, X |= Π) if, for every rule F ← G in Π, X |= F whenever X |= G. The reduct Π X of a program Π with respect to a set X of atoms is obtained by replacing each outermost formula of the form not F (that is, every formula of the form not F not in the scope of negation as failure) by ⊥, if X |= F , and by otherwise. The concept of an answer set is defined first for programs not containing negation as failure: a set X of atoms is an answer set for such a program Π if X is a minimal set satisfying Π. For an arbitrary program Π, we say that X is an answer set for Π if X is an answer set for the reduct Π X . 5.2
Strong Equivalence
The following lemma is the main criterion that we use to check strong equivalence in most of the proofs. It can be proved in a way similar to the equivalence criterion from [Turner, 2003]. Lemma 1. Let A be the set of atoms occurring in programs Π1 and Π2 . Π1 and Π2 are strongly equivalent iff, for each Y ⊆ A, – Y |= Π1Y iff Y |= Π2Y , and – if Y |= Π1Y then, for each X ⊂ Y , X |= Π1Y iff X |= Π2Y . Next lemma can be easily proven under the characterization of strong equivalence as stated in [Lifschitz et al., 2001].
86
P. Ferraris
Lemma 2. Let P1 and P2 be sets of programs. If each program in P 1 is strongly equivalent to a program in P2 and vice versa, then Π∈P1 Π and Π∈P2 Π are strongly equivalent. Finally, we will use another property of strong equivalence from [Lifschitz et al., 2001]: Lemma 3. Two programs P1 and P2 are strongly equivalent iff, for every program Π ⊆ UR, Π1 ∪ Π and Π2 ∪ Π have the same answer sets.
6 6.1
Proofs Proof of the Main Theorem
Main Theorem. For every transformation f such that Dom(f ) contains all unary rules, f is sound iff, for each r ∈ R, f (r) is strongly equivalent to r. The proof from right to left is a direct consequence of Lemma 2: if f (r) is strongly equivalent to r for every rule r ∈ R, then for any Π ⊆ R, Π and f (r) are strongly equivalent, and consequently have the same answer sets. r∈Π In the proof from left to right, we first consider the case when r is a unary rule, and then extend the conclusion to arbitrary rules. In the rest of this section, f is an arbitrary sound transformation such that Dom(f ) contains all unary rules. By a and b we denote distinct atoms. Lemma 4. For every fact a, {a} and f (a) are strongly equivalent. Proof. For every program Π that has {a} as the only answer set, we have that ∅ |= Π ∅ , {a} |= Π {a} and ∅ |= Π {a} . Since {a} and f (r) are two of such programs Π, and a is the only atom that occurs in r and f (r), we can conclude that {r} and f (r) are strongly equivalent by Lemma 1. Lemma 5. For every rule r and fact a, {r, a} and f (r) ∪ {a} have the same answer sets. Proof. In view of Lemma 4, f (r) ∪ {a} and f (r) ∪ f (a) have the same answer sets, and the same holds for {r, a} and f (r) ∪ f (a) by hypothesis. Lemma 6. For every rule r of the form a ← a, (i) ∅ |= f (r)∅ , (ii) {a} |= f (r){a} , and (iii) ∅ |= f (r){a} . Proof. First of all, since the empty set in the only answer set for {r} and then for f (r), (i) is clearly true. Now consider the program consisting of rule r plus fact a. Since {a} is an answer set for {r, a}, it is an answer set for f (r) ∪ {a} also by Lemma 5. Consequently, {a} |= (f (r) ∪ {a}){a} , which proves (ii). From (ii) and the fact that {a} is not an answer set for f (r), (iii) follows also.
On Modular Translations and Strong Equivalence
87
Lemma 7. For every rule r of the form a ← b, (i) (ii) (iii) (iv)
∅ |= f (r)∅ , {a} |= f (r){a} , ∅ |= f (r){a} , and {b} |= f (r){b} .
Proof. The proof of the first three claims is similar to the one of Lemma 6. To prove (iv), consider that since {b} is not an answer set for {r, b}, it is not an answer set for f (r) ∪ {b} either by Lemma 5. But ∅ |= (f (r) ∪ {b}){b} because ∅ |= {b}{b} ; consequently {b} |= (f (r) ∪ {b}){b} . Since {b} |= {b}{b} , we can conclude (iv). Lemma 8. For every rule r of the form a ← b, (i) {a, b} |= f (r){a,b} , (ii) {b} |= f (r){a,b} , and (iii) {a} |= f (r){a,b} . Proof. Set {a, b} is an answer set for {r, b}, and consequently for f (r) ∪ {b} also by Lemma 5. Consequently {a, b} |= (f (r) ∪ {b}){a,b} — from which we derive (i) — and all proper subsets of {a, b} don’t satisfy (f (r) ∪ {b}){a,b} . Since {b} |= {b}{a,b} , we have that (ii) holds. Notice that {a, b} |= (f (r) ∪ {a}){a,b} follows from (i), and that {a, b} is not an answer set for f (r) ∪ {a} because it is not an answer set for {r, a} and by Lemma 5. Consequently there is a proper subset of {a, b} that satisfies (f (r) ∪ {a}){a,b} . Such subset can only be {a} because it is the only one that satisfies {a}{a,b} . We can conclude (iii). Lemma 9.
∅ |= f (a ← b){a,b} .
Proof. Let r be a ← b, and r be b ← a. Lemma 8 can help us determine which subsets of {a, b} satisfy (f (r) ∪ f (r )){a,b} : from part (i) applied to both r and r , we get that {a, b} satisfies this program, while {b} (by part (ii) applied to r) and {a} (by part (ii) applied to r ) don’t. On the other hand {a, b} is not an answer set for {r, r } and then for f (r) ∪ f (r ) by the soundness hypothesis. We can conclude that ∅ |= (f (r) ∪ f (r )){a,b} from which the lemma’s assertion follows. Lemma 10. For every unary program Π, Π and r∈Π f (r) are strongly equivalent. Proof. In view of Lemma 2, it is sufficient to show that for each unary rule r, {r} and f (r) are strongly equivalent. For rules that are facts, this is shown by Lemma 4. For rules r of the form a ← a, in view of Lemma 6 it is easy to check that, for every sets X and Y such that X ⊆ Y ⊆ {a}, X |= (a ← a)Y iff X |= f (a ← a)Y . So a ← a and f (a ← a) are strongly equivalent by Lemma 1. Similarly, we can check that for every sets X and Y such that X ⊆ Y ⊆ {a, b}
88
P. Ferraris
with X = ∅ or Y = {b}, that X |= (a ← b)Y iff X |= f (a ← b)Y . (The case with X = ∅ and Y = {b} is irrelevant for strong equivalence since {b} |= (a ← b){b} .) This is by Lemmas 7–9. Consequently a ← b and f (a ← b) are strongly equivalent by Lemma 1 as well. Now we are ready to prove the second part of the main theorem: for any rule r ∈ Dom(f ), f (r) and {r} are strongly equivalent. By Lemma 3,it is sufficient to show that, for each unary program Π, Π ∪{r} and Π ∪f (r) have the same answer sets. First we notice that Π ∪{r} and r ∈Π∪{r} f (r ) have the same answer sets since Π ∪ {r}⊆ Dom(f ) and forthe soundness of the transformation. Then we can see that r ∈Π∪{r} f (r ) = r ∈Π f (r ) ∪ f (r). Finally, r ∈Π f (r ) ∪ f (r) and Π ∪ f (r) have the same answer sets because, by Lemma 10, programs Π and r ∈Π f (r ) are strongly equivalent. 6.2
Proof of Propositions 1 and 2
Proposition 1. For any program Π, Π and sets.
r∈Π
f1 (r) have the same answer
Proof. (outline) Consider any set of atoms X. If {p, q} ⊆ X then f (F ← G)X is essentially {F ← G}X , and the claim easily follows. Otherwise f1 (F ← G)X is essentially {Fp↔q ← Gp↔q }. If we extend the notation of the subscript p ↔ q to both programs and sets of atoms, ( r∈Π f1 (r))X can be seen as (Π X )p↔q . A subset Y of X satisfies Π X iff Yp↔q satisfies (Π X )p↔q . Since Y p↔q ⊆ X and |Yp↔q | = |Y |, we can conclude that X is a minimal set satisfying ( r∈Π f1 (r))X iff it is a minimal set satisfying Π X . Proposition 2. For any program Π ⊆ NBR, Π and r∈Π f2 (r) have the same answer sets. Proof. (outline) Let Π be r∈Π f2 (r). The proof is based on the fact that Π and Π are both absolutely tight. So each set X atoms is an answer set for Π iff X satisfies Π and X is “supported” by Π, and similarly for Π (for more details, see [Lee, 2005]). It is not hard to see that the same sets of atoms satisfy Π and Π , and that Π and Π are supported by the same sets of atoms. 6.3
Proof of Theorem 2
For simplicity, we consider the definition of an answer set for NDR programs as defined in [Lifschitz and Woo, 1992], in which the reduct Π X consists of the rule head + (r) ← body + (r)
(7)
(head + (r) here stands for the disjunction of its elements, body + (r) for their conjunction) for every rule r in Π such that head − (r) ⊆ X and body − (r)∩X = ∅.
On Modular Translations and Strong Equivalence
89
Since Π X is satisfied by the same sets of atoms regardless on the definition, the strong equivalent criterion based on satisfaction of the reduct doesn’t change. Let Π be a program strongly equivalent to r. Let X be head + (r)∪head − (r)∪ body + (r), and let Y be body + (r). Then rX is (7). By Lemma 1, since X |= rX (recall that head + (r) is nonempty by hypothesis) then X |= Π X , and since Y |= rX it follows that Y |= Π X . Consequently, there is a rule of Π — the rule r of the theorem’s statement — such that X |= (r )X and Y |= (r )X . From this second fact, (r )X is nonempty so it is head + (r ) ← body + (r ),
(8)
and also Y |= body + (r ) and Y |= head + (r ). To prove that head + (r) ⊆ head + (r ), take any atom a ∈ head + (r). The set Y ∪ {a} satisfies rX , so it satisfies Π X by Lemma 1, and then (r )X also. On the other hand, since Y |= body + (r ) and Y ⊆ Y ∪ {a}, we have that Y ∪ {a} |= body + (r ). Consequently, Y ∪ {a} |= head + (r ). Since Y |= head + (r ), we can conclude that a is an element of head + (r ). The proof that body + (r) ⊆ body + (r ) is similar to the previous part of the proof, by taking any a ∈ body + (r) and considering the set Y \ {a} instead of Y ∪ {a}. To prove that head − (r) ⊆ head − (r ), take any atom a ∈ head − (r). Since X\{a} r is empty, it is satisfied, in particular, by Y and X \ {a}. Consequently, Y |= (r )X\{a} by Lemma 1. On the other hand, Y |= (r )X , so (r )X\{a} is not (8), and then it is empty. The only case in which (r )X\{a} is empty and (r )X is not is if a ∈ head − (r ). The proof that body − (r) ⊆ body − (r ) is similar to the previous part of the proof, by taking any a ∈ body − (r) and considering the reduct rX∪{a} . 6.4
Proofs of Propositions 5–7 (Outline)
In the proof of Proposition 5, from SNDR to CCR, we take the following sound translation f : if r has the form (4) then f (r) is 1{a} ← 1{b1 }, . . . , 1{bn }, {c1 }0, . . . , {cm }0, {not d1 }0, . . . , {not dq }0, and, if r has the form (5), then f (r) is 1{} ← 1{b1 }, . . . , 1{bn }, {c1 }0, . . . , {cm }0, 1{d1}, . . . , 1{dq }. A sound translation f from VSNDR to PCCR (proof of Proposition 6) is defined as follows: if r has the form (6) then f (r) is {a} ← 1{b1 }, . . . , 1{bn }, {c1 }0, . . . , {cm }0 while for rules r of the form (5), f (r) is the same as in the previous translation. The proof in the other direction is based on the modular translation from programs with cardinality constraints to programs with nested expressions whose heads are atoms or ⊥, as defined in [Ferraris and Lifschitz, 2005]. If we first apply such translation to any CCR-program, then the one from RNE to NDR
90
P. Ferraris
of [Lifschitz et al., 1999], we get a SNDR-program. Similarly from a PCCRprogram we get a VSNDR-program. For Proposition 7 assume, in sake of contradiction, that a sound translation from CCR to PCCR exists. Then, in view of Propositions 5 and 6, a sound translation from SNDR to VSNDR exists. This is impossible in view of Theorem 2 and the Main Theorem.
7
Conclusions
We have established a relationship between modular transformations and strong equivalence. We showed how it can be used to determine whether sound modular translations between languages are possible. Other definitions of a modular translation allow the the introduction of auxiliary atoms. This is, for instance, the case for the definitions in [Ferraris, 2005] and [Janhunen, 2000]. These two papers are also different from the work described in this note in that they take into account the computation time of translation algorithms. We restricted, in Sect. 2, the domain and range of transformations to programs with nested expressions. If we drop this limitation by allowing arbitrary propositional formulas, and we define the soundness of a transformation in terms of equilibrium logic [Pearce, 1997, 1999] then the Main Theorem will still hold. Since each propositional theory is strongly equivalent to a logic program [Cabalar and Ferraris, 2005] we can conclude that there exists a sound and modular translation from propositional theories to RNE and vice versa. Criteria for strong equivalence, in part related to Theorem 2, are proposed in [Lin and Chen, 2005]. The theorems about cardinality constraints stated in Sect. 4 can be trivially extended to arbitrary weight constraints in view of the fact that an expression c = w in a weight constraint can always be replaced by w copies of c = 1.
Acknowledgments I am grateful to Joohyung Lee for comments on this work. Special thanks go to Vladimir Lifschitz for many comments and discussions on the topic, and his careful reading of this paper. This research was partially supported by the National Science Foundation under Grant IIS-0412907.
References [Cabalar and Ferraris, 2005] Pedro Cabalar and Paolo Ferraris. Propositional theories are equivalent to logic programs. In preparation, 2005. [Eiter and Gottlob, 1993] Thomas Eiter and Georg Gottlob. Complexity results for disjunctive logic programming and application to nonmonotonic logics. In Dale Miller, editor, Proceedings of International Logic Programming Symposium (ILPS), pages 266–278, 1993.
On Modular Translations and Strong Equivalence
91
[Erdem and Lifschitz, 2003] Esra Erdem and Vladimir Lifschitz. Tight logic programs. Theory and Practice of Logic Programming, 3:499–518, 2003. [Ferraris and Lifschitz, 2005] Paolo Ferraris and Vladimir Lifschitz. Weight constraints as nested expressions. Theory and Practice of Logic Programming, 5:45–74, 2005. [Ferraris, 2005] Paolo Ferraris. A modular, polynomial method for eliminating weight constraints. 2 Unpublished draft, 2005. [Gelfond and Lifschitz, 1988] Michael Gelfond and Vladimir Lifschitz. The stable model semantics for logic programming. In Robert Kowalski and Kenneth Bowen, editors, Proceedings of International Logic Programming Conference and Symposium, pages 1070–1080, 1988. [Janhunen, 2000] Tomi Janhunen. Comparing the expressive powers of some syntactically restricted classes of logic programs. In Proc. 1st International Conference on Computational Logic, volume 1861, pages 852–866, 2000. [Lee, 2005] Joohyung Lee. A model-theoretic counterpart of loop formulas. In Proc. IJCAI, 2005. To appear. [Lifschitz and Woo, 1992] Vladimir Lifschitz and Thomas Woo. Answer sets in general nonmonotonic reasoning (preliminary report). In Bernhard Nebel, Charles Rich, and William Swartout, editors, Proc. Third Int’l Conf. on Principles of Knowledge Representation and Reasoning, pages 603–614, 1992. [Lifschitz et al., 1999] Vladimir Lifschitz, Lappoon R. Tang, and Hudson Turner. Nested expressions in logic programs. Annals of Mathematics and Artificial Intelligence, 25:369–389, 1999. [Lifschitz et al., 2001] Vladimir Lifschitz, David Pearce, and Agustin Valverde. Strongly equivalent logic programs. ACM Transactions on Computational Logic, 2:526–541, 2001. [Lin and Chen, 2005] Fangzhen Lin and Yin Chen. Discovering classes of strongly equivalent logic programs. In Proc. IJCAI, 2005. To appear. [Marek and Niemel¨ a, 2004] Victor Marek and Ilkka Niemel¨ a. On logic programs with cardinality constraints. In Proc. 7th Int’l Conference on Logic Programming and Nonmonotonic Reasoning, pages 154–166, 2004. [Marek and Truszczy´ nski, 1991] Victor Marek and Miroslaw Truszczy´ nski. Autoepistemic logic. Journal of the ACM, 38:588–619, 1991. [Pearce, 1997] David Pearce. A new logical characterization of stable models and answer sets. In J¨ urgen Dix, Luis Pereira, and Teodor Przymusinski, editors, NonMonotonic Extensions of Logic Programming (Lecture Notes in Artificial Intelligence 1216), pages 57–70. Springer-Verlag, 1997. [Pearce, 1999] David Pearce. From here to there: Stable negation in logic programming. In D. Gabbay and H. Wansing, editors, What Is Negation? Kluwer, 1999. [Simons et al., 2002] Patrik Simons, Ilkka Niemel¨ a, and Timo Soininen. Extending and implementing the stable model semantics. Artificial Intelligence, 138:181–234, 2002. [Turner, 2003] Hudson Turner. Strong equivalence made easy: nested expressions and weight constraints. Theory and Practice of Logic Programming, 3(4,5):609–622, 2003.
2
http://www.cs.utexas.edu/users/otto/papers/newweight.ps .
Guarded Open Answer Set Programming Stijn Heymans, Davy Van Nieuwenborgh, and Dirk Vermeir Dept. of Computer Science, Vrije Universiteit Brussel, VUB, Pleinlaan 2, B1050 Brussels, Belgium {sheymans,dvnieuwe,dvermeir}@vub.ac.be
Abstract. Open answer set programming (OASP) is an extension of answer set programming where one may ground a program with an arbitrary superset of the program’s constants. We define a fixed point logic (FPL) extension of Clark’s completion such that open answer sets correspond to models of FPL formulas and identify a syntactic subclass of programs, called (loosely) guarded programs. Whereas reasoning with general programs in OASP is undecidable, the FPL translation of (loosely) guarded programs falls in the decidable (loosely) guarded fixed point logic (µ(L)GF). Moreover, we reduce normal closed ASP to loosely guarded OASP, enabling a characterization of an answer set semantics by µLGF formulas. Finally, we relate guarded OASP to Datalog LITE , thus linking an answer set semantics to a semantics based on fixed point models of extended stratified Datalog programs. From this correspondence, we deduce 2-EXPTIME -completeness of satisfiability checking w.r.t. (loosely) guarded programs.
1 Introduction A problem with finite closed answer set programming (ASP)[10] is that all significant constants have to be present in the program in order to capture the intended semantics. E.g., a program with a rule r : p(X ) ← not q(X ) and a fact q(a) has the unique answer set {q(a)} and thus leads to the conclusion that p is not satisfiable. However, if r is envisaged as a schema constraint and a is just one possible data instance, this conclusion is wrong: other data makes p satisfiable. This problem was solved in [11] by introducing k new constants, k finite, and grounding the program with this extended universe; the answer sets of the grounded program were called k-belief sets. We extended this idea, e.g. in [16], by allowing for arbitrary, thus possibly infinite, universes. Open answer sets are then pairs (U, M ) with M an answer set of the program grounded with U . The above program has an open answer set ({x, a}, {q(a), p(x)}) where p is satisfiable. Characteristic about (O)ASP is its treatment of negation as failure (naf): one guesses an interpretation for a program, computes the program without naf (the GL-reduct[10]),
Supported by the FWO. This work was partially funded by the Information Society Technologies programme of the European Commission, Future and Emerging Technologies under the IST-2001-37004 WASP project.
C. Baral et al. (Eds.): LPNMR 2005, LNAI 3662, pp. 92–104, 2005. c Springer-Verlag Berlin Heidelberg 2005
Guarded Open Answer Set Programming
93
calculates the iterated fixed point of this reduct, and checks whether this fixed point equals the initial interpretation. We compile these external manipulations, i.e. not expressible in the language of programs itself, into fixed point logic (FPL)[14] formulas that are at most quadratic in the size of the original program. First, we rewrite an arbitrary program as a program containing only one designated predicate p and (in)equality; this makes sure that when calculating a fixed point of the predicate variable p, it constitutes a fixed point of the whole program. In the next phase, such a p-program P is translated to FPL formulas comp(P ). comp(P ) ensures satisfiability of program rules by formulas comparable to those in Clark’s completion. The specific answer set semantics is encoded by formulas indicating that for each atom p(x) in the model there must be a true rule body that motivates the atom, and this in a minimal way, i.e. using a fixed point predicate. Negation as failure is correctly handled by making sure that only those rules that would be present in the GL-reduct can be used to motivate atoms. In [5], Horn clauses were translated to FPL formulas and in [12] reasoning with an extension of stratified Datalog was reduced to FPL, but, to the best of our knowledge, this is the first encoding of an answer set semantics in FPL. In [21,19], ASP with (finite) propositional programs is reduced to propositional satisfiability checking. The translation makes the loops in a program explicit and ensures that atoms p(x) are motivated by bodies outside of these loops. Although this is an elegant characterization of answer sets in the propositional case, the approach does not seem to hold for OASP, where programs are not propositional but possibly ungrounded and with infinite universes. Instead, we directly use the built-in “loop detection” mechanism of FPL, which enables us to go beyond propositional programs. Translating OASP to FPL is thus interesting in its own right, but it also enables the analysis of decidability of OASP via decidability results of fragments of FPL. Satisfiability checking of a predicate p w.r.t. a program, i.e. checking whether there exists an open answer set containing some p(x), is undecidable, e.g. the undecidable domino problem can be reduced to it[15]. It is well-known that satisfiability checking in FOL is undecidable, and thus the extension to FPL is too. However, expressive decidable fragments of FPL have been identified[14]: (loosely) guarded fixed point logic (µ(L)GF) extends the (loosely) guarded fragment (L)GF of FOL with fixed point predicates. GF was identified in [2] as a fragment of FOL satisfying properties such as decidability of reasoning and the tree-model property, i.e. every model can be rewritten as a tree-model. The restriction of quantified variables by a guard, an atom containing the variables in the formula, ensures decidability in GF. Guards are responsible for the treemodel property of GF (where the concept of tree is adapted for predicates with arity larger than 2), which in turn enables tree-automata techniques for showing decidability of satisfiability checking. In [4], GF was extended to LGF where guards can be conjunctions of atoms and, roughly, every pair of variables must be together in some atom in the guard. Satisfiability checking in both GF and LGF is 2-EXPTIME-complete[13], as are their extensions with fixed point predicates µGF and µLGF[14]. We identify a syntactically restricted class of programs, (loosely) guarded programs ((L)GPs), for which the FPL translation falls in µ(L)GF, making satisfiability checking w.r.t. (L)GPs decidable and in 2-EXPTIME. In LGPs, rules have a set of atoms, the guard, in the positive body, such that every pair of variables in the rule appears together
94
S. Heymans, D. Van Nieuwenborgh, and D. Vermeir
in an atom in that guard. GPs are the restriction of LGPs where guards must consist of exactly one atom. Programs under the normal answer set semantics can be rewritten as LGPs under the open answer set semantics by guarding all variables with atoms that can only deduce constants from the original program. Besides the desirable property that OASP with LGPs is thus a proper decidable extension of normal ASP, this yields that satisfiability checking w.r.t. LGPs is, at least, NEXPTIME-hard. Datalog LITE[12] is a language based on stratified Datalog with input predicates where rules are monadic or guarded and may have generalized literals in the body, i.e. literals of the form ∀Y · a ⇒ b for atoms a and b. It has an appropriately adapted bottom-up fixed point semantics. Datalog LITE was devised to ensure linear time model checking while being expressive enough to capture computational tree logic[8] and alternation-free µ-calculus[18]. Moreover, it was shown to be equivalent to alternationfree µGF. Our reduction of GPs to µGF, ensures that we have a reduction from GPs to Datalog LITE, and thus couples the answer set semantics to a fixed point semantics based on stratified programs. Intuitively, the guess for an interpretation in the answer set semantics corresponds to the input structure one feeds to the stratified Datalog program. The translation from GPs to Datalog LITE needs only one stratum to subsequently perform the minimality check of answer set programming. The other way around, we reduce satisfiability checking in recursion-free Datalog LITE to satisfiability checking w.r.t. GPs. Recursion-free Datalog LITE is equivalent to GF[12], and, since satisfiability checking of GF formulas is 2-EXPTIME-hard[13], we obtain 2-EXPTIME-completeness for satisfiability checking w.r.t. (L)GPs. In [16,17], other decidable classes of programs under the open answer set semantics were identified; decidability was attained differently than for (L)GPs, by reducing OASP to finite ASP. Although the therein identified conceptual logic programs are more expressive in some aspects (they allow for a more liberal use of inequality), they are less expressive in others, e.g. the use of predicates is restricted to unary and binary ones. Moreover, the definition of (L)GPs is arguably more simple compared to the often intricate restrictions on the rules in conceptual logic programs. The remainder of the paper is organized as follows. After recalling the open answer set semantics in Section 2, we reduce reasoning under the open answer set semantics to reasoning with FPL formulas in Section 3. Section 4 describes guarded OASP, together with a 2-EXPTIME complexity upper bound and a reduction from finite ASP to loosely guarded OASP. Section 5 discusses the relationship with Datalog LITE and establishes 2-EXPTIME-completeness for (loosely) guarded open answer set programming. Section 6 contains conclusions and directions for further research. Due to space restrictions, proofs have been omitted; they can be found in [15].
2 Open Answer Set Semantics We recall the open answer set semantics from [16]. Constants, variables, terms, and atoms are defined as usual. A literal is an atom p(t) or a naf-atom not p(t).1 The 1
We have no negation ¬, however, programs with ¬ can be reduced to programs without it, see e.g. [20].
Guarded Open Answer Set Programming
95
positive part of a set of literals α is α+ = {p(t) | p(t) ∈ α} and the negative part of α is α− = {p(t) | not p(t) ∈ α}. We assume the existence of binary predicates = and =, where t = s is considered as an atom and t = s as not t = s. E.g. for α = {X = Y, Y = Z}, we have α+ = {Y = Z} and α− = {X = Y }. A regular atom is an atom that is not an equality atom. For a set X of atoms, not X = {not l | l ∈ X}. A program is a countable set of rules α ← β, where α and β are finite sets of literals, |α+ | ≤ 1, and ∀t, s · t = s ∈ α+ , i.e. α contains at most one positive atom, and this atom cannot be an equality atom.2 The set α is the head of the rule and represents a disjunction of literals, while β is called the body and represents a conjunction of literals. If α = ∅, the rule is called a constraint. Free rules are rules of the form q(t) ∨ not q(t) ← for a tuple t of terms; they enable a choice for the inclusion of atoms. Atoms, literals, rules, and programs that do not contain variables are ground. For a program P , let cts(P ) be the constants in P , vars(P ) its variables, and preds(P ) its predicates. A universe U for P is a non-empty countable superset of the constants in P : cts(P ) ⊆ U . We call PU the ground program obtained from P by substituting every variable in P by every possible constant in U . Let BP be the set of regular atoms that can be formed from a ground program P . An interpretation I of a ground P is any subset of BP . For a ground regular atom p(t), we write I |= p(t) if p(t) ∈ I; For an equality atom p(t) ≡ t = s, we have I |= p(t) if s and t are equal terms. We have I |= not p(t) if I |= p(t). For a set of ground literals X, I |= X if I |= l for every l ∈ X. A ground rule r : α ← β is satisfied w.r.t. I, denoted I |= r, if I |= l for some l ∈ α whenever I |= β, i.e. r is applied whenever it is applicable. A ground constraint ← β is satisfied w.r.t. I if I |= β. For a ground program P without not, an interpretation I of P is a model of P if I satisfies every rule in P ; it is an answer set of P if it is a subset minimal model of P . For ground programs P containing not, the GL-reduct[10] w.r.t. I is defined as P I , where P I contains α+ ← β + for α ← β in P , I |= not β − and I |= α− . I is an answer set of a ground P if I is an answer set of P I . In the following, a program is assumed to be a finite set of rules; infinite programs only appear as byproducts of grounding a finite program with an infinite universe. An open interpretation of a program P is a pair (U, M ) where U is a universe for P and M is an interpretation of PU . An open answer set of P is an open interpretation (U, M ) of P with M an answer set of PU . An n-ary predicate p in P is satisfiable if there is an open answer set (U, M ) of P and a x ∈ U n such that p(x) ∈ M .
3 Open Answer Set Programming via Fixed Point Logic We assume without loss of generality that the set of constants and the set of predicates in a program are disjoint and that each predicate q has one associated arity, e.g. q(x) and q(x, y) are not allowed. A program P is a p-program if p is the only predicate in P different from the (in)equality predicate. We can rewrite any program P as an equivalent p-program Pp by replacing every regular m-ary atom q(t) in P by p(t, 0, q) where p has arity n, with n the maximum of the arities of predicates in P augmented by 2
The condition |α+ | ≤ 1 ensures that the GL-reduct is non-disjunctive.
96
S. Heymans, D. Van Nieuwenborgh, and D. Vermeir
1, 0 a sequence of new constants 0 of length n − m − 1, and q a new constant with the same name as the original predicate. Furthermore, in order to avoid interference of the new constants, we add for every variable X in a rule r ∈ P and for every newly added constant a in Pp , X = a to the body. E.g., the rule h(a, b) ← q(X ) in P corresponds to p(a, b, h) ← p(X , 0 , q), X = 0, X = h, X = q in Pp . Proposition 1. An open interpretation (U, M ) is an open answer set of P iff (U ∪ preds(P ) ∪ {0}, {p(x, 0, q) | q(x) ∈ M }) is an open answer set of the p-program Pp . The translation of a program to a p-program does not influence the complexity of reasoning, i.e. the size of Pp is linear in the size of P . By Proposition 1, we can focus attention on p-programs only. Since p-programs have open answer sets consisting of one predicate p, fixed points calculated w.r.t. p yield minimal models of the whole program as we will show in Proposition 2. In [5], a similar motivation drives the reduction of Horn clauses to clauses consisting of only one defined predicate. Their encoding does not introduce new constants to identify old predicates and depends entirely on the use of (in)equality. However, to account for databases consisting of only one element, [5] needs an additional transformation that unfolds bodies of clauses. We assume that FOL interpretations have the same form as open interpretations: a pair (U, M ) corresponds with the FOL interpretation M over the domain U . Furthermore, we consider FOL with equality such that equality is always interpreted as the identity relation over U . (Least) Fixed Point Logic (FPL) is defined along the lines of [14]. Fixed point formulas are of the form [LFP W X.ψ(W, X)](X) ,
(1)
where W is an n-ary predicate variable, X is an n-ary sequence of variables, ψ(W, X) is a FOL formula where all free variables are contained in X and where W appears only positively in ψ(W, X).3 We associate with (1) and an interpretation (U, M ) that does not interpret W , an n n operator ψ (U,M) : 2U → 2U defined on sets S of n-ary tuples as ψ (U,M) (S) ≡ {x ∈ U n | (U, M ) |= ψ(S, x)}. By definition, W appears only positively in ψ such that ψ (U,M) is monotonic on sets of n-ary U -tuples and has a least fixed point, which we denote by LFP(ψ (U,M) ). Finally, we have (U, M ) |= [LFP W X.ψ(W, X)](x) iff x ∈ LFP(ψ (U,M) ). We can reduce a p-program P to equivalent FPL formulas comp(P ). The completion comp(P ) consists of formulas a = b for different constants a and b in P making sure that constants are interpreted as different elements, where a = b ≡ ¬(a = b). comp(P ) also contains the formula ∃X · true ensuring the existence of at least one element in the domain of an interpretation. Besides these technical requirements that match FOL interpretations with open interpretations, comp(P ) contains the formulas in fix(P ) ≡ sat(P ) ∪ gl(P ) ∪ fpf(P ), which can be intuitively categorized as follows: sat(P ) 3
Since ψ(W, X ) is a FOL formula, we do not allow nesting of fixed point formulas. This restriction is sufficient for the FPL simulation of OASP, and, furthermore, it simplifies the notation since one does not have to take into account an extra function χ that gives meaning to free second-order variables different from W .
Guarded Open Answer Set Programming
97
ensures that a model of fix(P ) satisfies all rules in P , gl(P ) is an auxiliary component defining atoms that indicate when a rule in P belongs to the GL-reduct of P , and finally, fpf(P ) ensures that every model of fix(P ) is a minimal model of the GL-reduct in P ; it uses the atoms defined in gl(P ) to select, for the calculation of the fixed point, only those rules in P that are in the GL-reduct of P . We interpret a naf-atom nota in a FOL formula as the literal ¬a. Moreover, we assume that, if a set X is empty, X = true and X = false. We further assume that the arity of p, the only predicate in a p-program, is n. Definition 1. Let P be a p-program. Then, fix(P ) ≡ sat(P ) ∪ gl(P ) ∪ fpf(P ), where – sat(P ) contains formulas ∀Y ·
β⇒
α
(2)
for rules α ← β ∈ P with variables Y , – gl(P ) contains formulas ∀Y · r (Y ) ⇔
α− ∧
¬β −
(3)
for rules r : α ← β ∈ P with variables Y and a new predicate r, – fpf(P ) contains the formula ∀X · p(X) ⇒ [LFP W X.φ(W , X)](X) (4) with φ(W, X) ≡ W (X) ∨ r:p(t)∨α←β∈P E(r) and E(r) ≡ ∃Y · X1 = t1 ∧ . . . ∧ Xn = tn ∧ β + [p|W ] ∧ r(Y ), where X = X1 , . . . , Xn are n new variables, Y are the variables in r, W is a new (second-order) variable and β + [p|W ] is β + with p replaced by W . The completion of P is comp(P ) ≡ fix(P ) ∪ {a =b|a = b ∈ cts(P )} ∪ {∃X · true}. The predicate W appears only positively in φ(W, X) such that the fixed point formula in (4) is well-defined. The first conjunct, W (X), in φ(W, X) ensures that previously deduced tuples are deduced by thenext application of the fixed point operator, i.e. S ⊆ φ(U,M) (S). The disjunction r E(r) makes sure that for each atom there is a rule r in the GL-reduct (∃Y · r(Y )) with a true positive body that can motivate that atom. Example 1. Take a p-program P with rule r : p(X ) ← p(X ). comp(P ) is then such that sat(P ) = {∀X · p(X ) ⇒ p(X )}, ensuring that r is satisfied, and gl(P ) = {∀X · r (X ) ⇔ true} says that r belongs to every GL-reduct since there are no naf-atoms. Finally, fpf(P ) = {∀X1 · p(X1 ) ⇒ [LFP W X1 .φ(W , X1 )](X1 )}, with φ(W, X1 ) ≡ W (X1 ) ∨ ∃X · X1 = X ∧ W (X) ∧ r(X). Proposition 2. Let P be a p-program. Then, (U, M ) is an open answer set of P iff (U, M ∪ R) is a model of comp(P ), where R ≡ {r(y) | r[Y |y] ∈ PUM , vars(r) = Y }, i.e. the atoms corresponding to rules in the GL-reduct of PU w.r.t. M .4 4
We denote the substitution of Y = Y1 , . . . , Yd with y = y1 , . . . , yd in a rule r by r[Y |y].
98
S. Heymans, D. Van Nieuwenborgh, and D. Vermeir
Example 2. For a universe U = {x}, we have the unique open answer set (U, ∅) of P in Example 1. Since U is non-empty, every open answer set with a universe U satisfies ∃X · true. Both (U, M1 = {p(x), r(x)}) and (U, M2 = {r(x)}) satisfy sat(P ) ∪ gl(P ). Since LFP(φ(U,M1 ) ) = LFP(φ(U,M2 ) ) = ∅, only (U, M2 ) satisfies fpf(P ); (U, M2 ) corresponds exactly to the open answer set (U, ∅) of P . The completion in Definition 1 differs from Clark’s completion[6] both in the presence of the fixed point construct in (4) and the atoms representing membership of the GLreduct. For p-programs P , Clark’s Completion ccomp(P ) does not contain gl(P ), and fpf(P ) is replaced by the formula ∀X · p(X) ⇒ r :p(t)∨α←β∈P D (r ) with D(r) ≡ ∃Y · X1 = t1 ∧ . . . ∧ Xn = tn ∧ β ∧ α− . Program P in Example 1 is the OASP version of the classical example p ← p[19], for which there are FOL models of ccomp(P ) that do not correspond to any answer sets: both ({x}, {p(x)}) and ({x}, ∅) are FOL models while only the latter is an open answer set of P . Using Propositions 1 and 2, we can reduce satisfiability checking in OASP to satisfiability checking in FPL. Moreover, with c the number of constants in a program P , the number of formulas a = b is 12 c(c − 1), and, since the rest of comp(P ) is linear in P , this yields a quadratic bound for the size of comp(P ). Theorem 1. Let P be a program and q an n-ary predicate in P . q is satisfiable w.r.t. P iff p(X, 0, q) ∧ comp(Pp ) is satisfiable. Moreover, this reduction is quadratic.
4 Guarded Open Answer Set Programming We repeat the definitions of the loosely guarded fragment[4] of FOL as in [14]: The loosely guarded fragment LGF of FOL is defined inductively as follows: (1) Every relational atomic formula belongs to LGF. (2) LGF is closed under propositional connectives ¬, ∧, ∨, ⇒, and ⇔. (3) If ψ(X, Y ) is in LGF, and α(X, Y ) = α1 ∧ . . . ∧ αm is a conjunction of atoms, then the formulas ∃Y · α(X, Y ) ∧ ψ(X, Y ) ∀Y · α(X, Y ) ⇒ ψ(X, Y ) belong to LGF (and α(X, Y ) is the guard of the formula), provided that free(ψ) ⊆ free(α) = X ∪ Y and for every quantified variable Y ∈ Y and every variable Z ∈ X ∪ Y there is at least one atom αj that contains both Y and Z (where free(ψ) are the free variables of ψ). The loosely guarded (least) fixed point logic µLGF is LGF extended with fixed point formulas (1) where ψ(W, X) is a LGF formula5 such that W does not appear in guards. The guarded fragment GF is defined as LGF where the guards are atoms instead of conjunctions of atoms. The guarded fixed point logic µGF is GF extended with fixed point formulas where ψ(W, X) is a GF formula such that W does not appear in guards. 5
Thus, in accordance with our definition of FPL, nesting of (guarded) fixed point logic formulas is not allowed.
Guarded Open Answer Set Programming
99
Definition 2. A rule r : α ← β is loosely guarded if there is a γb ⊆ β + such that every two variables X and Y from r appear together in an atom from γb ; we call γb a body guard of r. It is fully loosely guarded if it is loosely guarded and there is a γh ⊆ α− such that every two variables X and Y from r appear together in an atom from γh ; γh is called a head guard of r. A program P is a (fully) loosely guarded program ((F)LGP) if every non-free rule in P is (fully) loosely guarded. Example 3. The rule in Example 1 is loosely guarded but not fully loosely guarded. A rule a(Y ) ∨ not g(X , Y ) ← not b(X ), f (X , Y ) has body guard {f (X, Y )} and head guard {g(X, Y )}, and is thus fully loosely guarded. Definition 3. A rule is guarded if it is loosely guarded with a singleton body guard. It is fully guarded if it is fully loosely guarded with singleton body and head guards. A program P is a (fully) guarded program ((F)GP) if every non-free rule in P is (fully) guarded. Every F(L)GP is a (L)GP, and we can rewrite every (L)GP as a F(L)GP. Example 4. The rule p(X ) ← p(X ) can be rewritten as p(X ) ∨ not p(X ) ← p(X ) where the body guard is added to the negative part of the head to function as the head guard. Both programs are equivalent: for a universe U , both have the unique open answer set (U, ∅). Formally, we can rewrite every (L)GP P as an equivalent F(L)GP P f , where P f is P with every α ← β replaced by α ∪ not β + ← β. The body guard of a rule in a (loosely) guarded program P is then also a head guard of the corresponding rule in P f , and P f is indeed a fully (loosely) guarded program. A rule is vacuously satisfied if the body of a rule in P f is false and consequently the head does not matter; if the body is true then the newly added part in the head becomes false and the rule in P f reduces to its corresponding rule in P . Proposition 3. Let P be a program. An open interpretation (U, M ) of P is an open answer set of P iff (U, M ) is an open answer set of P f . Since we copy the positive bodies to the heads, the size of P f only increases linearly in the size of P . Furthermore, the construction of a p-program retains the guardedness properties: P is a (F)LGP iff Pp is a (F)LGP. A similar property holds for (F)GPs. For a fully (loosely) guarded p-program P , we can rewrite comp(P ) as the equivalent µ(L)GF formulas gcomp(P ). gcomp(P ) is comp(P ) with the following modifications: – Formula ∃X · true is replaced by ∃X · X = X, a formula guarded by X = X. – Formula (2) is removed if r : α ← β is free and otherwise replaced by ∀Y · γb ⇒ α∨ ¬(β + \γb ) ∨ β− , where γb is a body guard of r; we logically rewrite formula (2) such that it is (loosely) guarded. If r is a free rule of the form q(t) ∨ not q(t) ← , we have ∀Y · true ⇒ q(t) ∨ ¬q(t) ∈ comp(P ), which is always true and can be removed.
100
S. Heymans, D. Van Nieuwenborgh, and D. Vermeir
– Formula (3) is replaced ∀Y · r (Y ) ⇒ α− ∧ ¬β − and ∀Y · − bythe formulas γh ⇒ r (Y ) ∨ β ∨ ¬(α− \γh ), where γh is a head guard of r. We thus rewrite an equivalence as two implications. The first implication is guarded by r(Y ) and the second one is (loosely) guarded by the head guard of the rule – hence the need for a fully (loosely) guarded program, instead of just a (loosely) guarded one. – For every E(r) in (4), define T ≡ {ti ∈ cts(P ) | 1 ≤ i ≤ n}, and replace E(r) by E (r) ≡ Xi = ti ∧ ∃Z · ( β + [p|W ] ∧ r(Y ))[ti ∈ T |Xi ] , ti ∈T
with Z = Y \T , i.e. move all Xi = ti where ti is constant out of the quantifier’s scope, and remove the others by substituting each ti in β + [p|W ] ∧ r(Y ) by Xi . This rewriting makes sure that every variable in the quantified part of E (R) is guarded by r(Y )[ti ∈ T |Xi ]. Example 5. For the fully guarded p-program P containing a rule p(X ) ∨ not p(X ) ← p(X ) with body and head guard {p(X)}, one has that sat(P ) = {∀X · p(X ) ⇒ p(X ) ∨ ¬p(X )}, gl(P ) = {∀X · r (X ) ⇔ p(X )} and the formula φ(W, X1 ) in fpf(P ) is φ(W, X1 ) ≡ W (X1 ) ∨ ∃X · X1 = X ∧ W (X) ∧ r(X). gcomp(P ) does not modify sat(P ) and rewrites the equivalence in gl(P ) as two guarded implications. The rewritten φ(W, X1 ) is W (X1 ) ∨ (W (X1 ) ∧ r(X1 )). For a fully (loosely) guarded p-program P , gcomp(P ) is a µ(L)GF formula, and it is logically equivalent to comp(P ), i.e. (U, M ) is a model of comp(P ) iff (U, M ) is a model of gcomp(P ). gcomp(P ) is a simple logical rewriting of comp(P ), with a size linear in the size of comp(P ). Using Proposition 3 and Theorem 1, satisfiability checking w.r.t. (L)GPs can be quadratically reduced to satisfiability checking of a µ(L)GF formula. Theorem 2. Let P be a (L)GP and q an n-ary predicate in P . q is satisfiable w.r.t. P iff p(X, 0, q) ∧ gcomp((P f )p ) is satisfiable. Moreover, this reduction is quadratic. Since satisfiability checking for µ(L)GF is 2-EXPTIME-complete (Proposition [1.1] in [14]), we have the following upper complexity bound. Theorem 3. Satisfiability checking w.r.t. (L)GPs is in 2-EXPTIME. An answer set of a program P (in contrast with an open answer set) is defined as an answer set of the grounding of P with its own constants, i.e. M is an answer set of P if M it is a minimal model of Pcts(P ) . As is common in literature, we assume P contains at least one constant. We can make any program loosely guarded and reduce the answer set semantics for programs to the open answer set semantics for loosely guarded programs. For a program P , let P g be the program P , where for each rule r in P and for each pair of variables X and Y in r, g(X, Y ) is added to the body of r. Furthermore, P g contains rules g(a, b) ← for every a, b ∈ cts(P ), making its size quadratic in the size of P . Note that we assume w.l.o.g. that P does not contain a predicate g.
Guarded Open Answer Set Programming
101
The newly added guards in the bodies of rules together with the definition of those guards for constants only ensure a correspondence between answer sets and open answer sets where the universe of the latter equals the constants in the program. Proposition 4. Let P be a program. M is an answer set of P iff (cts(P ), M ∪{g(a, b) | a, b ∈ cts(P )}) is an open answer set of P g . Moreover, this reduction is quadratic. By construction, P g is loosely guarded. We can reduce checking whether there exists an answer set containing a literal to satisfiability checking w.r.t. the open answer set semantics for loosely guarded programs. Proposition 5. Let P be a program and q an n-ary predicate in P . There is an answer set M of P with q(a) ∈ M iff q is satisfiable w.r.t. P g . Moreover, this reduction is quadratic. The “only if” direction is trivial; the other direction uses that for every open answer set (U, M ) of a loosely guarded program P g , M contains only terms from cts(P ), and can be rewritten as an open answer set (cts(P ), M ∪ {g(a, b) | a, b ∈ cts(P )}), after which Proposition 4 becomes applicable. By [7,3] and the disjunction-freeness of the GL-reduct of the programs we consider, we have that checking whether there exists an answer set M of P containing a q(a) is NEXPTIME-complete. Thus, by Proposition 5, satisfiability checking w.r.t. a LGP is NEXPTIME-hard. In the next section, we improve on this result and show that both satisfiability checking w.r.t. GPs and w.r.t. LGPs is actually 2-EXPTIME-hard.
5 Relationship with Datalog LITE We define Datalog LITE as in [12]. A Datalog rule is a rule α ← β where α = {a} for some atom a. A basic Datalog program is a finite set of Datalog rules such that no head predicate appears in negative bodies of rules. Predicates that appear only in the body of rules are extensional or input predicates. Note that equality is, by the definition of rules, never a head predicate and thus always extensional. The semantics of a basic Datalog program P , given a relational input structure U defined over extensional predicates of P 6 , is given by its fixed point model, see e.g. [1]; for a query (P, q), where P is a basic Datalog program and q is a n-ary predicate, we write a ∈ (P, q)(U) if there is a fixed point model M of P with input U such that q(a) ∈ M . We call (P, q) satisfiable if there exists a U and an a such that a ∈ (P, q)(U). A program P is a stratified Datalog program if it can be written as a union of basic Datalog programs (P0 , . . . , Pn ), so-called strata, such that each of the head predicates in P is a head predicate in exactly one stratum Pi . Furthermore, if a head predicate in Pi is an extensional predicate in Pj , then i < j. This definition entails that head predicates in the positive body of rules are head predicates in the same or a lower stratum, and head predicates in the negative body are head predicates in a lower stratum. The semantics 6
We assume that, if U defines equality, it does so as the identity relation on, at least, the terms in the regular atoms of U and on the constants in P . Moreover, U may define equality even if no (in)equality is present in P ; one can thus introduce arbitrary universes.
102
S. Heymans, D. Van Nieuwenborgh, and D. Vermeir
of stratified Datalog programs is defined stratum per stratum, starting from the lowest stratum and defining the extensional predicates on the way up. A generalized literal is of the form ∀Y1 , . . . , Yn · a ⇒ b where a and b are atoms and vars(b) ⊆ vars(a). A Datalog LITE program is a stratified Datalog program, possibly containing generalized literals in the positive body, where each rule is monadic or guarded. A rule is monadic if each of its (generalized) literals contains only one (free) variable; it is guarded if there exists an atom in the positive body that contains all variables (free variables in the case of generalized literals) of the rule. The definition of stratified is adapted for generalized literals: for a ∀Y1 , . . . , Yn · a ⇒ b in the body of a rule where the underlying predicate of a is a head predicate, this head predicate must be a head predicate in a lower stratum (i.e. a is treated as a naf-atom) and a head predicate underlying b must be in the same or a lower stratum (i.e. b is treated as an atom). The semantics can be adapted accordingly since a is completely defined in a lower stratum. In [12], Theorem 8.5., a Datalog LITE query (πϕ , qϕ ) was defined for an alternationfree7 µGF sentence8 ϕ such that (U, M ) |= ϕ iff (πϕ , qϕ )(M ∪id (U )) evaluates to true, where the latter means that qϕ is in the fixed point model of πϕ with input M ∪ id (U ), and where id (U ) ≡ {x = x | x ∈ U }. For the formal details of this reduction, we refer to [12]. Satisfiability checking with GPs can be polynomially reduced to satisfiability checking in Datalog LITE. Indeed, by Theorem 2, q is satisfiable w.r.t. a GP P iff p(X, 0, q)∧ gcomp((P f )p ) is satisfiable, and the latter is satisfiable iff ϕ ≡ ∃X · p(X, 0, q) ∧ gcomp((P f )p ) is. Since ϕ is a µGF sentence, we have that ϕ is satisfiable iff (πϕ , qϕ ) is satisfiable. By Theorem 2, the translation of P to ϕ is quadratic in the size of P and the query (πϕ , qϕ ) is quadratic in ϕ[12], resulting in a polynomial reduction. Theorem 4. Let P be a GP, q an n-ary predicate in P and ϕ the µGF sentence ∃X · p(X, 0, q) ∧ gcomp((P f )p ). q is satisfiable w.r.t. P iff (πϕ , qϕ ) is satisfiable. Moreover, this reduction is polynomial. Satisfiability checking in stratified Datalog under the fixed point model semantics can be linearly reduced to satisfiability checking w.r.t. programs under the open answer set semantics. For a stratified Datalog program P , let P o be the program P with free rules f (X) ∨ not f (X) ← added for all predicates f that are extensional in the entire program P (with the exception of equality predicates). The free rules in P o mimic the role of extensional predicates from the original P : they allow for an initial free choice of the relational input structure. Proposition 6. Let P be a stratified Datalog query (P, q). (P, q) is satisfiable iff q is satisfiable w.r.t. P o . Moreover, this reduction is linear. Recursion-free stratified Datalog is stratified Datalog where the head predicates in the positive bodies of rules must be head predicates in a lower stratum. We call recursionfree Datalog LITE where all rules are guarded, i.e. without monadic rules that are not guarded, Datalog LITER, where the definition of recursion-free is appropriately extended to take into account the generalized literals. 7
8
Since we did not allow nested least fixed point formulas in our definition of µ(L)GF, it is trivially alternation-free. A sentence is a formula without free variables.
Guarded Open Answer Set Programming
103
For a Datalog LITER program P , let ¬¬P be the program P where all generalized literals are replaced by a double negation. E.g. q(X ) ← f (X ), ∀Y · r (X , Y ) ⇒ s(Y ) is rewritten as the rules q(X ) ← f (X ), not q (X ) and q (X ) ← r (X , Y ), not s(Y ). As indicated in [12], ¬¬P is equivalent to P and the recursion-freeness ensures that o ¬¬P is stratified. Clearly, (¬¬P ) is a GP. For a Datalog LITER query (P, q), (¬¬P, q) is an equivalent stratified Datalog o query. Hence, by Proposition 6, (¬¬P, q) is satisfiable iff q is satisfiable w.r.t. (¬¬P ) . o This reduction is linear since ¬¬P is linear in the size of P and so is (¬¬P ) . Thus satisfiability checking of Datalog LITER queries can be linearly reduced to satisfiability checking w.r.t. GPs. Theorem 5. Let (P, q) be a Datalog LITER query. (P, q) is satisfiable iff q is satisfiable o w.r.t. (¬¬P ) . Moreover, this reduction is linear. The reduction from µGF sentences ϕ to Datalog LITE queries (πϕ , qϕ ) specializes, as noted in [12], to a reduction from GF sentences to recursion-free Datalog LITE queries. Moreover, the reduction contains only guarded rules such that GF sentences ϕ are actually translated to Datalog LITER queries (πϕ , qϕ ). Satisfiability checking in the guarded fragment GF is 2-EXPTIME-complete[13], such that, using Theorem 5 and the intermediate Datalog LITER translation, we have that satisfiability checking w.r.t. GPs is 2-EXPTIME-hard. Completeness readily follows from the 2-EXPTIME membership in Theorem 3. Every GP is a LGP and satisfiability checking w.r.t. to the former is 2-EXPTIMEcomplete, thus satisfiability checking w.r.t. LGPs is 2-EXPTIME-hard. Completeness follows again from Theorem 3. Theorem 6. Satisfiability checking w.r.t. (L)GPs is 2-EXPTIME-complete.
6 Conclusions and Directions for Further Research We embedded OASP in FPL and used this embedding to identify (loosely) guarded OASP, a decidable fragment of OASP. Finite ASP was reduced to loosely guarded OASP and the relationship with Datalog LITE was made explicit. Finally, satisfiability checking w.r.t. (loosely) guarded OASP was shown to be 2-EXPTIME-complete. We plan to further exploit the correspondence between (loosely) guarded OASP and µ(L)GF by seeking to apply implementation techniques used for µ(L)GF satisfiability checking directly to (loosely) guarded OASP. Possibly, we can take advantage of the fact that the embedding does not seem to need the full power of µ(L)GF – there are, e.g. , no nested fixed point formulas in the FPL translation of OASP. It is interesting to search for fragments of guarded OASP that can be implemented using existing answer set solvers such as DLV[9] or SMODELS[23]. Another promising direction is to study generalized literals in the context of the answer set semantics: what is an appropriate semantics in the absence of stratification, can this still be embedded in FPL? Finally, ω-restricted programs[22] are programs where function symbols are allowed but reasoning is kept decidable by “guarding” variables in a rule with a predicate that is in a lower stratification than the predicate of the head of that rule. Since reasoning
104
S. Heymans, D. Van Nieuwenborgh, and D. Vermeir
with ω-restricted programs is 2-NEXPTIME-complete, it should be possible to simulate guarded open answer set programming in this framework.
References 1. S. Abiteboul, R. Hull, and V. Vianu. Foundations of Databases. Addison-Wesley, 1995. 2. H. Andr´eka, I. N´emeti, and J. Van Benthem. Modal Languages and Bounded Fragments of Predicate Logic. J. of Philosophical Logic, 27(3):217–274, 1998. 3. C. Baral. Knowledge Representation, Reasoning and Declarative Problem Solving. Cambridge Press, 2003. 4. J. Van Benthem. Dynamic Bits and Pieces. In ILLC research report. University of Amsterdam, 1997. 5. A. K. Chandra and D. Harel. Horn Clauses and the Fixpoint Query Hierarchy. In Proc. of PODS ’82, pages 158–163. ACM Press, 1982. 6. K. L. Clark. Negation as Failure. In Readings in Nonmonotonic Reasoning, pages 311–325. Kaufmann, 1987. 7. E. Dantsin, T. Eiter, G. Gottlob, and A. Voronkov. Complexity and Expressive Power of Logic Programming. ACM Comput. Surv., 33(3):374–425, 2001. 8. E. A. Emerson and E. M. Clarke. Using Branching Time Temporal Logic to Synthesize Synchronization Skeletons. Sciene of Computer Programming, 2(3):241–266, 1982. 9. W. Faber, N. Leone, and G. Pfeifer. Pushing Goal Derivation in DLP Computations. In Proc. of LPNMR, volume 1730 of LNCS, pages 177–191. Springer, 1999. 10. M. Gelfond and V. Lifschitz. The Stable Model Semantics for Logic Programming. In Proc. of ICLP’88, pages 1070–1080, Cambridge, Massachusetts, 1988. MIT Press. 11. M. Gelfond and H. Przymusinska. Reasoning in Open Domains. In Logic Programming and Non-Monotonic Reasoning, pages 397–413. MIT Press, 1993. 12. G. Gottlob, E. Gr¨adel, and H. Veith. Datalog LITE: A deductive query language with linear time model checking. ACM Transactions on Computational Logic, 3(1):1–35, 2002. 13. E. Gr¨adel. On the Restraining Power of Guards. Journal of Symbolic Logic, 64(4):1719– 1742, 1999. 14. E. Gr¨adel and I. Walukiewicz. Guarded Fixed Point Logic. In Proc. of LICS ’99, pages 45–54. IEEE Computer Society, 1999. 15. S. Heymans, D. Van Nieuwenborgh, and D. Vermeir. Guarded Open Answer Set Programming. Technical report. http://tinf2.vub.ac.be/˜sheymans/ tech/guarded-oasp.ps.gz. 16. S. Heymans, D. Van Nieuwenborgh, and D. Vermeir. Semantic Web Reasoning with Conceptual Logic Programs. In Proc. of RuleML 2004, pages 113–127. Springer, 2004. 17. S. Heymans, D. Van Nieuwenborgh, and D. Vermeir. Nonmonotonic Ontological and RuleBased Reasoning with Extended Conceptual Logic Programs. In Proc. of ESWC 2005, number 3532 in LNCS, pages 392–407. Springer, 2005. 18. D. Kozen. Results on the Propositional µ-calculus. Theor. Comput. Sci., 27:333–354, 1983. 19. J. Lee and V. Lifschitz. Loop Formulas for Disjunctive Logic Programs. In Proc. of ICLP 2003, volume 2916 of LNCS, pages 451–465. Springer, 2003. 20. V. Lifschitz, D. Pearce, and A. Valverde. Strongly Equivalent Logic Programs. ACM Transactions on Computational Logic, 2(4):526–541, 2001. 21. F. Lin and Y. Zhao. ASSAT: Computing Answer Sets of a Logic Program by SAT Solvers. In Proc. of 18th National Conference on Artificial Intelligence, pages 112–117. AAAI, 2002. 22. T. Syrj¨anen. Omega-restricted Logic Programs. In Proc. of LPNMR, volume 2173 of LNAI, pages 267–279. Springer, 2001. 23. T. Syrj¨anen and I. Niemel¨a. The SMODELS System. In Proc. of LPNMR, volume 2173 of LNCS, pages 434–438. Springer, 2001.
External Sources of Computation for Answer Set Solvers Francesco Calimeri and Giovambattista Ianni Dipartimento di Matematica, Universit` a della Calabria, I-87036 Rende (CS), Italy {calimeri, ianni}@mat.unical.it Abstract. The paper introduces Answer Set Programming with External Predicates (ASP-EX), a framework aimed at enabling ASP to deal with external sources of computation. This feature is realized by the introduction of “parametric” external predicates, whose extension is not specified by means of a logic program but computed through external code. With respect to existing approaches it is explicitly addressed the issue of invention of new information coming from external predicates, in form of new, and possibly infinite, constant symbols. Several decidable restrictions of the language are identified as well as suitable algorithms for evaluating Answer Set Programs with external predicates. The framework paves the way to Answer Set Programming in several directions such as pattern manipulation applications, as well as the possibility to exploit function symbols. ASP-EX has been successfully implemented in the DLV system, which is now enabled to make external program calls.
1
Introduction
Among nonmonotonic semantics, Answer Set Programming (ASP) is nowadays taking a preeminent role, witnessed by the availability of efficient answer-set solvers, like ASSAT [Lin and Zhao, 2002], Cmodels [Babovich and Maratea, 2003], DLV [Leone et al., 2005b], and Smodels [Simons et al., 2002], and various extensions of the basic language with features such as classical negation, weak constraints, aggregates, cardinality and weight constraints. ASP has become an important knowledge representation formalism for declaratively solving AI problems in areas including planning [Eiter et al., 2003], diagnosis and information integration [Leone et al., 2005a], and more. Despite these good results, state-of-the-art ASP systems hardly deal with data types such as strings, natural and real numbers. Although simple, this data types bring two kinds of technical problems: first, they range over infinite domains; second, they need to be manipulated with primitive constructs which can be encoded in logic programming at the cost of compromising efficiency and declarativity.Furthermore, interoperability with other software is nowadays
Work supported by the EC under projects INFOMIX (IST-2001-3357) and WASP (IST-2001-37004), and by FWF under project “Answer Set Programming for the Semantic Web” (P17212-N04)
C. Baral et al. (Eds.): LPNMR 2005, LNAI 3662, pp. 105–118, 2005. c Springer-Verlag Berlin Heidelberg 2005
106
F. Calimeri and G. Ianni
important, especially in the context of those Semantic Web applications aimed at managing external knowledge. The contributions of the paper are the following: – we introduce a formal framework, named ASP-EX, for accommodating external predicates in the context of Answer Set Programming; – ASP-EX includes the explicit possibility of invention of new values from external sources: since this setting could lead to non-termination of any conceivable evaluation algorithm, we tailor specific cases where decidability is preserved. – we show that ASP-EX enhances the applicability of Answer Set Programming to a variety of problems such as string and algebraic manipulation. Also the framework paves the way for simulating function symbols in a setting where the notion of term is kept simple (Skolem terms are not necessary). – we discuss implementation issues, and show how we have integrated ASP-EX in the DLV system, which is, this way, enabled with the possibility of using external sources of computation. – we carry out some experiments, confirming that the accommodation of external predicates does not cause any relevant computational overhead.
2
Motivating Example
The introduction of external sources of computation in tight synergy with Answer Set Solvers opens a variety of possible applications. We show next an example of these successful experiences. The discovery of complex pattern repetitions in string databases plays an important role in genomic studies, and in general in the areas of knowledge discovery. Genome databases mainly consist of sets of strings representing DNA or protein sequences (biosequences) and most of these strings still require to be interpreted. In this context, discovering common patterns in sets of biologically related sequences is very important. It turns out that specifying pattern search strategies by means of Answer Set Programming and its extensions is an appealing idea: constructs like strong and weak constraints, disjunction, aggregates may help an algorithm designer to fast prototype search algorithms for a variety of pattern classes. Unfortunately, state-of-the-art Answer Set Solvers lack the possibility to deal in a satisfactory way with infinite domains such as strings or natural numbers. Furthermore, although very simple, such data types need of ad hoc manipulation constructs, which are typically difficult to be encoded and cannot be efficiently evaluated in logic programming. So, in order to cope with these needs, one may conceive to properly extend answer set programming with the possibility of introducing external predicates. The extension of an external predicate can be efficiently computed by means of an intensional definition expressed using a traditional imperative language. Thus, we might allow a pattern search algorithm designer to take advantage of Answer Set Programming facilities, but extended with special atoms such as
External Sources of Computation for Answer Set Solvers
107
e.g. #inverse(S1,S2) (true if S1 is the inverse string of S2), #strcat(S1,S2,S3) (true if S3 is equal to the concatenation of S1 and S2), or #hammingDistance(S1,S2,N) (true if S1 has N differences with respect to S2). Note that it is desirable that these predicates introduce new values in the domain of a program whenever necessary. For instance, the semantics of #strcat(a,b,X) should be such that X matches with the new symbol ab. Provided with a suitable mechanism for defining external predicates, the authors of [Palopoli et al., 2005] have been able to define and implement a framework allowing to specify and resolve genomic pattern search problems; the framework is based on automatically generating logic programs starting from userdefined extraction problems, and exploits disjunctive logic programming properly extended in order to enable the possibility of dealing with a large variety of pattern problems. The external built-in framework implemented into the DLV system is essential in order to deal with strings and patterns. We provide next syntax and semantics of the proposed framework.
3
Syntax and Semantics
Let U, X , E and P be mutually disjoint sets whose elements are called constant names, variable names, external predicate names, and ordinary predicate names, respectively. Unless explicitly specified, elements from X (resp., U) are denoted with first letter in upper case (resp., lower case); elements from E are usually prefixed with “ # ”. U will constitute the default Herbrand Universe. We will assume that any constant appearing in a program or generated by external computation is taken from U, which is possibly infinite1 . Elements from U ∪ X are called terms. An atom is a structure p(t1 , . . . , tn ), where t1 , . . . , tn are terms and p ∈ P ∪ E; n ≥ 0 is the arity of the atom. Intuitively, p is the predicate name. The atom is ordinary, if p ∈ P, otherwise we call it external atom. A list of terms t1 , . . . , tn is succinctly represented by t. A positive literal is an atom, whereas a negative literal is not a where a is an atom. For example, node(X), and #succ(a,Y) are atoms; the first is ordinary, whereas the second is an external atom. A rule r is of the form α1 ∨ · · · ∨ αk ← β1 , . . . , βn , not βn+1 , . . . , not βm ,
(1)
where m ≥ 0, k ≥ 1, α1 , . . . , αk , are ordinary atoms, and β1 , . . . , βm are (ordinary or external) atoms. We define H(r) = {α1 , . . . , αk } and B(r) = B + (r) ∪B − (r), where B + (r) = {β1 , . . . , βn } and B − (r) = {βn+1 , . . . , βm }. E(r) is the set of external atoms of r. If H(r) = ∅ and B(r) = ∅, then r is a constraint, and if B(r) = ∅ and H(r) = ∅, then r is a fact; r is ordinary, if it contains only ordinary atoms. A ASP-EX program is a finite set P of rules; it is ordinary, if all rules are 1
Also, we assume that constants are encoded using some finite alphabet Σ, i.e. they are finite elements of Σ ∗ .
108
F. Calimeri and G. Ianni
ordinary. Without loss of generality, we will assume P has no constraints2 and only ground facts. The dependency graph G(P ) of P is built in the standard way by inserting a node np for each predicate name p appearing in P and a directed edge (p1 , p2 ), labelled r, for each rule r such that p2 ∈ B(r) and p1 ∈ H(r). The following is a short ASP-EX program: mustChangePasswd(Usr) ← passwd(Usr,Pass), #strlen(Pass,Len), # < (Len,8).
(2)
We define the semantics of ASP-EX by generalizing the answer-set semantics, proposed by Gelfond and Lifschitz [1991] as an extension of the stable model semantics of normal logic programs [Gelfond and Lifschitz, 1988]. In the sequel, we will assume P is a ASP-EX program. The Herbrand base of P with respect to U, denoted HB U (P ), is the set of all possible ground versions of ordinary atoms and external atoms occurring in P obtained by replacing variables with constants from U. The grounding of a rule r, grnd U (r), is defined accordingly, and the grounding of program P by grnd U (P ) = r∈P grnd U (r). An interpretation I for P is a couple S, F where: – S ⊆ HB U (P ) contains only ordinary atoms; We say that I (or by small abuse of notation, S) is a model of ordinary atom a ∈ HB U (P ), denoted I |= a (S |= a), if a ∈ S. – F is a mapping associating with every external predicate name #e ∈ E, a decidable n-ary Boolean function (which we will call oracle) F (#e) assigning each tuple (x1 , . . . , xn ) either 0 or 1, where n is the fixed arity of #e, and xi ∈ U. I (or by small abuse of notation, F ) is a model of a ground external atom a = #e(x1 , . . . , xn ), denoted I |= a (F |= a), if F (#e)(x1 , . . . , xn ) = 1. A positive literal is modeled if its atom is modeled, whereas a negated literal is modeled if its corresponding atom is not modeled. Example 1. We give an interpretation I = S, F such that the external predicate #strlen is associated to the oracle F (#strlen), and F (# <) to # <. Intuitively these oracles are defined such that #strlen(pat4dat,7) and # < (7,8) are modeled by I, whereas #strlen(mypet,8) and # < (10,8) are not. The following is a ground version of rule 2: mustChangePasswd(frank) ← passwd(frank,pat4dat), #strlen(pat4dat,7), # < (7,8).
(3)
2 Let r be a ground rule. We define 2
A constraint ← B(r) can be easily simulated through the introduction of a corresponding standard rule fail ← B(r), not fail, where fail is a fresh predicate not occurring elsewhere in the program.
External Sources of Computation for Answer Set Solvers
109
i. I |= H(r) iff there is some a ∈ H(r) such that I |= a; ii. I |= B(r) iff I |= a for each atom a ∈ B + (r) and I |= a for each atom a ∈ B − (r); iii. I |= r (i.e., r is satisfied) iff I |=H(r) whenever I |= B(r). We say that I is a model of a ASP-EX program P with respect to a universe U, denoted I |=U P , iff I |= r for all r ∈ grnd U (P ). A model M is minimal if there is no model N such that N ⊂ M . Given a general ground program P , its GL reduct w.r.t. an interpretation I is the positive ground program P I , obtained from P by: – deleting all rules having a negated literal which is not modeled by I; – deleting all the negated literals from the remaining rules. I ⊆ HB U (P ) is an answer set for a program P w.r.t. U iff I is a minimal model for the positive program grnd U (P )I . Let ansU (P ) be the set of answer sets of grndU (P ). We call P F-satisfiable, if it has some answer set for a fixed function mapping F , i.e. if there is some interpretation S, F which is an answer set. In the following we will assume the semantics associated to each external predicate is defined a priori, i.e. F is fixed.
4
Properties of
ASP-EX
Programs
Although simple in its definition, the above semantics does not give any hint on how to actually compute answer sets of a given program P . In general, given an infinite domain of constants U, and a program P , HBU (P ) is indeed infinite. Theorem 1. It is given a ASP-EX program P , a domain of constants U, and a function mapping F where the co-domain of F contains only boolean functions decidable in polynomial time in the size of their arguments. Deciding whether P is F -satisfiable in the domain U is undecidable. Proof. (Sketch) The proof is carried out by showing that the Answer Set Semantics of a ordinary program P with function symbols3 can be reduced to the Answer Set Semantics of a ASP-EX program P . We take advantage of a family of external predicates {#functioni }. In a given interpretation S, F , F will be such that #functioni (C, f, x1 , . . . , xi ) is modeled if C unifies with the compound term f (x1 , . . . , xi ). This allows to rewrite a logic program P with function symbols by means of external predicates. For instance, given the rule p(s(X)) ← a(X, f (Y, h(Z))).
This can be rewritten in an equivalent ASP-EX rule: p(S) ← a(X, F ), #f unction1 (S, s, X), #f unction2 (F, f, Y, H), #f unction1 (H, h, Z).
2 3
Positive Horn programs with function symbols are undecidable, see e.g. [Dantsin et al., 2001].
110
F. Calimeri and G. Ianni
Tailoring cases where a finite portion of U is enough to evaluate the semantics of a given program is thus of interest. In the following we reformulate some results regarding splitting sets [Lifschitz and Turner, 1994]. Definition 1. Given a ASP-EX program P , a splitting set is a set of atoms A ∈ HBU (P ) such that for each atom a ∈ A, if a ∈ H(r) for some r ∈ grndU (P ), then B(r) ∪ H(r) ⊆ A. The bottom bA (P ) is the set of rules {r | r ∈ grndU (P ) and H(r) ⊆ A}. The residual rU (P, I) is a program obtained from grndU (P ) by deleting all the rules which are not modeled by I, and removing from the remaining rules all the a ∈ A modeled by I. 2 We take advantage here of the formulation of the splitting theorem as given in [Bonatti, 2004]. Theorem 2. (Splitting theorem [Lifschitz and Turner, 1994; Bonatti, 2004]) Given a program P and a splitting set A, M ∈ ansU (P ) iff M can be split in two disjoint sets I and J, such that I ∈ ansU (bA (P )) and J ∈ ansU (rU (grndU (P ) \ bA (P )), I). Definition 2. Given a rule r, a variable X is safe in r if it appears in some ordinary atom a ∈ B + (r). A rule r is safe if each variable X appearing in r is safe. A program P is safe if each rule r ∈ P is safe. Theorem 3. Given a safe ASP-EX program P , let U ⊂ U be the set of constants appearing in P . Then ansU (P ) = ansU (P ). Proof. (Sketch) The line of reasoning of the theorem is proving that, assuming P is safe, grndU (P ) is a finite splitting set for P . Furthermore, grndU (P ) = bU (P ). For each M ∈ ansU (P ), we can prove that rU (grndU (P )\bU (P ), M ) is consistent and its only answer set is the empty model. Thus M ∪ ∅ ∈ ansU (P ). Viceversa, assuming an answer set M ∈ ansU (P ) is given, same arguments lead to conclude that M ∈ ansU (P ). 2 In case a safe program is given, the above theorem allows to consider as the set of “relevant” constants only those values explicitly appearing in the program at hand. Intuitively, the semantics of a safe program P can be evaluated by means of the following steps: – compute grndU (P ); – remove from grndU (P ) all the rules containing at least one external literal e such that F |= e, and remove from each rule all the remaining external literals. – compute the remaining ordinary program by means of a standard Answer Set solver.
External Sources of Computation for Answer Set Solvers
111
It is worth pointing out that, assuming the complexity of computing oracles is polynomial in the size of their arguments, this algorithm as same complexity as computing grndU (P )4 .
5
Dealing with Values Invention
Although important for clarifying the given semantics, it is an actual practice to specify external sources of computation not in terms of boolean oracles. So we aim at introducing the possibility to specify functional oracles, keeping anyway the simple reference semantics given previously. In the new setting we are going to introduce, it is also very important that an external atom brings knowledge from external sources of computation, in terms of new symbols added to a given program. For instance, assume U contains encoded values that can be interpreted as natural numbers and that the external predicate #sqr is defined such that the atom #sqr(X,Y) is true whenever Y encodes a natural number representing the square of the natural number X; we want to extract a series of squared values from this predicate; consider the short program number(2) ← square(Y) ← number(X), #sqr(X,Y).
(4)
In the presence of unsafe rules as in the above example, Theorem 3 ceases to hold: it is indeed unclear whether there is a finite set of constants which the program can be grounded on. In the above example, we can intuitively conclude that the set of meaningful constants is {2, 4}. It is however undecidable, given a computable boolean oracle f to establish whether a given set S contains all and only all those tuples t such that f (t) = 1. In order to overcome these limits, we extend our framework with the possibility of explicitly computing missing values on demand. Although restrictive, this setting is not far from a realistic scenario where external predicates are defined by means of generic partial functions instead of boolean ones. Definition 3. It is given an external predicate name #p, having arity n and its oracle function F (#p). A pattern is a list of b’s and u’s. A b will represent a placeholder for a constant (or a bounded variable), whereas an u will be a placeholder for a variable. Given a list of terms, the corresponding pattern will be given by replacing each constant with a b, and each variable with a u. 2 For instance, the pattern related to the list of terms (X, a, Y ) is (u, b, u). Let pat be a pattern of length n having k placeholders b (which we will call input positions), and n− k placeholders of u type (which we will call output positions). A functional oracle F (#p)[pat] for the pattern pat, associated to the external 4
Assuming rules can have unbounded length, grounding a disjunctive logic program is in the worst case exponential in the size of the Herbrand base (see e.g. [Leone et al., 2001]).
112
F. Calimeri and G. Ianni
predicate #p, is a partial function taking k constant arguments from U and returning a tuple of arity n−k, and such that F (#p)[pat](a1 , ..., ak ) = b1 , ..., bn−k iff F (#p)(a1 , . . . , ak , b1 , . . . , bn−k ) = 1. Let pat[j] be the j-th element of a pattern pat. Let unboundpat (X) be the sub-list of X such that pat[j] = u for each Xj ∈ X, and boundpat (X) be the sub-list of X such that pat[j] = b for each Xj ∈ X. An external predicate #p might be associated to one or more functional oracles “consistent” with the originating boolean oracle. For instance, consider the #sqr external predicate, defined as mentioned above. We associate to it two functional oracles, F (#sqr)[b, u] and F (#sqr)[u, b]. The two functional oracles are such that, e.g. F (#sqr)[b, u](3) = 9 F (#sqr)[u, b](16) = 4
(5) (6)
consistently with the fact that F (#sqr)(3, 9) = F (#sqr)(4, 16) = 1, whereas F (#sqr)[u, b](5) is set as undefined since F (#sqr)(X, 5) = 0 for any natural X. In the sequel, given an external predicate #e, we will assume it comes equipped with its oracle F (#e) (called also base oracle) and a list of consistent functional oracles {F (#e)[pat1 ], . . . , F (#e)[patm ]}, having different patterns pat1 , . . . , patm 5 . Adopting functional oracles in the context of safe programs is however to big a restriction. We thus aim at enlarging the class of programs that can be evaluated against a finite Herbrand universe. To this end, we introduce a relaxed notion of safety. Intuitively, a variable is weakly safe if its value, although not explicitly appearing in a program, can be computed through a functional oracle. Definition 4. Given a rule r, let E(r) its set of external atoms. A choice C of functional oracles is a mapping C : E(r) → N associating each external atom of r with the index of one of its functional oracles. Given a choice C, let FC (#e) a shortcut for the functional oracle F (#e)[patC(#e) ]. Given a rule r and a choice C, a variable X is weakly safe in r w.r.t. to C if either – X is safe; or – X appears in some external atom #e(X) ∈ B + (r), X ∈ unboundpat and each variable Y ∈ boundpat
#e)
C(
#e)
C(
is weakly safe.
2
A rule r is weakly safe if there is a choice Cr such that each variable X appearing in some atom a ∈ B(r) is weakly safe with respect to Cr . A program P is weakly safe if each rule r ∈ P is weakly safe. 2 Example 2. Assume that #sqr is associated to the list of functional oracles {F (#sqr)[b, u], F (#sqr)[u, b]} defined above. Given a choice of oracles C such 5
Note that functional oracles prevent, to some extent, to define multivalued functions and/or generic relations. We consider anyway this setting acceptable for a variety of applications.
External Sources of Computation for Answer Set Solvers
113
that C(#sqr(X, Y )) = 2, the second rule of Program 4 is not weakly safe (intuitively there is no way for computing the value of the variable Y with the oracle F (#sqr)[u, b]. The same rule is weakly safe if we set C(#sqr(X,Y)) = 1. 2 It turns out that deciding whether a given rule is weakly safe or not depends on a given choice, but also from the set of available functional oracles. It is assumed indeed that an external predicate does not come with all its possible functional oracles. Proposition 1. Given a set of external predicates E, and a list of functional oracles for each #e ∈ E, it can be checked in polynomial time whether a program P is weakly safe. Proof. (Sketch) Simply observe that for each rule r ∈ P it can be checked in time linear in the number of atoms of r whether a choice making r weakly safe exists. 2 Weakly safe rules can be grounded with respect to functional oracles as follows. Definition 5. Given a weakly safe rule r, a choice C for it, and a set of ordinary ground atoms A, a ground rule r is member of ins(r, A) if r can be grounded to r by the following algorithm: 1. replace positive literals of r with a consistent nondeterministic choice of matching ground atoms from A; let θ the resulting variable substitution; 2. until θ instantiates all the variables of r: – pick from rθ an external atom #e(X)θ such that θ instantiates all the variables X ∈ boundpat (X). – If FC (#e)(boundpat
#e)
C(
#e)
C(
(Xθ)) = a1 , . . . , ak , then update θ by assigning
a1 , . . . , ak to unboundpat (Xθ); else fail; C(#e) 3. return r = rθ.
2
Example 3. Let’s consider the second rule of Program 4; then, ins(r, {number(1), number(2)}) contains the two rules: square(1) ← number(1), #sqr(1, 1). square(4) ← number(2), #sqr(2, 4).
2 Although desirable, weak safety is not sufficient in order to intuitively guarantee finiteness of answer sets and decidability. For instance, the program square(2) ← square(Y ) ← square(X), #sqr(X, Y ).
(7)
is modeled by the infinite set of atoms {square(2), square(4), . . . }. We thus introduce the notion of semi-safe program. Intuitively a semi-safe program is such that external atoms cannot create infinite chains of new values to be taken in account.
114
F. Calimeri and G. Ianni
Definition 6. A weakly safe program P is semi-safe if each cycle in G(P ) contains only edges corresponding to safe rules. 2 Example 4. For instance, the program square(Y ) ← square(X), number(Y ), #sqr(X, Y ). square(Y ) ← number(X), #sqr(X, Y ).
is semi-safe.
2
We extend next Theorem 3 to the case of semi-safe programs. Theorem 4. It is given a semi-safe program P . Then there is a finite set of constants U such that ansU (P ) = ansU (P ). Proof. (Sketch) The set U is defined as all the constant symbols appearing in the set of atoms TP∞ (∅) where the operator TP is defined as follows. TP (A) = A ∪ {a ∈ H(r )|r ∈ ins(r, A) for some r ∈ P } It is provable that TP∞ (∅) = TPn (∅) for some n in case P is semi-safe; TP∞ (∅) is a splitting set, and U is finite; as in Theorem 3 for each M ∈ ansU (P ), we can prove that rU (grndU (P )\ bTP∞ (P ), M ) is consistent and its only answer set is the empty model. Thus M ∪ ∅ ∈ ansU (P ). Assuming an answer set M ∈ ansU (P ) is given, same arguments lead to conclude that M ∈ ansU (P ). 2 The above theorem allows to compute semantics of a semi-safe program P by means of a traditional answer set solver, following the steps: – compute the ground program TP∞ (∅). This computation involves a number of evaluation of ins(r, A) that trigger evaluation of functional oracles whenever needed; – eliminate external literals as in the case of safe programs; – evaluate the remaining ordinary program by means of a traditional solver; We observe that, assuming F contains polynomial-time functional oracles, the complexity of the above algorithm is not greater than the complexity of computing grounding for an ordinary program.
6
Implementation and Experiments
The proposed language has been integrated into the ASP system DLV [Leone et al., 2005b]. We called this prototype DLV-EX. From a practical point of view, the external atoms are dealt with in the following steps (see Figure 1): 1. at design time: a developer provides a library of external atoms, each of them associated with a set of functional oracles. Each functional oracle has a corresponding pattern. Although useful in practice, it is not compulsory to provide functional oracles other than the base oracle. However, the absence of specific functional oracles limits de facto the possibility to exploit an external atom in weakly safe rules. A testing environment helps checking the correctness of the oracles by means of automatically generated test programs.
External Sources of Computation for Answer Set Solvers
115
2. at run-time in a pre-processing stage: each rule is checked to be weakly safe, and a suitable choice of functional oracles is made. Then the overall program is checked to be semi-safe. It is anyway possible to relax this second condition, provided that termination of grounding algorithms is not guaranteed in this case. It is worth pointing out that an user developing a logic program is not in charge of specifying a choice of oracles, since the system itself will choose the best functional oracles among a variety of possibilities. 3. at run-time during the rule instantiation stage: the optimized grounder of the DLV system has been extended in order to compute ins(r, A) for a given rule r and a set of “active” atoms A. For each external atom in r,the chosen functional oracles are repeatedly invoked according to Definition 5. Point 2 and 3 above are integrated in the existing grounding algorithm of the system. We briefly recall the rule instantiation algorithm of the DLV system [Leone et al., 2001]. Given a rule r, this algorithm exploits an intelligent backtracking algorithm, where a given atom a ∈ B(r) is picked at each stage and it is tried to be instantiated with respect to currently allowed values. The picking order is crucial in order to tailor the search space to the smallest extent: in principle, it is preferred to pick first those atoms whose estimated set of possible values is smaller. The presence of external atoms impacts within such algorithm in a twofold way: for what point 2 above is concerned, given a rule r, among possible choices of functional oracles, our algorithm prefers those patterns whose number of unbounded variables is bigger. This intuitively allows to reduce the space of possible instantiations for a given external atom. For instance, given the atom #sqr(X,Y), the choosing algorithm prefers, whenever possible, to choose the oracle with pattern (b, u) instead of the base oracle (which can be seen has having the pattern (b, b)), since this way it is searched only the space of values where Y is equal to the square of X. In the second case, an oracle with pattern (b, b) forces in principle to check all the possible couples of values for X and Y . Point 3 impacts on the atom pick-up ordering strategy. For the same reasons above, it is preferred to pick up external atoms, with pattern having many unbounded variables, as earlier as possible. This strategy relies on the assumption, often true in practice, that the computation of a functional oracle is less time consuming than several computations of the corresponding base oracle. All the pre-existing built-in atoms available in the DLV system (such as arithmetic and relational operators) have been rewritten using the new general framework. We carried out some experiment in order to appreciate the impact and the possible overhead of the new construct. Results are encouraging: grounding times are in most cases equivalent, and the slowdown reported in few cases is never above 6-7%. External predicate definitions can be grouped in one or more libraries. Libraries have to be compiled such that they can be dynamically linked to the DLV-EX executable; oracles are written in the C++ language. A special directive inside DLV-EX programs tells the system which libraries have to be linked at run-
116
F. Calimeri and G. Ianni
Fig. 1. System Architecture
time. Also, built-in developers are enabled to redefine predefined operators in order to deal with new data types, e.g. real numbers. Some usage experiments have been carried out as well; few users have been requested to start implementing some customized libraries [Palopoli et al., 2005; Cumbo et al., 2004],and early feedbacks are positive both from the correctness and the ease of use points of view.
7
Related Works
For what the possibility of calling external modules in a logic program is concerned, it is worth to mention the foundational work of Eiter et al. [1997]. This paper takes the notion of generalized quantifier, known in formal logics, and adapts it in the context of modular logic programming. A generalized quantifier indeed, can be seen as a way for delegating the truth value of a formula to an external source of computation. Based on this work, the same authors are addressing the issue of implementing generalized quantifiers under Answer Set Semantics, in order to enable Answer Set Solvers to communicate, in both directions, with external reasoners [Eiter et al., 2004; Eiter et al., 2005]. This approach is different from the one considered in this paper since the former is inspired from second order logics and allows bidirectional flow of relational data (to and from an external atom), whereas, in our setting, the information flow is strictly value based. Nonetheless, HEX programs, as defined in [Eiter et al., 2005], do not deal with infinite domains explicitly. Although this know-how has not been explicitly divulgated yet, other Answer Set Solvers introduced the possibility to deal with externally computed functions [Syrj¨ anen, 2002; Osorio and Corona, 2003].
External Sources of Computation for Answer Set Solvers
117
Furthermore, there are several works aiming at bringing in Answer Set Programming a restricted capability of dealing with infinite domains. Among these, it is worth citing the notion of ω-restricted programs [Syrj¨ anen, 2001]. ω -restricted programs allow to keep decidability of Answer Set Semantics in the presence of functions symbols, and constitute a subclass of finitary programs. It is indeed important to recall the work of Bonatti [2004], aimed at tailoring the class of finitary programs. Although, in general, recognizing this class of programs is undecidable, finitary programs allow function symbols but are decidable under brave/skeptical reasoning with ground queries. As shown in Theorem 1, external functions might be exploited in order to simulate function symbols. It is a matter of future search to extend the notion of semi-safe program to a larger class and investigate equivalence conditions with the notion of finitary program. In the above cited literature, infinite domains are obtained through the introduction of compound functional terms. Thus the studied theoretical insights are often specialized to this notion of term, and take advantage e.g., of the common unification rules of formal logics over infinite domains. Similar in spirit to our approach is the work on open logic programs, and conceptual logic programs [Heymans et al., 2004]. Such paper addresses the possibility of grounding a logic program, under Answer Set Semantics, over an infinite domain, in a way similar to classical logics and/or description logics. Each constant symbol has no predefined compound structure however. Also similar is the work of Cabibbo [1998], which extend the work of Hull and Yoshikawa [1998]. The latter authors introduce a language (ILOG) with a special construct aimed at introducing new invented values in a logic program, for the purpose of creating new tuple identifiers in relational databases. Based on this work, Cabibbo investigates about decidable fragments of the language. Despite some crucial semantic differences, the presented notion of weak safety is similar to the one herein presented, and describes conditions such that new values do not propagate in infinite chains.
8
Conclusions
We presented a framework where external atoms with value invention are taken in account. The purpose of this work is in the direction of closing the gap between Answer Set Programming and practical applications. Also, we believe this works paves the way to an actual implementation of finitary programs with function symbols. The system prototype, examples, manuals and benchmark results are available at http://www.mat.unical.it/kali/dlv-ex.
References [Babovich and Maratea] Y. Babovich and M. Maratea. Cmodels-2: Sat-based answer sets solver enhanced to non-tight programs. http://www.cs.utexas.edu/users/ tag/cmodels.html, 2003. [Bonatti] P. A. Bonatti. Reasoning with infinite stable models. AI,156(1):75–111,2004. [Cabibbo] L. Cabibbo. The Expressive Power of Stratified Logic Programs with Value Invention. Inf. Comput., 147(1):22–56, 1998.
118
F. Calimeri and G. Ianni
[Cumbo et al.] C. Cumbo, S. Iiritano, and P. Rullo. Reasoning-based knowledge extraction for text classification. In Discovery Science, pp. 380–387, 2004. [Dantsin et al.] E. Dantsin, T. Eiter, G. Gottlob, and A. Voronkov. Complexity and Expressive Power of Logic Programming. ACM CS, 33(3):374–425, 2001. [Eiter et al.] T. Eiter, G. Gottlob, and H. Veith. Modular Logic Programming and Generalized Quantifiers. In LPNMR-97, LNCS 1265. [Eiter et al.] T. Eiter, W. Faber, N. Leone, G. Pfeifer, and A. Polleres. A Logic Programming Approach to Knowledge-State Planning, II: the DLVK System. Artif. Intell., 144(1–2):157–211, 2003. [Eiter et al.] T. Eiter, G. Ianni, R. Schindlauer, and H. Tompits. Nonmonotonic description logic programs: Implementation and experiments. In LPAR 2004, pp. 511– 527, 2004. [Eiter et al.] T. Eiter, G. Ianni, R. Schindlauer, and H. Tompits. A Uniform Integration of Higher-Order Reasoning and External Evaluations in Answer Set Programming. In IJCAI 2005, to appear, Edinburgh, UK, 2005. [Gelfond and Lifschitz] M. Gelfond and V. Lifschitz. The Stable Model Semantics for Logic Programming. In ICLP 1988, pp. 1070–1080, MIT Press. [Gelfond and Lifschitz] M. Gelfond and V. Lifschitz. Classical Negation in Logic Programs and Disjunctive Databases. NGC, 9:365–385, 1991. [Heymans et al.] S. Heymans, D. Van Nieuwenborgh, and D. Vermeir. Semantic web reasoning with conceptual logic programs. In RuleML 2004, pp. 113–127, 2004. [Hull and Yoshikawa] R. Hull and M. Yoshikawa. On the equivalence of database restructurings involving object identifiers. In PODS 1991, pp. 328–340. ACM Press. [Leone et al.] N. Leone, S. Perri, and F. Scarcello. Improving ASP Instantiators by Join-Ordering Methods. LPNMR’01, Vienna, Austria, 2001, LNCS 2173. [Leone et al.] N. Leone, G. Gottlob, R. Rosati, T. Eiter et al. The INFOMIX System for Advanced Integration of Incomplete and Inconsistent Data. In SIGMOD 2005, ACM, to appear. [Leone et al.] N. Leone, G. Pfeifer, W. Faber, T. Eiter, G. Gottlob, S. Perri, and F. Scarcello. The DLV System for Knowledge Representation and Reasoning. ACM TOCL, 2005. To appear. [Lifschitz and Turner] V. Lifschitz and H. Turner. Splitting a Logic Program. In ICLP’94, pp. 23–37, MIT Press. [Lin and Zhao] F. Lin and Y. Zhao. ASSAT: Computing Answer Sets of a Logic Program by SAT Solvers. In AAAI-2002, AAAI Press / MIT Press. [Osorio and Corona] M. Osorio and Enrique Corona. The A-Pol system. In ASP,2003. [Palopoli et al.] L. Palopoli, S. Rombo, and G. Terracina. Flexible Pattern Discovery with (Extended) Disjunctive Logic Programming. In International Symposium on Methodologies for Intelligent Systems (ISMIS 2005), pp. 504–513, Verlag. [Simons et al.] P. Simons, I. Niemel¨ a, and T. Soininen. Extending and Implementing the Stable Model Semantics. Artif. Intell., 138:181–234, 2002. [Syrj¨ anen] T. Syrj¨ anen. Omega-restricted logic programs. In LPNMR-6, Vienna, Austria, 2001. Verlag. [Syrj¨ anen] T. Syrj¨ anen. Lparse 1.0 User’s Manual, 2002.
Answer Sets for Propositional Theories Paolo Ferraris Department of Computer Sciences, The University of Texas at Austin, Austin TX 78712, USA [email protected] Abstract. Equilibrium logic, introduced by David Pearce, extends the concept of an answer set from logic programs to arbitrary sets of formulas. Logic programs correspond to the special case in which every formula is a “rule” — an implication that has no implications in the antecedent (body) and consequent (head). The semantics of equilibrium logic looks very different from the usual definitions of an answer set in logic programming, as it is based on Kripke models. In this paper we propose a new definition of equilibrium logic which uses the concept of a reduct, as in the standard definition of an answer set. Second, we apply the generalized concept of an answer set to the problem of defining the semantics of aggregates in answer set programming. We propose, in particular, a semantics for weight constraints that covers the problematic case of negative weights. Our semantics of aggregates is an extension of the approach due to Faber, Leone, and Pfeifer to a language with choice rules and, more generally, arbitrary rules with nested expressions.
1
Introduction
Equilibrium logic, introduced by Pearce [1997, 1999], extends the concept of an answer set [Gelfond and Lifschitz, 1988, 1991] from logic programs to arbitrary sets of formulas. Logic programs correspond to the special case in which every formula is a “rule” — an implication that has no implications (or equivalences) in the antecedent (body) and consequent (head). The semantics of equilibrium logic looks very different from the usual definitions of an answer set in logic programming: it is based on Kripke models. In this paper, we propose a new definition of equilibrium logic, equivalent to Pearce’s definition, which uses the concept of a reduct, as in the one used in the standard definition of an answer sets. Second, we apply the generalized concept of an answer set to the problem of defining the semantics of aggregates in answer set programming. The best proposal in this area published so far is due to Faber, Leone, and Pfeifer [2004]. The strong point of that paper is that it is applicable to aggregates that are neither monotone nor antimonotone (such as, for instance, weight constraints in which some some weights are positive and some are negative). It has two defects, however. First, it does not allow negation in aggregate expressions. Second, it does not cover choice rules, which play an important role in answer set programming.1 1
Both negation within aggregates and choice rules can be defined, in principle, as abbreviations for expressions containing auxiliary atoms.
C. Baral et al. (Eds.): LPNMR 2005, LNAI 3662, pp. 119–131, 2005. c Springer-Verlag Berlin Heidelberg 2005
120
P. Ferraris
Our semantics includes aggregates in the style of [Faber et al., 2004] containing arbitrary formulas and also choice rules. We show also that the existence of an answer set for nondisjunctive program with aggregates of a very simple kind (weight constraints with the weights 1 and −1) is Σ2P -hard, as in the case of disjunctive programs. In the following section we define answer sets for propositional theories, and we relate this definition to equilibrium logic and to the traditional definition of an answer set. In Section 3 we extend several important theorems about logic programs to propostional theories. In Section 4, we propose our semantics of aggregates, discuss its properties, and show, as an example, how it applies to representing a combinatorial auction with negative costs. Comparisons with other formalizations are given in Section 5.
2
Formulas, Reducts and Answer Sets
2.1
Definition
For simplicity, we limit our attention to formulas without strong negation. We consider (propositional) formulas formed from atoms and connectives ⊥, ∨, ∧ and ⊃.2 A theory is a set of formulas. In the rest of the paper, F and G denote formulas, Γ a theory, X and Y sets of atoms, and ⊗ a binary connective. We identify an interpretation with the set of atoms satisfied by it. We write X |= F (X |= Γ ) if X satisfies F (or Γ ) in the sense of classical logic. The reduct F X of F relative to X is defined recursively: – if X |= F then F X = ⊥, – if X |= a (a is an atom) then aX = a, and – if X |= F ⊗ G then (F ⊗ G)X = F X ⊗ GX . This definition of a reduct is similar to a transformation proposed in [Osorio et al., 2004, Section 4.2]. The reduct F X can be alternatively defined as the formula obtained from F by replacing every outermost subformula not satisfied by X with ⊥ (this alternative definition applies even if we treat ¬, and ≡ as primitive connectives). For instance, if X contains p but not q then ((p ⊃ q) ∨ (q ⊃ p))X = ⊥ ∨ (⊥ ⊃ p). It is easy to see that, for every X, Y , ⊗, F and G, Y |= (F ⊗ G)X iff X |= F ⊗ G and Y |= F X ⊗ GX . X
(1)
X
The reduct Γ of Γ relative to X is {F : F ∈ Γ }. A set X is an answer set for Γ if X is a minimal set satisfying Γ X . For instance, let Γ be {(p ⊃ q) ∨ (q ⊃ p), p}. Set {p} is an answer set for Γ because {p} is a minimal model satisfying the reduct {⊥ ∨ (⊥ ⊃ p), p}. It is not difficult to see that no other set of atoms is an answer set for Γ . 2
¬F stands for F ⊃ ⊥; stands for ⊥ ⊃ ⊥; F ≡ G stands for (F ⊃ G) ∧ (G ⊃ F ).
Answer Sets for Propositional Theories
2.2
121
Relationship to Equilibrium Logic
Theorem 1. For any theory, its models in the sense of equilibrium logic are identical to its answer sets. Since in application to programs with nested expressions equilibrium logic is equivalent to the semantics defined in [Lifschitz et al., 1999], Theorem 1 implies that our definition of an answer set extends the corresponding definition from that paper. In the proof of Theorem 1, we write X, Y |= Γ (with X ⊆ Y ) if the HTinterpretation 3 X, Y is a model of Γ . Lemma 1. For any X and Y such that X ⊆ Y and any theory Γ , X |= Γ Y iff X, Y |= Γ. The lemma is proven first for the case when Γ is a singleton, by structural induction. Proof of Theorem 1. According to the semantics of equilibrium logic (reproduced in [Lifschitz et al., 2001, Section 4.4]), Y is a model of Γ iff
Y, Y |= Γ and, for all proper subsets X of Y , X, Y | = Γ. In view of Lemma 1, this is the same as Y |= Γ Y and, for all proper subsets X of Y , X | = ΓY . which means that Y is an answer set for Γ . 2.3
Relationship to the Traditional Definition of Reduct
A nested expressions is a formula that contains no implications F ⊃ G with G = ⊥, and no equivalences. 4 A program with nested expressions is a set of rules F ← G, where F and G are nested expressions. We will identify such a rule with the implication G ⊃ F . In application to programs with nested expressions, our definition of a reduct is quite different from the traditional definition [Lifschitz et al., 1999]. Consider, for instance, the following program: p ← not q q ← not r According to [Lifschitz et al., 1999], its reduct relative to {r} is p← q ← ⊥; with our definition, it is 3 4
See [Lifschitz et al., 2001, Section 2.1]. Traditionally, in nested expressions conjunction is denoted by comma, disjunction by semicolon, and negation by “not ”.
122
P. Ferraris
⊥ q ← ⊥. The first reduct is satisfied, for instance, by {p}, while the second is unsatisfiable. However, some similarities between these formalisms exist. For instance, it is easy to see that for any formula F , (¬F )X , according to the new definition, is when X | = F , and ⊥ otherwise, as with the traditional definition. Indeed, if X |= F then X | = F ⊃ ⊥ and consequently (¬F )X = (F ⊃ ⊥)X = ⊥. Otherwise, X |= F ⊃ ⊥, so that (¬F )X = (F ⊃ ⊥)X = F X ⊃ ⊥ = ⊥ ⊃ ⊥ = . The following proposition states a more general relationship between the new definition of the reduct and the traditional one. We denote by F X the reduct of a nested expression F relative to X according to the definition from [Lifschitz et al., 1999], and similarly for the reduct of a program. Proposition 1. For any program Π with nested expressions and any set X of atoms, Π X is equivalent, in the sense of classical logic, – to ⊥, if X | = Π, and – to the program obtained from Π X by replacing all atoms that do not belong to X by ⊥, otherwise. The proof of this proposition is based on the following lemma, proven by structural induction. Lemma 2. The reduct F X of a nested expression F is equivalent, in the sense of classical logic, to the nested expression obtained from F X by replacing all atoms that do not belong to X by ⊥. Corollary 1. Given two sets of atoms X and Y with Y ⊆ X and any program Π, Y |= Π X iff X |= Π and Y |= Π X . This corollary suggests another way to verify that the definition of an answer set proposed in this paper is equivalent to the usual one in the case of programs with nested expressions. If X | = Π then X is not an answer set for Π under either semantics. Otherwise, for every subset Y of X, Y |= Π X iff Y |= Π X by Corollary 1.
3
Properties of Propositional Theories
Several theorems about answer sets for logic programs can be extended to propositional theories. The proofs are omitted for lack of space. Two theories Γ1 and Γ2 are strongly equivalent if, for every theory Γ , Γ1 ∪ Γ and Γ2 ∪ Γ have the same answer sets.
Answer Sets for Propositional Theories
123
Proposition 2. For any two theories Γ1 and Γ2 , the following conditions are equivalent: (i) Γ1 is strongly equivalent to Γ2 , (ii) Γ1 is equivalent to Γ2 in the logic of here-and-there, and (iii) for each set X of atoms, Γ1X is equivalent to Γ2X in classical logic. The equivalence between (i) and (ii) is a generalization of the main result of [Lifschitz et al., 2001], and it is an immediate consequence of Lemma 4 from that paper and our Theorem 1. The equivalence between (i) and (iii) is similar to Theorem 1 from [Turner, 2003]. The following claims require some definitions. An occurrence of an atom in a formula is positive if it is in the antecedent of an even number of implications. An occurrence is strictly positive if such number is 0. An occurrence of an atom in a formula is negated if it is in a subformula of the form F ⊃ ⊥. For instance, in a formula (p ⊃ ⊥) ⊃ q, the occurrences of p and q are positive, the one of q is strictly positive, and the one of p is negated. The following proposition is an extension of the property that in each answer set of a program, each atom occurs in the head of a rule of that program [Lifschitz, 1996, Section 3.1]. Proposition 3. Each answer set of a theory consists of atoms that have a strictly positive occurrence in some formula of that theory. The following two propositions were stated in [Ferraris and Lifschitz, 2005] in the case of logic programs. Proposition 4 (Lemma on Explicit Definitions). Let Γ be any propositional theory, and Q a set of atoms that do not occur in Γ . For each q ∈ Q, let Def (q) be a formula that doesn’t contain any atom from Q. Then X → X \ Q is a 1–1 correspondence between the answer sets of Γ ∪ {Def (q) ⊃ q : q ∈ Q} and the answer sets of Γ . Proposition 5 (Completion Lemma). Let Γ be any propositional theory, and Q a set of atoms that do not have positive, nonnegated occurrences in any rule of Γ . For each q ∈ Q, let Def (q) be a formula such that all occurrences of elements of Q in Def (q) are either positive or negated. Then Γ ∪ {Def (q) ⊃ q : q ∈ Q} and Γ ∪ {Def (q) ≡ q : q ∈ Q} have the same answer sets. The following proposition is essentially a generalization of the splitting set theorem from [Lifschitz and Turner, 1994] and [Erdo˘ gan and Lifschitz, 2004]. Proposition 6 (Splitting Set Theorem). Let Γ1 and Γ2 be two theories such that all atoms occurring in Γ1 have no strictly positive occurrences in Γ2 . Then a set of X is an answer set for Γ1 ∪ Γ2 iff there is an answer set Y for Γ1 such that X is an answer set for Y ∪ Γ2 .
124
4
P. Ferraris
Representing Aggregates
4.1
Definition
Aggregates are an important extension to logic programs, widely used in answer set programming. We define a (ground) aggregate as an expression of the form op {F1 = w1 , . . . , Fn = wn } ≺ N
(2)
where – op is (a symbol for) a function from multisets of R (real numbers) to R ∪ {−∞, +∞} (such as sum, product, min, max, etc.), – {F1 = w1 , . . . , Fn = wn } (n ≥ 0) is a multiset where F1 , . . . , Fn are formulas, and w1 , . . . , wn are (symbols for) real numbers (“weights”), – ≺ is (a symbol for) a binary relation between real numbers, such as ≤ and =, and – N is (a symbol for) a real number. As an intuitive explanation of an aggregate, take the multiset W consisting of the weights wi (1 ≤ i ≤ n) such that Fi is “true”. The aggregate is considered “true” if op(W ) ≺ N . For example, sum {p = 1, q = 1} = 1.
(3)
intuitively expresses the condition that both p are q are “true” or none of them. To define the semantics of aggregates, we propose to identify (2) with the formula Fi ⊃ Fi , (4) I⊆{1,...,n} : op({wi : i∈I}) ≺N
i∈I
i∈I
where I stands for {1, . . . , n} \ I, and ≺ is the negation of ≺ 5 . For instance, if we consider aggregate (3), the conjunctive terms in (4) correspond to the cases when the sum of weights is 1, that is, when I = {1} and I = {2}. The two implications are q ⊃ p and p ⊃ q respectively, so that (3) is (q ⊃ p) ∧ (p ⊃ q).
(5)
sum {p = 1, q = 1} = 1
(6)
(p ∨ q) ∧ ¬(p ∧ q).
(7)
Similarly, is Note that, even if (5) is classically equivalent to (7), they are not equivalent in the logic of here-and-there. This shows that it is generally incorrect to “move” a negation from a binary relation symbol (such as =) in front of the aggregate as the unary connective ¬. Some properties of aggregates are stated in the following proposition. 5
This definition, based on the idea of the translation from [Faber et al., 2004], is meant to provide a very general semantics for aggregates, but we do not propose to use it directly for computing answer sets.
Answer Sets for Propositional Theories
125
Proposition 7. For any aggregate op S ≺ N where S is {F1 = w1 , . . . , Fn = wn }, and any sets X and Y of atoms, (a) X |= op S ≺ N iff op({wi : X |= Fi }) ≺ N , and (b) Y |= (op S ≺ N )X iff X |= op S ≺ N and Y |= op S X ≺ N , where S X stands for {F1X = w1 , . . . , FnX = wn }. Proposition 7(a) confirms that our proposal to identify (2) with (4) is in agreement with the intuitive meaning of an aggregate. Part (b) is similar to property (1) of binary connectives. When a theory Γ is described using abbreviation (2) in its formulas, answer sets of Γ can be computed using Proposition 7 instead of a direct reference to (4). Finally, it can be shown by Proposition 2 that if we want to identify (2) with a formula so that Proposition 7 holds then (4) is the only choice, modulo strong equivalence. Proposition 7(a) follows from the fact that X satisfies an implication in (4) iff I = {j : X |= Fj }. The proof of part (b) uses the following lemma that is easily provable. Lemma 3. For any formulas F1 , . . . , Fn (n ≥ 0), any set X of atoms, and any connective ⊗ ∈ {∨, ∧}, (F1 ⊗· · ·⊗Fn )X is classically equivalent to F1X ⊗· · ·⊗FnX . 4.2
Monotone Aggregates
An aggregate op {F1 = w1 , . . . , Fn = wn } ≺ N is monotone if, for each pair of multisets W1 , W2 such that W1 ⊆ W2 ⊆ {w1 , . . . , wn }, op(W2 ) ≺ N is true whenever op(W1 ) ≺ N is true. The definition of an antimonotone aggregate is similar, with W1 ⊆ W2 replaced by W2 ⊆ W1 . For instance, sum {p = 1, q = 1} > 1. (8) is monotone, and sum {p = 1, q = 1} < 1.
(9)
is antimonotone. An example of an aggregate that is neither monotone nor antimonotone is (3). Proposition 8. An aggregate op {F1 = w1 , . . . , Fn = wn } ≺ N is equivalent, in the logic of here-and-there, to Fi I⊆{1,...,n} : op({wi : i∈I}) ≺N
if the aggregate is monotone, and to I⊆{1,...,n} : op({wi : i∈I}) ≺N
if the aggregate is antimonotone.
i∈I
¬ Fi i∈I
126
P. Ferraris
In other words, if op S ≺ N is monotone then the antecedents of the implications in (4) can be dropped. Similarly, in case of antimonotone aggregates, the consequents of these implications can be replaced by ⊥. In both cases, (4) is turned into a nested expression, if F1 , . . . , Fn are nested expressions. For instance, the monotone aggregate (8) is (p ∨ q) ∧ (p ⊃ q) ∧ (q ⊃ p), which is equivalent, in the logic of here and there, to (p ∨ q) ∧ q ∧ p and then to q ∧ p. In the case of the antimonotone aggregate (9), the formula ((p ∧ q) ⊃ ⊥) ∧ (p ⊃ q) ∧ (q ⊃ p) is equivalent, in the logic of here-and-there, to (¬(p ∧ q)) ∧ ¬p ∧ ¬q, and then to ¬p ∧ ¬q. On the other hand, if an aggregate is neither monotone nor antimonotone, it may be not possible to find a nested expression equivalent, in the logic of here-and-there, to (4), even if F1 , . . . , Fn are nested expressions. This is the case for (3). Indeed, let A denote (3). Considering that this expression stands for (5), it is easy to check that {p}, {p, q} |= A and ∅, {p, q} |= A. On the other hand, for any nested expression F , if {p}, {p, q} |= F then ∅, {p, q} |= F (easily provable by structural induction.) Both parts of Proposition 8 can be proven, in the difficult direction, by strong induction on the cardinality of I. 4.3
Example
We consider the following variation of the combinatorial auction problem, which can be naturally formalized using an aggregate that is neither monotone nor antimonotone. Joe wants to move to another town and has the problem of removing all his bulky furniture from his old place. He has received some bids: each bid may be for one piece or several pieces of furniture, and the amount offered can be negative (if the value of the pieces is lower than the cost of removing them). A junkyard will take any object not sold to bidders, for a price. The goal is to find a collection of bids for which Joe doesn’t lose money, if there is any. Assume that there are n bids, labeled from 1 to n. We express by the formulas bi ∨ ¬bi
(10)
(1 ≤ i ≤ n) that Joe is free to accept any bid or not. Clearly, Joe cannot accept two bids that involve the selling of the same piece of furniture. So, for each pair i, j of such bids, we include the formula ¬(bi ∧ bj ).
(11)
Answer Sets for Propositional Theories
127
Next, we need to express which pieces of the furniture have not been given to bidders. If there are m objects (numbered from 1 through m), we can express that an object i is sold by bid j by adding the rule b j ⊃ si
(12)
to our theory. Finally, we need to express that Joe doesn’t lose money by selling his items. This is done by the aggregate sum {b1 = w1 , . . . , bn = wn , ¬s1 = −c1 , . . . , ¬sm = −cm } ≥ 0,
(13)
where each wi is the amount of money (possibly negative) obtained by accepting bid i, and each ci is the money requested by the junkyard to remove item i. Note that (13) is neither monotone nor antimonotone. Proposition 9. X → X ∩ {b1 , . . . , bn } is a 1–1 correspondence between the answer sets of the theory consisting of formulas (10)–(13) and the solutions of this problem.
5
Other Formalisms
5.1
Programs with Weight Constraints
Weight constraints [Simons et al., 2002] can be viewed as aggregates of the form sum S ≥ N (traditionally denoted by N ≤ S) and sum S ≤ N (denoted by S ≤ N ), where each formula in S is a literal. Weight constraints are one of the most commonly used kind of aggregates in logic programs, especially in the case of weights that are equal to 1 (cardinality constraints). A program with weight constraints is a set of formulas of the form W1 ∧ · · · ∧ Wn ⊃ a (n ≥ 0) where a is an atom or ⊥, and W1 , ..., Wn are weight constraints.
(14) 6
Theorem 2. For every program with weight constraints, if all the weights are positive, then the answer sets under our semantics are identical to its answer sets in the sense of [Simons et al., 2002, Section 2.3]. The proof consists in showing that, in the case of positive weights, sum S ≥ N and sum S ≤ N are equivalent, in the logic of hereand-there, to the nested expressions [N ≤ S] and [S ≤ N ] defined in [Ferraris and Lifschitz, 2005]. Theorem 2 follows from this fact in view of Theorem 1 from [Ferraris and Lifschitz, 2005]. 6
For simplicity, we are considering only part of the syntax allowed in [Simons et al., 2002]. Every rule in the sense of that paper can be equivalently rewritten as a set of rules of the form (14).
128
P. Ferraris
Our semantics is not equivalent to the semantics of [Simons et al., 2002] when the weights can be negative (as discussed in the introduction, our view of negative weights is equivalent to the one proposed in [Faber et al., 2004]). According to [Ferraris and Lifschitz, 2005, Footnote 6], the traditional semantics for weight constraints may lead to some unintuitive results: program (0 ≤ {p = 2, p = −1}) ⊃ p
(15)
according to [Simons et al., 2002], has no answer sets, while (0 ≤ {p = 1}) ⊃ p has one answer set {p}. Under our semantics, {p} is the only answer set for both programs. While weight constraints with positive weights only are either monotone or antimonotone, this is not the case when negative weights are allowed as in (13). In particular, it may not be possible to represent an aggregate of this kind by a nested expression. This is the main reason why the translation from programs with weight constraints to programs with nested expressions of [Ferraris and Lifschitz, 2005] was limited to the case of positive weights only. 5.2
Complexity of Programs with Weight Constraints
Under the semantics of [Simons et al., 2002], the existence of an answer set for programs with weight constraints is an NP-complete problem even in presence of negative weights. On the other hand, under our semantics, the place of this problem in the polynomial hierarchy is different. Proposition 10. Under the semantics of this paper, the existence of an answer set for a program with weight constraints is a ΣP2 -complete problem. A similar result has been independently proven in [Calimeri et al., 2005]. The problem is clearly in ΣP2 by the definition of an answer set. The ΣP2 hardness follows from the ΣP2 -completeness of the existence of an answer set for disjunctive logic programs [Eiter and Gottlob, 1993, Corollary 3.8], and the following lemma, which provides a polynomial translation from disjunctive programs to programs with weight constraints. Lemma 4. Rule l 1 ∧ · · · ∧ l m ⊃ a1 ∨ · · · ∨ a n (n > 0, m ≥ 0) where a1 , . . . , an are atoms and l1 , . . . , lm are literals, is strongly equivalent to the set of n implications (i = 1, . . . , n) (1 ≤ {l1 = 1}) ∧ · · · ∧ (1 ≤ {lm = 1}) ∧ Ai1 ∧ · · · ∧ Ain ⊃ ai , where each Aij stands for 0 ≤ {ai = 1, aj = −1}.
Answer Sets for Propositional Theories
5.3
129
FLP-Aggregates
We will now show that our semantics of aggregates is an extension of the semantics proposed by Faber, Leone and Pfeifer [2004]. An aggregate of the form (2) is a (ground) FLP-aggregate if F1 , . . . , Fn are conjunctions of atoms. A (ground) FLP-program is a set of formulas A1 ∧ · · · ∧ Am ⊃ a1 ∨ · · · ∨ an
(16)
(n, m ≥ 0), where a1 , . . . , an are atoms and A1 , . . . , Am are FLP-aggregates.7 Theorem 3. The answer sets for a FLP-program under our semantics are identical to its answer sets in the sense of [Faber et al., 2004]. To prove this theorem we need to observe, first of all, that the definition of satisfaction of FLP-aggregates and FLP-programs in [Faber et al., 2004] is equivalent to ours. The definition of a reduct is different, however. According to [Faber et al., 2004], the reduct of a program Π with FLP-aggregates relative to X (we denote such a reduct by Π X ) consists of the rules (16) of Π such that X |= A1 ∧ · · · ∧ Am . The definition of an answer set is again similar to ours: a set X of atoms is an answer set for a FLP-program Π if X is a minimal set satisfying Π X . Lemma 5. For any nested expression F without negations and any two sets X and Y of atoms such that Y ⊆ X, Y |= F X iff Y |= F. Lemma 6. For any FLP-aggregate op S ≺ N and any set X of atoms, if X |= op S ≺ N then Y |= (op S ≺ N )X iff Y |= op S ≺ N. Lemma 5 can be proven by structural induction. Lemma 6 follows from Lemma 5 and Proposition 7(b). Proof of Theorem 3. It is easy to see that if X |= Π then X |= Π X and X X |= Π , so that X is not an answer set under either semantics. Now assume that X |= Π. We will show that the two reducts are satisfied by the same subsets of X. It is sufficient to consider the case in which Π contains only one rule (16). If X |= A1 ∧ · · · ∧ Am then Π X = ∅, and Π X is the tautology ⊥ ⊃ (a1 ∨ · · · ∨ an )X . Otherwise, Π X is rule (16), and Π X is X X AX 1 ∧ · · · ∧ Am ⊃ (a1 ∨ · · · ∨ an ) .
These two reducts are satisfied by the same subsets of X by Lemmas 5 and 6. 7
The syntax of [Faber et al., 2004] is more general in several ways. An expression of the form ¬(opS ≺ N ) in such syntax has the same meaning as opS ≺ N . Also, that paper allows literals as conjunctive terms in the antecedent of the implication (16). However, semantically, an atom a is not different from sum{a = 1} ≥ 1, and ¬a is not different from sum{a = 1} ≤ 0.
130
6
P. Ferraris
Conclusion
We extended the definition of an answer set to arbitrary propositional theories. This definition of an answer set is equivalent to the definition of a model in equilibrium logic, so that it shares important properties of equilibrium logic such as the characterization of strong equivalence in terms of the logic of hereand-there. The new definition of reduct is different from the traditional definition [Lifschitz et al., 1999] in the case of programs with nested expressions, but it is in some ways similar to it. Even though propositional theories have a richer syntax, it turns out that any propositional theory can be expressed as a program with nested expression with the same answer sets [Cabalar and Ferraris, 2005]. In view of this fact, the possibility of defining answer sets for arbitrary propositional theories is not so surprising. Propositional formulas cover both disjunctive rules with FLP-aggregates and choice rules. In the case of weight constraints, if negative weights are allowed then our semantics is not equivalent to the one of [Simons et al., 2002], but seems to have better properties. We have seen that this difference has consequences from the point of view of computational complexity. It is possible, by Proposition 7, to view an aggregate op S ≺ N as a primitive construct rather than an abbreviation for an exponentially larger formula. This is what is already happening in the answer set solver dlv 8 , which partially supports programs with FLP-aggregates. On the other hand, viewing aggregates as formulas allows us to reason about strong equivalence in terms of the logic of here-and-there.
Acknowledgments I am grateful to Pedro Cabalar, Selim Erdo˘ gan, Joohyung Lee, David Pearce, Wanwan Ren and Hudson Turner for comments on a previous version of this paper. Special thanks go to Vladimir Lifschitz for many comments and discussions on the topic, and his careful reading of this paper. This research was partially supported by the National Science Foundation under Grant IIS-0412907.
References [Cabalar and Ferraris, 2005] Pedro Cabalar and Paolo Ferraris. Propositional theories are equivalent to logic programs. In preparation, 2005. [Calimeri et al., 2005] Francesco Calimeri, Wolfgang Faber, Nicola Leone, and Simona Perri. Declarative and computational properties of logic programs with aggregates. In Proc. IJCAI’05, 2005. To appear. [Eiter and Gottlob, 1993] Thomas Eiter and Georg Gottlob. Complexity results for disjunctive logic programming and application to nonmonotonic logics. In Dale Miller, editor, Proceedings of International Logic Programming Symposium (ILPS), pages 266–278, 1993. 8
http://www.dbai.tuwien.ac.at/proj/dlv/ .
Answer Sets for Propositional Theories
131
[Erdo˘ gan and Lifschitz, 2004] Selim T. Erdo˘ gan and Vladimir Lifschitz. Definitions in answer set programming. In Vladimir Lifschitz and Ilkka Niemel¨ a, editors, Proceedings of 7th International Conference on Logic Programming and Nonmonotonic Reasoning (LPNMR-7), pages 114–126, 2004. [Faber et al., 2004] Wolfgang Faber, Nicola Leone, and Gerard Pfeifer. Recursive aggregates in disjunctive logic programs: Semantics and complexity. In Proc. 9th European Conference on Artificial Intelligence (JELIA’04), 2004. Revised version: http://www.wfaber.com/research/papers/jelia2004.pdf. [Ferraris and Lifschitz, 2005] Paolo Ferraris and Vladimir Lifschitz. Weight constraints as nested expressions. Theory and Practice of Logic Programming, 5:45–74, 2005. [Gelfond and Lifschitz, 1988] Michael Gelfond and Vladimir Lifschitz. The stable model semantics for logic programming. In Robert Kowalski and Kenneth Bowen, editors, Proceedings of International Logic Programming Conference and Symposium, pages 1070–1080, 1988. [Gelfond and Lifschitz, 1991] Michael Gelfond and Vladimir Lifschitz. Classical negation in logic programs and disjunctive databases. New Generation Computing, 9:365– 385, 1991. [Lifschitz and Turner, 1994] Vladimir Lifschitz and Hudson Turner. Splitting a logic program. In Pascal Van Hentenryck, editor, Proceedings of International Conference on Logic Programming (ICLP), pages 23–37, 1994. [Lifschitz et al., 1999] Vladimir Lifschitz, Lappoon R. Tang, and Hudson Turner. Nested expressions in logic programs. Annals of Mathematics and Artificial Intelligence, 25:369–389, 1999. [Lifschitz et al., 2001] Vladimir Lifschitz, David Pearce, and Agustin Valverde. Strongly equivalent logic programs. ACM Transactions on Computational Logic, 2:526–541, 2001. [Lifschitz, 1996] Vladimir Lifschitz. Foundations of logic programming. In Gerhard Brewka, editor, Principles of Knowledge Representation, pages 69–128. CSLI Publications, 1996. [Osorio et al., 2004] Mauricio Osorio, Juan Antonio Navarro, and Jos´e Arrazola. Safe beliefs for propositional theories. Accepted to appear at Annals of Pure and Applied Logic, 2004. [Pearce, 1997] David Pearce. A new logical characterization of stable models and answer sets. In J¨ urgen Dix, Luis Pereira, and Teodor Przymusinski, editors, NonMonotonic Extensions of Logic Programming (Lecture Notes in Artificial Intelligence 1216), pages 57–70. Springer-Verlag, 1997. [Pearce, 1999] David Pearce. From here to there: Stable negation in logic programming. In D. Gabbay and H. Wansing, editors, What Is Negation? Kluwer, 1999. [Simons et al., 2002] Patrik Simons, Ilkka Niemel¨ a, and Timo Soininen. Extending and implementing the stable model semantics. Artificial Intelligence, 138:181–234, 2002. [Turner, 2003] Hudson Turner. Strong equivalence made easy: nested expressions and weight constraints. Theory and Practice of Logic Programming, 3(4,5):609–622, 2003.
An ID-Logic Formalization of the Composition of Autonomous Databases Bert Van Nuffelen1 , Ofer Arieli2 , Alvaro Cort´es-Calabuig1 , and Maurice Bruynooghe1 1 2
Department of Computer Science, Katholieke Universiteit Leuven, Belgium {bertv,alvaro,maurice}@cs.kuleuven.ac.be Department of Computer Science, The Academic College of Tel-Aviv, Israel [email protected]
Abstract. We introduce a declarative approach for a coherent composition of autonomous databases. For this we use ID-logic, a formalism that extends classical logic with inductive definitions. We consider ID-logic theories that express, at the same time, the two basic challenges in database composition problems: relating different schemas of the local databases to one global schema (schema integration) and amalgamating the distributed and possibly contradictory data to one consistent database (data integration). We show that our framework supports different methods for schema integration (as well as their combinations) and that it provides a straightforward way of dealing with inconsistent data. Moreover, this framework facilitates the implementation of database repair and consistent query answering by means of a variety of reasoning systems.
1 Introduction and Motivation Composition of information that arrives from different data-sources is a major challenge of information systems and its importance has been recognized by many researches. The works on this subject may be divided to two types according to their objectives: – Systems for schema integration, in which the main goal is to provide a uniform vocabulary to which the various vocabularies of the data-sources can be mapped (see, for instance, [6,10,21,26,30]). – Systems for data integration, in which the major concern is to resolve contradictions that may occur when the distributed data is amalgamated (see, e.g., [1,2,3,4,5,8]). In this work we consider a framework that handles both these tasks at the same time. To illustrate (and motivate) this, consider the following situation: Example 1. Given two data sources. One source stores information about all the students that were enrolled for the first time during 2004, and the other source contains information about all the students whose first year of enrollment is 2005. The encoding of such databases might be the following: DB 1 = ({st04(·)}, {st04(john)}), DB 2 = ({st05(·)}, {st05(mary), st05(john)}). C. Baral et al. (Eds.): LPNMR 2005, LNAI 3662, pp. 132–144, 2005. c Springer-Verlag Berlin Heidelberg 2005
An ID-Logic Formalization of the Composition of Autonomous Databases
133
Here, DB 1 encodes the fact that John is a student first enrolled in 2004, and DB 2 encodes the facts that John and Mary are students first enrolled in 2005. Assume further that there is a set of (global) integrity constraints, stating that the first year of enrollment is unique for every student, and that someone must have been enrolled already in 2003. That is, ∀XYZ enr(X, Y ) ∧ enr(X, Z) → Y = Z IC = . ∃Xenr(X, 2003) A proper integration system is expected to take the following actions in this case: a) remove the information that John was first enrolled in 2004 or the information that he was first enrolled in 2005 (but not both!) b) insert a fact that some student other than John or Mary was first enrolled in 2003. Note that in order to accomplish this task, the mediator system should be able to cope with the following challenges: 1. relate the different terminologies of the local databases and that of the global integrity constraints, 2. identify inconsistencies (i.e., violations of integrity constraints) and resolve them by making some (minimal amount of) changes in the unified database, 3. search for solutions that may lie outside the active domain of the databases (in order, e.g., to satisfy the second constraint above). We call the whole process described above database composition. In this paper we present a composition system that generalizes the schema integration process introduced in [30] and at the same time enhances the abductive system for data integration introduced in [3], by using the same logical formalism. The outcome is a uniform solution for database composition, which to the best of our knowledge is more comprehensive (with respect to the expressive power of the underlying language, the amount of integration methods that are supported, and the mediation capabilities mentioned in Example 1) than any other approach implemented by similar systems.
2 Preliminaries 2.1 ID-logic ID-logic [12,13] is a knowledge representation formalism extending classical first-order logic with non-monotone inductive definitions. It is motivated by the realization that (inductive) definitions are a distinctive form of human knowledge and are often encountered in mathematical practice. At the same time, inductive definitions cannot easily be expressed in classical logic (for instance, the transitive closure of a graph is one of the simplest concepts typically defined by induction but it is well-known that this concept cannot be defined in first-order logic).
134
B. Van Nuffelen et al.
The language of ID-logic uses the well-founded semantics [28] to extend classical logic with a new ‘inductive definition’ primitive, and as such it allows even nonmonotone inductive definitions to be correctly formalized in an intuitive way. It has also been shown that ID-logic is able to capture the basic ideas behind different concepts and approaches in common-sense reasoning, such as the semantical foundations of situation calculus [15] and description logic [27]. As our goal here is to define composed databases in terms of the distributed ones, together with a description of the merging process, ID-logic is a natural candidate for being the underlying formalism behind such an axiomatization. Below we give the formal definition of this logic. Definition 1. An ID-logic theory T , based on a first-order language L, is a pair (D,F ), where D is a set of definitions Di (i = 1, . . . , n) and F is a set of first-order formulas. A definition D is a set of rules of the form p(t) ← B, where p(t) is an atom and B is a first-order formula. Example 2. The transitive closure of a graph can be defined by the following ID-logic definition: T ransCl(x, y) ← Edge(x, y) ∨ ∃z(T ransCl(x, z) ∧ T ransCl(z, y)). In what follows we refer to D and F as the definitions and the constraints (respectively) of T . The predicates occurring in the heads of the rules in the definitions are the defined predicates of D. All the other predicates belong to Open(D), the set of the open (abducible) predicates of D. Definition 2. A structure M is a model of a definition D iff there exists an interpretation I of Open(D) such that M is the two-valued well-founded model [28] of D that extends I. A structure M is a model of D iff M is a model of each D ∈ D. Definition 3. A structure M is a model of an ID-logic theory T =(D,F ) iff M is a model of D and satisfies all formulas of F . The collection of all models of T is denoted by mod(T ). We say that a formula ψ is satisfied by an ID-logic theory T if there is a model of T that satisfies ψ. A formula ψ follows from T if every model of T satisfies ψ. The following notation will be useful in what follows: Definition 4. For two ID-logic theories T1 , T2 over the same language L, the composed theory T1 ◦ T2 is an ID-logic theory T over L, obtained by the pairwise union of both theories: T = T1 ◦ T2 = (D1 , F1 ) ◦ (D2 , F2 ) = (D1 ∪ D2 , F1 ∪ F2 ). Proposition 1. mod(T1 ◦ T2 ) = mod(T1 ) ∩ mod(T2 ). 2.2 Database Composition In this section we formally define the problem under consideration and its solutions. Definition 5. A database is a pair DB = (L, D), where the database language L is a first-order language based on a vocabulary consisting of the predicate symbols in a fixed database schema S and a finite set Dom of constants representing the elements of the domain of discourse. The database instance D is a finite set of ground atoms in the language L.
An ID-Logic Formalization of the Composition of Autonomous Databases
135
The semantics of a database instance is given by the conjunction of the atoms in D augmented with the Unique Name Assumption (UNA(Dom)), i.e., different constants represent different objects, and the Closed World Assumption (CWA(D)) that assures that each atom which is not explicitly mentioned in D is false. Often, the Domain Closure Assumption (DCA(Dom)) is also imposed, meaning that all elements of the domain of discourse are named by constants in Dom.1 The meaning of a database instance under these assumptions is formalized in a model theoretical way by the least Herbrand model semantics. Definition 6. A composition problem is a pair (D, C), where the set of resources D is a non-empty set of (local) databases DBi = (Li , Di ), i = 1, . . . , n, and the (global) integrity constraints C = (LG , IC) consists of a (possibly empty) set IC of first-order formulae in a first-order (global) language LG . Given a composition problem (D, C), our goal is therefore to construct a composed (global) database DB G = (LG , DG ) such that its database instance DG contains the translation to LG of data-facts that appear in database instances of elements in D, provided that these data facts do not violate the integrity constraints in IC. Clearly, this database instance should ‘gather’ from the local databases as much information as consistently possible, that is, it should be ‘as close as possible’ to i=1,...,n Di , without violating IC. Example 3. Consider again Example 1. The composition problem in this case consists of two databases, DB1 and DB 2 , that should be composed under the integrity constraints in IC. When LG = {enr(X, Y )} is the language of the composed database (meaning that a student X was first enrolled in a year Y ), the two best composed database instances are the following: DG1 = enr(mary, 2005), enr(john, 2005), enr(u, 2003) DG2 = enr(mary, 2005), enr(john, 2004), enr(u, 2003) where u is a (Skolem) constant, different from mary and john. When Dom consists only of mary and john, DCA(Dom) excludes the two solutions above, and the composed database instances are the following (see also Example 5): DG3 = enr(mary, 2005), enr(john, 2003) DG4 = enr(john, 2005), enr(mary, 2003) DG5 = enr(john, 2004), enr(mary, 2003) Note that other compositions of DB1 and DB 2 are less intuitive in this case. For instance, D∗ = {enr(john, 2003)} requires more revisions in the original assumptions than DG3 , and so DG3 is ‘closer’ to D1 ∪ D2 than D∗ . In what follows we shall describe how to define ID-logic theories that represent the composition problems under consideration (Section 3) and how to reason with these theories in order to compute composed databases for the given composition problems (Section 4). 1
This assumption is sometimes lifted when constants outside Dom should be introduced; see e.g. Examples 3 and 5 below.
136
B. Van Nuffelen et al.
3 The Composition Theory In what follows we assume that all the databases share the same domain Dom (this will simplify the presentation, as the implicit assumptions UNA(Dom) and DCA(Dom) can be imposed globally) and that all the languages are mutually distinct (to assure this, one can annotate the predicate names with the source identities). Definition 7. A mediator system for a composition problem (D, C) is a quadruple M = L, CP, SI, DI , where: – L is the union of the source languages Li , the global language LG , and the auxiliary predicates defined below. – CP = {S1 , . . . , Sn , IC}, the composition problem description, is a set of ID-logic theories Si encoding the source databases (i.e., the database instances Di of the databases in D), and an ID-logic theory IC encoding the global integrity constraints IC in C (see Section 3.1). – SI = {M1 , . . . , Mn , K}, the schema integration specification, is a set of ID-logic theories Mi encoding the relations between the source languages Li and the global language LG , and an ID-logic theory K encoding additional information about the relations among the schemas (see Section 3.2). – DI = {Comp, Trans}, the data integration specification, is a set of ID-logic theories that specify how to make the combined database consistent with the set IC of integrity constraints in C (see Section 3.3). A composition theory for a mediator system M is an ID-logic theory TM = TSI ◦ TDI in L, where TSI = S1 ◦ · · · ◦ Sn ◦ M1 ◦ · · · ◦ Mn ◦ K and TDI = IC ◦ Comp ◦ Trans. In the rest of this section we consider in further details the components of a mediator. 3.1 Representation of the Composition Problem Let ({(L1 , D1 ) , . . . , (Ln , Dn )} , (LG , IC)) be a composition problem. – The encoding of a source database instance Di (1 ≤ i ≤ n) in CP is the ID-logic theory Si = ({{Di }} , ∅), where Di is the enumeration of the facts in Di . – The encoding of the global integrity constraints IC in CP is the ID-logic theory IC = (∅, {IC}), where IC is obtained by interpreting the integrity constraints IC as an enumeration of formulae in LG , and substituting every occurrence of a predicate p(t) by fact(p(t)).2 3.2 Representation of Schema Integration The component SI of a mediator system describes the relationships between the source languages Li and the global language LG . These relationships are expressed in the form of (inductive) definitions, taking into account the ontological relationships between the predicates and the actual knowledge of the source. For a proper description of such relations, one has to take into consideration the following cases: 2
The need of this substitution will become apparent in Section 3.3.
An ID-Logic Formalization of the Composition of Autonomous Databases
137
1. Suppose that the set of rules {p(t) ← Bi | i = 1 . . . k} only partially defines a predicate p. A complete definition can be obtained by adding a rule p(s) ← p∗ (s), in which the auxiliary open predicate p∗ represents all the tuples in p that are not defined by any of the bodies Bi . 2. Sometimes a body of a rule p(t) ← B is too general, i.e., it includes tuples not intended to be in the predicate p. In this case it is possible to add to the body B an auxiliary open predicate ps that filters the extraneous tuples. The completed rule in this case is p(t) ← B ∧ ps (t). Auxiliary predicates help to relate different languages and to complete partial information. As such, they serve as open (abducible) predicates. Definition 8. A language mapping from a language L1 to a language L2 is an IDlogic theory (R1→2 , IC1,2 ), where R1→2 defines the predicates of L2 in terms of the predicates of L1 and the necessary auxiliary predicates, and IC1,2 formulates generic integrity constraints on the auxiliary predicates. In terms of the last definition, the elements M1 , . . . , Mn of SI are the language mappings between the source languages and the global language. The first component of each one of these mappings Mi may be of one of the following two forms: – Ri→G . In this case the predicates of global language LG are defined in terms of the predicates of a local language (Li in this case). This mapping corresponds to the Global as View (GAV) approach in schema integration (see, e.g., [26]). – RG→i . In this case the language Li of a local source is defined in terms of the global language LG . This mapping corresponds to the Local as View (LAV) approach in schema integration (see [21]). Most of the systems that are introduced in the literature support only one type of the schema integration methods described above. In our case it is clear that one may use both kinds of language mappings in the same theory, and so imitate both GAV and LAV by the same mediator system. Example 4. Consider the source languages L1 = {st05(·)} and the global language LG = {enr(·, ·)}, where st05(·) represents (some) students that are first enrolled in 2005 and enr(·, ·) represents all students with their first year of enrollment. According to the LAV approach, a mapping M1 = (RG→1 , ICG,1 ) between these languages could be the following ID-logic theory: {{st05(X) ← enr(X, 2005) ∧ st05s (X).}}, , {∀X(st05s(X) → enr(X, 2005))} where st05s (·) represents the students known by the source and the integrity constraint expresses that this is a subset of all students enrolled in 2005. Similarly, a GAV mapping M1 = (R1→G , IC1,G ) could be, e.g., the following ID-logic theory: {{enr(X, Y ) ← (st05(X) ∧ Y = 2005) ∨ enr∗ (X, Y ).}}, , ∀XY (enr∗ (X, Y ) → ¬(st05(X) ∧ Y = 2005)) where enr∗ (·, ·) represents the students not known by the source, and the integrity constraint imposes that enr∗ (·, ·) does not duplicate the information from the source.
138
B. Van Nuffelen et al.
The remaining element in SI, denoted by K, contains some additional information about the predicates and the interrelations. In the above example, for instance, one may know that the source has complete information about all students enrolled in 2005, so now st05(·) should represent all the students first enrolled in 2005. This can be expressed by the constraint ∀Xenr(X, 2005) ↔ st05(X). In the LAV approach it implies that the relation st05s (·) is empty (and could be omitted in the language mapping); in the GAV approach, it implies that enr∗ (·, ·) cannot have tuples with the year 2005. 3.3 Representation of Data Integration The data integration specification DI is a specification of how the database instances should be integrated such that no integrity constraint will be violated. It makes sure that if the set D = Di of all the local databases (translated to the global schema) preserves all the integrity constraints in IC (notation: D |= IC),3 then the global database instance DG will be equal to this set. Otherwise, some (minimal amount of) data-facts should be inserted to- or retractedfrom this union in order to restore its consistency with respect to IC. In other words, Di should be ‘repaired’: Definition 9. [1] A repair of a database instance D with respect to a set IC of integrity constraints is a pair (Insert, Retract), such that: (1) Insert ∩ D = ∅, (2) Retract ⊆ D,4 and (3) ((D ∪ Insert) \ Retract) |= IC. Intuitively, Insert is a set of elements that should be inserted to D and Retract is a set of elements that should be removed from D in order to assure that D is consistent with IC. This is represented by the following ID-logic theory (the composer): ⎞ ⎛
fact(X) ← db(X) ∧ ¬retract(X). ,⎟ ⎜ fact(X) ← insert(X). ⎟,
Comp = ⎜ ⎝ ∀X ¬(insert(X) ∧ db(X)) ⎠ ∀X db(X) ← retract(X) where db(X) denotes in the global language that X is a data-fact, and fact(X) denotes that the data-fact X should appear in the global database. Here, insert and retract are open (abducible) predicates that describe repairs. The last two formulas of Comp assure that conditions (1) and (2) in Definition 9 will hold.5 As there are usually many ways to repair a given database, it is often convenient to make preferences among the possible repairs, and consider only the most preferred ones. Below are two common preference criteria for preferring a repair (Insert, Retract) over a repair (Insert , Retract ): Definition 10. Let (Insert, Retract) and (Insert , Retract ) be two repairs of a database. – set inclusion preference criterion: (Insert, Retract) ≤i (Insert , Retract ), if Insert ⊆ Insert and Retract ⊆ Retract 3 4 5
That is, every formula in IC is satisfied in the least Herbrand model of D. Note that by conditions (1) and (2), Insert ∩ Retract = ∅. The third condition of Definition 9 is imposed by the theory IC as defined in Section 3.1.
An ID-Logic Formalization of the Composition of Autonomous Databases
139
– minimal cardinality preference criterion: (Insert, Retract) ≤c (Insert , Retract ), if |Insert|+|Retract| ≤ |Insert |+|Retract | If D |= IC, then (∅, ∅) is the only ≤i - and ≤c -preferred repair of D, as expected. The second component of DI is the translator, Trans. It represents all the translated data-facts in terms of one (global) language: Trans = ({{db(p1 (t)) ← p1 (t), . . . , db(pG (t)) ← pG (t)}}, ∅) where p1 , . . . , pG are the predicates of the global language LG . The translator reifies the database predicates, i.e., it converts the database facts into terms of the predicate db.6 For reducing notational complexity, we use the same symbols for the predicates and their reifications (e.g., in Trans above, the pi appearing on the left-hand side of the implications are the reified symbols of the predicates pi on the right-hand side of the same implications). Note that the predicate fact of the composer represents which one on these new ‘fact’-terms appears in the composed database. 3.4 Back to the Canonical Example A composition theory for Example 1 may be the following: • The schema integration theory TSI is a composition of S1 , S2 ,M1 , and M2 (in this case K is assumed to be empty): ⎫ ⎛⎧ ⎞ st04(john). ⎪ ⎪ ⎪ ⎪ ⎪ ⎪
⎪ ⎜⎪ ⎟ ⎪ ⎪ st05(mary). ⎪ ⎜⎪ ⎟ ⎪ ⎪ ⎪ ⎜⎪ ⎟ ⎪ st05(john). ⎪ ⎪ ⎜⎪ ⎟ ⎨ ⎬ ⎜ ⎟ ⎜ ⎟ enr(X, Y ) ← st04(X) ∧ Y = 2004. , ⎜⎪ ⎟ ⎪ ∗ ⎪ ⎜⎪ ⎟ enr(X, Y ) ← enr (X, Y ). ⎪ ⎪ 1 ⎪ ⎜⎪ ⎟
⎪ ⎪ ⎪ ⎜⎪ ⎟ ⎪ ⎪ enr(X, Y ) ← st05(X) ∧ Y = 2005. ⎪ ⎜⎪ ⎟ ⎪ ⎪ ⎪ ⎜⎪ ⎟ ∗ ⎩ ⎭ enr(X, Y ) ← enr2 (X, Y ). ⎜ ⎟ ⎜ ⎟ ⎝ ∀XY (enr∗ (X, Y ) → ¬(st04(X) ∧ Y = 2004)). ⎠ 1 ∀XY (enr2∗ (X, Y ) → ¬(st05(X) ∧ Y = 2005)). The definitions of TSI are from the theories S1 , S2 , M1 , and M2 ; the constraints are from M1 and M2 . • The data integration theory TDI is the following composition of IC, Comp and Trans: ⎛⎧ ⎞ ⎫ ⎨ fact(X) ← db(X) ∧ ¬retract(X). ⎬ ⎜ ⎟ , ⎜ ⎩ fact(X) ← insert(X). ⎟ ⎭ ⎜ ⎟ db(enr(X, Y )) ← enr(X, Y ). ⎜ ⎟ ⎫⎟ ⎜⎧ ⎜ ⎪ ∀X¬(insert(X) ∧ db(X)). ⎟ ⎪ ⎪ ⎜⎪ ⎬⎟ ⎜ ⎨ ∀Xdb(X) ← retract(X). ⎟ ⎜ ⎟ ⎝ ⎪ ∀XY Z (fact(enr(X, Y )) ∧ fact(enr(X, Z)) → Y = Z). ⎪ ⎠ ⎪ ⎪ ⎩ ⎭ ∃Xfact(enr(X, 2003)). The definitions of TDI are from Comp (the first two) and Trans (the third one); the constraints of TDI are from Comp (the first two) and IC (the last two). 6
See [7] for a description of reifications in the context of knowledge representation.
140
B. Van Nuffelen et al.
4 Reasoning with Composed Databases Query answering is probably the main task of a mediator system. In order to compute answers from a composition theory in our context, the underlying ID-logic theory should be converted to an equivalent theory in answer set programming (ASP) or abductive logic programming (ALP), which are the two available methods of reasoning with ID-logic theories. By this, corresponding off-the-shelf solvers (such as the ASP systems dlv [17] and sModels [25], or the ALP solver Asystem [3,20,29]) can be utilized for the query answering. Below we consider both options. Abductive Logic Programming An ID-logic theory can be converted to an equivalent abductive normal logic program (see [29] for a detailed description of this process), and then processed by solvers for reasoning with abductive theories. We have implemented our approach for database composition by such a solver, called Asystem [3,20,29].7 The Asystem computes interpretation of the abducible predicates of a given ID-logic theory8 by executing the abductive refutation procedure SLDNFA (an extension of SLD-resolution for programs with Negation as Failure operators and Abducible predicates; see [14]). It therefore constructs an explanation formula E, in terms of the open predicates of T , that entails a query Q. Formally: Definition 11. An abductive solution for an ID-logic theory T and a query Q is a pair (∆, E), where ∆ is a set of abducible atoms and E is the conjunction of the elements in ∆, such that T |= ∃x E(x) and T |= ∀x (E → Q)(x). In our case, the computed explanation formula E describes a class of models of T . When E is true, the query is satisfiable with respect to all the models. When the Asystem is unable to find an abductive solution for Q, then T |= ∀(¬Q). SLDNFA is a sound proof procedure for abductive normal logic programs under the (three-valued) completion semantics. Under certain conditions it is also complete (see [14]) and always terminates (see [31]).9 These properties are inherited by the Asystem, which is also equipped with a component that discards non-optimal solutions, called the optimizer. Given a preference criterion on the solution space, the optimizer computes only the most-preferred (abductive) solutions by pruning ‘on the fly’ those branches of the search tree that lead to solutions that are worse than others that have already been computed. This is actually a branch and bound ‘filter’ that speeds-up execution and makes sure that only the desired solutions will be obtained. If the preference criterion is a pre-order (as those of Definition 10), the optimizer is complete, that is, it can compute all the optimal solutions (as illustrated in Example 5 below). We refer to [3,29] for a detailed description of the abductive inference process implemented by the Asystem. 7 8 9
See also http://www.cs.kuleuven.ac.be/∼dtai/kt/systems-E.shtml. These interpretations uniquely determine the models of the theory; see Definitions 2 and 3. This is the case, for instance, when the underlying logic programs are hierarchical, or abductive non-recursive
An ID-Logic Formalization of the Composition of Autonomous Databases
141
Example 5. Consider again the composition theory TM = TSI ◦TDI given in Section 3.4 for the running example. By TSI we derive the atoms enr(john, 2004), enr(john, 2005), enr(mary, 2005), which is the translation of the local data in terms of the global language. Now, both integrity constraints in IC are violated, so the data should be repaired. Indeed, by TDI and ≤c -optimizer, the following repairs are obtained: – retract(enr(john, 2004)), insert(enr(u, 2003)) for u ∈ {john, mary}, – retract(enr(john, 2005)), insert(enr(u, 2003)) for u ∈ {john, mary}. With an ≤i -optimizer, three more solutions are obtained: – retract(enr(john, 2004)), retract(enr(john, 2005)), insert(enr(john, 2003)) – retract(enr(mary, 2005)),retract(enr(john,2004)),insert(enr(mary, 2003)) – retract(enr(mary, 2005)),retract(enr(john,2005)),insert(enr(mary, 2003)) The global database instances in this case are, respectively, – – – – –
{enr(u, 2003)), enr(john, 2005)), enr(mary, 2005))}, {enr(u, 2003)), enr(john, 2004)), enr(mary, 2005))}. {enr(john, 2003)), enr(mary, 2005))}. {enr(mary, 2003)), enr(john, 2005))}. {enr(mary, 2003)), enr(john, 2004))}.
The first two solutions are obtained since the Asystem does not impose the domain closure assumption DCA(Dom). This allows to compute solutions outside the least Herbrand model of the problem, and so to suggest explanations for database inconsistency, which could not be captured otherwise. Answer Set Programming An ID-logic theory in which each variable occurring in a formula is delimited by a range (domain) relation is called a strongly range-restricted theory. In [23] it is shown that strongly range-restricted ID-logic theories can be transformed to equivalent logic programs under the stable model semantics. This implies that ASP solvers may also be incorporated for reasoning with ID-logic-based mediator systems. ALP and ASP have a lot in common, and they are often viewed as different variations of the same paradigm. In particular, both approaches compute (minimal) models of the theory. Still, in opposed to the ALP approach, which is a local inference procedure that selects only the information which is relevant for the query, ASP is a global reasoning tool for processing ground theories. ASP requires finite domains and imposes the domain closure axiom. As a consequence, this method is conceptually less suitable for reasoning about tasks which need to go outside the Herbrand space, and it is inherently less scalable (in terms of the size of the databases) than ALP.10 Note, however, that grounding to finite theories ensures the termination of the ASP computations. 10
In Example 5, for instance, ASP solvers will not produce the two repairs that contain the Skolem constant u.
142
B. Van Nuffelen et al.
A simple work around that allows to lift the domain closure assumption posed by the ASP approach is to iteratively add new Skolem constants to the Herbrand domain and check for solutions in the new domains. However, a problem with this naive generateand-test approach is that one needs a criterion to know whether all the solutions have been found. In case of a preference condition, the number of the Skolems constants used in a solution allows to derive a lower bound on its cost, which could likely be the basis for a terminating condition. Note that in certain cases (e.g., when no insertions are allowed to restore consistency), all the solutions are already inside the Herbrand domain, and so ASP and ALP solvers will terminate.
5 Concluding Remarks In this paper we have developed a formal declarative foundation for representing and reasoning with independent databases that contain information about a common domain, but may have different schemas and may contradict each other. This problem, known as database composition, is represented by ID-logic theories that mediate among the ontologies of the sources, and resolve contradictions between local information and global constraints. It is important to note that this paper is mainly concerned with the representation aspects of this problem, showing that different ingredients of it can be expressed in a natural and intuitive way by a single logical formalism. In this context, we have elaborated on the following advantages of our approach: – The underlying logic extends classical logic with inductive definitions, and as such it can be viewed as an expressive form of a description logic.11 In particular, our approach is more expressive than similar approaches that are based on description logics. – Unlike some other approaches of data integration, no syntactical restriction is imposed on the integrity constraints (which can be any set of first-order formulas). – The inherent modularity of ID-logic allows to represent different aspects of the same problem (that is, schema and data integration) in different modules. In other formalisms (e.g., ALP, ASP, or description logics) these aspects are mixed in one complex theory. – The representation methodology is tolerant to the structure of the autonomous databases. For instance, the composition theory described in Section 3 may be easily modified in case that a certain source of information is added or dropped. – Different types of schema integration are supported (e.g., GAV and LAV), as well as their combinations and corresponding extensions, such as the generalized LAV approach (GLAV) [19] and Both-as-View approach (BAV) [24]. Other benefits of our framework, which are related to computation aspects of data integration, are hinted in Section 4. Below we list two of them: 12 11 12
See [27] for more information about the relation between ID-logic and description logics. The full details are beyond the scope (and the space limitations) of this paper. Still, as noted in Section 4, the properties below are obtained by straightforward generalizations or adaptations to our context of the techniques described in [3] (for ALP) and [23] (for ASP).
An ID-Logic Formalization of the Composition of Autonomous Databases
143
– Different types of query answering are supported. I.e., skeptical query answering (also called certain answering), in which a query is true iff it is entailed by every composed database, or credulous query answering, in which a query is true iff it is entailed by some composed database. – Different notions of optimal repairs (e.g., set inclusion, minimal cardinality, minimization of the amount of inserted data-facts, and so forth) are dealt with through preferential semantics. As noted above, the mediator systems considered here may be implemented by a variety of off-the-shelf solvers. Several other implementations have been introduced for the kind of problems we are dealing with here. Among the implementations of schema integration are the abductive GAV-based system of [9] and the LAV-based information manifold system of [21]. Systems for data integration are, e.g., BReLS [22] and the data repair system of [18]. We provide here a uniform framework for both kinds of integrations. Recently, some other implementations of schema and data integration have been introduced, e.g., [8] and [10]. These approaches are based on representation platforms that are more restricted than ours, as they implement only particular kinds of schema mapping styles, limit the syntactic structure of the integrity constraints, and impose the domain closure assumption. A detailed investigation of the properties of particular computational models for our framework is beyond the scope of the current paper. We refer to [11,16] for a discussion on some computational aspects (e.g, complexity and decidability) of the kinds of problems considered here. Other topics for future elaboration include incorporation of temporal information in the databases, handling of conflicts among integrity constraints, and a study of other merging policies (such as merging by majority vote).
References 1. M. Arenas, L. Bertossi, and J. Chomicki. Consistent query answers in inconsistent databases. In Proc. PODS’99, pages 68–79, 1999. 2. M. Arenas, L. Bertossi, and J. Chomicki. Answer sets for consistent query answering in inconsistent databases. Theory and Practice of Logic Programming, 3(4–5):393–424, 2003. 3. O. Arieli, M. Denecker, B. Van Nuffelen, and M. Bruynooghe. Coherent integration of databases by abductive logic programming. Artif. Intelligence Research, 21:245–286, 2004. 4. O. Arieli, M. Denecker, B. Van Nuffelen, and M. Bruynooghe. Database repair by signed formulae. In Proc. FoIKS’04, LNCS 2942, pages 14–30, 2004. 5. C. Baral, S. Kraus, and J. Minker. Combining multiple knowledge bases. IEEE Trans. on Knowledge and Data Enginnering, 3(2):208–220, 1991. 6. C. Batini, M. Lenzerini, and S. B. Navathe. A comparative analysis of methodologies for database schema integration. ACM Computing Surveys, 18(4):323–364, 1986. 7. R. Brachman and H. Levesque. Knowledge representation and Reasoning. Morgan Kaufmann, 2004. 8. L. Bravo and L. Bertossi. Logic programming for consistently querying data integration systems. In Proc. IJCAI’03, pages 10–15, 2003. 9. S. Bressan, C. H. Goh, K. Fynn, M. Jakobisiak, K. Hussein, H. Kon, T. Lee, S. Madnick, T. Pena, J. Qu, A. Shum, and M. Siegel. The context interchange mediator prototype. In Proc. PODS’97, pages 525–527. ACM, 1997.
144
B. Van Nuffelen et al.
10. A. Cal`ı, D. Calvanese, G. De Giacomo, and M. Lanzerini. Data integration under integrity constraints. Information Systems, 29(2):147–163, 2004. 11. A. Cal`ı, D. Lembo, and R. Rosati. On the decidability and complexity of query answering over inconsistent and incomplete databases. In Proc. PODS’03, pages 260–271. ACM, 2003. 12. M. Denecker. Extending classical logic with inductive definitions. In Proc. CL’2000, LNCS 1861, pages 703–717. Springer, 2000. 13. M. Denecker, M. Bruynooghe, and V. Marek. Logic programming revisited: logic programs as inductive definitions. ACM Trans. on Computational Logic, 2(4):623–654, 2001. 14. M. Denecker and D. De Schreye. SLDNFA an abductive procedure for abductive logic programs. Journal of Logic Programming, 34(2):111–167, 1998. 15. M. Denecker and E. Ternovska. Inductive situation calculus. In Proc. KR’04, pages 545–553. Morgan Kaufmann Publishers, 2004. 16. T. Eiter, M. Fink, G. Greco, and D. Lembo. Efficient evaluation of logic programs for querying data integration systems. In Proc. ICLP’03, LNCS 2916, pages 163–177. Springer, 2003. 17. T. Eiter, N. Leone, C. Mateis, G. Pfeifer, and F. Scarcello. The KR system dlv: Progress report, comparisons and benchmarks. In Proc. KR’98, pages 406–417, 1998. 18. E. Franconi, A. Palma, N. Leone, D. Perri, and F. Scarcello. Census data repair: A challenging application of disjunctive logic programming. In Proc. LPAR’01, LNCS 2250, pages 561–578. Springer, 2001. 19. M. Friedman, A. Y. Levy, and T. D. Millstein. Navigational plans for data integration. In Proc. 16th. AAAI, pages 67–73, 1999. 20. A. Kakas, B. Van Nuffelen, and M. Denecker. A-system : Problem solving through abduction. In Proc. IJCAI’01, pages 591–596, 2001. 21. A. Levy, A. Rajaraman, and Ordille J.J. Querying heterogeneous information sources using source descriptions. In Proc. VLDB-96, pages 251–262, 1996. 22. P. Liberatore and M. Schaerf. BReLS: A system for the integration of knowledge bases. In Proc. KR’2000, pages 145–152. Morgan Kaufmann Publishers, 2000. 23. M. Mari¨en, D. Gilis, and M. Denecker. On the relation between ID-logic and answer set programming. In Proc. JELIA’04, LNCS 3229, pages 108–120. Springer, 2004. 24. P. McBrien and A. Poulovassilis. Data integration by bi-directional schema transformation rules. In Proc. 19th ICDE. IEEE, 2003. 25. P. Simons, I. Niemel¨a, and T. Soinien. Extending and implementing the stable model semantics. Artificial Intelligence, 138(1–2), 2002. 26. J. Ullman. Information integration using logical views. Theoretical Computer Science, 239(2):189–210, 2000. 27. K. Van Belleghem, M. Denecker, and D. De Schreye. A strong correspondence between description logics and open logic programming. In Proc. ICLP’97, pages 346–360, 1997. 28. A. Van Gelder, K. A. Ross, and J. S. Schlipf. The well-founded semantics for general logic programs. Journal of the ACM, 38(3):620–650, 1991. 29. B. Van Nuffelen. Abductive constraint logic programming. PhD thesis, Katholieke Universiteit Leuven, 2004. 30. B. Van Nuffelen, A. Cort´es-Calabuig, M. Denecker, O. Arieli, and M. Bruynooghe. Data integration using ID-logic. In Proc. CAiSE’04, LNCS 3084, pages 67–81. Springer, 2004. 31. S. Verbaeten. Termination analysis for abductive general logic programs. In Proc. ICLP’99, pages 365–379. MIT Press, 1999.
On the Local Closed-World Assumption of Data-Sources Alvaro Cort´es-Calabuig1, Marc Denecker1 , Ofer Arieli2 , Bert Van Nuffelen1 , and Maurice Bruynooghe1 1
2
Department of Computer Science, Katholieke Universiteit Leuven, Belgium {Alvaro, Marc.Denecker, Bert.VanNuffelen, Maurice.Bruynooghe}@cs.kuleuven.ac.be Department of Computer Science, The Academic College of Tel-Aviv, Israel [email protected]
Abstract. The Closed-World Assumption (CWA) on a database expresses that an atom not in the database is false. The CWA is only applicable in domains where the database has complete knowledge. In many cases, for example in the context of distributed databases, a data source has only complete knowledge about part of the domain of discourse. In this paper, we introduce an expressive and intuitively appealing method of representing a local closed-world assumption (LCWA) of autonomous data-sources. This approach distinguishes between the data that is conveyed by a data-source and the meta-knowledge about the area in which these data is complete. The data is stored in a relational database that can be queried in the standard way, whereas the metaknowledge about its completeness is expressed by a first order theory that can be processed by an independent reasoning system (for example a mediator). We consider different ways of representing our approach, relate it to other methods of representing local closed-word assumptions of data-sources, and show some useful properties of our framework which facilitate its application in real-life systems.
1
Introduction and Motivation
In recent years, information integration has attracted considerable attention from the AI and databases communities. Generally speaking, the idea is, given a set of independent data-sources, to characterize the collective knowledge represented by them in terms of a uniform vocabulary, called the global schema, and then to exploit this information to obtain correct answers from the whole system (see [8] for a detailed description of this problem, and [1,9,14] for some particular solutions for it). An important aspect of this research is to arrive at an exact description of the information endorsed by each and every data-source in the system. Typically, a data-source stores a database consisting of a set of tuples. In standard database settings, the information held by the data-source would be
This work is supported by FWO-Vlaanderen, European Framework 5 Project WASP, and by GOA/2003/08.
C. Baral et al. (Eds.): LPNMR 2005, LNAI 3662, pp. 145–157, 2005. c Springer-Verlag Berlin Heidelberg 2005
146
A. Cort´es-Calabuig et al.
expressed by the conjunction of atoms together with the closed-world assumption [13]. The CWA expresses the communication agreement that an atom that does not appear in the database is false. However, it is clear that the CWA can only be applied when the database contains complete knowledge of the domain of discourse. In a context of distributed data-sources this assumption is inherently inappropriate since a consideration of a certain data-source as a single and complete representation of the world either completely discards the other sources of information or causes contradictions among them. For this reason, some existing approaches have applied an open-world assumption [3,11], interpreting a datasource just as the conjunction of atoms in the database. However, we find that this does not allow to grasp more refined information that is held in distributed data systems (sometimes called mediator-based systems). We illustrate this in the following example. Example 1. Consider a distributed traffic tax administration system, in which there is one data-source for each county, maintaining a database of car owners in that county. There is a protocol amongst the different counties so that when a car owner leaves one county A to live in another county B, then county A immediately transfers its information to county B, while still preserving a record of the car owner and its current status for a certain period of time, to handle all running tax demands. By the nature of the protocol, we may assume that each data-source has complete knowledge about all car owners in its county, but in general it has more information than that. Part of the tables of a particular county, say Bronx, may look as follows:
Name Peter Steward John Smith Mary Clark
Car Owners Model Mercedes 320 Volvo 230 BMW 550
CarID Qn-5452 Bx-5242 Bx-5462
Location Name Residence Peter Steward Queens Mary Clark Bronx John Smith Bronx
By the nature of the distributed system, this data-source has an expertise on car owners of Bronx. This meta-knowledge allows to derive further information that is not explicitly stated in the data-source, e.g. that all people that are recorded in the table Location as residents of Bronx, are actually all the car owners from that county. However, as the information about car owners in Queens is not complete in this data-source, one should not rely only on the tables of this source for making further conclusions about that county. The example above shows that when the information is distributed over several independent data-sources, a different approach is needed in order to properly capture the meaning of a particular data-source. While in distributed information systems, data-sources usually have only partial knowledge about the domain of discourse, still it is often the case that a particular source is an expert about a specific area and has complete knowledge about it. We call this area the window of expertise of the data source. It follows that to express the information
On the Local Closed-World Assumption of Data-Sources
147
held by a data source, the explicit data recorded in the data-source has to be complemented by a meta-information that describes this window of expertise. These two kinds of information should be separated as much as possible, so that one may still consider data-sources as relational databases, and process the information about their completeness by an independent reasoning system. Following these guidelines, we represent the meta-information about the completeness of a data-source by a theory that consists of several local closed-world assumptions (LCWA) [4]. A LCWA refines the closed-world assumption by specifying for a certain predicate an area in which the data source contains all true tuples of the predicate. In our approach, the semantics of a LCWA is expressed by a first-order formula of a uniform syntactical form. Specifically, the contribution of this paper is the following: • A new method for representing local closed-world assumptions is introduced. Unlike other methods for expressing such assumptions, conceived e.g. in [2,4], which are tailored for intelligent agents, our notion of LCWA is specifically devised for describing complete knowledge in relational data-sources that are part of mediator systems. This allows, in particular, to formally define the meaning of each and every data source in such systems. • The representation of the local closed-world assumption considered here allows to distinguish between the explicit data of the source and the external (implicit) information about its completeness. This separation allows to query a data-source in the standard way, whereas the knowledge about its completeness can be independently processed by the mediator system. • We present two equivalent representations of the meaning of data-sources. One representation is given in terms of first-order theories and the other one is based on circumscription [10] (which is the common approach for expressing LCWA in related works; see, e.g., [2]). This equivalence allows us to show how our proposal captures the intuition behind traditional approaches for LCWA, expressed in terms of higher-order languages, and how they can be reduced to first-order theories in case that certain conditions are met. The organization of the rest of paper is the following. In Section 2 we introduce the local closed-world assumption and use it for defining the meaning of a data-source. In Section 3 we consider an alternative approach, defined in terms of second-order, pseudo-circumscriptive formulae, and show the equivalence between the two approaches. Then, in Section 4 we give some further comments and generalizations to the local closed-world assumption, and in Section 5 we discuss some other approaches to this assumption. Section 6 concludes the paper.
2
The Local Closed-World Assumption (LCWA)
Definition 1. A data-source S is a pair Σ, D, where Σ is a vocabulary consisting of predicate symbols in a fixed relational schema R(Σ) and a finite set
148
A. Cort´es-Calabuig et al.
C(Σ) of constants representing the elements of the domain of discourse; and D is a finite set of ground atoms expressed in terms of Σ. Definition 2. Let S = Σ, D be a data-source and let P be a predicate that appears in D. Denote by P S the set of tuples of Pin D. We write P (t) ∈ P S , where t is a tuple of terms, to denote the formula a∈P S (t = a). Example 2. Let S = Σ, D be the following data-source with facts about the relations CarO(·, ·) (between people and their cars ID) and Loc(·, ·) (between people and the place they live.) CarO(JS, V231), CarO(MC, V231), CarO(MC, B342), CarO/2, Loc/2 , . Loc(JS, Qn), Loc(MC, Bx) S Here, LocS = {(JS, Qn), (MC, Bx)}, hence Loc(x, y) ∈ Loc denotes the following formula: (x = JS) ∧ (y = Qn) ∨ (x = MC) ∧ (y = Bx) .
Standard mediator systems consist of a number of data-sources collaborating with information through a common interface, the global schema [8,14]. In such context, the data-sources can be viewed as storing information, in the form of a collection of tuples, about certain domain in the real world. However, which parts of the modeled world are accurately represented in the data-source is not recorded explicitly in the system, and so the meaning of the data-source remains ambiguous. With the following definition we address this problem by characterizing through a FOL expression -using the same language of the data-sourcethe cases in which the data-source contains all the valid facts. We call this the window of expertise of the data-source, and it is represented in the following definition by the formula Ψ . Definition 3. A local closed-world assumption for a data-source S = Σ, D, is a triple LCWA = S, P , Ψ , where P = {P1 (x1 ), . . . , Pn (xn )} is a set of atoms (the LCWA’s objects) and Ψ (y) (the context
of the assumption) is a first-order n formula over Σ with free variables y s.t. y ⊆ i=1 xi . Note that in each Pi (xi ), the value of the variables xi ∩ y are constrained by Ψ . For this reason we call Ψ the window of expertise, and ∃y \ xi (Ψ ) the window of expertise of the predicate Pi . The intuitive meaning of the local closed-world assumption in Definition 3 is that for each i ∈ {1, . . . , n}, each fact Pi (xi ) that is true in the real world and which satisfies ∃y \ xi (Ψ ) should appear in the data-source. Example 3. Let S = Σ, D the data-source of Example 2. 1. S, {CarO(x, y)}, x = MC intuitively indicates that the data-source S contains all true atoms of the form CarO(x, y) for x = MC. 2. S, {CarO(x, y)}, Loc(x, Bx) indicates that S knows about all the cars of the people that live in Bx.
On the Local Closed-World Assumption of Data-Sources
149
3. S, {CarO(x, y), Loc(x, z)}, Loc(x, Bx) expresses that S contains all the data about the cars of persons living in Bx and about all people living in Bx. 4. S, {CarO(x, y), Loc(x, z)}, x = MC indicates that S has full knowledge ab -out Mary Clark (i.e., a LCWA regarding everything that is concerned with MC). Example 4. Consider the following two local closed-world assumptions: LCWAA = S, {CarO(x, y), Loc(x, z)}, CarO(x, V231) ∧ Loc(x, Bx) LCWAB = S, {CarO(x, u), Loc(y, v)}, u = V231 ∧ v = Bx Intuitively, the difference between these two expressions is that the first one expresses a full knowledge of S about car ownership and locations of V231 owners in Bronx. On the other hand, under the second assumption, the data-source knows all people having a V 321 including people not living in the Bronx; the data-source also knows all people living in the Bronx, including those that do not have a V 321. Example 5. In case of item (1) of Example 3, the local closed-world assumption may be expressed as follows: ∀x x = MC → ∀y(CarO(x, y) → y = V231 ∨ y = B342) (1) In case of item (2) of the same example, the local closed-world assumption may be expressed as follows: ∀x Loc(x, Bx) → ∀y(CarO(x, y) → y = V231 ∨ y = B342) (2) These examples lead us to the following general formulation of a local closedworld assumption in terms of first-order formulae: Definition 4. Let LCWA = S, {P1 (x1 ), . . . , Pn (xn )}, Ψ (y) be a local closedworld assumption for a data-source S. The formula that is induced from LCWA, denoted by ΛLCWA , is the following:
n ∀y Ψ (y) → ∀z Pi (xi ) → Pi (xi ) ∈ PiD where, x =
n i=1
i=1
xi , and z = x \ y.
Note that if P is empty, then ΛLCWA is tautologically true and does not specify any additional information. Example 6. Below are, respectively, the formulae that are induced from the local closed-world assumptions of items (1) and (2) in Example 3. 1. ∀x x = MC → ∀y CarO(x, y) → ((x = JS ∧ y = V231) ∨ (x = MC ∧ y = V231) ∨ (x = MC ∧ y = B342))
150
A. Cort´es-Calabuig et al.
2. ∀x Loc(x, Bx) → ∀y(CarO(x, y) → ((x = JS ∧ y = V231) ∨ (x = MC ∧ y = V231) ∨ (x = MC ∧ y = B342)) Note that under the unique name assumption (see Note 1 below), these formulae are equivalent with those of Example 5.1 Definition 5. For a data-source S = Σ, D, denote: D(S) = d∈D d. Now we are ready to define the meaning of a data-source (in the context of mediator systems): j
Definition 6. Let S = Σ, D be a data-source and let LCWAj = S, P , Ψ j , j = 1, . . . , m, be all the local closed-world assumptions of S. Then the meaning of S is given by the following formula: m
M(S) = D(S) ∧
ΛLCWAj .
j=1
Note 1. When S = Σ, D is the only data-source, the following two conditions are usually assumed: n – Domain Closure Axiom: DCA(S) = ∀x( i=1 x = Ci ) – Unique Name Axiom: UNA(S) = 1i<jn Ci = Cj where C1 , . . . , Cn are all constants in Σ. In such cases, DCA(S) and UNA(S) appear as two additional conjuncts in M(S). We denote the meaning of S by MD (S), MU (S), or MDU (S), when the first, the second or both assumptions are imposed, respectively. The meaning of a data-source can be understood as a first-order theory representing incomplete knowledge about the real world. In the general case this theory will be incomplete, so there will exist more than one model, the actual world corresponding to one of them. Consequently, the meaning of a data-source is not be interpreted with respect to its database but with respect to the real world. Given a formula Ψ , denote by ∃|x Ψ the existential quantification of all free variables in Ψ , except those in x. The next proposition shows that the formula ΛLCWA formalizes the intuitive meaning of the local closed-world assumption S, P , Ψ , as specified in the paragraph below Definition 3. Proposition 1. For S = Σ, D, let LCWA = S, {P1 (x1 ), . . . , Pn (xn )}, Ψ and LCWAi = S, {Pi (xi )}, ∃|xi Ψ i = 1, . . . n. Then: ΛLCWA ≡
n
ΛLCWAi
i=1 1
Consider, for instance, the first formula. It is of the form ∀xΦ, and the formula in Example 3–(1) is of the form ∀xΦ . For every x other than MC both Φ and Φ are trivially true, and for x = MC, both Φ and Φ hold only if there is no c ∈ {V231, B342} s.t. CarO(MC, c) is true.
On the Local Closed-World Assumption of Data-Sources
151
Proof. The equivalence is obtained by applying some simple rewriting rules on the relevant formulae. Indeed, denote x = ∪ni=1 xi and z = x \ y . Then: n ΛLCWA ≡ ∀y Ψ (y) → ∀z i=1 Pi (xi ) → Pi (xi ) ∈ PiD n D ≡ ∀y Ψ (y) → i=1 ∀z Pi (xi ) → Pi (xi ) ∈ Pi ≡ ∀y( ni=1 Ψ (y) → ∀(xi \ y) Pi (xi ) → Pi (xi ) ∈ PiD n ≡ i=1 ∀y Ψ (y) → ∀(xi \ y) Pi (xi ) → Pi (xi ) ∈ PiD n ≡ i=1 ∀(y ∩ xi ) ∃|x Ψ (y) → ∀(xi \ y) Pi (xi ) → Pi (xi ) ∈ PiD n ≡ i=1 ΛLCWAi .
Thus the equivalence is obtained.
Example 7. The assumption LCWA = S, {CarO(x, y), Loc(x, z)}, x = MC, given in Example 3-(4), which says that S has full knowledge about Mary Clark, may also be represented in a modular way by the following two expressions: LCWAA = S, {CarO(x, y)}, x = MC LCWAB = S, {Loc(x, z)}, x = MC We say that the meaning of a data-source is consistent if it has at least one model in the standard model-theoretic sense. Proposition 2. Every data-source has a consistent meaning. Proof. We consider the case where the meaning of a data-source S = Σ, D is given by M(S). The proofs for MD (S), MU (S), and MDU (S) (i.e., when any combination of DCA and UNA is also assumed) are similar. j j Let LCWAj = S, P , Ψ , j = 1, . .. , m be all the local closed-world assumptions for S. Then M(S) = A∈D A ∧ m j=1 ΛLCWAj . To show the proposition we define an interpretation I for Σ and show that it is a model of M(S). Let I be the Herbrand interpretation associated with the database of S: the domain is C(Σ) and P I = P S . By construction of I, I |= Pi (di1 , . . . , dik ) for every ground atom m in D. When Ψ j (y j ) is false in I, then trivially I |= j=1 ΛLCWAj . When Ψ j (yj ) j
true in I, then by its construction, whenever I |= P , also I |= P j (x) ∈ P S . The next proposition implies that for single data-sources our semantics of the local closed-world assumption is a conservative extension of Reiter’s closed-world assumption for relational databases; the present approach allows to express in such cases that a single data-source has complete knowledge about the world. Proposition 3. Let S = Σ, D be the only data-source and let LCWA = S, P , TRUE, where P = {P1 (x1 ), . . . , Pn (xn )} are all the predicates occurring in Σ. Then MDU (S) coincides with Reiter’s axiomatization of the closed-world assumption [13] for S.
152
A. Cort´es-Calabuig et al.
Proof. Reiter’s axiomatization of closed-world assumption of S is a first-order theory Γ , consisting of the following formulae: (1) DCA(S), (2) UNA(S), (3) the ground atomic facts in D, and (4) completion axioms for each predicate of S: ∀x(Pi (xi ) → P (xi ) ∈ PiD ), i = 1, . . . , n. By Definition 6, MDU (S) includes (1), (2) and (3), so it remains to show that LCWA = S, P , TRUE is equivalent to (4). Indeed, the formula that is induced from this assumption is n ∀x Pi (xi ) → Pi (xi ) ∈ PiD , i=1
which is equivalent to the conjunction of the formulae in (4).
3
A Circumscriptive Approach to the LCWA
In this section we consider an alternative approach to the representation of the closed-word assumption, this time by second-order formulas, and show its equivalence to the approach given in the previous section. Consider again item 1 of Example 3. The local closed-world assumption in this case could be defined also in terms of sets as follows: {y | CarO(MC, y)} = {y | CarO(MC, y) ∈ D}. Since the set on the left-hand side of this equation is always a superset of the set on the right-hand side, the condition could be rephrased as follows: {y | CarO(MC, y)} ⊆ {y | CarO(MC, y) ∈ D}. This condition is specified in terms of a set inclusion property, and it is common to express such conditions by means of circumscriptive formulae. These formulae express the aspiration that the set of tuples of a certain predicate, satisfying a certain condition, should be as minimal as possible. It is not surprising, therefore, that a variant of the notion of local closed-world assumption presented here has already been expressed in term of circumscriptive axioms (see [2] and Section 5). Definition 7. Let LCWA = S, {P1 (x1 ), . . . , Pn (xn )}, Ψ (y) be a local closedworld assumption for a data-source S = Σ, D. The pseudo-circumscriptive form of LCWA is the following (second-order) formula, denoted C(S):
∀Θ D(S)[P /Θ] → ∀y Ψ (y) → ∀z Θ P ) → ∀y Ψ (y) → ∀z(P Θ) , where x =
n i=1
xi , z = x \ y, and
– P = {P1 (x1 ), . . . , Pn (xn )}, Θ = {Θ1 (x1 ), . . . , Θn (xn )}, and each Θi (xi ) is a predicate variable with the same arity of Pi (xi ), n – P Q is an abbreviation for i=1 (Pi (xi ) → Qi (xi )). 2 2
C(S) is called pseudo-circumscriptive since it differs from a pure circumscription schema by introducing the first-order formula Ψ into the representation. Just as in Definition 4, Ψ represents the context in which P should be minimal.
On the Local Closed-World Assumption of Data-Sources
153
Definition 8. Let S = Σ, D be a data-source and let C j (S), j = 1, . . . , m be the pseudo-circumscriptive forms of its local closed-world assumptions. Denote: C(S) = D(S) ∧
m
C j (S).
j=1
Theorem 1. For every data-source S, M(S) is equivalent to C(S). Proof. We prove the theorem for the case that P and Θ are singletons, and that m = 1. The proof can be easily extended to the general case. We have to show that when D(S) holds, ∀y Ψ (y) → ∀z P (x) → P (x) ∈ P S (3) is equivalent to ∀Θ D(S) P/Θ → ∀y Ψ (y) → ∀z Θ P ) → ∀y Ψ (y) → ∀z(P Θ) , (a)
(b)
(c)
(4) where, in both cases, z = x \ y. Indeed, (⇒) Let I be a model of D(S) and (3), and consider some value ΘI in I for the predicate variable Θ. We show that if D(S)[P/Θ] is satisfied, so is the subformula (c) of (4), and hence the whole formula (4) is true as well. Let us prove, then, that sub-formula (c) holds. Assume that for some y, Ψ (y) is true in I and for some z, P (x) is true in I. As I is a model of (3), this implies that P (x) ∈ P S , i.e. for some tuple of terms c in the table of P in S, the equality x = cI holds in I. Since ΘI satisfies D(S)[P/Θ], it follows that x ∈ ΘI . (⇐) Let I be a model of D(S) and (4). From D(S) it follows that Θ P . It is obvious that Θ P implies (b). Consequently (c) holds. Assume that there exist values x such that Ψ (y) and P (x) hold in I. To prove (3) we need to show that P (x) ∈ P S ; or equivalently that there exists c ∈ P S s.t. x = cI . Because of (c) holds, it follows that x ∈ ΘI . By our choice of ΘI , this mean that for c ∈ P S , x = cI . By the last theorem, the counterparts of Propositions 1, 2, and 3 in terms of C(S) are also obtained. Note 2. It is important to note that unless the data-sources consist of sets of facts, the first-order approach and the circumscriptive approach to the LCWA do not coincide. To see this, consider S = {P/1}, {P (a) ∨ P (b)}, and the assumption LCWA = S, {P (x)}, TRUE. The formula in Definition 7 expresses a set inclusion minimization, and in this case it states an unconditional minimization of any extension of P . That is, an interpretation that satisfies both the disjunctive expression in S and the circumscriptive form of LCWA, will necessarily state that either P (a) or P (b) is true, but not both. Intuitively, this can be read as “although the data-source is not complete with respect to P , at least it knows that no other element of the domain can belong to P , except of a or b (where the ‘or’ here is interpreted exclusively)”.
154
4 4.1
A. Cort´es-Calabuig et al.
Extensions and Additional Comments on the LCWA LCWA with Several Data-Sources
An important (and intended) aspect of LCWA is applying it in a multiple-source environment. In this respect, it could be useful to specify a LCWA that addresses expertise obtained by the collective information in several data-sources. That is, LCWA = {S1 , . . . , Sn }, P , Ψ .
(5)
should represent complete knowledge, shared by sources {S1 , . . . , Sn }, in the context Ψ , about the predicates in P . The induced formula ΛLCWA of the assumption in (5) is obtained just as in the case of one data-source, when P S is modified in the obvious way as follows: Definition 9. Let Si = Σ, Di , i = 1, . . . , n be n data-sources and let P be n a Denote by P ∪Sithe set of tuples of P in
npredicate that appears in i=1 Di . ∪S i the formula a∈P ∪Si (t = a). i=1 Di , and abbreviate by P (t) ∈ P Now, the formula ΛLCWA for the LCWA in (5) is defined just as the formula for one source, where P (t) ∈ P S is replaced by P (t) ∈ P ∪Si . 4.2
Complex Forms of LCWA
As local closed-world assumptions are first-order formulae, they can be used for expressing more complex assumptions about the information endorsed by the data-sources. For instance, a context (i.e., the third component) of one LCWA may be a formula that is induced by another LCWA, and so it is possible to ’compose’ assumptions, and get, e.g., LCWA such as the following: LCWA = S2 , {Q(x)}, ΛS1 {P (x)},TRUE
(6)
Note that the formula that is induced by assumption (6) is in fact equivalent to ΛS1 ,{P (x)},TRUE → ΛS2 ,{Q(x)},TRUE , and in general, ΛS2 ,{Q(x},ΛS1 {P (x)},Ψ = ΛS1 ,{P (x)},Ψ → ΛS2 ,{Q(x)},TRUE . This idea also allows us to express more complicated assertions in terms of local closed-world assumptions. For instance, the following formula expresses that “either S1 or S2 has complete knowledge about P ”:
ΛS1 ,{P (x)},TRUE ∨ ΛS2 ,{P (x)},TRUE
Another possibility is to express that the assumptions about S1 and S2 are complementary, and so forth.
On the Local Closed-World Assumption of Data-Sources
5
155
Related Works
The concept of a local closed-world assumption was first introduced in [4], in the context of knowledge bases for agents. The idea in that work was to represent a situation in which an agent has local closed-world information relative to a formula Φ and a knowledge base Γ , by a condition saying that every ground sentence that unifies with Φ either follows from Γ or is falsified by it. Formally: LCWA (Φ) ≡ (Γ |= Φθ) ∨ (Γ |= ¬Φθ) for all ground substitutions θ. As we have noted above, a formal semantics for the definition of [4] in terms of second-order circumscription was proposed in [2]. The intuitive idea behind this semantics is the selection of only those models that satisfy the agent’s knowledgebase and that are minimal with respect to the formulae for which the agent has complete information. We note, however, that the circumscriptive approach presented in [2] allows to minimize more predicates than those allowed by the pseudo-circumscriptive formula presented here. To see this consider, for instance LCWA = S, {P (x)}, Q(x). Here, one may not know for which x, Q(x) is true, and indeed the pseudo-circumscriptive formula of the LCWA does not affect Q(x), but only P (x) in the context of Q(x). Suppose, then, that P (a) is not in S, and we do not know whether Q(a) is true, i.e. Q(a) is not in S. In our approach, all we can derive is that if Q(a) were true, then P (a) would be false; but it is also possible that P (a) is true but Q(a) is false. Following the approach in [2], P (x) and Q(x) satisfy the data-source, but moreover, the intersection of P (x) and Q(x) should be minimal. In particular, if P (b) is in S, but Q(b) is not, then Q(b) is considered false. So in this approach, also part of Q is minimized, not only P . An alternative approach to express different levels of knowledge of a certain data-source with respect to the global domain is to label the predicates of the data-sources as “sound”, “complete” or “exact” (see, for instance, [1,5,6]). We identify two main drawbacks with this approach. The first one is the loss of elegance and flexibility by the introduction of non-logical symbols to the representation. The second, more serious problem, is related to the limitation in grasping more refined knowledge about the specific areas in which the predicates of the data-source contain complete information, as observed in several examples in this paper. In [12], the concepts of “coverage” and “density” were introduced in order to measure the completeness of data-sources at the intensional and extensional levels, respectively. The authors use these concepts to determine the completeness of one or more data-sources, gathered under merge operators. As in our approach, the intension and the contents of the predicates in a data-source are divided into two independent components. This allows to provide a general completeness measure for the data-sources, but again, it is not possible to explicitly specify situations in which the data-sources have complete knowledge about (parts of) the domain of discourse.
156
6
A. Cort´es-Calabuig et al.
Conclusion and Future Work
In this paper we presented a method of expressing the meaning of a data-source in the context of information systems that mediate among several sources. A key issue in this respect is the ability to properly define and represent particular cases where there is a complete knowledge, although partial knowledge of the sources is usually assumed. The resulting theory is expressed by a first-order one. It may also be represented by circumscriptive-like formulae. This is an ongoing work which is part of a larger project aiming to represent and reason with incomplete information in general mediator-based systems. In such broader context a number of related issues should be addressed as well. Below we consider some of them. • Expressing meta-knowledge about the data-sources themselves. For instance, while it is possible to express by our approach statements such as “the datasource S contains complete knowledge about car owners in Bronx”, it is not possible to represent a statement such as “for every car in Bronx that is known to the data-source S, S also knows its owners”. While the first statement refers to the knowledge that S possesses about the domain of discourse, the latter expresses knowledge about S itself. In order to represent the second kind of statements, an extension based on modalities in the spirit of [7] seems to be a natural candidate. • Consider the assumption LCWA∗ = S, {P (x)}, ¬Q(x). If no other assumption mentions Q in its second component, this assertion does not allow to conclude whether S has complete knowledge about P . Indeed, the induced formula in this case is of the form ΛLCWA = ∀x.¬Q(x) → . . ., but the validity of ¬Q(x) cannot be verified, since the data-sources mention only positive information. Of course, if there are other assumptions, for instance, LCWA∗∗ = S, {Q(x)}, TRUE (which implies complete knowledge about Q) then LCWA∗ states that for all x such that Q(x) is not in the database, if P (x) is true then S contains P (x). This situation shows that in order to obtain complete knowledge about an arbitrary predicate P under its window of expertise, the formula Ψ must define unambiguously such window. The specific conditions for which Ψ define complete knowledge over source predicates is a crucial issue that must be investigated in the depth, since it would allow to discriminate from a set of LCWA expressions which ones are useful in practice. • While this paper concentrates on representation forms of the closed-worldassumption and their properties, computational aspects of reasoning with these assumptions should be considered as well. Among the issues that should be addressed is the effect of the local closed-world assumptions on the complexity and decidability of the resulting theories. • Finding a proper way to incorporate the information that the mediator system has about its data-sources with the theory that relates the different terminologies of the data-sources and the global vocabulary (called schema mappings). This information may also be used for splitting global queries among the sources to obtain sound and complete answers (query planning).
On the Local Closed-World Assumption of Data-Sources
157
References 1. D. Calvanese, G. De Giacomo, and M. Lenzerini. Description logics for information integration. In Computational Logic: Logic Programming and Beyond, Essays in Honour of Robert A. Kowalski, Part II, LNCS 2408, pages 41–60. 2002. 2. P. Doherty, W. L ukaszewicz, and A. Szalas. Efficient reasoning using the local closed-world assumption. In Proc. 9th AIMSA, LNCS 2407, pages 49–58, 2000. 3. O Duschka, M. Genesereth, and A. Levy. Recursive query plans for data integration. J. Logic Programming, 43(1):49–73, 2000. 4. O. Etzioni, K. Golden, and D. Weld. Sound and efficient closed-world reasoning for planning. Artificial Intelligence, 89(1-2):113–148, 1997. 5. G. Grahne. Information integration and incomplete information. IEEE Data Engineering Bulletin, 25(3):46–52, 2002. 6. G. Grahne and A. Mendelzon. Tableau techniques for querying information sources through global schemas. In Proc. 7th ICDT, LNCS 1540, pages 332–347, 1999. 7. J. Halpern and Y. Moses. Knowledge and common knowledge in a distributed environment. Journal of the ACM, 37(3):549–587, 1990. 8. M. Lenzerini. Data integration: A theoretical perspective. In Proc. 21st PODS, pages 233–246, 2002. 9. Rousset M. and Reynaud Ch. Knowledge representation for information integration. Inf. Syst., 29(1):3–22, 2004. 10. J. McCarthy. Applications of circumscription to formalizing common sense knowledge. In V. Lifschitz, editor, Formalizing Common Sense: Papers by John McCarthy, pages 198–225. Ablex Publishing Corporation, 1990. 11. T. Millstein, A. Levy, and M. Friedman. Query containment for data integration systems. In Proc. 21st PODS, pages 67–75, 2002. 12. F. Naumann, J.C. Freytag, and U. Leser. Completeness of integrated information sources. Information Systems, 29(7):583–615, 2004. 13. R. Reiter. Towards a logical reconstruction of relational database theory. In On Conceptual Modelling, Perspectives from Artificial Intelligence, Databases, and Programming Languages., pages 191–233, 1982. 14. B. Van Nuffelen, A. Cort´es-Calabuig, M. Denecker, O. Arieli, and M. Bruynooghe. Data integration using ID-logic. In Proc. 16th CAiSE, LNCS 3084, pages 67–81, 2004.
Computing Dialectical Trees Efficiently in Possibilistic Defeasible Logic Programming Carlos I. Ches˜ nevar1 , Guillermo R. Simari2 , and Lluis Godo3 1
2
Departament of Computer Science, Universitat de Lleida, C/Jaume II, 69, 25001 Lleida, Spain [email protected] Department of Computer Science and Engineering, Universidad Nacional del Sur, Alem 1253, (8000) Bah´ıa Blanca, Argentina [email protected] 3 Artificial Intelligence Research Institute (IIIA-CSIC), Campus UAB, 08193 Bellaterra, Barcelona Spain [email protected]
Abstract. Possibilistic Defeasible Logic Programming (P-DeLP) is a logic programming language which combines features from argumentation theory and logic programming, incorporating as well the treatment of possibilistic uncertainty and fuzzy knowledge at object-language level. Solving a P-DeLP query Q accounts for performing an exhaustive analysis of arguments and defeaters for Q, resulting in a so-called dialectical tree, usually computed in a depth-first fashion. Computing dialectical trees efficiently in P-DeLP is an important issue, as some dialectical trees may be computationally more expensive than others which lead to equivalent results. In this paper we explore different aspects concerning how to speed up dialectical inference in P-DeLP. We introduce definitions which allow to characterize dialectical trees constructively rather than declaratively, identifying relevant features for pruning the associated search space. The resulting approach can be easily generalized to be applied in other argumentation frameworks based in logic programming. Keywords: Defeasible Argumentation, Logic Programming, Dialectical Reasoning.
1
Introduction and Motivations
Possibilistic Defeasible Logic Programming (P-DeLP) [1] is a logic programming language which combines features from argumentation theory and logic programming, incorporating as well the treatment of possibilistic uncertainty and fuzzy knowledge at object-language level. As in many argumentation frameworks based in logic programming, solving a P-DeLP query Q accounts for performing an exhaustive analysis of arguments and defeaters for Q, resulting in a so-called dialectical tree, usually computed in a depth-first fashion. Computing dialectical trees efficiently in P-DeLP is an important issue, as some dialectical trees may be computationally more expensive than others which C. Baral et al. (Eds.): LPNMR 2005, LNAI 3662, pp. 158–171, 2005. c Springer-Verlag Berlin Heidelberg 2005
Computing Dialectical Trees Efficiently in P-DeLP
159
lead to equivalent results. In this paper we explore different aspects concerning how to speed up dialectical inference in P-DeLP. We introduce definitions which allow to characterize dialectical trees constructively rather than declaratively, identifying relevant features for pruning the associated search space. The resulting approach can be easily generalized to be applied in other argumentation frameworks based in logic programming. The rest of the paper is structured as follows. Section 2 summarizes the details of P-DeLP. Section 3 discusses how computation of dialectical trees can be modelled in the context of P-DeLP, a characterization extensible to other similar frameworks. Section 4 presents a generic algorithm for computing dialectical trees in a depth-first fashion, as well as some criteria to be considered for pruning the resulting search space. Finally, Section 5 summarizes related work and the main conclusions that have been obtained.
2
The P-DeLP Programming Language: Fundamentals
The P-DeLP language L is defined from a set of ground fuzzy atoms (fuzzy propositional variables) {p, q, . . .} together with the connectives {∼, ∧, ← }. The symbol ∼ stands for negation. A literal L ∈ L is a ground (fuzzy) atom q or a negated ground (fuzzy) atom ∼q, where q is a ground (fuzzy) propositional variable. A rule in L is a formula of the form Q ← L1 ∧ . . . ∧ Ln , where Q, L1 , . . . , Ln are literals in L. When n = 0, the formula Q ← is called a fact and simply written as Q. The term goal will be used to refer to any literal Q ∈ L.1 In the following, capital and lower case letters will denote literals and atoms in L, respectively. Definition 1 (P-DeLP formulas). The set Wffs(L) of wffs in L are facts, rules
and goals built over the literals of L. A certainty-weighted clause in L, or simply weighted clause, is a pair of the form (ϕ, α), where ϕ ∈ Wffs(L) and α ∈ [0, 1] expresses a lower bound for the certainty of ϕ in terms of a necessity measure.
The original P-DeLP language [1] is based on Possibilistic G¨ odel Logic or PGL [2], which is able to model both uncertainty and fuzziness and allows for a partial matching mechanism between fuzzy propositional variables. For simplicity and space reasons we will restrict ourselves to fragment of P-DeLP built on non-fuzzy propositions, and hence based on the necessity-valued classical propositional Possibilistic logic [3]. As a consequence, possibilistic models are defined by possibility distributions on the set of classical interpretations 2 and the proof method for our P-DeLP formulas, written , is defined based on the following generalized modus ponens rule (GMP): 1 2
Note that conjunction of literals is not a valid goal. Although the connective ← in logic programming is different form the material implication, e.g. p ← q is not the same as ∼ q ← ∼ p, regarding the possibilistic semantics we assume here they share the same set interpretations.
160
C.I. Ches˜ nevar, G.R. Simari, and L. Godo (L0 ← L1 ∧ · · · ∧ Lk , γ) (L1 , β1 ), . . . , (Lk , βk ) (L0 , min(γ, β1 , . . . , βk ))
which is a particular instance of the well-known possibilistic resolution rule, and which provides the non-fuzzy fragment of P-DeLP with a complete calculus for determining the maximum degree of possibilistic entailment for weighted literals.3 In P-DeLP we distinguish between certain and uncertain clauses. A clause (ϕ, α) will be referred as certain if α = 1 and uncertain, otherwise. Moreover, a set of clauses Γ will be deemed as contradictory, denoted Γ ⊥, if Γ (q, α) and Γ (∼q, β), with α > 0 and β > 0, for some atom q in L.4 A P-DeLP program is a set of weighted rules and facts in L in which we distinguish certain from uncertain information. As additional requirement, certain knowledge is required to be non-contradictory. Formally: Definition 2 (Program). A P-DeLP program P (or just program P) is a pair (Π, ∆), where Π is a non-contradictory finite set of certain clauses, and ∆ is a finite set of uncertain clauses.
Example 1. Consider an intelligent agent controlling an engine with three switches sw1, sw2 and sw3. These switches regulate different features of the engine, such as pumping system, speed, etc. The knowledge of such an agent can be modelled by the program Peng shown in Fig. 1. Note that uncertainty is assessed in terms of different necessity measures. This agent may have the following certain and uncertain knowledge about how this engine works, e.g. “if the pump is clogged, then the engine gets no fuel with necessity measure of 1” (rule 1) or “When there is heat, then oil is usually not ok with necessity measure of 0.9” (rule 12). Suppose also that the agent knows that sw1, sw2 and sw3 are on, and there is heat (rules 1-5). The agent wants to determine if the engine is ok on the basis of this program Peng .
(1) (∼fuel ok ← pump clog, 1) (2) (sw1, 1) (3) (sw2, 1) (4) (sw3, 1) (5) (heat, 1) (6) (pump fuel ← sw1 , 0.6) (7) (fuel ok ← pump fuel, 0.3) (8) (pump oil ← sw2 , 0.8)
(9) (oil ok ← pump oil, 0.8) (10) (engine ok ← fuel ok ∧ oil ok , 0.3) (11) (∼engine ok ← fuel ok ∧ oil ok ∧ heat, 0.95) (12) (∼oil ok ← heat, 0.9) (13) (pump clog ← pump fuel ∧ low speed, 0.7) (14) (low speed ← sw2 , 0.8) (15) (∼low speed ← sw2 , sw3 , 0.8) (16) (fuel ok ← sw3 , 0.9)
Fig. 1. P-DeLP program Peng (example 1)
3 4
From now on we will simply use P-DeLP to actually refer to the non-fuzzy fragment of the original P-DeLP. For a given goal Q, we write ∼ Q as an abbreviation to denote “∼ q” if Q ≡ q and “q” if Q ≡ ∼q.
Computing Dialectical Trees Efficiently in P-DeLP
161
Definition 3 (Argument. Subargument). Given a program P = (Π, ∆), a set
A ⊆ ∆ of uncertain clauses is an argument for a goal Q with necessity degree α > 0, denoted A, Q, α, iff: (1) Π ∪ A (Q, α); (2) Π ∪ A is non contradictory; and (3) There is no A1 ⊂ A such that Π ∪ A1 (Q, β), β > 0. Let A, Q, α and S, R, β be two arguments. We will say that S, R, β is a subargument of A, Q, α iff S ⊆ A. Notice that the goal R may be a subgoal associated with the goal Q in the argument A.
Note that from the definition of argument, it follows that on the basis of a P-DeLP program P there may exist different arguments A1 , Q, α1 , A2 , Q, α2 , . . . , Ak , Q, αk supporting a given goal Q, with (possibly) different necessity degrees α1 , α2 , . . . , αk . Arguments are built by backward chaining on the basis of the P-DeLP program P. The necessity degree of the conclusion of an argument involving clauses (C1 , β1 ), . . . (Ck , βk ) is defined as min(β1 , . . . , βk ). Consequently, if S, R, β is a subargument of an argument A, Q, α, then β ≥ α. Example 2. Consider theprogram Peng in Ex 1. The argument A1 , engine ok, 0.3 can be obtained, with A1 = {(engine ok ← fuel ok ∧ oil ok , 0.3), (pump fuel ← sw1 , 0.6); (fuel ok ← pump fuel , 0.3), {(pump oil ← sw2 , 0.8);(oil ok ← pump oil , 0.8)}. In particular, the argument B, f uel ok, 0.3, with B= {(pump fuel ← sw1 , 0.6); (fuel ok ← pump fuel , 0.3)}, is a subargument of A1 , engine ok, 0.3.
Conflict among arguments will be formalized by the notions of counterargument and defeat presented next. Definition 4 (Counterargument). Let P be a program, and let A1 , Q1 , α1
and A2 , Q2 , α2 be two arguments wrt P. We will say that A1 , Q1 , α1 counterargues A2 , Q2 , α2 iff there exists a subargument (called disagreement subargument) S, Q, β of A2 , Q2 , α2 such that Π ∪ {(Q1 , α1 ), (Q, β)} is contradictory. The literal (Q, β) will be called disagreement literal.
Example 3. Consider the program from Ex 1. Another argument A2 , ∼ f uel ok, 0.6 can be found, with A2 = { (∼fuel ok ← sw1 , 0.6), (low speed ← sw2 , 0.8), (pump clog ← pump fuel ∧ low speed , 0.7)} Argument A2 , ∼f uel ok, 0.6 is a counterargument for A1 , engine ok, 0.3 as there exists a subargument B, f uel ok, 0.3 in A1 , engine ok, 0.3 (see Example 2) such that Π ∪ {(f uel ok, 0.3), (∼f uel ok, 0.6)} is contradictory.
Defeat among arguments involves a preference criterion on conflicting arguments, defined on the basis of necessity measures associated with arguments. Definition 5 (Defeat). Let P be a program, and let A1 , Q1 , α1 and A2 , Q2 , α2 be two arguments in P. We will say that A1 , Q1 , α1 is a defeater for A2 , Q2 , α2 iff A1 , Q1 , α1 counterargues argument A2 , Q2 , α2 with disagreement subargument A, Q, α, with α1 ≥ α. If α1 > α then A1 , Q1 , α1 is called a proper defeater, otherwise (α1 = α) it is called a blocking defeater.
Example 4. Consider A1 , engine ok, 0.3 and A2 , ∼ f uel ok, 0.6 in Ex. 3. Then
A2 , ∼ f uel ok, 0.6 is a proper defeater for A1 , engine ok, 0.3, as A2 , ∼ f uel ok, 0.6 counterargues A1 , engine ok, 0.3 with disagreement subargument B, f uel ok, 0.3, and 0.6 > 0.3.
162
C.I. Ches˜ nevar, G.R. Simari, and L. Godo
Definition 6 (Argumentation line). An argumentation line λ starting in an argument A0 , Q0 , α0 is a finite sequence of arguments [A0 , Q0 , α0 , A1 , Q1 , α1 , . . . , An , Qn , αn , . . . ] such that every Ai , Qi , αi defeats Ai−1 , Qi−1 , αi−1 , for 0 < i ≤ n, satisfying certain dialectical constraints (see below). Every argument Ai , Qi , αi in λ has level i. We will distinguish the sets Sλk = i=0,2,...,2k/2 {Ai , Qi , αi ∈ λ} and Iλk = i=1,3,...,2k/2+1 {Ai , Qi , αi ∈ λ} associated with even-level (resp. odd-level) arguments in λ up to the k-th level (k ≤ n).
An argumentation line can be thought of as an exchange of arguments between two parties, a proponent (evenly-indexed arguments) and an opponent (oddly-indexed arguments). In order to avoid fallacious reasoning, argumentation theory imposes additional constraints on such an argument exchange to be considered rationally acceptable wrt a P-DeLP program P, namely:5 1. Non-contradiction: given an argumentation line λ of length n the set Sλn associated with the proponent (resp. Iλn for the opponent) should be non-contradictory wrt P.6 2. No circular argumentation: no argument Aj , Qj , αj in λ is a sub-argument of an argument Ai , Qi , αi in λ, i < j. 3. Progressive argumentation: every blocking defeater Ai , Qi , αi in λ is defeated by a proper defeater Ai+1 , Qi+1 , αi+1 in λ.
An argumentation line that cannot be further extended on the basis of a given program P will be called exhaustive, otherwise it will be partial. Formally: Definition 7 (Partial/exhaustive argumentation line). Given two argu-
mentation lines λ and λ , we will say that λ extends λ iff λ is an initial subsequence of λ . An argumentation line λ will be called exhaustive iff there is no argumentation line λ that extends λ; otherwise λ will be called partial.
As most argumentation systems [5,6], in order to determine whether a given argument is ultimately undefeated (or warranted ) wrt a program P, the P-DeLP framework relies on an exhaustive dialectical analysis. Such analysis is modelled in terms of a dialectical tree,7 where every path can be seen as an exhaustive argumentation line. Definition 8 (Dialectical tree). Let P be a program, and let A0 , Q0 , α0 be
an argument wrt P. A dialectical tree for A0 , Q0 , α0 , denoted TA0 , Q0 , α0 , is a tree structure defined as follows: 5
6
7
These constraints may vary from one particular argumentation framework to another. In particular, parametrizing dialectical trees with constraints on argumentation lines may give rise to characterizations of different logic programming semantics, as shown in [4]. Non-contradiction for a set of arguments is defined as a generalization ofDef. 3: a n set S = n i=1 {Ai , Qi , αi } of arguments is contradictory wrt P iff Π ∪ i=1 Ai is contradictory. In some frameworks other names are used for denoting tree-like structures of arguments, e.g. ‘argument tree’ or ‘dialogue tree’ [7,8].
Computing Dialectical Trees Efficiently in P-DeLP
163
1. The root node of TA0 , Q0 , α0 is A0 , Q0 , α0 . 2. B , H , β is an immediate child of B, H, β iff there exists an exhaustive argumentation line λ = [A0 , Q0 , α0 , A1 , Q1 , α1 , . . . ,An , Qn , αn , . . . ] such that there are two elements Ai+1 , Qi+1 , αi+1 = B , H , β and Ai , Qi , αi = B, H, β, for some i = 0 . . . n − 1.
Example 5. Consider Ex. 1. To compute the dialectical tree for A1 , engine ok, 0.3, the P-DeLP inference engine computes argumentation lines by depth-first search. A defeater for A1 , engine ok, 0.3 is found, namely A2 , ∼ f uel ok, 0.6 (Ex. 4). This defeater can on its turn be defeated by a third defeater A3 , ∼low speed, 0.8, with disagreement subargument A2 , low speed, 0.8. Note that argument A4 , f uel ok, 0.9, with A4 = { (fuel ok ← sw3 , 0.9) } would be also a defeater for A2 , ∼ f uel ok, 0.6. This completes the analysis of defeaters for A2 , ∼ f uel ok, 0.6. Backtracking to argument A1 , engine ok, 0.3, another defeater is found, namely A5 , ∼ engine ok, 0.3, with A5 = { (∼ engine ok ← fuel ok ∧ oil ok ∧ heat, 0.95) ; (pump fuel ← sw1 , 0.6); (fuel ok ← pump fuel , 0.3), (pump oil ← sw2 , 0.8); (oil ok ← pump oil , 0.8)}. Note that no further arguments can be found in the dialectical analysis. Although A6 , ∼ oil ok, 0.9, with A6 = { (∼ oil ok ← heat, 0.9) } seems a possible defeater for A5 , ∼ engine ok, 0.3, such argument would be fallacious as A1 supports oil ok, and there would be even-level arguments (namely A1 and A5 ) supporting contradictory conclusions. Therefore three different exhaustive argumentation lines can be computed, namely rooted in A1 , engine ok, 0.3, namely: • [A1 , engine ok, 0.3, A2 , ∼ f uel ok, 0.6, A3 , ∼ low speed, 0.8 ] • [ A1 , engine ok, 0.3, A2 , ∼ f uel ok, 0.6, A4 , f uel ok, 0.9 ] • [A1 , engine ok, 0.3, A5 , ∼ engine ok, 0.3 ] Fig. 2(b) shows the corresponding dialectical tree TA1 , engine
ok, 0.3 .
Nodes in a dialectical tree TA0 , Q0 , α0 can be marked as undefeated and defeated nodes (U-nodes and D-nodes, resp.). A dialectical tree will be marked as an and-or tree: all leaves in TA0 , Q0 , α0 will be marked U-nodes (as they have no defeaters), and every inner node is to be marked as D-node iff it has at least one U-node as a child, and as U-node otherwise. Note that α − β pruning (see Fig. 2(a)) can be applied, so not every node in the tree needs to be generated. We will write M ark(Ti ) = U (resp.M ark(Ti ) = D) to denote that the root node of Ti is marked as U -node (resp. D-node). Definition 9 (Warrant). An argument A0 , Q0 , α0 is ultimately accepted as valid (or warranted) with a necessity degree α0 wrt a program P iff the root of the tree TA0 , Q0 , α0 is marked as U-node (i.e., M ark(TA0 , Q0 , α0 ) = U ).
Example 6. Consider TA1 , engine ok, 0.3 in Ex. 5. Fig. 2(b) shows the result of com-
puting M ark(TA1 , engine ok, 0.3 ) = D with α − β pruning. From Def. 9 it holds that A1 , engine ok, 0.3 is not warranted.
164
3
C.I. Ches˜ nevar, G.R. Simari, and L. Godo
Modelling the Computation of Dialectical Trees
P-DeLP –as well as other implemented logic programming approaches to argumentation– relies on depth-first search to generate dialectical trees. As discussed before, such search can be improved by applying α−β pruning, so that not every node (argument) is computed. A well-known fact in depth-first search is that the order in which branches are generated is important. Fig. 2(b) shows a pruned dialectical tree, where only three arguments were actually computed to deem the root node as defeated. Fig. 2(c) shows that there is an alternative analysis which renders the search space even smaller, by considering first the argument A5 , ∼ engine ok, 0.3 instead of A2 , ∼ f uel ok, 0.6. Such evaluation order for generating argumentation lines is an issue not taken into account in existing formalizations of argumentation frameworks which mostly rely on dialectical trees computed exhaustively. On the other hand, the actual branching factor of a the dialectical tree is clearly restricted by dialectical constraints as discussed in Def. 6. In order to take into account such features we will introduce some new definitions required to characterize dialectical trees constructively rather than declaratively as follows. Definition 10 (Dialectical tree (revisited)). Consider the definition of dialectical tree (as in Def. 8) without the restriction of argumentation lines being exhaustive. A dialectical tree TA0 , Q0 , α0 will be called exhaustive iff each of its argumentation lines is exhaustive, otherwise TA0 , Q0 , α0 will be called partial. We will write TreeP (or just Tree) to denote the set of all possible dialectical trees based on P.
In this new setting the process of building a dialectical tree can be thought of as a computation starting from an initial tree (consisting of a single node), evolving into more complex trees by adding stepwise new arguments (nodes). This will be formalized by means of a precedence relationship “” among trees: Definition 11 (Precedence relationship ). Let P be a program, and let T, T be dialectical trees in P. We define a relationship ⊆ Tree × Tree, where T T
(a)
(b)
(c)
A1 , engine ok, 0.3
A1 , engine ok, 0.3
(D) (D) D @ qX X X @ X q q Xq U A2 , ∼f uel ok, 0.6 A5 , ∼engine ok, 0.3
J
J
J (D) (U) q D JqD q Jq q Jq @ A5 , ∼engine ok, 0.3 @ (U)
J
J qU q U qJq q Jq A3 , ∼low speed, 0.8 A4 , f uel ok, 0.6 (U)
(U)
Fig. 2. (a) Dialectical tree, where ’s denote arguments that do not need to be generated because of α − β pruning; (b) Dialectical Tree TA1 , engine ok, 0.3 with exhaustive argumentation lines (ex. 5) marked with α−β pruning; (c) Optimally settled dialectical tree T
Computing Dialectical Trees Efficiently in P-DeLP
165
(expressed as T evolves from T) whenever T can be obtained from T by extending some argumentation line in T. We will also write T ∗ T iff there exists a (possibly empty) sequence T1 , T2 , . . . , Tk such that T = T1 . . . Tk = T .
Clearly from Defs. 7 and 10 the notion of exhaustive dialectical tree can be recast as follows: A dialectical tree Ti is exhaustive iff there is no Tj = Ti such that Ti ∗ Tj . In fact, every dialectical tree Ti can be seen as a ‘snapshot’ of the status of a disputation between two parties (proponent and opponent), and the relationship “” allows to capture the evolution of such disputation. As discussed before, pruning strategies could be applied (e.g. α − β pruning), allowing to determine whether the marking of the root of a partial tree without computing its associated exhaustive tree. We formalize this situation as follows: Definition 12 (Settled dialectical tree). Let Ti be a dialectical tree, such that for every Tj evolving from Ti (i.e., Ti ∗ Tj ) it holds that M ark(Ti ) = M ark(Tj ). Then Ti is a settled dialectical tree. A Ti is an optimally settled dialectical tree iff there is no Ti ∗ Ti such that Ti is a settled dialectical tree.
Example 7. Consider the dialectical trees shown in Fig. 2(b) and (c). Then it holds that T ∗ TA1 , engine ok, 0.3 . Note also that both TA1 , engine ok, 0.3 and T settled dialectical trees. In particular, T is an optimally settled dialectical tree.
are
Note that from the above definition argumentation lines in a settled dialectical tree are not necessarily exhaustive. It is also clear that every exhaustive dialectical tree will be settled, although not necessarily optimally settled. Optimally settled dialectical trees are those involving the least number of arguments needed to determine whether the root of the tree is ultimately defeated or not according to the marking procedure. Proposition 1. Let P be a program, and A0 , Q0 , α0 an argument in P. Then
A0 , Q0 , α0 is warranted with necessity degree α0 iff M ark(TA0 , Q0 , α0 ) = U , where TA0 , Q0 , α0 is a settled dialectical tree.
Next we will analyze how to characterize the computation of dialectical trees in depth-first fashion, modelling informed search oriented towards computing optimally settled dialectical trees. Consider a leaf (argument) B, H, β in a given argumentation line λ in a partial dialectical tree T which is not settled, so that further computation will be needed (possibly expanding λ). Clearly, the dialectical constraints given in Def. 6 make that not every defeater as defined in Def. 5 can be used to extend λ. Defeaters satisfying dialectical constraints will be called feasible defeaters. Formally: Definition 13 (Feasible defeaters). Let T1 be a partial dialectical tree and let
B, H, β be a leaf node in T1 at level k in an argumentation line λ. Let T be the exhaustive dialectical tree associated with T1 and let {λ1 , . . . λm } be the set of all possible argumentation lines in T of length > k + 1 that extend λ, i.e. each λi has the form [A0 , Q0 , α0 , . . . , B, H, β, Bi , Hi , βi , . . . ], for i = 1 . . . m. We define the set of feasible defeaters for B, H, β wrt λ as FDefeat(B, H, β, λ) = m i=1 {Bi , Hi , βi }.
166
C.I. Ches˜ nevar, G.R. Simari, and L. Godo
Our depth-first approach can thus be improved by restricting search to feasible defeaters. Note that in depth-first search there will be always one current path associated with the last argument introduced. We call that path current argumentation line. Clearly, if B, H, β is a leaf in the current argumentation line λ associated with the computation of a settled dialectical tree T, any element in FDefeat(B, H, β, λ) is a possible candidate for expanding λ. The marking of the tree T induces an order “≺eval ” in FDefeat(B, H, β, λ): for any two arguments Bi , Hi , βi , Bj , Hj , βj in FDefeat(B, H, β, λ), we will say that Bi , Hi , βi ≺eval Bj , Hj , βj if the subtree rooted in Bi , Hi , βi is marked before than the subtree rooted in Bj , Hj , βj . Fig. 3 illustrates how a dialectical tree can be built in a depth-first fashion using α − β pruning and the evaluation order ≺eval . In order to speed up the construction of a settled dialectical tree, our approach will be twofold: on the one hand, we will identify which literals can be deemed as candidates for computing feasible defeaters. On the other hand, we will provide a definition of ≺eval which prunes the search space using dialectical constraints.
Algorithm 1 BuildDialecticalTree Input: A, Q, α, λ = [A, Q, α] Output: TA, Q, α , M ark (Marking) {uses α-β pruning and evaluation ordering eval } Global variable: TA, Q, α Local variables: M arkAux, ParentDefeated, λ {λ is the current argumentation line, initially λ = [A, Q, α]} Put A, Q, α as root node of TA, Q, α Compute FDefeat(A, Q, α, λ) = {A0 , Q0 , α0 , . . . , Ak , Qk , α0 } {FDefeat(A, Q, α, λ)= feasible defeaters for A, Q, α wrt λ} If S = ∅ Then ParentDefeated := false While (ParentDefeated=false) and (S = ∅) do Choose some Ai , Qi , αi ∈ S minimal wrt ≺eval S := S \ {Ai , Qi , αi } λ := λ ◦ Ai , Qi , αi {expand λ adding new argument Ai , Qi , αi } BuildDialecticalTree(Ai , Qi , αi , TAi , Qi , αi , M arkAux) Add TAi , Qi , αi as immediate subtree of A, Q, α. If M arkAux=U then ParentDefeated := true end while If ParentDefeated=false {S = ∅, all defeaters were defeated} then M ark := U {mark TA, Q, α as U } else M ark := D {mark TA, Q, α as D} else {S = ∅, hence A, Q, α has no defeaters} M ark := U {mark TA, Q, α as U } Return TA, Q, α , M ark Fig. 3. Algorithm for building and labelling settled dialectical trees in a depth-first fashion taking into account feasible defeaters and evaluation order ≺eval
Computing Dialectical Trees Efficiently in P-DeLP
4
167
Pruning Dialectical Trees in P-DeLP
Given an argument A0 , Q0 , α0 , building a dialectical tree TA0 , Q0 , α0 involves computing defeaters in a recursive way. According to Def. 4, to automate the computation of such defeaters it is necessary to detect the set of disagreement literals { (L1 , φ1 ), . . . , (Lk , φk ) } that can be source of conflict with counterarguments B1 , H1 , β1 , . . . , Bk , Hk , βk that defeat A0 , Q0 , α0 . Fortunately, in the context of P-DeLP this can be done on the basis of the consequents of uncertain clauses associated with subarguments in A0 , Q0 , α0 . Definition 14 (Set of consequents Co). Let A0 , Q0 , α0 be an argument. The set Co(A0 , Q0 , α0 ) = { (Q, α) | ∃ (Q ← L1 ∧ L2 ∧ . . . ∧ Lk , γ) ∈ A0 such that A, Q, α is a subargument of A0 , Q0 , α0 }. We generalize this to a set S of arguments, S = i=1...k Ai , Qi , αi , defining Co(S) = i=1...k Co(Ai , Qi , αi ).8
Lemma 1 (Goal-driven defeat [9]). Let A, Q, α be an argument, and let
B, H, β be a defeater for A, Q, α. Then there exists an argument B, H , β, such that H is the complement of a literal in Co(A, Q, α), (where complement of (L, γ) is defined as (∼L, γ)).
Lemma 1 allows to search for defeaters automatically by backward chaining, on the basis of the consequents of uncertain clauses in an argument. Thus if (L, γ) ∈ Co(A0 , Q0 , α0 ), a search for a defeater with disagreement literal (L, φ) will involve finding an argument for concluding (∼L, γ ), with γ ≥ γ. Example 8. Consider A1 , engine ok, 0.3 in Ex. 2. Then Co(A1 , engine ok, 0.3) =
{ (engine ok, 0.3), (pump f uel, 0.6), (f uel ok, 0.3), (oil ok, 0.3), (pump oil, 0.8) }. Defeaters for A1 , engine ok, 0.3 can be found by backward chaining from the complement of each weighted literal (L, γ), searching for arguments for (∼L, γ ), with γ ≥ γ.
From the above considerations we can establish the following inclusionship for detecting candidate disagreement literals in an argument A, Q, α appearing as a leaf in an argumentation line λ: Optimal(A, Q, α, λ) ⊆ Feasible(A, Q, α, λ) ⊆ Co(A, Q, α)
Here Feasible(A, Q, α, λ) denotes the set of weighted literals (φ, α) which are possible disagreement literals for A, Q, α for some feasible defeater, whereas Optimal(A, Q, α, λ) denotes the set of weighted literals (φ, α) which are possible disagreement literals for feasible defeaters leading to the shortest argumentation lines.9 Clearly Optimal(A, Q, α, λ) is in a sense an ideal set of disagreement literals, for which we can find different approximations. One possibility is to consider the set Feasible(A, Q, α, λ). However, determining feasible defeaters is computationally also quite a difficult task, as it involves checking different 8 9
Note that the set Co(A0 , Q0 , α0 ) can be easily computed along the derivation process of the argument itself. Note that this is a set, as there may be different argumentation lines extending λ, all of them having the same length.
168
C.I. Ches˜ nevar, G.R. Simari, and L. Godo
dialectical constraints (see Def. 6). As discussed before, a more tractable way to detect candidate defeaters is to consider the set Co(A, Q, α). A better approximation than Co(A, Q, α) can be stated taking into account the following intuition: let us assume that the current argumentation line λ has been computed up to level k. From the ‘non-contradiction’ constraint, even-level as well as odd-level arguments in λ should not be contradictory. This accounts to saying also that literals which are common to both even-level and odd-level arguments cannot be disagreement literals within any extension of λ. To formalize this notion, we will suitably extend the definitions for set intersection and difference for weighted literals as follows: given two sets of weighted literals S1 and S2 , we define intersection among S1 and S2 as S1 S2 =def {(Q, α) | (Q, α1 ) ∈ S1 and (Q, α2 ) ∈ S2 , with α = min(α1 , α2 ) }. Similarly, we define difference among S1 and S2 as follows: S1 \ S2 =def { (Q, α) | (Q, α) ∈ S1 and
∃(Q, β) ∈ S2 , for β > 0 } Definition 15 (Set SharedLit). Let λ be an argumentation line. SharedLit(λ, k) is the set of weighted literals common to even-level and odd-level arguments up to level k, i.e. SharedLit(λ, k) =def Co(Sλk ) Co(Iλk ).
Proposition 2. Let λ be an argumentation line in a partial dialectical tree T, and let
A, Q, α an argument which is a leaf in λ at level k. Let (L, γ) ∈ SharedLit(λ, k), k > 0. Then (L, γ ) ∈ Feasible(A, Q, α, λ), for any γ ≥ γ.
Proposition 2 allows to further refine the inclusion relationship given before as follows: Feasible(A, Q, α, λ) ⊆ Co(A, Q, α) \ SharedLit(λ, k) ⊆ Co(A, Q, α)
We can now come back to the original question: how to choose which defeater belongs to the (on the average) shorter argumentation line, i.e. the one more prone to settle the disputation as soon as possible. From our preceding results we can suggest the following definition for ≺eval : Definition 16 (Evaluation order based on SharedLit). Let λ be an argumen-
tation line, and let A, Q, α be a leaf at level k. Let A1 , Q1 , α1 and A2 , Q2 , α2 be two candidate defeaters for A, Q, α, such that λ can be extended to λ1 (using A1 , Q1 , α1 ) or λ2 (using A2 , Q2 , α2 ). Then A1 , Q1 , α1 ≺eval A2 , Q2 , α2 iff Co(A1 , Q1 , α1 ) \ SharedLit(λ1 , k + 1) ⊆ Co(A2 , Q2 , α2 ) \ SharedLit(λ2 , k + 1).10
Example 9. Consider the argument A1 , engine ok, 0.3 as in Ex. 2 and 8, and assume that the current argumentation line is λ = [A1 , engine ok, 0.3]. In such a case the set FDefeat(A1 , engine ok, 0.3, λ) has two defeaters { A2 , ∼ f uel ok, 0.6, A5 , ∼ engine ok, 0.3 }, computed in Ex. 3 and 5. Argumentation line λ can therefore be extended in two different ways, λ1 = λ◦ A2 , ∼ f uel ok, 0.6 and λ2 = λ◦ 10
Note that this partial order can be refined by considering those arguments with higher necessity, i.e. given two defeaters A1 , Q1 , α1 and A2 , Q2 , α2 equally preferred wrt ≺eval , the one having max(βi , βj ) as necessity degree is preferred.
Computing Dialectical Trees Efficiently in P-DeLP
169
A5 , ∼ engine ok, 0.3. Let us compute the set of consequents for these arguments: Co(A1 , engine ok, 0.3) = { (engine ok, 0.3), (pump f uel, 0.6), (f uel ok, 0.3), (oil ok, 0.3), (pump oil, 0.8)}. Co(A5 , ∼engine ok, 0.3) = {(∼engine ok, 0.3), (pump f uel, 0.6), (f uel ok, 0.3), (oil ok, 0.3), (pump oil, 0.8)}. Co(A2 , ∼f uel ok, 0.6) = { (∼f uel ok, 0.6), (low speed, 0.8), (pump clog, 0.7) } From the above sets we have then SharedLit(λ1 , 1) = ∅ and SharedLit(λ2 , 1) = { (engine ok, 0.3), (pump f uel, 0.6), (f uel ok, 0.3), (oil ok, 0.3), (pump oil, 0.8)}. Consequently, it holds that Co(A1 , engine ok, 0.3)\SharedLit(λ2 , 1) ⊂ Co(A1 , engine ok, 0.3)\SharedLit(λ1 , 1) Thus the defeater A5 , ∼ engine ok, 0.3 should be evaluated before the defeater A2 , ∼ f uel ok, 0.6 in the depth-first computation of the dialectical tree using the algorithm in Fig. 3.
Although Example 9 is rather na¨ıve, it is intended to show one possible way of characterizing the evaluation order ≺eval , reducing the average branching factor of the dialectical tree when in a depth-first fashion.
5
Related Work and Conclusions
In this paper we have presented a novel approach to characterize dialectical reasoning in the context of Possibilistic Defeasible Logic Programming, aiming at speeding up the underlying inference procedure. The contribution of this paper is twofold: on the one hand, we have formalized the notion of dialectical trees constructively, taking into account salient features in modelling the depthfirst construction of such trees. On the other hand, we have analyzed the role of dialectical constraints as an additional element for pruning the resulting search space. Although our characterization is based in P-DeLP, it can be generalized to be applied in other argumentation frameworks based on logic programming. It must be remarked that P-DeLP is an extension of Defeasible Logic Programming [9], which has been successfully integrated in a number of real-world applications (e.g. clustering [10], and recommender systems [11]). Our work complements previous research concerning the dynamics of argumentation, notably [12] and [13]. In particular, Prakken [12] has analyzed the exchange of arguments in the context of dynamic disputes. Our approach can also be understood in the light of his characterization of dialectical proof theories. However, Prakken focuses on a comprehensive but rather general framework, in which important computational issues (e.g. detecting disagreement literals, search space considerations, etc.) are not taken into account. Hunter [14] analyzes the search space associated with dialectical trees taking into account novel features such as the resonance of arguments. His interesting formalization combines a number of features that allow to assess the impact of dialectical trees, contrasting shallow vs. deep trees. However, computational aspects as the ones analyzed in this paper are outside the scope of his work. In [4] a throughout
170
C.I. Ches˜ nevar, G.R. Simari, and L. Godo
analysis of various argumentation semantics for logic programming is presented on the basis of parametric variations of derivation trees. In contrast with that approach, our aim in this paper was not to characterize different emerging semantics, but rather to focus on an efficient construction of dialectical trees for speeding up inference. On the other hand, in [4] the authors concentrate in normal logic programming, whereas our approach deals with extended logic programming enriched with necessity degrees. Recently semantical aspects of P-DeLP have been analyzed in the context of specialized inference operators [15]. It must be remarked that our approach can also be improved by considering the non-circularity constraint (see Def. 6) for argumentation lines: as the current argumentation line λ is computed, the set of feasible defeaters associated to the last argument in λ at level k is also restricted by arguments which already appeared earlier at any level k < k. Part of our current research work involves how to extend our algorithm to include such non-circularity constraints in our analysis, in order to develop a full-fledged implementation of the algorithm presented in this paper including such features. Our experiments so far have been performed only on a “proof of concept” prototype, as we have not been able yet to carry out thorough evaluations in the context of a real-world application. The results obtained, however, have been satisfactory and as stated before can be generalized to most argumentation frameworks. The development of such generalization is part of our future work. Acknowledgements. This research was partially supported by Projects TIC2003-00950, TIN2004-07933-C03-01/03, by Ram´on y Cajal Program (Ministerio de Ciencia y Tecnolog´ıa, Spain), by CONICET (Argentina), by the Secretar´ıa General de Ciencia y Tecnolog´ıa de la Universidad Nacional del Sur and by Agencia Nacional de Promoci´ on Cient´ıfica y Tecnol´ogica (PICT 2002 No. 13096).
References 1. Ches˜ nevar, C.I., Simari, G., Alsinet, T., Godo, L.: A Logic Programming Framework for Possibilistic Argumentation with Vague Knowledge. In: Proc. of the Intl. Conf. in Uncertainty in Art. Intelligence. (UAI 2004). Banff, Canada. (2004) 76–84 2. Alsinet, T., Godo, L.: A complete calculus for possibilistic logic programming with fuzzy propositional variables. In: Proc. of the UAI-2000 Conference. (2000) 1–10 3. Dubois, D., Lang, J., Prade, H.: Possibilistic logic. In D.Gabbay, C.Hogger, J.Robinson, eds.: Handbook of Logic in Art. Int. and Logic Prog. (Nonmonotonic Reasoning and Uncertain Reasoning). Oxford Univ. Press (1994) 439–513 4. Kakas, A., Toni, F.: Computing argumentation in logic programming. Journal of Logic Programming 9 (1999) 515:562 5. Ches˜ nevar, C.I., Maguitman, A., Loui, R.: Logical Models of Argument. ACM Computing Surveys 32 (2000) 337–383 6. Prakken, H., Vreeswijk, G.: Logical Systems for Defeasible Argumentation. In Gabbay, D., F.Guenther, eds.: Handbook of Philosophical Logic. Kluwer Academic Publishers (2002) 219–318
Computing Dialectical Trees Efficiently in P-DeLP
171
7. Besnard, P., Hunter, A.: A logic-based theory of deductive arguments. Artificial Intelligence 1:2 (2001) 203–235 8. Prakken, H., Sartor, G.: Argument-based extended logic programming with defeasible priorities. Journal of Applied Non-classical Logics 7 (1997) 25–75 9. Garc´ıa, A., Simari, G.: Defeasible Logic Programming: An Argumentative Approach. Theory and Practice of Logic Programming 4 (2004) 95–138 10. G´ omez, S., Ches˜ nevar, C.: A Hybrid Approach to Pattern Classification Using Neural Networks and Defeasible Argumentation. In: Proc. of 17th Intl. FLAIRS Conf. Miami, Florida, USA, AAAI Press (2004) 393–398 11. Ches˜ nevar, C., Maguitman, A.: An Argumentative Approach to Assessing Natural Language Usage based on the Web Corpus. In: Proc. of the ECAI-2004 Conference. Valencia, Spain. (2004) 581–585 12. Prakken, H.: Relating protocols for dynamic dispute with logics for defeasible argumentation. Synthese (special issue on New Perspectives in Dialogical Logic) 127 (2001) 187:219 13. Brewka, G.: Dynamic argument systems: A formal model of argumentation processes based on situation calculus. J. of Logic and Computation 11 (2001) 257–282 14. Hunter, A.: Towards Higher Impact Argumentation. In: Proc. of the 19th American National Conf. on Artificial Intelligence (AAAI’2004), MIT Press (2004) 275–280 15. Ches˜ nevar, C., Simari, G., Godo, L., Alsinet, T.: Argument-based expansion operators in possibilistic defeasible logic programming: Characterization and logical properties. In: 8th European Conf. on Symbolic and Qualitative Aspects of Reasoning Under Uncertainty (ECSQARU 2005), Barcelona, Spain (to appear). (2005)
An Approximation of Action Theories of AL and Its Application to Conformant Planning Tran Cao Son1 , Phan Huy Tu1 , Michael Gelfond2 , and A. Ricardo Morales2 1
2
Department of Computer Science, New Mexico State University, Las Cruces, NM 88003, USA {tson, tphan}@cs.nmsu.edu Department of Computer Science, Texas Tech University, Lubbock, TX 79409, USA {mgelfond, ricardo}@cs.ttu.edu
Abstract. In this paper we generalize the notion of approximation of action theories introduced in [13,26]. We introduce a logic programming based method for constructing approximation of action theories of AL and prove its soundness. We describe an approximation based conformant planner and compare its performance with other state-of-the-art conformant planners.
1 Introduction and Motivation Static causal laws (a.k.a. state constraints or axioms) constitute an important part of every dynamic domain. Unlike an effect of an action, a static causal law represents a relationship between fluents. For example, (a) In the travel domain, the static causal law “one person cannot be at A if he is at B” states that at(B) is false if at(A) is true; (b) In the block world domain, the static causal law “block A is above block B if A is on B” says that above(A, B) is true if on(A, B) is true; Static causal laws can cause actions to have indirect effects. For example, the action of putting the block A atop the block B, denoted by put(A, B), causes on(A, B) to be true. The static causal law (b) implies that above(A, B) is also true, i.e., above(A, B) is an indirect effect of put(A, B). The problem of determining such indirect effects is known as the ramification problem in the area of reasoning about action and change (RAC). In the last decade, several solutions to the ramification problem have been proposed. Each of these solutions extends a framework for RAC to allow static causal laws [2,18,22,23,20,15,17]. While being intensively studied by the RAC’s research community, static causal laws have rarely been directly considered by the planning community. Although the original specification of the Planning Domain Description Language (PDDL) – a language frequently used for the specification of planning problems by the planning community – includes axioms (or static causal laws in our notation) [14], most of the planning domains used in the recent planning competitions [1,19,11] do not include axioms. The main reason for this practice is that it is widely believed that axioms can be compiled into actions’ effect propositions; thus, making the representation of and reasoning about axioms become unnecessary in planning. This is partly true due to the fact that PDDL only allows non-recursive axioms. In a recent paper [29], it is proved C. Baral et al. (Eds.): LPNMR 2005, LNAI 3662, pp. 172–184, 2005. c Springer-Verlag Berlin Heidelberg 2005
An Approximation of Action Theories of AL and Its Application
173
that adding axioms to the planning language not only improves the readability and elegance of the representation but also increases the expressiveness of the language. It is also shown that the addition of a component to handle axioms in a planner can indeed improve the performance of the planner. The main difficulty in planning in domains with static causal laws lies directly in defining and computing the successor states. In general, domains with static causal laws are nondeterministic; for example, in a theory with a single action a and three fluents f , g, and h with the property that execution of a causes f to become true and the two static causal laws (i) if f is true and g is false then h must be true; and, (ii) if f is true and h is false then g must be true. Intuitively, the execution of a in a state where f , h, and g are false will yield two possible states. In one state, f and g are true and h is false. In the other one, f and h are true and g is false. This nondeterminism leads to the fact that the execution of an action sequence can generate different trajectories. Thus, exact planning1 is similar to conformant planning, an approach to dealing with incomplete information in planning. It is also worth noticing that the complexity of conformant planning (Σ2P ) is much higher than planning in deterministic domains (NP-complete) [3,30]. It is also pointed out in [3] that approximations of the transition function between states can help reduce the complexity of the planning problem. In this paper, we further investigate the notion of approximations of action theories introduced in [26,13]. We define an approximation for action theories of AL. The key difference between the newly developed approximation and those proposed in [26,13] is that it is applicable for action descriptions with arbitrary static causal laws: while the approximation proposed in [13] is only for specific type of state constraints, the approximations in [26] are defined for action descriptions with sensing actions but without state constraints. We use a logic program in defining the approximation. The paper is organized as follows. In the next section, we review the basics of the language AL. Afterward, we define an approximation of AL action theories. We then proceed with the description of a logic programming based conformant planner which makes use of the approximation. We then compare the performance of our planner with some conformant planners which are closely related to our planner.
2 Syntax and Semantics of AL We consider domains which can be represented by a transition diagram whose nodes are possible states of the domain and whose arcs are actions that take the domain from one state to another. Paths of the diagram correspond to possible trajectories of the system. We limit our attention to transition diagrams which can be defined by action descriptions of the action language AL from [4]. The signature Σ of an action description of AL consists of two disjoint, non-empty sets of symbols: the set F of fluents, and 1
By exact planning we mean the problem of finding a polynomial-bounded length sequence of actions that can achieve the goal at the end of every possible trajectory generated by the action sequence.
174
T.C. Son et al.
the set A of elementary actions. By an action we mean a non-empty set a of elementary actions. Informally we interpret an execution of a as a simultaneous execution of its components. For simplicity we identify an elementary action e with {e}. By fluent literals we mean fluents and their negations. By l we denote the fluent literal complementary to l. A set S of fluent literals is called complete if, for any f ∈ F, f ∈ S or ¬f ∈ S. An action description D of AL is a collection of statements of the form: e causes l if p l if p impossible a if p
(1) (2) (3)
where e is an elementary action, a is an action, l is a fluent literal, and p is a set of fluent literals from the signature Σ of D. The set p is often referred to as the precondition of the corresponding statement. When it is empty, the “if” part of the statement can be omitted. Statement (1), called a dynamic causal law, says that, if e is executed in a state satisfying p then l will hold in any resulting state. Statement (2), called a static causal law, says that any state satisfying p must satisfy l. Statement (3) is an impossibility condition. It says that action a cannot be performed in a state satisfying p. We next define the transition diagram, T (D) specified by an action description D of AL. A set of literals S is closed under a static causal law (2) if l ∈ S whenever p ⊆ S. By Cn(S), we denote the smallest set of literals that contains S and is closed under the static causal laws of D. A state σ of T (D) is a complete, consistent set of literals closed under the static causal laws of D. An action b is said to be prohibited in σ if D contains an impossibility condition (3) such that p ⊆ σ and a ⊆ b. E(a, σ) stands for the set of all fluent literals l for which there is a causal law (1) in D such that p ⊆ σ and e ∈ a. Elements of E(a, σ) are called direct effects of the execution of a in σ. Definition 1 ([21]). For an action a and two states σ1 and σ2 , a transition σ1 , a, σ2 ∈ T (D) iff a is not prohibited in σ1 and σ2 = Cn(E(a, σ1 ) ∪ (σ1 ∩ σ2 )). An alternate sequence of states and actions, M = σ0 , a0 , σ1 , . . . , an−1 , σn , is a path in a transition diagram T (D) if σi , ai , σi+1 ∈ T (D) for 0 ≤ i < n. M is called a model of the chain of events α = a0 , . . . , an−1 ; σ0 (resp. σn ) is referred to as the initial state (resp. final state) of M ; M entails a set of fluent literals s, written as M |= s, if s ⊆ σn . We sometime write σ0 , α, σn ∈ T (D) to denote that there exists a model of α whose initial state and final state is σ0 and σn , respectively. An action description D is called deterministic if for any state σ1 and action a there is at most one successor state σ2 such that σ1 , a, σ2 ∈ T (D). Note that if D is deterministic there can be at most one model for α given the initial state σ0 and final state σn . We denote this model by σn = α(σ0 ). Notice that in the presence of static causal laws, action theories can be nondeterministic. As an example, the second theory in the introduction can be described by the action description D0 consisting of the following statements: g if f, ¬h h if f, ¬g D0 = a causes f Observe that T (D0 ) includes the transitions {¬f, ¬h, ¬g}, a, {f, h, ¬g} and {¬f, ¬h, ¬g}, a, {f, g, ¬h}. Hence, D0 is non-deterministic. An action a is executable in state σ1 if there is a state σ2 such that σ1 , a, σ2 ∈ T (D); a chain of events α = a1 , . . . , an−1 is executable in a state σ if there exists a
An Approximation of Action Theories of AL and Its Application
175
path σ, α, σ in T (D) for some σ ; D is called consistent if for any state σ1 and action a which is not prohibited in σ1 there exists at least one successor state σ2 such that σ1 , a, σ2 ∈ T (D).
3 Approximating Action Theories of AL Normally an agent does not have complete information about its current state. Instead its knowledge is limited to the current partial state – a consistent collection of fluent literals closed under the static causal laws of the agent’s action description D. In what follows partial states and states are denoted by (possibly indexed) letters s and σ respectively. A state σ that includes a partial state s is called a completion of s. By comp(s) we denote the set of all completions of s. An action a is safe in s if it is executable in every completion of s. A chain of events α = a0 , . . . , an−1 is safe in s if (i) a0 is safe in s; and (ii) for every state σ such that σ, a0 , σ ∈ T (D) for some σ ∈ comp(s), a1 , . . . , an−1 is safe in σ . For many of its reasoning tasks the agent may need to know the effects of its actions which are determined by the fluents from s (as opposed to the actual completion of s). In [26] the authors suggest to model such knowledge by a transition function which approximates the transition diagram T (D) for deterministic action theories with sensing actions. We will next generalize this notion to action theories in AL. Even though approximations can be non-deterministic, in this paper we will be interested only in deterministic approximations. Definition 2 (Approximation). T (D) is an approximation of T (D) if 1. States of T (D) are partial states of T (D). 2. If s, a, s ∈ T (D) then for every σ ∈ comp(s), (a) a is executable in σ and, (b) s ⊆ σ for every σ such that σ, a, σ ∈ T (D). An approximation T (D) is deterministic if for each partial state s and action a, there exists at most one s such that s, a, s ∈ T (D). The next observation shows that an approximation must be sound. Observation 1. Let T (D) be an approximation of T (D). Then, for every chain of events α if s, α, s ∈ T (D) then for every σ ∈ comp(s), (a) α is executable in σ; and (b) s ⊆ σ for every σ such that σ, α, σ ∈ T (D). In what follows we describe a method for constructing approximations of action theories of AL. In our approach, the transitions in T (D) will be defined by a logic program π(D) called the cautious encoding of D. The signature of π(D) includes terms corresponding to fluent literals and actions of D, as well as non-negative integers used to represent time steps. For convenience, we often write π(D, n) to denote the program π(D) where the time constants take values between 0 and n. Atoms of π(D) are formed by the following (sorted) predicate symbols: – h(l, T ) is true if literal l holds at time-step T ; – o(e, T ) is true if action e occurs at time-step T ;
176
T.C. Son et al.
– dc(l, T ) is true if literal l is a direct effect of an action that occurs at time T −1; and – ph(l, T ) is true if literal l possibly holds at time T . The program also contains a set of auxiliary predicates, including time, f luent, and action, for enumerating constants of sorts time, fluent, and action respectively; literal and contrary for defining literals and complementary literals, respectively2 . In our representation, letters T , F , L, and A (possibly indexed) are used to represent variables of sorts time, fluent, literal, and action correspondingly. Morever, we also use some shorthands: if a is an action then o(a, T ) = {o(e, T ) : e ∈ a}. For a set of fluent literals p, and a predicate symbol ρ ∈ {h, dc, ph}, ρ(p, T ) = {ρ(l, T ) : l ∈ p} and not ρ(p, T ) = {not ρ(l, T ) : l ∈ p}. For a fluent f , by l we mean ¬f if l = f and f if l = ¬f . Literals l and l are called contrary literals. For a set of literals p, p = {l : l ∈ p}. The set of rules of π(D) consists of those encoding the laws in D, those encoding the inertial axioms, and some auxiliary rules. We next describe these subsets of rules: 1. For each dynamic causal law (1) in D, the rules h(l, T +1) ← o(e, T ), h(p, T ) dc(l, T + 1) ← o(e, T ), h(p, T )
(4) (5)
belong to π(D). The first rule states that l holds at T + 1 if e occurs at T and the condition p holds at T . The second rule indicates that l is a direct effect of the execution of e. Since the state at the time moment T might be incomplete, we add to π(D) the rule ph(l, T + 1) ← o(e, T ), not h(p, T ) (6) which says that l might hold at T +1 if e occurs at T and the precondition p possibly holds at T . 2. For each static causal law (2) in D, π(D) contains the two rules: h(l, T ) ← h(p, T ) ph(l, T ) ← ph(p, T )
(7) (8)
These rules basically state that if p holds (or possibly holds) at T then so does l. 3. For each impossibility condition (3) in D, we add to π(D) the following rule: ← o(a, T ), not h(p, T )
(9)
This rule states that a cannot occur if the condition p possibly holds. 4. The inertial law is encoded as follows: ph(L, T + 1) ← not h(L, T ), not dc(L, T + 1) h(L, T ) ← not ph(L, T ), T = 0
(10) (11)
which says that L holds at the time moment T > 0 if its negation cannot possibly hold at T . 2
Some adjustment to this syntax is needed if one wants to use some of the existing answer set solvers. For instance, since Cmodels does not allow h(¬f, T ) we may replace it with, say, h(neg(f ), T ). Besides, to simplify our representation, we make use of choice rules introduced in [24].
An Approximation of Action Theories of AL and Its Application
177
5. Auxiliary rules: π(D) also contains the following rules: ← h(F, T ), h(¬F, T ) literal(F ) ← f luent(F ) literal(¬F ) ← f luent(F ) contrary(F, ¬F ) ← f luent(F ) contrary(¬F, F ) ← f luent(F )
(12) (13) (14) (15) (16)
The first constraint guarantees that two contrary literals cannot hold at the same time. The last four rules are used to define fluent literals and complementary literals. At this point, it is worthwhile to provide the intuition behind the of atoms dc(l, T ), h(l, T ), and ph(l, T ). Let a be an action and s be a partial state. Consider an “one-step” program Π = π(D, 1) ∪ {h(l, 0) | l ∈ s} ∪ {o(a, 0)}. Observe that Definition 1 implies that a literal l belongs to a possible next state if 1. it is an direct effect of a, i.e., l ∈ E(a, σ1 ); 2. it holds by inertial, i.e., l ∈ (σ1 ∩ σ2 ); or, 3. it is an indirect effects of a, i.e., l ∈ σ2 \ (E(a, σ1 ) ∪ (σ1 ∩ σ2 )). In other words, it is caused by a static causal law. Let S1 , S2 , and S3 denote the three sets of literals corresponding to the above three cases with respect to the partial state s. Since s might be incomplete, these three sets cannot be computed in full. Our approach is to conservatively estimate the next partial state by (i) underestimate S1 by considering only what definitely will hold given s. This set is encoded by the set of atoms of the form dc(l, 1) and is computed by the rule (5); (ii) overestimate the negation of S2 by considering what can possibly hold in the next state. This set is encoded by the set of atoms of the form ph(l, 1) and is computed by the rules (6) and (8); and (iii) underestimate S3 by considering only what definitely will hold and what cannot possibly change in the construction of the next state. This is encoded by the rules (10)-(11) and (7). Definition 3. Let T lp (D) be a transition diagram such that s, a, s ∈ T lp (D) iff s is a partial state and s = {l | h(l, 1) ∈ A} where A is the answer set of π(D, 1) ∪ h(s, 0) ∪ {o(a, 0)}. The following theorem3 show that T lp (D) is sound with respect to T (D). Theorem 1 (Soundness). If D is consistent then T lp (D) is a deterministic approximation of T (D).
4 Approximation Based Conformant Planners We will now turn our attention to the conformant planning problem in action theories of AL. We begin with the definition of a planning problem. 3
Proofs of theorems are omitted to save space.
178
T.C. Son et al.
Definition 4. A planning problem is a tuple D, s0 , sf where s0 and sf are partial states of D. Partial states s0 and sf characterize possible initial situations and the goal respectively. Definition 5. A chain of events α = a0 , . . . , an−1 is a solution to a planning problem P = D, s0 , sf if α is safe in s0 , and for every model M of α with a possible initial state σ0 ∈ comp(s0 ), M |= sf . We often refer to α as a plan for sf . If s0 is a state and action description D is deterministic then α is a “classical” plan, otherwise it is a conformant plan. We next illustrate these definitions using the well-known bomb-in-the-toilet example. Example 1 (Bomb in the toilet). There is a finite set of toilets and a finite set of packages. One of the packages contains a bomb. The bomb can be disarmed by dunking the package that contains it in a toilet. Dunking a package clogs the toilet. Flushing a toilet unclogs it. Packages can only be dunked in unclogged toilets, one package per toilet. The objective is to find a plan to disarm the bomb. This domain can be modeled by the action description D1 which consists of the following laws: dunk(P, E) causes ¬armed(P ) dunk(P, E) causes clogged(E) f lush(E) causes ¬clogged(E)
impossible dunk(P, E) if clogged(E) impossible {dunk(P, E), f lush(E)} impossible {dunk(P1 , E), dunk(P2 , E)} impossible {dunk(P, E1 ), dunk(P, E2 )}
E and P are variables for toilets and packages respectively; E1 and E2 stand for different toilets and P1 and P2 stand for different packages. Note that the last three statements specify physical impossibilities of some concurrent actions and the domain does not have a static causal law. Let n and m denote the number of packages and toilets respectively. A planning problem in this domain, denoted by BM T C(n, m), is often given by D1 , s0 , sf where s0 is a (possibly empty) collection of literals of the form ¬armed(P ), where P denotes some package. The goal sf contains {¬armed(1), . . . , ¬armed(n)}. Consider the problem BM T C(2, 1). We can easily check that if σ is a state containing ¬clogged(1) then σ, dunk(1, 1), σ is a transition in T (D1 ) where σ =(σ\ {armed(1), ¬clogged(1)})∪{¬armed(1), clogged(1)}. Furthermore, α = f lush(1), dunk(1, 1), f lush(1), dunk(2, 1) is safe in the partial state ∅ and α is a solution to the problem BM T C(2, 1).
2
It is not difficult to show that there is a close relationship between conformant plans and paths of an approximation T (D) of T (D). Because of the soundness of an approximation, it follows from Observation 1 that if s, α, s ∈ T (D), s ⊆ s0 , and sf ⊆ s then α is a safe solution in s0 of the planning problem D, s0 , sf . Since T lp (D) is an approximation of T (D), we can use the program π(D) to compute safe solutions of the planning problem P = D, s0 , sf . Furthermore, because T lp (D) is deterministic and computing the next state can be done in polynomial time, we can show that the complexity of the conformant planning problem with respect to T lp (D) is reduced to NP-complete (comparing to Σ2P , see [30]).
An Approximation of Action Theories of AL and Its Application
179
We will next describe the program π(P) for this purpose. Like π(D), the signature of π(P) includes terms corresponding to fluent literals and actions of D. We add to π(P) a constant, length, which represents the plan length, i.e., time steps can take value in the interval [0, length]. We also write π(P, n) to denote the program π(P) with length equal to n. π(P) consists of π(D) and the following rules: 1. Rules encoding the initial state: for each l ∈ s0 , we add to π(P) the rule: h(l, 0) ←
(17)
2. Goal encoding: for each l ∈ sf , π(P) contains the constraint: ← not h(l, length) This set of constraints makes sure that every literal in sf holds in the final state. 3. Action generation rule: as in other ASP-planners, π(P) contains the rule for generating action occurrences: 1{o(A, T ) : action(A)} ← T < length
(18)
which says that at each moment of time T , some action must occur4 . With the help of Theorem 1, we can prove the correctness of the planner π(P). Theorem 2. Let A be an answer set of π(P, n). It holds that – for every 0 ≤ i < n, if ai = {e | o(e, i) ∈ A} then ai is an action which is not prohibited in {l | h(l, i) ∈ A}; and – α = a0 , . . . , an−1 is a solution to P. This theorem allows us to use π(P) for computing minimal plans of P. This is done by sequentially computing the answer sets of π(P, 0), π(P, 1), . . .. In the next section, we will describe our experiments with π(P). From now on, we will refer to π(P) as CPASP5 . Before going on, we would like to mention that π(P) is not complete. One of the main reasons for the incompleteness of π(P) lies in its limited capability in reasoning-by-cases. The next example demonstrates this issue. Example 2. Consider the action description D2 consisting of two dynamic causal laws a causes f if g a causes f if ¬g Intuitively, we have that a is a conformant plan achieving f from ∅ because either g or ¬g is true in any state belonging to comp(∅). Yet, it is easy to verify that a cannot be generated by CPASP due to the fact that π(D2 , 1) ∪ h(∅, 0) ∪ {o(a, 0)} has a unique answer set containing no atom of the form h(l, 1). 2 The next example shows that it is not only conditional effects but also static causal laws can cause T lp to be incomplete. 4
5
If we wish to find a sequential plan, the only thing needed to do is to change the left side of the rule to 1{o(A, T ) : action(A)}1. CPASP stands for Conformant Planning using Answer Set Programming.
180
T.C. Son et al.
Example 3. Consider the action description D3 consisting of the following laws a causes f g if f, h g if f, ¬h We can check that a is a solution to the problem P3 = D3 , {¬f, ¬g}, {g} since a causes f to hold and the two static causal laws guarantee that if f holds then so does g. Yet, neither h(h, 1) nor h(¬h, 1) will belong to any answer set of π(P3 , 1) due to the rules (10) and (11). As such, π(P3 , 1) does not return an answer set, i.e., a cannot be found using T lp (D3 ). 2
5 Experiments We ran CPASP on both S MODELS and Cmodels [16]. In general, Cmodels yields better performance. The results reported in this paper are the times obtained using Cmodels. Since most answer set solvers do not scale up well to programs that require large grounded representation, we also implemented the approximation in a C++ planner, called CPAph ([28]). CPAph employs a best-first search strategy with the number of fulfilled subgoals as its heuristic function. Unlike CPASP, the current version of CPAph does not compute concurrent plans. However, CPAph allows disjunctions to be specified in the initial state description, while CPASP does not. Thus, CPASP cannot solve conformant planning benchmarks in the literature where the initial state specification contains disjunctions. We consider this as one of the weaknesses of CPASP. We compare CPASP (and CPAph ) with three other conformant planners CMBP[9], DLVk [12], and C-P LAN[8] because these planners do allow static causal laws and are similar in spirit of CPASP (that is, a planning problem is translated into an equivalent problem in a more general setting which can be solved by an off-the-shelf software system). While the latter two allow concurrent planning, the former does not. A comparison between DLVK and other planners like SGP [25] and GPT [5] can be found in [12]. For a comparison between CPAph and other state-of-the-art conformant planners like Conformant-FF [6], KACMBP [10], and POND [7], we refer the reader to [28]. We prepared two test suites: one contains sequential, conformant planning benchmarks and the other contains concurrent, conformant planning benchmarks. The first test suite includes two typical planning domains, the well-known Bomb-inthe-toilet and the Ring domains [10]. In the former, we consider two variants, BM T (n, p) and BM T C(n, p), where n and p are the numbers of packages and toilets respectively. The first one is without clogging and the second one is with clogging. The uncertainty in the initial state is that we do not know whether or not packages are disarmed. In the Ring domain, one can move in a cyclic fashion (either forward or backward) around a n-room building to lock windows. Each room has a window and the window can be locked only if it is closed. Initially, the robot is in the first room and it does not know the state (open/closed) of the windows. The goal is to have all windows locked. A possible conformant plan is to perform a sequence of actions forward, close, lock repeatedly. In this domain, we tested with n∈{2, 4, 6, 8, 10}. These domains, however, do not contain many static causal laws. Therefore, we introduce two new domains, called Domino and Gaspipe. The former is very simple. We have n dominos standing on a line in such a way that if one of them falls then the domino on its right also falls. There is a ball hanging close to the leftmost one. Touching
An Approximation of Action Theories of AL and Its Application
181
the ball causes the first domino to fall. Initially, the states of dominos are unknown. The goal is to have the rightmost one to fall. The solution is obviously to touch the ball. In this domain, we tested with n∈{100, 200, 500, 100, 2000, 5000, 10000}. The Gaspipe domain is a little more complicated. We need to start a flame in a burner, which is connected to a gas tank through a pipe line. The gas tank is on the left-most of the pipeline and the burner is on the right-most. The pipe line contains sections that connect with each other by valves. The state of pipe sections can be either pressured or unpressured. Opening a valve causes the section on its right side to be pressured if the section on its left is pressured. Moreover, to be safe, a valve can be opened only if the next valve on the line is closed. Closing a valve causes the pipe section on its right side to be unpressured. There are two kinds of static causal laws. The first one is that if a valve is open and the section on its left is pressured then the section on its right will pressured. Otherwise (either the valve is closed or the section on the left is unpressured), the pipe on the right side is unpressured. The burner will start a flame if the pipe connecting to it is pressured. The gas tank is always pressured. The uncertainty we introduce with the initial situation is that the states of valves are unknown. A possible conformant plan will be closing all valves but the first one (that is, the one that connects to the gas tank), in the right-to-left order and then opening them in the reverse order. We tested with n∈{3, 5, 7, 9, 11}. The last domain in the first test suite is the Cleaner domain. It is a modified version of the Ring domain. The difference is that instead of locking the window, the robot has to clean objects. Each room has p objects to be cleaned. Initially, the robot is at the first room and does not know whether or not objects are cleaned. The goal is to have all objects cleaned. While the Domino and Gaspipe domains expose a richness in static causal laws, the Cleaner domain provides a high degree of uncertainty in the initial state. We tested the domain with 6 problems where n∈{2, 5} and p∈{10, 50, 100} respectively. The second test suite includes benchmarks for concurrent, conformant planning. It contains four domains. The BM T p and BM T C p domains are variants of BM T and BM T C in the first test suite in which dunking different packages into different toilets at the same time is allowed. The Gaspipep is a modification of Gaspipe in which closing multiple valves at the time are allowed. In addition, one can open a valve while closing other valves. However, it is not allowed to open and close the same valve or open two different valves at the same time. The Cleaner domain is relaxed to allow cleaning multiple objects in the same room at the same time. The relaxed version is denoted by Cleanerp . The testing problems in the second test suite are the same as those in the first test suite. All experiments were made on a 2.4 GHz CPU, 768MB RAM machine, running Slackware 10.0 operating system. Time limit is set to half an hour. The testing results for two test suites are shown in Tables 1a) and 1b) respectively. We did not test CP LAN in the sequential planning benchmarks since it is supposed to use for concurrent planning6 . Times are shown in seconds; “PL”, “TO”, “MEM”, “NA” indicate the length of the plan found by the planner, that the planner ran out of time, that the planner ran out of memory, and that the planner returns a message indicating that no plan can be found7 , respectively. Since both DLVK and CPASP require as an input parameter the length of 6 7
The authors told us that C-P LAN was not intended for searching sequential plans. We did contact the authors’ of the planner for help and are waiting for a response.
182
T.C. Son et al.
Table 1. Comparison between CPASP, CPAph , CMBP DLVK , and C-P LAN in sequential DLVK , and C-P LAN in sequential a) Sequential Benchmarks b) Concurrent Benchmarks Domains Problems BM T (2, 2) BM T (4, 2) BM T (6, 2) BM T (8, 4) BM T (10, 4) BM T C(2, 2) BM T C(4, 2) BM T C(6, 2) BM T C(8, 4) BM T C(10, 4) Gaspipe(3) Gaspipe(5) Gaspipe(7) Gaspipe(9) Gaspipe(11) Cleaner(2, 2) Cleaner(2, 5) Cleaner(2, 10) Cleaner(4, 2) Cleaner(4, 5) Cleaner(4, 10) Cleaner(6, 2) Cleaner(6, 5) Cleaner(6, 10) Ring(2) Ring(4) Ring(6) Ring(8) Ring(10) Domino(100) Domino(200) Domino(500) Domino(1000) Domino(2000) Domino(5000) Domino(10000)
CMBP PL Time 2 0.03 4 0.167 6 0.206 8 0.633 10 1.5 2 0.166 6 0.269 10 0.749 TO TO NA NA NA NA NA 5 0.1 11 0.617 TO 11 0.13 TO TO 17 4.1 TO TO 5 0.01 11 0.116 17 0.5 TO TO 1 0.26 1 1.79 1 7.92 1 13.2 1 66.6 1 559.467 TO
DLVK PL Time 2 0.046 4 0.555 6 216.557 TO TO 2 0.121 6 72.442 TO TO TO 5 0.132 9 0.425 13 42.625 TO TO 5 0.104 11 214.696 TO 11 14.82 TO TO TO TO TO 0.201 0.638 TO TO TO 1 0.1 1 0.352 1 2.401 1 13.104 1 62.421 MEM MEM
CPASP CPAph PL Time PL Time 2 0.209 2 0.000 4 0.418 4 0.002 6 0.775 6 0.005 8 6.734 8 0.021 10 890.064 10 0.038 2 0.222 2 0.001 6 0.712 6 0.004 8 2.728 10 0.010 TO 12 0.031 TO 16 0.054 5 1.349 7 0.026 9 2.226 22 0.481 13 6.186 86 8.464 17 39.323 261 45.910 21 868.102 1327 529.469 5 0.496 5 0.002 11 3.88 11 0.012 TO 21 0.060 11 2.094 11 0.014 TO 23 0.082 TO 43 0.434 17 224.391 17 0.054 TO 35 0.311 TO 65 1.623 5 0.911 5 0.003 11 2.738 12 0.025 17 18.852 18 0.088 23 669.321 24 0.242 TO 30 0.542 1 0.216 1 0.026 1 0.285 1 0.099 1 0.747 1 0.568 1 1.236 1 2.313 1 2.414 1 9.209 1 6.076 1 67.619 1 12.584 1 350.129
Domains Problems BM T p (2, 2) BM T p (4, 2) BM T p (6, 2) BM T p (8, 4) BM T p (10, 4) BM T C p (2, 2) BM T C p (4, 2) BM T C p (6, 2) BM T C p (8, 4) BM T C p (10, 4) Gaspipep (3) Gaspipep (5) Gaspipep (7) Gaspipep (9) Gaspipep (11) Cleaner p (2, 2) Cleaner p (2, 5) Cleaner p (2, 10) Cleaner p (4, 2) Cleaner p (4, 5) Cleaner p (4, 10) Cleaner p (6, 2) Cleaner p (6, 5) Cleaner p (6, 10)
C-P LAN PL Time 1 0.078 2 0.052 3 1.812 2 4.32 TO 1 0.057 3 0.076 5 7.519 TO TO TO TO TO TO TO 3 0.052 3 0.121 3 0.06 7 0.068 7 0.09 7 0.131 11 0.116 11 0.195 11 0.357
DLVK PL Time 1 0.074 2 0.094 3 3.065 2 10.529 TO 1 0.059 3 0.908 5 333.278 TO TO 4 0.088 6 0.173 8 0.441 10 17.449 TO 3 0.076 3 0.066 3 0.076 7 0.196 7 0.809 7 237.637 11 4.475 11 986.731 TO
CPASP PL Time 1 0.116 2 0.268 3 0.346 2 0.248 3 1.911 1 0.13 3 0.3 5 0.672 3 0.508 5 1192.458 4 0.402 6 0.759 8 1.221 10 3.175 12 8.832 3 0.265 3 0.3 3 0.309 7 0.773 7 0.931 7 1.164 11 1.982 11 2.947 11 3.737
b)
a)
a plan to search for, we ran them by incrementally increasing the plan length, starting from 18 , until a plan is found. As can be seen in Table 1a), in the BM T and BM T C domains, CMBP outperforms both DLVK and CPASP in most problems. However, its performance is not competitive with CPAph which can solve the BM T C(10, 4) with only less than one tenth of a second (In fact, CPAph can scale up to larger problems, e.g., with 100 packages and 100 toilets, within the time limit). CPASP in general has better performance than DLVK in these domains. As an example, DLVK took more than three minutes to solve the BM T (6, 2), while it took only 0.775 seconds for CPASP to solve the same problem. Within the time limit, CPASP is able to solve more problems than DLVK . CPASP seems to work well with domains rich in static causal laws like Domino and Gaspipe. In the Domino domain, CPASP outperforms all the other planners in most of instances. It took only 2.414 seconds to solve Domino(2000), while both DLVK and CMBP took more than one minute. Although CPAph can solve all the instances in this domain, its performance is in general worse than CPASP’s. In the Gaspipe domain, CPASP and CPAph are competitive with each other and outperform the other two. The Cleaner domain turns out to be quite hard for the tested planners except CPAph . We believe that the high degree of uncertainty in the initial state is the main reason for this performance gain of CPAph comparing to others since it does not consider all possible cases in searching for a solution. CPASP is outperformed by both CMBP and DLVK in some small instances in the Ring domain. However, it can solve the Ring(8), while CMBP and DLVK cannot. 8
We did not start from 0 because none of the benchmarks has a plan of length 0.
An Approximation of Action Theories of AL and Its Application
183
Again, CPAph is the best. This shows that CPASP can be competitive with the tested conformant planners in some sequential planning benchmarks. Table 1b) shows that CPASP also has a fairly good performance in concurrent planning problems. It outperforms both DLVK and C-P LAN in most instances in the BM T p , BM T C p , and Gaspipep domains. DLVK is better than C-P LAN in the Gaspipep domain. On the contrary, C-P LAN is very good at the Cleanerp domain. To solve Cleaner (6, 10), C-P LAN took only 0.357 seconds , whereas DLVK ran out of time and CPASP needs 3.737 seconds.
6 Conclusion and Future Work We present a logic programming based approximation for AL action descriptions and apply it to conformant planning. We describe two conformant planners, CPASP and CPAph , whose key reasoning part is for computing the approximation. Our initial experiments show that with an appropriate approximation, logic programming based conformant planners can be built to deal with problems rich in static causal laws and incomplete information about the initial state. In other words, a careful study in approximated reasoning may pay off well in the development of practical planners. As an approximation can only guarantee soundness, it will be interesting to characterize situations when an approximation (e.g. T lp (D)) can yield completeness. For example, if T lp (D) can generate all conformant plans of length 1 and whenever a1 , . . . , f f a n is a solution to D, s, s , a2 , . .lp. , an is a solution to D, s , s where s = ∃σ∈comp(s).σ,a1 ,σ ∈T (D) σ , then T (D) is complete. It can be shown that the first condition can be met when D does not contain (i) a static causal law; (ii) a pair of dynamic causal laws of the form a causes f if p and a causes f if p with p ∩ p¯ = ∅; and (iii) a pair of impossibility conditions of the form impossible a if p and impossible a if p with p ∩ p¯ = ∅. Identifying sufficient conditions for the completeness of T lp (D) will be our main concern in the near future. At this point, we would like to mention that to verify that our approach can deal with a broad spectrum of planning problems, we tested CPASP and CPAph with several benchmarks problems [1] including the instances of the Blocks World domain tested in [12] and did not encounter a problem that the two planners cannot solve. This shows that our approach can deal with a large class of practical planning problems. Finally, we would like to point out that the use of logic programming allows us to easily exploit control knowledge (e.g., “do not dunk a package unless it is armed”) in improving the quality of a plan or to specify complex initial (incomplete)-states (see e.g., [13,27]). Acknowledgment: Michael Gelfond was partially supported by an ARDA contract. Tran Cao Son and Phan Huy Tu were partially supported by NSF grants EIA-0220590 and HRD-0420407.
References 1. F. Bacchus. The AIPS’00 Planning Competition. AI Magazine, 22(3), 2001. 2. C. Baral. Reasoning about Actions : Non-deterministic effects, Constraints and Qualification. In IJCAI’95, 2017–2023.
184
T.C. Son et al.
3. C. Baral, V. Kreinovich, and R. Trejo. Computational complexity of planning and approximate planning in the presence of incompleteness. Artificial Intelligence, 122:241–267, 2000. 4. C. Baral and M. Gelfond. Reasoning agents in dynamic domains. In J. Minker, editor, Logic-Based Artificial Intelligence, pages 257–279. Kluwer Academic Publishers, 2000. 5. B. Bonet and H. Geffner. GPT: a tool for planning with uncertainty and partial information. In IJCAI-01 Workshop on Planning with Uncertainty and Partial Information, 82–87, 2001. 6. R. Brafman and J. Hoffmann. Conformant planning via heuristic forward search: A new approach. In (ICAPS-04), 355–364. 7. D. Bryce and S. Kambhampati. Heuristic Guidance Measures for Conformant Planning. In (ICAPS-04), 365–375, 2004. 8. C. Castellini, E. Giunchiglia, and A. Tacchella. SAT-based Planning in Complex Domains: Concurrency, Constraints and Nondeterminism. Artificial Intelligence, 147:85–117, 2003. 9. A. Cimatti and M. Roveri. Conformant Planning via Symbolic Model Checking. Journal of Artificial Intelligence Research, 13:305–338, 2000. 10. A. Cimatti, M. Roveri, and P. Bertoli. Conformant Planning via Symbolic Model Checking and Heuristic Search. Artificial Intelligence Journal, 159:127–206, 2004. 11. S. Edelkamp, J. Hoffmann, M. Littman, and H. Younes. The IPC-2004 Planning Competition, 2004. http://ls5-www.cs.uni-dortmund.de/∼edelkamp/ipc-4/. 12. T. Eiter, W. Faber, N. Leone, G. Pfeifer, and A. Polleres. A Logic Programming Approach to Knowledge State Planning, II: The DLVK System. AIJ, 144(1-2):157–211, 2003. 13. M. Gelfond and R. Morales. Encoding conformant planning in a-prolog. DRT’04. 14. M. Ghallab et al. PDDL — the Planning Domain Definition Language. Version 1.2. Technical Report CVC TR98003/DCS TR1165, Yale Center for Comp, Vis and Ctrl, 1998. 15. E. Giunchiglia, G. Kartha, and V. Lifschitz. Representing action: indeterminacy and ramifications. Artificial Intelligence, 95:409–443, 1997. 16. Y. Lierler and M. Maratea. Cmodels-2: SAT-based Answer Set Solver Enhanced to Non-tight Programs. In LPNMR’04, 346–350, LNCS 2923, 2004. 17. V. Lifschitz. On the Logic of Causal Explanation (Research Note). AIJ, 96(2):451–465. 18. F. Lin. Embracing causality in specifying the indirect effects of actions. IJCAI’95, 1985–93. 19. D. Long and M. Fox. The 3rd International Planning Competition: Results and Analysis. JAIR, 20:1–59, 2003. 20. N. McCain & H. Turner. A causal theory of ramifications and qualifications. IJCAI’95, 1978–1984. 21. N. McCain & M. Turner. Causal theories of action and change. AAAI’97, 460–467. 22. S. McIlraith. Intergrating actions and state constraints: A closed-form solution to the ramification problem (sometimes). Artificial Intelligence, 116:87–121, 2000. 23. M. Shanahan. The ramification problem in the event calculus. In IJCAI’99, 140–146, 1999. 24. P. Simons, N. Niemel¨a, and T. Soininen. Extending and Implementing the Stable Model Semantics. Artificial Intelligence, 138(1–2):181–234, 2002. 25. D. Smith and D. Weld. Conformant graphplan. In Proceedings of AAAI 98, 1998. 26. T.C. Son and C. Baral. Formalizing sensing actions - a transition function based approach. Artificial Intelligence, 125(1-2):19–91, January 2001. 27. T.C. Son, C. Baral, N. Tran, and S. McIlraith. Domain-Dependent Knowledge in Answer Set Planning. To appear in TOCL. 28. T.C. Son, P.H. Tu, M. Gelfond, and R. Morales. Conformant Planning for Domains with Constraints — A New Approach. To Appear in AAAI’05. 29. S. Thiebaux, J. Hoffmann, and B. Nebel. In Defense of PDDL Axioms. IJCAI’03. 30. H. Turner. Polynomial-length planning spans the polynomial hierarchy. JELIA’02, 111–124.
Game-Theoretic Reasoning About Actions in Nonmonotonic Causal Theories Alberto Finzi1,2 and Thomas Lukasiewicz1,2 1
2
Institut f¨ur Informationssysteme, Technische Universit¨at Wien Favoritenstraße 9-11, A-1040 Vienna, Austria {finzi, lukasiewicz}@kr.tuwien.ac.at
Dipartimento di Informatica e Sistemistica, Universit`a di Roma “La Sapienza” Via Salaria 113, I-00198 Rome, Italy {finzi, lukasiewicz}@dis.uniroma1.it
Abstract. We present the action language GC+ for reasoning about actions in multi-agent systems under probabilistic uncertainty and partial observability, which is an extension of the action language C+ that is inspired by partially observable stochastic games (POSGs). We provide a finite-horizon value iteration for this framework and show that it characterizes finite-horizon Nash equilibria. We also describe how the framework can be implemented on top of nonmonotonic causal theories. We then present acyclic action descriptions in GC+ as a special case where transitions are computable in polynomial time. We also give an example that shows the usefulness of our approach in practice.
1 Introduction There are several important problems that we have to face in reasoning about actions for mobile agents in real-world environments. First and foremost, we have to deal with uncertainty, both about the initial situation of the agent’s world and about the results of the actions taken by the agent (due to noisy effectors and/or sensors). Second, a closely related problem is that the properties of real-world environments are in general not fully observable (due to noisy and inaccurate sensors, or because some relevant parts of the environment simply cannot be sensed), and thus we also have to deal with partial observability. One way of adding uncertainty and partial observability to reasoning about actions is based on qualitative models in which all possible alternatives are equally taken into consideration. Another way is based on quantitative models where we have a probability distribution on the set of possible alternatives, and thus can numerically distinguish between the possible alternatives. Well-known first-order formalisms for reasoning about actions such as the situation calculus [24] easily allow for expressing qualitative uncertainty about the effects of actions and the initial situation of the world through disjunctive knowledge. Furthermore, there are generalizations of the action language A [12] that allow for qualitative uncertainty in the form of nondeterministic actions. An important recent formalism in this family is the action language C+ [13], which is based on the theory of nonmonotonic causal reasoning presented in [18], and has evolved from the action language C. In C. Baral et al. (Eds.): LPNMR 2005, LNAI 3662, pp. 185–197, 2005. c Springer-Verlag Berlin Heidelberg 2005
186
A. Finzi and T. Lukasiewicz
addition to allowing for conditional and nondeterministic effects of actions, C+ also supports concurrent actions as well as indirect effects and preconditions of actions through static causal laws. Closely related to it is the recent planning language K [7]. There are a number of formalisms for probabilistic reasoning about actions. In particular, Bacchus et al. [1] propose a probabilistic generalization of the situation calculus, which is based on first-order logics of probability, and which allows to reason about an agent’s probabilistic degrees of belief and how these beliefs change when actions are executed. Poole’s independent choice logic [22] is based on acyclic logic programs under different “choices”. Each choice along with the acyclic logic program produces a first-order model. By placing a probability distribution over the different choices, we then obtain a distribution over the set of first-order models. Boutilier et al. [5] introduce and explore an approach to first-order (fully observable) Markov decision processes (MDPs) [23] that are formulated in a probabilistic generalization of the situation calculus. A companion paper [6] presents a generalization of Golog, called DTGolog, that combines agent programming in Golog with decision-theoretic planning in MDPs. Probabilistic extensions of the action language A and its most recent variant C+ have especially been proposed by Baral et al. [2] and Eiter and Lukasiewicz [8]. Many of the above logical formalisms for reasoning about actions under probabilistic uncertainty take inspiration from decision-theoretic planning in fully observable Markov decision processes (MDPs) [23] and the more general partially observable Markov decision processes (POMDPs) [16]. Such logical formalisms for reasoning about actions that are inspired by decision-theoretic planning are also appealing from the perspective of decision-theoretic planning, since they allow for [11,14] (i) compactly representing MDPs and POMDPs without explicitly referring to atomic states and state transitions, (ii) exploiting such compact representations for efficiently solving large-scale problems, and (iii) nice properties such as modularity (parts of the specification can be easily added, removed, or modified) and elaboration tolerance (solutions can be easily reused for similar problems with few or no additional effort). The above generalizations of A and C+ in [2,8] assume that the model of the world consists of a single agent that we want to control and the environment summarized in “nature”. In realistic applications, however, we often encounter multiple agents, which may compete or cooperate with each other. Here, the optimal actions of one agent generally depend on the actions of all the other agents. In particular, there is a bidirectional dependence between the actions of two agents, which generally makes it inappropriate to model enemies and friends of the controlled agent simply as a part of “nature”. There are generalizations of MDPs and POMDPs to multi-agent systems with cooperative agents, called multi-agent MDPs [4] and decentralized POMDPs [3,20], respectively. Similarly, there are also generalizations of MDPs and POMDPs to multi-agent systems with competing (that is, not necessarily cooperative) agents, called stochastic games [21] (or Markov games [25,17]) and partially observable stochastic games (POSGs) [15,9], respectively. Multi-agent MDPs (resp., decentralized POMDPs) and stochastic games (resp., POSGs) are similar to MDPs (resp., POMDPs), except that actions (and decisions) are distributed among multiple agents, where the optimal actions of each agent may depend on the actions of all the other agents. Stochastic games (resp., POSGs) generalize both normal form games [26] and MDPs (resp., POMDPs).
Game-Theoretic Reasoning About Actions in Nonmonotonic Causal Theories
187
In this paper, we present the language GC+ for reasoning about actions in multiagent systems under probabilistic uncertainty and partial observability, which is an extension of the language C+ that takes inspirations from partially observable stochastic games (POSGs) [15]. The main contributions of this paper are as follows: – We present the action language GC+ for reasoning about actions in multi-agent systems under probabilistic uncertainty and partial observability, which is an extension of both the action language C+ and POSGs. We consider the very general case in which the agents may have different rewards, and thus may be competitive. Here, we assume that planning and control are centralized as follows. All agents transmit their local belief states and/or observations to a central agent, which then computes and returns the optimal local action for each agent. – Under the above assumption, the high worst-case complexity of POSGs (NEXPcompleteness for the special case of decentralized POMDPs [3]) is avoided, since the POSG semantics of GC+ can be translated into a belief state stochastic game semantics. We use the latter to define a finite-horizon value iteration for GC+, and show that it characterizes finite-horizon Nash equilibria. – We show that the GC+ framework can be implemented on top of reasoning in nonmonotonic causal theories. We present acyclic action descriptions in GC+ as a special case where transitions are computable in polynomial time. We also provide an example that shows the usefulness of our approach in practice. Note that further technical details are given in the extended paper [10].
2 Preliminaries In this section, we recall the basic concepts of the action language C+, normal form games, and partially observable stochastic games. 2.1 The Action Language C+ We first recall the main concepts of the action language C+; see especially [13] for further details, motivation, and background. Syntax. Properties of the world are represented by rigid variables, simple fluents, and statically determined fluents, while actions are expressed by action variables. The values of rigid variables do not change when actions are performed, while the ones of simple (resp., statically determined) fluents may directly (resp., indirectly) change through actions. The knowledge about the latter is encoded through dynamic (resp., static) causal laws over formulas, which are Boolean combinations of atomic assignments. Formally, we thus assume a finite set V of variables, which are divided into rigid variables, simple fluents, statically determined fluents, and action variables. Every variable X ∈ V may take on values from a nonempty finite domain D(X), where every action variable has the Boolean domain {⊥, }. We define formulas inductively as follows. False and true, denoted ⊥ and , respectively, are formulas. If X ∈ V and x ∈ D(X), then X = x is a formula (called atom). If φ and ψ are formulas, then also ¬φ and (φ ∧ ψ). A literal is an atom X = x or a negated atom ¬X = x (abbreviated as X = x). We often abbreviate X = (resp., X = ⊥) as X (resp., ¬X).
188
A. Finzi and T. Lukasiewicz
Static causal laws express static knowledge about fluents and rigid variables. They are expressions of the form caused ψ if φ ,
(1)
where ψ and φ are formulas such that either (a) every variable in ψ is a fluent, and no variable in φ is an action variable, or (b) every variable in ψ and φ is rigid. Informally, (1) encodes that every state of the world that satisfies φ should also satisfy ψ. If φ = , then (1) is abbreviated by caused ψ. Dynamic causal laws express how simple fluents change when actions are performed. They have the form caused ψ if φ after θ ,
(2)
where ψ, φ, and θ are formulas such that every variable in ψ is a simple fluent, and no variable in φ is an action variable. Informally, (2) encodes that every next state of the world satisfying φ should also satisfy ψ, if the current state and the executed action satisfy θ. If φ = , then (2) is abbreviated by caused φ after θ. If also θ = a1 ∧· · ·∧ak ∧ δ, where every ai is an assignment of to an action variable, then (2) is abbreviated by a1 , . . . , ak causes ψ if δ. Informally, if the current state of the world satisfies δ, then the next state after concurrently executing a1 , . . . , ak satisfies ψ. If ψ = ⊥ and φ = , then (2) is an execution denial and abbreviated by nonexecutable θ .
(3)
Informally, if a state s and an action α satisfy θ, then α is not executable in s. If θ = a1 ∧ · · · ∧ ak ∧ δ, then (3) is abbreviated by nonexecutable a1 , . . . , ak if δ. Informally, a1 , . . . , ak cannot be concurrently executed in a state satisfying δ. The expression inertial X, where X ∈ V , abbreviates the set of all laws (2) such that φ = ψ = θ = X=x and x ∈ D(X). Informally, the value of X remains unchanged when actions are executed, as long as this does not produce any inconsistencies. A causal law (or axiom) is a static or dynamic causal law. An action description D is a finite set of causal laws. An initial database φ is a formula without action variables. Semantics. An action description D represents a system of transitions from states to sets of possible successor states, while an initial database φ encodes a set of possible initial states. We now define states and actions, the executability of actions in states, and the above transitions through actions. An interpretation I of a set of variables V ⊆ V assigns to every X ∈ V an element of D(X). We say I satisfies an atom Y = y, where Y ∈ V , denoted I |= Y = y, iff I(Y ) = y. Satisfaction is extended to all formulas over V as usual. Let s be an interpretation of all rigid variables and fluents in V . Let Ds be the set of all ψ such that either (a) s |= φ for some caused ψ if φ in D, or (b) s |= ψ and ψ = X=x for some simple fluent X ∈ X and x ∈ D(X). A state s of D is an interpretation s as above that is a unique model of Ds . An action α is an interpretation of all action variables in V . The action α is executable in a state s, denoted Poss(α, s), iff s ∪ α satisfies ¬θ for every nonexecutable θ in D. An action transition is a triple (s, α, s ), where s and s are states of D such that s(X) = s (X) for every rigid variable X ∈ V , and α is an action that is executable in s. A formula ψ is caused in (s, α, s ) iff either (a) s |= φ for some caused ψ if φ in D, or (b) s ∪ α |= θ and s |= φ for some caused ψ if φ after θ in D. The triple (s, α, s ) is causally explained iff s is the only interpretation that satisfies all formulas caused
Game-Theoretic Reasoning About Actions in Nonmonotonic Causal Theories
189
in (s, α, s ). For every state s and action α, define Φ(s, α) as the set of all states s such that (s, α, s ) is causally explained. Note that Φ(s, α) = ∅ if no such (s, α, s ) exists, in particular, if α is not executable in s. We say that D is consistent iff Φ(s, α) = ∅ for all actions α and states s such that α is executable in s. Informally, Φ(s, α) is the set of all possible successor states after executing α in s. 2.2 Normal Form Games Normal form games from classical game theory [26] describe the possible actions of n 2 agents and the rewards (or utilities) that the agents receive when they simultaneously execute one action each. For example, in two-finger Morra, two players E and O simultaneously show one or two fingers. Let f be the total numbers of fingers shown. If f is odd, then O gets f dollars from E, and if f is even, then E gets f dollars from O. Formally, a normal form game G = (I, (Ai )i∈I , (Ri )i∈I ) consists of a set of agents I = {1, . . . , n}, n 2, a nonempty finite set of actions Ai for each agent i ∈ I, and a reward (or utility) function Ri : A → R for each agent i ∈ I, which associates with every joint action a ∈ A = ×i∈I Ai a reward (or utility) Ri (a) to agent i. A pure (resp., mixed) strategy specifies which action an agent should execute (resp., which actions an agent should execute with which probability). Formally, a pure strategy for agent i ∈ I is any action ai ∈ Ai . A pure strategy profile is any joint action a ∈ A. If the agents play a, then the reward to agent i ∈ I is Ri (a). A mixed strategy for agent i ∈ I is any probability distribution πi over Ai . A mixed strategy profile π = (πi )i∈I consists of a mixed strategy πi for each agent i ∈ I. If the agents play π, then the expected reward to agent i ∈ I, denoted E[Ri (a) | π] (or Ri (π)), is defined as a=(aj )j∈I ∈A
Ri (a) · Πj∈I πj (aj ) .
We are especially interested in mixed strategy profiles π, called Nash equilibria, where no agent has the incentive to deviate from its part, once the other agents play their parts. A mixed strategy profile π = (πi )i∈I is a Nash equilibrium for G iff for every agent i ∈ I, it holds that Ri (πi ◦ π−i ) Ri (π) for every mixed strategy πi , where π−i (resp., πi ◦ π−i ) is obtained from π by removing πi (resp., replacing πi by πi ). Every normal form game G has at least one Nash equilibrium among its mixed (but not necessarily pure) strategy profiles, and many have multiple Nash equilibria. A Nash selection function f associates with every normal form game G a unique Nash equilibrium f (G). The expected reward to agent i ∈ I under f (G) is denoted by vfi (G). 2.3 Partially Observable Stochastic Games We will use POSGs [15] to define the semantics of the action language GC+, where we assume that planning and control are centralized as follows. There exists a central agent, which (i) knows the local belief state of every other agent, (ii) computes and sends them their optimal local actions, and (iii) thereafter receives their local observations. Hence, we assume a transmission of local belief states and local observations to a central agent from all other agents, and of the optimal local actions in the reverse direction. Using this assumption, we can translate POSGs into belief state stochastic games, and then perform a finite-horizon value iteration.
190
A. Finzi and T. Lukasiewicz
Roughly, a POSG consists of a nonempty finite set of states S, a normal form game for each state s ∈ S, a set of joint observations of the agents O, and a transition function that associates with every state s ∈ S and joint action of the agents a ∈ A a probability distribution on all combinations of next states s ∈ S and joint observations o ∈ O. Formally, a partially observable stochastic game (POSG) G = (I, S, (Ai )i∈I , (Oi )i∈I , P, (Ri )i∈I ) consists of a set of agents I = {1, . . . , n}, n 2, a nonempty finite set of states S, two nonempty finite sets of actions Ai and observations Oi for each agent i ∈ I, a transition function P : S × A → PD (S × O), which associates with every state s ∈ S and joint action a ∈ A = ×i∈I Ai a probability distribution over S × O, where O = ×i∈I Oi , and a reward function Ri : S × A → R for each agent i ∈ I, which associates with every state s ∈ S and joint action a ∈ A a reward Ri (s, a) to agent i. Since the actual state s ∈ S of the POSG G is not fully observable, every agent i ∈ I has a belief state bi that associates with every state s ∈ S the belief of agent i about s being the actual state. Formally, a belief state b = (bi )i∈I of G consists of a probability function bi over S for each agent i ∈ I. The POSG G then defines probabilistic transitions between belief states as follows. The new belief state ba,o = (ba,o i )i∈I after executing the joint action a ∈ A in b = (bi )i∈I and jointly observing o ∈ O is given by: ba,o i (s ) =
s∈S
P (s , o | s, a) · bi (s) / Pb (ba,o | bi , a), where i
| bi , a) = Pb (ba,o i
s ∈S
s∈S
P (s , o | s, a) · bi (s)
is the probability of observing o after executing a in bi . These probabilistic transitions define the fully observable stochastic game over belief states G = (I, B, (Ai )i∈I , Pb , (Ri )i∈I ), where B is the set of all belief states of G. We next define finite-horizon pure and mixed policies and their rewards and expected rewards, respectively, using the above fully observable stochastic game over belief states. Assuming a finite horizon H 0, a pure (resp., mixed) time-dependent policy associates with every belief state b of G and number of steps to go h ∈ {0, . . . , H} a pure (resp., mixed) normal form game strategy. Formally, a pure policy α assigns to each belief state b and number of steps to go h ∈ {0, . . . , H} a joint action from A. A mixed policy is of the form π = (πi )i∈I , where every πi assigns to each belief state b and number of steps to go h ∈ {0, . . . , H} a probability function πi [b, h] over Ai . The H-step reward (resp., expected H-step reward) for pure (resp., mixed) policies can now be defined as usual. In particular, the expected H-step reward to agent i ∈ I under a start belief state b=(bi )i∈I and the mixed policy π, denoted Gi (H, b, π), is defined as
a∈A (Πj∈I πj [b, 0](aj ))·
s∈S
bi (s)Ri (s, a)
a∈A (Πj∈I πj [b, H](aj ))·( s∈S bi (s)Ri (s, a)+ a,o a,o P (b |b , a) · G , π)) i i (H−1, b i o∈O
if H = 0; otherwise.
The notion of a finite-horizon Nash equilibrium for a POSG G is then defined as follows. A policy π is a Nash equilibrium of G under a belief state b iff for every agent i ∈ I, it holds that Gi (H, b, πi ◦ π−i ) Gi (H, b, πi ◦ π−i ) for all policies πi . A policy π is a Nash equilibrium of G iff it is a Nash equilibrium of G under every belief state b. Nash equilibria of G can be characterized by finite-horizon value iteration from local Nash equilibria of normal form games as follows. Let f be an arbitrary Nash selection function for normal form games with the action sets (Ai )i∈I . For every belief state b=(bi )i∈I and number of steps to go h ∈ {0, . . . , H}, let G[b, h] = (I, (Ai )i∈I , (Qi [b, h])i∈I ), where Qi [b, h](a) is defined as follows (for all a ∈ A and i ∈ I):
Game-Theoretic Reasoning About Actions in Nonmonotonic Causal Theories
s∈S s∈S
if h = 0;
bi (s)Ri (s, a) bi (s)Ri (s, a) +
191
a,o o∈O P (bi
|bi , a) ·
vfi (G[ba,o , h−1])
otherwise.
Let the mixed policy π = (πi )i∈I for the POSG G be defined by πi (b, h) = fi (G[b, h]) for all i ∈ I, belief states b, and number of steps to go h ∈ {0, . . . , H}. Then, π is a Nash equilibrium of G, and Gi (H, b, π) = vfi (G[b, H]) for every i ∈ I and belief state b.
3 The Action Language GC+ In this section, we define the action language GC+, which generalizes both the action language C+ and POSGs. Syntax. We extend C+ by formulas that express probabilistic transitions and agent rewards as in POSGs as well as formulas that encode the initial belief state of the agents. We assume a set of n 2 agents I = {1, . . . , n}. Each agent i ∈ I has (i) a nonempty set of action variables AV i , where AV 1 , . . . , AV n partitions the set of all action variables AV ⊆ V , and (ii) a nonempty set of possible observations Oi . Every o ∈ O = ×i∈I Oi is a joint observation. A probabilistic dynamic causal law is of the form caused [(ψ1 if φ1 ; o1 ) : p1 , . . . , (ψk if φk ; ok ) : pk ] after δ ,
(4)
where every caused ψj if φj after δ with j ∈ {1, . . . , k} is a dynamic causal law, every oj is a joint observation, p1 , . . . , pk > 0, p1 + · · · +pk = 1, and k 1. Informally, if an action α is executed in a state s, where s ∪ α |= δ, then with the probability pj the successor states satisfy caused ψj if φj and the agents observe oj . We omit “if φj ” in (4), when φj = . A reward law for agent i ∈ I is of the form reward i : r after δ ,
(5)
where r is a real. Informally, if an action α is executed in a state s, where s ∪ α |= δ, then agent i receives the reward r. A probabilistic initial database law for i ∈ I is of form i : [ψ1 : p1 , . . . , ψk : pk ] ,
(6)
where each ψj with j ∈ {1, . . . , k} is a formula without action variables, p1 , . . . , pk > 0, p1 + · · · +pk = 1, and k 1. Informally, the initial belief of agent i is that the set of states satisfying ψj holds with the probability pj . A probabilistic action description P is a finite set of causal, probabilistic dynamic causal, and reward laws. A probabilistic initial database Ψ = (Ψi )i∈I consists of a probabilistic initial database law Ψi for every agent i ∈ I. Semantics. A probabilistic action description P represents a transition system, where every state s and action α executable in s is associated with a reward to every agent and a probability distribution over possible successor states. A probabilistic initial database Ψ = (Ψi )i∈I encodes each agent’s probabilistic belief about the possible initial states. The set of all states and actions of P and the executability of an action in a state are defined as in Section 2.1. An action for agent i ∈ I is any interpretation over AV i . The set of all actions for agent i is denoted by Ai . We next define the probabilistic transitions and the rewards encoded in P .
192
A. Finzi and T. Lukasiewicz
Let s be a state, and let α be an action executable in s. Suppose that P contains exactly one law F of the form (4) such that s ∪ α |= δ. For every j ∈ {1, . . . , k}, let Pj be obtained from P by replacing F by caused ψj if φj after δ. Let Φj (s, α) be the set of all states s such that (s, α, s ) is causally explained relative to Pj . For each state s and o ∈ O, let Pj (s , o|s, α) = pj / |Φj (s, α)|, if s ∈ Φj (s, α) and o = oj , and Pj (s , o|s, α) = 0, otherwise. Informally, pj is uniformly distributed among all s ∈ Φj (s, α). For each state s and o ∈ O, the probability of moving to the successor state s along with jointly observing o, when executing α in s, denoted P (s , o|s, α), is k defined as j=1 Pj (s , o|s, α). Let s be a state, and let α be an action executable in s. Suppose for every agent i ∈ I, exactly one law reward i : r after δ with s ∪ α |= δ belongs to P . Then, the reward to i when executing α in s, denoted Ri (s, α), is defined as r. We next define the initial probabilistic belief of every agent i ∈ I, which is encoded in the law Ψi of the form (6). For each j ∈ {1, . . . , k}, let Φj be the set of all states satisfying ψj . For each state s, let Pj (s) = pj / |Φj |, if s ∈ Φj , and Pj (s) = 0, otherwise. k Agent i’s belief about s being the initial state, denoted b0i (s), is defined as j=1 Pj (s). In the sequel, we implicitly assume that all P and Ψ are consistent: We say that P is consistent iff for each state s and action α executable in s, (i) there is exactly one law (4) in P with s ∪ α |= δ, (ii) each Φj (s, α) as above is nonempty, and (iii) for every agent i ∈ I, there is exactly one law reward i : r after δ in P with s ∪ α |= δ. We say that Ψ is consistent iff, for every i ∈ I, each Φj as above is nonempty. Example 3.1 (Two Robots). We consider the scenario shown in Fig. 1: There are two robots a1 and a2 in a room looking for an object o1 , and trying to bring it out through the only door d1 . Both robots can pick up the object, and also pass it to another robot. A pass attempt is only possible if the two robots are facing in adjacent positions. If the receiving robot is not expecting the object, then it falls down. If the two robots are in the same location, then they both cannot perform any pick up and door crossing action. We assume that the reward for the robot bringing out the object is a bit higher. Hence, there is an additional individual payoff for the robot able to accomplish the goal. Let L = {l1,1 , . . . , l2,3 , d1 , nil } be the set of possible locations of the robots and the object, where li,j encodes the field (i, j), and d1 represents the door. For locations L and L , let close(L, L ) be true iff L and L are adjacent. We assume the simple fluents at (X), where X ∈ {a1 , a2 , o1 }, with the domain L, as well as holds (R), where R ∈ {a1 , a2 }, with the domain {o1 , nil }. Let the action variables be given by = R , goTo(R, L), pickUp(R), passTo(R, R ), receive(R), where R, R ∈ {a1 , a2 }, R 1111111111 0000000000 0000000000 1111111111 0000000000 1111111111 0000000000 1111111111 0000000000 1111111111 0000000000 1111111111 0000000000 1111111111 0000000000 1111111111 0000000000 1111111111 0000000000 1111111111 0000000000 1111111111 o1 0000000000 1111111111 a1 0000000000 1111111111 0000000000 1111111111 0000000000 1111111111 ? 0000000000 1111111111 0000000000 1111111111 0000000000 1111111111 o1 0000000000 1111111111 0000000000 1111111111 0000000000 1111111111 a2 0000000000 1111111111 0000000000 1111111111 0000000000 1111111111 0000000000 1111111111 0000000000 1111111111 0000000000 1111111111
1111111111 0000000000 0000000000 1111111111 0000000000 1111111111 0000000000 1111111111 0000000000 1111111111 0000000000 1111111111 0000000000 1111111111 0000000000 1111111111 0000000000 1111111111 0000000000 1111111111 0000000000 1111111111 o1 0000000000 1111111111 a1 0000000000 1111111111 0000000000 1111111111 0000000000 1111111111 ? 0000000000 1111111111 o1 0000000000 1111111111 0000000000 1111111111 0000000000 1111111111 0000000000 1111111111 0000000000 1111111111 a2 0000000000 1111111111 0000000000 1111111111 0000000000 1111111111 0000000000 1111111111 0000000000 1111111111 0000000000 1111111111
Fig. 1. Initial belief states of a2 and a1 , respectively
Game-Theoretic Reasoning About Actions in Nonmonotonic Causal Theories
193
and L ∈ L. Each robot’s set of observations is {obs(holds), obs(notHolds)}. Informally, each robot can only check if it is carrying something or not after a pick up. We assume the following static causal law: caused at (O) = nil if holds(R) = O .
We introduce the following dynamic causal laws for the action variables passTo(R,R ), receive(R), and goTo(R, L) (they abbreviate probabilistic causal laws (4) with k = 1): caused holds(R) = nil after passTo(R, R ) with R = R , caused holds(R) = O after holds(R ) = O ∧ passTo(R , R) ∧ receive(R) with R = R , caused at (O) = L after holds(R) = O ∧ passTo(R, R ) ∧ = R , ¬receive(R ) ∧ at (R, L) with R caused at (R) = L after goTo(R, L) .
Here, if R fails to pass the object O, the latter remains in the location of R. For pickUp(R), we introduce the following probabilistic causal law, assuming pickUp(R) can fail, and obs(notHolds) can give incorrect positive results: caused [(holds(R) = O ; obs(holds)) : 0.7, (holds(R) = O ; obs(notHolds )) : 0.1, (holds(R) = nil ; obs(notHolds)) : 0.2] after pickUp(R) ∧ at(R) = L ∧ at(O) = L ,
We assume the following execution denials: nonexecutable pickUp(R) ∧ holds(R) = nil , = L, nonexecutable pickUp(R) ∧ at(R) = L ∧ at(o1 ) nonexecutable pickUp(R) ∧ at(R ) = L ∧ at (R) = L , nonexecutable goTo(R, L) ∧ at (R) = L ∧ ¬close(L, L ) , nonexecutable goTo(R, d1 ) ∧ at (R) = L ∧ at (R ) = L , nonexecutable passTo(R, R ) ∧ at(R)=L ∧ at(R )=L ∧ ¬close(L, L ) .
where R = R and L = L. Furthermore, every robot can execute only one action at a time, that is, for any two distinct actions α and α of either robot a1 or a2 : nonexecutable α ∧ α .
For every simple fluent X, we assume the inertial law inertial X. Finally, the reward function is defined as follows: reward ai reward ai reward ai reward ai
: 100 after αi ∧ holds(ai , O) , : 90 after αi ∧ holds(aj , O) with i =j, : 10 after α ∧ holds(ai , O) with α = αi , : 0 after α ∧ i=1,2 ¬holds(ai , O) with α = αi .
where αi = goTo(ai , d1 ). The robot achieving the goal receives a high reward, the other one a bit less. If a robot moves carrying something, it also receives a small payoff.
4 Finite-Horizon Value Iteration In this section, we define finite-horizon Nash equilibria for probabilistic action descriptions P in GC+ and provide a finite-horizon value iteration for computing them.
194
A. Finzi and T. Lukasiewicz
Nash Equilibria. We first define belief states and probabilistic transitions between them. A belief state of P is of the form b = (bi )i∈I , where every bi is a probability function over the set of states of P . An action α is executable in b = (bi )i∈I iff for every i ∈ I the action α is executable in some state s with bi (s) > 0. Then, the new belief state bα,o = (bα,o i )i∈I after executing α in b and observing o ∈ O is given by: bα,o i (s )=
P (bα,o i
s∈S,Poss(α,s)
| bi , α) =
P (s , o|s, α)·bi (s)/P (bα,o i |bi , α), where
s ∈S
s∈S, Poss(α,s)
P (s , o | s, α) · bi (s)
is the probability of observing o after executing α in bi . A mixed policy is of the form π = (πi )i ∈ I , where each πi assigns to every belief state b and number of steps to go h ∈ {0, . . . , H} a probability function over Ai . The expected H-step reward to i ∈ I under an initial belief state b=(bi )i∈I and the mixed policy π, denoted Gi (H, b, π), is defined as
α (Πj∈I πj [b, 0](αj ))·
s∈S,Poss(α,s)
bi (s)Ri (s, α) if H = 0;
α (Πj∈I πj [b, H](αj ))·( s∈S,Poss(α,s) bi (s)Ri (s, α)+ α,o P (b |b , α) · Gi (H−1, bα,o , π)) otherwise. i i o∈O
A policy π is a Nash equilibrium of G iff for each agent i ∈ I and each belief state b, it holds that Gi (H, b, πi ◦ π−i ) Gi (H, b, πi ◦ π−i ) for all πi . We are especially interested in partial Nash equilibria, which are only defined for an initial belief state and all future belief states within a fixed horizon. Algorithm. We characterize Nash equilibria of P by finite-horizon value iteration from local Nash equilibria of normal form games. We assume an arbitrary Nash selection function f for normal form games with action set (Ai )i∈I . For every belief state b=(bi )i∈I and number of steps to go h ∈ {0, . . . , H}, we consider the normal form game G[b, h] = (I, (Ai )i∈I , (Qi [b, h])i∈I ), where Qi [b, h](α) is defined as follows (for all actions α and agents i ∈ I):
s∈S, Poss(α,s) s∈S, Poss(α,s)
if h = 0;
bi (s)Ri (s, α) bi (s)Ri (s, α) +
α,o o∈O P (bi
|bi , α) ·
vfi (G[bα,o , h−1])
otherwise.
The next result shows that the above finite-horizon value iteration computes a Nash equilibrium for consistent probabilistic action descriptions P in GC+. Theorem 4.1. Let P be a consistent probabilistic action description in GC+, and π = (πi )i ∈ I be defined by πi (b, h) = fi (G[b, h]) for all agents i ∈ I, belief states b, and number of steps to go h ∈ {0, . . . , H}. Then, π is a Nash equilibrium of G, and Gi (H, b, π) = vfi (G[b, H]) for all i ∈ I and b. The following theorem shows that every POSG can be encoded as a consistent probabilistic action description in GC+. Theorem 4.2. Let G = (I, S, (Ai )i∈I , (Oi )i∈I , P, (Ri )i∈I ) be a POSG. Then, there exists a consistent probabilistic action description D in GC+ that encodes G. Example 4.1 (Two Robots cont’d). Suppose the initial belief of robot a1 (resp., a2 ) is as in Fig. 1, right (resp., left) side. In particular, a1 initially believes that o1 is at l1,2 or l2,2 , while a2 initially believes that o1 is at l2,3 or l2,2 . Given the three possible
Game-Theoretic Reasoning About Actions in Nonmonotonic Causal Theories
195
states s1,2 , s2,2 , and s2,3 such that si,j |= at (o1 )=li,j , let the probabilities be given by b1 (s1,2 ) = 0.2 and b1 (s2,2 ) = 0.8 for a1 , and by b2 (s2,3 ) = 0.4 and b2 (s2,2 ) = 0.6 for a2 . How should the two robots act in such an initial situation? We now apply our finitehorizon value iteration algorithm to compute a partial Nash equilibrium. Notice that pickUp(a1 , l2,3 ) and pickUp(a2 , l1,2 ) are not executable in the initial belief states of a2 and a1 , respectively. Hence, pickUp can only be executed in l2,2 . In this case, each agent wants to get to l1,2 first, execute pickUp, and cross the door. Assuming a 3step horizon, we obtain two pure partial policies αi , one for each agent ai : (1) at 3 steps to go, αi assigns the action a = goTo(ai , l2,2 ) to bi , while any executable action bj except for goTo(aj , l2,2 ) is assigned to bj ; (2) at 2 steps to go, ai executes pickUp i (ai , l2,2 ) from bai , while aj avoids goTo(aj , l2,2 ) from bbj ; (3) at 1 step to go, ai performs goTo(ai , d1 ) in any reached belief state (both after obs(holds ) and obs(notHolds)), while aj can execute any action. Both α1 and α2 represent a pure partial Nash equilibrium, where the expected 3-step reward of α1 and α2 for the robot pair (a1 , a2 ) is (70.4, 43.2) and (52.8, 57.6), respectively. Another Nash equilibrium can be obtained form the previous policies by randomizing the first action selection with π1 (b1 , a) = 0.55 for a = goTo(a1 , l2,2 ) (Σβ π1 (b1 , β) = 0.45 with β = a), and = a). Depending π2 (b2 , a) = 0.56 for a = goTo(a2 , l2,2 ) (Σβ π2 (b2 , β) = 0.44 with β on the first action execution, the remaining policy is defined as in α1 or α2 . In this case, the expected 3-step reward is G1 (3, b1 , π) = 30.67 and G2 (3, b2 , π) = 25.70.
5 Reductions and Special Cases Computing partial Nash equilibria for a probabilistic action description P and an initial belief state requires the following computations: (i) computing the set of all states for P , (ii) deciding whether an action α is executable in a state s, (iii) computing all probabilistic transitions P (s , o | s, α), and (iv) computing Nash equilibria of normal form games. Here, (ii) can be easily done in polynomial time on P , while (iv) can be done with standard technology from game theory (see especially [19]). Finally, (i) and (iii) can be reduced to reasoning in causal theories as follows. Reduction to Causal Theories. We first recall the main concepts of causal theories [13]. A (causal) rule has the form ψ ⇐ φ with formulas ψ and φ, called its head and body, respectively. A causal theory T is a finite set of rules. Let I be an interpretation of the variables in T . The reduct of T relative to I, denoted T I , is defined as {ψ | ψ ⇐ φ ∈ T, I |= φ}. We say I is a model of T iff I is the unique model of T I . The following result shows that the tasks (i) and (iii) above can be reduced to computing the set of all models of a causal theory. It follows from the original semantics of C+ based on causal theories [13]. In the case of definite causal laws, where all law heads ψ in (1) and (2) are literals, the set of all models of the corresponding causal theories can be computed using the Causal Calculator and answer set programming [13]. Proposition 5.1. Let D be an action description. (a) Let T be the set of all rules ψ ⇐ φ such that either (i) caused ψ if φ ∈ D, or (ii) φ = ψ = X=x for some simple fluent X∈X and x∈I(X). Then, an interpretation s of all fluents and rigid variables is a state of D iff it is a model of T .
196
A. Finzi and T. Lukasiewicz
(b) Let α be an action executable in state s. Let Ts∪α be the set of all ψ ⇐ φ such that either (i) caused ψ if φ ∈ D, or (ii) s ∪ α |= θ for some caused ψ if φ after θ ∈ D. Then, Φ(s, α) is the set of all models s of Ts∪α that coincide with s on all rigid variables. Acyclic Action Descriptions. The action description of Section 3 is acyclic, which allows for polynomial-time computations, as we now show. A causal theory T is acyclic relative to W ⊆ V iff (i) every rule head is a literal, and (ii) there is a mapping κ from W to the non-negative integers such that κ(X) > κ(Y ) for all X, Y ∈ W such that X (resp., Y ) occurs in the head (resp., body) of some rule in T . An action description D is acyclic iff (i) the set of all rules ψ ⇐ φ with caused ψ if φ ∈ D is acyclic relative to all statically determined fluents and rigid variables, and (ii) for each state s and action α executable in s, it holds that Ts∪α is acyclic relative to all fluents. The following result shows that, in the acyclic case, every interpretation of the simple fluents produces at most one state, which is computable in polynomial time. Similarly, the Φ(s, α)’s contain at most one state, and are computable in polynomial time. Theorem 5.1. Let D be an acyclic action description. Then: (a) Every interpretation f of the set of all simple fluents can be extended to at most one state s of D. (b) Deciding whether such s exists and computing it can be done in polynomial time. (c) If s is a state and α an action executable in s, then Φ(s, α) is either empty or a singleton, and it is computable in polynomial time.
6 Summary and Outlook We have presented the action language GC+ for reasoning about actions in multi-agent systems under probabilistic uncertainty and partial observability, which is an extension of the action language C+ that is inspired by partially observable stochastic games (POSGs). We have provided a finite-horizon value iteration algorithm and shown that it characterizes finite-horizon Nash equilibria. We have also given a reduction to nonmonotonic causal theories and identified the special case of acyclic action descriptions in GC+, where transitions are computable in polynomial time. An interesting topic of future research is to define similar action languages for more general classes of POSGs and decentralized POMDPs. Acknowledgments. This work has been supported by the Austrian Science Fund Project P18146-N04 and a Heisenberg Professorship of the German Research Foundation. We thank the reviewers for their constructive comments, which helped to improve our work.
References 1. F. Bacchus, J. Y. Halpern, and H. J. Levesque. Reasoning about noisy sensors and effectors in the situation calculus. Artif. Intell., 111(1-2):171–208, 1999. 2. C. Baral, N. Tran, and L.-C. Tuan. Reasoning about actions in a probabilistic setting. In Proceedings AAAI-2002, pp. 507–512, 2002.
Game-Theoretic Reasoning About Actions in Nonmonotonic Causal Theories
197
3. D. S. Bernstein, S. Zilberstein, and N. Immerman. The complexity of decentralized control of Markov decision processes. In Proceedings UAI-2000, pp. 32–37, 2000. 4. C. Boutilier. Sequential optimality and coordination in multiagent systems. In Proceedings IJCAI-1999, pp. 478–485, 1999. 5. C. Boutilier, R. Reiter, and B. Price. Symbolic dynamic programming for first-order MDPs. In Proceedings IJCAI-2001, pp. 690–700, 2001. 6. C. Boutilier, R. Reiter, M. Soutchanski, and S. Thrun. Decision-theoretic, high-level agent programming in the situation calculus. In Proceedings AAAI-2000, pp. 355–362, 2000. 7. T. Eiter, W. Faber, N. Leone, G. Pfeifer, and A. Polleres. A logic programming approach to knowledge-state planning, II: The DLVK system. Artif. Intell., 144(1-2):157–211, 2003. 8. T. Eiter and T. Lukasiewicz. Probabilistic reasoning about actions in nonmonotonic causal theories. In Proceedings UAI-2003, pp. 192–199, 2003. 9. R. Emery-Montemerlo, G. Gordon, J. Schneider, and S. Thrun. Game theoretic control for robot teams. In Proceedings ICRA-2005, pp. 1175–1181, 2005. 10. A. Finzi and T. Lukasiewicz. Game-theoretic reasoning about actions in nonmonotonic causal theories. Report Nr. 1843-05-04, Institut f¨ur Informationssysteme, TU Wien, 2005. 11. N. H. Gardiol and L. P. Kaelbling. Envelope-based planning in relational MDPs. In Proceedings NIPS-2003, 2003. 12. M. Gelfond and V. Lifschitz. Representing action and change by logic programs. J. Logic Program., 17:301–322, 1993. 13. E. Giunchiglia, J. Lee, V. Lifschitz, N. McCain, and H. Turner. Nonmonotonic causal theories. Artif. Intell., 153(1-2):49–104, 2004. 14. C. Guestrin, D. Koller, C. Gearhart, and N. Kanodia. Generalizing plans to new environments in relational MDPs. In Proceedings IJCAI-2003, pp. 1003–1010, 2003. 15. E. A. Hansen, D. S. Bernstein, and S. Zilberstein. Dynamic programming for partially observable stochastic games. In Proceedings AAAI-2004, pp. 709–715, 2004. 16. L. P. Kaelbling, M. L. Littman, and A. R. Cassandra. Planning and acting in partially observable stochastic domains. Artif. Intell., 101(1-2):99–134, 1998. 17. M. L. Littman. Markov games as a framework for multi-agent reinforcement learning. In Proceedings ICML-1994, pp. 157–163, 1994. 18. N. McCain and H. Turner. Causal theories of action and change. In Proceedings AAAI-1997, pp. 460–465, 1997. 19. R. McKelvey and A. McLennan. Computation of equilibria in finite games. In Handbook of Computational Economics, pp. 87–142. Elsevier, 1996. 20. R. Nair, M. Tambe, M. Yokoo, D. V. Pynadath, and S. Marsella. Taming decentralized POMDPs: Towards efficient policy computation for multiagent settings. In Proceedings IJCAI-2003, pp. 705–711, 2003. 21. G. Owen. Game Theory: Second Edition. Academic Press, 1982. 22. D. Poole. Decision theory, the situation calculus and conditional plans. Electronic Transactions on Artificial Intelligence, 2(1-2):105–158, 1998. 23. M. L. Puterman. Markov Decision Processes: Discrete Stochastic Dynamic Programming. Wiley, 1994. 24. R. Reiter. Knowledge in Action: Logical Foundations for Specifying and Implementing Dynamical Systems. MIT Press, 2001. 25. J. van der Wal. Stochastic Dynamic Programming, volume 139 of Mathematical Centre Tracts. Morgan Kaufmann, 1981. 26. J. von Neumann and O. Morgenstern. The Theory of Games and Economic Behavior. Princeton University Press, 1947.
Some Logical Properties of Nonmonotonic Causal Theories Marek Sergot and Robert Craven Department of Computing, Imperial College London, SW7 2AZ, UK {mjs, rac101}@doc.ic.ac.uk
Abstract. The formalism of nonmonotonic causal theories (Giunchiglia, Lee, Lifschitz, McCain, Turner, 2004) provides a general-purpose formalism for nonmonotonic reasoning and knowledge representation, as well as a higher level, special-purpose notation, the action language C+, for specifying and reasoning about the effects of actions and the persistence (‘inertia’) of facts over time. In this paper we investigate some logical properties of these formalisms. There are two motivations. From the technical point of view, we seek to gain additional insights into the properties of the languages when viewed as a species of conditional logic. From the practical point of view, we are seeking to find conditions under which two different causal theories, or two different action descriptions in C+, can be said to be equivalent, with the further aim of helping to decide between alternative formulations when constructing practical applications.
1
Introduction
The formalism of nonmonotonic causal theories, presented by Giunchiglia, Lee, Lifschitz, McCain and Turner [1], is a general-purpose language for knowledge representation and nonmonotonic reasoning. A causal theory is a set of causal rules each of which is an expression of the form F ⇐G where F and G are formulas of an underlying propositional language and F ⇐ G corresponds to the statement “if G, then F has a cause” (which is not the same as saying that G is a cause for F ). Associated with causal theories is the action language C+, also presented in [1]. This may be viewed as a higher-level formalism for defining classes of causal theories in a concise and natural way, for the purposes of specifying and reasoning about the effects of actions and the persistence, or ‘inertia’, of facts through time, with support for indirect effects, non-deterministic actions and concurrency. The two closely-related formalisms have been used to represent standard domains from the knowledge representation literature. In this paper, we investigate some logical properties of these formalisms. There are two motivations. The first is technical, to gain new insights into the C. Baral et al. (Eds.): LPNMR 2005, LNAI 3662, pp. 198–210, 2005. c Springer-Verlag Berlin Heidelberg 2005
Some Logical Properties of Nonmonotonic Causal Theories
199
languages when they are viewed as species of conditional logic. For example, Turner [2] presents a more general formalism called the ‘logic of universal causation’. A rule F ⇐ G of a causal theory can be expressed equivalently in this logic by the formula G → CF where C is a modal operator standing for ‘there is a cause for’ (and → is truthfunctional, ‘material’ implication). Since C is a normal modal operator whose logic is at least as strong as S5, some logical properties of F ⇐ G are immediately obvious. For example, we can see from G → C F S5 G → C (F ∨ H) that the logic of causal theories will exhibit the property of ‘weakening of the consequent’: F ⇐ G implies (in a sense to be made more precise) (F ∨ H) ⇐ G. Other properties of F ⇐ G will be straightforwardly propositional, such as ‘strengthening of the antecedent’: F ⇐ G implies F ⇐ G ∧ H. This last property is intriguing, since it is often seen as a characteristic feature of monotonic conditionals, yet the logic of causal theories is nonmonotonic. In this paper, we will not rely on the translation to Turner’s modal logic but prove properties directly from the semantics of causal theories. This is largely because of space limitations. Although many of the properties can be derived quite straightforwardly in S5, there is some preliminary notation and terminology we need, and we do not have space to introduce it here. Moreover, there are some fundamental properties of causal theories that are not inherited from S5. The second motivation is a practical one. Causal theories and C+ are very expressive languages. One purpose of the technical investigation is to find conditions under which which two different causal theories, or two different action descriptions in C+, can be said to be equivalent, with the further aim of helping to decide between alternative formulations when constructing applications.
2
Causal Theories
A multi-valued propositional signature σ [3,1] is a set of symbols called constants. For each constant c in σ, there is a non-empty set dom(c) of values called the domain of c. An atom of a signature σ is an expression of the form c=v, where c is a constant in σ and v ∈ dom(c). A formula ϕ of signature σ is any propositional compound of atoms of σ. A Boolean constant is one whose domain is the set of truth values {t, f}. If p is a Boolean constant, p is shorthand for the atom p=t and ¬p for the atom p=f. Notice that, as defined here, ¬p is an atom when p is a Boolean constant. An interpretation of σ is a function that maps every constant in σ to an element of its domain. An interpretation I satisfies an atom c=v, written I |= c=v, if I(c) = v. The satisfaction relation |= is extended from atoms to formulas in accordance with the standard truth tables for the propositional connectives. When X is a set of formulas we also write I |= X to signify that I |= ϕ for all formulas ϕ ∈ X. I is then a model for the set of formulas X. We write |=σ ϕ to mean that I |=σ ϕ for all interpretations I of σ. Where X is a set of formulas of signature σ, X |=σ ϕ denotes that I |=σ ϕ for all
200
M. Sergot and R. Craven
interpretations I of σ such that I |=σ X. When X is a set of formulas of signature σ, X |=σ X is shorthand for X |=σ ϕ for all formulas ϕ ∈ X . In addition, where A and B are sets of formulas of a multi-valued propositional signature, we define A ≡σ B to mean that A |=σ B and B |=σ A. A causal rule is an expression of the form F ⇐ G, where F and G are formulas of signature σ. A causal theory is a set of causal rules. Semantics. Let Γ be a causal theory, and let X be an interpretation of its underlying propositional signature. Then the reduct of Γ , written Γ X , is {F | F ⇐ G ∈ Γ and X |= G} X is a model of Γ , written X |=C Γ , iff X is the unique model of the reduct Γ X . By models(Γ ) we denote the set of all models of the causal theory Γ . Γ X is the set of all formulas which have a cause to be true, according to the rules of Γ , under the interpretation X. If Γ X has no models, or has more than one model, or if it has a unique model different from X, then X is not considered to be a model of Γ . Γ is consistent or satisfiable iff it has a model. For an illustration of the preceding definitions, consider the causal theory T1 , with underlying Boolean signature {p, q}: T1 = {p ⇐ q, q ⇐ q, ¬q ⇐ ¬q}. There are clearly four possible interpretations of the signature: X1 (p → t, q → t), X2 (p → t, q → f), X3 (p → f, q → t), and X4 (p → f, q → f). It is clear that T1X1 = {p, q}, whose only model is X1 ; T1X2 = {¬q}, which has two models; T1X3 = {p, q}, whose only model is X1 = X3 ; and T1X4 = {¬q}, which has two models. In only one of these cases—that of X1 —is it true that the reduct of the causal theory with respect to the interpretation has that interpretation as its unique model. Thus X1 |=C T1 and models(T1 ) = {X1 }. Suppose we add another law to T1 : for example, T2 = T1 ∪ {¬p ⇐ ¬p}. Now we have models(T2 ) = {X1 , X4 }. In this example, augmenting the causal theory increases the set of models. It is clear that in general, for causal theories Γ and ∆, models(Γ ∪ ∆) ⊆ models(Γ ). This is the sense in which the causal theories are nonmonotonic. In the following, one of our purposes will be to invesigate under which conditions Γ ∪ ∆ has the same models as Γ .
3
A Consequence Relation Between Causal Theories
In this section, we frequently omit set-theoretic brackets from causal theories where doing so does not create confusion. In particular, causal theories which are singletons are often represented by the sole law they contain. Proposition 1. X |=C Γ iff, for every formula F , X |= F iff Γ X |=σ F . Proof. This is Proposition 1 of [1]. Observation 2. (Γ1 ∪ Γ2 )X = Γ1X ∪ Γ2X . Proposition 3. X |= {F ⇐ G}X iff X |= G → F .
Some Logical Properties of Nonmonotonic Causal Theories
201
Proof. Assume X |= {F ⇐ G}X . If X |= G, then {F ⇐ G}X = {F }, so X |= F . For the other direction, suppose X |= G → F . If X |= G then X |= F . But then {F ⇐ G}X = {F } and we have X |= {F ⇐ G}X . If X |= G then {F ⇐ G}X = ∅, and X |= {F ⇐ G}X , trivially.
It follows from the above that X |= {F1 ⇐ G1 , . . . , Fn ⇐ Gn }X iff X |= (G1 → F1 ) ∧ · · · ∧ (Gn → Fn ). Moreover, if a causal theory Γ contains a rule F ⇐ G then every model of Γ satisfies G → F , i.e., X |=C Γ implies X |= G → F . This last remark is Proposition 2 of [1]. Where Γ is a causal theory, we will denote by mat(Γ ) the set of formulas obtained by replacing every rule F ⇐ G of Γ by the corresponding material implication, G → F . The remarks above can thus be summarised as follows. Proposition 4. (i) X |= Γ X iff X |= mat(Γ )
(ii) X |=C Γ implies X |= mat(Γ )
Proof. In the preceding discussion.
We now define a notion of consequence between causal theories. This will allow us to say under which conditions two causal theories are equivalent, to simplify causal theories by removing causal laws that are implied by the causal theory, and to identify (in the following section) general properties of causal laws. We will say that causal theories Γ1 and Γ2 of signature σ are equivalent, written Γ1 ≡ Γ2 , when ∆ ∪ Γ1 and ∆ ∪ Γ2 have the same models for all causal theories ∆ of signature σ. We will say that Γ1 implies Γ2 , written Γ1 Γ2 , when (Γ1 ∪ Γ2 ) ≡ Γ1 , that is, when ∆ ∪ Γ1 ∪ Γ2 and ∆ ∪ Γ1 have the same models for all causal theories ∆ of signature σ. Proposition 5. Γ1 ≡ Γ2 iff Γ1 Γ2 and Γ2 Γ1 Proof. A straightforward consequence of the definitions and basic set theory.
Proposition 6. Γ Γ1 and Γ Γ2
iff
Γ (Γ1 ∪ Γ2 )
Proof. Immediate from the definitions.
Proposition 7. For all causal theories Γ , Γ1 , Γ2 , ∆ of signature σ we have: (i) If Γ1 ≡ Γ2 , then (Γ1 ∪ ∆) Γ iff (Γ2 ∪ ∆) Γ . (ii) If Γ1 ≡ Γ2 , then Γ (∆ ∪ Γ1 ) iff Γ (∆ ∪ Γ2 ). (iii) If Γ1 ≡ Γ2 , then (Γ1 ∪ ∆) ≡ (Γ2 ∪ ∆). Proof. Part (ii): suppose Γ1 ≡ Γ2 and (Γ1 ∪ ∆) Γ . That models(∆ ∪ (Γ2 ∪ ∆) ∪ Γ ) is equal to models(∆ ∪ (Γ2 ∪ ∆)) follows easily using basic set theory. The other parts can be proved in similar fashion.
Proposition 8. The relation between causal theories of a given signature σ is a classical consequence relation (also known as a closure operator), that is, it satisfies the following three properties, for all causal theories Γ , Γ , and ∆:
202
M. Sergot and R. Craven
– inclusion: – cut: – monotony:
Γ Γ (Γ ∪ ∆) Γ and Γ ∆ implies Γ Γ Γ Γ implies (Γ ∪ ∆) Γ
Proof. ‘Inclusion’ is trivial. For ‘monotony’, suppose Γ Γ . Then (Γ ∪Γ ) ≡ Γ . We show (Γ ∪ ∆ ∪ Γ ) ≡ (Γ ∪ ∆) for any causal theory ∆. Clearly (Γ ∪ ∆ ∪ Γ ) ≡ ((Γ ∪ Γ ) ∪ ∆). And ((Γ ∪ Γ ) ∪ ∆) ≡ (Γ ∪ ∆) because (Γ ∪ Γ ) ≡ Γ . The proof for ‘cut’ is similar.
Corollary 1. Γ1 Γ2 iff (Γ1 ∪ Γ2 ) ≡ Γ1 (As Γ1 Γ1 and Γ1 Γ2 iff Γ1 ≡ (Γ1 ∪ Γ2 ).) If Γ1 Γ2 and Γ2 Γ3 then Γ1 Γ3 . (By ‘monotony’ and ‘cut’.) Notice that although the formalism of causal theories is non-monotonic, in the sense that in general models(Γ ∪ ∆) ⊆ models(Γ ), the consequence relation between causal theories is monotonic. We now establish some simple sufficient conditions under which holds. Proposition 9. models(Γ1 ) ⊆ models(Γ2 ) iff, for all X ∈ models(Γ1 ), we have Γ1X ≡σ Γ2X . Proof. Omitted.
Corollary 2. models(Γ1 ) = models(Γ2 ) iff we have Γ1X ≡σ Γ2X , for all X ∈ models(Γ1 ) ∪ models(Γ2 ). Proposition 10. (i) Γ1 Γ2 if Γ1X |=σ Γ2X , for all X |= mat(Γ1 ∪ Γ2 ). (ii) Γ1 Γ2 if Γ1X |=σ Γ2X , for all X |= mat(Γ1 ). (iii) Γ (G ⇐ F ) if Γ X |=σ G, for all X |= mat(Γ1 ) ∪ {F }. Proof. Part (i) follows from considering Proposition 9 and Corollary 2; the details of this have been omitted. Part (ii) is obtained from Part (ii) by strengthening the condition. Part (iii) follows from Part (ii): if X |= F then {G ⇐ F }X = {G}. If X |= F then {G ⇐ F }X = ∅, and so Γ X |=σ {G ⇐ F }X , trivially.
We record one further property for future reference. A causal rule of the form F ⇐ F expresses that F holds by default. Adding F ⇐ F to a causal theory Γ cannot eliminate models, though it can add to them. Proposition 11. models(Γ ) ⊆ models(Γ ∪ {F ⇐ F }) Proof. Suppose X |=C Γ , i.e., X |= Γ X and Y |= Γ X implies Y = X. We show (i) X |= (Γ ∪ {F ⇐ F })X , and (ii) if Y |= (Γ ∪ {F ⇐ F })X then Y = X. For (i): if X |= F then (Γ ∪ {F ⇐ F })X = Γ X ∪ {F }; we have both X |= Γ X and X |= F . If X |= F , then (Γ ∪ {F ⇐ F })X = Γ X ; we have X |= Γ X . For (ii), suppose Y |= (Γ ∪{F ⇐ F })X . Then Y |= Γ X , and X |=C Γ implies Y = X.
Some Logical Properties of Nonmonotonic Causal Theories
4
203
Properties of ⇐
We can now prove properties about the logic of causal theories, using the preliminary results and definitions given in the previous section. We have chosen to name the results after Chellas’s [4] taxonomy of rules of inference from modal logic, as this scheme is well-known and seems natural to us. We frequently omit the proofs in this section, which in nearly all cases are based straightforwardly on Proposition 10, possibly including reasoning by cases of interpretations. (Full proofs are available in a companion technical report.) In the following, we will frequently use the notational convenience of writing A instead of A B, where A and B are causal rules or sets of such. B Proposition 12. [RCM] If F1 |=σ F2 , then
F1 ⇐ G F2 ⇐ G
Proof. From Proposition 10(iii), a sufficient condition for F1 ⇐ G F2 ⇐ G is {F1 ⇐ G}X |=σ F2 for all X |=σ G, which is just F1 |=σ F2 , which was given.
Proposition 13. [RAug] If G1 |=σ G2 , then
F ⇐ G2 F ⇐ G1
Proof. Similar to that for Proposition 12, and also using Proposition 10(ii).
Given the preceding two propositions and Proposition 5, we have the following corollary, of which the second part will be dubbed [RCEA], again after [4]. Corollary 3. [RCEA]
(i) If F1 ≡σ F2 , then F1 ⇐ G ≡ F2 ⇐ G (ii) If G1 ≡σ G2 , then F ⇐ G1 ≡ F ⇐ G2
Proposition 14. [RCK]
If F1 , . . . , Fn |=σ F , then
F1 ⇐ G, . . . , Fn ⇐ G (n 0) F ⇐G
The above are properties characteristic of ‘normal conditional logics’ [4]. We now move on to consider some distribution laws. Proposition 15. [CC]
F1 ⇐ G, . . . , Fn ⇐ G (F1 ∧ · · · ∧ Fn ) ⇐ G
[CM]
[DIL]
F ⇐ G1 , . . . , F ⇐ Gn F ⇐ (G1 ∨ · · · ∨ Gn )
[cDIL]
(F1 ∧ · · · ∧ Fn ) ⇐ G F1 ⇐ G, . . . , Fn ⇐ G F ⇐ (G1 ∨ · · · ∨ Gn ) F ⇐ G1 , . . . , F ⇐ Gn
There follows a network of interrelated properties which all express a form of monotonicity of the conditional ⇐.
204
M. Sergot and R. Craven
Proposition 16. [Aug]
F ⇐G F ⇐G∧H
Proof. This is clearly a specific instance of [RAug]. For a direct proof: a sufficient condition for [Aug] is {F ⇐ G}X |=σ F for all X |= (G∧H). But if X |= (G∧H), then the condition reduces to F |=σ F , which holds.
In fact, it can be shown that in the presence of the rule [RCEA], which we proved as Corollary 3(ii), the schema [Aug] is equivalent to the distribution law [cDIL]; constraints on space prevent our including the proof. Proposition 17. [Contra]
F ⇐⊥
Proof. A sufficient condition for this is ∅X F for all X |= ⊥, which holds trivially, since there is no such X.
Proposition 18. F ⇐ G ⊥ ⇐ ¬F ∧ G Proof. By Proposition 10(iii), a sufficient condition is that {F ⇐ G}X |=σ ⊥, for all X with X |= (¬F ∧ G) ∧ (G → F ), which obtains: there is no such X.
The converse of this proposition does not hold: ⊥ ⇐ ¬F ∧ G F ⇐ G. Now, since G |=σ ⊥ iff G ≡σ ⊥, the schema [Contra] is equivalent to the rule: if G |=σ ⊥ then F ⇐ G. This is the case n = 0 for the following generalization of [RAug], easily proved by induction on n. Proposition 19. [RDIL]
If G |=σ (G1 ∨ · · · ∨ Gn ), then
Proposition 20. [S]
F ⇐ G1 , . . . , F ⇐ Gn (n 0) F ⇐G
F ⇐ G, G ⇐ H F ⇐ H
A statement of the propogation of constraints, and a rule of Modus Ponens, are obvious instances of [S]: Corollary 4. [Constr]
F ⇐ G, ⊥ ⇐ F , ⊥⇐G
[MP]
F ⇐ G, G ⇐ F ⇐
From G ⇐ , we get ⊥ ⇐ ¬G ∧ using Proposition 18; an application of [RCEA] then gives us ⊥ ⇐ ¬G. Using [Contra] and [S] we then derive F ⇐ ¬G: Proposition 21. G ⇐ F ⇐ ¬G The rule describing propogation of constraints may be generalised to a weak resolution law for Horn-like rules:
Some Logical Properties of Nonmonotonic Causal Theories
205
Proposition 22. F ⇐ G ∧ H, G ⇐ K F ⇐ H ∧ K The logic of causal theories does not contain the two equivalent rules [I]
F ⇐ F;
[RI]
If G |=σ F , then
F ⇐G
To see this, use ¬p ⇐ ¬p for F and consider the causal theory with the single rule p ⇐ p; models({p ⇐ p}) = models({p ⇐ p, ¬p ⇐ ¬p}) which means that we do not have models(Γ ∪ ∅) = models(Γ ∪ ∅ ∪ {¬p ⇐ ¬p}) for all causal theories Γ , and so ¬p ⇐ ¬p. Although we do not have [I], it has already been shown (Proposition 11) that models(Γ ) ⊆ models(Γ ∪ {F ⇐ F }). Using the same example, it can easily be seen that the logic of ⇐ does not contain a contrapositive law: we have that F ⇐ G ¬G ⇐ ¬F . Example. As one example of an application of these properties consider the following common patterns of causal rules: { F ⇐ F ∧ G ∧ ¬R, ¬F ⇐ R }
and
{ F ⇐ F ∧ G, ¬F ⇐ R }
In each case the first law expresses that F holds by default if G holds, and the second that R is an exception to the default rule. These pairs of laws are equivalent in causal theories. One direction is straightforward: F ⇐ F ∧ G ∧ ¬R follows from F ⇐ F ∧ G by [Aug]. For the other direction, notice first that ¬F ⇐ R implies ⊥ ⇐ F ∧ G ∧ R (because ¬F ⇐ R implies ⊥ ⇐ F ∧ R and the rest follows by [Aug]). Now F ⇐ ⊥ [Contra], and by [S] we derive F ⇐ F ∧ G ∧ R. For the final step F ⇐ F ∧ G ∧ R, F ⇐ F ∧ G ∧ ¬R F ⇐ F ∧ G ∧ (R ∨ ¬R) from which F ⇐ F ∧ G follows.
5
The Action Language C+
As with the logic of causal theories, the language C+ is based on a multi-valued propositional signature σ, with σ partitioned into a set σ f of fluent constants and a set σ a of action constants. Further, the fluent constants are partitioned into those which are simple and those which are statically determined. A fluent formula is a formula whose constants all belong to σ f ; an action formula has at least one action constant and no fluent constants. A static law is an expression of the form caused F if G, where F and G are fluent formulas. An action dynamic law is an expression of the same form in which F is an action formula and G is a formula. A fluent dynamic law has the form caused F if G after H,
206
M. Sergot and R. Craven
where F and G are fluent formulas and H is a formula, with the restriction that F must not contain statically determined fluents. Causal laws are static laws or dynamic laws, and an action description is a set of causal laws. In the following section we will make use of several of the many abbreviations afforded in C+. In particular: α causes F if G abbreviates the fluent dynamic law caused F if after α ∧ G; nonexecutable α if G expresses that there is no transition of type α from a state satisfying fluent formula G. It is shorthand for the fluent dynamic law caused ⊥ if after α ∧ G; inertial f where f is a simple fluent constant, states that the values of f persist by default—they are subject to inertia—from one state to the next. It stands for the collection of fluent dynamic laws caused f =v if f =v after f =v for every v ∈ dom(f ). exogenous a where a is an action constant, stands for the set of action dynamic laws caused a=v if a=v after a=v for every v ∈ dom(a). The language C+ can be viewed as a useful shorthand for the logic of causal theories, for to every action description D of C+ and non-negative integer m, D D there corresponds a causal theory Γm . The signature of Γm contains constants c[i], such that – i ∈ {0, . . . , m} and c is a fluent constant of the signature of D, or – i ∈ {0, . . . , m−1} and c is an action constant of the signature of D, and the domains of such constants c[i] are kept identical to those of their constituents c. The expression F [i], where F is a formula, denotes the result of D suffixing [i] to every occurrence of a constant in F . The causal rules of Γm are: F [i] ⇐ G[i], for every static law in D and every i ∈ {0, . . . , m}, and for every action dynamic law in D and every i ∈ {0, . . . , m−1}; F [i + 1] ⇐ G[i + 1] ∧ H[i], for every fluent dynamic law in D and every i ∈ {0, . . . , m−1}; and f [0]=v ⇐ f [0]=v, for every simple fluent constant f and v ∈ dom(c). Each action description of C+ defines a labelled transition system. The states of the transition system are the models of Γ0D . Each state is an interpretation of the fluent constants σ f . Transitions are the models of Γ1D . Each transition label (also called an ‘event’) is an interpretation of the action constants σ a . When α is a formula of σ a , we say that a transition label/event is of type α when it satisfies the formula α. It can also be shown [1] that paths of length m of the D transition system correspond to the models of Γm . Since action descriptions are a shorthand for particular forms of causal theories, we obtain a notion of equivalence and consequence between action descripD1 D2 tions of C+: D1 C+ D2 is defined as Γm Γm for all non-negative integers m, and likewise for equivalence of action descriptions. We also inherit properties of causal laws of C+ corresponding to those proven in Section 4. For example: α causes F if G C+ α∧β causes F if G follows directly from ‘augmentation’ [Aug] for causal theories in general. In the following we will use the same labels for properties of C+ as for the causal-theoretic properties from which they are derived.
Some Logical Properties of Nonmonotonic Causal Theories
6
207
Example (Winning the Lottery)
Winning the lottery causes one to become (or remain) rich. Losing one’s wallet causes one to become (or remain) not rich. A person who is rich is happy. A person who is not alive is neither rich nor happy. The example is constructed partly to show how C+ deals with indirect effects of actions (ramifications). The example also illustrates some issues in the representation of concurrent actions, actions with defeasible effects, and nondeterministic actions. Naturally it is not possible to illustrate everything with one simple example, but the example is indicative of the issues that are encountered when formulating applications in a language as expressive as C+. Signature: simple Boolean fluent constants alive, rich, happy ; Boolean action constants birth, death, win, lose. inertial alive, rich, happy exogenous birth, death, win, lose birth causes alive nonexecutable birth if alive death causes ¬alive nonexecutable death if ¬alive win causes rich nonexecutable win if ¬alive lose causes ¬rich nonexecutable lose if ¬alive caused happy if rich caused ¬rich if ¬alive caused ¬happy if ¬alive nonexecutable nonexecutable nonexecutable nonexecutable
birth ∧ death birth ∧ win birth ∧ lose win ∧ lose
null
alive ¬rich ¬happy
‘birth’
‘lose’
‘win’ ‘death’
null ¬alive ¬rich ¬happy
‘death’
‘win’
alive rich happy
null
‘win’ ‘death’
null
‘lose’
alive ¬rich happy
‘lose’
States and transition labels/events are interpretations of the fluent constants and action constants, respectively. Here, each state and each transition label/event is represented by the set of atoms that it satisfies. Because of the static laws, there are only four states in the transition system and not 23 = 8. The diagram label ‘birth’ is shorthand for the label/event {birth, ¬death, ¬win, ¬lose}, and likewise for the labels ‘death’, ‘win’ and ‘lose’. The label null is shorthand for {¬birth, ¬death, ¬win, ¬lose}. The diagram does not show transitions of type death ∧ lose, win ∧ death, and so on. We will discuss those presently. Notice that happy is declared inertial, and so still persists even if one becomes not rich. That is why the ‘lose’ transition from state {alive, rich, happy } results in the state {alive, ¬rich, happy }. We could of course modify the action description so that happy is no longer inertial but defined to be true if and only
208
M. Sergot and R. Craven
if rich is true. Or we might prefer to make happy non-inertial and let the ‘lose’ transition be non-deterministic. The interactions between these various adjustments are rather subtle, however, and are not always immediately obvious. We will restrict attention to the following two questions. First, there are alternative ways of formulating the constraints that a person cannot be rich or happy when not alive, and these alternatives have different interactions with the other causal laws. Second, as it turns out, the last group of four nonexecutable statements are all redundant, in that they are already implied by the other causal laws. There are some remaining questions about the effects of concurrent actions in the example which we will seek to identify. First, let us look at some effects of individual actions. With the static constraints as formulated above, we have the following implied laws. (Henceforth we omit the keyword caused to conserve space.) death causes ¬alive (in other words, ¬alive if after death) together with ¬rich if ¬alive imply death causes ¬rich. And in general α causes F if G, F if F α causes F if G as is easily checked. By a similar argument we also have the implied causal law death causes ¬happy (¬happy if after death) and win causes happy . We do not get the law lose causes ¬happy because as formulated here, we do not have the static law (explicit or implied) ¬happy if ¬rich. Suppose that instead of the static laws ¬rich if ¬alive and ¬happy if ¬alive, we had included only the weaker constraints ⊥ if rich ∧¬alive and ⊥ if happy ∧¬alive . These constraints eliminate the unwanted states, but are too weak to give the implied effects (ramifications). We also lose transitions: if ¬happy if ¬alive is replaced by either of alive if happy or ⊥ if happy ∧ ¬alive, the only way that ¬happy can be ‘caused’ is by inertia. Consequently, we eliminate all the death transitions from states in which happy holds: we get the implied law nonexecutable death if happy . (We omit the formal derivation of this implied law for lack of space. It is rather involved since it also requires to taking into account the presence of other causal laws in the example.) Similarly, if we replace ¬rich if ¬alive by either of alive if rich or ⊥ if rich ∧ ¬alive, the only way that ¬rich can be ‘caused’ is by a lose transition or by inertia. Consequently, transitions of type death ∧ ¬lose become non-executable in the states {alive, rich, ¬happy } and {alive, rich, happy } whether or not we also make the earlier adjustment to the alive/happy constraint. In addition, we have the implied law nonexecutable death ∧ ¬lose if rich: a rich person cannot die unless he simultaneously loses his wallet. There is one way in which we can use constraints ⊥ if rich ∧ ¬alive and ⊥ if happy ∧¬alive (or alive if rich and alive if happy ) without losing transitions. That is by adding a pair of extra fluent dynamic laws: either death causes ¬rich
and
death causes ¬happy
or the weaker pair death may cause ¬rich and death may cause ¬happy . (In C+, α may cause F is an abbreviation for the fluent dynamic law F if F after α.) We leave out the (straightforward) derivation that demonstrates both these pairs
Some Logical Properties of Nonmonotonic Causal Theories
209
have the claimed effect. Neither is entirely satisfactory since they require all ramifications of death to be identified in advance and then modelled explictly using causal laws. We turn now to examine the effects of concurrent actions. First, notice that the law nonexecutable birth ∧ death is implied by the other causal laws. Because: alive if after birth and ¬alive if after death imply by [Aug] alive if after birth ∧ death and ¬alive if after birth ∧ death, which in turn together imply by [CC] alive ∧ ¬alive if after birth ∧ death (which is equivalent to nonexecutable birth ∧ death). And in general α causes A if F, β causes B if G, C if A ∧ B α ∧ β causes C if F ∧ G There is another derivation of nonexecutable birth ∧ death from the causal laws of the example. We have the causal laws nonexecutable birth if alive and nonexecutable death if ¬alive. ⊥ if after birth ∧ alive and ⊥ if after death ∧ ¬alive imply by [Aug]: ⊥ if after birth ∧ death ∧ alive and ⊥ if after birth ∧ death ∧¬alive, which in turn together imply by [DIL] ⊥ if after (birth ∧death ∧ alive) ∨ (birth ∧ death ∧ ¬alive), whose antecedent can be simplified by [RCEA]: ⊥ if after birth ∧ death. In general we have: nonexecutable α if F, nonexecutable β if G nonexecutable α ∧ β if (F ∨ G) What of birth ∧ win and birth ∧ lose? We have nonexecutable birth if alive, nonexecutable win if ¬alive nonexecutable birth ∧ win from which nonexecutable birth ∧ lose follows by a similar argument. This leaves transitions of type death ∧ lose and death ∧ win. death ∧ lose is not problematic. We have the implied causal laws death ∧ lose causes ¬alive (by [Aug] from death causes ¬alive) and death ∧ lose causes ¬rich (either by [Aug] from lose causes ¬rich or from the implied law death causes ¬rich). In this example, the effects of death ∧ lose transitions are the same as those of death ∧ ¬lose transitions. Consider now death ∧ win. Here we need some adjustment to the example’s formulation. We have the implied law nonexecutable win ∧ death because (one of several possible derivations): we have the implied law (win ∧death) causes (rich ∧ ¬alive), the static law ¬rich if ¬alive implies ⊥ if rich ∧ ¬alive, and so (win ∧ death) causes ⊥, which is equivalent to nonexecutable win ∧ death. But it seems unreasonable to insist that win∧death transitions cannot happen— that was not the intention when the example was originally formulated. We can admit the possibility of win ∧death transitions by re-formulating the relevant causes statement for win so that it reads instead win causes rich if ¬death, or equivalently win ∧ ¬death causes rich. The effects of the ‘win’ transitions are unchanged, but the transition system now contains transitions of type win ∧ death: their effects are exactly the same as those of ‘death’ and death ∧ lose transitions.
210
M. Sergot and R. Craven
But note that after this adjustment, we have to re-examine other combinations of possible concurrent actions. win ∧ birth is still non-executable (it depended on the pre-conditions of the two actions, not their effects) but we no longer have nonexecutable win ∧ lose. We have only the implied law (win ∧ lose) causes (rich ∧ ¬rich ) if ¬death, or equivalently, nonexecutable win ∧ lose ∧ ¬death. So now a person can win the lottery and lose his wallet simultaneously, but only if he dies at the same time. But suppose win ∧ lose ∧ ¬death is intended to be executable. What should its effects be? One possibility is that the effects of win override those of lose. We replace the lose causes ¬rich law by the weaker lose causes ¬rich if ¬win. A second possibility is that the effects of lose override those of win. We replace the win causes rich if ¬death law by the weaker win causes rich if ¬death ∧ ¬lose. (And we may prefer to introduce an ‘abnormality’ action constant (see [1, Section 4.3]) to express the defeasibility of winning more concisely.) The third possibility is to say that win ∧ lose transitions are non-deterministic: win ∧ lose may cause rich,
win ∧ lose may cause ¬rich
What of the interactions between non-deterministic win ∧ lose actions and death? We still have the implied law win ∧lose ∧death causes ¬rich. But perhaps the non-deterministic effects of the other win ∧ lose transitions should have been formulated thus: win ∧ lose ∧ ¬death may cause rich,
win ∧ lose ∧ ¬death may cause ¬rich
This is unnecessary. In C+ {α may cause F, α may cause ¬F, β causes ¬F } and {α ∧ ¬β may cause F, α ∧ ¬β may cause ¬F, β causes ¬F } are equivalent. Left-to-right is just an instance of [Aug]. For right-to-left, notice that α ∧ ¬β may cause F, β causes ¬F is an instance of the general pattern of causal rules {P ⇐ P ∧ Q ∧ ¬R, ¬P ⇐ R}, discussed at the end of Section 4. It is equivalent to {P ⇐ P ∧ Q, ¬P ⇐ R}. For the other part, notice that β causes ¬F implies α ∧ β may cause ¬F by [Aug], and α ∧ ¬β may cause ¬F and α ∧ β may cause ¬F together imply α may cause ¬F by [DIL] and [RCEA]. There are other variations of the example that we do not consider here for lack of space. We might remove the declaration that happy is inertial. Or we might choose to make the fluent constant happy statically determined instead of ‘simple’. These changes have a further set of interactions with the other causal laws. Their effects can be analysed in similar fashion.
References 1. Giunchiglia, E., Lee, J., Lifschitz, V., McCain, N., Turner, H.: Nonmonotonic causal theories. Artificial Intelligence 153 (2004) 49–104 2. Turner, H.: A logic of universal causation. Artificial Intelligence 113 (1999) 87–123 3. Giunchiglia, E., Lee, J., Lifschitz, V., Turner, H.: Causal laws and multi-valued fluents. In: Proc. of the Fourth Workshop on Nonmonotonic Reasoning, Action, and Change, Seattle. (2001) 4. Chellas, B.F.: Modal Logic—An Introduction. Cambridge University Press (1980)
Modular-E: An Elaboration Tolerant Approach to the Ramification and Qualification Problems Antonis Kakas1, Loizos Michael2 , and Rob Miller3 1
University of Cyprus, P. O. Box 20537, CY-1678, Cyprus [email protected] 2 Harvard University, Cambridge, MA 02138, USA [email protected] 3 University College London, London WC1E 6BT, UK [email protected]
Abstract. We describe Modular-E (ME ), a specialized, modeltheoretic logic for narrative reasoning about actions, able to represent non-deterministic domains involving concurrency, static laws (constraints) and indirect effects (ramifications). We give formal results which characterize ME ’s high degree of modularity and elaboration tolerance, and show how these properties help to separate out, and provide a principled solutions to, the endogenous and exogenous qualification problems. We also show how a notion of (micro) processes can be used to facilitate reasoning at the dual levels of temporal granularity necessary for narrative-based domains involving “instantaneous” series of indirect and knock-on effects.
1
Introduction
Domain descriptions for reasoning about actions and change (RAC) in commonsense reasoning and other contexts should be Elaboration Tolerant [10,9]. Formalisms should be able to incorporate new information gracefully into representations, e.g. by the simple addition of sentences. Elaboration Tolerance (ET) is strongly linked with the need to have a modular semantics for RAC frameworks that properly separates different aspects of the domain knowledge, as argued e.g. in [6]. ET and modularity are known to be strongly related to the Qualification Problem in RAC – if the effect laws (or action executability laws) of our domain are not qualified in a complete way they can lead to unintended conclusions that contradict new information. In particular, new narrative information about observations or attempted actions can render the domain description inconsistent in this way. In this paper, we present the language Modular-E (ME) as a case study in developing modular semantics for RAC frameworks in order to provide comprehensive solutions to the ramification and qualification problems. Our approach builds upon [7] and is inspired by [13], separating out the qualification problem into two parts - an endogenous aspect concerning qualifications expressible in the known domain language, and an exogenous aspect where change is qualified by C. Baral et al. (Eds.): LPNMR 2005, LNAI 3662, pp. 211–226, 2005. c Springer-Verlag Berlin Heidelberg 2005
212
A. Kakas, L. Michael, and R. Miller
unrepresented (or exogenous) factors. The semantics of ME decouples these two problems, allowing exogenous qualifications to come into play only when the endogenous qualification alone is not sufficient to avoid inconsistency. It uses a simple default minimization of exogenous qualifications to “minimize unexplained failure” (c.f. [13]) when observations of properties cannot be reconciled with the assumed success of the applied effect laws. ME’s modular semantics offers a clean solution to the problem of anomalous models that arose from earlier treatments of the qualification problem. To achieve the semantic decoupling of endogenous and exogenous qualifications it is important to address two issues. First, a proper treatment of ramifications, including non-determinism and loops in chains of instantaneous effects, is needed (as any incomplete treatment will cause some endogenous qualifications to be treated as exogenous). ME uses a notion of processes for this. Second, for the same reason a full account is needed for the qualifications that static constraints provide for causal laws. In this regard we distinguish between local or explicit and global or implicit qualification. Local qualifications are the explicit preconditions included in individual causal effect laws and action executability statements. Global qualifications are formed at the semantic level by taking into account static laws and interactions between effect laws. Global qualification is closely related to modularity. Without it elaboration tolerance is compromised by the need to manually reconcile each local set of qualifications with each new static law. We show that this analysis of the qualification and ramification problems indeed results in modularity and elaboration tolerance. For example, ME enjoys a “free will” property – a domain description can be extended with any action attempt at any time after its recorded observations without affecting the conclusions about the domain up to that time.
2
ME Syntax and Examples
In this section we give ME’s syntax and sketch its important characteristics via a series of examples. Definition 1 (Domain Language). An ME domain language is a tuple Π, , ∆, Φ, where is a total ordering defined over the non-empty set Π of time-points, ∆ is a non-empty set of action constants, and Φ is a non-empty set of fluent constants. Definition 2 (Formula, Literal and Conjunction). A fluent formula is a propositional formula containing only fluent constants (used as extra-logical symbols), the standard connectives ¬, →, ←, ↔, ∨ and ∧, and the truth value constants and ⊥. A fluent literal is either a fluent constant or its negation. An action literal is either an action constant or its negation. A fluent conjunction is a conjunction of fluent literals. Definition 3 (Converse). Let E be an action or fluent constant. The converse of E, written E, is ¬E, and the converse of ¬E, written ¬E, is E.
ME : An Elaboration Tolerant Approach
213
Definition 4 (Domain Description or Theory). A domain description or theory in ME is a collection of the following types of statements, where φ is a fluent formula, T is a time point (assume an integer or real number unless otherwise stated), A is an action constant, C is a (possibly empty) set of fluent and action literals, L is a fluent literal, and E is a non-empty set of action constants and fluent literals: – – – – –
h-propositions o-propositions c-propositions p-propositions a-propositions
of of of of of
the form: φ holds-at T the form: A occurs-at T the form: C causes L the form: φ prevents E the form: always φ
A domain description is finite if it contains only a finite number of propositions. Singleton sets of fluent or action literals in c-propositions of the form {P } will sometimes be written without enclosing braces, i.e. as P . The intended meaning of h-propositions is straightforward – they can be used to record “observations” about the domain along the time line. “A occurs-at T ” means that an attempt to execute A occurs at T . Together, the h- and o-propositions describe the “narrative” component of a domain description. “C causes L” means that, at any time-point, the combination of actions, inactions and preconditions described via C will provisionally cause L to hold immediately afterwards. As we shall see, the provisos automatically accompanying this causal rule are crucial – in any model the potential effect L competes with other potential effects, and maybe overridden, for example, because it would otherwise result in a more-than-instantaneous violation of a domain constraint described with an a-proposition. The rule “C causes L” is thus qualified both locally (via C) and globally via the total set of c-, p- and a-propositions. “φ prevents E” means that the circumstances described by φ prevent the simultaneous causation/execution of the effects/actions listed in E. “ always φ” means that ¬φ can never hold, other than in temporary, instantaneous “transition states” which form part of an instantaneous chain of indirect effects. In other words, “ always φ” describes a domain constraint or static law at the granularity of observable time. Example 1 (Lift Door). A lift door can be opened and closed by pressing the “open” and “close” buttons respectively. The door is initially open, and both buttons are pressed simultaneously. This scenario can be described with a single fluent DoorOpen and two actions PressOpen and PressClose: {PressOpen} causes DoorOpen {PressClose} causes ¬DoorOpen DoorOpen holds-at 1 PressOpen occurs-at 2 PressClose occurs-at 2
(LD1) (LD2) (LD3) (LD4) (LD5)
Example 1 results in two models – one in which the door is open at times after 2 and one in which the door is closed. Note that, even though the conflicting
214
A. Kakas, L. Michael, and R. Miller
actions are not prevented from occurring together (i.e. there is no p-proposition “ prevents {PressOpen, PressClose}”), they do not give rise to inconsistency. More generally, we show in Section 4 that ME exhibits a “free will” property – from any consistent initial state, and for any given collection of c- and ppropositions, any series of actions may be attempted without giving rise to inconsistency. Put another way, any finite collection of o-, c- and p-propositions is consistent with any internally consistent collection of a-propositions. Consequently, the only way to engineer an inconsistent ME domain description (other than by inclusion of inconsistent a-propositions) is to include “observations” (hpropositions) along the time line which contradict the predictions that would otherwise be given by ME’s semantics. In Section 5 we show how this remaining type of inconsistency can sometimes be overcome by attributing it to unknown exogenous reasons and applying a simple minimization to these. The following series of “broken car” examples is to illustrate the modularity and elaboration tolerance of ME, and how this is linked to the way a- and c-propositions interact. Example 2 (Broken Car A). Turning the key of a car causes its engine to start running. The key is turned at time 1: {TurnKey} causes Running TurnKey occurs-at 1
(BC1) (BC2)
In all models of this domain the car engine is running at all times after 1. (A more complete description would typically include some local qualifications for (BC1), e.g. “{TurnKey, BatteryOK } causes Running” – turning the key starts the engine only when the battery is OK, in which case models would also arise where e.g. ¬BatteryOK and ¬Running at all time-points.) Example 3 (Broken Car B). We elaborate the previous description by stating that broken cars’ engines cannot run: always ¬(Broken ∧ Running)
(BC3)
There are two classes of models for the elaborated domain (BC1)-(BC3) – one in which the car is broken and not running at times after 1, and one in which the car is not broken and running. The occurrence of TurnKey at 1 does not eliminate the model in which the car is broken because the semantics of ME allows (BC3) to act as a global qualification, in particular for (BC1). The TurnKey action does not force ¬Broken at earlier times, and thus if in addition the car is known to be broken the theory remains consistent after this elaboration. Without this characteristic, we would have to alter (BC1) to “{TurnKey, ¬Broken} causes Running” to accommodate (BC3), in other words explicitly encode as a local qualification the global qualification effect of (BC3) on (BC1). In ME this local qualification is redundant thus illustrating its modular nature; the a-proposition (BC3) has been simply added without further ado.
ME : An Elaboration Tolerant Approach
215
Example 4 (Broken Car C). We elaborate Example 3 with two more causal rules and an extra action occurrence: {Break } causes Broken {Broken} causes ¬Running Break occurs-at 1
(BC4) (BC5) (BC6)
In all models of the domain (BC1)-(BC6), the car is broken and not running at times after 1. (BC5) describes an “indirect effect” or “ramification”. It introduces an asymmetry between the Running and Broken fluents and their relationship with (BC3), preventing (BC3) from acting as a qualification for (BC4) in the same way as it does for (BC1). Translating global to local/explicit qualifications is therefore complex, as it requires consideration of the interactions between aand c-propositions. ME deals with indirect effects by considering chains of instantaneous, temporary transition states (“nodes”). Within these causal chains, “processes” are introduced to describe the initiation and termination of fluents. These processes may “stretch” across several links of a given chain before they are complete, thus allowing all possible micro-orderings of effects to be considered. Because of the coarseness of the domain description with respect to the granularity of time, this is important for a proper treatment of collections of instantaneous effects which compete or “race” against each other. Furthermore, since the granularity of time in which these chains operate is finer than that of observable time, intermediate states within them may (temporarily) violate the static laws described by a-propositions. In Example 4, one of the chains allowed by the semantics completes the process initiating Running and then the process initiating Broken. At this point there is a state in which (BC3) is violated, but (BC5) then generates a new process terminating Running whose completion results in a consistent state further along the chain. Example 5 (Broken Car B+/C+). We elaborate the previous two descriptions by observing the car running at time 2: Running holds-at 2
(BC-obs)
Adding (BC-obs) to Example 3 does not result in inconsistency, but allows us to infer that the car is not broken (in particular at earlier times). Note that ME would facilitate the opposite conclusion (Broken ) in exactly the same way had the observation been “¬Running holds-at 2”. This is because it accords exactly the same status to globally derived qualifications (in this case from (BC3)) as to qualifications localized to particular c-propositions. However, adding (BC-obs) to Example 4 does give rise to inconsistency at the level of the ME’s “base semantics” (as detailed in Section 3), because since there are no (local or globally derived) qualifications to (BC4) and (BC5), the theory would otherwise entail ¬Running. An intuitive explanation for (BC-obs) in this context is that one or both of the effects of (BC4) and (BC5) “failed” due to exogenous circumstances (i.e. factors not included in the representation) implicitly qualifying these causal rules. This type of reasoning is captured within ME by the use of simple default minimization of such exogenous qualifications
216
A. Kakas, L. Michael, and R. Miller
(see Section 5). The minimization policy is straightforward and robust because the base semantics fully accounts for all endogenous qualifications (i.e. those expressed in the domain) by its modularity and its encapsulation of global as well as local qualifications, as described above. Example 6 (Broken Car D). We elaborate Example 4 with the knowledge that the car was parked at time 0 in anti-theft mode (ATM), so that causing the engine to run (even for an instant) will trigger the alarm: (¬Broken ∧ ¬Running ∧ ¬Alarm ∧ ATM ) holds-at 0 {Running, ATM } causes Alarm
(BC7) (BC8)
Intuitively, even though at times after 1 the car will be broken and not running, the alarm may or may not be triggered in this narrative, depending on whether the (indirect) effect of the Break action takes effect just before or just after the effect of the TurnKey action. This is an example of a “race” condition between competing instantaneous effects. ME is able to deal correctly with such representations via its processed-based semantics. It gives two models of this domain – in both models (Broken ∧ ¬Running) is true at times after 1, but in one model Alarm is true and in the other it is false. The example illustrates how ME’s processes operate at a finer level of temporal granularity than “observable time” in order to deal with “instantaneous” indirect effects.1 Example 7 (Oscillator). {On} causes ¬On {¬On} causes On
(OSC1) (OSC2)
This example (which might e.g. represent the internal mechanism of an electric buzzer) has an infinite number of models in which the truth value of On is arbitrarily assigned at each time point. It illustrates that ME is able to deal with “loops” of indirect effects without over-constraining models. It is important, for example, not to restrict the set of models to those in which the truth value of On alternates at each successive time-point. This is because the change within the domain is happening ”instantaneously” – i.e. at an altogether finer granularity of time than “observable” time. Therefore the observable time-points are best considered as arbitrarily spaced “snapshots” of the finer-grained time continuum. A full treatment of such loops along these lines (as well as a full treatment of concurrency and nondeterminism) is necessary for ME to exhibit the “free will” property and resulting modularity and elaboration tolerance described above. 1
An interesting (and more contentious) variation of Example 6 is to delete (BC4) and (BC6), and replace (BC7) with “(Broken ∧¬Running ∧¬Alarm ∧ATM ) holds-at 0”. (so that the car is already broken at 1). ME ’s semantics still gives the two models with Alarm true in one and false in the other. This is because it treats (BC3) only as a “stability” constraint at the temporal granularity of “observable” time, and not as a “definitional” constraint that would transcend all levels of temporal granularity. Note, however, that we could eliminate the model in which Alarm was true by adding the p-proposition “Broken prevents Running”, meaning that Broken prevents Running from being caused (even instantaneously).
ME : An Elaboration Tolerant Approach
3
217
Modular-E Base Semantics
In this section we give a formal account of ME’s semantics. We begin with some straightforward preliminary definitions concerning states and processes. 3.1
Definitions Regarding States, Processes and Causal Change
Definition 5 (States and Satisfaction). A state is a set S of fluent literals such that for each fluent constant F , either F ∈ S or ¬F ∈ S but not both. A formula φ is satisfied in a state S iff the interpretation corresponding to S is a model of φ. Definition 6 (A-Consistency). Let D be a domain description and S a state. S is a-consistent with respect to D iff for every a-proposition “ always φ” in D, φ is satisfied in S. D is a-consistent iff there exists a state which is a-consistent with respect to D. Let Da denote the set of all a-propositions in D. Then given a fluent formula ψ, Da |=a ψ iff ψ is entailed classically by the theory T = {φ | always φ ∈ D}. Definition 7 (Process). A process is an expression of the form ↑F or ↓F , where F is a fluent constant of the language. ↑F is called the initiating process of F and ↓F is called the terminating process of F . The associated processes of the c-propositions “C causes F ” and “C causes ¬F ” are respectively ↑F and ↓F . ↑F and ↓F will also sometimes be written as proc(F ) and proc(¬F ) respectively. An active process log is a set of processes. Definitions 8 – 15 concern the identification of fluent changes following instantaneously from a given state and set of actions. A causal chain represents a possible instantaneous series of knock-on effects implied by the causal laws. There is a repeated two-phase mechanism for constructing the “nodes” of causal chains – a triggering phase in which new processes are generated from c-propositions applicable at that point, immediately followed by a resolution phase in which some of the already-active processes complete, resulting in an update of the corresponding fluents’ truth values. The process triggering is appropriately limited by the p-propositions. The triggering and completion of a particular process may be separated by several steps in the chain, so that consideration of all such chains gives an adequate treatment of “race” conditions between competing instantaneous effects. Chains terminate either because they reach a state from which no change is possible (a static node) or because they loop back on themselves. We have made the working (but retractable) assumption that actions trigger processes only at the beginning of such chains, at which point they are “consumed”. Definition 8 (Causal Node). A causal node (or node) is a tuple S, B, P , where S is a state, B is a set of action constants and P is an active process log. S, B, P is fully resolved iff P = ∅, and is a-consistent w.r.t. a domain description D iff S is a-consistent w.r.t. D.
218
A. Kakas, L. Michael, and R. Miller
Definition 9 (Triggering). Let D be a domain description, N = S, B, P a node, Lt a set of fluent literals, Pt = {proc(L) | L ∈ Lt }, and Bt a set of action constants. The set (Bt ∪ Pt ) is triggered at N with respect to D iff 1. Bt ⊆ B 2. For each p-proposition “φ prevents E” in D, either φ is not satisfied in S or E ⊆ (Bt ∪ Lt ). 3. For each L ∈ Lt there is a c-proposition “C causes L” in D such that (i) for each action constant A ∈ C, A ∈ Bt , (ii) for each action literal ¬A ∈ C, A ∈ Bt , and (iii) for each fluent literal L ∈ C, L ∈ S. (Bt ∪ Pt ) is maximally triggered at N with respect to D iff there is no other set (Bt ∪ Pt ) also triggered at N with respect to D and (Bt ∪ Pt ) is a strict subset of (Bt ∪ Pt ). Definition 10 (Process Successor). Let D be a domain description and N = S, B, P a node. A process successor of N w.r.t. D is a node of the form S, Bt , (P ∪ Pt ), where (Bt ∪ Pt ) is maximally triggered at N with respect to D. Definition 11 (Resolvant). Let N = S, B, P and N = S , ∅, P be causal nodes. N is a resolvant of N iff S = S and P = P = ∅ or there exists a non-empty subset R of P such that the following conditions hold. 1. P = P − R. 2. For each fluent constant F such that both ↑F and ↓F are in P , either both or neither ↑F and ↓F are in R. 3. For each fluent constant F (i) if ↑F ∈ R and ↓F ∈ R then F ∈ S , (ii) if ↓F ∈ R and ↑F ∈ R then ¬F ∈ S , (iii) if ↓F ∈ R and ↑F ∈ R then F ∈ S iff F ∈ S. N is a full resolvant of N iff P = ∅. Definition 12 (Stationary/Static Nodes). Let D be a domain description and N = S, B, P a causal node. N is stationary iff for each resolvant S , ∅, P of N , S = S. N is static w.r.t. D iff every process successor of N w.r.t. D is stationary. The central definition of causal chains now follows. It is slightly complicated by the need to deal with loops – conditions 2, 3 and 4 below ensure that all chains will end when the first static or repeated node is encountered. Definition 13 (Causal Chain). Let D be a domain description and let N0 be a node. A causal chain rooted at N0 with respect to D is a (finite) sequence N0 , N1 , ..., N2n of nodes such that for each k, 0 ≤ k ≤ n − 1, N2k+1 is a process successor of N2k w.r.t. D and N2k+2 is a resolvant of N2k+1 , and such that the following conditions hold: 1. N2n is fully resolved. 2. N2n is static, or there exists k < n s.t. N2n = N2k .
ME : An Elaboration Tolerant Approach
219
3. If there exists j < k ≤ n s.t. N2j = N2k then k = n. 4. There does not exist a k < n s.t. N2k is static. In the context of Example 1, Figure 1 below shows the tree of all possible causal chains with the starting node {DoorOpen}, {PressClose, PressOpen}, ∅ (which intuitively corresponds to the situation at time 2). N1 is the unique process successor of N0 , and the nodes N2 and N2 (which are both static) are the only resolvants of N1 . N0 : {DoorOpen}, {PressClose, PressOpen}, ∅ ↓ N1 : {DoorOpen}, {PressClose, PressOpen}, {↑DoorOpen, ↓DoorOpen} N2 : {DoorOpen}, ∅, ∅ N2 : {¬DoorOpen}, ∅, ∅
Fig. 1.
As regards Example 6, we may form several causal chains starting from the node corresponding to time 1. Here is a chain terminating with a state in which Alarm holds (Br = Broken , Ru = Running , Al = Alarm): N0 : {¬Br , ¬Ru, ¬Al , ATM }, {Break, TurnKey}, ∅ N1 : {¬Br , ¬Ru, ¬Al , ATM }, {Break, TurnKey}, {↑Br, ↑Ru} N2 : {Br , Ru, ¬Al, ATM }, ∅, ∅ N3 : {Br , Ru, ¬Al, ATM }, ∅, {↓Ru, ↑Al} N4 : {Br , ¬Ru, Al, ATM }, ∅, ∅ Here is another chain terminating with a state in which ¬Alarm holds: N0 : {¬Br , ¬Ru, ¬Al , ATM }, {Break, TurnKey}, ∅ N1 : {¬Br , ¬Ru, ¬Al , ATM }, {Break, TurnKey}, {↑Br, ↑Ru} N2 : {Br , ¬Ru, ¬Al , ATM }, ∅, {↑Ru} N3 : {Br , ¬Ru, ¬Al , ATM }, ∅, {↓Ru, ↑Ru} N4 : {Br , ¬Ru, ¬Al , ATM }, ∅, ∅ Nodes, and in particular nodes that terminate causal chains, do not necessarily contain a-consistent states. But causal chains that do not terminate aconsistently are not discarded when computing direct and indirect instantaneous effects. Rather, the semantics identifies proper causal descendants within a tree of all possible causal chains starting from a given root node. These are a-consistent nodes which are either within the terminating loop of a chain (condition 1 in Definition 14), or are such that there are no other a-consistent nodes further from the root of the tree (condition 2). (For example, in Fig. 1, N2 and N2 are proper causal descendants of N0 by condition 1 below, with j = k = n = 1.) Definition 14 (Proper Causal Descendant). Let D be a domain description and let N0 and N be nodes. N is a proper causal descendant of N0 w.r.t.
220
A. Kakas, L. Michael, and R. Miller
D iff N is a-consistent w.r.t. D, and there exists a causal chain N0 , N1 , ..., N2n w.r.t. D such that N = N2k for some 0 ≤ k ≤ n and at least one of the following two conditions holds: 1. There exists j ≤ k such that N2j = N2n . 2. There does not exist a causal chain N0 , N1 , ..., N2k , N2k+1 , ..., N2m w.r.t. D and a j such that k < j ≤ m and N2j is a-consistent w.r.t. D. It is also useful to define a stable state as a state that does not always immediately cause its own termination (note that stable states can be in loops, but must be a-consistent): Definition 15 (Stable State). Let D be a domain description and let S be a state. S is stable w.r.t. D if there exists a node S, ∅, P which is a proper causal descendant of S, ∅, ∅. Example 8 (Promotion). An employee gets promoted at time 1. Promotion results in a large office (LO ) and big salary (BS ). But nobody gets a large office when the building is overcrowded (OC ), which it is at time 1: always ¬(OC ∧ LO) Promote causes {BS , LO } Promote occurs-at 1 (¬LO ∧ ¬BS ∧ OC ) holds-at 1
(PR1) (PR2) (PR3) (PR4)
Here is the tree of possible causal chains that arise at time 1 in this example, with the single proper causal descendant of the root node underlined:
{¬LO, ¬BS , OC }, {Promote}, ∅ ↓ {¬LO, ¬BS , OC }, {Promote}, {↑LO, ↑BS } ↓ {LO, ¬BS , OC }, ∅, {↑BS } {LO, BS , OC }, ∅, ∅ {¬LO, BS , OC }, ∅, {↑LO} ↓ ↓ {LO, ¬BS , OC }, ∅, {↑BS } {¬LO, BS , OC }, ∅, {↑LO} ↓ ↓ {LO, BS , OC }, ∅, ∅ {LO, BS , OC }, ∅, ∅
Fig. 2.
3.2
Definitions Regarding Time and Temporal Change
If a causal node corresponds to a particular time-point in the narrative of a given domain description (e.g. in Fig. 1, N0 corresponds to time 2), then Definitions 16 – 21 below ensure that the states within its proper causal descendants indicate possible choices as to which fluents will change values in the time period immediately afterwards. These definitions are largely modifications of those in [7], but with the notion of a change set replacing that of initiation/termination points. Definition 16 (Interpretation). An interpretation of ME is a mapping H : Φ × Π → {true, false}.
ME : An Elaboration Tolerant Approach
221
Definition 17 (Time-point Satisfaction). Given a fluent formula φ of ME and a time point T , an interpretation H satisfies φ at T iff the mapping MT defined by ∀F, MT (F ) = H(F, T ) is a model of φ. Given a set Z of fluent formulae, H satisfies Z at T iff H satisfies φ at T for each φ ∈ Z. Definition 18 (State/Event Base at a Time-point). Let D be a domain description, H an interpretation, and T a time-point. The state at T w.r.t. H, denoted S(H, T ), is the state {F | H(F, T ) = true} ∪ {¬F | H(F, T ) = false}. The event base at T w.r.t. D, denoted B(D, T ), is the set {A | “A occurs-at T ” ∈ D}. Definition 19 (Causal Frontier). Let D be a domain description, T a timepoint, H an interpretation and S a state. S is a causal frontier of H at T w.r.t. D iff there exists a node N = S, B, P such that N is a proper causal descendant of S(H, T ), B(D, T ), ∅ w.r.t. D. Definition 20 (Change Set). Let D be a domain description, H an interpretation, T a time-point and C a set of fluent literals. C is a change set at T w.r.t. H iff there exists a causal frontier S of H at T w.r.t. D such that C = S − S(H, T ). Definition 21 (Model). Let D be a domain description, and let Φ∗ be the set of all (+ve and -ve) fluent literals in the language. Then an interpretation H is ∗ a model of D iff there exists a mapping c : Π → 2Φ such that for all T , c(T ) is a change set at T w.r.t. H, and the following three conditions hold. For every fluent literal L and time-points T1 ≺ T3 : 1. If H satisfies L at T1 , and there is no time-point T2 s.t. T1 T2 ≺ T3 and L ∈ c(T2 ), then H satisfies L at T3 . 2. If L ∈ c(T1 ), and there is no time-point T2 s.t. T1 ≺ T2 ≺ T3 and L ∈ c(T2 ), then H satisfies L at T3 . 3. H satisfies the following constraints: – For all “φ holds-at T ” in D, H satisfies φ at T . – For all time-points T , S(H, T ) is a stable state. Intuitively, condition (1) above states that fluents change their truth values only via successful effects of c-propositions, and (2) states that successfully initiating a literal establishes its truth value as true. Note also that condition (3)’s requirement of stability ensures that S(H, T ) is a-consistent. Definition 22 (Consistency and Entailment). A domain description D is consistent if it has a model. D entails the h-proposition “φ holds-at T ”, written D |= φ holds-at T , iff for every model M of D, M satisfies φ at T . Example 9 (Faulty Circuit). An electric current in a faulty circuit is switched on causing a broken fuse, which in turn terminates the current: {SwitchOn} causes ElectricCurrent {ElectricCurrent} causes BrokenFuse
(FC1) (FC2)
222
A. Kakas, L. Michael, and R. Miller
{BrokenFuse} causes ¬ElectricCurrent always ¬(ElectricCurrent ∧ BrokenFuse) SwitchOn occurs-at 1
(FC3) (FC4) (FC5)
One causal chain that could be triggered at time 1 (with non-a-consistent nodes N4 and N5 ) is: N0 : {¬ElectricCurrent, ¬BrokenFuse}, {SwitchOn}, ∅ N1 : {¬ElectricCurrent, ¬BrokenFuse}, {SwitchOn}, {↑ElectricCurrent} N2 : {ElectricCurrent, ¬BrokenFuse}, ∅, ∅ N3 : {ElectricCurrent, ¬BrokenFuse}, ∅, {↑BrokenFuse}, N4 : {ElectricCurrent, BrokenFuse}, ∅, ∅ N5 : {ElectricCurrent, BrokenFuse}, ∅, {↓ElectricCurrent} N6 : {¬ElectricCurrent, BrokenFuse}, ∅, ∅. This chain is well-formed because N6 is the first static resolvant node and is fully resolved (Definition 13). N6 is a-consistent and therefore is a proper causal descendant of N0 (Definition 14). So {¬ElectricCurrent, BrokenFuse} is a causal frontier at 1 of any interpretation that satisfies (¬ElectricCurrent ∧¬BrokenFuse) at 1 (Definition 19), thus providing the change set {BrokenFuse} (Definition 20). Note that at the granularity level of the representation of this example, ElectricCurrent, the cause of BrokenFuse, is never true! ElectricCurrent is true only at a finer granularity.
4
Some Formal Results and Properties
As we have seen, ME provides principled, general mechanisms for causal laws to be qualified both by each other and by static laws, thus integrating all endogenous qualifications within one base-level semantic framework. ME also provides a high degree of modularity by its separation of information about causality (c-, p- and a-propositions), narrative information about attempted actions (o-propositions), and observations (h-propositions) within the narrative. These qualities make ME domain descriptions particularly elaboration tolerant, as the following results show. (Proofs of all results at www.ucl.ac.uk/slais/robmiller/modular-e/lpnmr05long.pdf). Definition 23 (Pre- and Post-observation/action Points). Given a domain description D, a post-observation point of D is a time-point Tp such that, for every h-proposition of the form “φ holds-at T ” in D, T Tp . A preaction point (respectively post-action point) is a time-point Ta such that, for every o-proposition “A occurs-at T ” in D, Ta T (respectively Ta T ). Definition 24 (Projection Domain Description). The domain description D is a projection domain description if there exists a time-point which is both a post-observation point and a pre-action point of D.
ME : An Elaboration Tolerant Approach
223
Theorem 1 (Free Will Theorem). Let M be a model of a finite domain description D, let O be a finite set of o-propositions, and let Tn be a time-point which is both a post-observation point for D and a pre-action point for O. Then there is a model MO of D ∪ O such that for any fluent F and time-point T Tn , MO (F, T ) = M (F, T ). Corollary 1 (Free Will Corollary). Let D and D be domain descriptions and let Tn be a post-observation point for both D and D . Let D and D differ only by o-propositions referring to time-points greater than or equal to Tn and let M be a model of D. The there is a model M of D such that M (F, T ) = M (F, T ) for all fluent constants F and all time-points T such that T Tn . Corollary 2 (Action Elaboration Tolerance Corollary). Let D be a consistent domain description and let O be a finite set of o-propositions. If there exists a time-point Tn which is both a post-observation point for D and a preaction point for O, then D ∪ O is consistent. Theorem 2 demonstrates the robustness and elaboration tolerance of ME theories by showing that their consistency is contingent only on the internal consistency of the static laws and on whether observations match with predicted effects. Theorem 2 (Theorem of Causal Elaboration Tolerance). Let Da be a consistent domain description consisting only of a-propositions and let E be a finite set of o-, c- and p-propositions. Then Da ∪ E is also a consistent domain description. Lack of space prevents us from giving further formal results here on the link between global and local qualifications as illustrated in examples 3 and 4. These results show their complex relationship and hence the difficulty to have modularity when a framework relies overly on explicit local qualification.
5
Exogenous Qualifications
ME’s base semantics offers an elaboration tolerant solution to the endogenous qualification problem, where properties of the domain implicitly qualify the effect laws. It is, nonetheless, still possible that an effect fails to be produced as expected. Such a scenario occurs, for instance, when we elaborate Example 2 by observing the car not running at time 2. No known reason can explain this unexpected observation, so it needs to be attributed to an exogenous cause. A way to reconcile such conflicts is to assume that every effect law of a domain description is implicitly qualified [4] by a set of extra preconditions, written Normal exo that symbolizes the normal conditions under which the law operates successfully. These preconditions are outside the user’s language or exogenous [13], and package together all the unknown conditions necessary for the effect law to successfully generate its effect. They hold true by default unless the observations in a given narrative make the domain description inconsistent.
224
A. Kakas, L. Michael, and R. Miller
Definition 25 (Default description. To obtain ciated with D: (i) “C ∪ Normal exo(C, L) “ normally norm exo( )” Normal exo( ).
Domain Description). Let D be a domain the default domain description Dd assoreplace every c-proposition “C causes L” with causes L”, and (ii) add the n-proposition for every fluent norm exo( ) in some set
The exogenous fluents norm exo that belong to the Normal exo sets depend on assumptions on the nature of the failures of the effect law, in the particular domain of application. A meta-level recovery policy can be chosen a-priori appropriate for the domain at hand. Omitting the details, a recovery policy defines what other effect laws will be assumed to fail once a given effect law is observed to fail. One can define recovery policies where (i) no other effect laws are assumed to fail, (ii) all effect laws sharing the same effect L are also assumed to fail, (iii) all effect laws sharing the same event set C are also assumed to fail, etc. Irrespective of the recovery policy, the default models of domain D are given via the same simple minimization of the exogenous fluents over the (strict) models of the associated default domain Dd . Definition 26 (Default Model). Let D be a domain description, Ta a pre-action point of D, and Dd the default domain description associated with D but without its n-propositions. Then, the restriction of M to fluents other than the norm exo( ) fluents is a default model of D iff (1) )M is a model of Dd , and (2) There is no model M of Dd such that N ⊂ N , where N = {norm exo( ) | M (norm exo( ), Ta ) = true}, N = {norm exo( ) | M (norm exo( ), Ta ) = true}. So far we have assumed that once an effect law is observed to fail, all subsequent instances will also fail by virtue of the persistence of norm exo fluents. Various alternatives are also possible and the semantics can easily be adapted to support them. An observed failed effect law might, for example, cause its subsequent instances to fail nondeterministically, or not fail at all. Hence, in addition to failures, we can also have uncertain failures, or “accidents” (see [13]). The existence of default models can be guaranteed as long as domains are a-consistent, point-wise consistent w.r.t. h-propositions, and do not violate fluent persistence. This requirement is captured by the notion of a frame model, which (assuming a “coupled accidents” recovery policy, where the exogenous qualification of a causal law exactly implies the exogenous qualification of all other causal laws applied to the same time-point) can be defined similarly to a model with the exception that the change set mapping c(·) can map arbitrary time-points to the empty set. Intuitively, this frame model definition allows all causal laws at some time-point to simply fail to produce their effects, as long as the successful production of their effects is not required to explain the change in the truth-value of some fluents. Theorem 3 (Default Model Existence). A domain description D has a default model iff it has a frame model.
ME : An Elaboration Tolerant Approach
6
225
Summary and Related and Future Work
We have shown how ME can represent non-deterministic narrative domains involving concurrency, static laws and indirect effects. We have formally characterized ME’s high degree of modularity and elaboration tolerance, enabled by an exceptionally full solution to the ramification problem able to deal with looping systems of indirect effects, and race conditions between competing causal laws. These properties help separate out, and provide a principled solutions to, the endogenous and exogenous qualification problems. Endogenous qualifications may be either locally specified or globally derived within the base semantics, whereas exogenous qualifications are provided by the use of default minimization. Our approach to the qualification problem and its links to ramifications partly follows that in [13]. But ME’s fuller solution to the frame problem, which covers both successful and failed action attempts, enables it to use the same default reasoning mechanism to deal with not just the “weak” but also the “strong” qualification problem as described in [13]. Two other important aspects in which ME differs from [13] are (a) the more complete treatment of ramifications, e.g. for concurrent effects and (b) the notion of global qualification which gives ME a higher degree of modularity. Our results are in line with the recent study of modularity in [6] which again highlights the link between modularity and freewill properties. Our solution to the ramification problem is related to that in [1] in that the indirect effects of actions are defined constructively through causal laws. But ME’s processed-based semantics differs in that it (a) embraces nondeterminism resulting from the possible orderings by which effects are realized, and (b) attributes meaning to domains (e.g, Example 9) that are deemed ill-formed in [1]. Irrespective of the qualification problem, the “free will” property of Theorem 1 is important to avoid anomalous planning, whereby unintended “plans” can be abduced or deduced for the converse of a precondition of an effect law by virtue of a lack of model for the successful application of that law. (See [11] for an example.) Although lack of space prevents an illustration here, anomalous plans are easy to construct in formalisms such as the Language C [5] which express action non-executability in terms of inconsistency. But they also arise in any framework (such as [7]) unable to provide models for all combinations of causal laws. We currently have a prototype implementation of ME’s base semantics in Prolog. The declarative programming style should facilitate an easy proof of the soundness and completeness of the implementation w.r.t. to ME’s semantics. On the other hand, different techniques might be needed to address the computational qualification problem [3] of avoiding considering the majority of qualifications during the computation. Similar techniques might also prove useful when computing default models, where one does not want to consider all possible ways causal laws might fail, but rather deduce which ones should fail. To this end we are currently considering the use of satisfiability methods or Answer Set Programming (along the lines of [8,12,2]), as well as argumentation (or
226
A. Kakas, L. Michael, and R. Miller
abduction) based computational methods. We also aim to study subclasses (as in [2]) of ME, where the computational complexity of reasoning decreases. There are several aspects of ME that deserve further study. One is the extent to which static laws should be regarded as specific to the temporal granularity of the representation (how would we refine the role that a-propositions play in computing indirect effects?). A detailed comparison would also be useful on different recovery policies used in ME’s approach to the exogenous qualification problem. We would also like to investigate the use of priority policies on different ME models, e.g. to prefer non-change in nondeterministic situations. Acknowledgement. This work was partially supported by the IST programme of the EC, FET under the IST- 2001-32530 SOCS project, within the Global Computing proactive initiative.
References 1. M. Denecker, D. Theseider-Dupr´e, and K. Van Belleghem. An inductive definition approach to ramifications. Linkoping Electronic Articles in Computer and Information Science, 3(7):1–43, 1998. 2. Y. Dimopoulos, A. Kakas, and L. Michael. Reasoning about actions and change in answer set programming. In Proceedings of LPNMR’03, 2004. 3. C. Elkan. On solving the qualification problem. In Extending Theories of Actions: Formal theory and practical applications, AAAI Spring Symposium, 1995. 4. M. Ginsberg and D. Smith. Reasoning about Action II: The Qualification Problem. AIJ, 35, 1988. 5. E. Giunchiglia, J. Lee, V. Lifschitz, N. McCain, and H. Turner. Nonmonotonic Causal Theories. AIJ, 153(1–2):49–104, 2004. 6. A. Herzig and I. Varzinczak. Domain Descriptions Should be Modular. In Proceedings of ECAI 2004. IOS Press, 2004. 7. A. Kakas and R. Miller. Reasoning about Actions, Narratives and Ramifications. Journal of Electronic Transactions on AI, 1(4), 1998. 8. H. Kautz and B. Selman. Pushing the envelope: Planning, propositional logic, and stochastic search. In Proceedings of NCAI’96, 1996. 9. V. Lifschitz. Missionaries and cannibals in the causal calculator. In Proceedings of KR-2000, 2000. 10. J. McCarthy. Elaboration tolerance. http://www-formal.stanford. edy/jmc/elaboration , 1999. 11. R. Miller and M. Shanahan. Some Alternative Formulations of the Event Calculus. Lecture Notes in Artificial Intelligence, 2408:452–490, 2002. 12. M. Shanahan and M. Witkowski. Event Calculus Planning Through Satisfiability. J. of Logic Comp., 14(5):731–745, 2004. 13. M. Thielscher. The Qualification Problem: A solution to the problem of anomalous models. AIJ, 131(1–2):1–37, 2001.
P LATYPUS: A Platform for Distributed Answer Set Solving Jean Gressmann1 , Tomi Janhunen2, Robert E. Mercer3 , Torsten Schaub1, , Sven Thiele1 , and Richard Tichy1,3 1
Institut f¨ur Informatik, Universit¨at Potsdam, Postfach 900327, D-14439 Potsdam, Germany Helsinki University of Technology, Department of Computer Science and Engineering, Laboratory for Theoretical Computer Science, P.O. Box 5400, FI-02015 TKK, Finland 3 Computer Science Department, Middlesex College, The University of Western Ontario, London, Ontario, Canada N6A 5B7 2
Abstract. We propose a model to manage the distributed computation of answer sets within a general framework. This design incorporates a variety of software and hardware architectures and allows its easy use with a diverse cadre of computational elements. Starting from a generic algorithmic scheme, we develop a platform for distributed answer set computation, describe its current state of implementation, and give some experimental results.
1 Introduction The success of Answer Set Programming (ASP) has been greatly boosted by the availability of highly efficient ASP solvers [1,2]. However, its expanding range of application creates an increasing demand for more powerful computational devices. We address this by proposing a generic approach to distributed answer set solving that permits exploitation of the increasing availability of clustered and/or multi-processor machines. We observe that the search strategies of most current answer set solvers naturally decompose into a deterministic and a non-deterministic part, borrowing from the wellknown DPLL satisfiability checking algorithm [3]. While the non-deterministic part is usually realized through heuristically driven choice operations, the deterministic one is normally based on advanced propagation operations, often amounting to the computation of Fitting’s [4] or well-founded semantics [5]. Roughly, the idea is: starting with an empty (partial) assignment of truth values to atoms, successively apply propagation and choice operations, gradually extending a partial assignment, until finally a total assignment, expressing an answer set, is obtained. The overall approach is made precise in Algorithm 1, which closely follows smodels [1].1,2 When called with S MODELS((∅, ∅)), it computes all answer sets of a logic program via backtracking. A partial assignment is represented as a pair (X, Y ) of sets of atoms, in which X and Y contain those atoms assigned true and false, respectively. Informally, propagation is done with the E XPAND function (in Line 1); choices are done with C HOOSE (in Line 4). 1 2
Affiliated with the School of Computing Science at Simon Fraser University, Burnaby, Canada. dlv works analogously yet tuned to disjunctive programs. We use typewriter font when referring to actual systems.
C. Baral et al. (Eds.): LPNMR 2005, LNAI 3662, pp. 227–239, 2005. c Springer-Verlag Berlin Heidelberg 2005
228
J. Gressmann et al.
The first if-statement accounts for invalid assignments indicating an inconsistency (in Line 2), and the second, for the case of a total assignment representing an answer set (in Line 3). Otherwise, a case-analysis is performed on the chosen atom,3 assuming it to be true in Line 5 and false in Line 6, respectively. Algorithm 1: S MODELS Global Input Output 1 2 3
4 5 6
: A logic program Π over alphabet A. : A partial assignment (X, Y ). : Print all answer sets of Π ∪ {← not A | A ∈ X} ∪ {← A | A ∈ Y }.
begin (X , Y ) ← E XPAND ((X, Y )) if X ∩ Y = ∅ then return if X ∪ Y = A then print X return A ← C HOOSE (A \ (X ∪ Y )) S MODELS ((X ∪ {A}, Y )) S MODELS ((X , Y ∪ {A})) end
Our approach takes advantage of this idea by relying on an encapsulated module for propagation. For sake of comparability, this is currently embodied by smodels’ expansion procedure. Unlike smodels, however, we are interested in distributing parts of the search space, as invoked by the two recursive calls in Algorithm 1. To this end, we propose a general approach, based on pioneering work in distributed tree search, that accommodates a variety of different architectures for distributing the search for answer sets over different processes and processors, respectively. Distributed tree search in ASP solvers [6,7,8] has been significantly influenced by the general-purpose backtracking package, DIB [9], the culmination of a decade of research in distributed tree search. Also, much work has been carried out in the area of parallel logic programming, among which our work is particularly analogous to or-parallelism; see [10,11] for surveys of this field. However, an important difference is that concurrent prolog implementations seek to parallelize query evaluation, whereas our goal is to distribute the search for answer sets. The latter is more closely related to distributed satisfiability checking (see e.g. [12,13]), although differing in the sense that it typically suffices for satisfiability checking to find only one satisfying assignment. An early attempt to compute answer sets in parallel was made in [14] by using the model generation theorem prover MGTP. We start by developing an iterative enhancement of Algorithm 1 that is based on an explicit representation of the search space. Whenever the system environment allows us to delegate a part of this search space, it may be transferred to another computational device. Although our early efforts have focused on smodels as the computing engine, we differ from [7] and [8] in that their design philosophy is to build distributed versions of smodels, whereas our approach (1) modularizes (and is thus independent of) the propagation engine, and (2) incorporates a flexible distribution scheme, accommodating different distribution policies and distribution architectures, for instance. Regarding 3
In fact, smodels chooses a literal, thereby dynamically deciding the order between the two calls in Line 5 and Line 6.
P LATYPUS: A Platform for Distributed Answer Set Solving
229
the latter, the current system supports a multiple process (by forking) and a multiple processor (by MPI [15]) architecture. A multi-threaded variant is currently under development. The multi-process and multi-threaded architectures can also be run on a multi-processor environment to achieve real speed-ups (compared to a one-processor environment).
2 Definitions and Notation A logic program is a finite set of rules of the form p0 ← p1 , . . . , pm , not pm+1 , . . . , not pn ,
(1)
where n ≥ m ≥ 0, and each pi (0 ≤ i ≤ n) is an atom in some alphabet A. Given a rule r as in (1), we let head (r) denote the head (set), {p0 }, of r and body + (r) = {p1 , . . . , pm } and body − (r) = {pm+1 , . . . , pn }, the sets of positive and negative body literals, respectively. Also, we allow for integrity constraints, where head (r) = ∅. The reduct, Π X , of a program Π relative to a set X of atoms is defined as Π X = {head (r) ← body + (r) | r ∈ Π, body − (r) ∩ X = ∅} . Then,4 a set X of atoms is an answer set of a program Π if X is a ⊆–minimal model of Π X . We use AS (Π) for denoting the set of all answer sets of a program Π. As an example, consider program Π, consisting of rules p ← not q, r ← p, s ← r, not t, q ← not p, r ← q, t ← r, not s.
(2)
Program Π has 4 answer sets, {p, r, s}, {p, r, t}, {q, r, s}, and {q, r, t}. Adding integrity constraint ← q, r eliminates the two last sets. For computing answer sets, we rely on partial assignments, mapping atoms in A onto true, false, or undefined. We represent such assignments as pairs (X, Y ) of sets of atoms, in which X contains all true atoms and Y all false ones. An answer set X is then represented by the total assignment (X, A \ X). In general, a partial assignment (X, Y ) aims at capturing a subset of the answer sets of a program Π, viz. AS (X,Y ) (Π) = {Z ∈ AS (Π) | X ⊆ Z, Z ∩ Y = ∅} .
3 The P LATYPUS Approach A key observation leading to our approach is that once the program along with its alphabet is fixed, the outcome of Algorithm 1 depends only on the partial assignment given as Input. As made precise in the Output field, the resulting answer sets are then uniquely determined. Moreover, partial assignments provide a straightforward way for 4
We use this definition since it easily includes integrity constraints. Note that any integrity constraint ← body (r) can be expressed as x ← body (r), not x by using a new atom x.
230
J. Gressmann et al.
partitioning the search space, as witnessed by Lines 5 and 6 in Algorithm 1. In fact, incompatible partial assignments represent different parts of the search space. For illustration, let us compute the answer sets of Program Π, given in (2). Starting with S MODELS((∅, ∅)) forces us to choose immediately among the undefined atoms in {p, q, r, s, t} because (∅, ∅) cannot be extended by E XPAND. Choosing p makes us call S MODELS first with ({p}, ∅) and then with (∅, {p}). This case-analysis partitions the search space into two subspaces, the one containing all assignments making p true and the other with all assignments making p false. Following up the first call with ({p}, ∅), the latter gets expanded to ({p, r}, {q}) before a choice must be made among {s, t}. Again, the search space becomes partitioned, and we obtain two total assignments, ({p, r, s}, {q, t}) and ({p, r, t}, {q, s}), whose first components are printed as answer sets. The two remaining answer sets are obtained analogously, but with the roles of p and q interchanged. For distributing the computation of answer sets, the idea is to decompose the search space by means of partial assignments. For instance, instead of invoking a single process via S MODELS((∅, ∅)), we may initiate two independent ones by calling S MODELS on ({p}, ∅) and (∅, {p}), possibly even on different machines. Although this static distribution of the search space results in a fair division of labor, such a balance is hardly achievable in general. To see this, consider the choice of r instead of p, resulting in calling S MODELS with ({r}, ∅) and (∅, {r}). While the former process gets to compute all 4 answer sets, the latter terminates almost immediately, since the E XPAND function yields an invalid assignment.5 In such a case a dynamic redistribution of the search space is clearly advantageous. That is, once the second process is terminated, the first one may delegate some of its remaining tasks to the second one. To this end, we propose a general approach that accommodates a variety of different modes for distributing the search for answer sets over different processes and/or processors. We start by developing an iterative enhancement of Algorithm 1 that is based on an explicit representation of the search space in terms of partial assignments. Algorithm 2 gives our generic P LATYPUS6 algorithm for distributed answer set solving. A principal goal in its design is to allow for as much generality as possible. Specific instances contain trade-offs, for example, arbitrary access to the search space versus compact spatial representations of it. Another major design goal is minimal communication in terms of message size. To this end, P LATYPUS relies on the omnipresence of the given logic program Π along with its alphabet A as global parameters. Communication is limited to passing partial assignments as representatives of parts of the search space. The only input variable S delineates the initial search space given to a specific instance of P LATYPUS. S is thus a set of partial assignments over alphabet A. Although this explicit representation offers an extremely flexible access to the search space, it must be handled with care since it grows exponentially in the worst case. Without Line 9, Algorithm 2 computes all answer sets in (X,Y )∈S AS (X,Y ) (Π), or equivalently, 5
6
This nicely illustrates that the choice of the branching atom is more crucial in a distributed setting. platypus, small densely furred aquatic monotreme of Australia and Tasmania having a broad bill and tail and webbed feet.
P LATYPUS: A Platform for Distributed Answer Set Solving
231
Algorithm 2: P LATYPUS Global Input Output 1 2 3 4 5 6 7 8 9
: A logic program Π over alphabet A. : A nonempty set S of partial assignments. : Print a subset of the answer sets of Π (cf. (3)).
repeat (X, Y ) ← C HOOSE (S ) S ← S \ {(X, Y )} (X , Y ) ← E XPAND ((X, Y )) if X ∩ Y = ∅ then if X ∪ Y = A then print X else A ← C HOOSE (A \ (X ∪ Y )) S ← S ∪ { (X ∪ {A}, Y ), (X , Y ∪ {A}) } S ← D ELEGATE (S ) until S = ∅
AS (Π ∪ {← not A | A ∈ X} ∪ {← A | A ∈ Y }) .
(3)
(X,Y )∈S
With Line 9, a subset of this set of answer sets is finally obtained (from a specific P LATYPUS instance). Clearly, depending on which parts of the search space are removed by delegation (see below), this algorithm is subject to incomplete and redundant search behaviour, unless an appropriate delegation strategy is used. A P LATYPUS instance iterates until its local search space has been processed. Before detailing the loop’s body, let us fix the formal behavior of the functions and procedures used by P LATYPUS (in order of appearance). C HOOSE: Given a set7 X, C HOOSE(X) gives some x ∈ X. E XPAND: Given a partial assignment (X, Y ), E XPAND((X, Y )) computes a partial assignment (X , Y ) such that 1. X ⊆ X and Y ⊆ Y , 2. AS (X ,Y ) (Π) = AS (X,Y ) (Π), 3. if X ∩ Y = ∅ and X ∪ Y = A, then AS (X ,Y ) (Π) = {X }, and furthermore (X , Y ) can be closed under propagation principles such as those based on well-founded semantics and contraposition [1].8 D ELEGATE: Given a set X, D ELEGATE(X) returns a subset X ⊆ X. Both functions C HOOSE and D ELEGATE are in principle non-deterministic selection functions. As usual, C HOOSE is confined to a single element, whereas D ELEGATE selects an entire subset. In sum, P LATYPUS adds two additional sources of non-determinism. While the one in Line 1 is basically a “don’t care” choice, the one in Line 9 must be handled with care since it removes assignments from the local search space. 7 8
The elements of X are arbitrary in view of Lines 1 and 7. In practice, propagation may even go beyond well-founded semantics, as for instance with smodels’s lookahead.
232
J. Gressmann et al.
The E XPAND function hosts the deterministic part of Algorithm 2; it is meant to be accomplished by an off-the-shelf system that is used as a black-box providing both sufficiently firm as well as efficient propagation operations which aim to reduce the remaining local search space resulting from choice operations. D ELEGATE permits some answer set computation tasks embodied in S to be assigned to other processes and/or processors. The assignments returned in Line 9 have not been delegated and thus remain in S . The removed assignments are either dealt with by other P LATYPUS instances or even algorithms other than P LATYPUS. The elimination of search space constituents is a delicate operation insofar as we may lose completeness or termination. For example, an implementation of D ELEGATE that does not reassign all removed constituents is incomplete. Accordingly, passing certain constituents around forever would lead to non-termination.9 For illustration, we present some concrete specifications of D ELEGATE, given in Algorithms 3 and 4. The common idea is that the system wide number of P LATYPUS Algorithm 3: D ELEGATE1 Global
: Two integers k, n indicating the current and maximum number of P LATYPUS instances. : A set S of partial assignments. : A subset of S .
Input Output begin while (k < n) ∧ (S = ∅) do (X, Y ) ← C HOOSE (S ) S ← S \ {(X, Y )} k ← k+1 distribute P LATYPUS ({(X, Y )}) return S end
Algorithm 4: D ELEGATE2 Global
: Two integers k, n indicating the current and maximum number of P LATYPUS instances. : A set S of partial assignments. : A subset of S .
Input Output begin if k < n then (S , D) ← S PLIT (S ) k ← k+1 distribute P LATYPUS (D ) return S end
instances is limited (by n). Variable k holds the current number of P LATYPUS instances. Accordingly, in this specific setting, k must be declared in Algorithm 2 as a global variable and decremented after each execution of the repeat loop. In Algorithm 3, the delegation procedure tries to maximize the global number of P LATYPUS instances. Without 9
In fact, this cannot happen in a pure P LATYPUS setting, since at least one element is removed by each P LATYPUS instance in Line 2.
P LATYPUS: A Platform for Distributed Answer Set Solving
233
external interference (a changing k), D ELEGATE1 tries to produce (n − k) new P LATYPUS instances. Each instance is created10 following one of a variety of strategies, for instance, taking into account temporal or structural criteria on the partial assignments in S as well as system-specific balance criteria. Algorithm 4 is less greedy insofar as it “removes”11 a subset from S and creates only a single new P LATYPUS instance. As with C HOOSE previously, S PLIT can be guided by various strategies, e.g. trying to share the remaining search space equally among processes/processors in order to minimize communication costs that result from delegation operations. Also, numerous mixtures of both strategies can be envisaged. Both delegation procedures guarantee completeness. To see this, it is enough to observe that every assignment and thus every part of the search space is investigated by one P LATYPUS instance in one way or another. Also, duplicate solutions are avoided by having exactly one solver investigate each part of the search space. Table 1. Three P LATYPUS instances computing the answer sets of Π2 P LATYPUS I P LATYPUS II P LATYPUS III {(∅, ∅)} 1/3 (∅, ∅) {({s}, ∅), (∅, {s})} {({s}, ∅)} {(∅, {s})} 2/3 ({s, r}, {t}) (∅, {s}) {({s, r, q}, {t}), ({s, r}, {t, q})} {({p}, {s}), (∅, {s, p})} {({s, r, q}, {t})} {({p}, {s}), (∅, {s, p})} {({s, r}, {t, q})} 3/3 ({s, r, q}, {t, p}) ({p, r, t}, {s, q}) ({s, r, p}, {t, q}) ∅ {(∅, {s, p})} ∅ {(∅, {s, p})} 1/3 ({r, t, q}, {s, p}) ∅ 0/3
k/n
To illustrate, let us compute the answer sets of the program given in (2) in an environment with at most 3 P LATYPUS instances, using the delegation procedure in Algorithm 4. The distribute procedure is used for creating new processes. Our instance of S PLIT transfers |S |/2 assignments to another P LATYPUS instance. These assignments are overlined in Table 1, while the ones chosen in Lines 1 and 7 in Algorithm 2 are underlined. The print of an answer set (in Line 5) is indicated by boldface letters. A cell in Table 1 represents an iteration in Algorithm 2. In each cell the first entry is S after Line 1, the second presents the result of the E XPAND function, and the last one is S before Line 9. Once the environment has been initialized, setting n = 3 and k = 1 among other things, the first P LATYPUS instance is invoked with {(∅, ∅)}. After the first iteration, its search space contains ({s}, ∅), while (∅, {s}) is used to create a 10 11
To be precise, MPI instances are merely reinitialized; they live throughout the computation. Given a set X, S PLIT(X) returns a partition (X1 , X2 ) of X.
234
J. Gressmann et al.
second instance of P LATYPUS. Also, variable k is incremented by D ELEGATE2 . After one more iteration, each P LATYPUS instance could potentially create yet another instance. Since the maximum number of processes is limited to 3, only one of them is able to create a new P LATYPUS instance. Once this is done k equals 3, which prevents D ELEGATE2 from creating any further processes. In our case, P LATYPUS I manages to delegate ({s, r}, {t, q}) while blocking any delegation by P LATYPUS II. The three processes output their answer sets. Whereas the first and third terminate, having emptied their search spaces, the second one iterates once more to compute the fourth and last answer set. (No delegation is initiated since |S |/2 = 1/2 = 0.)
4 The platypus Platform Current technology provides a large variety of software and hardware mechanisms for distributed computing. Among them, we find single- and multi-threaded processes, multiple processes, as well as multiple processors, sometimes combined with multiple processes and threads. The goal of the platypus platform is to provide an easy and flexible use of these architectures for ASP. To begin with, we have implemented a multiple process and a multiple processor variant of platypus. A multi-threaded variant is currently under development. To enable the generality of the approach, the platypus system is designed in a strictly modular way. The central module consists of a black-box providing the functionality of the E XPAND function. This module provides a fixed interface that permits wrapping different off-the-shelf propagation engines. A second module deals with the search space given by variable S in Algorithms 2, 3, and 4. Last but not least, distribution is handled by a dedicated control module fixing the respective implementation of the distribute operation. That is, this module controls forking, threading or MPI. With this module, each variant is equipped with a common set of distribution policies; currently all of them are realized through controllers being variations of D ELEGATE2 (cf. Algorithm 4), where S PLIT is replaced by C HOOSE. Hence, the currently implemented policies vary the strategy of the C HOOSE operation. Each policy depends upon the underlying distribution capabilities of the software and hardware architectures. The multiple process variant is implemented with the UNIX fork mechanism, which creates a child process managed by the same operating system that controls the parent process. The forking policy requires a local controller in each process to perform the delegation task. Communication among the processes is accomplished via shared memory. The forking policy provides an easily manageable framework to test design alternatives and to experiment with low-level distribution policy decisions, such as resource saturation caused by having too many processes. The multiple processor variant runs on a cluster and relies on The Message Passing Interface (MPI [15]) library to perform the distribution to a process controlled by another operating system on a distinct processor. As with forking, we rely on a local controller in each process to control the delegation task; in addition, we use a global controller to manage the processes on the separate processors and the communication among processes. To reduce the size of partial assignments and thus of passed messages, we follow [8] in storing only atoms whose truth values were assigned by a choice oper-
P LATYPUS: A Platform for Distributed Answer Set Solving
235
ation (cf. atom A in Lines 7 and 8 of Algorithm 2). Given an assignment (X, Y ) along with the subsets Xc ⊆ X and Yc ⊆ Y of atoms treated in this way, we have (X, Y ) = E XPAND ((Xc , Yc )). Accordingly, some care must be taken when implementing the tests in Lines 4 and 5. To this end, the current design foresees two signals provided by the E XPAND module. The search space module (1) must support multiple access modes for accommodating the varying choice policies in Lines 1 and 9 (or better the subsequent delegation procedures) of Algorithm 2, and (2) must be handled with care, since it may grow exponentially without appropriate restrictions. So that, at this stage of the project, we can focus on issues arising from our distribution-oriented setting, the current implementation is based on the design decision that a non-distributing platypus instance must correspond to a traditional solver, as given in Algorithm 1. This has the advantage that we obtain a “bottom-line” solver instance that we can use for comparison with state-of-the-art solvers as well as all distributed platypus instances for measuring the respective trade-offs. To this end, we restrict the search space (in S ) to a single branch of the search tree and implement the “local” choice operation in Line 1 of Algorithm 2 through a LIFO strategy. In this way, the “local” view of the search space can be realized by stack-based operations. Unlike this, the second access to the search space, described in the delegation procedures 3 and 4 is completely generic. This allows us to integrate various delegation policies (cf. Section 5). Following the above decision, our design also foresees the option of using a choice proposed by a given E XPAND module for implementing Line 7 in Algorithm 2, provided that this is supported by the underlying propagation engine. Finally, let us detail some issues of the current implementation. platypus is written in C++. Its major E XPAND module is based on the smodels API. This also allows us to take advantage of smodels’ heuristics in view of Line 7 in Algorithm 2 (see above). Accordingly, this module requires lparse for parsing logic programs. All experiments reported in Section 5 are conducted with this implementation of E X PAND . However, for guaranteeing modularity, we have also implemented other E XPAND modules, among them the one of the nomore++ system [16]. While the distribution architecture of a platypus instance must be fixed at compile time, the respective parameters, like constant n in Algorithm 3, or delegation policies, such as the kind of the delegated choice point, are set via command line options at run-time. More details are given in the experimental section.
5 Experimental Results To illustrate the feasibility of our approach, we present in Tables 2 and 3 a selection of experimental results obtained with the multi-process and the multi-processor versions of platypus. As a point of reference, we mention that on all these tests smodels is on average 1.62 times faster than the multi-process version of platypus limited to one process. Apart from platypus’ early stage of development, a certain overhead is created by “double bookkeeping” due to the strict encapsulation of the E XPAND module. In this way, we trade-off some speed for our modular design. The multi-process data were generated using the forking architecture limited to 1 to 4 active processes on a quad processor under Linux, comprised of 4 Opteron
236
J. Gressmann et al.
Table 2. Data obtained for computing all answer sets with the multi-process version of platypus platypus color-5-10 color-5-15 hamcyc-8 hamcyc-9 pigeon-7-8 pigeon-7-9 pigeon-7-10 pigeon-7-11 pigeon-7-12 pigeon-8-9 pigeon-8-10 pigeon-9-10 schur-11-5 schur-12-5 schur-13-5 schur-14-5 schur-14-4 schur-15-4 schur-16-4 schur-17-4 schur-18-4 schur-19-4 schur-20-4
-p 1 -l s 6.44 (0) 349.07 (0) 4.35 (0) 105.88 (0) 1.92 (0) 7.44 (0) 24.21 (0) 71.40 (0) 177.02 (0) 18.83 (0) 87.45 (0) 227.72 (0) 1.50 (0) 5.26 (0) 22.53 (0) 74.51 (0) 2.93 (0) 8.02 (0) 14.14 (0) 32.50 (0) 62.72 (0) 132.30 (0) 164.24 (0)
-p 2 3.54 178.70 2.61 54.59 1.60 4.49 12.86 34.93 85.71 9.99 43.23 107.14 1.15 3.09 11.78 37.80 1.88 4.54 7.64 16.92 31.23 65.99 80.70
-l s (21.1) (36.5) (30.9) (40.6) (38.5) (45.2) (49.0) (55.9) (60.5) (46.3) (49.5) (60.3) (18.1) (19.6) (20.6) (19.9) (16.4) (20.4) (24.1) (22.9) (21.8) (22.6) (26.1)
-p 3 2.55 120.24 1.94 36.73 1.33 3.35 9.04 23.73 57.53 7.09 29.22 71.14 0.82 2.23 8.07 25.60 1.52 3.23 5.28 11.50 20.77 44.02 53.61
-l s (44.7) (63.2) (55.4) (88.3) (68.5) (84.8) (99.3) (111.8) (124.2) (94.7) (112.3) (123.8) (25.4) (34.9) (37.9) (46.0) (41.9) (41.3) (43.9) (48.1) (52.8) (54.2) (60.5)
-p 4 -l s 2.12 (69.2) 91.15 (99.8) 1.66 (87.1) 28.13 (134.8) 1.22 (92.7) 2.83 (115.8) 7.24 (142.6) 18.34 (165.2) 44.04 (193.3) 5.73 (138.8) 22.33 (163.4) 53.56 (189.2) 0.71 (34.9) 1.80 (48.0) 6.22 (56.9) 19.25 (68.0) 1.17 (46.0) 2.55 (55.5) 4.13 (62.3) 8.82 (68.3) 15.75 (74.7) 33.24 (77.7) 40.09 (75.0)
2.2GHz processors with 8 GB shared RAM. The multi-processor tests ran on a cluster of 5 Pentium III 1GHz PCs under Linux with 1 GB RAM each, with 1 to 4 active nodes and one extra node serving as master.12 All of our timing results reflect the average elapsed time (in seconds) of the launching process/processor, respectively, over 20 runs, each computing all answer sets. Timing excludes parsing and printing time. Similarly, the number in parentheses indicates the average number of forks/messages passed, respectively. The first column of Tables 2 and 3 lists the benchmarks, largely taken from the benchmarking site at [17]. Columns 2 to 5 give the forking architecture results, and columns 6 to 9 contain the data obtained from the cluster using MPI. The first row provides the command line options with which platypus was invoked. The -p option indicates the maximum number of processes or processors, respectively (n in Algorithms 3 and 4). And -l stands for the delegation policy. All listed tests are run in shallow mode, delegating the smallest among all of the delegatable partial assignments available to the delegation procedure. The current system also supports a deep, middle, and random mode. Delegating small partial assignments is theoretically reasonable since they represent the putatively largest parts of the search space, thus each delegated 12
Note that the former processor type is much faster than the latter.
P LATYPUS: A Platform for Distributed Answer Set Solving
237
Table 3. Data obtained for computing all answer sets with the multi-processor version of platypus platypus -p 1 -l s -p 2 -l s -p 3 -l s -p 4 -l s color-5-10 28.18 (4) 14.57 (119.0) 9.99 (245.1) 7.74 (385.4) color-5-15 1632.91 (4) 821.83 (120.3) 549.68 (258.4) 413.75 (616.5) hamcyc-8 16.59 (4) 8.89 (146.8) 6.10 (312.4) 4.77 (454.3) hamcyc-9 407.43 (4) 202.16 (219.8) 135.96 (585.8) 102.80 (993.6) pigeon-7-8 6.37 (4) 4.01 (82.8) 3.23 (176.6) 2.87 (243.3) pigeon-7-9 25.53 (4) 13.99 (131.8) 10.18 (251.6) 8.54 (349.1) pigeon-7-10 84.28 (4) 42.92 (167.3) 30.08 (335.3) 24.01 (546.9) pigeon-7-11 238.62 (4) 117.46 (198.3) 81.07 (476.1) 62.73 (750.0) pigeon-7-12 590.83 (4) 291.03 (219.3) 197.33 (581.1) 150.43 (972.6) pigeon-8-9 62.70 (4) 32.22 (146.3) 22.71 (281.8) 18.44 (486.0) pigeon-8-10 282.19 (4) 139.72 (176.8) 95.51 (453.8) 73.75 (753.7) pigeon-9-10 695.56 (4) 341.25 (214.0) 230.35 (586.1) 175.02 (1024.1) schur-11-5 5.45 (4) 3.19 (40.5) 2.67 (83.7) 2.27 (133.6) schur-12-5 18.85 (4) 9.88 (30.3) 7.19 (81.9) 5.95 (195.6) schur-13-5 78.90 (4) 40.16 (48.5) 27.36 (104.5) 21.30 (247.5) schur-14-5 254.78 (4) 129.08 (70.5) 86.70 (106.8) 66.05 (297.1) schur-14-4 10.26 (4) 5.55 (27.5) 4.38 (112.9) 3.77 (187.2) schur-15-4 27.83 (4) 14.56 (44.5) 10.24 (102.7) 8.52 (251.3) schur-16-4 48.56 (4) 24.92 (56.3) 17.27 (122.8) 14.16 (291.6) schur-17-4 113.29 (4) 57.61 (65.8) 39.47 (164.9) 30.36 (291.3) schur-18-4 206.20 (4) 103.74 (47.5) 70.19 (172.5) 53.92 (369.6) schur-19-4 450.43 (4) 225.75 (75.3) 151.40 (226.6) 113.60 (306.2) schur-20-4 539.21 (4) 270.21 (70.0) 180.97 (237.8) 135.70 (335.9)
platypus instance will be given the largest task to perform, hence minimizing the amount of delegation. Our early experiments and similar observations reported in [8] support this view. In fact, selecting the largest assignment (via option -l d) results in much more forking/message passing and much poorer performance. For instance, using the forking architecture, we get on average for schur-20-4 with options -p 4 -l d a time of 155.43s and a count of 322 forks. The results in Tables 2 and 3 are indicative of what is expected from distributed computation. When looking at each benchmark, the forking and MPI experiments show a qualitatively consistent 2-, 3-, and 4-times speed-up when doubling, tripling, and quadrupling the number of processors, with only minor exceptions. The more substantial the benchmark, the more clear-cut the speed-up. A more global and more quantitative sense of the speed-up is provided by the sum of times13 for all benchmarks for each -p setting compared to “-p 1”. These ratios are: 1, 1.98, 2.93, 3.85, and 1, 1.99, 2.96, 3.88 for forking and MPI, respectively. With this in mind, we observe on computationally undemanding benchmarks, like hamcyc-8, pigeon-7-8, or schur-11-5 no real gain. In fact, our overall experiments show that the less substantial the benchmark, the more 13
Of course, these ratios are biased by the more substantial benchmarks, but these are the more reasonable indicators of the speed-up.
238
J. Gressmann et al.
insignificant the speed-up as the overhead caused by distribution dominates the actual search time. Similarly, the sum of messages increases from “-p 2” to “-p 3” and to “-p 4” by 2.03, 2.95, and by 2.41, 4.16, respectively for forking and MPI. To interpret the number of messages in Tables 2 and 3, the one in the forking results reflects the number of delegations, whereas the number of messages in our MPI setting include 2(n+1) start-up and shut-down messages plus 5 handshaking messages for each delegation.
6 Summary Conceptually, the P LATYPUS approach offers a general and flexible framework for managing the distributed computation of answer sets, incorporating a variety of different software and hardware architectures for distribution. The major design decisions were to minimize the number and size of the messages passed by appeal to partial assignments and to abstract from a serial ASP propagation system. The latter allows us to take advantage of efficient off-the-shelf engines, developed within the ASP community for the non-distributive case. Meanwhile, the platypus system furnishes a platform for implementing various forms of distribution. All versions of platypus share the same code, except for the control module matching the specific distribution architecture. The current system supports a multiple process architecture, using the UNIX forking mechanism, and a multiple processor architecture, running on a cluster via MPI. A multi-threaded variant is currently under development. Moreover, platypus supports different distribution policies, being open to further extensions through well-defined interfaces. Finally, the encouraging results from our experiments suggest that our generic approach to the distributed computation of answer sets offers a powerful computational enhancement to classical answer set solvers. In particular, we have seen a virtually optimal speed-up on substantial benchmarks, that is, the speed-up nearly matched the number of processes or processors, respectively. The platypus platform is freely available on the web [18]. The current system provides us with the necessary infrastructure for manifold future investigations into distributed answer set solving. This concerns the whole spectrum of different instances of the procedures C HOOSE and S PLIT, on the one side, and distribute on the other. A systematic study of different options in view of dynamic load balancing will be a major issue of future experimental research. In fact, the given set of benchmarks was chosen as a representative selection demonstrating the feasibility of our approach. In view of load balancing, it will be interesting to see how the type of benchmark (and thus the underlying search space) is related to specific distribution schemes. Also, we have so far concentrated on finding all answer sets of a given program. When extending the system for finding some answer set(s) only, the structure of the search space will become much more important. Acknowledgments. The first, fourth, and fifth authors were supported by DFG under grant SCHA 550/6-4. All but the third and last authors were also funded by the EC through IST-2001-37004 WASP project. The third and last authors were funded by NSERC (Canada) and SHARCNET. Finally, we would like to thank Christine Bailey for her contribution to the very early development of platypus.
P LATYPUS: A Platform for Distributed Answer Set Solving
239
References 1. Simons, P., Niemel¨a, I., Soininen, T.: Extending and implementing the stable model semantics. Artificial Intelligence 138 (2002) 181–234 2. Leone, N., Faber, W., Pfeifer, G., Eiter, T., Gottlob, G., Koch, C., Mateis, C., Perri, S., Scarcello, F.: The DLV system for knowledge representation and reasoning. ACM Transactions on Computational Logic (2005) To appear. 3. Davis, M., Logemann, G., Loveland, D.: A machine program for theorem-proving. Communications of the ACM 5 (1962) 394–397 4. Fitting, M.: Fixpoint semantics for logic programming: A survey. Theoretical Computer Science 278 (2002) 25–51 5. van Gelder, A., Ross, K., Schlipf, J.: The well-founded semantics for general logic programs. Journal of the ACM 38 (1991) 620–650 6. Finkel, R., Marek, V., Moore, N., Truszczynski, M.: Computing stable models in parallel. In Provetti, A., Son, T., eds.: Proceedings of AAAI Spring Symposium on Answer Set Programming, AAAI/MIT Press (2001) 72–75 7. Hirsim¨aki, T.: Distributing backtracking search trees. Technical report, Helsinki University of Technology (2001) 8. Pontelli, E., Balduccini, M., Bermudez, F.: Non-monotonic reasoning on beowulf platforms. In Dahl, V., Wadler, P., eds.: Proceedings of the Fifth International Symposium on Practical Aspects of Declarative Languages. (2003) 37–57 9. Finkel, R., Manber, U.: DIB — a distributed implementation of backtracking. ACM Transactions on Programming Languages and Systems 9 (1987) 235–256 10. Gupta, G., Pontelli, E., Ali, K., Carlsson, M., Hermenegildo, M.: Parallel execution of prolog programs: a survey. ACM Transactions on Programming Languages and Systems 23 (2001) 472–602 11. Chassin de Kergommeaux, J., Codognet, P.: Parallel logic programming systems. ACM Computing Surveys 26 (1994) 295–336 12. Zhang, H., Bonacina, M., Hsiang, J.: PSATO: a distributed propositional prover and its application to quasigroup problems. Journal of Logic and Computation 21 (1996) 543–560 13. Blochinger, W., Sinz, C., K¨uchlin, W.: Parallel propositional satisfiability checking with distributed dynamic learning. Parallel Computing 29 (2003) 969–994 14. Inoue, K., Koshimura, M., Hasegawa, R.: Embedding negation as failure into a model generation theorem prover. In Kapur, D., ed.: Proceedings of the Eleventh International Conference on Automated Deduction. Springer-Verlag (1992) 400–415 15. Gropp, W., Lusk, E., Thakur, R.: Using MPI-2: Advanced Features of the Message-Passing Interface. The MIT Press (1999) 16. (http://www.cs.uni-potsdam.de/nomore) 17. (http://asparagus.cs.uni-potsdam.de) 18. (http://www.cs.uni-potsdam.de/platypus)
Solving Hard ASP Programs Efficiently Wolfgang Faber and Francesco Ricca Department of Mathematics, University of Calabria, I-87030 Rende (CS), Italy {faber, ricca}@mat.unical.it
Abstract. Recent research on answer set programming (ASP) systems, has mainly focused on solving NP problems more efficiently. Yet, disjunctive logic programs allow for expressing every problem in the complexity classes Σ2P and Π2P . These classes are widely believed to be strictly larger than NP, and several important AI problems, like conformant and conditional planning, diagnosis and more are located in this class. In this paper we focus on improving the evaluation of Σ2P /Π2P -hard ASP programs. To this end, we define a new heuristic hDS and implement it in the (disjunctive) ASP system DLV. The definition of hDS is geared towards the peculiarites of hard programs, while it maintains the benign behaviour of the well-assessed heuristic of DLV for NP problems. We have conducted extensive experiments with the new heuristic. hDS significantly outperforms the previous heuristic of DLV on hard 2QBF problems. We also compare the DLV system (with hDS ) to the QBF solvers SSolve, Quantor, Semprop, and yQuaffle, which performed best in the QBF evaluation of 2004. The results of the comparison indicate that ASP systems currently seem to be the best choice for solving Σ2P /Π2P complete problems.
1
Introduction
Answer Set Programming (ASP) is a novel programming paradigm, which has been recently proposed in the area of nonmonotonic reasoning and logic programming. The idea of answer set programming is to represent a given computational problem by a logic program whose answer sets correspond to solutions, and then use an answer set solver to find such a solution [1]. The knowledge representation language of ASP is very expressive in a precise mathematical sense; in its general form, allowing for disjunction in rule heads and nonmonotonic negation in rule bodies, ASP can represent every problem in the complexity class Σ2P and Π2P (under brave and cautious reasoning, respectively) [2]. Thus, ASP is strictly more powerful than SAT-based programming, as it allows us to solve problems which cannot be translated to SAT in polynomial time. The high expressive power of ASP can be profitably exploited in AI, which often has to deal with
This work was supported by the European Commission under projects IST-200233570 INFOMIX, and IST-2001-37004 WASP. Funded by an APART grant of the Austrian Academy of Sciences.
C. Baral et al. (Eds.): LPNMR 2005, LNAI 3662, pp. 240–252, 2005. c Springer-Verlag Berlin Heidelberg 2005
Solving Hard ASP Programs Efficiently
241
problems of high complexity. For instance, problems in diagnosis and planning under incomplete knowledge are complete for the complexity class Σ2P or Π2P [3,4], and can be naturally encoded in ASP [5,6]. Most of the optimization work on ASP systems has focused on the efficient evaluation of non-disjunctive programs (whose power is limited to NP/co-NP), whereas the optimization of full (disjunctive) ASP programs has been treated in fewer works (e.g., in [7,8]). In particular, we are not aware of any work concerning heuristics for Σ2P /Π2P -hard ASP programs. Since the model generators of ASP systems, like DLV [9] and Smodels [10], are similar to the Davis-Putnam procedure, employed in many SAT solvers, the heuristic (branching rule) for the selection of the branching literal (i.e., the criterion determining the literal to be assumed true at a given stage of the computation) is fundamentally important for the efficiency of an ASP system. Some other systems, like ASSAT [11] or Cmodels [12] use a SAT solver directly as a black box, and thus have limited means of tuning the heuristic. Also note that all of Smodels, ASSAT, and Cmodels are confined to NP problems. Since our focus is on harder problems, we will not consider these systems further. In this paper, we address the following two questions: Can the heuristics of ASP systems be refined to deal more efficiently with Σ2P /Π2P -hard ASP programs? On hard Σ2P /Π2P problems, can ASP systems compete with other AI systems, like QBF solvers? We define a new heuristic hDS for the (disjunctive) ASP system DLV. The new heuristic aims at improving the evaluation of Σ2P /Π2P -hard ASP programs, but it is designed to maintain the benign behaviour of the well-assessed heuristic of DLV on NP problems like 3SAT and Blocks-World, on which it proved to be very effective [13]. We experimentally compare hDS against the DLV heuristic on hard 2QBF instances, generated following recent works presented in the literature that describe transition phase results for QBFs [14,15]. hDS significantly outperforms the heuristic of DLV on 2QBF. To check the competitiveness of ASP w.r.t. QBF solvers on hard problems, we carry out an experimental comparison of the DLV system (with the new heuristic hDS ) with four prominent QBF solvers, which performed best at the 2004 QBF evaluation[16,17]: SSolve, Semprop, Quantor, yQuaffle. The results of the comparison, performed on instances used in the QBF competition and on a set of randomly generated instances for the Strategic Companies problem, indicate that ASP systems currently perform better than QBF systems on Σ2P /Π2P -hard problems.
2 2.1
Answer Set Programming Language ASP Programs
A (disjunctive) rule r is a formula a1 ∨ · · · ∨ an :− b1 , · · · , bk , not bk+1 , · · · , not bm .
242
W. Faber and F. Ricca
where a1 , · · · , an , b1 , · · · , bm are atoms and n ≥ 0, m ≥ k ≥ 0. The disjunction a1 ∨· · ·∨an is the head of r, while the conjunction b1 , · · · , bk , not bk+1 , · · · , not bm is the body, b1 , · · · , bk the positive body, and not bk+1 , · · · , not bm the negative body of r. An (ASP) program P is a finite set of rules. An object (atom, rule, etc.) is called ground or propositional, if it contains no variables. 2.2
Answer Sets
Given a program P, let the Herbrand Universe UP be the set of all constants appearing in P and the Herbrand Base BP be the set of all possible ground atoms which can be constructed from the predicate symbols appearing in P with the constants of UP . Given a rule r, Ground(r) denotes the set of rules obtained by applying all possible substitutions σ from the variables in r to elements of UP . Similarly, given a program P, the ground instantiation Ground(P) of P is the set r∈P Ground(r). For every program P, we define its answer sets using its ground instantiation Ground(P) in two steps: First we define the answer sets of positive programs, then we give a reduction of general programs to positive ones and use this reduction to define answer sets of general programs. A set L of ground literals is said to be consistent if, for every atom ∈ L, its complementary literal not is not contained in L. An interpretation I for P is a consistent set of ground literals over atoms in BP .1 A ground literal is true w.r.t. I if ∈ I; is false w.r.t. I if its complementary literal is in I; is undefined w.r.t. I if it is neither true nor false w.r.t. I. Interpretation I is total if, for each atom A in BP , either A or not A is in I (i.e., no atom in BP is undefined w.r.t. I). A total interpretation M is a model for P if, for every r ∈ Ground(P), at least one literal in the head is true w.r.t. M whenever all literals in the body are true w.r.t. M . X is an answer set for a positive program P if it is minimal w.r.t. set inclusion among the models of P. Example 1. For the positive program P1 ={a ∨ b ∨ c. , :−a.}, {b, not a, not c} and {c, not a, not b} are the answer sets. For the positive program P2={a ∨ b ∨ c. , :−a. , b:−c. , c:−b.}, {b, c, not a} is the only answer set. The reduct or Gelfond-Lifschitz transform of a general ground program P w.r.t. an interpretation X is the positive ground program P X , obtained from P by (i) deleting all rules r ∈ P whose negative body is false w.r.t. X and (ii) deleting the negative body from the remaining rules. An answer set of a general program P is a model X of P such that X is an answer set of Ground(P)X . Example 2. Given the (general) program P3={a ∨ b:−c. , b:−not a, not c. , a ∨ c:−not b.} and I = {b, not a, not c}, the reduct P3I is {a ∨ b:−c., b.}. I is an answer set of P3I , and for this reason it is also an answer set of P3 . 1
We represent interpretations as set of literals, since we have to deal with partial interpretations in the next sections.
Solving Hard ASP Programs Efficiently e- d
c a
@ I @
b
(a)
c
Z 6 @ } Za I @ (b)
Fig. 1. Graphs (a) DGP4 , and
2.3
243
b (b) DGP5
Some ASP Properties
Given an interpretation I for a ground program P,we say that a ground atom A is supported in I if there exists a supporting rule r ∈ ground(P) such that the body of r is true w.r.t. I and A is the only true atom in the head of r. Proposition 1. [18,19,20] If M is an answer set of a program P, then all atoms in M are supported. Another relevant property of ASP programs is head-cycle freeness (HCF). With every ground program P, we associate a directed graph DGP = (N, E), called the dependency graph of P, in which (i) each atom of P is a node in N and (ii) there is an arc in E directed from a node a to a node b iff there is a rule r in P such that b and a appear in the head and body of r, respectively. The graph DGP singles out the dependencies of the head atoms of a rule r from the positive atoms in its body.2 Example 3. Consider the program P4 ={a ∨ b. , c:−a. , c:−b.}, and the program P5 = P4 ∪ {d ∨ e:−a. , d:−e. , e:−d, not b.}. The dependency graph DGP4 of P4 is depicted in Figure 1 (a), while the dependency graph DGP5 of P5 is depicted in Figure 1 (b). The dependency graphs allow us to single out HCF programs [21]. A program P is HCF iff there is no rule r in P such that two atoms occurring in the head of r are in the same cycle of DGP . Example 4. The dependency graphs given in Figure 1 reveal that program P4 of Example 3 is HCF and that program P5 is not HCF, as rule d ∨ e ← a contains in its head two atoms belonging to the same cycle of DGP5 . HCF programs are computationally easier than general (non-HCF) programs. Proposition 2. [21,2] 1. Deciding whether an atom belongs to some answer set of a ground HCF program P is NP-complete. 2. Deciding whether an atom belongs to some answer set of a ground (non-HCF) program P is Σ2P -complete.
3
Answer Set Computation
In this section, we describe the main steps of the computational process performed by ASP systems. We will refer particularly to the computational engine 2
Note that negative literals cause no arc in DGP .
244
W. Faber and F. Ricca
of the DLV system, which will be used for the experiments, but also other ASP systems, like Smodels, employ a very similar procedure. An answer set program P in general contains variables. The first step of a computation of an ASP system eliminates these variables, generating a ground instantiation ground(P) of P.3 The hard part of the computation is then performed on this ground ASP program generated by the instantiator. Function ModelGenerator(I: Interpretation): Boolean; begin I := DetCons(I); if I = L then return False; (* inconsistency *) if no atom is undefined in I then return IsAnswerSet(I); Select an undefined ground atom A according to a heuristic; if ModelGenerator(I ∪ {A}) then return True; else return ModelGenerator(I ∪ {not A}); end; Fig. 2. Computation of Answer Sets
The heart of the computation is performed by the Model Generator, which is sketched in Figure 2. Roughly, the Model Generator produces some “candidate” answer sets. The stability of each of them is subsequently verified by the function IsAnswerSet(I), which verifies whether the given “candidate” I is a minimal model of the program Ground(P)I obtained by applying the GL-transformation w.r.t. I and outputs the model, if so. IsAnswerSet(I) returns True if the computation should be stopped and False otherwise. The ModelGenerator function is first called with parameter I set to the empty interpretation.4 If the program P has an answer set, then the function returns True setting I to the computed answer set; otherwise it returns False. The Model Generator is similar to the Davis-Putnam procedure employed by SAT solvers. It first calls a function DetCons(), which returns the extension of I with the literals that can be deterministically inferred (or the set of all literals L upon inconsistency). This function is similar to a unit propagation procedure employed by SAT solvers, but exploits the peculiarities of ASP for making further inferences (e.g., it exploits the knowledge that every answer set is a minimal model). If DetCons does not detect any inconsistency, an atom A is selected according to a heuristic criterion and ModelGenerator is called on I ∪ {A} and on I ∪ {not A}. The atom A plays the role of a branching variable of a SAT solver. And indeed, like for SAT solvers, the selection of a “good” atom A is crucial for the performance of an ASP system. In the next section, we describe a number of heuristic criteria for the selection of such branching atoms. Remark 1. On hard ASP programs (non-hcf programs), a very large part of the computation-time may be consumed by function isAnswerSet(I), since it performs a co-NP-complete task if the program is non-hcf. 3 4
Note that ground(P) is not the full set of all syntactically constructible instances of rules in P; rather, it is a subset of it having precisely the same answer sets as P. Observe that the interpretations built during the computation are 3-valued, that is a literal can be True, False or Undefined w.r.t. to an interpretation I.s
Solving Hard ASP Programs Efficiently
4
245
Heuristics
Throughout this section, we assume that a ground ASP program P and an interpretation I have been fixed. Here, we describe the two heuristic criteria that will be compared in Section 5. We consider “dynamic heuristics” (the ASP equivalent of UP heuristics for SAT5 ), that is, branching rules where the heuristic value of a literal Q depends on the result of taking Q true and computing its consequences. Given a literal Q, ext(Q) will denote the interpretation resulting from the application of DetCons (see previous section) on I ∪ {Q}; without loss of generality, we assume that ext(Q) is consistent, otherwise Q is automatically set to false and the heuristic is not evaluated on Q at all. The Heuristic of DLV (hU T ). The heuristic employed by the DLV system was proposed in [13], where it was shown to be very effective on relevant problems like 3Satisfiability, Hamilthonian Path, Blocks World, and Strategic Companies. A peculiar property of answer sets is supportedness: For each true atom A of an answer set I, there exists a rule r of the program such that the body of r is true w.r.t. I and A is the only true atom in the head of r. Since an ASP system must eventually converge to a supported interpretation, ASP systems try to keep the interpretations “as much supported as possible” during the intermediate steps of the computation. To this end, the DLV system counts the number of UnsupportedTrue (UT) atoms, i.e., atoms which are true in the current interpretation but still miss a supporting rule (further details on UTs can be found in [22] where they are called MBTs). For instance, the rule :−not x implies that x must be true in every answer set of the program; but it does not give a “support” for x. Thus, in the DLV system x is taken true to satisfy the rule, and it is added to the set of UnsupportedTrue; it will be removed from this set once a supporting rule for x will be found (e.g., x ∨ b:−c is a supporting rule for x in the interpretation I = {x, not b, c}). Given a literal Q, let U T (Q) be the number of UT atoms in ext(Q). Moreover, let U T2 (Q) and U T3 (Q) be the number of UT atoms occurring, respectively, in the heads of exactly 2 and 3 unsatisfied rules w.r.t. ext(Q). The heuristic hU T of DLV considers U T (Q), U T2 (Q) and U T3 (Q) in a prioritized way, to favor atoms yielding interpretations with fewer U T /U T2 /U T3 atoms (which should more likely lead to a supported model). If all UT counters are equal, then the heuristic considers the total number Sat(Q) of rules which are satisfied w.r.t. ext(Q). The heuristic hU T is “balanced”, that is, the heuristic values of an atom Q depends on both the effect of taking Q and not Q. For an atom Q, let U T (Q) = U T (Q) + U T (not Q), U T2 (Q) = U T2 (Q) + U T2 (not Q), U T3 (Q) = U T3 (Q) + U T3 (not Q), and, eventually, Sat (Q) = Sat(Q) + Sat(not Q). Given two atoms A and B: 1. A U T (B); 2. otherwise, A U T2 (B); 5
The UP heuristic for SAT adds for each variable x a unit clause x and -x, respectively, and makes two independent unit propagations. The choice is then based on information thus obtained.
246
W. Faber and F. Ricca
3. otherwise, A U T3 (B); 4. otherwise, A
Solving Hard ASP Programs Efficiently
247
hU T on NP problems like 3SAT and Blocks-World, where hU T proved to be very effective [13]; while, as we will see in Section 5 it sensibly improves on hU T on hard 2QBF problems (Σ2P -complete). Given two atoms A and B: 1. A
5
Comparing hUT vs hDS : Experiments
The proposed heuristic aims at improving the performance of DLV on hard (Σ2P complete) ASP programs. While there are many experimental works benchmarking ASP systems on NP-complete problems, less is available for Σ2P -complete problems. We resort to 2QBF, the canonical problem, and one of the few Σ2P hard problems for which some transition phase results are known [14,15]. The problem here is to decide whether a quantified Boolean formula (QBF) Φ = ∃X∀Y φ, where X and Y are disjoint sets of propositional variables and φ = C1 ∨ . . . ∨ Ck is a 3DNF formula over X ∪ Y , is valid. The transformation from 2QBF to disjunctive logic programming is based on a reduction used in [23]. The propositional disjunctive logic program Pφ produced by the transformation requires 2 ∗ (|X| + |Y |) + 1 predicates (with one dedicated predicate w). Our benchmark instances were generated following recent works presented in the literature that describe transition phase results for QBFs [14,15], see [9], for a thorough discussion. In all generated instances, the number of ∀-variables in any formula is the same as the number of ∃-variables (that is, |X| = |Y |) and each disjunct contains at least two universal variables. Moreover, the number of clauses is ((|X| + |Y |)/2)0.5 . Experiments were performed on a PentiumIV 1500 MHz machine with 256MB RAM running SuSe Linux 9.0. Time measurements have been done using the time command shipped with SuSe Linux 9.0. We generated 100 random QBF instances for each problem size. The results of our experiments are displayed in Fig. 3. For each instance, we allowed a maximum time of 7200 seconds (two hours). The line of a system stops whenever 6
The denominator is increased by 1, in order to avoid possible divisions by zero.
248
W. Faber and F. Ricca hUT hDS
Maximum Execution Time [s]
Average Execution Time [s]
1000 100 10 1 0.1 0.01
0
20 40 60 80 Number of propositional variables
100
hUT hDS
1000 100 10 1 0.1 0.01
0
20 40 60 80 Number of propositional variables
100
Fig. 3. Running Times on Random QBF problems
some problem instance was not solved within this time limit. On the vertical axis, we report, respectively, the average and the maximum running time in seconds over the 100 instances of the respective size, in logarithmic scale. It is evident that the new heuristic hDS outperforms the heuristic hU T in these experiments. Heuristic hU T stopped at size 56; while heuristic hDS solved all instances up to size 92. To solve an instance of size 56, hU T took 3455.85s; while hDS required at most 5.13s and 0.12s on average for instances of this size. Heuristic hU T could not solve a 60-variables instance within 2 hours of cpu time; while hDS took at most 12.41s and 0.64s on average for solving these.
6
ASP vs QBF Solvers
One may wonder whether ASP systems are competitive with other systems on Σ2P /Π2P -hard problems. Currently it seems that QBF solvers are the most prominent (and efficient) non-ASP-systems for such problems. In order to answer this question, we carry out an experimental comparison of DLV (with the heuristic described in this paper) with QBF solvers which performed best at the 2004 QBF evaluation [16,17]: SSolve [24] (in the version used at the 2004 QBF evaluation), Semprop [25] (version v01.06.04), Quantor [26] (version 1.3pre1), and yQuaffle [27] (version 093004). We use two different sets of benchmarks, which we describe in the following sections. 6.1
QBF Evaluation
The first group of benchmarks constitute the Σ2P - and Π2P -complete QBF instances of the 2004 QBF evaluation, which we obtained from the qbflib web site [16]. These instances are of four different kinds: (1) Letz-tree, (2) Narizzanorobot, (3) Pan-Kph, and (4) hard random-instances, see [16] for details. In total, our suite contains 143 2QBF instances: 2 Letz-tree, 32 Narizzano-robot, 1 Pan-Kph, and 108 random instances. For DLV we used a standard propositional encoding as described in Sec. 5, while for the QBF systems we used directly the qDimacs format. The experiments were performed on the same machine as those of Sec. 5. For each instance, we have allowed a maximum running time of 1800 seconds (30 minutes). Again, we have limited the process size to 256MB to avoid swapping.
Solving Hard ASP Programs Efficiently
249
Table 1. Number (and percentage) of instances solved within the allowed time DLV Quantor Semprop Robot 32 (100%) 10 (31%) 17 (53%) Random 108 (100%) 14 (13%) 96 (89%) T ree 2 (100%) 2 (100%) 2 (100%) P an − Kph 1 (100%) 1 (100%) 1 (100%) T otal 143 (100%) 27 (19%) 116 (81%)
yQuaffle SSolve 21 (67%) 22 (69%) 55 (51%) 103 (95%) 2 (100%) 2 (100%) 1 (100%) 1 (100%) 79 (55%) 128 (90%)
Table 1 displays, for each system, the number and percentage of instances which have been solved under the resource limitations. Summarizing, DLV could solve all instances (100%) and is therefore clearly the best among the compared systems. Among the QBF solvers, SSolve and Semprop could solve 81% and 88% of the instances, respectively, and thus performed significantly better than both yQuaffle (55%) and Quantor (19%). It should be noted that practically all of the unsolved instances for Quantor are due to excessive memory consumption, while for the other systems they are due to time-outs. Indeed, we have tried to run Quantor on some of its unsolved instances manually: Within the first minute of CPU time (several minutes real-time due to swapping), it had typically allocated around 500MB, and after two minutes (around half an hour in real time) more than 700MB, still growing. We then aborted the test to avoid a machine lock-up. Table 2. Average time (seconds) on instances solved by QBF systems # solved solver avg DLV avg
SSolve Semprop Quantor yQuaffle 128 116 27 79 43,86 68,18 4,74 55,24 38,95 43,50 10,94 49,05
While SSolve and Semprop did significantly better on the random instances than on the ”Narizzano-robot” instances, the situation is inverse for Quantor and yQuaffle, which confirms the observations in [17]. Also when comparing the average runtime between DLV and each QBF solver (on the instances solved by the respective system), DLV usually has an edge, as Table 2 shows. The average runtime of DLV is only larger when comparing to Quantor; but given that this comparison is based only on 19% of all instances, this is rather insignificant. 6.2
Strategic Companies
The second group of benchmarks is made up of randomly generated instances for the Strategic Companies problem, as defined in [28]. We use the same DLV program and generation method as in [9]. s Here, we generated tests as in [9] with 20 instances each size for m companies (5 ≤ m ≤ 200), 3m products, 10 uniform randomly chosen contr by relations per company (up to four controlling companies), and uniform randomly chosen
250
W. Faber and F. Ricca
prod by relations (up to four producers per product). The problem is deciding whether two fixed companies (1 and 2, without loss of generality) are strategic. For the QBF solvers we have produced the following formula: ∃c1 , . . . , cn : ∀c1 , . . . , cn : ((I ∧ N E) → (R ∧ R ) ∧ c1 ∧ c2 ) where I stands for (c1→ c1 ) ∧ . . . ∧ m (cn → cn ), N E for ¬((c1 ↔ c1 ) ∧ . . . ∧ (cn ↔ cn )), R for i=1 (( cj ∈Oi cj ) → n ci ) ∧ i=1 ( gi ∈Cj cj ) (Oi contains the controlling companies of ci , while Cj contains the companies producing good j. R is defined analogous to R on the primed variables. Unfortunately this formula is not in CNF, as required by the qDimacs format. In order to avoid a substantial blowup of the formula by a trivial normalization, we have used the tool qst of the traquasto suite [29], which transforms a formula into qDimacs by introducing additional “label variables” to avoid exponential formula growth. However, these additional variables are existentially quantified at the inner level and thus would turn the formula above into a 3QBF. To avoid this, we consider the negated formula ∀c1 , . . . , cn : ∃c1 , . . . , cn : ¬((I ∧ N E) → (R ∧ R ) ∧ c1 ∧ c2 ), which stays on the second level after the transformation. 104
104 Ssolve
Ssolve Semprop Quantor DLV
10
Quantor DLV
102 101 100 10−1 10−2
0
50 100 150 Number of Companies
Maximum Execution Time [s]
Average Execution Time [s]
Semprop 3
103 102 101 100 10−1 10−2
0
50 100 150 Number of Companies
Fig. 4. Average (left) and maximum (right) timings for Strategic Companies
In the same experimental setting as before, we obtained the results of Fig. 4.7 It is evident that DLV scales significantly better than the QBF solvers (note that the vertical axis is logarithmic), and can solve all instances of up to 175 companies, while the QBF solver fail to solve instances of 40 companies.
7
Conclusion
In this paper, we have presented a new heuristic method for ASP systems, which is geared towards hard problems on the second level of the polynomial hierarchy. We have implemented this method in the state-of-the-art system DLV, and showed that it is beneficial for the performance of the system. To our knowledge, this is the first work dealing with heuristics dedicated for Σ2P /Π2P -hard ASP programs. Previous optimization techniques for this segment have been concerned with the model checking portion, which is important for this class of problems. In our work, we attack the problem earlier, in the model 7
yQuaffle is not included, as it triggered assertions on some of the input files.
Solving Hard ASP Programs Efficiently
251
generation phase, and can therefore cut on the model checks. Importantly, this heuristics has been incorporated in a way such that the benign behavior on NP/co-NP programs w.r.t. the previous heuristic of DLV is maintained. We experimentally verified that the new heuristic significantly improves the DLV system performance on randomly generated hard 2QBF instances, reducing the average execution time, enlarging the maximum solvable size of these problems for a fixed time limit. We also carried out an experimental comparison of DLV (with the heuristic described in this paper) with the best QBF solvers of the 2004 QBF evaluation [16,17]: SSolve [24], Semprop [25], Quantor [26], and yQuaffle [27]. This comparison was done on benchmark instances of the 2004 QBF evaluation, and Strategic Companies. In both cases, DLV could outperform the QBF solvers, often significantly. DLV was able to solve all the instances of the 2004 QBF evaluation within the given resource limitations, while the best QBF system solved 88%, and the worst only 19%. Also for Strategic Companies, DLV exhibited much better performance. We therefore conclude that ASP systems are currently the best choice for solving Σ2P /Π2P -complete problems. All benchmark data is available at http://www.dlvsystem.com/examples/tests-sigma2-2005.tar.gz. We note again that QBF solvers are designed for solving also harder problems than the ones considered here. Nevertheless, they are used for solving problems of this kind, especially planning problems, cf. [30]. However, from our results we have to conclude that DLV appears to be the better choice for Σ2P /Π2P -complete problems
References 1. Lifschitz, V.: Answer Set Planning. In Schreye, D.D., ed.: ICLP’99, Las Cruces, New Mexico, USA, The MIT Press (1999) 23–37 2. Eiter, T., Gottlob, G., Mannila, H.: Disjunctive Datalog. ACM TODS 22 (1997) 364–418 3. Rintanen, J.: Improvements to the Evaluation of Quantified Boolean Formulae. In Dean, T., ed.: IJCAI 1999, Sweden,(1999) 1192–1197 4. Eiter, T., Gottlob, G.: The Complexity of Logic-Based Abduction. JACM 42 (1995) 3–42 5. Baral, C.: Knowledge Representation, Reasoning and Declarative Problem Solving. CUP (2002) 6. Leone, N., Rosati, R., Scarcello, F.: Enhancing Answer Set Planning. In: IJCAI01 Workshop on Planning under Uncertainty and Incomplete Information. (2001) 33–42 7. Janhunen, T., Niemel¨ a, I., Simons, P., You, J.H.: Partiality and Disjunctions in Stable Model Semantics. In: KR 2000, 12-15,(2000) 411–419 8. Koch, C., Leone, N., Pfeifer, G.: Enhancing Disjunctive Logic Programming Systems by SAT Checkers. Artificial Intelligence 15 (2003) 177–212 9. Leone, N., Pfeifer, G., Faber, W., Eiter, T., Gottlob, G., Perri, S., Scarcello, F.: The DLV System for Knowledge Representation and Reasoning. ACM TOCL (2005) To appear.
252
W. Faber and F. Ricca
10. Simons, P., Niemel¨ a, I., Soininen, T.: Extending and Implementing the Stable Model Semantics. Artificial Intelligence 138 (2002) 181–234 11. Lin, F., Zhao, Y.: ASSAT: Computing Answer Sets of a Logic Program by SAT Solvers. In: AAAI-2002, Edmonton, Alberta, Canada, AAAI Press / MIT Press (2002) 12. Lierler, Y., Maratea, M.: Cmodels-2: SAT-based Answer Set Solver Enhanced to Non-tight Programs. In: LPNMR-7. LNCS, (2004) 346–350 13. Faber, W., Leone, N., Pfeifer, G.: Experimenting with Heuristics for Answer Set Programming. In: IJCAI 2001, Seattle, WA, USA,(2001) 635–640 14. Cadoli, M., Giovanardi, A., Schaerf, M.: Experimental Analysis of the Computational Cost of Evaluating Quantified Boolean Formulae. In: AI*IA 97. Italy, (1997) 207–218 15. Gent, I., Walsh, T.: The QSAT Phase Transition. In: AAAI. (1999) 16. Narizzano, M., Tacchella, A.: QBF Solvers Evaluation page (2002) http://www.qbflib.org/qbfeval/index.html/. 17. Berre, D.L., Simon, L., Tacchella, A.: Challenges in the QBF Arena: the SAT’03 Evaluation of QBF Solvers. In: SAT’03. Santa Margherita Ligure, Italy, (2003) 468–485 18. Marek, W., Subrahmanian, V.: The Relationship between Logic Program Semantics and Non-Monotonic Reasoning. In: ICLP’89, MIT Press (1989) 600–617 19. Leone, N., Rullo, P., Scarcello, F.: Disjunctive Stable Models: Unfounded Sets, Fixpoint Semantics and Computation. Information and Computation 135 (1997) 69–112 20. Baral, C., Gelfond, M.: Logic Programming and Knowledge Representation. JLP 19/20 (1994) 73–148 21. Ben-Eliyahu, R., Dechter, R.: Propositional Semantics for Disjunctive Logic Programs. AMAI 12 (1994) 53–87 22. Faber, W., Leone, N., Pfeifer, G.: Pushing Goal Derivation in DLP Computations. In: LPNMR’99. LNCS 1730 23. Eiter, T., Gottlob, G.: On the Computational Cost of Disjunctive Logic Programming: Propositional Case. AMAI 15 (1995) 289–323 24. Feldmann, R., Monien, B., Schamberger, S.: A Distributed Algorithm to Evaluate Quantified Boolean Formulae. In: Proceedings National Conference on AI (AAAI‘00), Austin, Texas, AAAI Press (2000) 285–290 25. Letz, R.: Lemma and Model Caching in Decision Procedures for Quantified Boolean Formulas. In: TABLEAUX 2002. Denmark, (2002) 160–175 26. Biere, A.: Resolve and Expand. (2004) SAT’04. 27. Zhang, L., Malik, S.: Towards a Symmetric Treatment of Satisfaction and Conflicts in Quantified Boolean Formula Evaluation. In: CP 2002. NY, USA, (2002) 200–215 28. Cadoli, M., Eiter, T., Gottlob, G.: Default Logic as a Query Language. IEEE TKDE 9 (1997) 448–463 29. Zolda, M.: Comparing Different Prenexing Strategies for Quantified Boolean Formulas. Master’s thesis, TU Wien (2005) 30. Castellini, C., Giunchiglia, E., Tacchella, A.: SAT-based planning in complex domains: Concurrency, constraints and nondeterminism. Artificial Intelligence 147 (2003) 85–117
Mode-Directed Fixed Point Computation Hai-Feng Guo Department of Computer Science, University of Nebraska at Omaha, Omaha, NE 68182-0500, USA [email protected]
Abstract. Goal-directed fixed point computation strategies have been widely adopted in the tabled logic programming paradigm. However, there are many situations in which a fixed point contains a large number or even infinite number of solutions. In these cases, a fixed point computation engine may not be efficient enough or feasible at all. We present a mode-declaration scheme which provides the capabilities to reduce a fixed point from a big solution set to a preferred small one, or from an infeasible infinite set to a finite one. We show the correctness of the modedeclaration scheme. One motivating application of our mode-declaration scheme is for dynamic programming, which is typically used for solving optimization problems. There is no need to define the value of an optimal solution recursively, instead, defining a general solution suffices. The optimal value as well as its corresponding concrete solution can be derived implicitly and automatically using a mode-directed fixed point computation engine. This mode-directed fixed point computation engine has been successfully implemented in a commercial Prolog system.
1
Introduction
Due to their highly declarative nature and efficiency, Tabled logic programming (TLP) systems [3,16,5,10] have been put to many innovative uses, such as model checking [9] and non-monotonic reasoning [12]. A tabled logic programming system can be thought of as an engine for efficiently computing fixed points, which is critical for many practical applications. A TLP system is essential for extending traditional LP system (e.g., Prolog) with tabled resolutions (or memorized resolutions). The main advantages of tabled resolution are that a TLP system terminates more often by computing fixed points, avoids redundant computation by memoing the computed answers, and keeps the declarative and procedural semantics consistent for pure logic programs with bounded-size terms. Example 1. Consider the following two programs defining the reachability relations. The predicate reach(X,Y) in the program (a) checks whether a node X is reachable to Y, while the predicate reach(X,Y,E) in the program (b) does the same job as well as returning a path information as an explanation. C. Baral et al. (Eds.): LPNMR 2005, LNAI 3662, pp. 253–265, 2005. c Springer-Verlag Berlin Heidelberg 2005
254
H.-F. Guo
:- table reach/2. reach(X,Y) :- reach(X,Z), arc(Z,Y). reach(X,Y) :- arc(X,Y). arc(a,b). arc(a,c). arc(b,a). :- reach(a,X).
:- table reach/3. reach(X,Y,E) :reach(X,Z,E1), arc(Z,Y,E2), append(E1,E2,E). reach(X,Y,E) :- arc(X,Y,E). arc(a,b,[(a,b)]). arc(a,c,[(a,c)]). arc(b,a,[(b,a)]). :- reach(a,X,P).
(a) Finite Solutions
(b) Infinite Solutions
The program for example 1(a), checking the existence of reachability, does not work properly in a traditional Prolog system. With the declaration of a tabled predicate reach/2 in a tabled Prolog system, it can successfully find the complete solutions due to the fixed point computation strategy. However, there are many situations in which a fixed point contains a large number or even infinite number of solutions, which in turn affects the efficiency or completion of the computation. Consider another reachability program shown in example 1(b), where append/3 is a standard predicate to append a list to another. An extra argument is added for the predicate reach/3 to collect the corresponding path. However, this extra argument results in the fixed point of the computation to be infinite and nonterminating, since there are indeed infinite number of paths from a to any node due to the cycle between a and b. Similar problems on evidence construction have been studied on justification in [11,8]. One reasonable solution is presented in [8] by asserting the first evidence into a dynamic database for each tabled answer. However, the evidence has to be organized as segments indexed by each tabled answer. That is, an extra procedure is required to construct the full evidence. To avoid such an inefficiency or nontermination problem due to a fixed point containing a large number or an infinite number of solutions respectively, it is often necessary to change the original problem to having a small finite solution set. For this reachability example, it is actually enough to find a single simple path to show the evidence of reachability. However, it is generally not only difficult to alter the predicate definition of reach/3 to avoid nontermination to have a single simple path for each pair of reachable nodes, but also sacrifices the clarity of the original relation. In these cases, a fixed point computation engine may not be efficient enough or feasible at all. In this paper, we present a mode-declaration scheme in a tabled Prolog paradigm which provides the capabilities to reduce a fixed point from a large or infinite solution set to a preferred finite one. Note that we only consider definite logic programs in this paper. The method introduces a new mode declaration for tabled predicates. The mode declaration classifies arguments of a tabled predicate as indexed or non-indexed. Each non-indexed argument can be thought of as a function value uniquely determined by indexed arguments. The mode declaration can further extend one of the non-indexed arguments to be an aggregated value, e.g., the minimum function, so that the global table will record answers
Mode-Directed Fixed Point Computation
255
with the value of that argument appropriately aggregated. Thus, in the case of the minimum function, a tabled answer can be dynamically replaced by a new one with a smaller value during the computation. Semantically, the mode declaration scheme can be characterized as a metalevel operation over the fixed point to the original program. The semantics of a tabled Prolog program is formalized based on the Herbrand model [13,7] and fixed-point theory, whereas the semantics of declared modes is defined as a strict partial order relation 1 among the solutions. The mode declaration essentially provides selection mechanism among the alternative solutions, thus making fixed point computation more flexible. We formally present the semantics of mode declaration in a tabled Prolog program, and further show the correctness of its operational semantics in a tabled resolution. The new mode-declaration scheme, coupled with recursion, provides an attractive platform for making dynamic programming simpler [6]: there is no need to define the value of an optimal solution recursively, instead, defining the value of a general solution suffices. The optimal value, as well as its associated solution, will be computed implicitly and automatically in a tabled Prolog system that uses the new mode declaration and modified variant checking. Thus, dynamic programming problems are solved more elegantly and declaratively. The rest of the paper is organized as follows: Section 2 gives a brief introduction of tabled logic programming and presents a mode declaration scheme for tabled predicates. Section 3 explains how the mode declaration affects the operational semantics of tabled logic programming. Section 4 gives a detailed demonstration of how dynamic programming can benefit from this new scheme. Section 5 presents the running performance on some dynamic programming benchmarks. Finally, section 6 gives our conclusions.
2
Mode-Directed Fixed Point Computation
2.1
Tabled Logic Programming (TLP)
Traditional logic programming systems (e.g., Prolog) use SLD resolution [7] with the following computation strategy: subgoals of a resolvent are solved from left to right and clauses that match a subgoal are applied in the textual order they appear in the program. It is well known that SLD resolution may lead to non-termination for certain programs, even though an answer may exist via the declarative semantics. That is, given any static computation strategy, one can always produce a program in which no answers can be found due to nontermination even though some answers may logically follow from the program. In case of Prolog, programs containing certain types of left-recursive clauses are examples of such programs. Tabled logic programming (TLP) [3,5,16,10] eliminates such infinite loops by extending logic programming with tabled resolution. The main idea of tabled resolution is to memorize the answers to some calls and use the memorized 1
A strict partial order relation is irreflexive and transitive.
256
H.-F. Guo
answers to resolve subsequent variant calls. Tabled resolution adopts a dynamic computation strategy while resolving subgoals in the current resolvent against matched program clauses or tabled answers. It keeps track of the nature and type of the subgoals; if the subgoal in the current resolvent is a variant of a former tabled call, tabled answers are used to resolve the subgoal; otherwise, program clauses are used following SLD resolution. TLP systems can be thought of as an engine for efficiently computing fixed points. However, there are many situations in which a fixed point contains a large number or even infinite number of solutions (for example 1(b)). In these cases, a fixed point computation engine may not be efficient enough or feasible at all. In this section, we present a mode-declaration scheme which provides the capabilities to reduce a fixed point from a big solution set to a preferred small one, or from an infeasible infinite set to a finite one. 2.2
Mode Declarations
The fixed point reduction can be achieved by a mode declaration for tabled predicates, which is described in the form of :- table q(m1 , ..., mn ). where q/n is a tabled predicate name, n ≥ 0, and each mi has one of the forms as defined in Table 1. Table 1. Built-in Modes for Tabled Predicates Modes Informal Semantics + an indexed argument − a non-indexed argument min a minimum non-indexed argument max a maximum non-indexed argument
In order to find out how modes will affect the fixed point computation, we have to get better understanding on the function of variant checking in tabled resolution. Variant checking is a crucial operation for tabled resolution as it leads to avoidance of non-termination. It is used to differentiate both tabled goals and their answers. While computing the answers to a tabled goal p with tabled resolution, if another tabled subgoal q is encountered, the decision regarding whether to consume tabled answers or to try program clauses depends on the result of variant checking. If q is a variant of p, the variant subgoal q will be resolved by unifying it with tabled answers, otherwise, traditional Prolog resolution is adopted for q. Additionally, when an answer to a tabled goal is generated, variant checking is used to check whether the generated answer is variant of an answer that is already recorded in the table. If so, the table is not changed; this step is crucial in ensuring that a fixed point is reached. The main purpose of the mode declaration is to classify the predicate arguments into two types: indexed and non-indexed. Only indexed arguments are
Mode-Directed Fixed Point Computation
257
used for variant checking during collecting answers for the table; for each tabled call, any answer generated later for the same value of the indexed arguments is discarded because it is a variant, w.r.t. the indexed arguments, of a previously tabled answer. Consider again the reachability program in Example 1(b). Suppose we declare the mode as “:- table reach(+,+,-)”; this means that only the first two arguments of the predicate reach/3 are used for variant checking during the tabled answers collection. Given the query reach(a,X,P), the answers “X=b, P=[(a,b),(b,a),(a,b)]” and “X=c, P=[(a,b),(b,a),(a,c)]”, are variant to “X=b, P=[(a,b)]” and “X=c, P=[(a,c)]” respectively. Therefore, the computation is then terminated properly with three answers, that is, each answer gives a reachable node from a as well as its explanation. The mode directive table makes it very easy and efficient to extract explanation for tabled predicates. In fact, our strategy of ignoring the explanation argument during variant checking results in only the first explanation for each tabled answer being recorded. Subsequent explanations are filtered by our modified variant checking scheme. This feature ensures that those generated explanations are concise and that cyclic explanations are guaranteed to be absent. For the reachability instance, each returned path is simple such that all arcs are distinct. Essentially, if we regard a tabled predicate as a function, then all the nonindexed arguments are uniquely defined by the instances of indexed arguments. For the previous example, the third argument of reach/3 returns a single path depending on the first two arguments. Therefore, variant checking should be done w.r.t. only indexed arguments during tabled resolution. From this viewpoint, the mode declaration makes tabled resolution more efficient and flexible. More importantly, this declaration scheme is especially useful to reduce an infinite computation model to a finite one for some practical uses, or to reduce a large finite computation model to an optimized one as shown below. 2.3
Declaration of Aggregates
The mode directive table can be further extended to associate a non-indexed argument of a tabled predicate with some optimum constraint. With the mode ‘-’, a non-indexed argument for each tabled answer only records the very first instance. This “very first” property can actually be generalized to support other preferences, e.g., the minimum value with mode min (or the maximum with mode max), in which case the global table will record answers with the value of that argument as small (or great) as possible. That is, a tabled answer can be dynamically replaced by a new one with smaller (or greater) value during the computation. Note that we only enumerate two typical aggregates as examples, other aggregates, such as sum, average, etc., can easily be extended as well. Example 2. Consider the following program searching for a shortest path, where path(X,Y,D,L) denotes a path from X to Y with the distance D and the route L.
258
H.-F. Guo :- table path(+, +, min, -). path(X, X, 0, []). path(X, Y, D, [e(X, Y)]) :- edge(X, Y, D). path(X, Y, D, [e(X, Z) | P]) :edge(X, Z, D1), path(Z, Y, D2, P), D is D1 + D2. edge(a,b,4). edge(b,a,3). edge(b,c,2). :- path(a, X, D, P).
(1) (2) (3) (4) (5) (6)
The aggregates, min and max, are specified via mode declarations as shown in Table 1. Both modes imply that the declared arguments are non-indexed. The aggregates can be used to make the specification and execution of optimization problems more elegant. For the program 2 searching for shortest paths, instead of defining the shortest path directly, we only need to specify what is the definition for a general path. Clauses (2) to (5) make up the core program defining the path relation and a directed graph with a set of edges; Clause (1) specifies the predicate path/4 to be optimized and gives the criteria how to optimize the path/4 predicate. The mode declaration path(+,+,min,-) means that only the first two arguments (pair of nodes) are used for variant checking when an answer is generated, and a minimum value (the shortest path) is expected for the third argument. Arguments with different modes are tested in the following order during variant checking of a recently generated answer: (i) the indexed argument with ‘+’ mode has the highest priority to be checked to identify whether it is a new answer. If that is the case, a new tabled entry is required to record the answer; otherwise a tabled answer with the same indexed arguments is found. (ii) This tabled answer is then compared with the recently generated one w.r.t the argument with the optimum mode ‘min’; if the new answer has a smaller value on the optimum argument, then a replacement of the tabled answer is required such that the tabled answer keeps the minimum value as expected for this argument. (iii) The last argument with mode ‘-’ will not be used for variant checking; if a replacement of a tabled answer happens, then the argument will be replaced as well; otherwise, the recently generated answer as well as its fourth argument are discarded.
3
Operational Semantics
The operational semantics of a tabled program is dependent on tabled resolution [2,16,5], which can be formalized based on the Herbrand model [13,7] and fixedpoint theory. In spite of having different tabled resolution, a tabled Prolog can be thought of as an engine for computing the least fixed points by mimicing the bottom-up computation strategy [5]. For the consideration of clarity and simplicity, we ignore any optimization used for the bottom-up computation. (e.g. incremental consumption simulating semi-naive bottom-up computation). We use the following notational conventions: P is used to denote a tabled P logic program, BP denotes the Herbrand base of P , 2B denotes the set of all Herbrand interpretations of P , and a ground instance (e.g., a ground atom, a ground instance of a clause) denotes an instance without involving any variable.
Mode-Directed Fixed Point Computation
259
Note that ω is the first infinite ordinal, and F ↑ n(x) to denote applying the n mapping F n times as F (F (· · · F (x) · · · )). Definition 1. Let P and BP be a logic program and its Herbrand base. We define a meta-level procedure TP : 2BP → 2BP . Given a Herbrand interpretation I, TP (I) performs: 1. I0 ← ∅; 2. for each ground instance A :- A1 , · · · , An of a clause in P where {A1 , · · · , An } ⊆ I, do I0 ← I0 ∪ {A}; 3. return I0 . Thus, the fixed point semantics of P can be described as TP ↑ ω(∅) [7]. We next show how mode declaration affects the fixed point semantics of a logic program. One key ingredient that the mode declaration scheme can be applicable is the optimal-substructure property 2 , that is, the optimal solution to a tabled call contains optimal solutions to its tabled sub-calls. Typical examples of such problems are those for dynamic programming. For simplicity, we assume that for any tabled predicate, there is at most one optimization mode, ‘min’ or ‘max’, in the mode declaration. For the optimization minimizing or maximizing multiple arguments, they can always be combined as one by transforming the program clauses. Additionally, we assign non-indexed modes different priorities, i.e., ‘min’ and ‘max’ have higher priorities than ‘-’. Note that a tabled predicate without explicit mode declaration has a default one with all indexed modes ‘+’. Although mode declarations are only allowed for tabled predicates, the non-tabled predicates can also be simply treated as implicitly declaring indexed modes ‘+’ for all arguments. Thus, in the rest of this subsection we will not differentiate tabled predicates from non-tabled predicates, and each predicate defined in a tabled logic program is associated with a mode declaration. Definition 2. Let q/n be a predicate with a mode declaration q(m1 , m2 , · · · , mn ) in a tabled logic program P , let mi1 , mi2 , · · · , mik (0 ≤ k ≤ n) be all the modes ‘+’ such that 1 ≤ i1 < i2 < · · · < ik ≤ n; let mj be a non-indexed mode with the highest priority if there are any non-indexed modes for q/n; we define two functions Kq/n and Oq/n as follows: given a ground atom q(a1 , a2 , · · · , an ), Kq/n (q(a1 , a2 , · · · , an )) = (ai1 , ai2 , · · · , aik ); Oq/n (q(a1 , a2 , · · · , an )) = aj , if mj exists. We say two ground atoms, t1 and t2 , of q/n comparable if and only if Kq/n (t1 ) = Kq/n (t2 ). 2
The optimal-substructure property refers to problems with optimal solutions that exhibit optimal solutions in their subproblems.
260
H.-F. Guo
The function Kq/n is used to return a sequence of indexed arguments in a left-to-right order, whereas Oq/n return a non-indexed argument with the highest priority. We say two ground atoms of q/n comparable if and only if these two atoms have the same indexed arguments. We abbreviate Kq/n and Oq/n to K and O, respectively, whenever the predicate is obvious from the context. Thus, we have a preference relation defined as follows. Definition 3. Let P be a logic program. A preference relation in P is a strict partial order relation ≺P s.t. for any two ground atoms A1 and A2 of a predicate q/n in P , A1 ≺P A2 if both of the followings are true: – K(A1 ) = K(A2 ); – cases the non-indexed mode with the highest priority in q/n of min: O(A1 )iscomparablygreaterthanO(A2 ); max: O(A1 )iscomparablylessthanO(A2 ); −: A2 is generated earlier than A1 during tabled resolution. We abbreviate ≺P to ≺ whenever the tabled logic program is obvious from the context. It has to be mentioned that the semantics of mode ‘−’ is heavily dependent on the generating order of answers, which is decided by the procedure of tabled resolution. For Example 2, the preference relation ≺ is the set { path(a, a, 7, ) ≺ path(a, a, 0, ), path(a, a, 14, ) ≺ path(a, a, 0, ), · · · path(a, b, 11, ) ≺ path(a, b, 4, ), path(a, b, 18, ) ≺ path(a, b, 4, ), · · · · · · }
where the numbers 0, 7, 11, ... are the possible distances for their corresponding pair of nodes, and ‘ ’ means any ground term from the Herbrand universe. Note that no atoms of the non-tabled predicate edge/3 are in the preference relation. That is because the non-tabled predicate has an implicit declaration having indexed modes ‘+’ for all arguments, therefore, none of their atoms can satisfy the second condition of Definition 3. Similarly, all ground atoms of non-tabled predicates are optimized according to the following definition. Definition 4. Let P be a logic program and I be one of its Herbrand interpretations; We say that A is an optimized ground atom, abbreviated as an optimized atom, in I if there does not exist any other ground atom A1 ∈ I s.t. A ≺ A1 . Definition 5. Let P and BP be a logic program and its Herbrand base. We define a meta-level procedure TP : 2BP → 2BP . Given a Herbrand interpretation I, TP (I) performs: 1. I0 ← ∅; 2. for each ground instance A :- A1 , · · · , An of a clause in P where {A1 , · · · , An } ⊆ I, do 2a. I0 ← I0 ∪ {A}; 2b. I0 ← I0 − {a1 ∈ I0 : ∃a2 ∈ I0 s.t. a1 ≺ a2 } (∗) 3. return I0 . Thus, the fixed point semantics of P can be described as TP ↑ ω(∅).
Mode-Directed Fixed Point Computation
261
Def. 5 gives the fixed point semantics for a tabled logic program with mode declaration. The statement (*) shows how non-indexed modes affect the the procedural semantics of the core program through the preference relation ≺.
Proposition 1. Let P be a tabled logic program. For any atom A ∈ TP ↑ n(∅), where n ≥ 0, A is an optimized atom in TP ↑ n(∅). Proof: This can be easily shown by a mathematical induction on n, mainly using the result of step 2b in Definition 5: I0 ← I0 − {a1 ∈ I0 : ∃a2 ∈ I0 s.t. a1 ≺ a2 }, so that any atom A in the resulting I0 is an optimized atom according to Definition 4. 2 Proposition 2. Let P be a tabled logic program. If A is an optimized atom in TP ↑ n(∅), then A ∈ TP ↑ n(∅), for any n ≥ 0. Proof: The proof is a mathematical induction on n. Base case: Consider n = 0. Since TP ↑ 0(∅) is an empty set, the proposition is vacuously true. Inductive Case: Assume that the proposition is true for some i ≥ 0. We consider an optimized atom A ∈ TP ↑ (i + 1)(∅). A is obviously an optimized atom in TP ↑ (i + 1)(∅) as well due to the fact that TP ↑ (i + 1)(∅) ⊆ TP ↑ (i + 1)(∅). Next, we complete the proof by showing A ∈ TP ↑ (i + 1)(∅). According to Definition 1, there exists a ground instance A:-A1 , ..., Am (for some m ≥ 0) of a clause in P where {A1 , ..., Am } ⊆ TP ↑ i(∅). Based on the optimal-substructure property, A1 , ..., Am must be optimized atoms in TP ↑ i(∅). Following the induc tion assumption, we have {A1 , ..., Am } ∈ TP ↑ i(∅). Therefore, A satisfies the conditions specified in Definition 5; we have A ∈ TP ↑ (i + 1)(∅). 2
Proposition 3. Let P be a tabled logic program. If A ∈ TP ↑ n(∅), then A is an optimized atom in TP ↑ n(∅), for any n ≥ 0.
Proof: We can easily get A ∈ TP ↑ n(∅) due to the fact that TP ↑ n(∅) ⊆ TP ↑ n(∅). Assume that A is an optimized atom in TP ↑ n(∅) and A ≺ A . Based on Proposition 2, we have A ∈ TP ↑ n(∅), which is a contradiction with the fact that A ∈ TP ↑ n(∅) since A ≺ A . Therefore, A must be an optimized atom in TP ↑ n(∅). 2 Thus, we have the following major result showing the correctness of our mode declaration scheme in the application of optimization problems with optimalsubstructure properties.
Theorem 4. Let P be a tabled logic program. A ∈ TP ↑ ω(∅) if and only if A is an optimized atom in TP ↑ ω(∅). Proof: According to Proposition 2 and Proposition 3.
2
The monotonic property in traditional logic programming is not present in the mode-directed fixed point computation. Adding new rules or facts to a logic
262
H.-F. Guo
program may retract obtained conclusions since the new knowledge may lead to new optimal answers for mode-directed optimization predicates. Fortunately, it is not necessary to compute the new fixed point from scratch. Instead, the meta level procedure TP in Definition 5 can continue to be applied on the obtained interpretation as well as the new knowledge, until a new fixed point is found.
4
Dynamic Programming with Modes
In the dynamic programming paradigm the value of an optimal solution is recursively defined in terms of optimal solutions to subproblems. Such dynamic programming definitions can be very tricky and error-prone to specify due to the involvement of both optimization and recursion. In this section, we presents a novel, elegant method using mode declaration that simplifies the specification of such dynamic programming solutions. We use the matrix-chain multiplication problem [4] as an example to illustrate how tabled logic programming can be adopted for solving dynamic programming problems. A product of matrices is fully parenthesized if it is either a single matrix or the product of two fully parenthesized matrix products, surrounded by parentheses. Thus, the matrix-chain multiplication problem can be stated as follows Problem 1. Given a chain A1 , A2 , ..., An of n matrices, where for i = 1, 2, ..., n, matrix Ai has dimension pi−1 × pi , fully parenthesize the product A1 A2 ...An in a way that minimizes the number of scalar multiplications. Using mode declaration for dynamic programming, the programmer is only required to define what a general solution is, while searching for the optimal solution is left to the TLP system. The mode declaration can be used to make control of execution implicit during dynamic programming, making the specification of dynamic programming problems more declarative and elegant. For the matrix-chain multiplication, instead of defining the cost of an optimal solution, we only need to specify what the cost for a general solution is. Let m[i, j] be the number of scalar multiplications needed to compute the matrix Ai..j for 1 ≤ i ≤ j ≤ n, where n is the total number of matrices. The recursive definition for the cost of parenthesizing Ai..j becomes 0 if i = j, m[i, j] = m[i, k] + m[k + 1, j] + pi−1 pk pj if i < j, where any k ∈ [i, j). Thus, we have the following program shown in Example 3. Example 3. A tabled logic program with optimum mode declaration for matrixchain multiplication problems: :- table scalar cost(+, min, -, -). scalar cost([P1, P2], 0, P1, P2). scalar cost([P1, P2, P3 | Pr], V, P1, Pn) :-
Mode-Directed Fixed Point Computation
263
break([P1, P2, P3 | Pr], PL1, PL2, Pk), scalar cost(PL1, V1, P1, Pk), scalar cost(PL2, V2, Pk, Pn), V is V1 + V2 + P1 * Pk * Pn.
The predicate scalar cost(PL, V, P0, Pn) is a tabled predicate, where PL, P0 and Pn are given by the user to represent the dimension squence [p0 , p1 , ..., pn ], the first dimension p0 and the last dimension pn , respectively, and V is the minimum cost of scalar multiplications to multiply A1..n . The mode declaration scalar cost(+,min,-,-) means that only the first argument (the list of matrix dimensions) is used for variant checking when an answer is generated, and a minimum value is expected from the second argument (the cost of scalar multiplication). Consider the problem for a chain A1 , A2 , A3 of three matrices. Suppose that the dimensions of the matrices are 10 × 100, 100 × 5, and 5 × 50, respectively. Figure 1 shows a skeleton of the recursion tree produced by the query :- scalar cost([10,100,5,50],V,10,50). Its first tabled answer has V=75000. However, when the second answer V=7500 is computed, it will automatically replace the previous answer following the declared optimum mode. Therefore, there is at most one answer for the tabled call scalar cost([10,100,5,50],V,10,50) that exists in the table at any point in time, and it represents the optimal value computed up to that point.
scalar_cost([10,100,5,50],7500,10,50)
cost=75000
scalar_cost([10,100],0,10,100)
cost=7500
scalar_cost([10,100,5],5000,10,5) scalar_cost([5,50],0,5,50)
scalar_cost([100,5,50],25000,100,50)
cost=5000 cost=25000
scalar_cost([10,100],0,10,100) scalar_cost([100,5],0,100,5) scalar_cost([100,5],0,100,5) scalar_cost([5,50],0,5,50)
Fig. 1. Recursion tree for computing scalar cost([10,100,5,50],V,10,50)
5
Experimental Results
The mode declaration scheme has been implemented in the author’s TALS [5] system, a tabled Prolog system incorporating DRA resolution on the top of the commercial ALS Prolog engine [1]. Detailed implementation details and experimental results can be found in [6]. No changes are required to the DRA resolution; therefore, the same idea can also be applied to other tabled Prolog systems. Our experimental benchmarks include five typical dynamic programming examples. matrix is the matrix-chain multiplication problem; lcs is longest
264
H.-F. Guo
common subsequence problem; obst finds an optimal binary search tree; apsp finds the shortest paths for all pairs of nodes; and knap is the knapsack problem. All tests were performed in TALS system on an Intel Pentium 4 CPU 2.0GHz machine with 512M RAM running RedHat Linux 9.0. Table 2. Running time performance comparison in Seconds(Ratio) Benchmarks without modes matrix 2.74(1.0) lcs 0.86(1.0) obst 10.58(1.0) apsp 6.05(1.0) knap 126.25(1.0)
with modes 1.97(0.72) 0.55(0.63) 0.63(0.06) 2.85(0.47) 38.56(0.31)
Table 2 compares the running time performance between the programs with and without mode declaration. The experimental data indicates, based on the ratios in Table 2, that the programs with mode declaration consume only 6% to 72% time that the corresponding programs without mode declaration do. The efficiency for those benchmarks are mainly credited to two factors. First, tabled Prolog systems with mode declaration provides a concise but easy-touse interface for dynamic programming, and it does not introduce any major overhead; the mode declaration are flexible and powerful to support meta-level manipulation of fixed points, and the mode functionality is implemented at the system level instead of the Prolog programming level. Second, tabled answers can be more efficiently organized due to the mode declaration. Indeed, variant checking is only applied for indexed arguments; if an indexed argument is instantiated in advance before a tabled goal is called, variant checking on this indexed argument can be avoided since its value is same for all the answers; furthermore, it is not necessary to record the pre-instantiated value with each tabled answer because the same value has already been stored in the tabled call entry. Those optimization leads to great running performance improvement.
6
Conclusions
A new mode declaration for tabled predicates has been presented in TLP systems to aggregate information dynamically into the table. It provides a declarative method to reduce a fixed point from a big solution set to a preferred small one, or even from an infeasible infinite set to a finite one. The mode declaration classifies arguments of tabled predicates as either indexed or non-indexed. As a result, (i) a tabled predicate can be regarded as a function in which nonindexed arguments (outputs) are uniquely defined by the indexed arguments (inputs); (ii) concise explanation for tabled answers can be easily constructed in non-indexed (output) arguments; (iii) the efficiency of tabled resolution may be
Mode-Directed Fixed Point Computation
265
improved since only indexed arguments are involved in variant checking; and (iv) the non-indexed arguments of a tabled predicate can be further qualified with an aggregate mode such that an optimal value can be sought without explicit coding of the comparison. This new mode declaration scheme, coupled with recursion, provides an elegant method for specifying dynamic programming problems: there is no need to define the value of an optimal solution recursively, instead, defining the value of a general solution is enough. The optimal value, as well as its associated solution, is obtained automatically by the TLP systems. This new scheme has been implemented in the TALS system with encouraging results.
References 1. ALS. Applied logic systems, inc., http://www.als.com. 2. W. Chen and D. S. Warren. Query evaluation under the well founded semantics. In ACM Symposium on Principles of Database Systems, pages 168–179, 1993. 3. W. Chen and D. S. Warren. Tabled evaluation with delaying for general logic programs. Journal of the ACM, 43(1):20–74, January 1996. 4. T. Cormen, C. Leiserson, and R. Rivest. Introduction to Algorithms. The MIT Press, 2001. 5. H.-F. Guo and G. Gupta. A simple scheme for implementing tabled logic programming systems based on dynamic reordering of alternatives. In Proceedings of International Conference on Logic Programming, pages 181–196, 2001. 6. H.-F. Guo and G. Gupta. Simplifying dynamic programming via tabling. In Practical Aspects of Declarative Languages, pages 163–177, 2004. 7. J. Lloyd. Foundations of Logic Programming. Springer-Verlag, 1987. 8. G. Pemmasani, H.-F. Guo, Y. Dong, C. Ramakrishnan, and I. Ramakrishnan. Online justification for tabled logic programs. In International Symposium of Functional and Logic Programming, April 2004. 9. Y. Ramakrishnan, C. Ramakrishnan, I. Ramakrishnan, S. Smolka, T. Swift, and D. Warren. Efficient model checking using tabled resolution. In Proceedings of Computer Aided Verification, pages 143–154, 1997. 10. R. Rocha, F. Silva, and V. S. Costa. On a tabling engine that can exploit orparallelism. In Proceedings of International Conference on Logic Programming, pages 43–58, 2001. 11. A. Roychoudhury, C. Ramakrishnan, and I. Ramakrishnan. Justifying proofs using memo tables. In Second International ACM SIGPLAN conference on Principles and Practice of Declarative Programming, pages 178–189, 2000. 12. T. Swift. Tabling for non-monotonic programming. Annals of Mathematics and Artificial Intelligence, 25(3-4):201–240, 1999. 13. M. van Emden and R. Kowalski. The semantics of predicate logic as a programming language. Journal of AMC, 23(4):733–742, 1976. 14. D. S. Warren. Programming in Tabled Prolog (Draft Book). www.cs.sunysb.edu/~warren. 15. XSB. http://xsb.sourceforge.net. 16. N.-F. Zhou, Y. Shen, L. Yuan, and J. You. Implementation of a linear tabling mechanism. In Proceedings of Practical Aspects of Declarative Languages, 2000.
Lookahead in Smodels Compared to Local Consistencies in CSP Jia-Huai You, Guohua Liu, Li Yan Yuan, and Curtis Onuczko Department of Computing Science, University of Alberta, Edmonton, Alberta, Canada {you, guohua, yuan, onuczko}@cs.ualberta.ca
Abstract. In answer set programming systems like Smodels and some SAT solvers, constraint propagation is carried out by a mechanism called lookahead. The question arises as what is the pruning power of lookahead, and how such pruning power fares in comparison with the consistency techniques in solving CSPs. In this paper, we study the pruning power of lookahead by relating it to local consistencies under two different encodings from CSPs to answer set programs. This leads to an understanding of how the search space is pruned in an answer set solver with lookahead for solving CSPs. On the other hand, lookahead as a general constraint propagation mechanism provides a uniform algorithm for enforcing a variety of local consistencies. We also study the impact on the search efficiency under these encodings.
1 Introduction Constraint satisfaction problems (CSPs) on the one hand and propositional satisfiability (SAT) and answer set programming (ASP) under the stable model semantics [9] on the other are two competing approaches to constraint programming. CSPs are typically solved by a systematic backtracking search algorithm, whereas at each choice point consistency of a certain kind is maintained for constraint propagation. Many SAT and answer set solvers are based on the DP procedure (the DavisPutnam-Logemann-Loveland algorithm) [4], where a main mechanism for space pruning is lookahead [8] - before a guess on a choice point is made, for each atom, if fixing the atom’s truth value leads to a contradiction, the atom gets the opposite truth value. In this way, an atom may be propagated from already assigned atoms without going through a search process. ASP has been advocated as an emerging paradigm of constraint programming for solving a variety of constraint problems, including CSPs [12]. It is therefore important to understand how the search space is pruned in solving CSPs. Such studies can potentially benefit both sides - an effective method in one approach may be adopted by another to improve the search efficiency. The relationship between the two becomes more interesting recently in light of the fact that answer set solvers have been integrated with CSP solvers [7]. One would expect more to come in combining the two in the future. C. Baral et al. (Eds.): LPNMR 2005, LNAI 3662, pp. 266–278, 2005. c Springer-Verlag Berlin Heidelberg 2005
Lookahead in Smodels Compared to Local Consistencies in CSP
267
The research direction of this paper started in [16], where it is shown that lookahead is strictly stronger than arc consistency under Niemel¨a’s encoding with an understanding of where the added pruning power comes from. In this paper, we extend our investigation in two fronts, one of which is to consider different encodings, and the other is to study how higher level local consistencies for CSPs such as i-consistency may be captured in lookahead. For the first goal we consider two familiar encodings in the SAT literature, the direct encoding and support encoding. In the direct encoding, disallowed tuples are expressed. We show that the pruning power of lookahead under the direct encoding is the same as the pruning power under Niemel¨a’s encoding where allowed tuples are expressed. The pruning power of lookahead under these two encodings is precisely that of arc consistency enhanced by propagation of unique domain values to variables [16]. However, we will see that these two complementary encodings have different inference powers if tuples of literals are tested in lookahead. For the support encoding, we show that lookahead coincides with a stronger local consistency called singleton arc consistency in the literature [2,5]. This shows that an idea similar to lookahead had been formulated independently for CSP. We also show that by testing tuples instead of individual literals, lookahead can capture higher level consistencies, such as i-consistency and singleton restricted path consistency [6]. The possibility of testing n-tuples in lookahead was briefly discussed in Simons’ thesis [14]. The work on relating CSP with SAT are relevant here. In [15] several encodings of CSP in SAT are compared. In general, unit propagation is weaker than arc consistency. Kasif [11] on the other hand shows that the support encoding of binary CSPs in SAT can have arc consistency established by unit propagation. Gent in [10] reports experiments that show the support encoding handles hard instances of random binary CSP more effectively than the direct encoding. Kasif’s work is further extended to some higher levels and wider range of local consistencies [3]. However, none of these works consider the more powerful mechanism of lookahead in SAT solvers. The next section defines terminologies for CSPs. Section 3 introduces answer set programming and the lookahead algorithm as defined in Smodels. Section 4 deals with direct encoding while Section 5 treats support encoding. Then, in Section 6 we discuss some relationships between the direct encoding and Niemel¨a’s encoding [12] from CSPs to answer set programs. In Section 7 we show some experimental results that confirm some of our theoretical findings. Section 8 provides a summary.
2 Constraint Satisfaction Problem A constraint satisfaction problem (CSP) is a triple A(X, D, C) where X = {x1 , . . . , xn } is a finite set of variables with respective domains D = {Dx1 , . . . , Dxn } listing the possible values for each variable, and C is a finite set of constraints. A constraint cy1 ,...,yk ∈ C is a subset of the Cartesian product Dy1 × ... × Dyk . We denote by A|Dx ={a} the CSP obtained by restricting the domain Dx to {a} in A. Given a CSP A(X, D, C), if a tuple (a, b) is in a binary constraint cxy , we say a is a support of b w.r.t. cxy and b is a support of a w.r.t. cxy . We say x is a neighboring variable of y, and vice versa, if there is a constraint cxy or cyx in C.
268
J.-H. You et al.
An instantiation is a variable assignment where each variable is assigned a unique value from its domain. An assignment may be partial. A partial instantiation is consistent with an n-ary constraint c ∈ C iff the assignment yields a projection of a tuple in the relation of c. A partial instantiation is consistent iff it is consistent with every constraint. A constraint cy1 ,...,yk ∈ C is satisfied iff the assignment to the variables y1 , ..., yk forms a tuple in the relation of cy1 ,...,yk . A solution to a CSP is an instantiation of all variables that satisfy all the constraints. We denote by x → a that variable x is assigned value a from its domain. Given a CSP A(X, D, C), we use n to denote the number of variables in X, e the number of constraints in C, and d the maximum domain size. In this paper we deal only with binary constraints. A CSP is i-consistent iff given any consistent instantiation of any i − 1 variables, there exists an instantiation of any ith variable such that the i values taken together satisfy all of the constraints among the i variables. The most popular degrees of consistencies are arc consistency when i = 2, and 3-consistency when i = 3 (which coincides with path consistency for binary constraints). A local consistency LC is said to be stronger than another local consistency LC’ if for any CSP in which LC holds so does LC’. Maintaining (or enforcing) arc consistency on a CSP is a domain reduction process − it removes inconsistent values from the domains of unassigned variables. This is compared with maintaining higher level consistencies where nogood tuples are identified. More recently, based on the idea of domain reduction, some additional notions of consistency for domain reduction are introduced [13,6], among which singleton arc consistency and singleton restricted path consistent are particularly interesting due to their potential in practical applications. We give their definitions below. Let A(X, D, C) be a CSP. – A is singleton arc consistent (SAC) iff ∀x ∈ X, Dx = ∅, and ∀a ∈ Dx , A|Dx ={a} can be made arc consistent with non-empty domains. – A is restricted path consistent (RPC) iff ∀x ∈ X, Dx has a non-empty arc consistent domain and, ∀a ∈ Dx and ∀y ∈ X such that a has a unique support b ∈ Dy , and ∀z ∈ X, ∃c ∈ Dz such that (a, c) ∈ cxz and (b, c) ∈ cyz .1 – A is singleton restricted path consistent (SRPC) iff ∀x ∈ X, Dx = ∅, and ∀a ∈ Dx , A|Dx ={a} can be made restricted path consistent. Intuitively, in order to enforce a certain kind of singleton consistency, one restricts each variable to each of its domain values and then enforces that consistency. If enforcing that consistency causes an empty domain, we then know the corresponding value of that variable cannot contribute to any solution and thus should be removed from its domain. One can see that the notion of singleton consistencies bears an idea similar to that of lookahead. In the latter, since we are dealing with Boolean variables, removing a value of a variable simply means to assign the variable with the opposite (truth) value. Among singleton consistencies, singleton arc consistency is the most extensively studied in the literature of CSP, due to its relatively low complexity. 1
When a constraint is not explicitly presented in C, it means all the tuples in the corresponding Cartesian product are allowed.
Lookahead in Smodels Compared to Local Consistencies in CSP
269
As singleton can be prefixed to any consistency, the next computationally realistic consistency to be considered is path consistency. From the definition of path consistency, two variables are required to be instantiated with all possible domain values to see if a conflict exists. To reduce the complexity, restricted path consistency is proposed where only the domain values that satisfy the stated condition in the definition are tested. In the literature, more complex singleton consistencies are considered to be only of theoretical interest [6].
3 Constraint Propagation in Smodels Smodels implements the stable model semantics for normal logic programs which consist of rules of the form A ← B1 , ..., Bm , not C1 , ..., not Cn ., where A, Bi and Ci are function-free atoms, and not Ci are default negations or simply called not-atoms. The head A may be the special atom ⊥, in which case it serves as a constraint. In systems like Smodels, these programs are first instantiated to ground instances for the computation of answer sets. An answer set (also called a stable model) is defined over the ground instantiation of a given program [9]. A set of atoms M is an answer set for a program P iff M is the least model of P M , where P M is defined as P M = {a ← b1 , ..., bm | a ← b1 , ..., bm , not c1 , ..., not cn ∈ P and ∀i ∈ [1..n], ci ∈ M} Additional notations: Atoms and not-atoms are both called literals. A set of literals is consistent if there is no atom φ such that φ and not φ are both in the set. Atoms(Φ) denotes the set of distinct atoms appearing in Φ (excluding the special atom ⊥). The expression not(not φ) is identified with φ, and not(φ) is not φ. Given a set of literals B, B + = {ξ | ξ is an atom in B} and B − = {ξ | not ξ ∈ B}. Suppose Q is a set of atoms. Then we define not(Q) = {not φ | φ ∈ Q}. Constraint propagation in Smodels is carried out by lookahead (cf. Figure 1 where P is a program and A a set of literals representing a partial truth value assignment). For each unassigned atom φ, lookahead assumes a truth value for it (via the function lookahead once), if that leads to a conflict, then the opposite truth value for φ is in any answer set M agreeing with A (meaning A+ ⊆ M and A− ∩ M = ∅). Truth values are propagated in lookahead by a function called expand(P, A) (cf. Figure 2), which returns a superset of A, representing the process of propagating the values of the atoms in A to some additional atoms. In lookahead once, the function conf lict(P, A) returns true if A+ ∩ A− = ∅ and false otherwise. Atleast(P, A) in the expand function returns a superset of A by repeatedly applying four propagation rules until no new literals can be deduced. Let r be a rule in program P of the form: r = h ← a1 , ..., an , not b1 , ..., not bm . Define + − minr (A) = {h | {a1 , ..., an } ⊆ A− , {b1 , ..., bm } ⊆ A } maxr (A) = {h | {a1 , ..., an } A = ∅, {b1 , ..., bm } A+ = ∅}
270
J.-H. You et al.
F unction lookahead(P, A) repeat A := A A := lookahead once(P, A) until A = A return A.
F unction lookahead once(P, A) B := Atoms(P ) − Atoms(A) B := B not (B) while B = ∅ do take any literal χ ∈ B A := expand(P, A {χ}) B := B − A if conf lict(P, A ) then return expand(P, A {not (χ)}) end while return A.
Fig. 1. Function lookahead(P, A)
F unction expand(P, A) repeat A := A A := Atleast(P, A) A := A {not φ | φ ∈ Atoms(P ) and φ ∈ Atmost(P, A)} until A = A return A. Fig. 2. Function expand(P, A)
The four propagation rules in Atleast(P, A) are:
1. If r ∈ P , then A := A minr (A). 2. If there is an atom a such that for all r ∈ P , a ∈ / maxr (A), then A := A {not a}. 3. If an atom a ∈ A, there is only one r ∈ P for which a ∈ max r (A), and there is a literal x such that a ∈ / maxr (A {x}), then A := A {not(x)}. 4. If not a ∈ A and there is a literal x s.t. for some r ∈ P , a ∈ minr (A {x}), then A := A {not(x)}.
Rule 1 adds the head of a rule to A if the body is true in A. If there is no rule with a as the head whose body is not false w.r.t. A, then a cannot be in any answer set agreeing with A. This is Rule 2. Rule 3 says that if a ∈ A, the only rule with a as the head whose body is not yet false must have its body true in extending A. Rule 4 forces the body of a rule to be false if the head is false in A. The function Atmost(P, A) is of little relevance here, since the answer set programs that encode CSPs in this paper do not have “positive loops”. For these programs, it can be shown that the expand function behaves as if the fifth line in the definition were removed.
4 Constraint Propagation Under Direct Encoding The direct encoding of a CSP by an answer set program consists of two parts. The first part specifies the uniqueness property - a variable in CSP is assigned exactly one value
Lookahead in Smodels Compared to Local Consistencies in CSP
271
from its domain. For each variable x ∈ X and its domain Dx = {a1 , ..., ad }, we use an atom x(aj ) to represent that x gets the value aj ∈ Dx . Then, for each j ∈ [1..d] we have a rule x(aj ) ← not x(a1 ), ..., not x(aj−1 ), not x(aj+1 ), ..., not x(ad ).
(1)
These rules will be referred to as the uniqueness encoding. In the second part, disallowed tuples in constraints are expressed. For each constraint cxy ∈ C, and for each tuple (a, b) ∈ cxy , where a ∈ Dx and b ∈ Dy , we have a rule of denial ⊥ ← x(a), y(b).
(2)
The direct encoding of a CSP A is denoted Pdir (A). The correctness of the direct encoding is obvious. For the complexity, for any CSP A, it can be verified that O(nd2 + ed2 ) bounds the size of Pdir (A). 4.1 Propagation Arc Consistency Given a CSP A(X, D, C) and a collection Π of pairs x → a, unique value propagation is an operation that generates an extension of Π, which is Π ∪ {x → a | cxy ∈ C or cyx ∈ C, and y → b ∈ Π such that a is the only value in Dx consistent with b} A collection of pairs Π is closed under (unique value) propagation if it cannot be extended further by unique value propagation. Π is said to be in conflict (or conflicting) if there are distinct values a and a such that for some variable x, x → a, x → a ∈ Π, otherwise it is non-conflicting. Definition 1. A CSP A(X, D, C) is propagation arc consistent (PAC) iff it is arc consistent, and ∀x ∈ X and ∀a ∈ Dx , the closure of {x → a} under unique value propagation is non-conflicting. It is clear from the definition that PAC is stronger than arc consistency (AC). Example 1. Consider a CSP with three variables x, y, and z, all with the domain {0, 1}, and the following constraints: cxy = {(0, 0), (1, 1)}
cyz = {(0, 1), (1, 0)}
czx = {(0, 0), (1, 1)}
It is clear that this CSP is arc consistent. However, it is not PAC since {x → 0} leads to a conflict under unique value propagation. In the direct encoding of this CSP, besides the uniqueness encoding, the disallowed tuples are expressed by the following rules: ⊥ ← x(0), y(1). ⊥ ← x(1), y(0).
⊥ ← y(0), z(0). ⊥ ← y(1), z(1).
⊥ ← z(0), x(1). ⊥ ← z(1), x(0).
Now, we have not x(0) ∈ lookahead(Pdir (A), {not ⊥}), corresponding to 0 being removed from its domain in CSP. This is obtained by assuming x(0), and then by applying the expand function to infer not y(1), y(0), not z(0), z(1), and not x(0), resulting in a conflict.
272
J.-H. You et al.
Under the direct encoding, the pruning power of lookahead is precisely that of PAC. Theorem 1. Let A(X, D, C) be a CSP. A value a is removed from its domain Dx by maintaining PAC on A iff not x(a) ∈ lookahead(Pdir (A), {not ⊥}). A proof of this theorem is relatively routine but can be lengthy. Roughly, we note that it is known that the result of lookahead is independent of the order in which literals are picked up in lookahead once [16]. Thus, we only need to show that for any values a1 , ..., ak that are removed from Dx1 , ..., Dxk , perspectively, in enforcing PAC, lookahead(Pdir (A), {not ⊥}) infers not x1 (a1 ), ..., not xk (ak ), in the same order (and vice versa). Since the effect of value removals is incremental, we can apply a simple induction on k to show that if in lookahead once xi (ai ) is picked up, the expand function generates a conflict, assuming all not x1 (a1 ), ..., not xk (ai−1 ) have already been added by lookahead. 4.2 Extension to i-Consistency Though strictly stronger than AC, it is not a surprise that PAC in general is not as powerful as higher level consistencies. Example 2. Consider a CSP with three variables x, y, and z, all with the domain {0, 1, 2, 3}, and three constraints cxy = {(0, 0), (0, 1), (1, 2), (1, 3), (2, 0), (2, 1), (3, 2), (3, 3)} cxz = {(0, 0), (0, 1), (1, 2), (1, 3), (2, 0), (2, 1), (3, 2), (3, 3)} czy = {(0, 2), (1, 3), (2, 0), (3, 1), (1, 2), (0, 3), (3, 0), (2, 1)} This CSP is not path consistent: for any pair (ai , aj ) ∈ cxy there exists no value ak ∈ Dz such that (ai , ak ) ∈ cxz and (ak , aj ) ∈ czy . However, this CSP is arc consistent. One can also check that for this CSP there is no possibility of unique value propagation. Therefore, it is PAC. Lookahead may be extended to test tuples of literals instead of single literals [14]. Here we show that i-consistency can be captured by testing (i − 1)-tuples. Theorem 2. Let A(X, D, C) be a CSP. For any 1 < i ≤ |X|, let {y1 , ..., yi−1 } be any i − 1 variables in X and yi be any ith variable. For any consistent instantiation Π = {y1 → b1 , ..., yi−1 → bi−1 }, if yi has no instantiation consistent with Π, then a conflict will be generated in expand(Pdir (A), {not ⊥, y1 (b1 ), ..., yi−1 (bi−1 )}). Note that although this theorem is not stated directly using lookahead, it is clear that what it states is that any inconsistency in enforcing i-consistency can be detected by testing the corresponding (i − 1)-tuple by lookahead. This implies that if lookahead tests all (i − 1)-tuples, and the result of lookahead in such testing is independent of any order in which these tuples are tested, then i-consistency is enforced. Proof. That there is no instantiation of yi that is consistent with Π implies that for any v ∈ Dyi , there exists yj ∈ {y1 , ..., yi−1 }, such that bj ∈ Dyj is inconsistent with v.
Lookahead in Smodels Compared to Local Consistencies in CSP
273
Thus, in Pdir (A) there must be a rule of denial ⊥ ← yj (bj ), yi (v). Since yj (bj ) is in the input set, not yi (v) can be inferred by Rule 4 of the Atleast function. Since this is the case for any v ∈ Dyi , a conflict will be generated by the uniqueness encoding in Pdir (A).
5 Constraint Propagation Under Support Encoding The support encoding of a CSP by an answer set program consists of two parts. The first part is the uniqueness encoding, the same as in the direct encoding. The difference lies in the second part: for each constraint cxy ∈ C and for each value a ∈ Dx , let {b1 , ...bk } be the set of the supports for a w.r.t. cxy , the support rule for a w.r.t. cxy is ⊥ ← x(a), not y(b1 ), ..., not y(bk ).
(3)
Similarly, for each value b in Dy , let {a1 , ...ak } be the set of the supports for b w.r.t. cxy , the support rule for b w.r.t. cxy is ⊥ ← y(b), not x(a1 ), ..., not x(ak ).
(4)
The support encoding of a CSP A is denoted Psup (A). Example 3. Let a CSP have two variables x and y with domains Dx = Dy = {0, 1}, and a constraint cxy = {(0, 0), (0, 1), (1, 0)}. The support rules for cxy are: ⊥ ← x(0), not y(0), not y(1). ⊥ ← x(1), not y(0).
⊥ ← y(0), not x(0), not x(1). ⊥ ← y(1), not x(0).
It can be seen that the size of the resulting program by support encoding remains to be bounded by O(nd2 +ed2 ). Again, the correctness of the support encoding is obvious. Our goal in this section is to show that, under the support encoding, lookahead coincides with singleton arc consistency (SAC). First, we should place this result in a context, namely the fact that SAC is strictly stronger than propagation arc consistency (PAC) introduced in the last section. It is easy to see that whenever unique value propagation is possible, enforcing AC will carry it out. Thus, SAC is stronger than PAC. Example 4 below shows a CSP which is PAC but not SAC. Example 4. Consider a CSP with three variables all with domain Dx = Dy = Dz = {0, 1, 2, 3}, and three constraints cxy = {(0, 0), (0, 1), (1, 0), (1, 1), (2, 2), (2, 3), (3, 2), (3, 3)} cyz = {(0, 0), (0, 1), (1, 0), (1, 1), (2, 2), (2, 3), (3, 2), (3, 3)} czx = {(0, 2), (0, 3), (1, 2), (1, 3), (2, 0), (2, 1), (3, 0), (3, 1)} This CSP is arc consistent, and there is no unique value propagation; hence it is PAC. But it is not SAC. Suppose we restrict Dx to {0}. Enforcing AC removes 2 and 3 from Dy as well as from Dz , resulting in 0 being removed from Dx . We therefore have Theorem 3. SAC is strictly stronger than PAC. Now, let us use the following example to explain the main technical result of this section.
274
J.-H. You et al.
Example 5. Consider a CSP A with three variables all with domain {0, 1}, and three constraints: cxy = {(0, 0), (0, 1), (1, 1)}
cyz = {(0, 0), (1, 1)}
czx = {(0, 1), (1, 0)}
Enforcing arc consistency on A|Dx ={1} will eventually remove 1 from Dx . On the other hand, we have not x(1) ∈ lookahead(Psup (A), {not ⊥}). The following lemma is essential in proving the main result. Lemma 1. Let A(X, D, C) be a CSP. For any value a ∈ Dx , a is removed by enforcing arc consistency iff not x(a) ∈ Atleast(Psup (A), {not ⊥}). The lemma can be proved by an induction on the sequence of value removals. For the base case, for any constraint cxy , if a value a ∈ Dx does not have a support in Dy , the corresponding support rule in Psup (A) is ⊥ ← x(a). By Rule 4 of Atleast we infer not x(a). For the inductive step, suppose a value a in Dx is removed because all of its supports in Dy have already been removed. Then, the corresponding rule in Psup (A) is ⊥ ← x(a), not y(b1 ), ..., not y(bk ). Again by Rule 4 of the Atleast function, because all not y(bi ), i ∈ [1..k] are already inferred, we must have not x(a). The argument for the other direction is similar. This lemma leads to the following theorem. Theorem 4. Let A(X, D, C) be a CSP. A value a is removed from its domain Dx by maintaining SAC on A iff not x(a) ∈ lookahead(Psup (A), {not ⊥}). We can further show that by testing pairs of literals, lookahead captures singleton restricted path consistency (SRPC). Theorem 5. Let A(X, D, C) be a CSP. For any constraint cxy ∈ C, if a pair (a, b) ∈ cxy is identified as nogood by maintaining RPC on A|Dz ={v} , then either expand(Psup (A), {not ⊥, z(v), x(a)}) or expand(Psup (A), {not ⊥, z(v), y(b)}) generates a conflict. Note that, in enforcing SRPC, inconsistencies are detected by fixing three values, one for domain restriction and the other two for testing a path. Since one of the latter two is a unique support of the other, it can be propagated in the Atleast function. This is why lookahead only needs to test two values.
6 Relationships Niemel¨a proposes to encode a CSP by representing allowed tuples [12]. The resulting program consists of the uniqueness encoding and the rules for allowed tuples: for each constraint cxy , and each pair (a, b) ∈ cxy , we have sat(cxy ) ← x(a), y(b).
(5)
Lookahead in Smodels Compared to Local Consistencies in CSP
275
where sat(cxy ) is a new atom. We then ask an answer set generator to compute the answer sets that contain all sat(cxy ) where cxy ∈ C. It is shown in [16] that under Niemel¨a’s encoding lookahead coincides with PAC. However, the following example shows that Theorem 2 does not hold under Niemel¨a’s encoding, illustrating that these two complementary encodings behave differently when testing tuples of literals. Example 6. Given three variables and their domains Dx = Dy = {0} and Dz = {0, 1, 2, 3}, and three constraints cxy = {(0, 0)} cxz = {(0, 0), (0, 1)} cyz = {(0, 2), (0, 3)} {x → 0, y → 0} cannot be consistently extended to z. Under the direct encoding, we have rules of denial as follows ⊥ ← x(0), z(2).
⊥ ← x(0), z(3).
⊥ ← y(0), z(0).
⊥ ← y(0), z(1).
When we test the pair x(0), y(0), we derive not z(0), not z(1), not z(2), and not z(3), from which conflicts are derived by the uniqueness encoding. However, one can check that no conflict can be derived by the expand function under Niemel¨a’s encoding. The rules for allowed tuples in Niemel¨a’s encoding are: sat(cxy ) ← x(0), y(0). sat(cxz ) ← x(0), z(0). sat(cyz ) ← y(0), z(2).
sat(cxz ) ← x(0), z(1). sat(cyz ) ← y(0), z(3).
When we test the pair x(0), y(0), for sat(cxz ) to be true one of the literals in {z(0), z(1)} must be true; for sat(cyz ) to be true one of the literals in {z(2), z(3)} must be true. But their intersection is empty. To arrive at the conclusion of conflict, one has to reason disjunctively along with the uniqueness encoding. But the expand function of Smodels does not perform this type of reasoning.
7 Experiments The experiments were designed to test the following: the difference in performance of the direct and support encodings from CSP to ASP. We ran the direct encoding and support encoding on a wide range of problems varying the number of variables, the size of the domains, the number of constraints and the number of no-goods. We found that problems with approximately 10 variables are best for testing, as increasing the number of variables can significantly extend the running time of the program for the more complex problems. We then tested with various domain sizes and made the number of constraints range from 5 to 45. The number of no-good values as a percentage of the constraints is called the tightness, which in our experiments ranged from 5% to 95%. When measuring the running time of the ASP programs, we only report the time required to run Smodels and omit the time required to ground the problem through lparse. We do this because it is possible to directly translate from the CSP instance to a
276
J.-H. You et al.
grounded instance without having to use a grounding program. All times were recorded using the time command in Linux, and recording the user CPU time. All experiments were performed by generating random CSP instances using the generator found at [1]. All results reported were performed on an Intel Pentium 4 2.00 Ghz machine with 512 Mb of RAM running Slackware Linux 10.0.
Fig. 3. Run time vs. tightness
Figure 3 shows the running time (in seconds) of Smodels plotted against the tightness of the problems. The tests were performed on problems with 10 variables, a domain size of 30, and 20 constraints. Each point on the graph represents the average running time of 10 random instances. The direct encoding begins by having a better running time than the support encoding, but is quickly outdone by the support encoding as the tightness of the problems increase. This is especially apparent as the problem set is about to enter its phase transition; the support encoding is greatly outperforming direct encoding. It is worth noting that Gent performed similar tests between the direct and support encoding of CSP to SAT, using Chaff which does not employ the lookahead mechanism. In his tests a similar shape to the graph was reported. This indicates that the support encoding has a similar improvement in running time over the direct encoding in both the SAT and ASP encodings, with or without lookahead. We also decided to measure the amount of searching that both the direct and support encodings must do in order to arrive at a solution. This is measured in Smodels via the number of picked atoms reported. This number represents the number of atoms that the
Lookahead in Smodels Compared to Local Consistencies in CSP
277
lookahead function must pick a value for and then test to see if any conflicts occur. It is a good (though implicit) measure of the amount of search that occurs.
Fig. 4. Picked atoms vs. tightness
Figure 4 shows the number of picked atoms plotted against the tightness of the problem set. The problem set is identical to the one used for figure 3. For lower values of tightness, the number of picked atoms is almost identical in both the direct and support encoding. Similar to Figure 3, as the problem set begins to enter its phase transition, the number of picked atoms between the two encodings begins to diverge. The support encoding clearly picks less atoms as the problem set becomes tighter.
8 Conclusion We summarize below the main findings reported in this paper. (1) Lookahead has the same pruning power under the direct encoding as well as under Niemel¨a’s encoding (Theorem 1 and [16]). (2) When testing (i − 1)-tuples, lookahead captures i-consistency under the direct encoding (Theorem 2). (3) Under the support encoding, lookahead coincides with SAC (Theorem 4). (4) Lookahead performs more effectively under the support encoding than under the direct encoding (Theorems 1, 4 and 3). Experimentally, the former shows a substantial improvement in running time than the latter on hard random binary CSPs.
278
J.-H. You et al.
(5) When testing pairs of literals, lookahead captures singleton restricted path consistency under the support encoding (Theorem 5). (6) Lookahead provides an uniform algorithm for maintaining local consistencies of various kinds, in particular enforcing both SAC and PAC is of the complexity O(n3 d4 + en2 d4 ). This is because the number of atoms in these encodings is nd, lookahead may be called at most O(n2 d2 ) times, and each time expand takes time linear in the size of the program (which is bounded by O(nd2 + ed2 )). It is interesting to see that this complexity is comparable to that of the algorithm specifically designed for SAC in [5]. Acknowledgment: We thank the referees for their comments, which have been useful in improving the presentation of the paper.
References 1. C. Bessi`ere. Uniform random binary csp generator. Retrieved December 19, 2004, Website www.lirmm.fr/∼bessiere/generator.html. 2. C. Bessi`ere and R. Debruyne. Theoretical analysis of singleton arc consistency. In Proc. ECAI’04 Workshop on Modeling and Solving Problems with Constraints, pages 20–29, 2004. 3. C. Bessi`ere, E. Hebrard, and T. Walsh. Local consistencies in SAT. In Proc. Int’l Conf. on Theory and Applications of Satisfiability Testing, pages 400–407, 2003. 4. M. Davis, G. Logemann, and D. Loveland. A machine program for theorem proving. Communications of the ACM, 5(7):394–397, July 1962. 5. R. Debruyne and C. Bessi`ere. Some practical filtering techniques. In Proc. IJCAI’97, pages 412–417, 1997. 6. R. Debruyne and C. Bessi`ere. Domain filtering consistencies. J. Artificial Intelligence Research, 14:205–230, 2001. 7. Islam Elkabani, Enrico Pontelli, and Tran Cao Son. Smodels with CLP and its applications: a simple and effective approach to aggregates in ASP. In Proc. ICLP’04, pages 73–89, 2004. 8. J.W. Freeman. Improvements to propositional satisfiability search algorithms. PhD thesis, Department of Computer and Information Science, University of Pennsylvania, 1995. 9. M. Gelfond and V. Lifschitz. The stable model semantics for logic programming. In Proc. 5th ICLP, pages 1070–1080. MIT Press, 1988. 10. Ian Gent. Arc consistency in SAT. In Proc. ECAI 2003, pages 121–125, 2002. 11. S. Kasif. On the parallel complexity of discrete relaxation in constraint satisfaction networks. Artificial Intelligence, pages 275–286, 1990. 12. I. Niemel¨a. Logic programs with stable model semantics as a constraint programming paradigm. Annals of Math. and Artificial Intelligence, 25(3-4):241–273, 1999. 13. P. Prosser, K. Stergiou, and T. Walsh. Singleton consistencies. In Proc. CP’00, pages 353– 368, 2000. 14. P. Simons. Extending and Implementing the Stable Model Semantics. PhD thesis, Helsinki University of Technology, Helsinki, Finland, 2000. 15. T. Walsh. CSP vs. SAT. In Proc. Principles and Practice of Constraint Programming, pages 441–456, 2000. 16. J. You and G. Hou. Arc consistency + unit propagation = lookahead. In Proc. ICLP’04, pages 314–328, 2004.
Nested Epistemic Logic Programs Kewen Wang1 and Yan Zhang2 1
2
Griffith University, Australia [email protected] University of Western Sydney, Australia [email protected]
Abstract. Nested logic programs and epistemic logic programs are two important extensions of answer set programming. However, the relationship between these two formalisms is rarely explored. In this paper we first introduce the epistemic HT-logic, and then propose a more general extension of logic programs called nested epistemic logic programs. The semantics of this extension - named equilibrium views - is defined on the basis of the epistemic HT-logic. We prove that equilibrium view semantics extends both the answer sets of nested logic programs and the world views of epistemic logic programs. Therefore, our work establishes a unifying framework for both nested logic programs and epistemic logic programs. Furthermore, we also provide a characterization of the strong equivalence of two nested epistemic logic programs.
1
Introduction
Answer set programming (ASP) [6] was developed in the late of 1990s and has been widely recognized as a promising tool for effective knowledge representation and declarative problem solving [1]. ASP is based on the answer set semantics of logic programs introduced by Gelfond and Lifschitz [4,5]. The formal systems for ASP may have different features such as default negation, explicit negation, disjunction and preference. Normal, general, extended and disjunctive logic programs are among the major ASP formalisms. As many researchers (including [3,8]) have noticed, the languages of logic programming are still insufficient in representing commonsense knowledge. Recently answer set semantics has been extended to nested logic programs [8], in which arbitrarily nested formulas are allowed. On the other hand, ASP is also expanded to epistemic logic programs by Gelfond [3], where belief operators can be explicitly presented so that incomplete information may be correctly represented in the extent of multiple belief sets. The semantics of epistemic logic programs is defined as the collection of its world views, which are generalizations of the answer sets for logic programs without nested expressions. Having examined the syntax and semantics of nested logic programs and epistemic logic programs, people may observe an important fact: Although the world view semantics of epistemic logic programs generalizes the answer set semantics for disjunctive (extended) logic programs, it, however, cannot be used as the semantics for the epistemic logic programs with nested expressions containing belief operators. Hence, the following two problems remain open: C. Baral et al. (Eds.): LPNMR 2005, LNAI 3662, pp. 279–290, 2005. c Springer-Verlag Berlin Heidelberg 2005
280
K. Wang and Y. Zhang
1. As two extensions of ASP, can nested logic programs and epistemic logic programs be unified in one common language? 2. Can nested expressions of formulas with belief operators be allowed in both the head and body of rules in an epistemic logic program? We observe that existing nonmonotonic epistemic logics, such as [9], do not provide direct solutions to the above problems. As it will be illustrated in the following, since the world view semantics is defined based on a transformation from epistemic logic programs to disjunctive logic programs by eliminating the belief operators in the body of rules, it is not feasible to simply allow belief operators to occur in the head of rules in an epistemic logic program. Hence, it seems to be inevitable to develop a new approach to solve these problems instead of seeking for a straightforward extension of Gelfond’s world view semantics. This paper aims to solve these problems in a unified manner. In particular, we first introduce a new logic called epistemic equilibrium HT-logic. This logic is a natural integration of the equilibrium HT-logic [10,11] and modal logic. Based on this logic, we then specify a more general extension of logic programs called nested epistemic logic programs (NELPs). The semantics of this extension - named equilibrium views - is defined on the basis of the epistemic HT-logic. We prove that equilibrium view semantics extends both the answer sets of nested logic programs and the world views of epistemic logic programs. Therefore, our work establishes a unifying framework for both nested logic programs and epistemic logic programs. Furthermore, we also provide a characterization of the strong equivalence of two nested epistemic logic programs.The main results of this paper are summarized as follows: 1. Equilibrium view semantics extends the answer set semantics of nested logic programs; 2. Equilibrium view semantics extends the world view semantics of epistemic logic programs; 3. Two nested epistemic logic programs are strong equivalent if and only if they are equivalent in the epistemic HT-logic. The rest of this paper is organized as follows. Section 2 proposes a new logic called epistemic HT logic and defines its semantics. Section 3 presents a new logic programming language (i.e. nested epistemic logic programs) which extends both the nested logic programs and epistemic logic programs. Section 4 proves two major results to show that the equilibrium view semantics generalizes both the answer set semantics for nested logic programs and the world view semantics for epistemic logic programs. Section 5 further proves a result about the strong equivalence of nested epistemic logic programs. Section 6 discusses how to add the second negation into the new class of programs. Finally, section 7 concludes the paper with some discussions.
2 Epistemic HT-Logic and Equilibrium Models 2.1 Syntax and Semantics The language of our epistemic HT-logic will be the modal language which extends the classical propositional language by means of two belief operators K and M . We
Nested Epistemic Logic Programs
281
consider classical propositional formulas built from propositional atoms and the 0-place connective ⊥ (“false”) using the binary connectives ∨, ∧ and →. We use for ⊥ ← ⊥, and ¬F for F → ⊥ where F is a formula. Modal formulas are obtained by addition of the following clauses to the usual inductive definition of propositional formulas: – If F is a formula, then KF is a formula; – If F is a formula, then M F is a formula. KF is read as “F is known to be true” and M F is read as “F may be believed to be true”. If a is an atom in the classical propositional logic, then an objective literal is either a or ¬a, and both Kb and M b are called subjective literals for any objective literal b. Similarly, F is a subjective formula if F contains at least one belief operator. An epistemic theory is a (finite) set of formulas in the language of epistemic HT-logic. The HT-logic (i.e. the logic of here-and-there) is also known as “the logic of present and future”, which is basically a three-valued logic. Pearce first used this logic to characterize the answer set semantics of logic programs [11]. More recently, Lifschitz, Pearce and Valverde characterize the strong equivalence of logic programs through the HT-logic [7]. In the following we extend the semantics of the HT logic to the epistemic HT-logic. So in our logic, we will have two tenses (H and T ) and two belief operators (K and F ). Let A be a collection of sets of (ground) atoms. An epistemic HT-interpretation is defined as an ordered tuple (A, I H , I T ) where I H , I T are sets of atoms with I H ⊆ I T . If I H = I T , we say (A, I H , I T ) is total. Notice that we do not require I H ∈ A or I T ∈ A. For any epistemic HT-interpretation (A, I H , I T ), any tense t ∈ {H, T }, and any formula F , we define when (A, I H , I T , t) satisfies F , denoted as (A, I H , I T , t) |= F , as follows: – – – – – – – –
for any atom F , (A, I H , I T , t) |= F if F ∈ I t . (A, I H , I T , t) |= ⊥. (A, I H , I T , t) |= KF if (A, J H , J T , t) |= F for all J H , J T ∈ A with J H ⊆ J T . (A, I H , I T , t) |= M F if (A, J H , J T , t) |= F for some pair J H , J T ∈ A with JH ⊆ JT . (A, I H , I T , t) |= F ∧ G if (A, I H , I T , t) |= F and (A, I H , I T , t) |= G. (A, I H , I T , t) |= F ∨ G if (A, I H , I T , t) |= F or (A, I H , I T , t) |= G. (A, I H , I T , t) |= F → G if, for every tense t with t ≤ t , (A, I H , I T , t ) |= F or (A, I H , I T , t ) |= G. (A, I H , I T , t) |= ¬F if (A, I H , I T , t) |= F → ⊥
It is easy to see that if F does not contain any belief operators, (A, I H , I T , t) |= F is irrelevant to the collection A; if F is a subjective literal (either Ka or M a), (A, I H , I T , t) |= F is irrelevant to I H and I T . For example, take A = {{a, b}, {a, c}} and then (A, I H , I T , t) |= Ka for any sets of atoms I H and I T with I H ⊆ I T . Epistemic HT-logic has the following basic properties which will be used in subsequent sections. Lemma 1. For any epistemic HT-interpretation (A, I H , I T ), if (A, I H , I T , H) |= F , then (A, I H , I T , T ) |= F .
282
K. Wang and Y. Zhang
The intuition behind this lemma is obvious: If a statement is true “here”, then it is also true “there”. This property is guaranteed by the condition I H ⊆ I T . Finally, we say that an epistemic HT-interpretation (A, I H , I T ) satisfies a formula F , denoted (A, I H , I T ) |= F , if (A, I H , I T , H) |= F . A model of an epistemic theory E is an epistemic HT-interpretation (A, I H , I T ) by which every formula in E is satisfied. 2.2 Epistemic Equilibrium Logic Pearce’s equilibrium logic is a kind of minimal model reasoning based on the HT-logic and its semantics is defined as the set of the equilibrium models [11]. An interesting result about the equilibrium logic is that it provides a characterization of the answer sets for nested logic programs [7]. In this subsection, we generalize the notion of equilibrium models to our epistemic HT-logic and the resulting logic is called epistemic equilibrium logic. Definition 1. An epistemic equilibrium model of an epistemic theory Γ is a total epistemic HT-interpretation (A, I, I) such that (i) (A, I, I) is a model of Γ . (ii) for every proper subset J of I, (A, J, I) is not a model of Γ . Epistemic equilibrium logic is the logic whose semantics is defined through epistemic equilibrium models. To provide a unifying characterization for the semantics of both nested logic programs and epistemic logic programs, we need the following definition. Definition 2. Let A be a collection of sets of atoms occurring in an epistemic theory Π. We say A is an equilibrium view if A is a maximal collection that satisfies A = {I | (A, I, I) is an equilibrium model of Π}. To illustrate our definitions, let us look at the following examples. Example 1. Let Π1 be the epistemic theory containing only the formula {Ka∨b}. Then both ({{a}}, {a}, {a}) and ({{b}}, {b}, {b}) are epistemic equilibrium models of Π1 . Moreover, A1 = {{a}} and A2 = {{b}} are equilibrium views of Π1 . But A3 = {{a}, {b}} is not an equilibrium view of Π1 since (A3 , {a}, {a}) is not an epistemic model of Π1 (note that (A3 , {a}, {a}) |= Ka). A4 = {{a, b}} is not an equilibrium view of Π1 either because (A4 , {a, b}, {a, b}) is not an epistemic equilibrium model. Example 2. Let Π2 = {K(a∨b)} be an epistemic theory. Then {{a}, {b}} is the unique equilibrium view of Π2 . Note that although ({{a}}, {a}, {a}) and ({{b}}, {b}, {b}) are epistemic equilibrium models of Π1 , neither {{a}} nor {{b}} is an equilibrium view of Π2 since they are not maximal. Example 3. Let Π3 = {a, Ka → b ∨ c} be an epistemic theory. It is easy to see that Π3 has a unique equilibrium view {{a, b}, {a, c}}.
Nested Epistemic Logic Programs
283
It is worth to mentioning that differently from the standard propositional modal logic, for instance S5, the epistemic equilibrium logic can be viewed as a kind of minimal model reasoning about epistemic concepts (i.e knowledge and belief). In this way, the equilibrium view semantics shares the same spirit of Gelfond’s world view semantics. However, as will be shown next, epistemic equilibrium logic is general enough to characterize the semantics of nested epistemic logic programs, while the world view semantics cannot.
3 Nested Epistemic Logic Programs (NELPs) As we will see in the next section, the epistemic HT-logic is actually a very general extension of both nested logic programs (NLPs) and epistemic logic programs (ELPs). To make this comparison more direct, we generalize both the syntax of NLPs and the syntax of ELPs by introducing a class of logic programs called nested epistemic logic programs or NELP. This language corresponds to a subset of the language of the epistemic HT-logic. The atom is understood as in propositional logic. Elementary formulas are propositional atoms and the 0-place connective ⊥ (“false”) and (“true”). NELP formulas are built from elementary formulas using negation as failure “not”, conjunction “,”, disjunction “;”, and the two belief operators K and M . An NELP rule is an expression of the form F ←G where F and G are NELP formulas called the head and the body of the rule. For any rule r, its head and body are denoted head(r) and body(r), respectively. A nested epistemic logic program (abbreviated NELP) is a (finite) set of NELP rules. For our purpose, in this paper we will only consider propositional epistemic logic programs where rules containing variables are viewed as the set of all ground rules by replacing these variables with all constants occurring in the language. Let us think of NELP rules as epistemic formulas by replacing every “not” with “¬”, every comma with “∧”, every semicolon “;” with disjunction “∨”, and transforming every rule head ← body into the implication body → head. Accordingly we can turn every nested epistemic logic program Π into an epistemic theory. When no confusion is caused, we will not distinguish a nested epistemic logic program Π and its corresponding epistemic theory. Note that the negation “¬” corresponds to the negation as failure rather than the strong negation (or classical negation) in logic programming. For simplicity, the second negation will not be considered until in Section 6. For example, we may use Π to denote both the NELP {Ka; b ← c, M d, note} and its corresponding epistemic theory {c ∧ M d ∧ ¬e → Ka ∨ b}. Now based on the epistemic HT-logic introduced in Section 2, we define the semantics of nested epistemic logic programs as follows. Definition 3. Let Π be a nested epistemic logic program and A be a collection of sets of atoms. We say A is an equilibrium view of Π if A is an equilibrium view of the corresponding epistemic theory Π.
284
K. Wang and Y. Zhang
Example 4. Consider the nested epistemic logic program Π: Ka; Kb ←, c ← Ka, notM b, d ← Kb, notM a. It is easy to see that Π has two equilibrium views {{a, c}} and {{b, d}}. Note that if we change the first rule in Π to be a; b ←, then the modified program will only have one equilibrium view {{a}, {b}}.
4 Epistemic Equilibrium Logic and Logic Programs The class of NELPs contains two major classes of logic programs: nested logic programs and epistemic logic programs. Thus NELPs generalize most classes of logic programs including normal logic programs and disjunctive logic programs. In this section we will prove that the equilibrium view semantics of NELPs extends both the world view semantics of epistemic logic programs and answer set semantics of nested logic programs. 4.1 Equilibrium Views and Answer Sets of Nested Logic Programs An NLP rule is a special NELP rule which contains no belief operators, and a nested logic program (NLP) is a set of NLP rules. Similarly, an NLP formula is an NELP formula containing no belief operators. To define the answer sets of nested logic programs, we first define when a set S of atoms satisfies an NLP formula F , denoted as S |= F , recursively as follows: S S S S S S
|= F if F is an atom and F ∈ S, |= , |= ⊥, |= (F, G) if S |= F and S |= G, |= (F ; G) if S |= F or S |= G, |= notF if S |= F .
We say a nested logic program Π is closed under a set of atoms S if, for every rule r, body(r) implies head(r). Then the definition of answer sets is defined in two steps: – Let Π be a nested logic program without negation as failure not. A set S of atoms is an answer set of Π if S is minimal set closed under S; – For an arbitrary nested logic program Π, the reduct Π S with respect to a set S of atoms is obtained by replacing every maximal occurrence of a formula of the form notF in Π with ⊥ if S |= F and with if S |= notF . We say S is an answer set of Π if S is an answer set of Π S . As we have noted before, a nested logic program is also a nested epistemic logic program and thus any nested logic program Π can be assigned two semantics: answer sets and equilibrium views. The following result states that these two semantics coincide for nested logic programs and thus the equilibrium view semantics generalizes the answer set semantics.
Nested Epistemic Logic Programs
285
Theorem 1. Let Π be a nested logic program and S be a set of atoms. Then S is an answer set of Π if and only if there exists an equilibrium view A of Π (as a nested epistemic logic program) such that S ∈ A. Proof. (⇒) If S is an answer set of Π, let A denote the set of minimal models of Π S . Then we have S ∈ A by the definition of answer sets. We need only to prove that A is an equilibrium view of Π (as a nested epistemic logic program). Since Π contains no belief operators, (A, S, S) is an equilibrium model of Π in the epistemic HT-logic if and only if (S, S) is an equilibrium model of Π in ordinary HT-logic. Again, by Lemma 3 in [7], (S, S) is an equilibrium model of Π in ordinary HT-logic if and only if S is an answer set of Π. Thus (A, S, S) is an equilibrium model of Π in the epistemic HT-logic. (⇐) Using the above argument, we have that if (A, S, S) is an equilibrium model of Π in the epistemic HT-logic then S is an answer set of Π. 4.2 Equilibrium Views and World Views of Epistemic Logic Programs Epistemic logic programs were first proposed by Gelfond [3] in order to overcome difficulties in reasoning about disjunctive information through disjunctive logic programs. It turns out that epistemic logic programs can be used as an effective formulation to represent and reason about agents’ epistemic states and hence have great potential in agent programming. The semantics for epistemic logic programs is based on the pair (A, S), where A is a collection of sets of ground literals and S is a set in A. The truth of an NELP formula F in (A, S) is denoted by (A, S) |= F and the falsity by (A, S) =|F , and are defined as follows: (A, S) |= F iff F ∈ S where F is a ground atom. (A, S) |= KF iff (A, Si ) |= F for all Si ∈ A. (A, S) |= M F iff (A, Si ) |= F for some Si ∈ A. (A, S) |= (F, G) iff (A, S) |= F and (A, S) |= G. (A, S) |= (F ; G) iff (A, S) |= ¬(¬F, ¬G). (A, S) |= ¬F iff (A, S) =|F . (A, S) =|F iff ¬F ∈ S where F is a ground atom. (A, S) =|KF iff (A, S) |= KF . (A, S) =|M F iff (A, S) |= M F . (A, S) =|(F, G) iff (A, S) =|F or (A, S) =|G. (A, S) =|(F ; G) iff (A, S) =|F and (A, S) =|G. An epistemic logic program or ELP is a finite set of ELP rules of the form: F1 ; F2 ; · · · ; Fk ← G1 , · · · , Gm , notGm+1 , · · · , notGn .
(1)
Here F1 , · · · , Fk are (objective) formulae, G1 , · · · , Gm are (objective) formulae or subjective formulaes, and Gm+1 , · · · , Gn are (objective) formulae. Note that ELP also allows nested expressions but in a restricted form. For an epistemic logic program Π, its semantics is given by its world view which is defined in the following steps: Step 1. Let Π be an epistemic logic program containing neither belief operators K and M nor negation as failure not. A set S of ground literals is called a belief set of Π iff S is
286
K. Wang and Y. Zhang
a minimal set of satisfying conditions: (i) for each rule F1 ; F2 ; · · · ; Fk ← G1 , · · · , Gm from Π such that S |= (G1 , · · · , Gm ) we have S |= (F1 ; F2 ; · · · ; Ft ); and (ii) if S contains a pair of complementary literals, then S is the set Lit of all literals (called inconsistent belief set). Step 2. Let Π be an epistemic logic program not containing modal operators K and M and S be a set of ground literals in the language of Π. By ΠS we denote the result of (i) removing from Π all the rules containing formulas of the form notG such that S |= G and (ii) removing from the rules in Π all other occurrences of formulas of the form notG. S is a belief set of Π iff S is a belief set of ΠS . Step 3. Finally, let Π be an arbitrary epistemic logic program and A a collection of sets of ground literals in its language. By ΠA we denote the epistemic logic program obtained from Π by (i) removing from Π all rules containing formulas of the form G such that G is subjective and A |= G, and (ii) removing from rules in Π all other occurrences of subjective formulas. S is a belief set of Π iff S is a belief set of ΠA . Example 5. The following epistemic logic program Π: a← b; c ← d ← Ka e ← Mb has a unique world view {{a, b, d, e}, {a, c, d, e}}. Observe that the world view of the above program Π is also the equilibrium view of Π. This is not surprising because we will show that, for any epistemic logic program Π, A is a world view of Π if and only if A is an equilibrium view of Π. The negation ¬ in epistemic program actually corresponds to the strong negation in extended logic program. In the rest of this section our discussion is temporarily restricted to epistemic programs that do not contain ¬. In Section 6, we will see that the results here are all valid for arbitrary epistemic programs. We first introduce some notations. By viewing an epistemic logic program Π as an epistemic theory in epistemic HT-logic, (A, J, I) |= Π means that each rule is satisfied in the epistemic HT-interpretation (A, J, I). Under the world view semantics, on the other hand, we say that a rule of the form (1) is satisfied in a pair (A, S) if the fact (A, S) |= (G1 , · · · , Gm ), (A, S) |= Gm+1 , · · · , (A, S) |= Gn implies (A, S) |= F1 ; · · · ; Fk . (A, S) |= Π means that each rule of Π is satisfied in (A, S). If Π does not contain any belief operators, we simply use S |= Π to denote (A, S) |= Π (recall that the truth values of objective formulas are irrelevant to A. Lemma 2. Let (A, I H , I T ) be an epistemic HT-interpretation and Π an epistemic logic program without containing negation as failure. (A, J, I) |= Π if and only if (A, J) |= Π. Lemma 3. Let Π be an epistemic logic program and (A, J, I) be an epistemic HTinterpretation. Then (A, J, I) |= Π if and only if J |= (ΠA )I . Here (ΠA )I is obtained through Step 3 and Step 2 in the definition of the world views.
Nested Epistemic Logic Programs
287
Proof. (⇒) Suppose (A, J, I) |= Π, we want to show J |= (ΠA )I . If R ∈ Π, we can assume that R is of the form (1). If R satisfies (A, I) |= Gi for every i with r + 1 ≤ i ≤ m and (A, I) |= Gj for every i with m + 1 ≤ j ≤ n, we use (RA )I to denote the reduction of R with respect to A and I: F1 ; · · · ; Fk ← G1 , · · · , Gr . In general, (RA )I may be undefined. Note that (ΠA )I = {(RA )I | R ∈ Π}. For any rule of ((ΠA )I ), it must be of the form (RA )I for some rule R ∈ Π. So we need only to prove that J |= (RA )I for R ∈ Π. By the definition of the program reduction, we have the following two facts: 1. (A, I) |= Gi for r + 1 ≤ i ≤ m and 2. (A, I) |= Gi for m + 1 ≤ i ≤ n. Suppose J |= body((RA )I )), we want to show J |= head((RA )I ). That is, J |= (F1 ; · · · ; Fk ). Since the body of (RA )I is now the conjunction of G1 , · · · , and Gr , we have J |= Gi for all i with 1 ≤ i ≤ r. We prove that (A, J, I) |= body(R) by considering three different cases: Case 1. Since J |= Gi for 1 ≤ i ≤ r, then Gi ∈ J and thus (A, J, I, t) |= Gi for any t ∈ {H, T }. Case 2. If r + 1 ≤ i ≤ m, then Gi is a subjective literal and it is of form either KOi or M Oi for some objective literal Oi . If Gi = KOi , by (A, I) |= Gi for r + 1 ≤ i ≤ m, (A, I) |= KOi . This means (A, I ) |= Oi for all I ∈ A, which implies (A, I H , I T , t) |= Oi for all sets J H , J T of atoms with J H ⊆ J T . Thus (A, J, I, t) |= KOi or (A, J, I, t) |= Gi for r + 1 ≤ i ≤ m. Similarly, we also have (A, J, I, t) |= Gi for r + 1 ≤ i ≤ m if Gi = M Oi . Case 3. If (A, I) |= Gi for m + 1 ≤ i ≤ n, then Gi ∈ I. Since Gi is objective and J ⊆ I, (A, J, I) |= Gi . Combining Cases 1-3, we have (A, J, I) |= body(R). By (A, J, I) |= R, we have (A, J, I) |= head(R). By head(R) = head((RA )I ) and thus (A, J, I) |= head ((RA )I ). (⇐) Suppose J |= (ΠA )I , we show (A, J, I) |= Π by considering the following three cases: For any rule R ∈ Π, assume R is of form (1), Case 1. If (A, I) |= Gi for some i with r + 1 ≤ i ≤ m, then Gi ∈ I and thus Gi ∈ J. This implies (A, J, I) |= Gi . In this case, (A, J, I) |= body(R). So (A, J, I) |= R. Case 2. If (A, I) |= Gi for some i with m + 1 ≤ i ≤ n, then Gi ∈ I. This implies (A, J, I, T ) |= Gi . In this case, (A, J, I) |= body(R). So (A, J, I) |= R. Case 3. If neither Case 1 nor Case 2, then (A, J, I) |= Gr+1 ∧ · · · ∧ Gm ∧ ¬Gm+1 ∧ · · · ∧ ¬Gn and thus (RA )I is well defined. If (A, J, I) |= G1 ∧ · · · ∧ Gr , then J |= G1 ∧ · · · ∧ Gr . Since J |= (RA )I , we have J |= head((RA )I ). That is, J |= head(R). Lemma 4. Let Π be an ELP and (A, J, I) be a epistemic HT-interpretation. Then (A, I, I) is an equilibrium model of Π if and only if I is a belief set of (ΠA )I . The above lemma, obtained directly from Lemma 3, implies the following result. Theorem 2. Let Π be an epistemic logic program and A be a collection of sets of atoms. Then A is a world view of Π if and only if A is an equilibrium view of Π.
288
K. Wang and Y. Zhang
5 Strong Equivalence of Nested Epistemic Logic Programs Recently, researchers have addressed the problem of characterizing the strong equivalence of logic programs under the answer sets. In particular, the result in [7] shows that the strong equivalence of nested logic programs can be characterized in term of the equivalence of formulas in monotonic logic (the HT-logic). Here we are interested in extending this result to NELPs under the equilibrium view semantics. We say two NELPs Π1 and Π2 are equivalent if they have the same equilibrium views. A NELP Π1 is said to be strong equivalent to another NELP Π2 if, for every NELP Π, Π1 ∪ Π and Π2 ∪ Π are equivalent. It is well-known that equivalence of two programs does not implies their strong equivalence in general (see [2,8,7] for more examples of strongly equivalent programs). Similarly, two theories Π1 and Π2 in the epistemic HT-logic is equivalent if they have the same set of models. Theorem 3. For any nested epistemic logic programs Π1 and Π2 , the following conditions are equivalent: (1) Π1 is strongly equivalent to Π2 . (2) Π1 is equivalent to Π2 in the epistemic HT-logic. By Theorem 2, it is easy to prove Theorem 3 since we have the following lemma, whose proof is similar to that of Theorem 1 in [7]. Lemma 5. For any epistemic theories Γ1 and Γ2 , the following conditions are equivalent: (1) for every epistemic theory Γ , Γ1 ∪Γ and Γ2 ∪Γ have the same equilibrium models. (2) Γ1 is equivalent to Γ2 in the epistemic HT-logic. For any two objective theories Γ1 and Γ2 , they are equivalent in the logic of hereand-there if and only if they are equivalent in the epistemic HT-logic. Thus, by Theorem 2, the main result (Theorem 1) in [7] is a corollary of our Theorem 3: Corollary 1. For any nested logic programs Π1 and Π2 , the following conditions are equivalent: (1) Π1 is strongly equivalent to Π2 . (2) Π1 is equivalent to Π2 in the logic of here-and-there. By Theorem 2, the strong equivalence of epistemic logic programs under the world view semantics can also be verified by checking the equivalence of formulas in the epistemic HT-logic which is a monotonic logic. Corollary 2. For any epistemic logic programs Π1 and Π2 , the following conditions are equivalent: (1) Π1 is strongly equivalent to Π2 . (2) Π1 is equivalent to Π2 in the epistemic HT-logic.
Nested Epistemic Logic Programs
289
6 Adding Strong Negation in NELPs In answer set programming, the syntax of logic programs usually allows both negation as failure and strong negation [5]. The second negation is denoted by ¬. It is well-known that this extension is very useful for representing and reasoning about incomplete information. In this section, we show how to add the second negation in NELPs. This can be done by an easy generalization of Section 5 in [7]. Technically, it is not hard to add the strong negation in the syntax of logic programs. A literal is an atom a or its strong negation ¬a. By allowing arbitrary literals in place of atoms, extended NELP formula, extended NELP rule and extended NELP can be defined in the same way as we defined NELP formula, NELP rule and NELP. Following [5], the semantic of an extended NELP can be defined through a simple syntactic translation. Given an extended NELP Π, we introduce a new symbol a for each atom a in Π. Then Π can be translated into a NELP Π by replacing each negative literal ¬a with a . Note that Π does not contain the strong negation. For any expression E, we use E to denote the expression obtained by replacing every ¬a with a . Denote Cons(Π) = {⊥ ← a, a | a is literal in Π}. Then we say A is an equilibrium view of Π if A is an equilibrium view of Π ∪ Cons(Π). For nested logic programs (with strong negation) Π, a set X of literals is an answer set of Π iff X is X is an answer set of Π ∪ Cons(Π). Therefore, Theorem 1 is also true for nested logic programs with strong negation. In the same way as in [5], the negation ¬ in an epistemic logic program can be eliminated by introducing new atom a for each atom a. Thus, Theorem 2 is also true for epistemic logic program with strong negation. Theorem 3 can also be generalized to extended NELPs. Theorem 4. For any extended NELPs Π1 and Π2 , the following conditions are equivalent: (1) Π1 is strongly equivalent to Π2 . (2) Π1 ∪ Cons(Π1 ) is equivalent to Π2 ∪ Cons(Π2 ) in the epistemic HT-logic. Proof. Π1 is strongly equivalent to Π2 if and only if Π1 ∪ Cons(Π1 ) is strongly equivalent to Π2 ∪ Cons(Π2 ) if and only if Π1 ∪ Cons(Π1 ) is equivalent to Π2 ∪ Cons(Π2 ) in the epistemic HT-logic.
7 Conclusions In this paper, we introduced the epistemic HT-logic and based on this logic further developed a new type of logic programs called nested epistemic logic programs (NELPs). We showed that the equilibrium view semantics of NELPs generalizes the answer set semantics of nested logic programs as well as the world view semantics of epistemic logic programs. We also characterize the strong equivalence property of NELPs in terms of epistemic HT-logic.
290
K. Wang and Y. Zhang
Some important issues related to NELPs should be further investigated. Firstly, it is important to understand the computational properties of NELPs in detail from both theoretical and practical viewpoints. Secondly, as epistemic logic programs may be viewed as an effective formalism for representing and reasoning about agent’s dynamic epistemic state, e.g. [12], it would be interesting to explore how this work can be improved by applying NELPs. Acknowledgements. The authors would like to thank the three referees for their comments. In particular, the comments from one referee greatly helped the improvement of the paper.
References 1. C. Baral. Knowledge Representation, Reasoning and Declarative Problem Solving. Cambridge University Press, 2003. 2. E. Erdem and V. Lifschitz. Transformations of logic programs related to causality and planning. In Proceedings of the 5th International Conference on Logic Programming and Nonmonotonic Reasoning (LNAI 1730), pages 107–116, 1999. 3. M. Gelfond. Logic programming and reasoning with incomplete information. Annals of Mathematics and Artificial Intelligence, 12:98–116, 1994. 4. M. Gelfond and V. Lifschitz. The stable model semantics for logic programming. In Proceedings of the International Conference on Logic Programming, pages 1070–1080. The MIT Press, 1988. 5. M. Gelfond and V. Lifschitz. Logic programs with classical negation. In Proceedings of the International Conference on Logic Programming, pages 579–597, 1990. 6. V. Lifschitz. Answer set planning. In Proceedings of the International Conference on Logic Programming, pages 23–37. The MIT Press, 1999. 7. V. Lifschitz, D. Pearce, and A. Valverde. Strongly equivalent logic programs. ACM Transactions on Computationl Logic, 2(4):426–541, 2001. 8. V. Lifschitz, L. Tang, and H. Turner. Nested expressions in logic programs. Annals of Mathematics and Artificial Intelligence, 25:369–389, 1999. 9. F. Lin and Y. Shoham. A logic of knowledge and justified assumptions. Artificial Intelligence, 57:271–289, 1992. 10. D. Pearce. From here to there: stable negation in logic programming. In D. Gabbay and H. Wansing, editors, What is Negation? Springer-Verlag, 1997. 11. D. Pearce. A new logical characterization of stable models and answer sets. In J. Dix, L. Pereira, and T. Przymusinski, editors, Non-Monotonic Extensions of Logic Programming (LNAI 1216), pages 57–70. Springer-Verlag, 1997. 12. Y. Zhang. Minimal change and maximal coherence for epistemic logic program updates. In Proceedings of IJCAI-03, pages 112–117. 2003.
An Algebraic Account of Modularity in ID-Logic Joost Vennekens and Marc Denecker Dept. of Computer Science, K.U.Leuven Celestijnenlaan 200A B-3001 Leuven, Belgium {joost.vennekens, marc.denecker}@cs.kuleuven.ac.be
Abstract. ID-logic uses ideas from the field of logic programming to extend second order logic with non-monotone inductive defintions. In this work, we reformulate the semantics of this logic in terms of approximation theory, an algebraic theory which generalizes the semantics of several non-monotonic reasoning formalisms. This allows us to apply certain abstract modularity theorems, developed within the framework of approximation theory, to ID-logic. As such, we are able to offer elegant and simple proofs of generalizations of known theorems, as well as some new results.
1
Introduction
Inductive definitions are common in mathematical practice. For instance, the non-monotone inductive definition of the satisfaction relation |= (see Definition 1 in Section 2.2) can be found in most textbooks on first-order logic. This prevalence of inductive definitions indicates that these offer a natural and wellunderstood way of representing knowledge. At the same time, inductive definitions cannot easily be expressed in classical logic. For instance, the transitive closure of a graph is one of the simplest concepts typically defined by induction— such a definition might consist of the following two rules: if (x, y) is an edge of the graph, (x, y) belongs to the transitive closure and if ∃z such that both (x, z) and (z, y) belong to the transitive closure, then (x, y) belongs to the transitive closure—yet it can be shown that this concept cannot be defined in first-order logic. While second-order logic does allow the representation of such simple definitions, the resulting formula might not always be very natural and the use of second-order logic itself may be undesirable, e.g., due to computational considerations. Moreover, even this methodology breaks down when faced with nonmonotone inductive definitions, such as that of the satisfaction relation. It turns out, however, that certain knowledge representation logics do allow even non-monotone inductive definitions to be correctly formalized in an intuitive way. Particularly suited for this are logic programs under the well-founded
This work is supported by FWO-Vlaanderen, European Framework 5 Project WASP, and by GOA/2003/08.
C. Baral et al. (Eds.): LPNMR 2005, LNAI 3662, pp. 291–303, 2005. c Springer-Verlag Berlin Heidelberg 2005
292
J. Vennekens and M. Denecker
model semantics. In fact, one could even go so far as to explain the semantical foundations of this logic themselves as precisely a formalization of the principle of inductive definition [Den01]. The language of ID-logic uses the well-founded semantics to extend classical logic with a new “inductive definition” primitive. In the resulting formalism, all kinds of definitions regularly found in mathematical practice—e.g., monotone inductive definitions, non-monotone inductive definitions over a well-ordered set, and iterated inductive definitions—can be represented in a uniform way. Moreover, this representation neatly corresponds to the form such a definitions would take in a mathematical text. For instance, in ID-logic the transitive closure of a graph can be defined as:
∀x, y T ransCl(x, y) ← Edge(x, y). ∀x, y T ransCl(x, y) ← (∃z T ransCl(x, z) ∧ T ransCl(z, y)).
However, ID-logic is able to handle more than only mathematical concepts. Indeed, inductive definitions are also useful in common-sense reasoning. For instance, in [DT04a], it was shown that situation calculus can be given a natural representation as an iterated inductive definition. The resulting theory is able to correctly handle tricky issues such as recursive ramifications, and is in fact, to the best of our knowledge, the most general representation of this calculus to date. In general, definitions are a distinctive and important form of human expert knowledge; as a uniform and natural way of representing this kind of knowledge, ID-logic provides a useful contribution to the field of knowledge representation. The goal of this paper is to study modularity properties for ID-logic. Modularity properties deal with the relation between a theory and its components. Typical examples are so-called splitting results, which allow large theories to be rewritten as equivalent sets of sub-theories. Such properties are of interest, because they may offer additional insight into the semantics of a formalism, can be used to guarantee that certain transformations are equivalence preserving, or may lead allow more efficient computations. Modularity properties have been studied for a large number of different formalisms. Recently, an algebraic theory of modularity [VGD04b, VGD04a] was developed within the framework of approximation theory, a general fixpoint theory for arbitrary operators, which naturally captures the semantics of logic programs, auto-epistemic logic, and default logic [DMT03, DMT00]. These abstract results have since been used to unify several concrete splitting theorems: [VGD04a] generalizes results concerning autoepistemic logic [GP92], and [VGD04b] (partially) generalizes results for logic programming [LT94]. Here, we apply this algebraic modularity theory to ID-logic. First, we show how the semantics of this logic can be reformulated in terms of approximation theory. By doing so, we are able to apply the aforementioned splitting theorems (and a small extension thereof) to ID-logic and obtain a generalization of results from [DT04b], as well as some new results. The structure of this paper is as follows. Section 2 introduces approximation theory and ID-logic. Section 3 summarizes the algebraic modularity results which will be used. In Section 4, we then apply those results to ID-logic.
An Algebraic Account of Modularity in ID-Logic
2 2.1
293
Preliminaries Approximation Theory
Approximation theory is a general fixpoint theory for arbitrary operators. Our presentation of this theory is based on [DMT00, DMT03]. Let L, ≤ be a lattice. An element (x, y) of the square L2 of the domain of such a lattice, can be seen as denoting an interval [x, y] = {z ∈ L | x ≤ z ≤ y}. Using this intuition, we can derive a precision order ≤p on the set L2 from the order ≤ on L: for each x, y, x , y ∈ L, (x, y) ≤p (x , y ) iff x ≤ x and y ≤ y. Indeed, if (x, y) ≤p (x , y ), then [x, y] ⊇ [x , y ]. It can easily be shown that L2 , ≤p is also a lattice, which is called the bilattice corresponding to L. Moreover, if L is complete, then so is L2 . As an interval [x, x] contains precisely one element, namely x itself, elements (x, x) of L2 are called exact. The set of all exact elements of L2 forms a natural embedding of L in L2 . A pair (x, y) only corresponds to a non-empty interval if x ≤ y. Such pairs are called consistent. Approximation theory is based on the study of operators on bilattices L2 which are monotone w.r.t. the precision order ≤p . Such operators are called approximations. For an approximation A and x, y ∈ L, we denote by A1 (x, y) and A2 (x, y) the unique elements of L, for which A(x, y) = (A1 (x, y),A2 (x, y)). An approximation approximates an operator O on L if for each x ∈ L, A(x, x) contains O(x), i.e. A1 (x, x) ≤ O(x) ≤ A2 (x, x). An approximation is symmetric if for each pair (x, y) ∈ L2 , if A(x, y) = (x , y ) then A(y, x) = (y , x ). For an approximation A on L2 , the following two operators on L can be defined: the function A1 (·, y) maps an element x ∈ L to A1 (x, y), i.e. A1 (·, y) = λx.A1 (x, y), and the function A2 (x, ·) maps an element y ∈ L to A2 (x, y), i.e. A2 (x, ·) = λy.A2 (x, y). As all such operators are monotone, they all have a ↓ unique least fixpoint. We define an operator CA on L, which maps each y ∈ ↑ 1 L to lf p(A (·, y)) and, similarly, an operator CA , which maps each x ∈ L to ↓ ↑ lf p(A2 (x, ·)). CA is called the lower stable operator of A, while CA is the upper stable operator of A. Both these operators are anti-monotone. Combining these ↓ ↑ two operators, the operator CA on L2 maps each pair (x, y) to (CA (y), CA (x)). This operator is called the partial stable operator of A. Because the lower and ↓ ↑ upper partial stable operators CA and CA are anti-monotone, the partial stable operator CA is monotone. If an approximation A is symmetric, its lower and ↓ ↑ upper partial stable operators will always be equal, i.e. CA = CA . An approximation A defines a number of different fixpoints: the least fixpoint of an approximation A is called its Kripke-Kleene fixpoint, fixpoints of its partial stable operator CA are stable fixpoints and the least fixpoint of CA is called the well-founded fixpoint of A. As shown in [DMT00, DMT03], these fixpoints correspond to various semantics of logic programming, auto-epistemic logic and default logic. Finally, it should also be noted that the concept of an approximation as defined in [DMT00] corresponds to our definition of a symmetric approximation.
294
2.2
J. Vennekens and M. Denecker
ID-Logic
ID-logic [DT04b, DT04a] extends second-order logic with non-monotone inductive definitions. Before defining this logic in its entirity, we first introduce basic second order logic. Following [DT04a], we do this in a slightly non-standard way. In particular, no distinction is made between constant symbols and variables. We assume an infinite supply of object symbols x, y, . . ., function symbols f /n, g/n, . . . of every arity n, and predicate symbols P/n, Q/n, . . . of every arity n. A vocabulary Σ is a set of symbols. We denote by Σo the object symbols in Σ, by Σf the function symbols, and by ΣP the predicate symbols. Terms and atoms of Σ are defined in the usual way. A formula of Σ is inductively defined as: – – – –
a Σ-atom P (t1 , . . . , tn ) is a Σ-formula; if φ is a Σ-formula, then so is ¬φ; if φ1 and φ2 are Σ-formulas, then so is (φ1 ∨ φ2 ); if φ is a (Σ ∪ {σ})-formula and σ an (object, function or predicate) symbol, then (∃σ φ) is a Σ-formula.
If in all quantifications ∃σ of a formula φ, σ is an object symbol, φ is called first order. Given a certain domain D, a symbol σ can be assigned a value in D: – if σ ∈ Σo , a value for σ in D is an element of D; – if σ/n ∈ Σf , a value for σ in D is a function of arity n in D; – if σ/n ∈ ΣP , a value for σ in D is a relation of arity n in D. A structure S for vocabulary Σ, or Σ-structure S, consists of a domain, denoted SD , and a mapping from each symbol σ in Σ to a value σ S in SD for σ. A vocubalary Σ is a sub-vocabulary of Σ iff Σ ⊆ Σ . The restriction S |Σ of a Σ -structure S to a sub-vocabulary Σ, is the Σ-structure S for which SD = SD S S and, for each symbol σ of Σ, σ = σ . Under the same conditions, S is called an extension of S to Σ . The set of all structures extending S to Σ is denoted S by SΣ . For each value a in SD for a symbol σ, we denote by S[σ/a] the ex tension S of S to Σ ∪ {σ}, such that σ S = a.We also extend this notation to tuples x and a, and to pairs (X, Y ) of Σ-structures sharing the same domain, i.e., (X, Y )[x/a] = (X[x/a], Y [x/a]). The value of a Σ-term t in a Σ-structure S, also denoted tS , is inductively defined as: (f (t1 , . . . , tn ))S = f S (tS1 , . . . , tSn ), for a function symbol f and terms t1 , . . . , tn . We now define a satisfaction relation between structures and formulas: Definition 1. For a Σ-structure S and Σ-formula φ, the relation “S satisfies φ”, denoted S |= φ, is inductively defined as: – – – –
S |= P (t) iff tS ∈ P S ; S |= (φ1 ∨ φ2 ) iff S |= φ1 or S |= φ2 ; S |= ¬φ iff S |= φ; S |= (∃σ φ) iff there exists a value a for σ in the domain SD , such that S[σ/a] |= φ;
An Algebraic Account of Modularity in ID-Logic
295
A pre-interpretation H for Σ is a structure for the language Σo ∪ Σf , i.e., one which interprets only the object and function symbols of Σ. A structure S extending H to Σ is called an H-interpretation. Clearly, H-interpretations can only differ in their assignment of relations (over the common domain SH ) to predicate symbols. Given a domain D, a domain atom is a pair (P, a), with P/n a predicate of Σ and a ∈ Dn . We also write such a pair as P (a). The function AtH is defined as mapping an H-interpretation S to the set of all domain atoms P (a) in HD , for which a ∈ P S . AtH is a one-to-one correspondence between H-interpretations and sets of domain atoms for HD . The set of all H-interpretations is a complete lattice w.r.t. to the truth order ≤t , defined as: S ≤t S iff AtH (S) ⊆ AtH (S ) (or, equivalently, for each predicate P , P S ⊆ P S ). Next, we explain how this logic can be extended with inductive definitions. We do this using concepts from approximation theory. In this, our presentation differs from the more direct approach taken in [DT04a]. As a first step, we extend the notion of satisfation to pairs (X, Y ) of structures. Definition 2. Let H be a pre-interpretation for Σ, X and Y H-interpretations, and φ a Σ-formula. The relation “(X, Y ) satisfies φ”, denoted (X, Y ) |= φ is inductively defined by: – – – –
(X, Y ) |= P (t) iff tH ∈ P X ; (X, Y ) |= (φ1 ∨ φ2 ) iff (X, Y ) |= φ1 or (X, Y ) |= φ2 ; (X, Y ) |= ¬φ iff (Y, X) |= φ; (X, Y ) |= (∃σ φ) iff there exists a value a for σ in HD , such that (X, Y )[σ/a] |= φ;
Observe that in the rule for ¬φ, the roles of X and Y are switched. This causes all positively occurring atoms in φ to be evaluated in X, while all negatively occurring atoms in φ are evaluated in Y . To motivate this definition, let us consider a structure S approximated by (X, Y ), i.e. such that X ≤t S ≤t Y . In the evaluation of φ in (X, Y ), all positively occurring atoms are evaluated with respect to the underestimate X of S, and all negatively occurring atoms are evaluated with respect to the overestimate Y of S. Therefore, the truth value of φ in (X, Y ) is an underestimate of the value of φ in S. Vice versa, in the evaluation of φ in (Y, X), all positively occurring atoms are evaluated in the overestimate Y while all negatively occurring atoms are evaluated in the underestimate X, and hence, the truth value of φ in (Y, X) is an overestimate of the value of φ in S. Considering satisfaction in pairs of structures rather than single structures, corresponds to switching to a four-valued logic: φ is true according to (X, Y ) if (X, Y ) |= φ and (Y, X) |= φ , false if (X, Y ) |= φ and (Y, X) |= φ, unkown if (X, Y ) |= φ and (Y, X) |= φ, and inconsistent if (X, Y ) |= φ and (Y, X) |= φ . We now define the ID-logic syntax used for inductive definitions. Let Σ be a vocabulary. A definitional rule r of Σ is a formula ∀x A ← φ, with A a Σ-atom and φ a first-order (Σ ∪ x)-formula. The atom A is called the head, head(r), of r and φ is called the body, body(r), of r. Note that the symbol “←” in such a rule should not be read as material implication, but rather as a new language
296
J. Vennekens and M. Denecker
primitive: the definitional implication. A rule r is said to be a defining rule of a predicate P if P is the predicate of head(r). A Σ-definition ∆ is a set of definitional rules. A predicate symbol having at least one defining rule r in ∆, is d called a defined predicate of ∆. The set of all such predicates is denoted by P∆ . Predicates of ΣP which are not defined by ∆ are open in ∆ and the set of all o o d such predicates is denoted by P∆ . The notations Σ∆ and Σ∆ are used to denote o d the vocabularies Σo ∪ Σf ∪ P∆ and Σo ∪ Σf ∪ P∆ , respectively. Using this syntax, the well-known simultaneous inductive definition of the even and odd numbers (i.e., 0 is an even number, each successor of an even number is an odd number, and vice versa) can be written as: Example 1.
⎧ ⎪ ⎨
∆even
⎫ Even(0). ⎪ ⎬ = ∀x Even(s(x)) ← Odd(x). ⎪ ⎪ ⎩ ⎭ ∀x Odd(s(x)) ← Even(x).
Intuitively, such an inductive definition describes a process by which, given some fixed interpretation of the open predicates, new elements of the defined relations can be derived from a set of already known elements. The formal definition of the semantics of ID-logic captures this intuition, by associating a class of operators to a definition ∆. More precisely, for each interpretation O of the open predicates of ∆, an operator T∆O is defined, which maps an estimate (X, Y ) of the defined relations to a more precise estimate T∆O (X, Y ) = (X , Y ). The new lower bound X is constructed by underestimating the truth of the bodies of the rules in ∆, i.e., by evaluating these in (X, Y ). When constructing the new upper bound Y , on the other hand, the truth of the bodies of these rules is overestimated, i.e., evaluated in (Y, X). o Definition 3. Let ∆ be a Σ-definition and O a Σ∆ -structure. We define a function O O 2 O O d U∆ from the bilattice (SΣ ) to SΣ as U∆ (X, Y ) = S, with for each P ∈ Σ∆ : a ∈ P S iff there exists a rule (∀x P (t) ← φ) in ∆ and a value c for x, such that (X, Y )[x/c] |= φ O 2 O and a = tS[x/c] . The operator T∆O on (SΣ ) is defined as, for all X, Y ∈ SΣ : O O T∆O (X, Y ) = (U∆ (X, Y ), U∆ (Y, X)).
If an estimate (X, Y ) is more precise than an estimate (X , Y ), i.e., X ≤t X and Y ≤t Y , then T∆O (X, Y ) will also be more precise than T∆O (X , Y ). In other words, each operator T∆O is an approximation. As such, each T∆O has a well-founded fixpoint. We now use this to define the semantics of the logic. Definition 4. Let Σ be a vocabulary. An ID-logic formula is inductively defined by extending the definition of a formula with the additional base case: – A definition ∆ is an ID-logic formula. The corresponding base case for the satisfaction relation is: – S |= ∆ iff X|Σ∆ d = S|Σ d = Y |Σ d , with (X, Y ) the well-founded fixpoint of ∆ ∆ O o . T∆ , with O = S|Σ∆
An Algebraic Account of Modularity in ID-Logic
297
Note that, even though this definition uses the operator T∆S on pairs of structures, the eventual models of a definition are always single structures S. The intuition here is that a definition should completely define its defined predicates, i.e., there should be no tuples for which it is “unknown” whether they belong to the defined relations or not. o Definition 5. Let Σ be a vocabulary. A Σ-definition ∆ is total in a Σ∆ O -structure O iff X = Y , with (X, Y ) the well-founded fixpoint of T∆ .
3
Algebraic Splitting Results
In this section, we summarize and extend results from [VGD04b]. First, we introduce some basic definitions and notations. Let I be a set, which
we call the index set, and for each i ∈ I, let Si be a set. The product set i∈I Si is the following set of functions: Si = {f | f : I → Si such that ∀i ∈ I : f (i) ∈ Si }. i∈I
i∈I
If, for instance, I is {1, . . . , n}, the product i∈I Si is (isomorphic to) the cartesian product S1 × · · · × Sn . If each Si is partially ordered by some ≤i , this induces the product order ≤⊗ on ⊗i∈I Si : ∀x, y ∈ ⊗i∈I Si , x ≤⊗ y iff ∀i ∈ I : x(i) ≤i y(i). It can easily be shown that if all Si , ≤i are (complete) lattices, then ⊗i∈I Si , ≤⊗ is also a (complete) lattice; this is the product lattice of the lattices Si . From now on, we only consider product lattices with a well-founded index set, i.e., index sets I with a partial order such that each non-empty subset of I has a -minimal element. This allows us to use inductive arguments in dealing with elements of product lattices. The following notations are used. Let L be a product lattice ⊗i∈I Li . For x ∈ L and i ∈ I, we abbreviate the restriction x|{j∈I|ji} by x|i . We also use similar abbreviations x|≺i , x|i and x| i . If i is a minimal element of the wellfounded set I, x|≺i is defined as the empty function. For any subset J of I, the set {x|J | x ∈ L}, ordered by the appropriate restriction ≤⊗ |J of the product order, is also a lattice. This sublattice of L is of course equal to the product lattice ⊗j∈J Lj . If J is of the form {j ∈ I | j i} for some i, we simply write L|i for L|J . Similarly, L|≺i is written for ⊗j≺i Li . If f, g are functions f : A → B, g : C → D and the domains A and C are disjoint, we denote by f g the function from A ∪ C to B ∪ D, such that for all a ∈ A, (f g)(a) = f (a) and for all c ∈ C, (f g)(c) = g(c). Furthermore, for any g whose domain is disjoint from the domain of f , we call f g an extension of f . For each element x of a product lattice L and each index i ∈ I, the extension x|≺i x|i of x|≺i is clearly equal to x|i . To ease notation, we sometimes write x(i) instead of x|i in such expressions, i.e. we identify an element a of the ith lattice Li with the function from {i} to Li which maps i to a. Similarly, x|≺i x(i) x| i = x.
298
J. Vennekens and M. Denecker
Our goal is now to study operators on product lattices. Let I, be a wellfounded index set and let L = ⊗i∈I Li be a product lattice. Intuitively, an operator O on L is stratifiable over , if the value (O(x))(i) of O(x) in the ith level only depends on values x(j) for which j i. Definition 6. An operator O on a product lattice L is stratifiable iff ∀x, y ∈ L, ∀i ∈ I : if x|i = y|i then O(x)|i = O(y)|i . It is possible to characterize stratifiablity in a more constructive manner. The following proposition shows that stratifiablity of an operator O on a product lattice L is equivalent to the existence of a family of operators on each lattice Li (one for each partial element u of L|≺i ), which mimics the behaviour of O on this lattice. Proposition 1. Let O be an operator on a product lattice L. O is stratifiable iff for each i ∈ I and u ∈ L|≺i there exists a unique operator Oiu on Li , such that for all x ∈ L: If x|≺i = u then (O(x))(i) = Oiu (x(i)). The operators Oiu are called the components of O. The main results of [VGD04b] are the following correspondences between various kinds of fixpoints of the original operator O and those of its components Oiu : Theorem 1. Let L be a product lattice ⊗i∈I Li . – If O is a stratifiable operator on L, then for each x ∈ L: x is a fixpoint of O x| iff ∀i ∈ I : x(i) is a fixpoint of Oi ≺i . – If O is a monotone stratifiable operator on L, then for each x ∈ L: x is the x| least fixpoint of O iff ∀i ∈ I : x(i) is the least fixpoint of Oi ≺i . 2 – If O is a stratifiable approximation on the bilattice L , then for each x ∈ L2 : x is a stable (well-founded) fixpoint of O iff ∀i ∈ I : x(i) is a stable (wellx| founded, respectively) fixpoint of Oi ≺i . This theorem allows us to incrementally construct any kind of fixpoint of a stratifiable operator, by constructing the corresponding fixpoints of its components in a bottom-up manner w.r.t. the well-founded order on the index set. We now extend this material from [VGD04b] with some additional results. More specifically, we not only want to split a stratifiable operators into its components, but also into sets of “bigger” operators, i.e., operators which may encompass several levels. For a subset J of I and x ∈ L|I\J , we denote by OJx the operator on L|J which maps each y ∈ L|J to O(x y)|J . Such operators OJx are called recombinations of O. Our goal is now to show that, for each partition J of I, a stratifiable operator O can be split into the recombinations OJx , with J ∈ J . We do this, by showing that a recombination OJx is also stratifiable and can be split into the components of O itself. Proposition 2. Let O be a stratifiable operator. For each J ⊆ I and x ∈ L|I\J , OJx is stratifiable.
An Algebraic Account of Modularity in ID-Logic
299
Proof. Let OJx be as above, i ∈ J, and y, y ∈ L|J , such that y|i = y |i . By definition, OJx (y) = O(x y)|J . Because (x y)|i = (x y )|i , we have that, by stratifiability of O, OJx (y)|i = O(x y)|{j∈J|ji} = O(x y )|{j∈J|ji} = OJx (y )|i . Proposition 3. Let O be a stratifiable operator. For each J ⊆ I, x ∈ L|I\J , i ∈ J, and u ∈ L|{j∈J|j≺i} , the component (OJx )ui of OJx equals the component u (x|≺i ) Oi of O. Proof. Let (OJx )ui be as above and let y ∈ Li . By definition, for any z extending (x z)|≺i x| u u y to J, (OJx )ui (y) = O(x z)|i = (Oi (z|i ))|i = Oi ≺i (y). These two propositions now imply the wanted result. Theorem 2. Let O be a stratifiable operator and let J be a partition of I. Then, for each x ∈ L, x is a fixpoint (least fixpoint, stable fixpoint, or wellfounded fixpoint) of O (assuming that O is monotone or an approximation, where appropriate) iff for each J ∈ J , x|J is a fixpoint (least fixpoint, stable fixpoint, x| or well-founded fixpoint) of OJ I\J . Proof. We only show the correspondence between fixpoints; the proofs of the other correspondences are similar. Let x be a fixpoint of O. By Theorem 1, this x| is equivalent to: ∀i ∈ I, x|i is a fixpoint of Oi ≺i . Because J partitions I, this is x| equivalent to ∀J ∈ J , ∀i ∈ J, x|i is a fixpoint of Oi ≺i . By Proposition 3, such a x|≺i
component Oi
x|
1, ∀J ∈ J , ∀i ∈ J, x|i is a fixpoint x|
x|{j∈J|j≺i}
is equal to (OJ I\J )i
. By Proposition 2 and Theorem
x| x| (OJ I\J )i {j∈J|j≺i}
iff ∀J ∈ J , x|J is a fixpoint
of OJ I\J .
4
Modularity Results for ID-Logic
Now, we apply the algebraic results presented in Section 3 to ID-logic. We fix a vocabulary Σ and a pre-interpretation H for Σ. Also, we restrict our attention to H-interpretations, which can therefore be viewed as sets of domain atoms. The basic notion needed to split an ID-logic theory, is that of a dependence relation between domain atoms. Roughly speaking, such a relation is supposed to express which domain atoms Q(c) can influence whether an operator T∆O will derive a certain P (a) in a pair (X, Y ). We require that dependence relations are well-founded. Definition 7. A well-founded pre-order on domain atoms is called a dependence relation. We denote by E the set of all equivalence classes P (a) = {Q(c) | P (a) Q(c) and Q(c) P (a)}, together with the well-founded order , defined as P (a) Q(c) iff P (a) Q(c). Such a dependence relation now gives us a product lattice in which to study stratifiability of the operators T∆O . Recall that we can only apply the algebraic
300
J. Vennekens and M. Denecker
splitting results, if T∆O can be seen as operating on the square of some product lattice ⊗i∈I Li . It turns out that the product of the powersets of all equivalence E in E can give us such a lattice. We denote by S the lattice
classes E 2 . Now, S is isomorphic to the powerset of all domain atoms, which is E∈E in turn isomorpic to the set of all H-interpretations. An operator T∆O can there fore be seen as operating on the square of the set SO of all elements of S which extend O (or, more precisely, whose image under the appropriate isomorphism extends O). When dealing with the definition ∆even from Example 1, we will consider the obvious pre-interpretation HN with domain N. The set of domain atoms then consists of {Even(n) | n ∈ N} ∪ {Odd(n) | n ∈ N}. We will use the dependence relation consisting of: Odd(n) Even(n + 1) and Even(n) Odd(n + 1), for all n ∈ N. The fact that is well-founded follows from the fact that N is well-founded. The set E consists of the equivalence classes {Even(n) | n ∈ N} ∪ {Odd(n) | n ∈ N}, which are all singletons, i.e., for all n ∈ N, Even(n) = {Even(n)} and Odd(n) = {Odd(n)}. The relation consists of the pairs Even(n) Odd(n + 1) and Odd(n) Even(n + 1) with n ∈ N. Definition 8. A dependence relation stratifies a definition ∆ given an Ho interpretation O of Σ∆ iff the operator T∆O is a stratifiable approximation on the product lattice SO . In [DT04b], a dependence relation that stratifies a definition, is called a reduction relation. In case of our example, the dependence relation defined above stratifies ∆even . Now, the results presented in Section 3 can be used to show the equivalence of a definition ∆ and certain partitions of ∆. Definition 9. Let ∆ be a definition and let be a dependence relation. A partition {∆1 , . . . , ∆n } of ∆ is a -partition iff, for each 1 ≤ j ≤ n, if ∆j contains a rule defining a predicate P , then ∆j also contains all rules defining a predicate Q, for which there exist tuples a, c of domain elements, such that Q(c) ∈ P (a). In order to show the desired equivalence, we relate the concept of -partitions to that of recombinations. Proposition 4. Let ∆ be a definition, let be a dependence relation, and o {∆1 , . . . , ∆n } a -partition. Let O be an H-interpretation of Σ∆ , for some j O1 O2 O o , 1 ≤ j ≤ n. Then T∆j is equal to the recombination (T∆ )J , with O1 = O|Σ∆ o O2 = O|(Σ∆
j
o ), \Σ∆
and J = {P (a) | ∆j defines P }.
2 Proof. Let T∆Oj and (T∆O1 )O J be as above. We first note that an H-interpretation X extends O iff it extends O1 O2 . It now follows directly from the definitions of 2 the two operators, that T∆Oj = (T∆O1 )O J iff for all X, Y extending O, the following two statements are equivalent:
n – There exists a rule ∀x P (t) ← φ in ∆j , for which there exists a c ∈ HD , such that (X, Y )[x/c] |= φ.
An Algebraic Account of Modularity in ID-Logic
301
n – There exists a rule ∀x P (t) ← φ in ∆, for which there exists a c ∈ HD , such that (X, Y )[x/c] |= φ. d Because, for each P ∈ P∆ , ∆j contains precisely all rules from ∆ defining P , j this is the case.
As a direct consequence of this proposition and Theorem 2, we now have the following equivalence between a definition and its -partitions: Theorem 3. Let ∆ be a definition, a dependence relation, and {∆1 , . . . , ∆n } a -partition. Let O be a Σ-structure, such that stratifies ∆ given O. Then o = O|Σ o : for each Σ-structure S, such that S|Σ∆ ∆ S |= ∆ iff S |= ∆1 ∧ · · · ∧ ∆n . [DT04b] contains a theorem which corresponds to the restriction of this theorem to those cases where each ∆j is total given O. Our result is strictly more general. We can now use this result to split the example ∆even . Recall that above we already defined a dependence relation which stratifies ∆even . A corresponding -partition of ∆even is:
Even(0). ∆1 = ∀x Even(s(x)) ← Odd(x). ∆2 = ∀x Odd(s(x)) ← Even(x). Therefore, for every H-interpretation S, S |= ∆even iff S |= ∆1 ∧ ∆2 . We now characterize the components of the operators T∆O in more detail. (U,V ) Recall that a stratifiable operator T∆O has a component (T∆O )E for each level 2 E ∈ E and (U, V ) in (SO |≺E ) . Our goal is now to find a way of deriving some (U,V ) new definition ∆E from ∆, which characterizes such a component, i.e., such O (U,V ) that (T∆ )E = (U∆(U,V ) , U∆(V,U ) ). E E Intuitively, there are two main steps in constructing a component-definition (U,V ) ∆E . First, we need to ground ∆ w.r.t. to the set of domain atoms E. To do this, we need to assume domain closure, i.e., that for each a ∈ HD , there exists some term t of Σ, such that tH = a. Such a term is denoted a ˆ; for a tuple n ˆ. Roughly speaking, in the a = (a1 , . . . , an ) ∈ HD , we denote (ˆ a1 , . . . , a ˆn ) by a grounding step, a rule r should be replaced by all rules that can be obtained ˆ, such that by replacing the universally quantified variables x of r by some a the head of this new rule corresponds to a domain atom in E. Additionally, existential quantifiers also need to be eliminated; this can be done by replacing such a quantifier by a disjunction over all domain elements. In the following definition, the notation φ[x/y] is used to denote the result of substituting in φ every free occurence of a symbol x ∈ x by the corresponding symbol y ∈ y.
302
J. Vennekens and M. Denecker
Definition 10. Let ∆ be a definition, E ∈ E . For a rule (∀x A ← φ) ∈ ∆ a] and and domain tuple a, the rule ra is the rule A ← φ , with A = A[x/ˆ φ = γ(φ[x/ˆ a]), with γ defined as: – for each atom A, γ(A) = A; – γ(φ1 ∨ φ2 ) = γ(φ1 ) ∨ γ(φ2 ) and γ(¬φ) = ¬γ(φ); – γ(∃x φ) = a∈HD γ(φ[x/ˆ a]); The grounding rE of a rule r = (∀x P (t) ← φ) ∈ ∆, is the set of rules ra , H[x/a] with ) ∈ E. The grounding ∆E of ∆ is a a domain tuple, such that P (t r . E r∈∆ In a second step, we now replace ground atoms P (t) for which P (tH ) ≺ E, by their truth-value according to (U, V ); atoms such that P (tH ) ∈ E are left as they are. We make the small technical assumption that two predicate symbols T and F exist, such that T holds and F does not. Definition 11. Let ∆ be a definition, E ∈ E , and (U, V ) ∈ (SO |≺E )2 . For (U,V ) (U,V ) each rule r = (A ← φ) ∈ ∆E , we define r as the rule A ← δ (φ), with δ (U,V ) inductively defined as:
– for each atom A = P (t), such that P (tH ) ∈ E: δ (U,V ) (A) is T if (U, V ) |= A and F otherwise; – for each other atom A, δ (U,V ) (A) = A; – δ (U,V ) (φ1 ∨ φ2 ) = δ (U,V ) (φ1 ) ∨ δ (U,V ) (φ2 ); – δ (U,V ) (¬φ) = ¬δ (V,U ) (φ). (U,V )
We define ∆E
as {r(U,V ) | r ∈ ∆E }.
The proof of the following theorem is omitted, as it follows easily from the various definitions. Theorem 4. Let ∆ be a definition, E ∈ E , U, V ∈ SO |≺E , and O an Ho O (U,V ) O O (V,U ) interpretation of Σ∆ . Then (U∆ )E = U (U,V ) and (U∆ )E = U O(V,U ) . ∆E
∆E
Let us look again at definition ∆even from Example 1, with the obvious preinterpretation HN . If E = {Even(n + 1)} for some n ∈ N, then for all U, V ∈ (U,V ) S |≺E the component (T∆even )E is the constant function {Even(n + 1)} if U n ∈ Odd and the constant function {} otherwise. Similarly, for every level E = (U,V ) {Odd(n + 1)}, (T∆even )E is the constant function {Odd(n + 1)} if n ∈ EvenU and the constant function {} otherwise. The component (T∆even ){Even(0)} is the constant function {Even(0)}, while the component (T∆even ){Odd(0)} is the constant function {}. From this, it follows that there exists a unique model of ∆even extending HN , namely that which interprets Even by {n ∈ N | n is even} and Odd by {n ∈ N | n is odd}. While space restrictions prevent us from discussing this here, this characterization of the components of a stratifiable operator promises to be useful for the study of the relation between ID-logic and known classes of mathematical inductive definitions. For instance, we suspect that the class of well-founded inductions coincides precisely with the class of ID-logic definitions whose T∆O -operators can be split into constant components, as witnessed by the above example.
An Algebraic Account of Modularity in ID-Logic
5
303
Conclusions and Related Work
Our work extends that from [VGD04b, VGD04a] about algebraic modularity results. Firstly, we have extended these results to also allow operators to be split into recombinations, rather than components. Secondly, our work is the first to apply these results outside a propositional context. Our work also extends previous work on modularity properties for ID-logic [DT04b], by generalizing existing results in Theorem 3 and by the additional Theorem 4. It is interesting to note that, although in the context of ID-logic we are only interested in the well-founded fixpoints of the operators associated with definitions, our results also suffice to show a similar correspondence between their Kripke-Kleene and stable fixpoints. Indeed, this follows directly from the generality of the algebraic splitting theorem (Theorem 1). As such, our work actually also generalizes the results from [VGD04b], which in turn generalized part of the splitting theorem for the stable model semantics from [LT94]. The work presented here demonstrates that approximation theory and algebraic modularity results can be used to elegantly and easily derive useful results, even in a complex setting. In our opinion, it therefore offers quite a convincing testimony to the power of this approach.
References [Den01]
M. Denecker. Logic programming revisited: logic programs as inductive definitions. In ACM Transactions on Computational Logic, 2(4):623-654, 2001. [DMT00] M. Denecker, V. Marek, and M. Truszczynski. Approximating operators, stable operators, well-founded fixpoints and applications in non-monotonic reasoning. In Logic-based Artificial Intelligence, The Kluwer International Series in Engineering and Computer Science, pages 127–144, 2000. [DMT03] M. Denecker, V. Marek, and M. Truszczynski. Uniform semantic treatment of default and autoepistemic logics. Artificial Intelligence, 143(1):79–122, 2003. [DT04a] M. Denecker and E. Ternovska. Inductive situation calculus. In Principles of Knowledge Representation and Reasoning: Proceedings of the Ninth International Conference (KR2004), pages 545–553. AAAI Press, 2004. [DT04b] M. Denecker and E. Ternovska. A logic of non-monotone inductive definitions and its modularity properties. In 7th International Conference on Logic Programming and Nonmonotonic Reasoning, 2004. [GP92] M. Gelfond and H. Przymusinska. On consistency and completeness of autoepistemic theories. Fundamenta Informaticae, 16(1):59–92, 1992. [LT94] V. Lifschitz and H. Turner. Splitting a logic program. In Proceedings of the 11th International Conference on Logic Programming, pages 23–37, 1994. [VGD04a] J. Vennekens, D. Gilis, and M. Denecker. Splitting an operator: An algebraic modularity result and its application to auto-epistemic logic. In Proceedings of International Workshop on Non-Monotonic Reasoning, 2004. [VGD04b] J. Vennekens, D. Gilis, and M. Denecker. Splitting an operator: An algebraic modularity result and its applications to logic programming. In Logic Programming, 20th International Conference, ICLP 2004, Proceedings, volume 3132 of Lecture Notes in Computer Science, pages 195–209. Springer, 2004.
Default Reasoning with Preference Within Only Knowing Logic Iselin Engan1 , Tore Langholm1 , Espen H. Lian2 , and Arild Waaler2,3 1 2
Dept. of Linguistics, University of Oslo, Norway Dept. of Informatics, University of Oslo, Norway 3 Finnmark College, Norway
Abstract. The main construction in this paper is an encoding of default logic into an “only knowing” logic with degrees of confidence. By imposing simple and natural constraints on the encoding we show that the “only knowing” logic can accommodate ordered default theories and that the constrained encoding implements a prescriptive interpretation of preference between defaults. An advantage of the encoding is that it provides a transparent formal rendition of such a semantics. A feature of the construction is that the generation of extensions can be carried out within the “only knowing” logic, using object level concepts alone.
1
Introduction
Although default logic [16] is most widely studied among the consistency-based approaches to non-monotonic reasoning, a number of arguments have emerged in favour of an autoepistemic approach [15]. In autoepistemic logic, defaults are provided with a clear model-theoretic semantics, since they are represented by modal belief formulae, as opposed to rules. A further clarification of the semantics of autoepistemic logic was provided by Levesque’s introduction of “only knowing” logic [12], by which he achieved a clearer separation of the objectand meta-level parts of the modal language. Thus, in Levesque’s logic a notion of e.g. consistency of defaults receives a clear interpretation. Another advantage of an autoepistemic approach over standard default logic is that the underlying language can be extended to represent multi-agent reasoning. These arguments carry over to the debate on how to represent preference in non-monotonic reasoning. The notion of preference has been added to the framework of non-monotonic reasoning as one way of avoiding unintended ambiguities, known as the multiple extension problem. A preference order intuitively captures the idea that some defaults lead to more plausible conclusions than others. Two varieties of preference have been identified [5]: prescriptive, which “prescribes” the order in which to apply defaults, and descriptive, which is defined independently of application order. E.g. preferring the default p : q / q to the default : p / p, without further world beliefs, prescriptively yields no extension, because applying the more preferred default requires us to apply the less preferred default first. Descriptively, however, an extension including p and q is C. Baral et al. (Eds.): LPNMR 2005, LNAI 3662, pp. 304–316, 2005. c Springer-Verlag Berlin Heidelberg 2005
Default Reasoning with Preference Within Only Knowing Logic
305
accepted. This paper adopts a prescriptive interpretation, because descriptive approaches seem to require extra meta-level machinery [6]. In recent years, a number of approaches to handling preference have been proposed in terms of default logic [1,2,5,3]. In contrast, only a few approaches interpret preference in relation to autoepistemic logic [10,17]. Rintanen’s prioritized autoepistemic logic interprets preference descriptively, thus imposing a higher complexity on the system, while hierarchic autoepistemic logic (HAEL), introduced by Konolige, is prescriptive, and avoids this disadvantage. HAEL is founded on the idea of a hierarchy of beliefs. It gives a natural interpretation of prescriptive preference in autoepistemic logic because it captures the idea that some beliefs take precedence over others. In HAEL, the multiple extension problem is avoided in the sense that each theory gives rise to a unique extension. However, Konolige’s system fails to satisfy a number of evaluative principles that have recently emerged in the default literature [6] and which, e.g., the prescriptive semantics of preference satisfies. In light of these principles, HAEL is not a satisfactory approach to preference. One shortcoming is that a theory may in HAEL give rise to extensions that are not extensions of the underlying classical default theory. The system also violates the weak Principle I proposed by Brewka and Eiter [3], cf. Sect. 2.2 below. An even more unfortunate aspect of HAEL is its limited expressive power, a result of disallowing nested modalities. Thus, the notion of an agent reasoning about his own beliefs cannot be represented. Recently Levesque’s system has been generalized to the logic Æ of “only knowing” with degrees of confidence [13] which does not suffer from these shortcomings. The added expressive power is illustrated in [13] by a simple representation in Æ of supernormal defaults equipped with a preference relation. The computation of extensions is carried out at the object level by means of equivalence-preserving rewriting steps to yield a formula of a particularly simple form, from which the extensions of the theory are straightforwardly identified. In this paper we show that there is a translation of any ordered default theory with prescriptive semantics into Æ. A central idea underlying our work is that modalities can be used to control deduction. We here control deduction by assigning different modalities to different steps in the generation of an extension, and impose logical relationships between the modalities which reflect the intended interpretation of the modalities. This allows us to give a precise formal rendition of the semantics of prescriptive preference, characterized by the property of order-preservation from the approach of Delgrande and Schaub [5]. In contrast to the their approach, our formalization has the advantage that all aspects of the default theory are formulated entirely at the object level. Seeing that a substantial part of the reasoning used to generate extensions is captured within the logic itself, a higher degree of formalization is obtained. Another contribution of this work is that the semantics of prescriptive ordered defaults is expressed in a simpler and more transparent way than the technical encoding provided in the work of Delgrande and Schaub. The exact relation between autoepistemic logic and default logic is non-trivial and has been addressed in a number of studies [4,9,11,14,7]. From the results
306
I. Engan et al.
of Gottlob [8] we know that an autoepistemic representation of default logic cannot be both faithful and modular, hence a solution to this task is far from straightforward. This picture changes significantly when we instead represent ordered default theories in autoepistemic logic. Since our approach treats classical default theories as ordered theories with empty preference order, it follows that there is a simple translation of classical default logic into an autoepistemic system with language constructs representing different degrees of confidence.
2
Preliminaries
We will assume a propositional language over a finite set Φ of propositional variables, the Boolean constants ⊥ and , and the usual connectives. Formulae in this language are called purely Boolean. If S is a set of purely Boolean formulae, Th(S) denotes the closure of S under classical consequence. 2.1
Default Logic
A classical default theory is a pair (W, D) consisting of a set W of purely Boolean formulae and a finite set D of default rules or defaults. In a default δ = α : β / γ the prerequisite α is denoted pre(δ), the justification β is denoted just(δ), while cons(δ) is the consequent γ. Default theories induce zero or more extensions; for any (W, D) this notion is defined from the function Γ(W,D) which maps any set S of purely Boolean formulae to the smallest set E for which (1) W ⊆ E, (2) E = Th(E) and (3) γ ∈ E for each α : β / γ in D such that α ∈ E and ¬β ∈ S. Following Reiter [16] we say that the extensions of a classical theory ∆ = (W, D) are the fixed-points of Γ∆ , i.e. those S for which Γ∆ (S) = S. Extensions can also be characterized in a more constructive way along the following lines. Let (W, D) be a default theory; a generating sequence is a sequence u of defaults in D, not containing repetitions, such that for any δ ∈ D GS1 if sδ u then W ∪ cons(s) pre(δ) and W ∪ cons(u) ¬just(δ), and GS2 δ occurs in u if W ∪ cons(u) pre(δ) and W ∪ cons(u) ¬just(δ). Here, cons(u) is the set of consequents of defaults in u, while s u denotes that s is an initial segment of u. By sδ we mean the sequence s with δ added to the right. The next lemma is a straightforward consequence of Theorem 2.1 of [16]. Lemma 1. The extensions of (W, D) are the sets T h(W ∪ cons(u)) for generating sequences u. For sequences s of defaults we define formulae ψs by recursion as follows. ψε = W ψs cons(δ) if ψs pre(δ) and ψs ¬just(δ) ψsδ = ψs otherwise
Default Reasoning with Preference Within Only Knowing Logic
307
Hence T h(W ∪ cons(u)) = T h(ψu ) for any generating sequence u (or any initial segment of one) while T h(ψu ) in general (i.e., for arbitrary sequences of defaults) is only a subset of T h(W ∪ cons(u)). An enumeration1 t of D is felicitous if ψt pre(δ) and ψs ¬just(δ) together imply ψs pre(δ) and ψt ¬just(δ) whenever sδ t. This notion can be used to characterize extensions in a way similar to generating sequences, as seen in the next lemma, which follows as a special case of Lemma 3. Lemma 2. The extensions of (W, D) are the sets T h(ψt ) for felicitous enumerations t of D. 2.2
Ordered Default Theories
An ordered default theory is a structure (W, D, <) such that (W, D) is a classical default theory and < is a strict partial order on D. δ1 < δ2 intuitively expresses that δ1 is preferred to δ2 . The partiality of the preference relation is important as there are cases where the defaults are incomparable. Following Delgrande and Schaub [5], we define an extension of an ordered theory2 (W, D, <) as an order-preserving extension of the underlying classical default theory, where an extension E of (W, D) is defined to be order-preserving if there is a generating sequence u such that E = Th(ψu ), which satisfies the following conditions3 for each initial segment rδ u and each default δ ∈ D: O1 if δ < δ , then δ is not in r, O2 if δ < δ and ψu pre(δ ) and ψr ¬just(δ ), then δ is in r. O1 says that a less preferred default is never to be applied before a more preferred one, and O2 says (contrapositively) that if, at any point (r), the justification of a more preferred default (δ ) that has not yet been applied is still possible, and the prerequisite of this default is eventually believed, then a less preferred default (δ) shall not be used in the next step (rδ u). The next result says that this notion of extension is fully determined from its behaviour on strict linear orderings. Lemma 3. E is an extension of the ordered theory (W, D, <) iff E is an extension of (W, D, < ) for some strict total ordering < on D containing <. Proof. As < only occurs negatively in O1 and O2, the “if” direction is trivial. The “only if” direction assumes an arbitrary generating sequence u satisfying O1 1 2
3
An enumeration of D is a sequence without repetitions, containing all and only the elements of D. The authors interpret the preference relation ¡ in the opposite direction from what is done here, in accordance with the convention of answer set programming. We, on the other hand, follow the convention of [3]. It is worth noting that in the presence of O1, O2 is equivalent to a version with the weaker conclusion that δ is in u.
308
I. Engan et al.
and O2 with respect to <, and proceeds by construction of a strict linear order < extending <, with respect to which u still satisfies O1 and O2. To ensure this, < is chosen so that it agrees with the ordering of elements in u and also, whenever < allows, gives precedence to u-elements over non-u-elements.4
An enumeration of D satisfying O1 is said to be a topological sorting of (D, <). The encoding introduced in Sect. 3 relies on this notion; the soundness of the approach rests on the following observation. Lemma 4. The extensions of (W, D, <) are the sets Th(ψt ) for felicitous enumerations t of D which are also topological sortings of (D, <). Proof. The latter, alternative, notion of extension clearly satisfies the property of Lemma 3, hence it suffices to prove that the two notions coincide on any (W, D, <) where < is a strict linear ordering on D. For such (D, <) we can suppose that D = {δ1 , · · · , δn }, where δi < δj iff i < j. Now in the presence of O1 a generating sequence u is fully determined from the corresponding subset U of D, hence GS1 and GS2 can be rephrased to 1 and 2 below, while the additional content of O2 is represented by 3. 5 We suppose that δi = αi : βi /γi for all i. 1. δj ∈ U ⇒ (W ∪ {γi | δi ∈ U, i < j} αj & W ∪ {γi | δi ∈ U } ¬βj ), 2. δj ∈ U ⇐ (W ∪ {γi | δi ∈ U } αj & W ∪ {γi | δi ∈ U } ¬βj ), 3. δj ∈ U ⇐ (W ∪ {γi | δi ∈ U } αj & W ∪ {γi | δi ∈ U, i < j} ¬βj ). Now 3 of course implies 2, and it is easily checked that 1 and 3 in combination are equivalent to the implication from the right-hand side of 3 to the right-hand side of 1, in combination with the equivalence δj ∈ U ⇔ (W ∪ {γi | δi ∈ U, i < j} αj & W ∪ {γi | δi ∈ U, i < j} ¬βj ). Now recall that we are existentially quantifying over U ⊆ D. As δ1 · · · δn is the only topological sorting of D, we see that the two latter conditions (with U existentially quantified) precisely express that δ1 · · · δn is felicitous.
4
5
If u = δ1 · · · δn then for i = 0, . . . , n let Ai be {δ ∈ u | δ < δ1 ∨ · · · ∨ δ < δi } (hence A0 = ∅) while An+1 = {δ | δ ∈ u}, and for i = 1, . . . , n + 1 let Bi be Ai \ Ai−1 . Then let < be any strict, linear order containing <, such that all elements of B1 precede δ1 , which in turn precedes all elements of B2 , which all precede δ2 , etc. Inside each Bi , the defaults can be ordered in any way that agrees with <. The direct rendering of O2 (actually, the equivalent (modulo O1) version noted in footnote 3) is rather that if k > j for any δk ∈ U then δi ∈ U if W ∪{γi | δi ∈ U } αj and W ∪ {γi | δi ∈ U, i < k} ¬βj . If there are several such k, the implication obtained from the smallest one yields the corresponding implications for all larger, hence provided there is such a k > j for which δk ∈ U , O2 is equivalent to the condition 3’ below. δj ∈ U ⇐ (W ∪ {γi | δi ∈ U } αj & W ∪ {γi | δi ∈ U, i ≤ j} ¬βj ) If there is no such k, 3’ is equivalent to 2, hence in either case O2 is, in the presence of 2, equivalent to 3’. Finally, the falsifying conditions of 3 and 3’ are clearly identical.
Default Reasoning with Preference Within Only Knowing Logic
309
From properties noted below and the fact that any enumeration is a topological sorting for empty <, we see that Lemma 2 is a special case of Lemma 3. In the literature, approaches to adding preference to a non-monotonic logic have proved to yield very different results. Therefore, certain principles and properties that serve to evaluate an ordered logic have emerged. The following three principles follow easily from Lemma 2 and Lemma 4. – Classical Subset: Every extension of an ordered default theory (W, D, <) is an extension of the classical default theory (W, D). – Empty order : Every extension of the classical default theory (W, D) is an extension of the ordered default theory (W, D, ∅). – Inapplicable defaults: Any extension E of an ordered default theory (W, D, <) is also an extension of the ordered default theory (W, D ∪ {δ}, < ) if δ is a default such that pre(δ) ∈ E and < is a conservative extension of <. The first two principles were identified in [6]. The third was identified in [3] and is there referred to as Principle II. The corresponding Principle I can be formulated in the following way. Let E1 and E2 be two extensions of a classical default theory (W, D) and let u1 and u2 be generating sequences s.t. E1 = Th(W ∪ cons(u1 )) and E2 = Th(W ∪ cons(u2 )). Assume that, neglecting their intrinsic order, u1 and u2 only differ by the defaults δ1 and δ2 . If δ1 < δ2 , then E2 is not an extension of (W, D, <). This principle is easily seen to hold for our definition of extension: if E1 , E2 , u1 , u2 , δ1 , δ2 are as above and r1 , r2 are the sequences such that r1 δ1 u1 and r2 δ2 u2 then, as u1 is a generating sequence, we have W ∪ cons(r1 ) pre(δ1 ) and W ∪ cons(u1 ) ¬just(δ1 ). Now since every default in r1 is in u2 and every default in r2 is in u1 , we also infer W ∪ cons(u2 ) pre(δ1 ) and W ∪ cons(r2 ) ¬just(δ1 ). But then u2 is not order-preserving, since δ1 < δ2 and δ1 ∈ u2 . 2.3
The Logic Æ
The system Æ belongs to the family of “only knowing” logics. It generalizes the pioneering system of Levesque [12] to a language which allows us to represent various degrees of confidence for a doxastic subject. Æ is a special instance of the system Æρ introduced in [13] and further analysed and motivated in [20]. An interesting proof-theoretical property of Æ is that it has a sequent calculus formulation which admits constructive cut-elimination and hence cut-free proofs; this is shown in [18] for a generalization to a multi-agent language in which the beliefs of each subject are represented relative to different degrees of confidence. This section contains a review of the main concepts of Æ . The object language extends the language of purely Boolean formula by the addition of modal operators: (necessity) and modalities Bk (belief) and Ck (co-belief) for each k in a finite index set I. I comes along with a strict partial order . bk ϕ is defined as ¬Bk ¬ϕ and denotes that ϕ is compatible with belief at k. A formula ϕ is completely modalized if every occurrence of a propositional letter is within the scope of a modal operator.
310
I. Engan et al.
The intuitions behind the syntactical operators are discussed at length in [20]. In short, is intended to express personal necessities. The indices in I are intended to represent various degrees of confidence or conviction. Bk ϕ expresses that ϕ is believed with degree of confidence k; Ck ϕ expresses that ϕ is co-believed with degree of confidence k. The belief and co-belief operators are complementary. Ck ϕ expresses a notion of caution, and can generally be read as expressing that at most ¬ϕ is believed with degree of confidence k; or, what amounts to the same, that ¬ϕ is at least as strong as everything that is believed at k. The “all I know at k” expression Ok ϕ is central; it abbreviates Bk ϕ ∧ Ck ¬ϕ, meaning that precisely ϕ is believed with degree of confidence k. A formula of the form k∈I Ok ϕk is called an OI -block. If each ϕk is purely Boolean, the OI -block is said to be prime. An Æ -model M is a quadruple (U, U + , U − , V ). The universe U is a nonempty set of points; U + and U − are functions which assign a subset of U to each index in I. U + (k) is denoted Uk+ ; Uk− denotes U − (k). V is a valuation function which assigns a subset of U to each propositional letter in the language. For each k ∈ I, we require that Uk+ ∪ Uk− = U , expressing that while belief states may vary between degrees of confidence, the universe does not. We also require that greater confidence is never accompanied by stronger belief: Uk+ ⊆ Ui+ and Ui− ⊆ Uk− for each i k. Finally we require that U is Boolean saturated, i.e., that the following condition holds for every subset P of the propositional letters: there is a point x ∈ U such that for each propositional letter p, x ∈ V (p) iff p ∈ P . Informally, the points in U span the set of all propositional valuations. A satisfaction relation can be defined for each point x: M x p
iff x ∈ V (p), when p is any propositional letter
M x ϕ iff M y ϕ for each y ∈ U M x Bk ϕ iff M y ϕ for each y ∈ Uk+
M x Ck ϕ iff M y ϕ for each y ∈ Uk− and as usual for Boolean connectives. A formula is satisfied in a model if it is true at one of its points. If M x ϕ for all x ∈ U we write M ϕ and say that ϕ is true in M. If ϕ is true in all models, we also write ϕ. Note that all points in a model agree on the truth value of every completely modalised formula. Hence, for such formulae the notions of satisfiability and truth in a model coincide, and the notation M ϕ can be used to express either notion. We omit the easy proof of the following useful observation. Lemma 5. Let M satisfy Ok ϕ for an index k. 1. If M satisfies Ok ψ, then ϕ ≡ ψ is true at every point in M . 2. If ϕ and ψ are purely Boolean, M satisfies Bk ψ iff ϕ ψ and bk ψ iff ϕ ¬ψ. A model is bisected if, for each k ∈ I, Uk+ ∩Uk− = ∅. This is not a model condition. It is however, easy to prove that a model is bisected if it satisfies an OI -block.
Default Reasoning with Preference Within Only Knowing Logic
311
An axiom system for Æ is defined in [13].6 From here on denotes the provability relation of Æ (which extends the provability relation of classical logic). The following properties have been established for Æ [13,20]: – Soundness: if ϕ, then ϕ. – Completeness: if ϕ, then ϕ. – Decidability and the Finite model property: the logic is determined by the set of finite models. – The Modal Reduction Theorem: for each OI -block there is an m ≥ 0 as well I I as prime OI -blocks ψ1I , . . . , ψm such that ϕI ≡ (ψ1I ∨ · · · ∨ ψm ). A prime OI -block determines the belief state of the agent in a unique and transparent way. It is easy to show that all models of a prime OI -block are modally equivalent: they agree on the truth value of all completely modalised formulae. The models of a non-prime OI -block are in general not transparent; it requires some work to find them. A non-prime OI -block hence only implicitly defines the belief state. The Modal Reduction Theorem relates an implicit belief representation to an explicit representation by a provable equivalence. To determine whether m > 0 in the statement of the theorem is Σ2p -hard. If there is only one degree of confidence, Æ is equivalent to Levesque’s system of only knowing, for which there is a direct correspondence between a stable expansion in autoepistemic logic and a prime formula Oϕ. A prime OI -block is a natural generalization of the notion of stable expansion to an hierarchical collection of expansions.
3
Translating a Default Theory into Æ
3.1
The Basic Translation
In this section we define the mapping · of an ordered default theory (W, D, <) to a formula W, D, < of Æ . The index set I in the signature of Æ is the set of numbers 0, . . . , |D| and the order on I is the usual strict order on numbers. Let T be the set of topological sortings of (D, <); the formula W, D, < quantifies over initial segments of elements of T : W, D, < = W, Ds ∧ IC(t) t∈T st W, Ds = O|s| W∧ tr(rδ) rδs IC(t) = ((B|t| α ∧ b|s| β) ⊃ (B|s| α ∧ b|t| β)) sδt
Here we have used the notational convention of identifying δ with α : β / γ. The integrity constraint function IC corresponds exactly to the condition for a felicitous enumeration (cf. the proof of Lemma 7). The function served by tr 6
Æ is just the system Æρ in [13] with the characteristic formula ρ set to .
312
I. Engan et al.
is to map specific defaults. We shall first define one basic mapping and later introduce two alternative translations. The basic mapping is: tr(rδ) = (B|r| α ∧ b|r| β) ⊃ γ . The basic correctness result below relates the translation to formulae ψs studied in Sect. 2.1. Lemma 6. Let t be any enumeration of D. Then W, Ds ≡ O|s| ψs . st
st
Proof. We show, by induction on v, the more general result that for any v t, W, Ds ≡ O|s| ψs . sv
sv
The basis is trivial, as W, Dε = O0 W and ψε = W . For the induction step, it suffices to show that M W, Dsδ ≡ O|sδ| ψsδ for any Æ -model M satisfying both W, Ds and O|s| ψs . By Lemma 5(1), every such model M satisfies M( W∧ tr(rδ )) ≡ ψs . rδ s
Thus M W, Dsδ ≡ O|sδ| (ψs ∧ tr(sδ)). It only remains to show M O|sδ| (ψs ∧ ((B|s| α ∧ b|s| β) ⊃ γ)) ≡ O|sδ| ψsδ . But since M O|s| ψs , it follows directly from the definition of ψsδ and Lemma 5(2) that M B|s| α iff ψs α, and M b|s| β iff ψs ¬β, and we are done.
If s is an enumeration and W, Ds is proved equivalent to O|s| ψs , Th{ψs } is a potential extension of the underlying classical theory (W, D). The integrity constraint will, however, reduce to precisely when s is felicitous and reduce to ⊥ otherwise, as illustrated in the examples below. Example 1 (From [16]). Let W = ∅, D = {δ} and δ = : p / ¬p. As there is only one default, < is empty. W, D, < = W, Dε ∧ W, Dδ ∧ IC(δ), where W, Dε = O0 W, Dδ = O1 ( ∧ ((B0 ∧ b0 p) ⊃ ¬p)) IC(δ) = (B1 ∧ b0 p) ⊃ (B0 ∧ b1 p) By Lemma 6, W, D, < ≡ O0 ∧ O1 ¬p ∧ (b0 p ⊃ b1 p), thus W, D, < is inconsistent. This illustrates that the integrity constraints serve to exclude potential extensions. Example 2 (From [3,5]). Let W = ∅, D = {δ1 , δ2 , δ3 }, <= ∅, and δ1 =
:q q ,
δ2 =
:p p ,
and δ3 =
: ¬q p
.
Below are listed every enumeration and a simpler, equivalent form of the translation. Since the order < is empty, the entire translation is the disjunction of the translation for each enumeration in the table.
Default Reasoning with Preference Within Only Knowing Logic
t
st W, Dt
IC(t) Extension
δ1 δ2 δ3 δ1 δ3 δ2 δ2 δ1 δ3 δ2 δ3 δ1 δ3 δ1 δ2 δ3 δ2 δ1
O0 ∧ O1 q ∧ O2 (p ∧ q) ∧ O3 (p ∧ q) ∧ O0 ∧ O1 q ∧ O2 (p ∧ q) ∧ O3 (p ∧ q) ∧ O0 ∧ O1 p ∧ O2 (p ∧ q) ∧ O3 (p ∧ q) ∧ O0 ∧ O1 p ∧ O2 p ∧ O3 (p ∧ q) ∧ ⊥ O0 ∧ O1 p ∧ O2 (p ∧ q) ∧ O3 (p ∧ q) ∧ ⊥ O0 ∧ O1 p ∧ O2 p ∧ O3 (p ∧ q) ∧ ⊥ When t is any of the last three enumerations st W, Dt IC(δ2 δ3 δ1 ) b1 ¬q ⊃ b3 ¬q
313
and
Th{p, q} Th{p, q} Th{p, q} ¬IC(t), as
IC(δ3 δ1 δ2 ) ∨ IC(δ3 δ2 δ1 ) b0 ¬q ⊃ b3 ¬q.
It can be seen that these enumerations are not felicitous while the remaining are and moreover define the extensions in the rightmost column. Note that the entire translation entails O3 (p ∧ q), showing that Th{p, q} is the unique extension. If we change the order relation, the translation selects as disjuncts only the enumerations that are topological sortings of the order. Note that any order where δ3 < δ1 yields no extension, as this constraint rules out the first three enumerations. If we, on the other hand, use the order δ1 < δ3 , we get the same extensions as when δ1 and δ3 are unrelated. Restricting the order further has no impact on the extensions, as δ1 < δ2 < δ3 , δ1 < δ3 < δ2 and δ2 < δ1 < δ3 all yield the extension Th{p, q}. Example 3 (Nixon diamond). Let W = {q, r}, D = {δ1 , δ2 }, and δ1 = t
q:p p
st W, Dt
and δ2 =
r : ¬p ¬p
. IC(t) Extension
δ1 δ2 O0 (q ∧ r) ∧ O1 (q ∧ r ∧ p) ∧ O2 (q ∧ r ∧ p) ∧ δ2 δ1 O0 (q ∧ r) ∧ O1 (q ∧ r ∧ ¬p) ∧ O2 (q ∧ r ∧ ¬p) ∧
Th{p, q, r} Th{¬p, q, r}
If we let δ1 < δ2 , then δ2 δ1 ∈ T , thus the only extension is Th{p, q, r}. Similarly if we let δ2 < δ1 , the only extension is Th{¬p, q, r}. If the order is empty, the representation entails O2 (q∧r∧p)∨O2 (q∧r∧¬p), which is the Æ -representation of the corresponding two extensions. 3.2
Adequacy of Translation
The proof that the translation determines all and only order-preserving extensions follows straightforwardly from the previous results in the paper. Lemma 7. Let t be an enumeration of D. Then st W, Ds ∧ IC(t) is consistent in Æ iff t is a felicitous enumeration of D. Proof.Since IC(t) formalizes the condition for t being felicitous, it is immediate that st O|s| ψs and IC(t) are true in the same model iff t is felicitous. The result follows from this and Lemma 6.
314
I. Engan et al.
Lemma 8. The extensions of (W, D) are the sets T h(ψt ) for enumerations t of D such that st W, Ds ∧ IC(t) is consistent in Æ .
Proof. By Lemma 2 and Lemma 7.
Theorem 1. Let (W, D) be a default theory, n = |D|, and suppose for some m W, D, < ≡ Oi ϕji , 0≤j≤m 0≤i≤n
where all ϕji are purely Boolean and each disjunct 0≤i≤n Oi ϕji is Æ -consistent. Then {T h(ϕjn ) | 0 ≤ j ≤ m} is the set of extensions of (W, D, <).
Proof. By Lemma 4 and Lemma 8. 3.3
Alternative Translations
Prior attempts to relate default logic and autoepistemic logic gave rise to a variety of mappings from default rules to autoepistemic formulae. It has been a general conception that the different mappings allow different sets of extensions to be generated [4], and therefore that the choice of mapping would determine the degree of correspondence one would find. We now show that some mappings turn out to be equivalent in our encoding. This is due to the integrity constraint, which controls the impact a default may have on possible extensions. Such equivalences would seem to indicate that the differences between mappings are not as substantial as argued in the literature. The mapping tr used in the encoding is identical to that of the HAEL system [10]. We will study two mappings that are simple modifications of tr, defined by tr1 (rδ) = (α ∧ B|r| α ∧ b|r| β) ⊃ γ and tr2 (rδ) = (α ∧ B|rδ| α ∧ b|rδ| β) ⊃ γ , respectively. We now proceed to show that the lemmata of the previous section also hold for these two translations. Write W, D1s and W, D2s for the two alternative translation functions; we show that W, Ds ∧ IC(t) ≡ W, D1s ∧ IC(t) ≡ W, D2s ∧ IC(t) st
st
st
for any enumeration t of D. To see that the first equivalence holds, observe that a proof of Lemma 6 for the translation W, D1s would proceed precisely as the above proof of this lemma, until it remains to prove M O|sδ| (ψs ∧ ((α ∧ B|s| α ∧ b|s| β) ⊃ γ)) ≡ O|sδ| ψsδ under the assumption that M O|s| ψs . Now if M B|s| α, then ψs α, hence M O|sδ| (ψs ∧ ((α ∧ B|s| α ∧ b|s| β) ⊃ γ)) ≡ O|sδ| (ψs ∧ ((B|s| α ∧ b|s| β) ⊃ γ)).
Default Reasoning with Preference Within Only Knowing Logic
315
The rest of the proof then proceeds as originally. The equivalence between the two latter translations can be seen from the fact that for any ϕ both translations imply B|r| ϕ ⊃ B|s| ϕ and b|s| ϕ ⊃ b|r| ϕ whenever r s, hence in combination with IC(t) either translation implies the equivalence between tr1 and tr2 . Notice that the mapping tr2 is the one adopted by Chen [4]. He introduces this mapping in order find an autoepistemic correspondence of default theories (W, D) where W and the prerequisites of all δ ∈ D are conjunctions of literals. With this mapping, Lemma 8 shows the correspondence to all default theories.
4
Discussion and Future Work
This article presents a method for representing ordered default theories in modal logic by encoding these into formulae in Æ. We have shown that a classical default theory may be treated as a special case of an ordered default theory, and thus that the encoding is adequate for representing classical default reasoning. These results open up a number of possibilities for using the ideas and the toolbox of modal logic for interpreting reasoning with preference. The idea of having different steps in the generation of an extension correspond to distinct modalities has strong intuitive value in the sense that it provides support for the idea that the confidence in default beliefs are relative to the number of defaults that have been tested. To conclude something by default is one way of restricting the set of worlds or situations that one considers to be plausible, and thereby be subject to a greater risk of error. The representation of this idea does not have a counterpart in the framework of default logic. There are many interesting variants and extensions of the encoding to consider. In section 3.3 above, alternative, equivalent translations were discussed, but there is also room for a discussion and comparison of translations corresponding to alternative notions of an ordered default theory. Furthermore we have, up until now, only dealt with the idea of static preference, i.e. preferences that are fixed in every circumstance. For the future, we plan to encompass the idea of dynamic preference as well. Many preferences are context independent, especially within the field of medical and legal reasoning. Dynamic preference may not be encoded in the current translation. Handling dynamic preferences presupposes that preferences may be subject to reasoning, thus we need to represent preferences at the object level. Making preferences objects of reasoning could provide many interesting perspectives on default reasoning. The system Æ has been generalized to a multi-agent logic [18,19]. Understanding default reasoning in multi-agent contexts is a task that we will work on in the future. It would be fruitful to consider the idea of static preference also in the multi-agent case. This way the idea of an agent having beliefs about the preferences of other agents might be represented. Another idea that we want to develop further is that of constraining reasoning by excluding some possible worlds from the set of conceivable worlds. This restriction would provide us with an even more fine-grained method for selecting the most plausible extensions. The Æ framework [20] is defined so that any
316
I. Engan et al.
nonempty sets of points can serve as universe, allowing a flexible representation of the idea of personal necessity. Of course, such restrictions would go beyond the ideas of classical default logic.
References 1. Baader F., Hollunder B.: How to Prefer More Specific Defaults in Terminological Default Logic. Technical Report RR-92-58, DFKI, December 1993 2. Brewka, G.: Adding priorities and specificity to default logic. In JELIA 1994, Proceedings, LNAI 838, Springer, pages 247–260 3. Brewka, G., Eiter, T.: Prioritizing Default Logic. In St. H¨ olldobler, editor: Intellectics and Computational Logic. Papers in Honor of Wolfgang Bibel. Kluwer Academic Publisher, 2000 4. Chen, J.: The Logic of Only Knowing as a Unified Framework for Non-monotonic Reasoning. ISMIS ’93, Proceedings, Lecture Notes in Computer Science 689 (1993) 152–161 5. Delgrande, J. P., Schaub, T.: Expressing Preferences in Default Logic. Artificial Intelligence 123 (2000) 41–87 6. Delgrande, J. P., Schaub, T., Tompits, H., Wang, K.: A Classification and Survey of Preference Handling Approaches in Nonmonotonic Reasoning. Computational Intelligence 20(2) (2004) 308–334 7. Denecker, M., Marek, V. W., Truszczynski, M.: Uniform semantic treatment of default and autoepistemic logics. Artificial Intelligence 143 (2003) 79–122 8. Gottlob, G.: Complexity Results for Nonmonotonic Logics. Journal of Logic and Computation 2 (1992) 397–425 9. Gottlob, G.: Translating Default Logic into Standard Autoepistemic Logic. J. ACM 42(4) (1995) 711–740 10. Konolige, K.: Hierarchic Autoepistemic Theories for Nonmonotonic Reasoning. Pages 439–443 of Proceedings of the Seventh National Conference on Artificial Intelligence (AAAI’88). Morgan Kaufmann Publishers 11. Konolige, K.: On the relationship between default and autoepistemic logic Artificial Intelligence 35 (1988) 343–382 12. Levesque, H. J.: All I know: A study in autoepistemic logic. Artificial Intelligence 42 (1990) 263–309 13. Lian, E. H., Langholm, T., Waaler, A.: Only Knowing with Confidence Levels: Reductions and Complexity. In JELIA 2004, Proceedings, LNAI 3229, Springer, pages 500–512 14. Marek, V. W., M. Truszczynski, M.: Nonmonotonic logics; context dependent reasoning. Springer Verlag. 1993 15. Moore, R.: Semantical Considerations on Nonmonotonic Logic. Artificial Intelligence 25 (1985) 75–94 16. Reiter, R.: A logic for default reasoning. Artificial Intelligence 13 (1980) 81–132 17. Rintanen, J.: Prioritized autoepistemic logic. In JELIA 1994, Proceedings, LNAI 838, Springer, pages 232–246 18. Waaler, A.: Consistency proofs for systems of multi-agent only knowing. To appear in Advances in Modal Logic, Volume 5. 19. Waaler, A., Solhaug, B.: Semantics for multi-agent only knowing (extended abstract). In Proceedings of TARK X (2005), ACM Digital Library, pages 109–125 20. Waaler, A., Kl¨ uwer, J. W., Langholm, T., Lian, E.: Only Knowing with Degrees of Confidence. To appear in the Journal of Applied Logics. with Degrees of Confidence. Submitted for publication.
A Social Semantics for Multi-agent Systems Francesco Buccafurri and Gianluca Caminiti DIMET, Universit` a degli Studi Mediterranea di Reggio Calabria, via Graziella, loc. Feo di Vito, I-89060 Reggio Calabria, Italy {bucca, gianluca.caminiti}@unirc.it
Abstract. As in human world many of our goals could not be achieved without interacting with other people, in case many agents are part of the same environment one agent should be aware that he is not alone and he cannot assume other agents sharing his own goals. Moreover, he may be required to interact with other agents and to reason about their mental state in order to find out potential friends to join with (or opponents to fight against). In this paper we focus on a language derived from logic programming which both supports the representation of mental states of agent communities and provides each agent with the capability of reasoning about other agents’ mental states and acting accordingly. The proposed semantics is shown to be translatable into stable model semantics of logic programs with aggregates.
1
Introduction
Beside autonomy, agents [16,15] may be required to have social ability, which is the capability of interacting with other self-interested agents and, as a consequence, producing beliefs, desires and intentions (BDI) [2,3] which may be dependent on such interactions. Social ability means not only using a common language for agent communication. In this respect, KQML [13] and FIPA ACL [7], both based on the speech act theory by Cohen and Levesque [6], represent the main efforts done in the last years. Another important issue is reasoning about the content of such a communication [15,14,11]. In this paper we focus on a language derived from logic programming which both supports the representation of mental states of agent communities and provides each agent with the capability of reasoning about other agents’ mental states and acting accordingly. Consider the following example: There are four agents which have been invited to the same wedding party. Some agents are less autonomous than the others, i.e. they may decide either to join the party or not to go at all, possibly depending on the other agents’ choice. Moreover some agents may tolerate some options. These are the desires of the agents: Agent1 will go to the party only if at least the half of the total number of agents (not including himself) goes there.
This work was partially supported by WASP (Working Group on Answer Set Programming) IST-2001-37004, 5th framework programme, Information Society Technologies, Action Line FET (Future and emerging technologies).
C. Baral et al. (Eds.): LPNMR 2005, LNAI 3662, pp. 317–329, 2005. c Springer-Verlag Berlin Heidelberg 2005
318
F. Buccafurri and G. Caminiti
Agent2 possibly does not go to the party, but he tolerates such an option. In case he goes, then he possibly drives the car. Agent3 would like to join the party together with Agent2 , but he is not so much safe with Agent2 ’s driving skill. Thus he decides to go to the party only if Agent2 both goes there and does not want to drive the car. Agent4 does not go to the party. It is possible to represent the above desires using logic programming with negation as failure (not) where each agent is represented by a single program and requested/desired items (representing the mental state of the agent) are modelled as atoms occurring inside rule heads. In particular, mandatory items are modelled as facts. Moreover, it is possible to represent tolerated items, i.e. items which are not requested, but possibly accepted. To this aim we use the predicate okay(), previously introduced in [5]. However, representing the requests/acceptances of single agents in a community is not enough. A social language should provide also a machinery to handle compromises among those agents. Thus, we introduce a new construct providing one agent with the ability to reason about other agents’ mental state and then to act accordingly. Program rules may have the form: head ← [selection condition]{body},
(1)
where selection condition predicates about some social condition concerning either the cardinality of communities or particular individuals satisfying body. For instance, consider the following rule, belonging to a program representing a given agent A: a ← [ l , h ] {b, not c}. This rule means that A will require a only if n agents (other than A) exist such that they require or tolerate b, do not require or tolerate c and it holds that 0 ≤ l ≤ n ≤ h ≤ nagent − 1, where nagent is the total number of agents1 . This enriched language is referred to as SOcial Logic Programming (SOLP). The wedding party example above may be represented by the four SOLP programs shown in Table 1, where the program P4 is empty since the corresponding agent has not any desire to express. The intended models must represent the mental states of each agent inside the community. For instance, the agents’ choices w.r.t. the party can be: {}, {go weddingP1 , go weddingP2 , driveP2 }, and {go weddingP1 , go weddingP2 , go weddingP3 }, where the subscript Pi (1 ≤ i ≤ nagent ) references, for each atom in a model, the program (resp. agent) that atom is entailed by. The models respectively mean that either (i) no agent will go to the party, (ii) only Agent1 and Agent2 will go and also Agent2 will drive the car, or (iii) all agents but Agent4 will go to the party. Indeed, Agent4 anyway does not go. On the one hand, if Agent2 does not go to the party, then Agent3 will do the same. Now, let n be the number of agents which are going to the party, it is n = 0. Agent1 requires that at 1
By default, l = 0 and h = nagent − 1.
A Social Semantics for Multi-agent Systems
319
Table 1. The wedding party example
P1 (Agent1 ) : go wedding ← [
nagent 2
− 1, ]{go wedding}
P3 (Agent3 ) : go wedding ← [Agent2 ]{go wedding, not drive}
n
P2 (Agent2 ) : okay(go wedding) ← okay(drive) ← go wedding P4 (Agent4 ) : empty program
least ν = agent − 1 agents (other than himself) go to the party, but since it is 2 ν = 42 − 1 = 1 and n < ν, then Agent1 does not go to the party (case (i)). On the other hand, if Agent2 goes to the party, it is possible that he wants either to drive the car or not. If he wants to drive, then Agent3 will not join the party. Now, it is n = 1 = ν, then Agent1 will go to the party (case (ii)). Otherwise, if Agent2 does not want to drive the car, then all conditions required by Agent3 are satisfied, thus he will go to the party. Now, it is n = 2 > ν and then Agent1 will join the party too (case (iii)). The intended models are referred to as social models, since they express the results of the interactions among agents. Our work is strongly related to [5], where the Joint Fixpoint Semantics (JFP), that is a semantics providing a way to reach a compromise (in terms of a common agreement) among many agents, is proposed. Therein, each model contains atoms representing items being common to all the agents. Our paper extends such a semantics, providing feature-selective atom subset community, i.e. given a set S of SOLP programs representing a community of agents, a program P ∈ S and a rule r ∈ P of the form head ← [selection condition]{body}, then head will belong to an intended model if all properties enclosed in {body} are entailed by either (i) any subset S ⊆ (S \ {P}) of programs with a given cardinality (specified by [selection condition]) or (ii) some particular program different from P. An example of case (i) is shown in Table 1 by the program P1 : An intended model M will include the atom go weddingP1 if a set of programs S ⊆ n {P2 , P3 , P4 } exists such that ∀Pi ∈ S , go weddingPi ∈ M and |S | ≥ agent − 1. 2 An example of case (ii) is represented by the program P3 , which requests the atom go weddingP3 to be part of an intended model M if go weddingP2 belongs to M , but the atom driveP2 does not. Importantly, social constraints can be nested. Consider for example the program: download(X)←[min, ]{shared(X), [1, ]{not incomplete(X)}}, file(X). This program represents a Peer-to-Peer file-sharing system where a user can share his collection of files with other users on the Internet. In order to get better performances, a file is split into several parts being downloaded separately (possibly
320
F. Buccafurri and G. Caminiti
each part from a different user)2 . Thus, the program describes the behavior of an agent (acting on behalf of a given user) that wants to download any file X being shared by at least a number min of users such that at least one of them owns a complete version of X. We show also that, given a set of SOLP programs in input, a source-to-source transformation is possible which provides as output a single DLPA [8] program whose stable models are in one-to-one correspondence with the intended ones. We recall that DLPA is basically disjunctive logic programming with aggregate functions, supported by the DLV system [9]. The translation to DLPA give us the ability of exploiting DLV (widely accepted as the state-of-the-art system implementing disjunctive logic programming)3 . Observe that since our language includes neither disjunction nor classical negation (even though the extensions to these cases could be considered), both disjunction and classical negation of DLPA are never enabled by our translation. Moreover, Section 5 shows that our kind of social reasoning is not trivial, since even in the case of positive programs, the semantics of SOLP has a computational complexity which is NP complete. The paper is organized as follows: in Sections 2 and 3 we respectively define the notion of SOLP programs and define their semantics (Social Semantics). In Section 4 we illustrate how a set of SOLP programs, each representing a different agent, is translated into a single DLPA logic program whose stable models describe the mental states of the whole agent community and then we show that such a translation is correct. In Section 5 we prove that the Social Semantics extends the JFP Semantics [5] and we study the complexity of the problem of searching for a social model. In Section 6 we describe how this novel approach may be used for knowledge representation and finally, we draw our conclusions. For space restrictions, proofs of theorems and lemmata are omitted. They can be found in [4].
2
Social Logic Programs: Basic Definitions
In this section we introduce the notion of SOLP program. A term is either a variable or a constant. An atom or positive literal is an expression p(t1 , · · · , tn ), where p is a predicate of arity n and t1 , · · · , tn are terms. A negative literal is the negation as failure (NAF) not a of a given atom a. Definition 1. A (n-)social selection constraint s, said also (n-)SSC, is an expression of the form cond (s) property(s), such that: (1) cond (s) is an expression [α] where α is either (i) a pair of integers l, h such that 0 ≤ l ≤ h ≤ n−1, or (ii) an integer belonging to {1, · · · , n} said program identifier4 . 2 3 4
Among others, KaZaA, EDonkey, WinMX and BitTorrent are the most popular Internet P2P file-sharing systems exploiting such a feature. Of course, our approach may easily be adapted to other systems supporting cardinality constraints, such as Smodels. We will show, at the end of the section, that the program identifier uniquely identifies a program (i.e., an agent).
A Social Semantics for Multi-agent Systems
321
(2) property(s) = content(s) ∪ skel (s), where content(s) is a non-empty set of literals and skel (s) is a (possibly empty) set of SSCs. Concerning item (1) of the above definition, in case (i), cond (s) is said cardinal selection condition, while, in case (ii), cond (s) is said member selection condition. n-social selection constraints operate over a collection of n programs (we will formally define later in this section which kind of program are allowed). Thus, with a little abuse of notation, we often denote a member selection condition by [Pj ] instead of [j]. Concerning item (2) of Definition 1, if skel (s) = ∅ then s is said simple. For a simple SSC s such that content(s) is singleton, the enclosing braces can be omitted. Finally, given a SSC s, the formula not s is said the NAF of s. In our initial wedding party example, [ nagent − 1, ]{go wedding} and [Agent2 ] 2 {go wedding, not drive} are two simple SSCs. On the contrary, the SSC occurring in the example regarding a Peer-to-Peer system (see Page 319) is not simple. As a further example, if s = [l, h]{a, b, c, [l1 , h1 ]{d, [l2 , h2 ]e}, [l3 , h3 ]f }, then s is not simple, content(s) = {a, b, c} and skel (s) = {[l1 , h1 ]{d, [l2 , h2 ]e}, [l3 , h3 ]f }. Now we define a function which returns, for a given SSC s, its nesting depth. Given a SSC s, we define the function depth as follows: depth(s) = depth(s ) + 1, if ∃s | s ∈ skel (s ) depth(s) = 0, otherwise. Given two SSCs s and s such that cond (s) = [l, h] and cond (s ) = [l , h ], i.e. they are cardinal selection conditions, we say that cond (s ) ⊆ cond (s) if h ≤ h. A SSC s is well-formed if either (i) s is simple, or (ii) s is not simple, cond (s) is a cardinal selection condition and ∀s ∈ skel (s) it holds that: (a) If cond (s ) is a cardinal selection condition, then s is well-formed and cond (s ) ⊆ cond (s); (b) If cond (s ) is a member selection condition, then s is simple. From now on, we consider only well-formed SSCs. Example 1. The SSC s = [1, 8]{a, [3, 6]{b, [AgentX ]{c, d}}} is well-formed, while s1 = [4, 7]{a, [3, 9]b} is not a well-formed SSC, because [3, 9] ⊆ [4, 7]. We introduce now the notion of rule. Our definition generalizes the notion of classical logic rule. Definition 2. A (n-)social rule r is a is a formula a ← b1 ∧ · · · ∧bm ∧s1 ∧ · · · ∧sk (m ≥ 0, k ≥ 0), where a is an atom, each bi (1 ≤ i ≤ m) is a literal and each sj (1 ≤ j ≤ k) is either a n-SSC or the NAF of a n-SSC. The atom a is said the head of r, while the conjunction b1 ∧ · · · ∧bm ∧s1 ∧ · · · ∧sk is said the body of r. In case a is of the form okay(p), where p is an atom, then r it is said (n-)tolerance (social) rule and p is said the head of r. In case k = 0, a social non-tolerance rule is said classical rule.
322
F. Buccafurri and G. Caminiti
Given a rule r, we denote by head (r) (resp. body(r)) the head (resp. the body) of r. Moreover, r is said a fact in case the body is empty, while r is said an integrity constraint if the head is missing. Definition 3. A SOLP collection is a set {P1 , · · · , Pn } of SOLP programs, where each SOLP program is a set of n-social rules. The cardinal i (1 ≤ i ≤ n) is called program identifier of the program Pi . A SOLP program is positive if no NAF symbol not occurs in it. For the sake of presentation we only refer, in the following sections, to ground (i.e., variable-free) SOLP programs – the extension to the general case is straightforward.
3
Semantics of SOLP Programs
In this section we introduce the Social Semantics, i.e. the semantics of a collection of SOLP programs. We assume the reader is familiar with the basic concepts of logic programming [1,12]. We start by introducing the notion of interpretation for a single SOLP program (note that this is the same as for classical programs). An interpretation for a ground SOLP program P is a subset of V ar(P), where V ar(P) is the set of atoms appearing in P. A positive literal a (resp. a negative literal not a) is true w.r.t. an interpretation I if a ∈ I (resp. a ∈ / I); otherwise it is false. A rule is satisfied (or is true) w.r.t. I if its head is true or its body is false w.r.t. I. Before defining the intended models of our semantics, we need some preliminary definitions. Let P be a SOLP program. We define the autonomous reduction of P, denoted by AP, the program obtained from P by removing all the SSCs from the rules in P. Thus, if the program P represents the social behavior of an agent, then AP represents the behavior of the same agent in case he decides to operate independently of the other agents. Given a SOLP program P and an interpretation I ⊆ V ar(AP), let CL(AP) (resp. TR(AP)) be the set of classical (resp. tolerance) rules in AP. The autonomous immediate consequence operator ATP is the function from 2V ar(AP) to 2V ar(AP) defined as follows: ATP (I) = {head (r) | ∀r ∈ CL(AP), body(r) is true w.r.t. I} ∪ {head (r) | ∀r ∈ T R(AP), body(r) ∧ head (r) is true w.r.t. I}. Definition 4. An interpretation I for a SOLP program P is an autonomous fixpoint of P if I is a fixpoint of the associated transformation ATP , i.e. if ATP (I) = I. The set of all autonomous fixpoints of P is denoted by AF P (P). Thus, the autonomous fixpoints of a given SOLP program P represent the mental states of the corresponding agent, whenever every social constraint in P is discarded. Definition 5. Let P be a SOLP program and L be a set of literals. The labeled version of L w.r.t. P is the set LP = {aP | a ∈ L}.
A Social Semantics for Multi-agent Systems
323
Let C = {P1 , · · · , Pn } be a SOLP collection. A social interpretation for C is a set I¯ = IP1 1 ∪ · · · ∪ IPnn , where I j is an interpretation for Pj (1 ≤ j ≤ n). Example 2. If C = {P1 , P2 , P3 }, I 1 = {a, b, c}, I 2 = {a, d, e} and I 3 = {b, c, d}, where I j is an interpretation for Pj (1 ≤ j ≤ 3), then I¯ = {aP1 , bP1 , cP1 , aP2 , dP2 , eP2 , bP3 , cP3 , dP3 } is a social interpretation for C. Let C = {P1 , · · · , Pn } be a SOLP collection and P ∈ C. Given a social interpretation I¯ for C, a positive literal a ∈ V ar(P) (resp. a negative literal ¯ otherwise it is false. not a) is true w.r.t. I¯ if aP ∈ I¯ (resp. aP ∈ / I); Before giving the definition of truth for a SSC, we introduce a way to reference any SSC s (and also every SSC nested in s) occurring in a given rule r of a SOLP program P. Given a SOLP program P, a social rule r ∈ P and an integer n ≥ 0, we define the set M SSC P,r,n = {s | s is a SSC occurring in r ∈ P ∧ depth(s) = n}. Observe that M SSC P,r,0 denotes the set of SSCs as they appear in the rule r of the SOLP program P. Example 3. Let a ← [1, 8]{a, [3, 6]{b, [AgentX ]{c, d}}}, [2, 3]{e, f } be a rule r in a SOLP program P. Then: M SSC P,r,0 M SSC P,r,1 M SSC P,r,2 M SSC P,r,3
= { [1, 8]{a, [3, 6]{b, [AgentX ]{c, d}}}, [2, 3]{e, f } }, = { [3, 6]{b, [AgentX ]{c, d}} }, = { [AgentX ]{c, d} }, = ∅.
Given a SOLP program P, we define the set M SSC P =
M SSC P,r,0 .
r∈P
Thus M SSC P is the set of all the SSCs (with depth 0) occurring in P. Now we provide the definition of truth of a SSC w.r.t. a given social interpretation and, subsequently, the definition of truth of a social rule. Definition 6. Let C = {P1 , · · · , Pn } be a SOLP collection, C ⊆ C and Pj ∈ C . Given a social interpretation I¯ for C and a n-SSC s ∈ M SSC Pj , we say that s is true in C w.r.t. I¯ if it holds that either: (1) cond (s) = [k] ∧ ¯ or ∃Pk ∈ C | ∀aPk ∈ (content(s))Pk a is true w.r.t. I, (2) cond (s) = [l, h] ∧ ∃D ⊆ C \ {Pj } | l ≤ |D| ≤ h ∧ ∀aP ∈ P∈D (content(s))P a is true w.r.t. I¯ ∧ ¯ ∀s ∈ skel (s) ∃D ⊆ D | s is true in D w.r.t. I, where l, h and k are integers (observe that k is a program identifier). If C = C, ¯ A n-SSC not true (in C ) w.r.t. I¯ is then we simply say that s is true w.r.t. I. ¯ said false (in C ) w.r.t. I. Finally, the NAF of a n-SSC s, not s, is said true (resp. false) (in C ) w.r.t. ¯ ¯ I if s is false (resp. true) (in C ) w.r.t. I. Thus, given a SSC s included in Pj , s is true w.r.t. a social interpretation I¯ if a single SOLP program corresponding to a program identifier k (resp. a set of
324
F. Buccafurri and G. Caminiti
SOLP programs) exists (resp. not including Pj ) such that all the elements in ¯ Observe that the truth of property(s) w.r.t. I¯ is property(s) are true w.r.t. I. possibly defined recursively, since s may contain nested SSCs. Once the notion of truth of SSCs has been defined, we are able to define the notion of satisfaction of a social rule w.r.t. a social interpretation. Let C = {P1 , · · · , Pn } be a SOLP collection and P ∈ C. Given a social interpretation I¯ for C, a social rule in P is satisfied (or is true) w.r.t. I¯ if its ¯ head is true w.r.t. I¯ or its body is false w.r.t. I. Given a SOLP collection {P1 , · · · , Pn }, we define the set of candidate social interpretations for P1 , · · · , Pn as U(P1 , · · · , Pn ) = FP11 ∪ · · · ∪ FPnn | F i ∈ AF P (Pi ), 1 ≤ i ≤ n . where, recall, AF P (Pi ) is the set of autonomous fixpoints of the SOLP program Pi , introduced in Definition 4 and by FPi (1 ≤ i ≤ n) we denote the labeled version of F i w.r.t. P (see Definition 5). U(P1 , · · · , Pn ) represents all the configurations obtained by combining the autonomous (i.e. without considering the social constraints) mental states of the agents corresponding to the programs P1 , · · · , Pn . Each candidate social interpretation is a candidate intended model. The intended models are then obtained by enabling the social constraints. Now, we are ready to give the definition of intended model w.r.t. the Social Semantics. Definition 7. Given a SOLP collection C = {P1 , · · · , Pn }, a candidate social ¯ ¯ interpretation I for C is a social model of C if ∀r ∈ Pi , r is true w.r.t. I. 1≤i≤n
Definition 8. Given a SOLP collection {P1 , · · · , Pn }, the Social Semantics (often referred to as S-Semantics) of P1 , · · · , Pn is the set ¯ |M ¯ ∈ U(P1 , · · · , Pn ) ∧ M ¯ is a social model of P1 , · · · , Pn }, SOS(P1 , · · · , Pn ) = {M
Thus SOS(P1 , · · · , Pn ) is the set of all social models of P1 , · · · , Pn . Given a SOLP collection C = {P1 , · · · , Pn } and a SOLP program P ∈ C, we define the S-Semantics of P as ¯ ∈ SOS(P1 , · · · , Pn ) | FP ⊆ M ¯ }, S(P) = {F | F ∈ AF P (P) ∧ ∃M Hence S(P) represents the autonomous mental states of an agent, corresponding to a SOLP program P, which are also included in some social model of P1 , · · · , Pn , and then fulfill all social requirements.
4
Translation
In this section we give the translation from SOLP under the Social Semantics to DLPA [8] under Stable Model Semantics. We assume that the reader is familiar with the Stable Model Semantics [10]. Given a classical logic program P, we denote by SM (P) the set of all the stable models of P.
A Social Semantics for Multi-agent Systems
Given a SOLP program P, we define the set U SSC P =
325
M SSC P,r,n .
r∈P n≥0
Thus, U SSC P includes all the SSCs (at any nesting depth) in P. Given a SOLP program P, we define the functions ρ and g, each establishing a one-to-one correspondence between each element in U SSC P and a set of atoms L such that both (i) L ∩ V ar(P) = ∅ and (ii) ∀s, t ∈ U SSC P , ρ(s) = g(t). Thus, given a SSC s included in a SOLP program P, ρ(s) is a unique positive literal identifying s and we denote by (ρ(s))P the labeled version of ρ(s) w.r.t. P. Similar considerations hold for g(s). Moreover, with a little abuse of notation we write (g(s))P (x) denoting the labeled version of the predicate (g(s))(x) w.r.t. P. Now we introduce the translation of a single SSC and then we extend such a translation to all SSCs included in a social rule, a SOLP program and a SOLP collection, respectively. Definition 9. Given a SOLP collection {P1 , · · · , Pj , · · · , Pn } and s ∈ U SSC Pj , we define the translation of s as the DLPA program Ψ Pj (s) = GUESS Pj (s) ∪ CHECK Pj (s), where GUESS Pj (s) =
⎧ {(g(s))Pj (k) ← b∈content(s) bPk }, if cond (s) = [k ], ⎪ ⎪ ⎪ ⎪ ⎪
⎪ ⎨ {(g(s))Pj (i) ← b∈content(s) bPi ∧
= ⎪ s ∈skel(s) (g(s ))Pj (i) | ⎪ ⎪ ⎪ ⎪ 1 ≤ i = j ≤ n} ∪ ⎪ ⎩ if cond (s) = [l , h], {GUESS Pj (s ) | s ∈ skel(s)}, and CHECK Pj (s) = ⎧ ⎪ ⎪ {(ρ(s))Pj ← (g(s))Pj (k)}, ⎨ =
if cond (s) = [k ],
{(ρ(s))Pj ← l ≤ #count{K : (g(s))Pj (K), K = j} ≤ h} ∪ ⎪ ⎪ ⎩ {CHECK Pj (s ) | s ∈ skel(s)}, if cond (s) = [l , h],
where #count is an aggregate function which returns the cardinality of a set of literals satisfying some conditions [8]. Observe that the above translation produces a safe aggregate-stratified DLPA program and thus the computational complexity remains the same as for standard DLP [8,9]. Given a SOLP program Pj and a social rule r ∈ Pj , we define the SSC translation of r as the DLPA program T Pj (r) = s∈M SSC P,r,0 Ψ Pj (s). Observe that, for any classical rule r ∈ Pj , it holds that T Pj (r) = ∅. Given a SOLP program Pj , the SSC translation of Pj is the DLPA program W Pj = r∈Pj T Pj (r). Definition 10. Given a SOLP collection {P1 , · · · , Pn }, we define the SSC translation of the collection as the DLPA program C(P1 , · · · , Pn ) = 1≤i≤n W Pi . Thus C(P1 , · · · , Pn ) is a DLPA program representing the translation of all the SSCs included in P1 , · · · , Pn .
326
F. Buccafurri and G. Caminiti
We have defined above the translation for the SSCs included in a SOLP program. Now we give the translation for the whole SOLP program, but first we need a preliminary processing of all tolerance rules. The latter is done by means of the transformation defined as follows: Given a SOLP program P, Pˆ = P \ T R(P) ∪ {head (r) ← head (r) ∧ body(r) | r ∈ T R(P)}. Thus Pˆ is obtained from P by replacing each tolerance rule okay(p) ← body with the rule p ← p, body. ˆ over Definition 11. Let P be a SOLP program. We define the program Γ (P) ˆ ˆ ˆ ∪ the set of atoms V ar(Γ (P)) = {aP | a ∈ V ar(AP)} ∪ {aP | a ∈ V ar(AP)} ˆ ∪ {fail P } as Γ (P) ˆ = S (P) ˆ ∪ S (P) ˆ ∪ S (P), ˆ where S (P), ˆ {saP | a ∈ V ar(AP)} 1 2 3 1 ˆ ˆ S2 (P) and S3 (P) are defined as follows: ˆ = {aP ← not aP | a ∈ V ar(AP)} ˆ ∪ {aP ← not aP | a ∈ V ar(AP)}, ˆ S1 (P) ˆ 1 n S2 (P) = {saP ← bP , · · · , bP , (ρ(s1 ))P , · · · (ρ(sm ))P | a ← b1 , · · · bn , s1 , · · · , sm ∈ P}, ˆ = {fail ← not fail , saP , not aP | a ∈ V ar(AP)}∪ ˆ S3 (P) P P ˆ {fail P ← not fail P , aP , not saP | a ∈ V ar(AP)}.
Definition 12. Given a SOLP collection {P1 , · · · , Pn }, we define the set Pu = ˆ 1≤i≤n Γ (Pi ). Thus Pu is a classical logic program representing the translation of the SOLP collection. This program is used in conjunction with the DLPA program C(P1 , · · · , Pn ) in order to enable the social constraints. In the next theorem we state that a one-to-one correspondence exists between the social models in SOS(P1 , · · · , Pn ) and the stable models of the DLPA ¯ First, we need the following definition and results: program Pu ∪ C. Let P be a SOLP program and M ⊆ V ar(P). We denote by [M ]P the set {aP | a ∈ M } ∪ {aP | a ∈ V ar(P) \ M } ∪ {saP | a ∈ M }. Lemma 1. Given a SOLP collection SP = {P1 , · · · , Pn }, a social interpretation I¯ for SP , a SOLP program Pj ∈ SP and a SSC s ∈ M SSC Pj , assume C¯ = ¯ Then: C(P1 , · · · , Pn ) and Q = {a ←| a ∈ I}. s is true w.r.t. I¯ iff ∃M ∈ SM (C¯ ∪ Q) | (ρ(s))Pj ∈ M. Definition 13. Given a SOLP collection SP = {P1 , · · · , Pn }, a social interpretation I¯ for SP , a SOLP program Pj ∈ SP and a SSC s ∈ M SSC Pj , assume ¯ We define the set C¯ = C(P1 , · · · , Pn ) and Q = {a ←| a ∈ I}. Pj SATI¯ (s) = { h | h = head (r), r ∈ Ψ Pj (s) ∧ ∃M ∈ SM (C¯ ∪ Q) | h ∈ M . ¯ then SAT ¯Pj (s) includes the Thus, by virtue of Lemma 1, if s is true w.r.t. I, I Pj literal (ρ(s))Pj and those heads of rules in Ψ (s) corresponding (by means of the functions ρ and g) to both s and the SSCs which are nested in s. Theorem 1. Given a SOLP collection {P1 , · · · , Pn }, and C¯ = C(P1 , · · · , Pn ). Then A = B, where:
A Social Semantics for Multi-agent Systems
327
¯ A = SM (Pu ∪ C) and ¯ ¯ ¯ B ={F ∪G ∪ H | F¯ = 1≤i≤n FPi i ∧ F i ∈ AF P (Pi ) ∧ F¯ ∈ SOS(P1 , · · · , Pn ) i i i ¯= G ]Pi \ FPi i 1≤i≤n GPi ∧ GPi = [F Pi i i ¯ = H 1≤i≤n HPi ∧ HPi = s∈M SSC Pi SATF¯ (s)}. Thus each stable model x ∈ A may be partitioned in three sets: F¯ (the social ¯ and H ¯ (both including model of the SOLP collection, which corresponds to x), G overhead literals needed by the translation).
5
Social Models, Joint Fixpoints and Complexity
In this section we show that the Social Semantics extends the JFP semantics [5]. Basically, COLP programs are logic programs containing also tolerance rules, that are rules of the form okay(p) ← body(r). The semantics of a collection of COLP programs is defined over classical programs obtained by the COLP programs by translating each rule of the form okay(p) ← body(r) into the rule p ← p, body(r). The semantics of a collection P1 , · · · , Pn of COLP programs is defined in [5] in terms of joint (i.e., common) fixpoints (of the immediate consequence operator) of the logic programs obtained from P1 , · · · , Pn by transforming tolerance rules occurring in them (as shown above). Recall that the immediate consequence operator TP is a function from 2V ar(P) to 2V ar(P) defined as follows. For each interpretation I ⊆ V ar(P), TP (I) is the set of all heads of rules in P whose bodies are true w.r.t. I. First, we define a translation from COLP programs [5] to SOLP programs: Definition 14. Given a COLP program P and an integer n ≥ 1, the SOLP translation of P is a SOLP program σ n (P) = {σrule (r) | r ∈ P}, where head (r) ← [n − 1, n − 1]head (r), body(r) if r is a classical rule, σrule (r) = okay(p) ← [n − 1, n − 1]p, body(r) if head (r) = okay(p). The next theorem states that the JFP semantics is a special case of the Social Semantics. JF P (P1 , · · · , Pn ) denotes the set of the joint fixpoints of P1 , · · · , Pn . Theorem 2. Given n ≥ 1, let P1 , · · · , Pn be COLP programs and Q1 , · · · , Qn be SOLP programs such that Qi = σ n (Pi ). Then: ⎧ ⎫ ⎨ ⎬ SOS(Q1 , · · · , Qn ) = FQi | F ∈ JF P (P1 , · · · , Pn ) . ⎩ ⎭ 1≤i≤n
Now we introduce a relevant decision problem w.r.t. the Social Semantics and discuss its complexity. Observe that the analysis is done in case of positive programs. Indeed, the case of non positive programs is straightforward: Since it is NP complete to determine whether a single non-positive program has a fixpoint, it is easy to see that the same holds for non-positive SOLP programs and autonomous fixpoints. Thus, checking whether a SOLP collection containing at least one non-positive SOLP program has a social model is trivially NP hard. Moreover, since this problem is easily seen to be in NP, it is NP complete.
328
F. Buccafurri and G. Caminiti
PROBLEM SOSn (Social Model Existence): Instance: A SOLP collection P1 , . . . , Pn Question: Is SOS(P1 , . . . Pn ) = ∅, i.e., does the SOLP collection P1 , . . . , Pn have any social model? Theorem 3. The problem SOSn is NP complete.
6
Knowledge Representation with SOLP Programs
In this section, we provide a real-life example showing the capability of our language of representing common knowledge. Seating. We must arrange a seating for a number nagent of agents, with m tables and a maximum of c chairs per table. Agents who like (resp. dislike) each other should (resp. should not) sit at the same table. Moreover, an agent can express some requirements w.r.t. the number and the identity of other agents sitting at the same table. Assume that the i-th agent is represented by a predicate agent(i) (1 ≤ i ≤ nagent ) and his knowledge base is included in a single SOLP program. The predicate like(i) (resp. dislike(i)) means that Agenti is desired (resp. not tolerated) at the same table, table(T ) represents a table (1 ≤ T ≤ m) and at(T ) expresses the desire to sit at table T . For instance, the program P1 (which is associated to Agent1 ) could be written as follows: r1 r2 r3 r4 r5 r6 r7 r8 r9
: agent(1) ← : ← : at(T ) ← : ← : ← : like(2) ← : dislike(3) ← : okay(like(4)) ← : ←
at(T 1), at(T 2), T 1 <> T 2 [, c − 1]{at(T ), agent(P )}, like(P ), table(T ) at(T ), [1, ]{at(T ), agent(P )}, dislike(P ) like(P ), dislike(P )
at(T ), [3, ]{at(T )}
where rules from r1 to r5 are common to all the programs (of course, the argument of agent() in r1 is suited to the enclosing program) and rules from r6 to r9 express agent’s own requirements. In particular, while the rule r2 states that any agent cannot be seated at more than one table, the rules r3 and r4 mean that an agent wants to share the table with no more than c − 1 agents he likes and with no agent he dislikes, respectively. The rule r5 provides consistency for like and dislike. The rule r8 is used to declare that Agent1 tolerates Agent4 , i.e. Agent4 possibly shares a table with Agent1 , and finally the rule r9 means that Agent1 does not want to share a table with 3 agents or more. Observe that while the rule r3 generates possible seating arrangements, the rules r2 , r4 and r9 discard those which are not allowed.
A Social Semantics for Multi-agent Systems
7
329
Conclusions
In this work we have proposed a new language, SOcial Logic Programming (SOLP), which enables social behavior among a community of agents represented by logic programs, extending COLP [5]. Thus, the intended models of the Social Semantics represent those mental states satisfying social requirements imposed by the agents. Moreover, we have given a translation from SOLP to logic programming with aggregates and discussed the computational complexity of SOLP, which has been proved to be NP complete.
References 1. C. Baral and M. Gelfond. Logic Programming and Knowledge Representation. Journal of Logic Programming, 19/20:73–148, 1994. 2. M. Bratman. Intention, Plans, and Practical Reason. Harvard Univ. Press, 1987. 3. M. Bratman, D. J. Israel, and M. E. Pollack. Plans and Resource-Bounded Practical Reason. AI center technical note SRI-AI 425R, SRI International, 1988. 4. F Buccafurri and G. Caminiti. A Social-Oriented Semantics for Multi-Agent Systems. Technical Report - TR Lab. Ing. Inf. 05/01, DIMET - University of Reggio Calabria, 2005. Available from the authors. 5. F. Buccafurri and G. Gottlob. Multiagent Compromises, Joint Fixpoints, and Stable Models, volume 2407 of LNCS and LNAI. Springer, 2002. 6. P. R. Cohen and H. Levesque. Rational interaction as the basis for communication. In Intentions in Communication. MIT Press, 1990. 7. R. S. Cost, T. Finin, and Y. Labrou. Coordinating Agents Using ACL Conversations. In Coordination of Internet Agents: Models, Technologies, and Applications, pages 183–196, 2001. 8. T. Dell’Armi, W. Faber, G. Ielpa, N. Leone, and G. Pfeifer. Aggregate Functions in Disjunctive Logic Programming: Semantics, Complexity, and Implementation in DLV. In IJCAI-03, Proc. of the 18th Int. Joint Conf. on Artificial Intelligence, pages 847–852, 2003. 9. T. Eiter, W. Faber, N. Leone, and G. Pfeifer. Declarative problem-solving in DLV. In Logic-Based Artificial Intelligence, pages 79–103. Kluwer, 2000. 10. M. Gelfond and V. Lifschitz. The Stable Model Semantics for Logic Programming. In 5th Conf. on Logic Programming, pages 1070–1080. MIT Press, 1988. 11. V. Mascardi, M. Martelli, and L. Sterling. Logic-based specification languages for intelligent software agents. TPLP, 4(4):429–494, 2004. 12. J. Minker and D. Seipel. Disjunctive Logic Programming: A Survey and Assessment, volume 2407 of LNCS and LNAI. Springer, 2002. 13. R. S. Patil, R. E. Fikes, P. F. Patel-Schneider, D. McKay, T. Finin, T. Gruber, and R. Neches. The DARPA knowledge sharing effort: progress report. In Principles of KR and Reasoning: Proc. of the 3rd Int. Conf. Kaufmann, 1992. 14. W. van der Hoek and W. Wooldrige. Towards a logic of rational agency. Logic Journal of the IGPL, 11(2):135–159, 2003. 15. M. Wooldridge. Reasoning about Rational Agents. Intelligent Robots and Autonomous Agents. MIT Press, Cambridge, Massachusetts, 2000. 16. M. Wooldridge and N. R. Jennings. Intelligent Agents: Theory and Practice. The Knowledge Engineering Review, 2(10):115–152, 1995.
Revisiting the Semantics of Interval Probabilistic Logic Programs Alex Dekhtyar1, and Michael I. Dekhtyar2, 1
Department of Computer Science, University of Kentucky [email protected] 2 Department of Computer Science, Tver State University [email protected]
Abstract. Two approaches to logic programming with probabilities emerged over time: bayesian reasoning and probabilistic satisfiability (PSAT). The attractiveness of the former is in tying the logic programming research to the body of work on Bayes networks. The second approach ties computationally reasoning about probabilities with linear programming, and allows for natural expression of imprecision in probabilities via the use of intervals. In this paper we construct precise semantics for one PSAT-based formalism for reasoning with inteval probabilities, probabilistic logic programs (p-programs), orignally considered by Ng and Subrahmanian. We show that the probability ranges of atoms and formulas in p-programs cannot be expressed as single intervals. We construct the prescise description of the set of models of p-programs and study the computational complexity if this problem, as well as the problem of consistency of a p-program. We also study the conditions under which our semantics coincides with the single-interval semantics originally proposed by Ng and Subrahmanian for p-programs. Our work sheds light on the complexity of construction of reasoning formalisms for imprecise probabilities and suggests that interval probabilities alone are inadequate to support such reasoning.
1 Introduction Reasoning with probabilistic information, in the context of logic programming, has two distinct origins: bayesian reasoning and probabilistic satisfiability. The former is based on interpreting statements about conditional probability of event A given event B as an implication of a special kind (if B then the probability of A is equal to p). Among the logic programming frameworks following this idea are the work of Poole[16], Ngo and Haddawy [14], and more recently, and in the context of answer set programming, of Baral, Gelfond and Rushton [2]. The second approach to reasoning with probabilistic information starts with Porbabilistic Satisfiability (PSAT), a problem originally formulated by Boole in [1], “resurrected” by Hailperin[9] more than a century later, and, finally, “modernized” by Georgakopoulos, Kavvadis and Papadimitriou[8] in 1988. PSAT is the problem of determining, whether a set {P (F ) = pF }, of assignments of probabilities to a collection
Work partially supported by NSF grant ITR-0325063. Work partially supported by Russian Foundation for Basic Research grants 04-01-00015 and 04-01-565.
C. Baral et al. (Eds.): LPNMR 2005, LNAI 3662, pp. 330–342, 2005. c Springer-Verlag Berlin Heidelberg 2005
Revisiting the Semantics of Interval Probabilistic Logic Programs
331
F = {F } of boolean formulas over atomic events is consistent, i.e., whether there exists a way to assign probabilities to all atomic events in a way that P (F ) = pF for all formulas F in F . Nilsson’s probabilistic logic[15] is based on PSAT and uses the semantics of possible worlds (world probability functions) to model probabilities of events. In [8] it is shown that PSAT is NP-complete. The attractiveness of building logic programming frameworks based on bayesian reasoning lies in direct relationship to the large body of work on Bayesian networks and Markov Decision Processes. The attractiveness of PSAT-based logic programs is in the fact that PSAT has a natural extension to the case of imprecise probabilities. The importance of imprecise probabilities has been observed by numerous researchers in the past 10-15 years [17,3] and lead to the establishment of the Imprecise Probabilities Project [10]. Interval PSAT is a reformulation of PSAT, in which probability assignments of the form P (F ) = pF are relplaced with inequalities of the form lF ≤ P (F ) ≤ uF . The underlying semantics and the methodology for solving Interval PSAT is the same as for PSAT. Logic programming frameworks inspired by PSAT consider rules of the form “P (F ) = µ if P (F1 ) = µ1 and . . . and P (Fn ) = µn ”. Unlike in bayesianinspired frameworks, here “if” is the classical logical implication. Logic programming formalisms stemming from PSAT, in which probabilities of events are expressed as intervals, have been considered by Ng and Subrahmanian[11,12] and by Dekhtyar and Subrahmanian[6]. In these frameworks, the fixpoint semantics of formulas, i.e., the set of possible probability assignments for them, had been represented using a single interval. In [5] we have established that even for simple logic programs (a subset of programs considered by [11]), which contain only atomic events in heads and bodies, the single-interval fixpoint does not adequately describe the exact set of possible probability assignments. We have shown that the “real” possible-world semantics is a union of a set of sub-intervals of [0,1]. In this paper, we extend the results of [5] onto the general case of propositional interval probabilistic logic programs as defined in [12]. We formally define the propositional interval probabilistic logic programs of [12]1 in Section 2, where we also show that the single-interval fixpoint is not precise. In Section 3 we provide the precise description of the set of models for an interval logic program. In Section 4 we address the problem of determining if an interval logic program has a model. In Section 5 we study the problem of when the single-interval fixpoint describes all the models of an interval logic program precisely, and prove a number of sufficient conditions.
2 Interval Probabilistic Logic Programs 2.1 Syntax In this section we describe interval Probabilistic Logic Programs of Ng and Subrahmanian [11,12]. Let L be some first order language containing infinitely many vari1
Ng and Subrahmanian consider in [12] probabilistic logic programs with variables in the probability intervals. In this paper, we consider only constant probability intervals, leaving the rest of the syntax from [12] the same.
332
A. Dekhtyar and M.I. Dekhtyar
able symbols, finitely many predicate symbols and no function symbols. Let BL = {A1 , . . . , AN } be the Herbrand base of L. A basic formula is either an atom from BL or a conjunction or disjunction of two or more atoms. The set of all basic formulas is denoted bf (BL ). Formulas of the form (B1 ∧ . . . ∧ Bn ) : µ and (B1 ∨ . . . ∨ Bm ) : µ , where B1 , . . . , Bn , B1 , . . . , Bm ∈ BL and µ = [l, u], µ = [l , u ] ⊆ [0, 1] are called p-annotated conjunctions and p-annotated disjunctions respectively. P-annotated conjunctions and disjunctions represent probabilistic information. Every atom in BL is assumed to represent an (uncertain) event or statement. A pannotated conjunction A1 ∧ . . . ∧ An : [l, u] is read as “the probability of the joint occurrence of the events corresponding to A1 , . . . , An lies in the interval [l, u]”. Similarly, A1 ∨ . . . ∨ An : [l, u] is read as “the probability of the occurrence of at least one of the events corresponding to A1 , . . . , An lies in the interval [l, u]”. Probabilistic Logic Programs (p-programs) are constructed from p-annotated formulas as follows. Let F, F1 , . . . , Fn be some basic formulas and µ, µ1 , . . . , µn be subintervals of [0, 1] (also called annotations). Then, a p-clause is an expression of the form F : µ ←− F1 : µ1 ∧ . . . ∧ Fn : µn (if n = 0, as usual, the p-clause F : µ ←− is referred to as a fact). A Probabilistic Logic Program (p-program) is a finite collection of p-clauses. In this paper, we call a p-program in which all clauses consist of atoms from BL only a simple p-program[5]. We also call a p-program in which the heads of all clauses are atoms from BL a factored p-program. In [11] Ng and Subrahmanian considered factored p-programs. In [13] they considered a framework, in which variables were allowed in the probability annotations. Our definition of p-programs allows arbitrary heads of p-clauses, but does does not consider variable annotations. 2.2 Model Theory The model theory assumes that in the real world each atom from BL , and therefore each basic formula, is either true or false. However, exact information about the real world is not known. The uncertainty about the world is represented in a form of a probability distribution over the set of 2N possible worlds. In addition, p-programs introduce uncertainty about the probability distribution itself. More formally, given BL , a world probability density function W P is defined as W P : 2BL → [0, 1], W ⊆2BL W P (W ) = 1. Each subset W of BL is considered to be a possible world and W P associates a point probability with it. W |= A iff A ∈ W ; W |= A1 ∧ . . . ∧ An iff (∀1 ≤ i ≤ n)W |= Ai and W |= A1 ∨ . . . ∨ An iff (∃1 ≤ i ≤ n)W |= Ai . We fix an enumeration W1 , . . . WM , M = 2N of the possible worlds and denote W P (Wi ) as pi . Given a function W P , probabilistic interpretation (p-interpretation) IW P is defined on the set of2 all basic formulas as follows: IW P : bf (BL ) → [0, 1], IW P (F ) = W |=F W P (W ) . P-interpretations assign probabilities to basic formulas by adding up the probabilities of all worlds in which they are true. 2
Note, that each world probability density function W P has a unique p-interpretation IW P associated with it. However, in general, a p-interpretation I can be induced by more than one world probability density function.
Revisiting the Semantics of Interval Probabilistic Logic Programs
333
P-interpretations specify the model-theoretic semantics of p-programs. Given a pinterpretation I, the following definitions of satisfaction are given: − I |= F : µ iff I(F ) ∈ µ; − I |= F1 : µ1 ∧ . . . ∧ Fn : µn iff (∀1 ≤ i ≤ n)(I |= Fi : µi ); − I |= F : µ ←− F1 : µ1 ∧ . . . ∧ Fn : µn iff either I |= F : µ or I |= F1 : µ1 ∧ . . . ∧ Fn : µn . Now, given a p-program P , I |= P (I is a model of P ) iff for all p-clauses C ∈ P , I |= C. Let M od(P ) denote the set of all models of p-program P . It is convenient to view a single p-interpretation I as a point (I(F1 ), . . . , I(FM )) in M = 2N -dimensional unit cube E M . Then, M od(P ) can be viewed as a subset of E M . P is called consistent iff M od(P ) = ∅, otherwise P is called inconsistent. 2.3 Interval Fixpoint In this section we give a brief definition of the fixpoint semantics proposed in [12]. The fixpoint semantics of defined on atomic functions and formula functions. Let C[0, 1] denote the set of all subintervals of the interval [0, 1]. An atomic function is a mapping f : BL → C[0, 1]. A formula function h is a mapping h : bf (BL ) → C[0, 1]. Given a set F ⊆ bf (BL ) a restricted formula function is a mapping fF : F → C[0, 1]. Intuitively atomic and formula functions assign probability intervals to atoms and basic formulas: h(F ) = [l, u] can be interpreted as the statement ‘‘probability of formula F lies in the interval [l, u]". Each formula function hF induces a set LL(hF ) of linear inequalities on the probabilities p1 , . . . , pM of possible worlds. LL(hF ) consists of the following inequalities: – lF ≤ Wj |=F pj ≤ uF , for all F ∈ F, hF (F ) = [lF , uF ]; M – j=1 pj = 1; – pj ≥ 0, for all 1 ≤ j ≤ M . Note that Wj |=F pj is the probability of F . Therefore, the first group of inequalities specifies, in terms of probabilities pj of possible worlds, the fact that the probability M of F must be between lF and uF . The equality j=1 pj = 1 simply states that the sum of probabilities of all possible worlds adds up to 1, while inequalities of the form pj ≥ 0 specify that probabilities of possible worlds are nonnegative. Given a p-program P , two operators, SP and TP are defined. They map formula functions to formula functions in the following manner. For a basic formula F , SP (h)(F ) = ∩MF , where MF = {µ|F : µ ←− F1 : µ1 ∧ . . . ∧ Fn : µn ∈ P, and (∀1 ≤ i ≤ n)(h(Fi ) ⊆ µi )}. If MF = ∅ then SP (h)(F ) = [0, 1]. The TP operator is defined as follows: TP (h)(F ) = [lF , uF ], where lF = min Wj |=F pj , subject to LL(SP (h)) and uF = max Wj |=F pj , subject to LL(SP (h)). Intuitively, SP computes the intervals of formulas based on the p-clauses that fired. However, because basic formulas are not, in general, independent (e.g. such formulas as a ∧ b and a ∧ c), the ranges computed by SP may need tightening, performed by TP . We also note that for factored p-programs, TP can be specified in a simpler way as described in [11,5]. The work of these operators is illustrated on the following example.
334
A. Dekhtyar and M.I. Dekhtyar
P1 : C1 : (a ∧ b) : [0.5, 1] ←− . C2 : (a ∧ b) : [0, 0.5] ←− . C3 : (a ∧ c) : [0.5, 0.5] ←− . C4 : (b ∧ c) : [0.5, 0.5] ←− . C5 : (a ∧ b ∧ c) : [0.1, 0.2] ←− .
p1 + p2 = 0.5 p1 + p3 = 0.5 p1 + p4 = 0.5 0.1 ≤ p1 ≤ 0.2 p1 + p2 + p3 + p4 + p5 + p6 + p7 + p8 = 1 p1 , p 2 , p3 , p4 , p5 , p6 , p 7 , p8 ≥ 0
Fig. 1. Sample p-program P1 , and the set of inequalities LL(SP ) it induces
Example 1. Consider the p-program P1 shown in Figure 1. Let h(F ) = [0, 1] for all F ∈ bf( BL ). SP (h)(a ∧ b) = [0, 0.5] ∩ [0.5, 1] = [0.5, 0.5]. SP (h)(a ∧ c) = [0.5, 0.5]; SP (h)(b ∧ c) = [0.5, 0.5] and SP (h)(a ∧ b ∧ c) = [0.1, 0.2]. To compute TP (h) we first construct LL(SP (h). Let W1 = {a, b, c}, W2 = {a, b}, W3 = {a, c} and W4 = {b, c}. The set of inequalities LL(SP )(h) is shown in Figure 1 (for simplicity replace constraints of the form a ≤ X ≤ a with X = a). Combining the first three constraints with the fifth we get 2p1 − 0.5 = p5 + p6 + p7 + p8 or p1 = 0.25 + p5 + p6 + p7 + p8 . Because all pi ≥ 0, min(p1 ) subject to the latter constraint is 0.25 (when all p5 ,p6 ,p7 ,p8 = 0). However, this contradicts the fourth constraint above which says, in particular p1 ≤ 0.2. Thus, LL(h)(SP ) has no solutions. Example 2. Consider the p-program P2 = P1 − {C5 }. The computation of SP (h) will be the same as in the previous example, except SP (h)(a ∧ b ∧ c) = [0, 1]. Now, TP (h)(a ∧ b ∧ c) is defined: min(p1 ) subject to LL(SP )(h) is 0.25 (see previous example for derivation). max(p1 ) = 0.5 and it is reached when p2 = p3 = p4 = 0. Thus, TP (h)(a ∧ b ∧ c) = [0.25, 0.5]. The set of all formula functions over bf (BL ) forms a complete lattice F F w.r.t. the subset inclusion: h1 ≤ h2 iff (∀F ∈ bf (BL ))(h1 (F ) ⊇ h2 (F )). The bottom element ⊥ of this lattice is the function that assigns [0, 1] interval to all formulas, and the top element is the atomic function that assigns ∅ to all formulas. Ng and Subrahmanian show that TP is monotonic [11] w.r.t. F F. The iterations of TP are defined in a standard way: (i) TP0 = ⊥; (ii) TPα+1 = TP (TPα ), where α + 1 is the successor ordinal whose immediate predecessor is α; (iii) TPλ = {TPα |α ≤ λ}, where λ is a limit ordinal. Ng and Subrahmanian show that, the least fixpoint lf p(TP ) of the TP operator is reachable after a finite number of iterations ([11], Theorem 2). They also show that if a p-program P is consistent, then I(lf p(TP )), the set of all p-interpretations satisfying lf p(TP )3 , contains M od(P ) ([11,12] Corollary 3). 2.4 Fixpoint Is Not Enough The inverse of the latter statement, however, is not true. We illustrate it on the examples below. There, and elsewhere in the paper, we use the following conventions concerning 3
I |= h iff for all F ∈ bf (BL ), I(F ) ∈ h(F ) and there exists W P , s.t., W P satisfies LL(h) and I = IW P .
Revisiting the Semantics of Interval Probabilistic Logic Programs
335
Fig. 2. Fixpoint does not describe exactly all models for p-programs P3 and P4
the possible worlds W1 , . . . , WM over which world probability functions are defined. Let BL = {A1 , . . . , AN }. The mapping of indexes i of worlds Wi to subsets of BL is the reverse lexicografical order: W1 = BL , W2 = BL − {AN }, . . . , WM = ∅. Consider now the p-program P3 in Figure 2. Proposition 1. There exists a p-interpretation I, such that I |= lf p(TP3 ), but I |= P3 . Proof. First, we compute lf p(TP3 ). On step 1 of the itrative process, SP3 (⊥)(a ∧ b) = [0.2, 0.5] and SP3 (⊥)(c ∨ d) = [0.4, 0.6], i.e., clauses C1 and C2 of the program will fire. The following constraints are present in LL(SP3 (⊥)). 0.2 ≤ p1 + p2 + p3 + p4 ≤ 0.5 0.4 ≤ p1 + p2 + p3 + p5 + p6 + p7 + p9 + p10 + p11 + p13 + p14 + p15 ≤ 0.6 From these constraints we can find the upper and lower bounds of TP3 on individual atoms. For a we get la = min(p1 + p2 + p3 + p4 + p5 + p6 + p7 + p8 ) = 0.2, while ua = max(p1 + p2 + p3 + p4 + p5 + p6 + p7 + p8 ) = 1. The probability range for b, [lb , ub ] = [la , ua ] = [0.2, 1] due to symmetricity of conjunction of two events. Similarly, we can discover that lc = ld = 0 and uc = ud = 0.6. On the second step, no new rules will fire. Indeed, for the p-clause C3 to fire, we must have TP13 (a∧b) ⊆ [0.2, 0.4], and for C4 to fire, it should be TP13 (a∧b) ⊆ [0.4, 0.5]. But TP13 (a ∧ b) = SP (⊥)(a ∧ b) = [0.2, 0.5], which is a subset of neither [0.2, 0.4] nor [0.4, 0.5]. Thus, lf p(TP3 ) = TP13 . We now show, that there exist a p-interpretation I, such that I |= TP13 but I |= P3 . Consider a (partially defined) p-interpretation I, such that I(a∧b) = 0.3 and I(c∨d) = 0.4. We complete the construction of I to ensure that it satisfies TP13 as follows. I(a ∧ b) = p1 + p2 + p3 + p4 = 0.3 I(c ∨ d) = p1 + p2 + p3 + p5 + p6 + p7 + p9 + p10 + p11 + p13 + p14 + p15 = 0.4 Let p1 = p2 = p3 = 0.05, p4 = 0.15, p5 = 0.05, p6 = 0.1, p7 = 0.1, p9 = p10 = p11 = p13 = p14 = p15 = 0, p12 = 0.15, p16 = 0.3. This assignment satisfies all constraints in LLSP3 (⊥), which means that I |= TP13 . I |= P3 iff I |= C1 , I |= C2 , I |= C3 and I |= C4 . We can see easilty that I |= C1 and I |= C2 : I(a ∧ b) = 0.3 ∈ [0.2, 0.5] and I(c ∨ d) = 0.4 ∈ [0.4, 0.6]. However, I |= C3 . Indeed, I(a ∧ b) = 0.3 ∈ [0.2, 0.4], i.e., the body of C3 is satisfied, but I(c ∨ d) = 0.4 ∈ [0.5, 0.6], i.e., the head of C3 is not satisfied. Proposition 1 shows that not all p-interpretations satisfying lf p(TP ) satisfy the program itself, i.e., M od(P ) = lf p(TP ). As it turns out, there exist p-programs with non-
336
A. Dekhtyar and M.I. Dekhtyar
empty lf p(TP ) for which M od(P ) = ∅. One such example is program P4 shown in Figure 2. Proposition 2. lf p(TP4 ) is not empty, while M od(P4 ) = ∅. Proof. First we show that there are p-interpretations satisfying lf p(TP4 ). Using reasoning similar to that in the proof of Proposition 1 we see that on the first step of the fixpoint computation process, clauses C1 and C2 will fire, giving rise to TP4 (⊥)(a ∧ b) = SP4 (⊥)(a ∧ b) = [0.2, 0.5] and TP4 (⊥)(c ∨ d) = SP4 (⊥)(c ∨ d) = [0.4, 0.6]. On the second step neither C3 nor C4 will fire as TP4 (⊥)(a ∧ b) = [0.2, 0.5] ⊆ [0.2, 0.4] and TP4 (⊥)(a ∧ b) = [0.2, 0.5] ⊆ [0.4, 0.5]. This means lf pTP4 = TP14 = TP4 (⊥), which is not empty and thus contains satisfying p-interpretations. Now we show that M od(P4 ) = ∅. Let I |= P4 be a p-interpretation. I |= P4 , means I |= C1 , I |= C2 , I |= C3 and I |= C3 . From I |= C1 we obtain I(a ∧ b) ∈ [0.2, 0.5]. From I |= C2 we obtain I(c∨d) ∈ [0.4, 0.6]. Now, we observe that I(a∧b) ∈ [0.2, 0.5] implies that either I(a ∧ b) ∈ [0.2, 0.4) or I(a ∧ b) ∈ (0.4, 0.5] or I(a ∧ b) = 0.4. Consider each case separately. If I(a ∧ b) ∈ [0.2, 0.4), then I satisfies the body of C3 . Therefore, it must be the case that I(c ∨ d) ∈ [0.7, 0.8]. However, because I |= C2 , I(c ∨ d) ∈ [0.4, 0.6] which leads to a contradiction. Similarly, I(a ∧ b) ∈ (0.4, 0.5] makes the body of C4 satisfied, and thus I(c ∨ d) must be in [0.7, 0.8] contradicting the fact that I |= C2 . Finally, if I(a ∧ b) = 0.4 then the bodies of both C3 and C4 , and hence I must satisfy their (identical) heads, leading again to I(c ∨ d) ∈ [0.7, 0.8], which contradicts I |= C2 . Thus, no p-interpretation I can satisfy P4 . Looking at the proofs of both propositions above we see that the reason for the “bad” behavior of lf p(TP ) lies in the computation of the SP operator, namely, in the determination when p-claues fire. By definition of SP , a p-clause C fires if current valuation for each basic formula in the body of the clause is a subinterval of its annotation in the clause. Consider, for example a clause C : F : µ ←− G : µ and some formula function (valuation) h, such that h(G) ⊆ µ but h(G) ∩ µ = ∅. This clause will not fire. However, any p-interpretation I |= C such that I(G) ∈ h(G) ∩ µ , satisfies the body of the clause, and thus, must satisfy its head, i.e., we must have I(F ) ∈ µ. This extra restriction on the probability range of F is not captured by the SP computation.
3 Possible Worlds Semantics We ask ourselves: given a p-program P , how do we give an exact description of M od(P )? In [5] we have answered this question of simple p-programs, i.e., p-programs with only atoms in the program clauses. In this section we extend the new semantics to the full case of p-programs. Definition 1. Let P be a p-program over the Herbrand base BL = {A1 , . . . , AN }, and let W = (W1 , . . . , WM ), M = 2N be an enumeration of all subsets of BL . With each Wj , 1 ≤ j ≤ M we associate a variable pj with domain [0, 1]. Let C be a p-clause in P of the form F : [l, u] ←− F1 : [1 , u1 ] ∧ . . . ∧ Fn : [ln , un ]. The family of systems of inequalities induced by C, denoted IN EQ(C) is defined as follows:
Revisiting the Semantics of Interval Probabilistic Logic Programs
337
– n = 0 (C is a fact). IN EQ(C) = l ≤ Wj |=F pj ≤ u . – n ≥ 1 (C is a rule). IN EQ(C) = T (C) ∪ F (C); T (C) = l ≤ Wj |=F pj ≤ u; li ≤ Wj |=Fi pj ≤ ui |1 ≤ i ≤ k ; F (C) = Wj |=Fi pj < li |1 ≤ i ≤ k ∪ Wj |=Fi pj > ui |1 ≤ i ≤ k .
Let P = {C1 , . . . , Cs }. Then, IN EQ(P ) is defined as follows: IN EQ(P ) = {α1 ∪ . . . ∪ αs |αi ∈ IN EQ(Ci ), 1 ≤ i ≤ s} Informally, IN EQ(P ) is constructed as follows: for each p-clause C in the program we select the reason, why it is true. The reason/evidence is either the statement that the head of the clause is satisfied, or that one of the conjuncts in the body is not. The set IN EQ(P ) represents all possible systems of such evidence/restrictions on probabilities of basic formulas. Solutions of any system of inequalities in IN EQ(P ) satisfy every clause of P . Of course, not all individual systems of inequalities have solutions, but IN EQ(P ) captures all the systems that do, as shown in the following lemma and theorem. Lemma 1. Let C : F : µ ←− F1 : µ1 ∧ . . . ∧ Fm : µk be a p-clause and I be a p−interpretation (both over the same Herbrand Base BL ). Then I |= C iff there exists a world probability function W P , such that I = IW P and {pj = W P (Wj )|Wj ⊆ BL } ∈ Sol(α) for some α ∈ IN EQ(C). Proof (sketch). First we note that given a p-interpretation I, one can always construct a world probability function W P , such that I = IW P [11,12]. If I |= C, then either either I satisfies F : µ, the head of C, or it does not satisfy the body of C. In the first case, we show in a straightforward manner that any world density function W P , such that I = IW P is in the solution of T (C). In the second case, we determine which conjunt Fi : µi in the body is not satisfied, and show that the appropriate system of inequalities from F (C) has any such W P as a solution. Going back, if W P is a probability density function that is a solution of some system of inequalities α ∈ IN EQ(C), we show that IW P |= C as follows. α must be either in T (C) or in F (C). In the first case, we show in a straightforward manner that I(F ) ∈ µ. In the second case, we show that I(F ) ∈ µi for some 1 ≤ i ≤ m. Theorem 1. A p-interpretation I is a model of a p-program P iff there exists a world probability function W P , such that I = IW P , and a system of inequalities α ∈ IN EQ(P ) such that P = {pj = W P (Wj )|Wj ⊆ BL } ∈ Sol(α). This leads to the following description of M od(P ): Corollary 1. M od(P ) = α∈IN EQ(P ) {IW P |W P ∈ Sol(α)} Let Rules(P ) and F acts(P ) denote the sets of p-clauses from P with non-empty and empty bodies respectively. Let f (P ) = |F acts(P )| and r(P ) = |Rules(P )|. Finally, let k(P ) be the maximum number of basic formulas in a body of a rule in P . The solution of each system α ∈ IN EQ(P ) is a convex M − 1-dimensional4 (in general case) polyhedron. Given a solution W P of some α ∈ IN EQ(P ), IW P is 4
Because p1 + . . . + pM = 1 is present in every α ∈ IN EQ(P ), the dimensionality of Sol(α) cannot be more than M − 1.
338
A. Dekhtyar and M.I. Dekhtyar
obtained via a linear transformation. Because linear transformations preserve convexity of regions, we can make the following statement about the geometry of the set M od(P ). Corollary 2. Given a p-program P over the Herbrand base BL = {A1 , . . . , AN }, M od(P ) is a union of S ≤ (2k(P )+1)r(P ) , not necessarily disjoint, convex polyhedra. Each polyhedron has a dimensionality of at most M − 1 = 2N − 1. This corollary provides an exponental, in the size of the p-program, upper bound on the number of possibly disjoint components of M od(P ). In [5] we constructed a simple p-program P with 2N + 1 clauses and k(P ) = 1, whose M od(P ) is a collection of 2N disjoint N -dimensional parallepipeds. This shows that the exponential bound cannot be substantially decreased. The semantics of p-programs is closely connected to Interval PSAT. As mentioned above, each system of inequalities in IN EQ(P ) is constructed by selecting one formula from each clause (either the head or from the body) and assigning it an interval: [l, u] for the head; [0, li ) or (ui , 1] for the formula Fi from the body. Theorem 1 showed that any assignment of point probabilities to the atoms, that satisfies these constraints is a model of P . At the same time, the set {F : µ} of annotated formulas for which satisfying p-interpretations are to be found is an instance of Interval PSAT. Thus, an instance of Interval PSAT is associated with each set of inequalities in IN EQ(P ). We note that the sets of solutions for individual systems from IN EQ(P ) are not disjoint, however, each system can contain unique solutions. Thus, one way of computing M od(P ) is to solve |IN EQ(P )| Interval PSAT problems.
4 Consistency Problem The consistency problem for p-programs is defined as follows: given a p-program P , check whether P has a model, i. e. M od(P ) = ∅. Let CONS-P= {P |M od(P ) = ∅}. Theorem 2. The set CONS-P is NP-complete. Proof. Upper bound. Let P be a p-program, B1 , . . . , Br be all basic formulas of P Then M od(P ) = ∅ iff there exist such probabilitues b1 , . . . , br of B1 , . . . , Br that (i) the system of linear equations and inequalities EQ(P ): – W |=B pj = bi , for i = 1, . . . , r, Mj i – j=1 pj = 1; – pj ≥ 0, for all 1 ≤ j ≤ M . has a solution W P = {p1 . . . . , pM } defined the interpretation IW P ∈ M od(P ). To prove the upper bound, we use the following lemma from [7] (which, in turn, cites [4]. Similar statement is also found in [8]). Lemma 2. If a system of r linear equations and/or inequalities with integer coefficients each of length at most l has a nonnegative solution, then it has a nonnegative solution with at most r entries positive, and where the size of each member of the solution is O(rl + r log r). Based on this lemma we obtain the following “small model” theorem.
Revisiting the Semantics of Interval Probabilistic Logic Programs
339
Lemma 3. p-program P including r different basic formulas is consistent iff there exists a probability distribution W P on possible worlds with no more than r + 1 nonzero probabilities such that IW P |= P . Let the longest number in annotations of P have length l. Then the following nondeterministic procedure allows us to check whether M od(P ) = ∅. 1) Guess for each Bi (i = 1, . . . , r) it’s probability bi ∈ [0, 1] of the length O(rl + r log r). 2) Guess a probability distribution W P with no more than r + 1 positive probabilities pi1 , . . . , pir+1 of the length O(rl + r log r) and check that W P is a solution of the system EQ(P ). 3) If IW P |= P retur n ”Yes”. From the lemmas above it follows that this algorithm runs in nondeterministic time bounded by a polynomial of |P |. Lower bound. We prove the lower bound for a subclass of simple p-programs with clause bodies of size 3 or less. We show that 3-CNF ≤P CONS-P. Let Φ = C1 ∧ . . . Cm be a 3-CNF over the set of boolean variables V ar = {x1 , . . . , xn }. Let each clause Cj , j = 1, . . . , m, include 3 literals lj1 , lj2 , lj3 . Define for each literal l an annotated atom α(l) as follows: if l = x ∈ V ar then α(l) = x : [0.5, 1], if l = ¬x then α(l) = x : [0, 0.5]. Let BL = V ar ∪ {Cj | j = 1, . . . , m} ∪ {Φ}. We include in pprogram P (Φ) the following p-clauses. (f 1) : Φ : [1.1] ← . (f cj ) : Cj : [0, 0.1] ← . (j = 1, . . . , m) (f xi ) : xi : [0, 1] ← . (i = 1, . . . , n) (rcj ) : Cj : [0.9, 1] ← α(lj1 ) ∧ α(lj2 ) ∧ α(lj3 ). (j = 1, . . . , m). (rfi ) : Φ : [0, 0] ← xi : [0.5, 0.5]. (i = 1, . . . , n) It is easy to see that P (Φ) can be constructed from Φ in polynomial time. Now the theorem follows from the following proposition. Proposition 3. Φ ∈ 3-CNF ⇐⇒ P (Φ) ∈ CONS-P. A consistent p-program P entails a formula F : [l, u] if for each I ∈ M od(P ) I |= F : [l, u]. The entailment problem is, thus, expressed as follows: given a consistent P and a formula F : [l, u], decide if P entails F : [l, u]? Let EQ1 (P, F ) = EQ(P ) ∪ { Wj |=F pj < l} and EQ2 (P, F ) = EQ(P ) ∪ { Wj |=F pj > u}. Then it easy to see that P does not entail F : [l, u] iff EQ1 (P, F ) is solvable or EQ2 (P, F ) is solvable. Therefore we get the following complexity bounds for the entailment problem. Theorem 3. The enailment problem for p-programs is co-NP-complete. We note, in fact, that the theorem holds for the class of simple p-programs.
5 When Fixpoint Is Enough? In this section we study subclasses of p-programs for which simpler procedures for determining M od(P ) exist. In particular, we ask ourselves a question of when M od(P ),
340
A. Dekhtyar and M.I. Dekhtyar
as defined here, and lf p(TP ), as defined in [12] coincide. We then address the problem of complexity of detecting that M od(P ) = I(lf p(TP )). First, we consider the problem of M od(P ) = lf p(TP ) for the case of simple p-programs. In the definition below we use the following notation. Given a simple p-program P and an atom A, we let haP (A) denote the set of all intervals associated with occurrences of a in the heads of clauses in P . We also let baP (A) denote the set of all intervals associated with occurrences of A in the bodies of the clauses from P . Definition 2. A simple p-program P is called semi-strict if it satifies the following condition: for all atoms A ∈ BL , and for each pair µ ∈ haP (A) and ν ∈ baP (A) either µ ⊆ ν or µ ∩ ν = ∅. Intuitively, a simple p-program is called semi-strict if for all atoms their annotations in the heads of the rules are either subintervals of annotations in the bodies or do not intersect with them. Theorem 4. If P is a simple semi-strict p-program, then M od(P ) = I(lf p(TP )). Theorem 5. Semi-strictness of a simple p-program P can be checked in time O(|P |2 ). Semi-strictness is a syntactic condition on simple p-programs, that can be checked in time, quadratic, in the size of the p-program in a straightforward manner. This makes it an attractive condition to use in general case. However, two facts make it impossible. First, this is a sufficient, but not necessary condition, and second, for programs with non-atomic formulas, semi-strictness does not imply M od(P ) = I(lf p(TP )). The following two examples illustrate this. Example 3. To show that semi-strictness is not a necessary condition, consider p-program P5 from Figure 3. First, we note that lf p(TP5 ) assigns intervals [0.2, 0.4], [0.3, 0.7] and [0, 1] to atoms a, b and c respectively. We can also see that the body of the third clause of P5 is unsatisfiable given the first two clauses, because the intervals for a, [0.5, 1] in the clause and [0.2, 0.4] from the first clause, do not intersect. Therefore, M od(P5 ) will not differ from lf p(TP5 ). At the same time, we note that P5 is not semistrict, because for b the annotation of the head of the second clause, [0.3, 0.7], and the annotation in the body of the third clause, [0.6, 0.9] overlap. Example 4. Consider the p-program P6 from Figure 3. P6 is semi-strict by definition 2. But we can show that I(lf p(TP )) and M od(P ) differ. Indeed, because the constraints on the probabilities of a and b from the first two p-clauses do not entail the [0.3, 0.6]
P5 : a : [0.2, 0.4] ←− . b : [0.3, 0.7] ←− . c : [0.8, 0.9] ←− b : [0.6, 0.9], a : [0.5, 1].
P6 : a : [0.2, 0.6] ←−. b : [0.3, 0.7] ←−. c : [0.8, 0.9] ←− (a ∧ b) : [0.3, 0.6].
Fig. 3. Programs P5 and P6 show that semi-strictness is not the right condition for general pprograms
Revisiting the Semantics of Interval Probabilistic Logic Programs
341
constraint on the probability of a∧b, this rule does not fire, and therefore lf p(TP )(c) = [0, 1]. In particular, a p-interpretation I, s.t., I(a) = 0.6, I(b) = 0.7, I(c) = 0.2 is in I(lf p(TP )). At the same time, if I(a) = 0.6 and I(b) = 0.7, then I(a ∧ b) ∈ [0.3, 0.6], and therefore, in the thrid rule, the head must be satisfied, but 0.2 ∈ [0.8, 0.9]. It turns out that it is possible to specify a sufficient condition in the general case. However, this is no longer a syntactic condition. Definition 3. Let P be a p-program and let P be the result of removing from P all p-clauses whose heads are satisfied by lf p(TP ). A p-program P is called strict if the following condition holds: for each clause C : F : µ ←− F1 : µ1 ∧ . . . Fn : µn in P , there exists an index 1 ≤ i ≤ n, such that lf p(TP )(Fi ) ∩ µi = ∅. Theorem 6. If a p-program P is strict, then M od(P ) = I(lf p(TP )). Proof. We know that M od(P ) ⊆ I(lf p(TP )). Suppose now, I ∈ I(lf p(TP )). We show that (∀C : F : µ ←− F1 : µ1 ∧ . . . Fn : µn ∈ P )I |= C. If C ∈ P − P , then I(F ) ∈ lf p(TP )(F ) ⊆ µ, and therefore, I |= F : µ. If C ∈ P , then, because C is strict, there exists such index i, that lf p(TP )(Fi ) ∩ µi = ∅. Then I |= Fi : µi , and therefore I |= F : µ ←− F1 : µ1 ∧ . . . Fn : µn and I |= C. For the class of simple p-programs, strictness can be efficiently checked and is a necessary condition. This leads to polynomial-time upper bounds on entailment and consistency. Theorem 7. 1. For a simple p-program P checking whether it is strict can be performed in polynomial time. 2. For a simple p-program P , M od(P ) = I(lf p(TP )) iff P is strict. Corollary 3. Consistency and entailment problems are solvable in polynomial time for strict simple p-programs. The following example shows that strictness is not a necessary condition for nonsimple programs. Example 5. Consider the following p-program P7 : a : [0.6, 0.8] ←−. b : [0.6, 0.7] ←−. d : [0.2, 0.3] ←− . c : [0.4, 0.5] ←− (a ∧ b) : [0.65, 0.7] ∧ (b ∨ d) : [0.5, 0.6]. lf p(TP ) assigns intervals [0.2, 0.7] and [0.6, 1] to a ∧ b and b ∨ d respectively, and therefore, P7 is not strict. However, there exists no p-interpretation I which satisfies the first three rules and the body of the fourth rule: I(b ∨ d) ∈ [0.5, 0.6] implies, I(b ∨ d) = 0.6 and I(b) = 0.6, while I(a ∧ b) ∈ [0.65, 0.7] implies that I(b) ≥ 0.65. Therefore, M od(P ) coincides with I(lf p(TP )).
6 Related Work and Conclusions A survey of different approaches to probabilistic logic programming can be found in [6] and [5]. This paper studies the precise semantics of a logic programming language
342
A. Dekhtyar and M.I. Dekhtyar
for reasoning about the interval probabilities of events and their combinations. This language, proposed by Ng and Subrahmanian[12] is a natural extension of Interval Probabilistic Satisfiability problem PSAT [8]: an instance of Interval PSAT is a p-program, in which all rules have no bodies. We show that for this, relatively simple language, the class of satisfying models (probabilistic interpretations) has a complex description: it is a union of a number of (closed, open, semiopen) intervals, obtained, solving an array of Interval PSAT problems. On the positive side, our results show how to compute the set of models of a p-program precisely. On the negative side, the complexity of the description and the computational complexity of the problem itself suggest that intervals may be inadequate as the means for specifying imprecision in probabilistic assessments.
References 1. G. Boole. (1854) The Laws of Thought, Macmillan, London. 2. Chitta Baral, Michael Gelfond, J. Nelson Rushton. (2004) Probabilistic Reasoning With Answer Sets, in Proc. LPNMR-2004, pp. 21-33. 3. Luis M. de Campos, Juan F. Huete, Serafin Moral (1994). Probability Intervals: A Tool for Uncertain Reasoning, International Journal of Uncertainty, Fuzziness and KnowledgeBased Systems (IJUFKS), Vol. 2(2), pp. 167 – 196. 4. V.Chv´atal. (1983) Linear Programming. W. Freeman and Co., San Fancisco, CA. 5. A. Dekhtyar, M.I. Dekhtyar. (2004) Possible Worlds Semantics for Probabilistic Logic Programs, in Proc., International Conference on Logic Programming (ICLP)’2004, LNCS, Vol. 3132, pp. 137-148. 6. A. Dekhtyar and V.S. Subrahmanian (2000) Hybrid Probabilistic Programs. Journal of Logic Programming, Volume 43, Issue 3, pp. 187 – 250 . 7. R. Fagin J. Halpern, and N. Megiddo. (1990) A logic for reasoning about probabilities, Information and Computation, vol. 87, no. 1,2, pp. 78-128. 8. G.Georgakopoulos, D. Kavvadias, C.H. Papadimitriou. (1988) Probabilistic Satisfiability, Journal of Complexity, Vol. 4, pp. 1-11. 9. T. Hailperin. (1965) Best Possible Inequalities for the Probability of a Logical Function of Events, American Mathematical Monthly, Vol. 72, pp. 343–359. 10. H.E. Kyburg Jr. (1998) Interval-valued Probabilities, in G. de Cooman, P. Walley and F.G. Cozman (Eds.), Imprecise Probabilities Project, http://ippserv.rug.ac.be/documentation/interval prob/interval prob.html. 11. R. Ng and V.S. Subrahmanian. (1993) Probabilistic Logic Programming, Information and Computation, 101, 2, pps 150–201, 1993. 12. R. Ng and V.S. Subrahmanian. A Semantical Framework for Supporting Subjective and Conditional Probabilities in Deductive Databases, J OURNAL OF AUTOMATED R EASON ING , 10, 2, pps 191–235, 1993. 13. R. Ng and V.S. Subrahmanian. (1995) Stable Semantics for Probabilistic Deductive Databases, I NFORMATION AND C OMPUTATION, 110, 1, pps 42-83. 14. L. Ngo, P. Haddawy (1995) Probabilistic Logic Programming and Bayesian Networks, in Proc. ASIAN-1995, pp. 286-300. 15. N. Nilsson. (1986) Probabilistic Logic, AI Journal 28, pp 71–87. 16. D. Poole (1993). Probabilistic Horn Abduction and Bayesian Networks. Artificial Intelligence, Vol. 64(1), pp. 81-129. 17. Walley, P. (1991). Statistical Reasoning with Imprecise Probabilities. Chapman and Hall, 1991.
Routley Semantics for Answer Sets Sergei Odintsov1 and David Pearce2, 1
Sobolev Institute of Mathematics, Novosobirsk, Russia [email protected] 2 Universidad Rey Juan Carlos, Madrid, Spain [email protected]
Abstract. We present an alternative model theory for answer sets based on the possible worlds semantics proposed by Routley (1974) as a framework for the propositional logics of Fitch and Nelson. By introducing a falsity constant or second negation into Routley models, we show how paraconsistent as well as ordinary answer sets can be represented via a simple minimality condition on models. This means we can define a paraconsistent version of equilibrium logic, or paraconsistent answer sets (PAS) for propositional theories. The underlying logic of PAS is denoted by N9 . We characterise it axiomatically and algebraically, showing it to be the least conservative extension of the logic of here-and-there with strong negation. In addition, we show that N9 captures the strong equivalence of programs in the paraconsistent case and can thus serve as a useful mathematical foundation for PAS. We end by showing that N9 has the Interpolation Property.
1 Introduction In Pearce [19] it was shown how the nonclassical logic of here-and-there with strong negation, often denoted by N5 , can serve as a foundation for answer set programming (ASP). The main property involved is that answer sets can be viewed as a certain kind of minimal N5 -model. A second key property was established in [13]: programs are strongly equivalent wrt answer set semantics (see §5.2) if and only if they are equivalent viewed as propositional theories in N5 . This shows that N5 can be used to reason about answer set programs, and N5 -deduction may be relevant for program transformation and optimisation. These issues have been explored in several recent works in the area of logic programming and nonmonotonic reasoning, where N5 -inference as well as its metatheoretic properties have been exploited, [21,26,27]. It is natural to ask whether other kinds of logic programming semantics, either variants of ASP, or alternatives such as the well-founded semantics (WFS), also possess a well-behaved monotonic ‘base’ logic. Although some partial results have been obtained, generally speaking complete solutions are still lacking. For WFS, for instance, it is not even known whether there exists a monotonic, deductive characterisation of strongly equivalent programs. In this paper we show how the paraconsistent version of answer set semantics also admits a natural underlying, monotonic logic, which we denote by N9 , and we look at an alternative model theory for answer sets due to R. Routley. Paraconsistent answer
Partially supported by CICyT project TIC-2003-9001-C02 and WASP (IST-2001-37004).
C. Baral et al. (Eds.): LPNMR 2005, LNAI 3662, pp. 343–355, 2005. c Springer-Verlag Berlin Heidelberg 2005
344
S. Odintsov and D. Pearce
sets (PAS) were studied as a logic programming semantics by Sakama and Inoue [30]. Recently, Alcantara et al [1] have made some progress towards a logical, declarative style of characterisation for PAS. However, [1] do not axiomatise or otherwise syntactically characterise the underlying (monotonic) logic of PAS; nor do they investigate the problem of strong equivalence. Moreover, their semantical frames can easily be reduced to a simpler notion of possible worlds model proposed by Routley [29] in 1974 as a semantical framework for the propositional logics of Nelson [16] and Fitch [6]. By introducing a falsity constant or second negation into Routley models, we can show how paraconsistent as well as ordinary answer sets can be represented via a simple minimality condition on models. It is relatively straightforward to prove this property from first principles. However, in the paper we will make use of the results of [1]. In particular we show (i) how the semantical frames of [1] can be reduced to Routley models, and (ii) how this leads to a simple characterisation of paraconsistent answer sets. An additional condition on Routley models yields N5 -models that capture ordinary answer sets. In the case of PAS, the underlying logic N9 belongs to the lattice of logics studied by Odintsov [17] which we denote here by EN− ¬ . We axiomatise the logic, showing it to be the least conservative extension of the logic of here-and-there with strong negation, representable via the full twist-structure on the 3-element Heyting algebra. The latter means that N9 can be viewed as a 9-valued logic, which explains the notation. In addition, we show that the logic suffices to characterise the strong equivalence of programs in the paraconsistent case and can thus serve as a useful mathematical foundation for PAS. We conclude the mathematical part of the paper by showing that the logic has the Interpolation Property. Besides providing a logico-mathematical foundation for PAS, and an extension to arbitrary theories, we hope to shed some light on the interplay between strong or explicit negation, ‘∼’, and default negation or negation-as-failure, ‘¬’ or ‘not’. Unlike in the usual case, in the paraconsistent version of answer sets, default negation is no longer definable in terms of strong negation. An interesting feature of PAS is that all the paraconsistency resides in that part of reasoning involving strong negation, reflecting the idea that basic information (facts) and even rules may be contradictory. That part of reasoning involving default negation, on the other hand, remains quite standard: the underlying logic of PAS extends intuitionistic logic and is even a conservative extension of the logic of here-and-there, when ‘not’ is identified with intuitionistic negation ‘¬’.
2 Some Background on Constructible Falsity The concept of constructible falsity was introduced into logic by David Nelson [16] via his system of constructive logic with strong negation, later often denoted by N. Nelson’s logic was subsequently axiomatised by Vorob’ev [32,33] and studied algebraically in the 1950s and 60s by the group of Helena Rasiowa [28]. A logical system related to Nelson’s, but somewhat weaker, was developed by Fitch [6]. From the early 1970s several authors explored logical systems similar to Nelson’s and Fitch’s but lacking the “explosive” axiom α → (∼α → β), thus producing paraconsistent logics. The paraconsistent version of N is sometimes denoted by N− . It was studied independently by R. Routley (later R. Sylvan) in the propositional case in [29],
Routley Semantics for Answer Sets
345
by L´opez-Escobar in [14] and by Nelson himself in [2], both in the first-order case. A very similar system was explored by von Kutschera in [12]. Both the logics N and N− , as well as the corresponding systems of Fitch, are extensions of positive logic. Only N itself can be viewed as an extension of intuitionistic logic, when the intuitionistic negation ‘¬’ is defined in it, say by ¬α := α → ∼α. Kripke semantics for N ([31,9]) is readily obtained from the usual Kripke semantics for intuitionistic logic by assigning to each world, instead of a set of atoms, a set of literals, ie. atoms or strongly negated atoms. Equivalently, the truth-assignment on atoms and worlds is 3-valued, to reflect the three cases of verified, falsified or neither. Changing to 4-valued assignments in Kripke models produces a semantics for N− : the fourth value now corresponds to “overdetermined” or the situation that both a literal and its contrary are verified at a world. An alternative possible worlds semantics for constructive logic with strong negation was provided by Routley in [29]. Routley studied all four variants of the Fitch and Nelson logics and proved completeness relative to models with 2-valued truth assignments. To handle strong negation and paraconsistency, Routley made use of a kind of non-normal worlds, related to ordinary worlds via a star operation (a kind of involution); hence one has normal and “starred” worlds. Since in N− , unlike in N, intuitionistic negation is not definable, there are several options for introducing a second negation into the paraconsistent systems. This topic has recently been studied in [17] which investigates the lattice of extensions of N− augmented with a falsum constant ⊥ satisfying two new axioms. 2.1 Constructible Falsity and Nonmonotonic Reasoning At the end of the 80s the use of constructible falsity, via normal and paraconsistent versions of Nelson’s logic and its variants, was explored as a tool for knowledge representation and reasoning. and studied in depth in the context of logical languages for information and knowledge exchange in several articles and books, [24,25,36,10,35]. In nonmonotonic logic programming in the tradition of stable models, strong negation became firmly established via the answer set semantics of Gelfond and Lifschitz [7]. The fact that they called their second negation, representing explicit falsity, classical, obscured at first the connection to Nelson’s logic N; though for computational purposes they used precisely the same reduction technique as Vorob’ev to eliminate strong negation through the addition of new predicates. That answer set inference could be viewed as an extension of Nelson’s logic N was later established in [18]. Later, attempts to find a precise match between answer set inference and a logic in the lattice of extensions of N led to equilibrium logic based on the propositional logic of here-and-there with strong negation, see Pearce [19,20], that we denote here by N5 . Equilibrium logic can be understood both as a nonmonotonic extension of N5 and as a generalisation of the language of answer set programming to full propositional logic. Paraconsistency also came to be considered in logic programming, initially by Blair and Subrahmanian [3], later by several other authors, for an overview see [4]. Among them, Sakama and Inoue [30] proposed a paraconsistent version of answer set semantics, essentially by dropping the requirement that one discard inconsistent models in the construction of answer sets. Recently the paraconsistent version of answer sets (PAS) was taken up again by Alcantara, Dam´asio and Pereira [1] who have attempted to give
346
S. Odintsov and D. Pearce
a more declarative style of characterisation of PAS, more in the spirit of the logical approach to AS [19]. However [1] uses a two-valued semantics based on frames, rather than the usual four values associated with the more typical Kripke model approach to paraconsistent logics such as N− . Here we show that the Routley [29] semantics, with the addition of a constant ⊥ or a second negation ¬, will do equally well; the advantage is that we know these models to be complete for N− .
3 Routley Semantics for N− N− is the weak, paraconsistent version of Nelson’s constructive logic with strong negation. Formulas of N− are built-up in the usual way using the logical constants: ∧, ∨, →, ∼, standing respectively for conjunction, disjunction, implication and strong negation. The only rule of inference for N− is modus ponens and the axioms are the axiom schemata of positive logic: P1. α → (β → α) P3. (α → (β → γ)) → ((α → β) → (α → γ)) P5. (α → β) → ((α → γ) → (α → (β ∧ γ))) P7. (α → γ) → ((β → γ) → ((α ∨ β) → γ))
P2. (α ∧ β) → α P4. (α ∧ β) → β P6. α → (α ∨ β) P8. β → (α ∨ β)
plus the following axiom schemata involving strong negation taken from the calculus of Vorob’ev [32,33] (where ‘α ↔ β’ abbreviates (α → β) ∧ (β → α)): N1. ∼ (α → β) ↔ α ∧ ∼β N3. ∼(α ∨ β) ↔ ∼α ∧ ∼β
N2. ∼(α ∧ β) ↔ ∼α∨ ∼ β N4. ∼ ∼α ↔ α
The main idea of Routley semantics is that the validity of negation ∼α at a world w is equivalent to the falsity of α not at w as in classical logic but at some adjacent world w∗1 . To define Routley semantics for N− we have additionally to divide the set of possible worlds into parts, unstarred and starred worlds. A Routley model for N− is a quadruple M = W ∪ W ∗ , ≤,∗ , V such that: W ∪ W ∗ is a non-empty set (of worlds), W ∩ W ∗ = ∅, ≤ is a partial ordering on W , ∗ is a bijection on W ∪ W ∗ , ∗(W ) = W ∗ , and V is a valuation function from Atoms × W −→ {0, 1} satisfying the following conditions: 1. u ≤ w ⇒ w∗ ≤ u∗ , 2. w = w∗∗ , 3. V (p, u) = 1 and u ≤ w imply V (p, w) = 1. V is extended to a valuation on all formulas via the following conditions: V (ϕ ∧ (∨)ψ, w) = 1 iff V (ϕ, w) = 1 and (or) V (ψ, w) = 1 V (∼ϕ, w) = 1 iff V (ϕ, w∗ ) = 0 For implication, one distinguishes between starred and unstarred worlds as follows. For w ∈ W , V (ϕ → ψ, w) = 1 iff for every w ∈ W such that w ≤ w , V (ϕ, w ) = 1 ⇒ V (ψ, w ) = 1. For w ∈ W ∗ , V (ϕ → ψ, w) = 1 iff V (ϕ, w∗ ) = 1 ⇒ V (ψ, w) = 1. 1
A natural understanding of the ∗ operator is a moot point. For discussion and further links we refer the reader to [5].
Routley Semantics for Answer Sets
347
A proposition ϕ is said to be true in a Routley model M = W, ≤,∗ , V , if V (ϕ, v) = 1, where v is an arbitrarily selected unstarred element of W . A formula is valid if it is true in every Routley model. It is easy to prove by induction that condition 3 above holds for any formula ϕ, ie V (ϕ, u) = 1 & u ≤ w ⇒ V (ϕ, w) = 1. Moreover N− is complete for the Routley semantics in the sense that a formula is valid iff it is a theorem of N− . In the full Nelson logic, N, intuitionistic or weak negation ¬ is definable, eg by ¬ϕ := ϕ → ∼ϕ. In the paraconsistent N− , however, there are various options for introducing an intuitionistic style negation, ¬. We shall consider a second negation ¬ defined via the constant ⊥, ¬ϕ := ϕ → ⊥, characterised semantically via the following condition: V (⊥, w) = 0 for all w. The logic obtained in this way we denote N− ¬ . Note that validity of ∼-free formulas in N− ¬ can be defined via unstarred worlds only. Moreover, this definition is identical with the validity of formulas in Kripke semantics for intuitionistic logic. Therefore, N− ¬ is a conservative extension of intuitionistic logic. − Proposition 1. N− ¬ = N + {⊥ → p, p →∼ ⊥}
Proof sketch. The validity of formulas ⊥ → p and p →∼ ⊥ is verified directly. The completeness follows by an obvious modification of the original Routley proof. 2 ⊥ Thus, the logic N− ¬ is identical with the logic N4 studied in [17] and we can apply − to extensions of N¬ the results of [17].
4 Answer Set Semantics We consider the version of answer set semantics defined for disjunctive logic programs with two kinds of negation [7]. We use the syntax of N− ¬ to describe the rules or formulas of programs. Strong negation is denoted therefore by ‘∼’ and the second, default negation, usually written as ‘not’ will be denoted by ‘¬’. The formulas of disjunctive programs therefore have the form L1 ∧ . . . ∧ Lm ∧ ¬ Lm+1 ∧ . . . ∧ ¬ Ln → K1 ∨ . . . ∨ Kk
(1)
where each Li , Kj is a literal (atom or strongly negated atom) and we may have m = n and m or n may be zero. A logic program Π is a set of such formulas. The set of all literals in the language of Π is denoted by Lit. We assume the reader is familiar with the usual definition of answer set [7] employing the notion of reduct. Paraconsisent answer sets (PAS) are defined, following [30], in the same way but omitting the clause ((ii) of [7]) which essentially imposes consistency by making Lit the only inconsistent answer set. Some simple examples from [30] may help to illustrate the difference between answer sets and PAS. For instance the program {∼A; ¬B → A} has no answer sets but an inconsistent PAS {A, ∼A}, while the program {A; ∼A; ¬B → B} has Lit as its only answer sets, but no paraconsistent answer sets. The reader is referred to [30] for further properties of PAS and additional motivation.
348
S. Odintsov and D. Pearce
5 Here-and-There Models In the semantics for intermediate or superintuitionistic logics, the so-called logic of here-and-there can be captured by rooted frames with two elements, commonly denoted by h and t and called ‘here’ and ‘there’, with h ≤ t. If we work instead in the lattice of extensions of Nelson’s logic N− , we can consider here-and-there models as special kinds of Routley models. In the obvious way therefore a Routley here-and-there model can be represented as a Routley model M = W ∪ W ∗ , ≤,∗ , V , where W = {h, t} comprises two worlds ‘here’ and ‘there’, such that h ≤ t, and W ∗ = {h∗ , t∗ } comprises the “starred” worlds. It follows that t∗ ≤ h∗ . We now consider the relation between Routley here-and-there models and answer sets, in particular paraconsistent answer sets. We shall therefore assume that a second negation ¬ is present in the language understood according to the above semantics for N− ¬ . The logic determined by here-and-there Routley models according to the semantics of N− ¬ will be denoted by N9 . We prove (Proposition 6) that this logic is determined by a 9-valued matrix, which explains the choice of notation. Recently a frame based semantics has been presented by Alcantara et al [1] to provide a more declarative style of representation for paraconsistent answer sets. Their approach (henceforth ADP frames) is based on here-and-there style worlds and 2-valued truth-valuations. In fact they call their models HT 2 -models. Syntax is as for the logic N− ¬ , but the frames employ no fewer than 3 accessibility relations to model the logical constants →, ¬, ∼. In addition the authors use point sets and so-called belief sets. It turns out however that several items of this rather complicated machinery are redundant. Once redundancies are removed it is easy to see that the HT 2 -models can be replaced without loss by Routley here-and-there models. We now indicate the steps to show this. 5.1 ADP Frames [1] define frames based on point sets, where a point set P = Q, ≤ , with Q a set and ≤ a partial ordering on Q. Propositions on P are upwards closed subsets of Q. Frames are point sets together with acccessibility relations. According to [1], an HT 2 frame is defined as follows. The underlying point set P = Q, ≤ is such that Q has four elements that we will denote here by h, h∗ , t, t∗ , where h ≤ t and t∗ ≤ h∗ . Secondly, three accessibility relations are defined on P that we will denote here by R, R∼ , R¬ . R is a ternary relation and R∼ and R¬ are binary relations determined by: R(h, h, h), R(h, h, t), R(h, t, t), R(t, t, t), R(t, h, t), R(t∗ , t, t∗ ), R(t∗ , t, h∗ ), R(t∗ , h, t∗ ), R(t∗ , h, h∗ ), R(h∗ , h, h∗ ). R∼ (h, h∗ ), R∼ (t, t∗ ), R∼ (h∗ , h), R∼ (t∗ , t), R∼ (h, t∗ ), R∼ (t∗ , h). R¬ (h, h), R¬ (t, t), R¬ (h, t), R¬ (t, h), R¬ (h∗ , h), R¬ (t∗ , h), R¬ (t∗ , t). An HT 2 model M is formed from an HT 2 frame by assigning atoms to the four points in accordance with the interpretation that propositions form upwards closed sets. In other words if we denote the set of atoms true in w by W , then we have w ≤ w implies W ⊆ W . The assignment of atoms to points is extended to all propositions via standard conditions for conjunction and disjunction and the following clauses:
Routley Semantics for Answer Sets
349
(M, w) |= ϕ → ψ iff ∀w , w s.t.R(w, w , w ), (M, w ) |= ϕ ⇒ (M, w ) |= ψ. (M, w) |= ¬ϕ iff ∀w s.t.R¬ (w, w ), (M, w ) | =ϕ (M, w) |= ∼ϕ iff ∀w s.t.R∼ (w, w ), (M, w ) | =ϕ It is straightforward to check that HT 2 models are equivalent to Routley here-andthere models. Let M be an HT 2 model. Then the corresponding Routley model M = W, W ∗ , ≤,∗ , V consists of the same four points or worlds h, h∗ , t, t∗ , such that for any propositional atom p, and world w, V (p, w) = 1 ⇔ (M, w) |= p, and conversely. Proposition 2. For all formulas ϕ and worlds w, V (ϕ, w) = 1 ⇔ (M, w) |= ϕ. Proof sketch. By assumption the two models make the same truth assignment for atoms. The truth conditions for conjunction and disjunction are also the same in each case. For the remaining connectives one simply applies the definitions. The verification is tedious but simple. We illustrate the case of strong negation; other cases are left to the reader. By Routley semantics we have V (∼ϕ, w) = 1 iff V (ϕ, w∗ ) = 0. Consider the case w = h. Then we have V (∼ϕ, h) = 1 iff V (ϕ, h∗ ) = 0. By the ADP semantics, (M, h) |= ∼ϕ iff for all w s.t. R∼ (h, w), (M, w) | = ϕ iff (M, h∗) | = ϕ (applying the definition of R∼ and noting that by the hereditary condition and the fact that t∗ ≤ h∗ , (M, h∗ ) | = ϕ implies (M, t∗ ) | = ϕ). So V (∼ϕ, h) = 1 ⇔ (M, h) |= ∼ϕ. The argument for other worlds w is analogous. 2 We can therefore replace the rather complicated HT 2 models of [1] by simpler Routley here-and-there models. Aside from simplicity, an advantage is that we know that Routley models capture logics in the lattice EN − of extensions of Nelson’s logic and with minor modification they capture the logic of Fitch and its extensions. 5.2 Minimal Models Consider Routley here-and-there models M = W, W ∗ , ≤,∗ , V , where W = {h, t} with h ≤ t, and W ∗ = {h∗ , t∗ }. More succinctly, represent M as a pair of ordered pairs (H, H ∗ , T, T ∗ ), where the upper-case letters denote the sets of atoms verified at the corresponding point or world. Even more succinctly we can denote an unstarred, starred pair in the form H and T, so M is represented simply as (H, T), with H = H, H ∗
and T = T, T ∗ . Such pairs can be partially ordered as follows. We say in general that H ≤ T if H ⊆ T and T ∗ ⊆ H ∗ . Notice that by the Routley semantics, if (H, T) is a model then necessarily H ≤ T. This ordering can be extended to a partial ordering among models as follows. We set (H, T) (H , T ) if (i) T = T ; (ii)H ≤ H . A model (H, T) in which H = T is said to be total. We are interested here in a special kind of minimal model that we call an equilibrium model. Let Π be a theory. A model M of Π is said to be an equilibrium model of Π if (i) M is total; (ii) M is minimal among models of Π under the ordering . In other words an equilibrium model of Π has the form (T, T) and is such that if (H, T) is a model of Π with H ≤ T, then H = T. The main property of equilibrium models is expressed in the next proposition. We introduce some notation. For a set X of atoms we set ∼X = {∼A : A ∈ X} and denote by X the complement of X. Then, note that a literal L is true in a model (H, T), just in case L ∈ H ∪ ∼H ∗ .
350
S. Odintsov and D. Pearce
Proposition 3. Let Π be a disjunctive logic program. A set of literals S is a paraconsistent answer set of Π just in case it can be represented in the form S = T ∪ ∼T ∗ where T and T ∗ are sets of atoms, and (T, T) is an equilibrium model of Π such that T = T, T ∗ . Proof sketch. By Proposition 2, HT 2 models can be equivalently represented as Routley here-and-there models (H, T). Using this representation, by Theorem 1 of [1], (H, T) is a model of a disjunctive program Π iff the sets I = H ∪ ∼H ∗ and J = T ∪ ∼T ∗ are models of the reduct Π J . By Theorem 2 of [1], paraconsisent answer sets correspond to total models (T, T) in which T satisfies a certain minimality condition. By this condition, if (H, T) is a model of Π different from (T, T) but with H ≤ T, then clearly I = H ∪ ∼H ∗ is a model of Π J strictly contained in J = T ∪ ∼T ∗ . But this is impossible by the definition of answer sets. Hence paraconsistent answer sets correspond to total models that are minimal under . 2 This shows the equivalence of paraconsistent answer sets and equilibrium models in N9 . However, notice that the notion of equilibrium model is defined for arbitrary propositional theories, not only disjunctive logic programs. From the above proposition it follows that any theories logically equivalent in N9 have the same equilibrium models. In general we say that two programs or theories, Π1 and Π2 , are strongly equivalent if for any set of formulas Π, Π1 ∪ Π and Π2 ∪ Π have the same equilibrium models. So clearly any two theories equivalent in N9 are strongly equivalent. As in the ordinary (non-paraconsistent) case, the converse also holds. Proposition 4. Two propositonal theories, Π1 and Π2 , are strongly equivalent if and only if they are equivalent in N9 . The method of proof is similar to that of Theorem 1 of [13] adapted to take account of strong negation and paraconstency. We omit the details. Finally, to obtain ordinary answer sets for the non-paraconsistent case we add one more condition on Routley models, namely we require for all worlds w, w ≤ w∗ . The notion of equilibrium is defined exactly as before and the resulting here-and-there Routley models are axiomatised by the logic N5 , studied in [11,22,23].
6 On the Logic N9 In this section we axiomatise the logic N9 , prove that it can be defined via a 9-element matrix and establish that it possesses the Craig interpolation property. To this end we will use some facts from [17] concerning the algebraic semantics of N− ¬ and the interrelations of the lattices of extensions EN− ¬ and EInt, where Int is intuitionistic logic. The lattice of logics EN− ¬ (EInt) consists of sets of formulas in the respective language containing all N− ¬ -(Int-)tautologies and closed under the rules of substitution and modus ponens, ie. a logic is identified with its set of tautologies. The meet-operation in these lattices coincides with set-theoretical intersection and the join operation is the closure of the sum of logics wrt substitution and modus ponens. If L ∈ EN− ¬ (EInt) and X is a set of formulas, then L + X denotes the least logic containing L and X.
Routley Semantics for Answer Sets
351
Recall that the algebraic semantics for Int and its extensions is provided by Heyting algebras. An algebraic structure A = A, ∨, ∧, →, 0, 1 is said to be a Heyting algebra if its reduct A, ∨, ∧, 0, 1 is a bounded lattice and the pseudo-complement a → b is the greatest x such that a ∧ x ≤ b. Validity of formulas in Heyting algebras (A |= ϕ) is understood in a usual way assuming that the unit 1 is the only distinguished element. Intuitionistic logic Int coincides with the set of formulas valid in all Heyting algebras. For any Heyting algebra A define the logic LA:= {ϕ : A |= ϕ}. Clearly, LA ∈ EInt. For a class K of Heyting algebras, LK = {LA : A ∈ K}. If L = LK we say that L is characterized by the class K. Every element of EInt is characterized by some class of Heyting algebras. 6.1 Twist-Structures Definition 1. Let A = A, ∨, ∧, →, 0, 1 be a Heyting algebra. A full twist-structure over A is an algebra A = A × A, ∨, ∧, →, ∼, ⊥, 1 with twist-operations defined for (a, b), (c, d) ∈ A × A as follows: (a, b) ∨ (c, d) := (a ∨ c, b ∧ d), (a, b) ∧ (c, d) := (a ∧ c, b ∨ d) (a, b) → (c, d) := (a → c, a ∧ d), ∼ (a, b) := (b, a), ⊥ := (0, 1), 1 := (1, 0). A twist-structure over A is an arbitrary subalgebra B of the full twist-structure A such that π1 (B) = A (in which case also π2 (B) = A), where πi , i = 1, 2, is a projection of a direct product onto the ith coordinate. For a Heyting algebra A denote by A 0 a twist-structure over A with the universe |A 0 | = {(a, b) : a, b ∈ A, a ∧ b = 0}. A valuation into a twist-structure B is defined in a usual way as a homomorphism of an algebra of formulae into B. The relation B |= ϕ, where ϕ is a formula of a respective language, means that π1 v(ϕ) = 1 for any B-valuation v. For a formula ϕ, the relation |= ϕ means that B |= ϕ for any twist-structure B. Theorem 1. [17] Let ϕ be a formula. Then N− ¬ ϕ ⇔ |= ϕ. Moreover, it was proved in [17] that algebras isomorphic to twist-structures form a variety and that any logic extending N− ¬ is characterized by some subvariety of this variety. − For a logic L ∈ EInt, define the N− ¬ -extensions η (L) and η(L) as follows − η − (L) = N− ¬ + L and η(L) = η (L)+ ∼ p → (p → q).
Note that the logic η(Int) = N− ¬ + ∼ p → (p → q) can be identified with the logic N, because if we define in N the new constant ⊥ :=∼ (p → p) it satisfies the two new axioms of the logic N− ¬ . It was proved in [8] that η(L) is the least conservative extension of L in the lattice EN. In [17], it was stated that η − (L) is the least conservative extension of L in the lattice EN− ¬. For any twist-structure A define the logic LA := {ϕ : A |= ϕ}. Then LA ∈ EN− ¬.
352
S. Odintsov and D. Pearce
Proposition 5. Let A be a Heyting algebra and L = LA. 1. [17] η − (L) = LA . 2. [8] η(L) = LA 0 . 6.2 Axioms of N9 It it well known that the logic HT of here-and-there is determined by the two-element Kripke frame or by the three-element Heyting algebra 3, where |3| = {0, 1/2, 1}, 0 ≤ 1/2 ≤ 1. We prove now that N9 is determined by the twist-structure 3 . Proposition 6. N9 = L3 . Proof. Let M = (H, H ∗ , T, T ∗ ) be a Routley here-and-there model. Define a 3 valuation vM by the following equivalences. π1 vM (p) = 0 iff p ∈T π1 vM (p) = 1 iff p ∈ H π2 vM (p) = 1/2 iff p ∈ H ∗ \ T ∗
π1 vM (p) = 1/2 iff p ∈ T \ H π2 vM (p) = 0 iff p ∈H ∗ π2 vM (p) = 1 iff p ∈ T ∗
Clearly, the mapping M →vM establishes a one-to-one correspondence between Routley here-and-there models and 3 -valuations. An easy induction on the structure of formulas shows that π1 vM (ϕ) = 1 iff ϕ is true at h in M and so at every unstarred world of M. 2 Taking into account Proposition 5 we arrive at Corollary 1. N9 = η − (HT ). The logic of here-and-there is axiomatized over Int by the formula p ∨ (p → q) ∨ ¬q. Therefore, N9 is axiomatized by the same formula over N− ¬ . Note also that N5 = η(HT ) and it is characterized by the five-element twist-structure 3 0 , which explains the choice of notation.2 6.3 Interpolation Property We say that a logic L possesses the Craig interpolation property, for short CIP, if ϕ → ψ ∈ L implies that there exists a formula χ such that ϕ → χ ∈ L and χ → ϕ ∈ L, and χ has occurences of common variables of ϕ and ψ only. The algebraic counterpart of this property is as follows. Let K be a class of algebras. We say that K has an amalgamation property if for any algebras A0 , A1 , A2 ∈ K and monomorphisms i1 : A0 → A1 and i2 : A0 → A2 , there exists an algebra A ∈ K and monomorphisms ε1 : A1 → A and ε2 : A2 → A such that ε1 i1 = ε2 i2 . The triple (A, ε1 , ε2 ) is called an amalgam of A1 and A2 over A0 . It was proved in [15] that an intermediate logic possesses CIP if and only if the variety of its models has an amalgamation property. The next statement can be obtained by an easy modification of the proof from [15]. 2
In [1] the authors also mention that propositions on their frames take 9 possible truth values.
Routley Semantics for Answer Sets
353
Proposition 7. Let L ∈ EN− ¬ . L possesses CIP if and only if the family of twiststructures A such that A |= L has an amalgamation property. Proposition 8. The logic N9 possesses CIP. Proof. Recall that N9 = η − (HT ), and that models of N− ¬ are exactly twist-structures over HT -models. In [15] it was proved that the latter possess the amalgamation property. We verify that the same holds for N9 -models. Let A0 , A1 , A2 |= HT . Consider twist-structures B0 , B1 and B2 over A0 , A1 and A2 , respectively, and their embeddings i1 : B0 → B1 and i2 : B0 → B2 . Then π1 i1 embeds A0 into A1 , and π1 i2 embeds A0 into A2 . There is an amalgam (A, ε1 , ε2 ) of A1 and A2 over A0 . Lift up the monomorphisms ε1 and ε2 as follows. Put (εi ) ((a, b)) = (εi (a), εi (b)) for (a, b) ∈ Bi . It is not hard to check that (ε1 ) and (ε2 ) are embeddings of B1 and B2 into A . So we obtain the following diagram.
i1
B0
@ i 2
R @
B1 @ ε1 R @ A ε 2
B2
Commutativity of this diagram immediately follows from the equalities ε1 π1 i1 = ε2 π2 i2 . 2 Note that CIP for N5 can be established in the same way.
7 Conclusions and Future Work Extending the results of [19] and [1] we have shown how both ordinary and paraconsistent answer sets can be captured via possible worlds models due to Routley [29]. In the case of PAS, the underlying logic, N9 , has been identified axiomatically and algebraically, and an important metalogical property - interpolation - has been proved. A consequence of our analysis is that PAS can easily be defined for arbitrary theories. An interesting feature to emerge is that the underlying logic of PAS, although paraconsistent, still extends intuitionistic inference (unlike say well-founded semantics), and is still a conservative extension of the logic of here-and-there. Answer set programming is already being applied in areas such as information integration where data sources may be incomplete and inconsistent (see INFOMIX: http://sv.mat.unical.it/infomix/). In this area paraconsistent reasoning may be a useful extension to ordinary ASP, and here PAS may be worthy of further study.3 Following Wagner [34] one can distinguish different styles of information processing in the presence of contradictions. Our characterisation of PAS should provide a useful basis 3
Currently INFOMIX uses various database repair techniques to restore consistency prior to query evaluation.
354
S. Odintsov and D. Pearce
for developing these issues further in the setting of logic programming. For example we may want to assume explosiveness for one kind of statement and not for another; eg one might distinguish essential information, where contradictions are not admitted, from ”information noise”, where contradictions are irrelevant. We can also discuss different ways in which contradictions may be localised. In this respect, the logic N− has the advantage of having no contradictory extensions [17]. It is not compatible with contradiction as a scheme, ie. it admits only local contradictions. Another important avenue for further research is the comparison of PAS with other approaches to paraconsistency in logic programming and nonmonotonic reasoning. In particular our purely logical characterisation of PAS may facilitate comparison with paraconsistent logics in general.
References 1. J. Alcantara, C. Dam´asio & L. M. Pereira. A Declarative Characterisation of Disjunctive Paraconsistent Answer Sets. In R. L´opez de M´antaras & L. Saitta (eds), Proc. of ECAI 2004, IOS Press, 2004, 951-952. Full version available at http://centria.di.fct.unl.pt/ jfla/publications/. 2. A. Almukdad & D. Nelson. Constructible Falsity and Inexact Predicates. J. Symbolic Logic 49 (1984), 231-233. 3. H. Blair & V.S. Subrahmanian. Paraconsistent logic programming. Theoretical Computer Science 68 (1989), 135-154. 4. C. Dam´asio & L. M. Pereira. A survey of paraconsistent semantics for logic programs. in D. Gabbay & P. Smets (eds), Handbook of Defeasible Reasoning and Uncertaintly Management Systems, Vol. 2, Kluwer, 1998, 241-320. 5. J.M. Dunn. Relevance logic and entailment. in D. Gabbay et al. (eds), Handbook of philosophical logic. Vol. III: Alternatives to classical logic, Reidel, Synth. Libr. 166, 1986, 117224. 6. F. B. Fitch. Symbolic Logic, an Introduction. Ronald Press, New York, 1952. 7. M. Gelfond and V. Lifschitz. Classical negation in logic programs and disjunctive databases. New Generation Computing, 9 (1991), 365–385, . 8. V. Goranko. The Craig Interpolation Theorem for Propositional Logics with Strong Negation. Studia Logica 44 (1985), 291-317. 9. Y. Gurevich. Intuitionistic logic with strong negation. Studia Logica, 36 (1977), 49–59. 10. J. Jaspers. Calculi for Constructive Communication. ILLC Dissertation Series 1994-4, ILLC 1994. 11. M. Kracht. On extensions of intermediate logics by strong negation. Journal of Philosophical Logic, 27 (1998), 49–73. 12. F. von Kutschera. Der Satz vom ausgeschlossenen Dritten. de Gruyter, Berlin, 1985. 13. V. Lifschitz, D. Pearce & A. Valverde. Strongly equivalent logic programs. ACM Transactions on Computational Logic, 2 (2001), 526–541. 14. E.G.K L´opez-Escobar. Refutability and Elementary Number Theory. Indag. Math. 34 (1972), 362-374. 15. L.L. Maksimova. Craig theorem in super-intuitionistic logics and amalgamated varieties of pseudo-boolean algebras. Algebra i Logika 16 (1977), 643–681 (in Russian). 16. D. Nelson. Constructible falsity. Journal of Symbolic Logic, 14 (1949),16–26. 17. S.P. Odintsov. The class of extensions of Nelson’s paraconsistent logic. Studia Logica, 80 (2005), 291–320.
Routley Semantics for Answer Sets
355
18. D. Pearce. Answer Sets and Constructive Logic. Part II: extended logic programs and related nonmonotonic formalisms. In L. M. Periera & A. Nerode (eds), Logic Programming and Non-monotonic Reasoning, MIT press, 1993, pp. 457-475. 19. D. Pearce. A new logical characterization of stable models and answer sets. In Proc. of NMELP 96, LNCS 1216, Springer, 1997, pp. 57–70. 20. D. Pearce. From here to there: Stable negation in logic programming. In Dov Gabbay and Heinrich Wansing, eds., What is Negation?, Kluwer Academic Pub., 1999, pp. 161–181. 21. D. Pearce. Simplifying logic programs under answer set semantics. In V. Lifschtiz & B. Demoen (eds), Proc. of ICLP04. Springer LNCS 3132, 2004, pp. 210–224. 22. D. Pearce, I.P. de Guzm´an, and A. Valverde. Computing equilibrium models using signed formulas. In Proc. of CL2000, Springer LNCS 1861, 2000, pp. 688–703. 23. D. Pearce, I.P. de Guzm´an, and A. Valverde. A tableau calculus for equilibrium entailment. In Proc. of TABLEAUX 2000, Springer LNAI 1847, 2000, pp. 352–367. 24. D. Pearce and G. Wagner. Reasoning with Negative Information I: Strong Negation in Logic Programs. In L. Haaparanta, M. Kusch and I. Niiniluoto (eds), Language, Knowledge and Intentionality, Acta Philosophica Fennica 49, Helsinki, 1990 25. D. Pearce and G. Wagner. Logic Programming with Strong Negation. In P. Schroeder-Heister (ed), Extensions of Logic Programming, Springer LNAI 475, 1991. 26. D. Pearce and A. Valverde. Uniform equivalence for equilibrium logic and logic programs. In V. Lifschitz & I. Niemel¨a (eds), Proc. of LPNMR’04, Springer LNAI 2923, 2004, pp. 194–206. 27. D. Pearce and A. Valverde. Synonymous theories in answer set programming and equilibrium logic. In R. L´opez de M´antaras & L. Saitta (eds), Proc. of ECAI 2004, IOS Press, 2004, 388392. 28. H. Rasiowa. An Algebraic Approach to Non-classical Logic PWN, Warwaw and NorthHolland, Amsterdam, 1974. 29. R. Routley. Semantical Analyses of Propositional Systems of Fitch and Nelson. Studia Logica 33 (1974), 283-298. 30. C. Sakama & K. Inoue Paraconsistent Stable Semantics for Extended Disjunctive Programs J. Logic & Computation 5 (1995), 265-285. 31. R. H. Thomason. A Semantical Study of Constructible Falsity. Zeitschrift f¨ur Mathematische Logik 15 (1969), 247-257. 32. N. N. Vorob’ev. A constructive propositional calculus with strong negation (in russian). Doklady Akademii Nauk SSR, 85 (1952), 465–468. 33. N. N. Vorob’ev. The problem of deducibility in constructive propositional calculus with strong negation (in russian). Doklady Akademii Nauk SSR, 85 (1952), 689–692. 34. G.Wagner. Ex contradictione nihil sequitur. Artificial intelligence, IJCAI-91, Proc. 12th Int. Conf. Sydney/Australia 1991, 1991, pp. 538–543. 35. G. Wagner. Vivid Logic. Knowledge-Based reasoning with Two Kinds of Negation Springer LNAI 764, 1994. 36. H. Wansing. The Logic of Information Structures Springer LNAI 681, 1993.
The Well Supported Semantics for Multidimensional Dynamic Logic Programs F. Banti1 , J.J. Alferes1 A. Brogi2, and P. Hitzler3 1 2
CENTRIA, Universidade Nova de Lisboa, Portugal jja | [email protected] Dipartimento di Informatica, Universit` a di Pisa, Italy [email protected] 3 AIFB, Universit¨ at Karlsruhe, Germany [email protected]
Abstract. Multidimensional dynamic logic programs are a paradigm which allows to express (partially) hierarchically ordered evolving knowledge bases through (partially) ordered multi sets of logic programs and allowing to solve contradictions among rules in different programs by allowing rules in more important programs to reject rules in less important ones. This class of programs extends the class of dynamic logic program that provides meaning and semantics to sequences of logic programs. Recently a semantics named refined stable model semantics has fixed some counterintuitive behaviour of previously existing semantics for dynamic logic programs. However, it is not possible to directly extend the definitions and concepts of the refined semantics to the multidimensional case and hence more sophisticated principles and techniques are in order. In this paper we face the problem of defining a proper semantics for multidimensional dynamic logic programs by extending the idea of well supported model to this class of programs and by showing that this concept alone is enough for univocally characterizing a proper semantics. We then show how the newly defined semantics coincides with the refined one when applied to sequences of programs.
1
Introduction
In recent years some effort was devoted to explore the problem of how to update knowledge bases represented by logic programs (LPs) with new rules. This allows, for instance, to better use LPs for representing and reasoning with knowledge that evolves in time, as required in several fields of application. The LPs updates framework has been used, for instance, as the base of the MINERVA agent architecture [14] and the action description language EAPs [3]. Different semantics have been proposed [1,2,5,6,12,15,17,19,18] that assign meaning to arbitrary finite sequences P1 , . . . , Pm of logic programs, usually called dynamic logic programs (DyLPs), each program in the sequence representing a
This work was supported by project FLUX POSI/40958/SRI/01, and by the European Commission within the 6th Framework Pr. project Rewerse, no. 506779.
C. Baral et al. (Eds.): LPNMR 2005, LNAI 3662, pp. 356–368, 2005. c Springer-Verlag Berlin Heidelberg 2005
The Well Supported Semantics for MDyLPs
357
supervenient state of the world. The different states may represent different time points, in which case P1 is an initial knowledge base, and the other Pi s are subsequent updates of the knowledge base or as knowledge coming from different sources that are (totally) ordered according to some precedence, or as different hierarchical instances where the subsequent programs represent more specific information. The role of the semantics of DyLPs is to employ the relationships among different states to precisely determine the meaning of the combined program comprised of all individual programs at each state. Intuitively, one can add, at the end of the sequence, newer rules or rules with precedence (arising from newly acquired, more specific or preferred knowledge) leaving to the semantics the task of ensuring that these added rules are in force, and that previous or less specific rules are still valid (by inertia) only as far as possible, i.e. that they are kept as long as they are not rejected. A rule is rejected whenever it is in conflict with a newly added one (causal rejection of rules). Most of the semantics defined for DyLPs [1,2,5,6,12,15,17,19,18] are based on such a concept of causal rejection. Multidimensional dynamic logic programs (MDyLPs) [13] generalize DyLPs by considering, instead of sequences, partially ordered multisets of programs. This generalization allows to combine in a single framework the possibility of having hierarchically ordered knowledge bases, with evolution in time. While most of the existing semantics1 for DyLPs coincide on a large class of program updates (cf. [6,11]), there are situations in which the set of (dynamic) stable models (SMs) differs from one semantics to the other. Usually such counter-examples show a counterintuitive behaviour of the semantics when dealing with particular kinds of recursive dependencies. Also the existing semantics for MDyLPs exhibit such counterintuitive behaviour as it emerges from the following example which also illustrates a possible usage of MDyLPs. Example 1. Roughly speaking, a joint venture is a society of companies that is administrated by a delegated administrator. The administrator can pursue his own policy independent of the requests of the partners, though taking the directives of the partners into account. Suppose that two companies α and β constitute a joint venture j whose customers are other companies. The two companies give some directives to the administrator, represented by programs Pα1 and Pβ1 . The administrator has his own policy which we represent by program Pj1 . Moreover, both the companies and the administrator update their policies from time to time. We represent such updates, respectively, by programs Pαt , Pβt and Pjt where t is a time-stamp. Since the policy of the administrator has precedence over the directives of α and β, we assign precedence to the Pjs over the other programs. At any given time tk , the decisions of the administrator are described by the semantics of the MDyLP computed at the most recent node Pjt . The administrator respects a specific directive from a partner unless it con1
In this paper we restrict our study to semantics generalizing the stable models semantics and that are based on causal rejection of rules. Semantics not based on causal rejection like the ones defined in [17,19], or semantics which use more general forms of rejection like the one presented in [18] are outside the scope of this paper, and are only briefly mentioned in the conclusions.
358
F. Banti et al.
flicts either with a more recent directive of the same partner or with any of the clauses representing the updates. For any order x, if cost(x, z) is true then z represents the estimated expenses that the j should face in order to satisfy the commission x. Let us assume that the directive of β is to not decline any order whose cost is within a given limit C. This is encoded by the single rule program: Pβ1 : not decline(X) ← cost(X, Z), Z ≤ C. On the other hand, α assigns a degree of reliability to some customers and wants to decline any commission asked by a customer who is not reliable enough. So, Pα1 contains: decline(X) ← comm(X, Y ), reliability(Y, K), rel limit(Z), K ≤ Z. plus a database of facts reliability(C, K) for customers C, and a fact rel limit(li) for representing the limit under which a customer is considered to be unreliable. The initial policy of the administrator is to accept any commission that is acceptable and not declined, having also a set of rules for establishing when a commission is acceptable. Moreover, whenever several orders are received from the same costumer, if one order is accepted, then the others can not be declined. So, Pj1 contains some rules for acceptable(X) plus: accept(X) ← acceptable(X), not decline(X). not decline(X) ← accept(K), comm(X, Y ), comm(K, Y ).
(1) (2)
Let us suppose a commission x1 arrives from the company y, the commission is acceptable, and the reliability of y is high enough. Hence the order is accepted. At time t2 the administrator updates his policy by deciding that no commission from the customer y will be declined. This is done by updating Pj1 with the program Pj2 with the rule: not decline(X) ← comm(X, y). At time t3 , α augments the limit of reliability. This is done by the update Pα3 with the two facts not rel limit(li) and rel limit(new li). Suppose that at time t4 a commission x2 arrives from y and the reliability of y is under the new limit of reliability. The directives in Pα1 say to decline the commission. Nevertheless the policy of the administrator encoded by the clause in Pj2 conflicts with this directive. Since Pj2 has precedence over Pα1 , the latter is rejected and the order is accepted. Note how the partially ordered programs are used to represent precedence among rules coming from different sources, as well as to represent updates of rules. So far we provided an example of how multidimensional dynamic logic programs work. We show now a problematic situation involving cyclic dependencies. At time t5 , another commission x3 arrives from a new costumer y2. The reliability of y2 is below the current limit, but the estimated cost of x3 is below the limit C and, moreover x3 is acceptable. Hence the directives of α and β collide. Since the directives of the two partners are not comparable, none can overcome the other. From an intuitive point of view the policy of j should not allow to judge whether the order should be declined or not. Hence, intuitively the semantics of the considered M DyLP should allow the administrator to detect the conflict and specify, by a new update, whether to decline the new order or accept it.
The Well Supported Semantics for MDyLPs
359
Unfortunately, none of the existing semantics for MDyLPs matches such intuition. The rules 1 and 2 have cyclic instances for X = K. Such a cycle is not relevant in the other examined cases. For X = K = x3 , instead, the rule 2 rejects the rule in Pα1 thus allowing the semantics to have a model where the commission x3 is not declined. It is clearly possible to find also much more complex examples involving complicated self dependencies among rules. Similar examples are known also in the case of DyLPs. In [1] the authors propose the refined extension principle,which should be satisfied by a proper semantics for DyLPs in order to avoid such counterintuitive behaviour and then proposed the refined stable model semantics for DyLPs that complies with such a principle. Unfortunately, as we show in section 3, the definition of the refined semantics cannot be extended directly to MDyLPs. Moreover, the refined extension principle is too weak for uniquely determining one “right” semantics. For example, the trivial semantics that assigns to each DyLP the empty set of models, satisfies the principle, which is obviously unsatisfactory. We hence need stronger new criteria and techniques. We begin this paper by, after recalling preliminary notions in Section 2, providing insights of the existing semantics for DyLPs and MDyLPs and explain why a new approach to the problem, based on stronger criteria, is in order. Then, in Section 4 we introduce such a criterium by extending the notion of well-supported model (WS model) [4,7] to DyLPs and MDyLPs. Fages [7] shows the equivalence between the concept of stable model and WS model, i.e. given a program P , an interpretation M is a stable model of P iff it is a WS model of P . By extending the definition of well supported model to MDyLPs, we obtain a new semantics for such class of programs. We also show how well supported models do not show counterintuitive behaviour in the illustrated example and, moreover, they provide new insights of the matrix of the behaviour of the other semantics for MDyLPs. Finally, we show that the well supported model semantics coincides with the refined semantics of [1] if we restrict to sequences of programs. For this reason we refer to the defined semantics also as the refined semantics for MDyLPs. Well-supported models do already provide a semantics for MDyLPs. Such a descriptive characterization, however, is not completely satisfactory for several reasons, the main one being the problem of finding a reasonable algorithm for its computation. So, in Section 5, we provide an alternative, though equivalent and more traditional characterization based on a fixpoint operator. We then establish relationships between the well supported semantics and the existing semantics for MDyLPs, and show that any WS model is also a model in the existing semantics.
2
Background and Preliminaries
In the following, a propositional language L is a (possibly countably infinite) set of atoms. A literal in L is an atom A of L or the (default) negation not A of an atom of L. We say that A is the default complement of not A and vice versa. Given a set of literals I, we say a literal L is true (resp. false) in I iff L ∈ I
360
F. Banti et al.
(resp. not L ∈ I). In the sequel a (two-valued) interpretation is a set of literals of L such that for each atom A ∈ L exactly one of A or not A belongs to I. To simplify the notation, whenever it is clear that we are talking about two-valued interpretations we omit all its negative literals. Let L and L be two languages such that L ⊂ L . Let M be an interpretation over L . We use the notation M |L for the set of literals of M in L. Given two interpretations M and M ∗ over L , we use the notation M ≡ |L M ∗ for M |L ≡ M ∗ |L . 2.1
Well-Supported Models
The semantic analysis which we make in this paper rests on the notion of level mapping over a set of atoms L, where a level mapping is a function from L to the set of natural numbers. We also lift to negative literals of the form not A, where A is an element of L, by setting (not A) = (A). Given a conjunction of literals C = L1 , . . . , Ln we further extend by assigning to C the value (Li ), where i is chosen such that the value of (Li ) is maximal, i.e. (C) = max({(Li ) : Li ∈ C}). For convenience, and by slight abuse of notation, we assign the value −1 to the empty conjunction of literals. Our approach is stimulated by recent results on uniform characterizations of different semantics for LPs in terms of level mappings as introduced in [10] and extended in [9]. This perspective provides an additional tool and guidelines on how to obtain reasonable new semantics for new classes of programs. A normal logic program over a language L is any (possibly countably infinite) set of rules of the form A ← body, where A is any atom of L and body is any conjunction of literals of L. Several different (two-valued) semantics are being used for assigning meaning to programs, including the supported model semantics [4], the minimal supported model semantics [4] and the stable model semantics [8]. Given any program P , the set of all supported models (SU (P )), the set of all minimal supported models (M SU (P )) and the set of all stable models (SM (P )) of P are related by SU (P ) ⊇ M SU (P ) ⊇ SM (P ). For large classes of programs these sets of models coincide, but there are particular cases where the inclusions above are strict. Example 2. Consider the program P : A ← A. P has unique SM ∅ which coincides with the unique minimal supported model. It has {A} as a second supported model. All the cited semantics have ∅ as unique model of the program consisting of the empty set of clauses. Hence, for the supported model semantics adding tautologies of the form A ← A to a program may change its semantics. A ← A. P1 has no stable models Example 3. Consider now P1 : A ← not A. but has {A} as unique minimal supported model. The program P2 : A ← not A, has no minimal supported model. Hence, again, the introduction of the tautology A ← A has changed the semantics of the program. Stable models for normal LPs can be characterized in terms of level mappings, and in this disguise they are termed well-supported models [7]. A model is wellsupported iff it is possible to define a level mapping over the literals of the
The Well Supported Semantics for MDyLPs
361
language, such that a literal A belongs to the model iff there is a rule in the program whose head is A, whose body is true in the considered model and the level of A is greater than the level of any atom in the body. Formally: Definition 1. Let P be a normal logic program over the language L. An interpretation M over L is a well-supported model of P iff i) M is a model of P and ii) there exists a level mapping defined over L, such that for each atom A in M there exists a rule A ← A1 , . . . , An , not B1 , . . . , not Bm with M |= A1 , . . . , An , not B1 , . . . , not Bm and (A) > (Ai) for each Ai with 1 ≤ i ≤ n. As formalized in the following result of [7], the WS models of a program P coincide with its stable models. Theorem 1. Let P be a normal logic program over L. An interpretation M over L is a well-supported model of P iff it is a stable model of P . 2.2
Semantics for DyLPs and MDyLPs
To represent negative information in logic programs and their updates, DyLPs use generalized logic programs (GLPs) [16], which allow for default negation not only in the premises of rules but also in their heads. A GLP over a language L is any (possibly countably infinite) set of rules of the form L0 ← L1 , . . . , Ln , where each Li is a literal of L. Given a rule τ as above, by hd(τ ) we mean L0 and by B(τ ) we mean {L1 , . . . , Ln }. A dynamic logic program P over a language L is a finite sequence P1 , . . . , Pm , where all the Pi ’s are GLPs over L. We call the Pi s updates. A multidimensional dynamic logic program MP is any partially ordered finite multiset of GLPs. Let M be a set of indices for the elements of MP, and let ≺ be the partial order defined over MP. For any index i, by Pi we denote the element of MP associated with i, and we call it an update. We often use the notation i ≺ j instead of Pi ≺ Pj . Let τ and η be two rules appearing in MP. As an abuse of notation, we also use the notation τ ≺ η for denoting that τ and η belong, respectively, to the updates Pi and Pj with Pi ≺ Pj . Two rules τ and η are said to be not comparable iff neither τ ≺ η nor η ≺ τ is true. For elements Pi and Pj of M, we say that Pi is less recent than Pj iff i ≺ j. Let Pn be an update of MP. The genealogy of Pn , denoted by MP n , is the subset of the elements of MP which are less recent than Pj plus Pn itself. We use ρ (P) to denote the multiset of all rules appearing in MP and ρ(P n ) to denote the multiset of all rules appearing in MP n . Note that, if the order defined over the MDyLP MP consisting of m elements is a total order, then MP is the DyLP P1 , . . . , Pm where Pi denotes the ith element of MP such that Pi ≺ Pj iff i < j. The dynamic stable models semantics for MDyLPs (DS) is defined in [13] by assigning to each MDyLP a set of dynamic stable models. The basic idea of the semantics is that, if a later rule τ has a true body, then former rules in conflict with τ are rejected. Moreover, any atom A for which there is no rule with true body is considered false by default. The semantics is then defined by a fixpoint equation that, given an interpretation I, tests whether I has exactly the
362
F. Banti et al.
consequences obtained after removing from the multiset ρ (P n ) all the rejected rules, and imposing all the default assumptions given I. Formally: Definition 2. Let MP be any MDyLP over language L , Pn be an update of MP and M be a two valued interpretation. Define Def ault(MP n , M ) = {not A | ∃ A ← body ∈ ρ (P n ) : body ⊆ M } Rej(MP n , M ) = {τ ∈ Pi | ∃ η ∈ Pj : i ≺ j, τ η, B(η) ⊆ M }, where τ η means that τ and η are conflicting rules, i.e. the head of τ is the default complement of the head of η. Then M is a dynamic stable model of n MPat Pn iff M is a fixpoint of ΓMP , defined by n ΓMP (M ) = least (ρ (P n ) \ Rej(MP n , M ) ∪ Def ault(MP n , M ))
where least(P ) denotes the least Herbrand model of the definite program obtained by considering each negative literal not A in P as a new atom2 . Other semantics for either DyLPs and MDyLPs based on causal rejection are the justified update (J U) [15] and the update programs semantics (UP) [6]. The latter is equivalent to the semantics proposed in [5]. All these semantics are extensions of the stable model semantics for normal and generalized LPs [8]; relations among them have been studied in [11,12], and the main result is as follows. Given any MDyLP MP, let UP(P), J U(P), DS(P) and be the set of models of P according to, respectively, the update programs, the justified update, the dynamic stable for MDyLPs. Then, as showed in [12,11] the following (possibly strict) inclusions hold: UP(P) ⊇ J U(P) ⊇ DS(P)
3
(3)
Some Considerations on the Existing Semantics
As shown in [11] and [6], all the cited semantics for MDyLPs based on causal rejection coincide on large classes of programs. The examples where these semantics differ involve cyclic dependencies among rules, similar to the one illustrated in the example 1. As stated in the introduction, all the existing semantics for M DyLP s (wrongly) coincide on the program of example 1, i.e. they allow the program to have a model where the commission is not declined. Note that this is a consequence of the cycle introduced by the instances of the rules 1 and 2. In fact, the MDyLP obtained by removing the mentioned instances of the rules has no model according to any of the cited semantics. Indeed these two rules that should not affect the semantics allow somehow an undesired model. Analogous behaviours are known also in the case of DyLPs as discussed in [1], where examples are given where cycles or even tautologies generate counterintuitive behaviour. In particular, all the semantics show counterintuitive behaviour 2
Whenever clear from the context we will omit the MP in any of the above defined operators.
The Well Supported Semantics for MDyLPs
363
in cases where conflicting rules appear in the same update. In [1], the authors introduce the refined extension principle as a principle that any semantics should satisfy in order to avoid such behaviour. Moreover, the refined dynamic stable model semantics [1] or simply refined semantics for DyLPs is defined. Such semantics obeys the refined extension principle and, in fact, it avoids the mentioned counterintuitive behaviour. The definition of the refined semantics is the same of definition 2 but replacing the MDyLP MP with a DyLP P and replacing i ≺ j in the rejection operator by i ≤ j. Intuitively, whenever rules with true body and with heads, respectively, A and notA appear in the same update Pi they reject each other. Moreover they reject also all the previous rules with either head A and not A, and finally they also reject the default assumption not A. Hence, unless a new rule with head A or not A and true body appears in a more recent update, the considered program has no model because it is not possible to derive neither A nor not A. The refined semantics (RS) for DyLPs is, among the cited semantics, the one that admits the less number of models. Hence, if we restrict to DyLPs, we can refine the inclusions 2.2 as follows UP(P) ⊇ J U(P) ⊇ DS(P) ⊇ RS(P)
(4)
Unfortunately, the technique of mutual rejection of rules in the same state cannot be extended to the class of MDyLPs. In fact, if we extend directly the definition of refined model to MDyLPs, Example 1 still exhibits an undesired model. This originates from the fact that, in multidimensional case, unlike in the linear one, two rules may be non comparable even if they do not belong to the same update. If, instead we allow non comparable rules to reject each other, the obtained semantics allows too few models. Let us consider for instance the following program MP P1 : A P2 : not A P3 : A P4 : not A P1 ≺ P2 P3 ≺ P4 According to the proposal above, the rules in P1 and P4 reject each other, as well as the ones in P2 and P3 . The default assumption is rejected as well and, as a result, we cannot derive neither A nor not A and hence MP would have no model. We regard this as counterintuitive, since, according to causal rejection, the facts A are rejected and {not A} should be the unique model of the program. Moreover, this last counterintuitive behavior is not captured by the refined extension principle since this principle only ensures that, whenever it is satisfied, the introduction of particular kind of rules does not allow undesired models. Here the problem is exactly the opposite: the proposed semantics would have too few models. We conclude that it is simply not possible to hack the definition of the refined semantics in order to apply it to MDyLPs nor can we refer to the refined extension principle as a tool for univocally determine a semantics. What is needed is an entirely new methodology to attack the problem. The next section introduces such a methodology.
4
Well-Supported Models for MDyLPs
As we see from equation (4), the existing semantics for DyLPs can be ordered in a sequence where each semantics is a refinement of the previous one. Going right
364
F. Banti et al.
in the sequence, the conditions for an interpretation to be accepted as a model become stricter. It seems that research is trying to discard bad models from the semantics and to keep only good models. Is this really the case? Moreover, can we consider the sequence ended by the refined semantics, or do we need to further refine it? To answer these questions we need a formal definition of what we mean by good model. Recalling section 2.1, we can see an interesting historical parallelism between the evolution of semantics for DyLPs and the evolution of two-valued semantics for normal LPs, where the supported, minimal supported and stable model semantics are successive refinements. We also note similarities between examples 1 and 2, 3: in them, rules that should not play any semantic role change the behavior of some semantics by introducing more models. In the static case, this behaviour is rectified by the introduction of the concept of wellsupported model. Guided by this historical perspective, we extend the notion of WS model to MDyLPs. We first note that in the definition of well-supported models for normal LPs only the level of the positive literals in the body of a rule is considered. This happens because within normal LPs only positive literals are derived by rules, and the negative ones follow by negation by default. For DyLPs and MDyLPs, however, also negative literals can be derived by rules, since we allow negative literals in rule heads. More importantly, in the static case a rule plays a role only for deciding whether or not a given literal should be true or not. In the dynamic case, a rule is also used for rejecting other rules. Hence the concept of well-supportedness should be applied not only to the derivation of literals but also to the rejection of rules. More precisely, we require well-supported rejection: a rule can reject another rule in a previous update iff the body of the rejecting rule is true and the level of the body of the rejecting rule is less than the level of its head. The following definition formalizes this idea using level mappings. Definition 3. Let MP be any MDyLP over some language L, let Pn be an update of MP, be any level mapping over L and M be any two-valued interpretation over L. Define the set of rejected rules w.r.t. by3 Rej (MP, M, n) = {τ ∈ Pi | ∃η ∈ Pj : i ≺ j n, τ η, M |= body(η), (hd(η)) > (B(η)) }. Given the considerations above and Definition 3, it is now easy to extend the concept of WS model to MDyLPs. An interpretation M is a WS model if it is possible to find a level mapping such that: M is a model of all the rules that are not rejected w.r.t. the given level mapping and such that, for each atom A which is true in M , a non-rejected rule with head A exists, whose body is true and has level less than the level of A. The formal definition follows. Definition 4. Let MP be any MDyLP over some language L and let M be an interpretation over L, Pn be an update of M and M be any interpretation over L. We say that M is a well-supported model at Pn iff there exists a 3
Hereafter, we use the simplified notation Rej (M, n) whenever this causes no ambiguity.
The Well Supported Semantics for MDyLPs
365
level mapping over L such that i) M is a model of ρ(P ) \ Rej (M, n) and ii) ∀ A ∈ M ∃ τ ∈ ρ(P ) \ Rej (M, n) such that hd(τ ) = A, (A) > (B(τ )) and τ is supported by M . If we consider again the program of the example 1, we find that the model where the commission x3 is not declined is not a well supported model. This also implies that the well supported model semantics for MDyLPs does not coincide with any of the existing semantics for such class of programs. If the partial order defined over the programs is a total one, then the considered program is a DyLP. In this case, it is possible to prove the analogue of Theorem 1. Theorem 2. Let P be any DyLP and M be an interpretation. Then M is a refined stable model of P iff it is a well-supported model of P. For this reason, we refer to the defined semantics also as to the the refined semantics for MDyLPs. We have shown that the WS models coincide with the refined SMs for a DyLP. Some comparisons of the refined semantics to other semantics for MDyLPs are in order. We would expect that any well supported model of a given program is also a model in any of the existing semantics for MDyLPs. In fact this result holds, as stated by the next theorem. Theorem 3. Let MP be any MDyLPs in the language L, Pn be an update of MP and M be a well supported model of MP at Pn . Then M is also a model of MP in any of the semantics defined in [13,5,11]. It is now easy to understand the different behaviour of the considered semantics. Two distinguished semantics differ for those cases when one semantics is a better approximation of the semantics of well-supported models than the other one.
5
Fixpoint Characterization for Well-Supported Models of MDyLPs
Well-supported models define a semantics for MDyLPs. However, this characterization is purely descriptive, which is obviously not entirely satisfactory for computational purposes. Moreover, to understand from this definition whether a given interpretation is a WS model of a given MDyLP, we have to face the problem of finding a corresponding level mapping or show that such a level mapping does not exist. This does not seem to be a reasonable approach for computing the semantics and, furthermore, may not lead to quick ways of testing whether a given interpretation is a well-supported model or not. For these reasons, we present an alternative characterization based on a fixpoint operator. We characterize our models as the fixpoints of an operator defined from interpretations to interpretations, in the spirit of the Gelfond-Lifschitz operator [8]. Given a program MP and an update Pn with index n, we associate with any pair (MP, n) S an operator Γ(MP,n) as in Definition 7 below. We then obtain a characterization of the well-supported models of MP as the fixpoints of this operator.
366
F. Banti et al.
The semantics of a MDyLP MP is defined with respect to the updates Pn of MP. To establish the semantics consider only the genealogy of Pn . The underlying idea of the semantics is to collect in a single program all the rules of the given MDyLP and add new rules and predicates that specify whether a rule is rejected or not. Let MP be a MDyLP over L, Pj , Pk be programs of MP and j ≺ k. If there exists a rule γ in Pk with head L, then every rule in Pj with head not L could be rejected, depending on whether the body of γ is true or not. Formally: Definition 5. Let MP be an MDyLP over the language L. Add new atoms rej(L, i) not belonging to L, where L is a literal in L and i ranges over the indices of the updates of MP. The set of rejecting rules over the extended language is then defined as follows: Rj(MP) = { rej(not L, j) ← body. | L ← body. ∈ Pk ∧ j ≺ k } Let MP be a multidimensional DyLP over L, n be an index, L be a literal of L, M be an interpretation over L, Pi , Pj and Pk be programs of MP n and τ i and η j be rules in, respectively Pi and Pj . We say that η j is a threat for L in i, or alternatively that L is threatened by η j iff the head of η j is not L, its body is true in M , and j ≺ i. We say that η j is a threat for some other rule τ i in Pi iff it is a threat for its head in i. A literal (rule) is considered to be strictly safe in Pi iff all its threats are rejected. Intuitively, derivations should only be made from safe rules. The main idea behind our definition is that a rule can be used to derive consequences iff it has already been established that the rule is safe. To achieve this result, we first consider the GLP given by the union of all the rules in MP with a new atom in the body of each rule which is satisfied only if the considered rule is safe. Then we introduce rules specifying which threats should be rejected in order to consider a literal (rule) as safe. Finally we introduce rules determining when a threat is rejected. Formally: Definition 6. Let MP be any multidimensional dynamic logic program in the language L. Add new atoms saf e(L, i) not belonging to L, where L is a literal in L and i ranges over the indices of the updates of MP. We denote by Σ(MP) the following set of rules. Σ(MP) = {L ← body, saf e(L, i)|L ← body ∈ Pi } Let M be an interpretation over L. The set of conditions for a literal L to be strictly safe at Pi is defined as follows. condS (MP, M, L, i) = {rej(not L, j) | ∃η ∈ Pj , j ≺ i, M |= B(η)∧ hd(η) = not L} By abuse of notation, condS (MP, M, L, i) also denotes the conjunction of all the literals in condS (MP, M, L, i). The set of strictly safe rules is defined as Saf eS (MP, M )) = {saf e(L, i) ← condS (MP, M, L, i)|∃ τ ∈ Pi : hd(τ ) = L}.
The Well Supported Semantics for MDyLPs
367
Having specified the condition for a rule to be allowed to derive literals, we then add the set of default assumptions and compute the least model of the obtained program. Finally we discard the auxiliary literals computed. Definition 7. Let MP be any multidimensional dynamic logic program in the language L, Pn be an update of MP and M be an interpretation over L. We S on interpretations over L as follows. define the operator Γ(MP,n) S (I) = least (Σ(MP n ) ∪ Saf eS (MP n , I) ∪ Γ(MP,n) Rj(MP n ) ∪ Def ault(MP n , I) )|L
We are finally ready to define the refined semantics for MDyLPs. A refined S multi stable model (RMSM) of an MDyLP at Pn is any fixpoint of the Γ(MP,n) operator. Definition 8. Let MP be any multidimensional dynamic logic program in the language L, Pn be an element of MP and M be any interpretation over L. We S say that M is a refined multi stable model of MP at Pn iff M = Γ(MP,n) (M ). The goal of Definition 8 is to provide a fixpoint characterization of the WS models of Definition 4. Indeed, this has been accomplished, as shown by the following theorem. Theorem 4. Let MP be any MDyLP in the language L, n be an index and M be any two valued interpretation over L. Then M is a refined multi stable model of MP at Pn iff M is a well-supported model of MP at Pn .
6
Conclusions and Future Research
The initial purpose of the paper was to provide a semantics for MDyLPs based on causal rejection that can be properly considered to be the stable modelslike semantics for such classes of programs. To obtain this, we extended the definition of well-supported model to the dynamic case. It turns out that, for DyLPs, our characterization coincides with the refined semantics. We provided also a fixpoint characterization of such semantics and established relationships between the new semantics and existing ones. Is it possible to conclude that the refined semantics is the proper extension of the SMs semantics to DyLPs and MDyLPs? Unfortunately there exists no theoretical result which is equivalent to the statement “this is the correct semantics”. Nevertheless we claim that the characterizations given herein provide some evidence that further refinements of the semantics will not be necessary. As mentioned in the introduction, there exist stable models-like semantics for LP updates [17,19,18] which are not (or at least not exclusively) based on the concept of causal rejection. Unlike those based on causal rejection, such semantics significantly differ from the refined semantics, and among each other, in properties, behaviors and underlying concepts. Comparisons of the semantics defined in [17,19] can be found in [12]. Given the underlying differences, it is possible that in the future specific application areas will be found where different
368
F. Banti et al.
approaches to LP updates are needed for different applications. It is our strong opinion that DyLPs and MDyLPs can be a useful tool in several application areas, in particular in those areas related to web-oriented applications for AI where powerful reasoning capabilities have to be applied in highly dynamic environments and where merging knowledge from different sources is an important and challenging task.
References 1. J. J. Alferes, F. Banti, A. Brogi, and J. A. Leite. Semantics for dynamic logic programming: a principled based approach. In LPNMR-7. Springer, 2004. 2. J. J. Alferes, J. A. Leite, L. M. Pereira, H. Przymusinska, and T. C. Przymusinski. Dynamic updates of non-monotonic knowledge bases. The Journal of Logic Programming, (1–3):43–70, 2000. 3. J.J. Alferes, F. Banti, and A. Brogi. From logic programs updates to action description updates. In J. Leite and P. Torroni, editors, CLIMA V, pages 227–242. Pre-Proceedings, 2004. ISBN: 972-9119-37-6. 4. K. R. Apt and R. N. Bol. Logic programming and negation: A survey. The Journal of Logic Programming, 19–20:9–72, 1994. 5. F. Buccafurri, W. Faber, and N. Leone. Disjunctive logic programs with inheritance. In D. De Schreye, editor, ICLP-99, 1999. 6. T. Eiter, M. Fink, G. Sabbatini, and H. Tompits. On properties of semantics based on causal rejection. Theory and Practice of Logic Programming, 2:711–767, 2002. 7. Fran¸cois Fages. Consistency of Clark’s completion and existence of stable models. Journal of Methods of Logic in Computer Science, 1:51–60, 1994. 8. M. Gelfond and V. Lifschitz. The stable model semantics for logic programming. In R. Kowalski and K. A. Bowen, editors, ICLP-5, 1988. 9. P. Hitzler. Towards a systematic account of different logic programming semantics. In A. G¨ unter, R. Kruse, and B. Neumann, editors, KI2003, 2003. 10. P. Hitzler and M. Wendt. A uniform approach to logic programming semantics. Theory and Practice of Logic Programming, 5(1–2):123–159, 2005. 11. M. Homola. Dynamic logic programming: Various semantics are equal on acyclic programs. In J. Leite and P. Torroni, editors, CLIMA V, pages 227–242. PreProceedings, 2004. ISBN: 972-9119-37-6. 12. J. A. Leite. Evolving Knowledge Bases, volume 81 of Frontiers in Artificial Intelligence and Applications. IOS Press, 2003. 13. J. A. Leite, J. J. Alferes, and L. M. Pereira. Multi-dimensional dynamic knowledge representation. In T. Eiter, M. Truszczynski, and W. Faber, editors, LPNMR-01, pages 365–378, 2001. 14. J. A. Leite, J. J. Alferes, and L. M. Pereira. Minerva – a dynamic logic programming agent architecture. In Intelligent Agents VIII, volume 2333 of LNAI. 2002. 15. J. A. Leite and L. M. Pereira. Iterated logic program updates. In JICSLP-98, 1998. 16. V. Lifschitz and T. Woo. Answer sets in general non-monotonic reasoning. In B. Nebel, C. Rich, and W. Swartout, editors, KR-92, 1992. 17. C. Sakama and K. Inoue. Updating extended logic programs through abduction. In M. Gelfond, N. Leone, and G. Pfeifer, editors, LPNMR-99, 1999. 18. J. Sefranek. A Kripkean semantics for dynamic logic programming. In LPAR’2000. Springer, 2000. 19. Y. Zhang and N. Y. Foo. Updating logic programs. In Henri Prade, editor, ECAI98, 1998.
Application of Smodels in Quartet Based Phylogeny Construction Gang Wu, Jia-Huai You, and Guohui Lin Department of Computing Science, University of Alberta, Edmonton, Alberta T6G 2E8, Canada Abstract. Evolution is an important sub-area of study in biological sci-
ence, where given a set of taxa, the goal is to reconstruct their evolutionary history, or phylogeny. One very recent approach is to predict a local phylogeny for every subset of 4 taxa, called a quartet topology, and then to assemble a phylogeny for the whole set of taxa satisfying these predicted quartet topologies. In general, the predicted quartet topologies might not always agree with each other, and thus the objective function becomes to satisfy a maximum number of them. This is the well known Maximum Quartet Consistency (MQC) problem. In the past, the MQC problem has been solved by dynamic programming and the so-called fixed-parameter method. Recently, we have proposed to solve the MQC in answer set programming. In this note, we summarize the theoretical results of this approach and report new experimental results for the purpose of comparison, which show that our approach in answer set programming is favored over the existing approaches based on dynamic programming and fixed-parameter method. In particular, some of the hard instances (where the error ratio is high) that were not reported to be solved in other approaches can now be solved in our approach.
1 Introduction In recent years, quartet based phylogeny construction methods have received considerable attention in the computational biology community. In comparison with other phylogeny construction methods, an advantage of quartet based methods is that they can overcome the data disparity problem [1]. Given a taxa set S, quartet based phylogeny construction methods first try to build an unrooted phylogeny for every (or most) subset of four taxa. This four taxa set is called a quartet and the phylogeny associated with that quartet is called a quartet topology. For each quartet, there are 3 possible quartet topologies associated with it. For example, Fig. 1 shows the 3 quartet topologies for quartet {s1 , s2 , s3 , s4 }. For simplicity, we use [s1 , s2 |s3 , s4 ] to denote the quartet topology in which the path connecting s1 and s2 doesn’t intersect the path connecting s3 and s4 (cf. Fig. 1(a)). Given a phylogeny T on a set of taxa S and a quartet topology q on {si , sj , sk , s }, if the path structure connecting si , sj , sk , and s in T is the same as q, then T satisfies q or q is consistent with T . Given a set Q of quartet topologies, the recognition problem, called the Quartet Compatibility Problem (QCP), is to determine if there is a phylogeny T on S satisfying all the quartet topologies in Q. The more C. Baral et al. (Eds.): LPNMR 2005, LNAI 3662, pp. 369–373, 2005. c Springer-Verlag Berlin Heidelberg 2005
370
G. Wu, J.-H. You, and G. Lin
s1 t
@ @ @
s2 t
@ @ (a)
t s3
s1 t
t s2
s1 t
t s2
@t s4
s3 t
@ @ @t s4
s4 t
@ @ @t s3
@ @ @ (b)
@ @ @ (c)
Fig. 1. Three possible quartet topologies for quartet {s1 , s2 , s3 , s4 }: (a) [s1 , s2 |s3 , s4 ], (b) [s1 , s3 |s2 , s4 ], and (c) [s1 , s4 |s2 , s3 ]
interesting computational problem is the optimization problem where we cannot find a phylogeny to satisfy all the quartet topologies in Q and the goal is to construct one to satisfy as many quartet topologies as possible. This is the so-called Maximum Quartet Consistency Problem (MQC), and it is NP-hard [2]. A few attempts have been made to solve the MQC problem optimally. Ben-Dor et al. [1] present a dynamic programming approach whose time complexity is O(3n n4 ), where n = |S| is the number of taxa. The fixed-parameter method proposed by Gramm and Niedermeier [3] can return an optimal phylogeny in O(4k n + n4 ) time, where k is the exact number of of inconsistent quartet topologies.
2 Solving the MQC Problem with Answer Set Programming We consider the rooted phylogeny, as the quartet consistency property is independent of whether or not a phylogeny is rooted. Given a set of taxa S = {s1 , s2 , . . . , sn } and a rooted phylogeny T on S, the least common ancestor of two leaf nodes si and sj in T is the common ancestor of si and sj farthest away from the root, denoted as LCA(si , sj ). A labeling scheme for T is a mapping from the set of internal nodes in T to the set of integers {1, 2, . . . , n − 1}. Note that there are exactly (n − 1) internal nodes in T and each node can be labeled by any number in the set {1, 2, . . . , n − 1}. A labeling scheme is ultrametric if along any root to leaf path, the labels of the internal nodes on the path are strictly decreasing. One rooted phylogeny together with an ultrametric labeling scheme is called an ultrametric phylogeny. Let M be an n × n symmetric matrix in which M (i, j) denotes the label of the internal node LCA(si , sj ). A triplet (i, j, k) for M is ultrametric if and only if there are two equal values among M (i, j), M (j, k), and M (i, k) and they are greater than the third value. M is ultrametric if every triplet (i, j, k) for M is ultrametric. An n × n ultrametric matrix M satisfies a quartet topology [si , sj |sk , s ] if min{M (i, k), M (j, )} > min{M (i, j), M (k, l)} holds. Theorem 1. [5] Given a quartet topology set Q and an ultrametric phylogeny T on S, T satisfies a maximum number of quartet topologies in Q if and only if the corresponding ultrametric matrix M satisfies a maximum number of quartet topologies in Q. Theorem 1 tells that the MQC problem is equivalent to the search for an ultrametric matrix to satisfy a maximum number of quartet topologies. In such a way, the MQC problem can be formulated into a constraint programming problem as shown in Fig. 2. This formulation can be easily translated into answer set programming rules and implemented in Smodels [4]. For each variable M (i, j) with its domain {1, 2, . . . , n − 1}, we use one atom m(i, j, k) to represent that M (i, j) takes the value k. That is, when m(i, j, k) is true, M (i, j) = k. We know that each variable should take exactly one value in the domain. So we use a cardinality rule to represent this constraint.
Application of Smodels in Quartet Based Phylogeny Construction
371
I NPUT: – A set of n taxa S = {s1 , s2 , . . . , sn }. n2 variables M (i, j), where 1 ≤ i, j ≤ n. The domain of each variable M (i, j), where i = j, is {1, 2, . . . , n − 1}; M (i, i) = 0, for all i. – A set Q of quartet topologies on S. Each quartet topology [si , sj |sk , s ] is transformed into a quartet consistency constraint q(i, j, k, ). C ONSTRAINTS: – Symmetry Constraint: M (i, j) = M (j, i), for all 1 ≤ i, j ≤ n, i, j distinct; – Ultrametric Constraint: ultra(i, j, k), for all 1 ≤ i, j, k ≤ n, i, j, k distinct; – Quartet Consistency Constraint: q(i, j, k, ), for quartet topology [si , sj |sk , s ] ∈ Q. G OAL: – Find a solution to M (i, j) for all 1 ≤ i, j ≤ n, such that all the symmetry and ultrametric constraints are satisfied and the number of satisfied quartet consistency constraints is maximized. Fig. 2. Formulating the MQC problem into a constraint programming problem
For example, “1{m(1, 2, 1), m(1, 2, 2), m(1, 2, 3), m(1, 2, 4)}1” means that variable M (1, 2) takes exactly one value in the domain {1, 2, 3, 4}. Similarly, we use one atom ultra(i, j, k) to represent that the triplet (i, j, k) for M is ultrametric if ultra(i, j, k) is true, and one atom q(i, j, k, ) to represent that [si , sj |sk , s ] is in the optimal phylogeny if q(i, j, k, ) is true. Based on this translation of variables, the ultrametric constraints and quartet consistency constraints can be formulated as: ultra(i, j, k) ← ultra(i, j, k) ← ultra(i, j, k) ← q(i, j, k, ) ← q(i, j, k, ) ←
equal(i, j, j, k), gter(i, j, i, k) equal(i, j, i, k), gter(i, j, j, k) equal(i, k, j, k), gter(i, k, i, j) gter(i, k, i, j), gter(j, , i, j) gter(i, k, k, ), gter(j, , k, l)
where equal(i, j, j, k) means M (i, j) = M (j, k), and gter(i, j, j, k) means M (i, j) > M (j, k). Finally, we use a maximize statement to find a stable model that contains the maximum number of true assignments of q(i, j, k, ). For example, for n = 5, maximize [ q(2, 3, 4, 5) = 1, q(1, 4, 3, 5) = 1, q(1, 5, 2, 4) = 1, q(1, 5, 2, 3) = 1, q(1, 4, 2, 3) = 1]
3
Strategies to Speed Up the Computation
Observe that an ultrametric matrix M is symmetric and therefore instead of putting the symmetry as constraints, we would rather use it to reduce the number of variables. Only M (i, j) with 1 ≤ i < j ≤ n becomes a variable, which gives only 12 (n2 − n) variables at the end. Consequently, we remove all symmetry constraints from the constraint set. Similarly, we would only consider ultrametric constraints ultra(i, j, k) such that 1 ≤ i < j < k ≤ n and quartet consistency constraints q(i, j, k, ) such that 1 ≤ i < j ≤ n, 1 ≤ k < ≤ n, and 1 ≤ i < k ≤ n. In the following, we introduce two new speedup strategies used in our Smodel programs. For any rooted phylogeny T , one natural ultrametric labeling scheme is to label
372
G. Wu, J.-H. You, and G. Lin
each internal node by its height. Therefore, the domain of variables M (i, j) can be reduced to {1, 2, . . . , h}, where h denotes the height of the optimal phylogeny. Theorem 2. Given a quartet topology set Q on taxa set S = {s1 , s2 , . . . , sn }, there exists an optimal phylogeny whose height is at most n2 . Theorem 3 lists some of the propagation rules that have been implemented into our Smodels programs. Theorem 3. For every set of five taxa {si , sj , sk , s , sm }, – if [si , sj |sk , s ] and [si , sj |sk , sm ] are in an optimal phylogeny, then [si , sj |s , sm ] must be in the optimal phylogeny too, i.e., q(i, j, , m) ← q(i, j, k, ), q(i, j, k, m) – if [si , sj |sk , s ] and [si , sk |s , sm ] are in an optimal phylogeny, then [si , sj |sk , sm ], [si , sj |s , sm ], and [sj , sk |s , sm ] must be in the optimal phylogeny too, i.e., q(i, j, k, m) ← q(i, j, k, ), q(i, k, , m) q(i, j, , m) ← q(i, j, k, ), q(i, k, , m) q(j, k, , m) ← q(i, j, k, ), q(i, k, , m).
4 Computational Results We have shown in [5] some preliminary computational results on our answer set programming approach. In this note, we make comparisons among the approaches proposed to solve the MQC problem optimally, including the dynamic programming by Ben-Dor et al. (denoted as DP) [1], the fixed-parameter method (denoted as GN) [3], and our answer set programming (denoted as ASP). We generated datasets defined by a pair (n, p) where for each dataset, n is the number of taxa and p records the percentage of quartet errors in the given complete quartet set. We used quartet error percentage p = 1%, 5%, 10%, 15%, 20%, 30%. The reported experimental results were done on a computer with an AMD 2.2GHz Opteron processor and 2.5GB main memory. Some of the running time results are summarized in Table 1. These results showed that the quartet error rate may affect the performance greatly, typically when the number of taxa under consideration exceeds 15. When the error rate was less than 10%, the problem could be solved more efficiently. In our experiments, we found that the lookahead function employed by Smodels played a very important role during the search of an optimal ultrametric matrix. In particular, we solved the Smodels programs without lookahead on the same datasets of 10 and 15 taxa reported in Table 1. The average computational times were 2 minutes and 5 minutes, respectively. These results showed that the lookahead in Smodels made hundreds of speedups to our Smodels programs and was the main factor that makes our programs outperform the other approaches. The symmetry breaking and domain reduction strategies proposed in Section 3 obviously can reduce the running time significantly since they can eliminate many variables and reduce the domain for variables. In our experiments, Smodels could improve search efficiency with the propagation rules proposed in Section 3. However, the overhead is a concern since Smodels need extra time to compute these rules. In some of our datasets, the performance with all possible propagation rules was even worse than that without
Application of Smodels in Quartet Based Phylogeny Construction
373
Table 1. The running times of three exact methods for the MQC problem. A ‘−’ indicates that a method didn’t terminate in 168 hours (7 days). Problem Size n = 10 p = 1% p = 5% p = 10% p = 15% p = 20% p = 30% n = 20 p = 1% p = 5% p = 10% p = 15% p = 20% p = 30%
DP 2 secs 2 secs 2 secs 2 secs 2 secs 2 secs 40 hrs 40 hrs 40 hrs 40 hrs 40 hrs 40 hrs
GN 1 secs 1 secs 5 secs 16 secs 35 secs 2 mins 20 mins − − − − −
ASP Problem Size 1 sec n = 15 p = 1% 1 sec p = 5% 1 sec p = 10% 1 sec p = 15% 1 sec p = 20% 1 sec p = 30% 10 mins n = 25 p = 1% 40 mins p = 5% 6 hrs p = 10% 6 hrs p = 15% 8 hrs p = 20% 10 hrs p = 30%
DP 2 mins 2 mins 2 mins 2 mins 2 mins 2 mins − − − − − −
GN 20 secs 10 mins 5 hours − − − 9 hrs − − − − −
ASP 1 sec 1 sec 1 sec 1 sec 1 sec 1 sec 20 mins 8 hrs 78 hrs 102 hrs 136 hrs −
any propagation rules. Currently, we are investigating this issue and trying to figure out which types of propagation rules are more important than the others.
5 Conclusions We have presented a formulation of the MQC problem and applied Smodels to solve it. The formulation, together with our speedup strategies, might lead us to a new perspective of the problem, as our experiments on simulated datasets showed that the proposed approach outperformed existing approaches proposed to solve the MQC problem optimally. Although in the worst case solving the problem still takes exponential time, it allows us to incorporate the domain knowledge into the search process. In the ideal case, we might be able to encode the target matrix variables such that the exponential behavior is a rare occurrence, and the average behavior is acceptable for practical use.
References 1. A. Ben-Dor, B. Chor, D. Graur, R. Ophir, and D. Pelleg. From four-taxon trees to phylogenies: the case of mammalian evolution. In Proceedings of the Fourth Annual International Computing and Combinatorics Conference (RECOMB), pages 9–19, 1998. 2. V. Berry, T. Jiang, P. E. Kearney, M. Li, and H. T. Wareham. Quartet cleaning: Improved algorithms and simulations. In Proceedings of the 7th Annual European Symposium on Algorithms (ESA’99), LNCS 1643, pages 313–324, 1999. 3. J. Gramm and R. Niedermeier. A fixed-parameter algorithm for minimum quartet inconsistency. Journal of Computer and System Science, 67:723–741, 2003. 4. P. Simons. Smodels: an implementation of the stable model semantics for logic programs. Accessible through http://www.tcs.hut.fi/Software/smodels/. 5. G. Wu, G.-H. Lin, and J. You. Quartet based phylogeny reconstruction with answer set programming. In Proceedings of The 16th IEEE International Conference on Tools with Artificial Intelligence (ICTAI 2004), pages 612–619, 2004.
Using Answer Set Programming for a Decision Support System Christoph Beierle1 , Oliver Dusso1 , and Gabriele Kern-Isberner2 1 2
Dept. of Computer Science, FernUniversit¨ at in Hagen, 58084 Hagen, Germany Dept. of Computer Science, University of Dortmund, 44221 Dortmund, Germany
Abstract. ACMI is a decision support system for the checking of medical invoices in a German health insurance company. We present a brief overview of the system and its implementation in DLV.
1
Introduction
In contrast to Germany’s compulsory health insurance, in the private health insurance system, a physician or a physiotherapist does not have a contractual relationship with the patient’s insurance company, but only with the patient himself. He issues an invoice to the patient which the patient has to pay. Having a private health insurance, the patient will hand the doctor’s bill to his insurance company for reimbursement. Typically, the insurance company will check whether the invoice obeys various legal and other regulations, in partic¨ ¨ scale ular, whether it conforms to e.g. the Geb¨ uhrenordnung f¨ ur Arzte (GOA, of fees for physicians) [4]. The checking of the invoices requires detailed knowledge of many regulations and is a labor-intensive task; the purpose of ACMI (Automatic Checking of Medical Invoices) is to support this task [2]. When investigating the official regulations concerning medical invoices (e.g. [4], [5]) and the corresponding business rules of one of Germany’s large insurance companies, it turned out that also various default rules are used. Thus, the paradigm of answer set programming (ASP) [6] was used for ACMI’s implementation.
2
Overview of the System
ACMI is embedded in an environment processing the workflow from the incoming patients invoices to the refunding decision done by the insurance company’s person in charge. Figure 1 shows a typical invoice. The first column specifies the date when the treatment was carried out. The second column specifies a number from the respective Geb¨ uhrenordnung (scale of fees). In this case, the invoice is from an alternative practitioner (Heilpraktiker ) so the relevant scale of fees is the Geb¨ uH (Geb¨ uhrenverzeichnis f¨ ur Heilpraktiker, scale of fees for alternative practitioners) [5]. The third column gives a verbal description of the treatment corresponding to the fee number, and the fourth column contains the invoiced fee (in e) for that treatment (which is not fixed, but must be in a certain range C. Baral et al. (Eds.): LPNMR 2005, LNAI 3662, pp. 374–378, 2005. c Springer-Verlag Berlin Heidelberg 2005
Using Answer Set Programming for a Decision Support System
375
Fig. 1. An invoice handed in by the patient Max Musterkrank
specified by the Geb¨ uH). After extraction of the relevant information from the invoice, ACMI automatically performs checks for every item with a fee number and reports the results.
3
ACMI’s Knowledge Base
In the following, we focus on ACMI’s knowledge base with respect to the Geb¨ uH ¨ [5]. The Geb¨ uH contains 148 different fee numbers (as a matter of fact, the GOA [4] contains many more). Each combination of fee numbers occurring in an invoice for a particular day of treatment must satisfy various constraints given in the Geb¨ uH, e.g.: C1 Number 4 may not occur more than once, and it may occur simultaneously only with 1 or with 17.1. C3 If number 28.1 occurs more than once, replace all its occurrences with one occurrence of 28.2. C4 Number 12.9 may not occur simultaneously with 12.10 and 12.11. C5 Number 5.0 may not occur simultaneously with 6.0, 7.0 or 8.0. Note that there are constraints about the frequency of certain numbers, different restrictions about the simultaneous occurrences of combinations of numbers, and even prescriptions where numbers have to be replaced by another one. There are also internal business rules (cf. [1]) of the insurance company attached to a fee number, e.g: T1 Number 21.1 is only refundable in insurance contracts with full coverage of the Geb¨ uH. H1 For number 12.2 a notification text is to be displayed to the person in charge. In addition, the following general rule applies to each fee number N : G1 If a number N occurs in an invoice and N is not found to be invalid, then N is valid.
376
C. Beierle, O. Dusso, and G. Kern-Isberner
Note that this rule is a typical default rule, and it turned out that also many other rules needed (default or classical) negation and could be expressed quite straightforwardly in ASP.
4
Knowledge Representation with Rule Schemas
By investigating all individual rules, three general types of rule schemas and four different types of consequences of a rule violation could be identified. Using these observations, each of ACMI’s rule information can be expressed using the following three predicates, where N is the number to be checked, k ≥ 0 is a number indicating a maximal frequency, M is a set of fee numbers, Cons ∈ {reject, replace, tariff , note} indicates the type of consequence of a violation, and R is a fee number being used in the output part of the rule (e.g. the number to be rejected or the number be used in a replacement): frequency(N, k, Cons, R): If N occurs more than k times, execute Cons for N with number R. forbidden (N, k, M, Cons, R): If N occurs and more than k fee numbers from M occur, execute Cons for N with number R. restricted (N, M, Cons, R): If N occurs and another fee number occurs that is not in M, execute Cons for N with number R. In all three predicates, “execute Cons for N with number R” is given by: – If Cons = reject , mark N to be rejected. – If Cons = replace, mark N to be rejected and mark R to be refunded instead. – If Cons = tariff , mark N to be not covered by the insurance tariff unless the current insurance tariff covers the full Geb¨ uH. – If Cons = note, mark N to be displayed with notification R to the person in charge. E.g., using these predicates, the information of the rules C1, C3, C4, C5, and T1 given in Sec. 3 can be expressed by: C1: frequency(4, 1, replace, 4) restricted(4, {1, 17.1}, reject, 4) C3: frequency(28.1, 1, replace, 28.2)
C4: forbidden(12.9, 1, {12.10,12.11}, reject, 12.9) C5: forbidden(5, 0, {6,7,8}, reject, 5) T1: frequency(21.1, 0, tariff, 21.1)
For instance, frequency(4, 1, replace, 4) says that if number 4 occurs more than once, all occurrences of 4 should be replaced by a single occurrence of 4. restricted(4, {1, 17.1}, reject, 4) says that 4 should be rejected if fee numbers other than 1 or 17.1 occur simultaneously with it. The schema frequency(28.1, 1, replace, 28.2) requires that all occurrences of 28.1 should be replaced by 28.2 if 28.1 occurs more than once. In the schema for T1, frequency(21.1, 0, tariff, 21.1) states that 21.1 might not be covered, depending on the current tariff. Note also the difference between the schemas for C4 and C5: 12.9 may occur with (not more than) one of {12.10, 12.11}, but 5 may not occur simultaneously with any of {6, 7, 8}.
Using Answer Set Programming for a Decision Support System
5
377
Implementation of ACMI in DLV
Whereas the rule schemas given above represent a high level of abstraction, they can not be expressed directly within the paradigm of ASP due to their usage of set-valued arguments. Therefore, we developed a transformation from the general rule schemas to DLV [3] code where each schema instance corresponds to a set of DLV facts and rules. Internally, each fee number is represented by a four digit number, e.g., 4 by 0400, 10 by 1000, and 20.8 by 2008. The occurrence of a number N at the I ’th position in the invoice is given by the literal p(I , N ). Thus, the invoice depicted in Figure 1 is internally represented by p(1,0100). p(2,0200). p(3,0400). p(4,1202). p(5,2008). p(6,2101). p(7,2801). tariff(vc).
where the literal tariff(vc) reflects the patient’s insurance tariff, being extracted from the corresponding database. A literal of the form z (N ) (resp. −z (N )) indicates that N occurs in the invoice and should be refunded (resp. should not be refunded). A literal r (N ) says that N serves as a replacement for (one or more) other number occurrences. A literal h(N ) indicates that a notification text should be presented to the person in charge, and t (N ) says that the patient’s tariff does not cover fee number N . Rules like fullGebuh :- tariff(an). fullGebuh :- tariff(ebc).
specify the tariffs providing full coverage of the Geb¨ uH. Also rule G1 (cf. Sec. 3) can be expressed easily using the DLV default rule: z(N) :- p(_,N), not -z(N).
For each of the three rule schemas introduced in Sec. 4, one or more facts are generated to represent what is called the schema information. For each frequency(N, k, Cons, R), frequency fact(N,k,Cons,R). is generated. For each forbidden (N, k, M, Cons, R) with M = {M 1, . . . , M n}, n facts of the form forbidden_fact(N, k, Mi, Cons, R).
are generated, and similarly for all restricted rule schemas.1 For instance, for the rule schemas for C1, the following facts are generated: frequency_fact(0400, 1, replace, 0400). restricted_fact(0400, 0100, reject, 0400). restricted_fact(0400, 1701, reject, 0400).
% % %
C1
Checking the constraints expressed by the rule schemas is done by exploiting DLV’s count facility as e.g. in checking the restricted schema: 1
If there is more than one rule schema of the form forbidden(N, , , , ) for a fee number N , a more complicated generation of facts along with a correspondingly extended form of checking the constraints expressed by these facts must be used [2].
378
C. Beierle, O. Dusso, and G. Kern-Isberner
execute(N,Cons,R) :restricted_fact(N,_,Cons,R), countRestrictedPartners(N,I), countPartners(N,All), All > I.
restrictedPartner(N,Partner) :p(_,N), p(_,Partner), restricted_fact(N,Partner,_,_). countPartners(N,All) :p(_,N), #count{P: p(_,P), P <> N} = All.
countRestrictedPartners(N,I) :p(_,N), #count{P: restrictedPartner(N,P)} = I.
Execution of the consequences of a rule violation is ensured by rules like: %------ replace: ---------------z(N) :- execute(N, replace, R). r(R) :- execute(N, replace, R).
6
% ------ tariff: -----------t(N) :- execute(N, tariff, R), not fullGebuh.
Conclusions and Future Work
Using appropriate input masks, instances of the frequency, forbidden and restricted schemas can be created and modified directly by the insurance experts who need not have knowledge about ASP. Additionally, the three rule schemas provide a powerful modelling tool: All rules and regulations stemming from the Geb¨ uH [5] or from the insurance company’s business rules could be expressed straightforwardly. Whereas these set-valued constraints can not be expressed directly as ASP rules, we developed a transformation for generating DLV code ensuring the constraints. Up to now the implemented system covers the full Geb¨ uH [5]; our current work includes the testing of ACMI in a large insurance ¨ [4]. company and its extension to cover the full GOA
References 1. P. A. Bonatti, N. Shahmehri, C. Duma, D. Olmedilla, W. Nejdl, M. Baldoni, C. Baroglio, A. Martelli, V. Patti, P. Coraggio, G. Antoniou, J. Peer, and N. E. Fuchs. Rule-based policy specification: State of the art and future work. Project Deliverable D1, Working Group I2, EU NoE REWERSE, September 2004. 2. O. Dusso. Entscheidungssysteme f¨ ur die Rechnungpr¨ ufung in der Krankenversicherung mit logik-basierten Regelsprachen. Diplomarbeit, Fachbereich Informatik, FernUniversit¨ at Hagen, 2005. 3. T. Eiter, W. Faber, N. Leone, and G. Pfeifer. Declarative problem solving using the DLV system. In J. Minker, editor, Logic-Based Artificial Intelligence, pages 79–103. Kluwer Academic Publishers, Dordrecht, 2000. ¨ – Geb¨ ¨ 4. GOA uhrenordnung f¨ ur Arzte. www.e-bis.de/goae/defaultFrame.htm, 2004. 5. Geb¨ uH – Geb¨ uhrenverzeichnis f¨ ur Heilpraktiker. www.patientenprojekt.de/ Gebuehrenverzeichnis%20Heilpraktiker.pdf, 2002. 6. M. Gelfond and N. Leone. Logic programming and knowledge representation – the A-Prolog perspective. Artificial Intelligence, 138:3–38, 2002.
Data Integration: A Challenging ASP Application Nicola Leone1 , Thomas Eiter2 , Wolfgang Faber2 , Michael Fink2 , Georg Gottlob2 , Luigi Granata1 , Gianluigi Greco1 , Edyta Kałka4 , Giovambattista Ianni1 , Domenico Lembo3, Maurizio Lenzerini3, Vincenzino Lio1 , Bartosz Nowicki4 , Riccardo Rosati3 , Marco Ruzzi3 , Witold Staniszkis4 , and Giorgio Terracina1 1
2
Dipartimento di Matematica, Universit`a della Calabria, Rende, Italy Inst. f¨ur Informationssysteme, Technische Universit¨at Wien, Vienna, Austria 3 Dip. di Informatica e Sistemistica, Universit`a “La Sapienza”, Roma, Italy 4 Rodan Systems S.A., Warsaw, Poland
Abstract. The paper presents INFOMIX a successful application of ASP technology to the domain of Data Integration. INFOMIX is a novel system which supports powerful information integration, utilizing the ASP system DLV. While INFOMIX is based on solid theoretical foundations, it is a user-friendly system, endowed with graphical user interfaces for the average database user and administrator, respectively. The main features of the INFOMIX system are: (i) a comprehensive information model, through which the knowledge about the integration domain can be declaratively specified, (ii) capability of dealing with data that may result incomplete and/or inconsistent with respect to global constraints, (iii) advanced information integration algorithms, which reduce (in a sound and complete way) query answering to cautious reasoning on disjunctive Datalog programs, (iv) sophisticated optimization techniques guaranteeing the effectiveness of query evaluation in INFOMIX, (v) a rich data acquisition and transformation framework for accessing heterogeneous data in many formats including relational, XML, and HTML data.
1 Data Integration Systems The enormous amount of information even more and more dispersed over many data sources, often stored in different heterogeneous formats, has boosted in recent years the interest for data integration systems (see, e.g, [2,6,5,4]). Roughly speaking, a data integration system I provides transparent access to different data sources by suitably combining their data, and providing the user with a unified view of them, called global schema. Formally, I can be seen as a triple G, S, M, where G is the global schema, S is the source schema, constituted by the schemas of all sources, and M is the mapping between G and S that contains a view over S for each element of G. The users formulate their queries over G, and the system automatically provides the answers. We assume that G and S are relational schemas, and that G contains integrity constraints (ICs) of three kinds: key dependencies (KDs), exclusion dependencies (EDs), and inclusion dependencies (IDs). Views in the mapping are specified in Datalog. Example 1. Consider the integration system I = G, S, M, where (i) G comprises the relation predicates HasTutor (student, tutor) and Student(name), (ii) S comprises C. Baral et al. (Eds.): LPNMR 2005, LNAI 3662, pp. 379–383, 2005. c Springer-Verlag Berlin Heidelberg 2005
380
N. Leone et al.
the unary relation predicate s1 and the binary predicates s2 and s3 , (iii) M is defined by the Datalog program: HasTutor (x, y) ← s2 (x, y) ∨ s3 (x, y)
Student(x) ← s1 (x).
ICs in G state that: (a) the key of HasTutor is the attribute student (KD); (b) a tutor cannot be a student (ED), and (c) each name in Student must occur in HasTutor , i.e., each student has at least one tutor (ID). 2 Data stored at the sources may violate global ICs when filtered through the mapping, since in general source data are not under the control of the data integration system. The standard approach to this problem is inherently procedural, and basically consists of explicitly modifying the data in order to eliminate violation of ICs (data cleaning). However, the explicit repair of data is not always convenient or possible. Therefore, when answering a user query, the system should be able to “virtually repair” relevant data in a declarative fashion (in the line of [1,2]) . In this paper, we present INFOMIX, a novel system which supports powerful integration of inconsistent data by resorting to computational logic systems. The INFOMIX approach is based on the idea of reformulating a user query, taking into account the ICs of the global schema, in terms of a logic program Π, using disjunction, in a way such that the stable models of Π represent the repairs of the global database constructed by evaluating the mapping over the source extension. Then, answering a user query amounts to cautious reasoning over the logic program Π augmented by the facts retrieved from the sources. We point out that this reduction is possible since query answering in data integration systems is coNP-complete in data complexity in the above setting (and also in many other data integration frameworks [5,4]). INFOMIX implements recent results of the database theory, which have been extended and specialized within the INFOMIX project [3,4,9,7,8,10]. While INFOMIX is based on solid theoretical foundations, it is a user-friendly system, endowed with graphical user interfaces for the average database user and administrator. INFOMIX is built in cooperation with RODAN systems, a commercial DBMS developer. Among the different features supported by the INFOMIX system,1 we shall consider here the following two aspects: • Advanced information integration algorithms [4] that reduce query answering to cautious reasoning on (head cycle free) disjunctive Datalog programs. This allows for effectively computing the query results (even in the presence of incomplete and/or inconsistent data) by using the state-of-the-art disjunctive Datalog system DLV [11]. The formal semantics of queries is captured also in the presence of incomplete and/or inconsistent data. • Sophisticated optimization techniques [9,7,8] guarantee the effectiveness of query evaluation in INFOMIX. The novel optimization techniques, developed in INFOMIX, “localize” the computation and limit the inefficient (coNP) computation to a very small fragment of the input, obtaining fast query answering, even in such a powerful data integration framework. 1
Further information, system documentation, and publications are available on the INFOMIX website: www.mat.unical.it/infomix.
Data Integration: A Challenging ASP Application
381
We have experimented the system on a real-life application scenario. The results we have conducted clearly indicate the impact of the optimizations techniques on the system performance, and, more generally, show that, despite its worst-case computational complexity, the semantic approach to data integration pursued by INFOMIX can be effectively realized.
2 Logic Programming Within the INFOMIX Architecture The INFOMIX system supports two modes: a design and a query mode. In the first, the global schema, the source schema, and the mapping between them are specified. Furthermore, wrappers for the data sources are created or imported. In the query mode, the system provides query answering facilities at run time, including data acquisition, integration, answer computation, and presentation to the user. In both the design and query mode, INFOMIX is conceptually divided into three levels, namely the Information Service Level, the Internal Integration Level and the Data Acquisition and Transformation Level. The most important level is the Internal Integration Level, which is based on computational logic and deductive database technology. It is composed by three modules, namely the Query Rewriter, the Query Optimizer and the Query Evaluator. The Query Rewriter reformulates the user query taking into account global ICs. According to the notion of repair adopted in INFOMIX, the Query Rewriter can separately consider IDs and KDs and EDs in the reformulation process, as showed in [3,4]. More precisely, it makes use of a sub-module to verify data consistency w.r.t. KDs and EDs: exploiting the mapping, the sub-module unfolds the user query over the source relations and activates the corresponding wrappers to retrieve relevant data; then it checks wether there are KD or ED violations. If no violations occur, the reformulation produced by the rewriter is a simple (disjunction free) Datalog program, constructed according to the global IDs; otherwise, a suitable disjunctive Datalog program is generated that performs automatic repair of data w.r.t. both EDs and KDs. Basically, the Datalog program encodes the user query, the views in the mapping, and the global ICs that involve relation predicates that are relevant to answer the user query, in a way such that cautious answers to this program evaluated over the data sources correspond to the answers to the user query. Example 2. In our example, consider now the the user query q(x) ← HasTutor(x, y). Wrapper activation populates the Internal Data Store of the system with a database D for the source schema S. Let us assume that the consistency check finds out that the KD and the EDs in G are violated by data migrating from the sources to the global schema through the mapping. Then, the Query Rewriter module reformulates the query in the following program: q(x) : − HasTutor (x, y) q(x) : − Student (x) HasTutor (x, y) : − HasTutor D (x, y) , not HasTutor (x, y) HasTutor (x, y) ∨ HasTutor (x, z) : − HasTutor D (x, y) , HasTutor D (x, z) , z = y HasTutor (x, y) ∨ HasTutor (y, z) : − HasTutor D (x, y) , HasTutor D (y, z) Student (x) : − Student D (x) , not Student (x) HasTutor (x, y) ∨ Student (y) : − HasTutor D (x, y) , Student D (y) Student D (x) : − s1 (x)
382
N. Leone et al. HasTutor D (x, y) : − s2 (x, y) HasTutor D (x, y) : − s3 (x, y)
Informally, for each global relation r, the above program contains (i) a relation rD that represents the extension of r obtained by evaluating the associated view in the mapping over the source database D; (ii) a relation r that represents a subset of such extension that is consistent with the KD and the EDs for r; (iii) an auxiliary relation r. The first two rules encode in the user query the ID stating that each student must have a tutor (intuitively, in order to return all the students that have a tutor, the rewriting looks also in the predicate Student). The third and the fourth rule encode the KD on HasTutor . The fifth, the sixth, and the seventh rule encode the ED stating that students cannot be tutors, whereas the last three rules encode the mapping M. 2 The Query Optimizer provides several optimization strategies, which turned out to be crucial for the efficiency of the system; in particular, the module exploits some focusing techniques which are able to isolate the portion of the source database that is relevant to answer the user query, by pushing constants in the query towards the sources. To this aim, an optimized (possibly disjunctive) Datalog program is generated by applying advanced binding propagation techniques a` la Magic-Set [9,7]. Finally, the optimized program is passed to the Query Evaluator. It first loads data from the Internal Data Store and then invokes DLV [11] in order to compute the answers. The results are then sent to the Information Model Manager for suitable presentation to the user.
3 Application and Experiments We have tested the INFOMIX prototype system on a real-life application scenario, in which data from various legacy databases and web sources must be integrated for a university information system. In particular, we built our information integration system on top of the data sources available at the University of Rome “La Sapienza”. The data sources comprise information on students, professors, curricula and exams in various faculties of the university. Currently, this data is dispersed over several databases in various (autonomous) administration offices and many webpages at different servers. Given this setting, we have devised a global schema of 14 relations and 29 integrity constraints, comprising KDs, IDs, and EDs. The application scenario includes 3 legacy databases in relational format, comprising about 25 relations in total. The relation sizes range from a few hundred to tens of thousands of tuples (e.g., exam data). Besides these legacy databases, there are numerous web pages, which either provide information explicitly or through simple query interfaces (e.g., members of a department, phone numbers etc). We have developed a number of wrappers using LiXto tools [10], which extract information from these web sources. In total, there are about 35 data sources in the application scenario, which are mapped to the global relations through about 20 UCQs. Each UCQ joins up to three different logical data sources. Finally, we have formulated 9 typical queries with peculiar characteristics, which model different use cases. Figure 1 shows the execution time for the 9 typical queries Q1, . . . ,Q9. Results are obtained on Pentium III machines running GNU/Linux with 256MB of memory. These
Data Integration: A Challenging ASP Application
383
Fig. 1. Impact of Optimizations
demonstrate the feasibility of our approach, and the impact of optimization techniques. Actually, the figure shows the total execution time for the optimized INFOMIX system, where in particular a magic-set technique is included, and the relative gain w.r.t. the evaluation without any optimization. For many queries, we note a significant speed-up, especially for query Q9. We have verified that for Q9, the magic-set technique effectively prunes the unrelated conflicts, thus avoiding their repair. Note that for Q3 none of our optimizations applies; the overhead of the optimization methods (1%) is very lightweight, however. Acknowledgment. This work was partially funded by the Information Society Technologies programme of the European Commission, Future and Emerging Technologies under the IST-2001-33570 INFOMIX project.
References 1. M. Arenas, L. E. Bertossi, and J. Chomicki. Consistent query answers in inconsistent databases. In Proc. PODS 1999, pages 68–79, 1999. 2. L. Bravo and L. Bertossi. Logic programming for consistently querying data integration systems. In Proc. IJCAI 2003, pages 10–15, 2003. 3. A. Cal`ı, D. Lembo, and R. Rosati. On the decidability and complexity of query answering over inconsistent and incomplete databases. In Proc. PODS 2003, pages 260–271, 2003. 4. A. Cal`ı, D. Lembo, and R. Rosati. Query rewriting and answering under constraints in data integration systems. In Proc. IJCAI 2003, pages 16–21, 2003. 5. J. Chomicki and J. Marcinkowski. Minimal-Change Integrity Maintenance Using Tuple Deletions. Information and Computation, 2004. 197(1-2): 90-121 (2005). 6. J. Chomicki, J. Marcinkowski, and S. Staworko. Computing consistent query answers using conflict hypergraphs. In Proc. of CIKM 2004, pages 417–426, 2004. 7. C. Cumbo, W. Faber, G. Greco, and N. Leone. Enhancing the magic-set method for disjunctive datalog programs. In Proc. ICLP 2004, pages 371–385, 2004. 8. T. Eiter, M. Fink, G. Greco, and D. Lembo. Efficient evaluation of logic programs for querying data int egration systems. In Proc. ICLP 2003, pages 163–177, 2003. 9. W. Faber, G. Greco, and N. Leone. Magic sets and their application to data integration. In Proc. ICDT 2005, 2005. LNCS 3363, in press. 10. G. Gottlob, C. Koch, R. Baumgartner, M. Herzog, and S. Flesca. The LiXto data extraction project - back and forth between theory and practice. In Proc. PODS 2004, pages 1–12, 2004. 11. N. Leone, G. Pfeifer, W. Faber, T. Eiter, G. Gottlob, S. Perri, and F. Scarcello. The DLV System for Knowledge Representation and Reasoning. ACM Trans. Comput. Log., 2004. To appear. Available via http://www.arxiv.org/ps/cs.AI/0211004.
Abduction and Preferences in Linguistics Extended Abstract Kathrin Konczak and Ralf Vogel Institut f¨ ur Informatik, Institut f¨ ur Linguistik, Universit¨ at Potsdam, Postfach 90 03 27, D–14439 Potsdam, [email protected], [email protected]
Abstract. We associate optimality theory with abduction and preference handling. We present linguistic problems that appear in the study of dialects as new application of abduction and preference handling. Differences in German dialects originate from different rankings of linguistic constraints which determine the well-formedness of expressions within a language. We introduce a framework for analyzing differences in German dialects by abduction of preferences. More precisely, we will take the perspective of a linguist and reconstruct dialectal variation as abduction problem: Given an observation that a sentence is found as grammatically correct, abduct the underlying constraint ranking. For this, we give a new definition for the determination of optimal candidates for total orders with indifferences. Additionally, we give an encoding for the diagnosis front-end of the DLV system.
1
Background
We assume a basic familiarity with logic programs, answer set programming (ASP) [5], abduction (within ASP), and diagnosis [2,7,8,4]. In this work we want to find preference structures in a linguistic framework as explanations of an abduction problem. A linguistic grammar is a model of the implicit knowledge that guides linguistic behavior. This knowledge is usually conceived as a system of rules and/or well-formedness constraints which determine for a given language which expressions are well-formed and which are not. Our example is the verb order in 3-verb clusters of German dialects. A standard German clause with such a 3-verb cluster looks as follows: Maria glaubt, dass sie das Lied singen m¨ ussen wird . Maria thinks that she the song sing must will. Swiss and Standard German follow different ordering strategies for the verbs: Default verb cluster orders Standard German: singen m¨ ussen wird Swiss German: wird m¨ ussen singen Syntactic structures are composed recursively by complementation. The object, here: “ein Lied ” is the complement of its governing head, here: the predicative verb “singen”. This verb phrase, “ein Lied singen”, is the complement of the modal verb “m¨ ussen”, and this modal verb phrase, in Standard German: “ein C. Baral et al. (Eds.): LPNMR 2005, LNAI 3662, pp. 384–388, 2005. c Springer-Verlag Berlin Heidelberg 2005
Abduction and Preferences in Linguistics
385
Lied singen m¨ ussen”, is the complement of the temporal auxiliary verb, “werden”. The differences between the languages and variants can now be described in terms of complement-head order: Default complement-head orders Standard German: All complements precede their heads: “ein Lied singen m¨ ussen wird ” Swiss German: Noun complements precede their heads, verbal complements follow them: “wird m¨ ussen ein Lied singen” English All complements follow their heads: “will have to sing a song” The differences between the three languages can be reconstructed within Optimality Theory (OT) using the following three constraints: H-Comp A complement follows its head. Comp-H A complement precedes its head. H-VComp A verbal complement follows its head. Constraint rankings are indicated with “”, meaning “has higher priority than”. The three rankings that conform to the observations are the following: 1 Standard German: Comp-H H-Comp (H-V Comp) Swiss German: H-V Comp Comp-H H-Comp English: H-Comp Comp-H (H-V Comp) The exact rank of H-V Comp can only be determined in Swiss German. While its effects are completely subsumed by the high rank of H-Comp in English, in Standard German all that is necessary is that Comp-H has highest priority, while the relative order of H-Comp and H-V Comp is irrelevant because of the low rank of these two constraints. Grammars are usually, but not necessarily, strict total orders of constraints. The rankings given here are only the crucial ones. For those which are left open, any order will be compatible with the observations.
2
Optimal Candidates
A linguistic grammar predicts the well-formedness of expressions. Optimality theory grammars do so by establishing a competition between different candidate expressions which are evaluated on a hierarchy of well-formedness constraints. An OT grammar is an input-output mapping. The input defines what is to be expressed. We then have a set of candidate output expressions. The candidates incur different constraint violations. Each candidate is evaluated on the basis of the constraint hierarchy, and the candidate that performs best in this evaluation is the winner, the optimal, hence, grammatical expression. In the following, we will consider the determination of optimal candidates wrt well-formedness of expressions. For this, let X be a set of candidates (sentences), C be a set of constraints, δ : X × C → IN be a violation function, where δ(x, c) denotes the degree of violation of x ∈ X wrt c ∈ C, and be a (strict) total order on C. Then, we call L = (X , C, δ, ) a linguistic framework. 1
These rankings were found out by empirical linguistic studies.
386
K. Konczak and R. Vogel
In Section 1, we have taken an example for the dialectal variation in German 3-verb clusters. In the following we will elaborate this example. For the 3-verb cluster we have the following possible word orders:2 Maria glaubt, dass sie das Lied ... (321) singen m¨ ussen wird. (231) m¨ ussen singen wird. (123) wird m¨ ussen singen. (132) wird singen m¨ ussen. (312) singen wird m¨ ussen. (213) m¨ ussen wird singen. Our set of candidates X = {321, 231, 123, 132, 312, 213} is constituted by these possible word orders. 3 C = {H-V Comp, Comp-H, H-Comp} is our set of constraints. The degree of violation denotes how well a sentence fulfills a constraint. It is represented by the number of asterisks (∗), as in the following table. 321 231 123 132 312 213
H-V Comp Comp-H H-Comp ∗∗∗ ∗∗ ∗∗ ∗ ∗ ∗∗ ∗ ∗ ∗ ∗∗ ∗ ∗∗ ∗ ∗∗ ∗
Next, we want to clarify when a sentence is a best candidate wrt a given constraint ranking [1]. Definition 1. Let L = (X , C, δ, ) be a linguistic framework, where is a strict total order on C. Then, candidate x ∈ X is a winner if there does not exist a candidate y ∈ X , x = y such that there exists a constraint c ∈ C where 1. for all c ∈ C where c c we have that δ(x, c ) ≥ δ(y, c ), and 2. δ(x, c) > δ(y, c). In our example, for the constraint order H-V Comp Comp-H H-Comp (Swiss German), we get 123 as winner. For constraint ranking Comp-H H-V Comp H-Comp (Standard German), candidate 321 is a winner.
3
Abduction of Constraint Rankings
In Optimality theoretic terms, linguists observe that a candidate is determined by a speaker as a winner, expressing that the sentence is grammatically correct. The problem is that the observer does not know which underlying constraint ranking the speaker has. Here, abduction comes into play. Given a linguistic framework L = (X , C, δ) with an unknown constraint ranking and an observation that candidate x ∈ X wins, we want to abduct which explains x. The set of candidates is given by rules (1) cd(x) ← for each x ∈ X , the set of constraints by (2) cst(c) ← for each c ∈ C, and the violation degrees by (3) viol(x, c, δ(x, c)) ← where δ(x, c) is the degree of violation of x ∈ X wrt c ∈ C. 2
3
The numbers signal the hierarchical position of the verb. Verb 1 is the temporal auxiliary (werden), verb 2 the modal (m¨ ussen), and verb 3 the predicative (singen). Due to OT we have to consider all possibilities.
Abduction and Preferences in Linguistics
387
According to Definition 1, a winner, can be determined by the following rules: (4) winner(X) ← cd(X), not defeated (X) (5) defeated (X) ← cd(X), cd(Y ), Y = X, better(Y, X) (6) better(Y, X) ← cd(X), cd(Y ), Y = X, cst(C), wins(Y, X, C), not hp(X, Y, C) (7) hp(X, Y, C) ← cd(X), cd(Y ), Y = X, cst(C), pref (C1 , C), wins(X, Y, C1 ) (8) wins(X, Y, C) ← cd(X), cd(Y ), cst(C), viol(X, C, N X), viol(Y, C, N Y ), N X < N Y (9) pref (X, Z) ← pref (X, Y ), pref (Y, Z) (10) ← pref (C, C), cst(C) (11) ← cst(C1 ), cst(C2 ), unranked(C1 , C2 ), C1 = C2 (12) unranked(C1 , C2 ) ← not pref (C1 , C2 ), not pref (C2 , C1 ), cst(C1 ), cst(C2 )
Our logic program Π consists of the rules (1)–(12). 4 An observation is that exactly one candidate is observed as a winner, but the other candidates not [1]: winner(x) ← for x ∈ X O(x) = def eat(y) ← for all y ∈ X , y =x Our hypothesis is the set of all possible pairwise preferences: H = {pref (c, c ) ←| c, c ∈ C, c = c }. Then, an explanation ∆ ⊆ H for Π, H, O gives us a possible strict total order among the constraints such that Π ∪ ∆ explains O. More precisely, ∆ ⊆ H is an explanation if O(x) ⊆ S for some answer set S of Π ∪ ∆. In our linguistic example we have additionally the background knowledge that constraint Comp-H is strictly higher preferred than H-Comp. Hence, we have pref (comph, hcomp) ← . additionally in Π. Then, our hypotheses is H = {pref (comph, hvcomp) ←, pref (hvcomp, hcomp) ←, pref (hvcomp, comph) ←, pref (hcomp, hvcomp) ←}, which gives us together with pref (comph, hcomp) ← all possible constraint rankings. For computing explanations, we use DLV [3,4] with the command -FD for abductive diagnosis. As a result, we get that 321 has two explanations, ∆1 = {Comp-H H-Comp H-V Comp} and ∆2 = {Comp-H H-V Comp H-Comp}. 123 has one explanation, ∆ = {H-V Comp Comp-H H-Comp}, and for observing other candidates as winners, we get no explanation. This means that the constraints are not sufficient for explaining these candidates as a winner. Candidate 321 yields two explanations, H-Comp H-V Comp and H-V Comp H-Comp. This supposes that H-Comp and H-V Comp can be ranked equally. Since Def. 1 is only valid for (strict) total orders, we have to extend it for total (pre-)orders. Definition 2. Let L = (X , C, δ, ) be a linguistic framework, where is a total order on C. Then, candidate x ∈ X is a winner if there exists no y = x such that there exists a c ∈ C such that 1. for all c = c such that c ≈ c or c c we have δ(c , x) ≥ δ(c , y), and 2. δ(c, y) < δ(c, x). The encoding for Definition 1 is adapted to Definition 2 in a straight forward way. Our hypotheses are now the set of all pairwise strict preference relations and the set of all possible indifferences: H = {pref (c, c ) ←| c, c ∈ C, c = c } ∪ {prefeq(c, c ) ←| c, c ∈ C, c = c }. From this set of hypotheses, all possible 4
Note that the abducted preference ordering must be total, as required in OT.
388
K. Konczak and R. Vogel
total orders are constructible. Coming back to our example, for candidate 321, we additionally get the supposed explanation that H-V Comp ≈ H-Comp.
4
Discussion and Further Work
We have associated OT with abduction and preference handling. Abduction and preference handling were studied in many other issues, e.g. in [6].But, as far as the authors know, abduction and preferences were not yet linked to OT before. We have shown that abduction within ASP is a useful knowledge reasoning tool for linguistic problems, here: dialectic studies, where the abducted explanations match the empirical results found out by the linguists. We have taken the perspective of a linguist and have reconstructed dialectal variation as abduction problem: Given an observation that a sentence is found as grammatically correct, abduct the underlying constraint ranking of the dialect. Furthermore, we have provided an encoding (within ASP) for the diagnosis front-end of DLV. Regarding linguistic studies, there is an ongoing debate about how unique the rule systems of language are in human cognition, as well as in biology in a very broad sense. The reconstruction of grammatical regularities with abduction and preference handling has consequences for this debate: if grammars can be modeled this way, then they share core properties with other non-linguistic rule systems. This supports a position that does not make special assumptions about the nature of linguistic rule systems. Further work is to study results when observing non-unique optimal candidates and to study abduction of partial orders instead of total orders, since partial orders may be enough for explaining the observations. Acknowledgments. The first author was supported by the German Science Foundation (DFG) under grant SCHA 550/6, TP C and by the EC under project IST-2001-37004 WASP. The second author was supported by the DFG under grant FOR-375/2-A3.
References 1. P. Besnard, G. Fanselow, and T. Schaub. Optimality theory as a family of cumulative logics. Journal of Logic, Language and Information, 12(2):153–182, April 2003. 2. M. Denecker and A. Kakas. Abduction in logic programming. In A. Kakas and F. Sadri, editors, Computational Logic. Logic Programming and Beyond, volume 2407 of Lecture Notes in Computer Science, pages 402–436. Springer-Verlag, 2002. 3. DLV. http://www.dbai.tuwien.ac.at/proj/dlv/. 4. T. Eiter, W. Faber, N. Leone, and G. Pfeifer. The diagnosis frontend of the DLV system. AI Communications, 12(1-2):99–111, 1999. 5. M. Gelfond and V. Lifschitz. The stable model semantics for logic programming. pages 1070–1080. The MIT Press, 1988. 6. K. Inoue and C. Sakama. Abducing priorities to derive intended conclusions. IJCAI99, pages 44–49. Morgan Kaufmann Publishers Inc., 1999. 7. A. Kakas, R. Kowalski, and F. Toni. The role of abduction in logic programming. In Handbook of logic in Artificial Intelligence and Logic Programming, volume 5, pages 235–324. Oxford University Press, 1998. 8. A. C. Kakas and P. Mancarella. Generalized stable models: A semantics for abduction. ECAI’90, pages 385–391, 1990.
Inference of Gene Relations from Microarray Data by Abduction Irene Papatheodorou, Antonis Kakas , and Marek Sergot Department of Computing, Imperial College London, SW7 2AZ, UK {ivp, ack, mjs}@doc.ic.ac.uk Abstract. We describe an application of Abductive Logic Programming (ALP) to the analysis of an important class of DNA microarray experiments. We develop an ALP theory that provides a simple and general model of how gene interactions can cause changes in observable expression levels of genes. Input to the procedure are the observed microarray results; output are hypotheses about possible gene interactions that explain the observed effects. We apply and evaluate our approach on microarray experiments on M. tuberculosis and S. cerevisiae.
1
Introduction
The focus in bioinformatics has shifted from the analysis of genome sequences, now available in their entirety for several organisms, to functional genomics, which seeks to ascribe biological function to genes and understand gene interactions. An important tool in these studies is DNA microarray technology, which enables simultaneous measurement of expression levels of thousands of genes. A common form of experiment measures differences in expression levels of whole genomes in differing environmental conditions and/or after deletion or overexpression of one or more genes. The aim is to obtain clues about gene interactions and unravel pathways that define the cell’s responses to various stimuli. The datasets generated are too large and complex for manual analysis. Raw data are analysed using statistical techniques to define significantly differentially expressed genes. Methods for further interpretation of the results, in terms of gene interactions, remain largely undeveloped, however, though Bayesian Networks have recently attracted attention (See e.g. [1] for an overview). We formulate the analysis of this type of microarray data as a problem of abduction, that is, inference from observable effects, i.e. the microarray data, to possible causes, hypotheses about possible gene interactions. We construct an Abductive Logic Program (ALP) theory which provides a simple, general model of how gene interactions can cause changes in observable expression levels of genes—essentially a formalisation of the (usually implicit) reasoning used by biologists designing microarray experiments. Adjustable parameters allow us to constrain the search for hypotheses and apply the methods to large data sets. A novel feature of our method is the ability to deal with observations in many separate experiments together.
Visiting from Department of Computer Science, University of Cyprus.
C. Baral et al. (Eds.): LPNMR 2005, LNAI 3662, pp. 389–393, 2005. c Springer-Verlag Berlin Heidelberg 2005
390
I. Papatheodorou, A. Kakas, and M. Sergot
The model is validated by comparing the inferred hypotheses against known gene interactions and by assessing the biological plausibility of the hypotheses where detailed information is lacking. We use microarray data sets on M. tuberculosis and S. cerevisiae (yeast). Section 3 presents an example of inferences that re-discover part of the M. tuberculosis heat shock response pathway. There are many issues and other experimental methods in the search for gene regulation mechanisms. To our knowledge, inference of gene networks from microarray data has not previously been formulated as a problem of abduction, though abduction has been used in [6] to construct a genetic network from classical genetics experiments. The nature of the data, the hypotheses and the model itself, differ from what is addressed here.
2
The Model
Input to the procedure is a set of observations expressed as logic assertions of the form increases expression(Expt, Gene) and reduces expression(Expt, Gene). They are obtained by statistical analysis of the raw microarray data to determine the significance of measured differences of expression levels of each gene [4]. The output is a set of abducible relations of two different types: induces (Gene1, Gene2) and inhibits(Gene1,Gene2) for the hypothesis that Gene1 induces the expression of Gene2, or inhibits it, respectively. Each individual experiment provides partial clues about possible induces/inhibits relations between genes. The modelling framework we employ is Abductive Logic Programming (ALP) [2], an extension of logic programming that allows declarative logical representations of the problem domain and supports abductive reasoning. A theory is represented by a triple (P, A, IC ), where P is a logic program, A a set of abducible predicates and IC a set of classical logic formulae, the integrity constraints. An abductive explanation for a query Q is a set ∆ of ground abducible atoms on the predicates A such that: P ∪∆ |=LP Q, P ∪∆ is consistent, P ∪∆ |=LP IC , where |=LP denotes a standard entailment relation of logic programming. The integrity constraints IC impose additional validity requirements on the hypotheses ∆. They are modularly stated in the theory, in addition to the basic model in P . They augment any partial information on the abducible predicates or impose other constraints on the abductively generated explanations. We form integrity constraints (IC) of three different types: (1) self-consistency: For example, a gene cannot both inhibit and induce the same gene at the same time (under the same conditions). (2) consistency with background information: Background knowledge, such as known inhibitor genes can also be expressed in the form of IC. (3) experimental consistency: When analysing the results of an experiment E in which a gene G is mutated, we may want to consider as ‘intermediary genes’ (see below) only genes whose expression is also observed to be affected in E. Gene Interactions Top-level Rules The program P of the ALP theory represents how gene interactions can increase or reduce the expression of genes, as observed in the experiments. An assumption is that such observed variations in gene expression
Inference of Gene Relations from Microarray Data by Abduction
391
should be attributed directly or indirectly to the variations (gene mutations or environmental stress), carried out in the experiment(s) investigated. This assumption is not justified for all classes of microarray experiments or all forms of gene regulation. For example: if an experiment E knocks out a gene G, and G inhibits gene X, then E will show an increased expression of X — subject to some possible exceptions. This rule is expressed in logic programming notation as follows: increases expression(E, X) ← knocks out(E, G), inhibits(G, X), not incr affected by other gene(E,G,X), not incr affected by EnvFact(E, X).
(1)
E is a variable that ranges over names of experiments and G, X are variables that represent genes. increases expression(E,X) is observational data from the experiment E, inhibits(G,X) is part of the unknown information to be abduced, and knocks out(E,G) provides background knowledge about the experiment E. The last two conditions express possible exceptions that deal with the possibility that the difference in gene expression can be attributed to a factor other than the mutated gene: e.g. (a) a gene other than G, or (b) an environmental factor. Here, not is the logic programming construct ‘negation as failure’, used to express that (1) is a default general rule subject to the stated exceptions. Similarly, there is a rule that deals with the cases of reduced expression of G in experiment E. Similar rules cover the cases of over-expressing G and further rules deal with the various combinations of gene mutation and changes in environmental conditions according to our classification of experiment types. Rule (1) only accounts for direct relationships between the mutated gene and the differentially expressed one. These relationships could be indirect: Inference of intermediate steps of interaction is achieved by further recursive rules: increases expression(E, X) ← mutates(E, G), intermediary gene(E, Gx, G), reduces expression(E, Gx), inhibits(Gx, X), not incr affected by other gene(E,Gx,X), not incr affected by EnvFact(E, X).
(2)
If gene Gx inhibits gene X, and the expression of gene Gx is reduced (directly or indirectly) by the mutation of gene G in experiment E, then the expression of X is increased in the experiment E. The relation mutates(E,G) covers both knock-out and over-expression of gene G in the experiment E. The Parameters are relations that control the genes taken into account when searching for hypotheses. In the general case, where every gene is possibly related to other genes, there may be an exponential number of possible hypotheses. With the parameters we constrain the problem by reducing the search space. By varying their definition, we can test different possibilities of the model. There are two parametric relations including intermediary gene/3 in rule (2). The integrity constraints provide another means of constraining the search space.
392
3
I. Papatheodorou, A. Kakas, and M. Sergot
Application: Heat Shock Response of M. tuberculosis
M. tuberculosis data sets were obtained from our collaborators at the Centre for Microbiology and Infection, Imperial College London [4] and publicly available tables from the Schoolnik lab, Stanford University. Observations and inferred hypotheses are presented as directed graphs using a set of visualisation tools we developed, which is based on Graphviz, an open source graph-layout software from the AT&T Laboratories. A web-based front-end to explore and manipulate the graphical displays is available [3]. In the example shown here, observations from 5 experiments were selected according to a conservatively chosen significance threshold in the 1st phase statistical analysis. Each experiment knocks out or over-expresses a gene believed to be involved in heat shock response and known to function as a transcriptional regulator (regulator of expression of other genes). The two parameters of the model were defined to restrict attention to possible interactions between 16 genes of known regulatory function. Analysis of the observations in all experiments together generated a single hypothesis, shown in graphical form in figure [1], that explained all observations.
Rv0251c
Rv0250c
Rv0249c
Rv0350
Rv2710
Rv0351 Rv1221 Rv0353 Rv0352
Rv3223c Rv0384c Rv3418c Rv3417c
Rv0990c Rv0991c
Rv2374c
Fig. 1. The nodes represent genes, whereas the edges show the inferred relations between genes, bold for induces and dotted for inhibits. Cyclical edges represent the auto-regulation relationships abduced.
The resulting hypothesis is in agreement with previous knowledge [4]. The DnaK operon1 (genes Rv0350–353, on the right of the figure) is controlled by the positive regulator sigH (Rv3223c) and the negative regulator hspR (Rv0353). The acr2 operon (genes Rv0249c–251c, at the top left of the figure) is controlled by the positive regulator sigE (Rv1221) and negative regulator hspR (Rv0353). 1
Group of genes that reside next to each other on the DNA and are expressed together.
Inference of Gene Relations from Microarray Data by Abduction
393
The groES/EL genes (Rv3417c–Rv3418c) are under dual negative control by hspR (Rv0353) and hrcA (Rv2374c). Known feedback loops are also discovered: the DnaK operon (Rv0350–353) is negatively regulated via its member Rv0353. Finally, there is a group of genes whose function in heat shock response is not clear but are linked in the explanatory hypothesis. Rv0249c and Rv0250c are both unknown genes, repressed (inhibited) by hspR, both next to Rv0251c in the chromosome. This could be a real effect, suggesting they are in an operon, or it could be some artefact due to their place on the chromosome and the way data is collected. Similarly, Rv0990c and Rv0991c could also be members of an operon, but isolated with no obvious function in heat shock. Our collaborators are planning to investigate these hypotheses in a new set of experiments. Further discussion of our methods and more detailed examples are available in [5].
4
Conclusions
We develop a general method to support the analysis of an important class of microarray experiments. The novel feature is a simple, general model of how gene interactions can cause changes in observable expression levels of genes under differing conditions, and the use of abduction to infer explanatory hypotheses. This method allows us to infer regulation relations across several experiments. The declarative and modular nature of this gene interaction model allows us to experiment easily with variations and new general rules suggested by our biological collaborators, and to add biological knowledge as it becomes available. The parameters in the model allow us to constrain the search space of possible hypotheses and thereby apply the methods to realistically large data sets. Tests on M. tuberculosis rediscovered part of the heat shock response mechanism and suggested further experiments. We are presently engaged in a systematic exploration of the various possibilities afforded by the model and an extensive validation against known gene regulation processes in yeast. We have been able to apply these methods in practice to the analysis of large data sets. Whatever the biological significance of this technique turns out to be in the long-term, the model provides a valuable test case for those concerned with the development of abductive reasoning technology.
References 1. Friedman N., Linial M., Nachman I., Pe’er (2000) Using Bayesian Networks to analyze expression data. J. Comp. Bio. 7:601–620. 2. Kakas, A.C., Denecker, M. (2002) Abduction in Logic Programming. In Computational Logic: Logic Programming and Beyond, Part I. Springer-Verlag, pp402–436. 3. Papatheodorou I., Sergot M., Randall M., Stewart G., Robertson B. (2004) Visualisation of Microarray results to assist interpretation Tuberculosis 84:275–281 4. Stewart, G. et al (2002) Dissection of the heat-shock response in Mycobacterium Tuberculosis using mutants and microarrays. Microbiology 10:3129–3138. 5. Technical Report No. 2005/3, Department of Computing, Imperial College London, 2005 6. Zupan, B., Demsar, J., Bratko, I. et al (2003) GenePath: a system for automated construction of genetic networks from mutant data. Bioinformatics 19:383–389.
nomore< : A System for Computing Preferred Answer Sets Susanne Grell, Kathrin Konczak, and Torsten Schaub Institut f¨ ur Informatik, Universit¨ at Potsdam, Postfach 90 03 27, D–14439 Potsdam [email protected], {konczak, torsten}@cs.uni-potsdam.de
1
Introduction
The integration of preferences into Answer Set Programming (ASP) constitutes an important practical device for distinguishing certain preferred answer sets from non-preferred ones. Up to now, the preference semantics we are considering in this system description were incorporated into answer set solvers either by meta-interpretation [3] or by pre-compilation front-ends [2]; therefore, such kinds of preferences were never integrated into the core existing ASP solvers. Unlike this, the nomore< system pursues an integrative approach to preference handling. Its theoretical background is described in [6]. The system itself is an early branch of the nomore++ ASP solver [8]. The approach relies on rule dependency graphs and computes answer sets by coloring this graph by following a certain strategy. It integrates preferences as an additional type of edges among nodes representing rules. The idea is to start from an uncolored graph and to employ specific operators that turn a partially colored graph gradually into a totally colored one that represents a preferred answer set. Apart from describing the nomore< system, we focus in our experimental section on the question how an integrative approach compares to a compilationbased approach. To this end, we use the plp system [9] in connection with nomore< as well as smodels [11] as its respective back-end ASP solvers. (Ab)using nomore< as a standard ASP solver allows us to obtain comparable results, although its performance is much more inferior than that of smodels as well as the full-fledged nomore++ system [8].
2
Background
The current version of the nomore< system computes preferred answer sets of logic programs with preferences on rules. A logic program is a finite set of rules such as p0 ← p1 , . . . , pm , not pm+1 , . . . , not pn , where n ≥ m ≥ 0, and each pi (0 ≤ i ≤ n) is an atom. The semantics of logic programs is determined by its set of answer sets, as proposed in [5]. An ordered program is a pair (Π, <), where Π is a logic program and < ⊆ Π × Π is a strict partial order among the rules in Π. Given, r1 , r2 ∈ Π, the relation r1 < r2 expresses that r2 has higher priority than r1 . The ordering < is used for selecting preferred answer sets among the standard ones of Π, which can be achieved in different ways. Here, we concentrate on one C. Baral et al. (Eds.): LPNMR 2005, LNAI 3662, pp. 394–398, 2005. c Springer-Verlag Berlin Heidelberg 2005
nomore< : A System for Computing Preferred Answer Sets
395
interpretation for preference handling, namely the D-semantics provided in [2]. Similar semantics for preferences among rules where defined in [1,10]. Previous work [6] provides the theoretical background for computing preferred answer sets in terms of coloring strategies of a rule dependency graph extended by preference information. The main goal of the work presented in [6] is the integration of preference information into an ASP solver. There, deterministic operators, e.g. U, P and nondeterministic operators, e.g. choice operator D, where defined. For instance, iterated application of P (denoted by P ∗ ) and U, denoted by (PU)∗ , yield the well-founded semantics [12]. Iterated application of propagation (PU)∗ and choice operations D, denoted by [(PU)∗ ◦ D]n ◦ (PU)∗ , yield preferred answer sets of the underlying ordered program. More precisely, these propagation and choice operations are preference-based, following the idea that rules are considered in an order preserving way.
3
System
The nomore< system is a C++ implementation of the approach given in [6] and an improvement of the GCplp [4] system. The current version 1.0 can be downloaded from http://www.cs.uni-potsdam.de/wv/nomorepref/. Since nomore< uses lparse [7] as parser, we have to encode preference statements as the following set of rules: name(r) ← preferred (r1 , r2 ) ←
for all rules r involved in < for every preference relation r2 < r1 ,
where the name predicates name are needed for rule labelling and the preferred predicates make the preferences explicit. For example, the ordered program {r1 : a ← not b, r2 : b ← not a, r2 < r1 } is represented as program a ← name(r1 ), not b b ← name(r2 ), not a
name(r1 ) ← name(r2 ) ← preferred (r1 , r2 ) ←
which has standard answer sets {a} and {b}, but only {a} as preferred one.
4
Experiments
We have considered the following examples: – indset N .lp encodes the independent set problem for an undirected circle graph with N vertices, where even numbered vertices are preferred to be in an independent set. – art2 N .lp and art N .lp are artificial ordered programs, where all N rules of the underlying logic program have only negative body atoms (except for name predicates used for rule labelling).
396
S. Grell, K. Konczak, and T. Schaub
– kernel comp N .lp encodes the kernel problem for a complete graph with N vertices, where one special vertex is preferred to be in a kernel, but no other ones. – col lad 1 N .lp encodes the coloring problem of a ladder graph with two colors, where a particular color is preferred for every odd vertex. A detailed description of the used examples including downloads can be found at http://www.cs.uni-potsdam.de/∼ konczak/benchmarks/BenchPref/index.html . Table 1 shows the time measurements on an AMD processor with 2.2 Ghz and 2 GB memory. We have tested several problem classes for finding one preferred answer set and finding all preferred answer sets. In Table 1, DH denotes a coloring strategy, where the propagation operators are preference-based (i.e. we propagate from higher preferred rules to lower preferred rule) and the choice operator is a conventional one. There, generated solutions have to be checked by the operator H, which verifies the existence of a so called height function [6] ensuring that an answer set is a preferred one. D< denotes a coloring strategy, where the propagation operators and the choice operators are fully preferencebased. More precisely, it denotes the coloring sequence [(PU)∗ ◦ D]n ◦ (PU)∗ [6]. That is, propagating and choosing goes along the given preferences from higher preferred rules to lower preferred ones. In short, DH offers a partial integration of preference information into an ASP solver where a check is still needed, whereas D< fully integrates preference information into an ASP solver. In contrast to the integration of preferences into an ASP solver, the plp system [9] compiles an ordered program into a logic program such that the preferred answer sets correspond to the standard answer set of the compiled program. We have used plp to compare our integrative approach with the compilation method provided by plp. In Table 1, plp + n denotes the time for computing preferred answer sets via the plp compilation while using the nomore< system as a standard ASP solver. Additionally, we have run the compilation in connection with smodels [11] (see plp + s in Table 1) for showing differences in the current development status of the nomore< system, when computing standard answer sets. The times for plp + s and plp + n show that the nomore< system has a lower base speed than smodels due to the fact that nomore< is not as optimized as smodels, e.g. heuristics and lookahead are not yet integrated in nomore< and nomore< provides only forward propagation whereas smodels (as well as nomore++ [8]) provides forward and backward propagation. The results in Table 1 show that for problems where one is interested in finding only one solution, the strategy where preference information is fully integrated into an ASP solver (indicated by appealing to the preference-based choice operator D< ) is much better than a strategy where the preference information is only partially integrated. Additionally in this case, D< behaves much better than the compilation method (plp + n). D< is also a good strategy for determining preferred answer sets whenever the underlying rules of the program have no positive body atoms, e.g. as in the artificial examples art2 N .lp. The strategy DH seems to be good whenever we want to find all preferred answer sets or whenever we have multiple positive atoms in the body of an rule.
nomore< : A System for Computing Preferred Answer Sets
397
Table 1. Time Measurements on an AMD processor with 2.2 Ghz and 2 GB memory, and lparse version 1.0.13 and smodels version 2.28
file indset 5.lp indset 10.lp indset 15.lp indset 20.lp indset 25.lp indset 30.lp indset 35.lp indset 40.lp art2 10.lp art2 16.lp art2 20.lp art2 30.lp art2 40.lp art2 50.lp art2 60.lp art2 70.lp art2 80.lp art2 90.lp art2 100.lp kernel comp 10.lp kernel comp 20.lp kernel comp 30.lp kernel comp 40.lp kernel comp 50.lp kernel comp 60.lp kernel comp 70.lp kernel comp 80.lp kernel comp 90.lp col lad 1 2.lp col lad 1 4.lp col lad 1 8.lp col lad 1 10.lp col lad 1 20.lp col lad 1 30.lp col lad 1 40.lp art 10.lp art 20.lp art 30.lp art 40.lp art 50.lp art 60.lp art 70.lp art 80.lp art 90.lp art 100.lp
find one preferred answer set find all preferred answer sets DH D< plp+n plp+s DH D< plp+n plp+s 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.02 0.01 0.00 0.00 0.02 0.01 0.01 0.00 0.06 0.01 0.02 0.02 0.06 0.01 0.00 0.00 0.13 0.02 0.14 0.18 0.13 0.02 0.29 0.01 0.23 0.04 0.68 0.89 0.23 0.04 0.01 0.01 0.38 0.05 3.42 8.47 0.38 0.05 6.83 0.01 0.59 0.07 16.25 41.90 0.60 0.07 0.01 0.01 0.88 0.09 78.31 371.60 0.90 0.09 0.00 0.00 0.02 0.01 0.00 0.00 0.05 0.01 0.02 0.00 0.05 0.02 0.03 0.00 0.32 0.02 0.06 0.00 0.09 0.02 0.10 0.00 0.82 0.02 1.44 0.01 0.27 0.05 2.55 8.05 4.91 0.05 32.81 0.01 0.62 0.08 58.40 0.01 19.08 0.08 – 0.02 1.36 0.13 – – 69.11 0.13 – 0.02 2.57 0.19 – – – 0.19 – 0.03 4.26 0.25 – – – 0.25 – 0.04 6.50 0.33 – – – 0.33 – 0.05 9.32 0.42 – – – 0.43 – 0.06 12.74 0.52 – – – 0.52 0.03 0.01 0.11 0.03 0.03 0.34 0.11 0.03 0.21 0.06 0.70 0.11 0.21 1087.77 0.72 0.11 0.81 0.16 2.87 0.25 0.80 – 2.93 0.25 2.20 0.33 7.09 0.46 2.17 – 7.23 0.46 5.03 0.60 14.37 0.73 4.99 – 14.23 0.73 10.34 1.01 24.28 1.07 9.91 – 24.88 1.07 21.02 1.60 38.54 1.46 20.00 – 39.00 1.46 46.69 2.55 59.49 1.92 41.67 – 59.11 1.91 87.17 3.87 84.36 2.45 85.27 – 83.31 2.44 0.00 0.00 0.00 0.00 0.00 0.00 0.01 0.00 0.00 0.00 0.06 0.01 0.00 0.05 0.06 0.01 0.01 0.01 3.13 0.02 0.01 33.78 3.16 0.02 0.01 0.01 19.38 0.03 0.02 – 19.47 0.03 0.05 0.06 – 0.10 0.07 – – 0.10 0.11 0.13 – 0.22 0.16 – – 0.22 0.20 0.23 – 0.38 0.28 – – 0.39 0.02 0.00 0.06 0.01 0.03 0.00 0.07 0.01 37.24 0.04 0.70 0.04 55.93 0.04 0.84 0.04 – 0.29 3.63 0.10 – 0.29 4.41 0.10 – 1.21 15.18 0.18 – 1.19 18.94 0.18 – 3.60 39.98 0.28 – 3.74 47.92 0.28 – 9.01 – 0.41 – 8.90 – 0.41 – 19.24 – 0.57 – 19.89 – 0.57 – 38.40 – 0.77 – 37.78 – 0.77 – 70.38 – 1.00 – 68.47 – 0.99 – 121.81 – 1.26 – 116.74 – 1.25
398
S. Grell, K. Konczak, and T. Schaub
For the independent set problem, the compilation method (plp + n) seems to be better than an integration of preference information into an ASP solver. This is mainly caused by the underlying preference structure. It remains to be future work, under which preference structure the compilation method and under which preference structure the integrative approach yields the best results. Hence, choosing the best strategy for computing preferred answer set depends on the underlying problem (example) class.
5
Conclusions and Future Work
We have presented the nomore< system, implemented in C++, which integrates preference information into an ASP solver. Furthermore, we have compared our integrative approach with the compilation method of preference handling provided by the plp system. We have found out that it really depends on the underlying problem class and preference structure, whether an integrative approach of preference handling is better than the compilation method, or vice versa. Hence, it remains to be future work to study problem classes and underlying preference structures in view of compilation and integrative methods. Moreover, the current version of nomore< contains no optimization methods, e.g. backward propagation, heuristics, and lookahead. Acknowledgements. The work was supported by the German Science Foundation (DFG) under grant SCHA 550/6-4, TP C and by the EC under project IST2001-37004 WASP.
References 1. G. Brewka and T. Eiter. Preferred answer sets for extended logic programs. Artificial Intelligence, 109(1-2):297–356, 1999. 2. J. Delgrande, T. Schaub, and H. Tompits. A framework for compiling preferences in logic programs. Theory and Practice of Logic Programming, 3(2):129–187, 2003. 3. T. Eiter, W. Faber, N. Leone, and G. Pfeifer. Computing preferred answer sets by meta-interpretation in answer set programming. Theory and Practice of Logic Programming, 3(4-5):463–498, 2003. 4. GCplp. http://www.cs.uni-potsdam.de/∼konczak/system/GCplp. 5. M. Gelfond and V. Lifschitz. Classical negation in logic programs and disjunctive databases. New Generation Computing, 9:365–385, 1991. 6. K. Konczak, T. Schaub, and T. Linke. Graphs and colorings for answer set programming with preferences. Fundamenta Informaticae, 57(2-4):393–421, 2003. 7. Lparse. http://saturn.tcs.hut.fi/Software/smodels/. 8. nomore++. http://www.cs.uni-potsdam.de/wv/nomore++/. 9. plp. http://www.cs.uni-potsdam.de/∼torsten/plp. 10. T. Schaub and K. Wang. A semantic framework for preference handling in answer set programming. Theory and Practice of Logic Programming, 3(4-5):569–607, 2003. 11. smodels. http://www.tcs.hut.fi/Software/smodels/. 12. A. van Gelder, K. Ross, and J. S. Schlipf. The well-founded semantics for general logic programs. Journal of the ACM, 38(3):620–650, 1991.
Integrating an Answer Set Solver into Prolog: ASP − PROLOG Omar Elkhatib, Enrico Pontelli, and Tran Cao Son Department of Computer Science, New Mexico State University {okhatib, epontell, tson}@cs.nmsu.edu
1
Introduction
A number of answer set solvers have been proposed in recent years, such as Smodels, DLV, Cmodels, and ASSAT. Most existing ASP solvers have been extended to provide front-ends that are suitable to encode specialized forms of knowledge—e.g., weight-constraints, restricted forms of optimization, front-ends for planning and diagnosis. These features allow declarative solutions in specific application domains. However, this is not completely satisfactory: • The development of an ASP program is viewed as a “monolithic” process. Most ASP systems offer only a batch approach to execution of programs— programs are completely developed, “compiled”, executed, and finally answer sets are proposed to the user. The process lacks any levels of interaction with the user. In particular, it does not directly support an interactive development of programs (as in Prolog), where one can immediately explore the results of simply adding/removing rules. • ASP programmers can control the computation of answer sets through the rules that they include in the logic program. Nevertheless, ASP systems offer very limited capabilities for reasoning on the whole class of answer sets associated to a program—e.g., to perform selection of models according to user-defined criteria or to compare models. These activities are important in many application domains—e.g., to express soft constraints, to support preferences when using ASP to perform planning. • ASP solvers are independent systems; interaction with other languages can be performed only through complex, low level APIs; this prevents programmers from writing programs that manipulate ASP programs and answer sets as first-class citizens. E.g., we wish to write programs in a high-level language (Prolog in this case), which are capable to access ASP programs, modify their structure (by adding or removing rules), and access and reason with answer sets. This type of features is essential in many domains—e.g., automatically modify the plan length in a planning problem. We address these problems by developing a system, ASP − PROLOG. The system provides a tight integration of ASP in Prolog. The language is developed using the module and class capabilities of CIAO Prolog. ASP − PROLOG allows C. Baral et al. (Eds.): LPNMR 2005, LNAI 3662, pp. 399–404, 2005. c Springer-Verlag Berlin Heidelberg 2005
400
O. Elkhatib, E. Pontelli, and T.C. Son
programmers to assemble a variety of different modules to create a program; along with the traditional types of modules supported by CIAO Prolog (e.g., standard Prolog, constraint logic programming, active deductive databases), it allows the presence of various ASP modules, each being a logic program conforming to the syntax of lparse. Each Prolog module can access any ASP modules (using the traditional module qualification of Prolog), read its content, access its models, and modify it (e.g., adding/removing rules).
2
System Capabilities and Possible Areas of Application
User Interface: Prolog modules are required to declare their intention to access any ASP modules; this is accomplished through the declarations :− use asp(module name, file name, parameters ) where module name is the name of the ASP module, file name is the file containing the ASP code, while parameters control the ASP solver (command line and compute arguments of Smodels). ASP − PROLOG provides predicates that allow Prolog to interact with ASP modules: • model(ModelName,ModelObject) retrieves one answer set of an ASP module; ModelName is an atom uniquely identifying one answer set, while ModelObject is a CIAO Prolog object containing the answer set (as Prolog facts). For example, plan:model(1, Q) retrieves the answer set named 1 of ASP module plan and stores it as an object in Q; if we want to check whether the atom p is true in such answer set, we simply execute the Prolog goal Q:p. • total stable model/2 determines the number of answer sets of an ASP module, and returns a list of the names given to the answer sets. • assert/1 and retract/1: the argument of these predicates is a list of ASP rules, that are either added or removed from an ASP module. For example, the goal plan:assert([p:-q]) adds the rule p:-q to the ASP module plan. Modifications are undone during backtracking. • assert nb/1 and retract nb/1 have the same effect as assert/retract, with the exception that the modifications are not undone upon backtracking. • change parm/1 allows to set/modify the parameters for the ASP execution (e.g., values of constants, components of the compute statement of Smodels). • clause/2: this predicate is used to allow a Prolog module to access the rules of an ASP module—in the same spirit as the clause predicate is employed in Prolog to access the Prolog rules present in the program. The two arguments represent respectively the head and the body of the rule. If α is a CIAO object representing an answer set, then the Prolog goal α : p corresponds to testing truth of p (possibly non-ground) in the answer set α. Observe that, due to the fact that the syntax of Smodels is not ISO Prolog-compliant, certain Smodels constructs (e.g., cardinality and weight constraints) have a slightly different syntactic representation when used within Prolog modules.
Integrating an Answer Set Solver into Prolog: ASP − PROLOG
401
Possible Application Areas: ASP − PROLOG allows users to • manipulate answer sets of a program; this includes (i) the computation of the entailment relation of a logic program (e.g., different modes of reasoning, such as skeptical or credulous reasoning can be done), and (ii) comparing answer sets of an ASP program, and select those that satisfy certain properties (e.g., individual preferences). Since ASP has frequently been used as a knowledge representation language, the ability to compute the entailment relation of a logic program makes ASP − PROLOG an attractive candidate for the implementation of query-answering systems based on answer set semantics. Furthermore, because computing preferred answer sets has found its application in planning with preferences, diagnosis, and common-sense reasoning, ASP − PROLOG can be used as an interactive environment for such systems. • modify programs and recompute their answer sets on the fly (e.g., adding or removing rules); this feature provides a simple way to modify the values of constants occurring in a program and/or to delay the grounding process of a program with variables until the instantiated rules are needed. Furthermore, ASP − PROLOG provides different ways for users to test and debug an ASP program interactively. For example, ’suspected rules’ can be removed for testing the consistency of a program; adding ’known-to-be-true’ atoms into a program is another way for detecting errors in the program; etc. • work with several logic programs simultaneously (e.g., reasoning about the common knowledge of multiple-agents); since ASP − PROLOG allows users to work with several modules at the same time, it can be used as an environment for implementing/testing various formalisms for modeling multi-agents. For example, when each agent’s knowledge is represented by a logic program, computing common knowledge among them is equivalent to computing the intersection of all possible answer sets. • use logic programs with answer set semantics to control the query-answering process of a Prolog program (e.g., avoiding infinite loops); this is possible, since ASP − PROLOG programs are Prolog programs extended with a new type of atoms, whose truth value is determined by the ASP solver. We are not aware of any systems with the same capabilities as ASP − PROLOG. Smodels provides a very low level API [5] that allows C++ programs to use Smodels as a library. DLV does not document any external API, although a Java wrapper has been recently announced [1]. XASP [2] proposes an interface from XSB to the API of Smodels. It provides a subset of the functionalities of ASP − PROLOG, with a deeper integration with the capabilities of XSB of handling normal logic programs.
3
System Implementation
The syntax and semantics of ASP − PROLOG programs are described in [3]. It suffices to notice that a ASP − PROLOG program is a pair (P r, As), where P r is a set of ASP − PROLOG rules and As is a logic program which conforms to
402
O. Elkhatib, E. Pontelli, and T.C. Son
the syntax of lparse. Each ASP − PROLOG rule is a Prolog rule whose body can contain atoms occurring in As. Furthermore, the above mentioned interface predicates (e.g., assert, retract) can be used by ASP − PROLOG programs to manipulate As. The overall structure of the implementation is depicted in Figure 1. The system is composed of two parts, a preprocessor and the actual CIAO Prolog system. The system accepts the input composed of (i) the main Prolog module (P r); (ii) a collection of CIAO Prolog modules (m1 , m2 , . . . , mn ); (iii) a collection of ASP modules (e1 , e2 , . . . , em ). Prolog Modules Updated Prolog Modules
ASP-Prolog PreProcessor
Interface Modules
Module Load
Model Classes
ASP-Prolog Goals
CIAO Prolog
Answer Substitutions
ASP Modules
Fig. 1. Overall Structure of ASP − PROLOG Implementation
Preprocessing: The input to the system is used as the input to the preprocessor. The preprocessor transforms each Prolog module into a new module (P r is transformed to N P r and mi is transformed to nmi ), and each ASP module ei into a CIAO module imi and a class definition ci .1 The main purpose of this step is to adapt the syntax of the interface predicates, make it compatible with CIAO Prolog’s syntax, and prepare different objects (interface module and model class) for the actual program execution. The preprocessor also invokes the CIAO Prolog top-level and loads all the appropriate modules for execution. The interaction with the user is the same as the standard Prolog top-level. Interface Modules: For each ASP module ei , the preprocessor generates an interface module ci by instantiating a generic module skeleton to the content of ei . ci is a standard CIAO Prolog module and provides the client Prolog modules with the predicates used to access and manage the ASP * access ASP file & parameters Module * computation of initial models module ei . The overall structure Initialization * generation of model objects * interface initialization of the interface module is illus* interface predicates trated in Figure 2. The module - assert/1, assert_nb/1 Public Part - retract/1, retract_nb/1 has an export list which includes Export List - models/2, total_stable_models/1 - compute/2, change_parm/1 all the predicates used to manipuMODELS late ASP modules (e.g., assert, * Internal ASP Program representation Private * Model Objects retract, model) as well as all * Backtracking checkpoints Data * Support Tables the predicates that are defined within the ASP module. The typFig. 2. Structure of the Interface Module ical module declaration generated for an interface module will look like: 1
CIAO provides the ability to define classes and create class instances [4].
Integrating an Answer Set Solver into Prolog: ASP − PROLOG
403
:− module(’plan.lp’,[assert/1,retract/1,...,model/2,p/0,q/0,r/0]). The definition of the various exported predicates (except for the predicates defined in the ASP module) is derived by instantiating a generic definition of each predicate. Each module has an initialization part, which is in charge of setting up the internal data structures (e.g., the internal representation of the ASP module, tables to store parameters and answer sets), and invoke the answer set solvers for the first time on the ASP module—in the current prototype we are using Smodels as answer set solver. The result of the computation of the models will be encoded as a collection of Model Objects (see below). The module will maintain a number of internal data structures, including a representation of the ASP code, a representation of the parameters to be used for the computation of the answer sets (e.g., values of constants), a list of the objects representing the models of the ASP module, and a count of the current number of answer sets.
Model Classes: For each ASP module ei , the preprocessor generates a CIAO class definition ci . The objects obtained from the instantiation of such class will be used to represent the individual models of the ASP module. Prolog modules can obtain reference to these objects (e.g., using the model predicate supplied by the interface module) and use them to directly query the content of one or several models. The definition of the class is obtained through a straightforward parsing of the ASP module, to collect the names of the predicates defined in it; the class will provide a public method for each of the predicates present in the ASP module. In addition, the class defines also a public method add/1 which is employed by the interface module to initialize the content of the model. Each model is stored in one instance of the class; the actual atoms representing the model are stored internally in the objects as facts of the form s(fact). Implementation and System Details: The various interface predicates are implemented in CIAO Prolog in a fairly straightforward way. For instance, the implementation of assert (resp. retract) makes use of the module concat of CIAO Prolog to introduce new (resp. remove) rules to (resp. from) the ASP module. A number of tables are maintained by each interface module to support the execution of ASP modules. Some of the relevant internal structures include: • fn: maintains a (Prolog-based) representation of the rules of the ASP module; • stable ref: a table (implemented as Prolog facts) that maintains references to the current answer sets of the ASP module (as pairs model name/object reference that maps name of models to objects representing the models); • retract rule: a trail structure that caches the modifications performed by assert and retract; this is required to allow undoing of the changes; • prm: a table (encoded as Prolog facts) that stores the parameters to be used during the computation of the models of the ASP module.
404
O. Elkhatib, E. Pontelli, and T.C. Son
Code and URL: The original idea and the semantics of ASP − PROLOG has been presented in [3]. The first version of system is now complete and available for download at www.cs.nmsu.edu/∼ okhatib/asp prolog.html .
References 1. The DLV Wrapper Project. 160.97.47.246:8080/wrapper, 2003. 2. L. Castro. XASP: Answer Set Programming with XSB. SUNY Stony Brook, 2002. 3. O. Elkhatib et al. ASP-Prolog: A System for Reasoning about Answer Set Programs in Prolog. In PADL-2004, pages 148–162. Springer, 2004. 4. M. Pineda et al. The O’Ciao Approach to Object Oriented Logic Programming. In Colloquium on Implementation of Constraint Logic Programming Systems, 2002. 5. T. Syrj¨ anen. Lparse User’s Manual. www.tcs.hut.fi/Software/smodels.
circ2dlp — Translating Circumscription into Disjunctive Logic Programming Emilia Oikarinen and Tomi Janhunen Helsinki University of Technology, Department of Computer Science and Engineering, Laboratory for Theoretical Computer Science, P.O.Box 5400, FI-02015 TKK, Finland {Emilia.Oikarinen, Tomi.Janhunen}@tkk.fi
1
Introduction
The stable model semantics of disjunctive logic programs (DLPs) is based on minimal models [5,12] which makes atoms appearing in a disjunctive program false by default. This is often desirable from the knowledge representation point of view, but certain domains become awkward to formalize if all atoms are blindly subject to minimization. In contrast to this, parallel circumscription [11] provides a refined notion of minimal models as it distinguishes varying and fixed atoms in addition to those being falsified. This eases the task of knowledge presentation in many cases. For example, it is straightforward to formalize Reiter-style minimal diagnoses [13] for digital circuits using parallel circumscription. There have been several attempts to embed parallel circumscription into disjunctive logic programming. Although fixed atoms are easy in this respect [1,6], varying atoms are not fully covered. Earlier approaches either deal with syntactic subclasses of logic programs [4] or have exponential worst-case space complexities [9,14]. To the contrary, the system circ2dlp described in this article is based on a new linear but non-modular transformation [8] which enables the use of existing implementations of disjunctive logic programming such as dlv [10] and GnT [7] for the actual search of minimal models. The rest of this system description is organized as follows. Section 2 concentrates on specifying the output produced by circ2dlp, i.e. the translation presented in [8], on a high level of abstraction. In Section 3, we provide the reader with some instructions how to use the tool in practice. The last section (Section 3) comprises of some preliminary experimental results obtained using circ2dlp together with dlv and GnT. As a benchmark, we use the problem of finding Reiter-style minimal diagnoses [13] for digital circuits. Moreover, we briefly compare the performance of our translation-based approach with another: circum [15] is a system developed for computing prioritized circumscription (a generalization of parallel circumscription) using a generate and test method.
The research reported in this paper is partially funded by the Academy of Finland (project #211025) and the European Commission (contract IST-FET-2001-37004). The support from Helsinki Graduate School in Computer Science and Engineering, Nokia Foundation, and Finnish Cultural Foundation is gratefully acknowledged.
C. Baral et al. (Eds.): LPNMR 2005, LNAI 3662, pp. 405–409, 2005. c Springer-Verlag Berlin Heidelberg 2005
406
2
E. Oikarinen and T. Janhunen
Translation-Based Approach
The aim in the following is to briefly describe the translation computed by circ2dlp. For that purpose, we give a definition for parallel circumscription in the propositional case. Following the presentation in [8], we formulate the definition in the case of a positive DLP Π possessing a Herbrand base Hb(Π). Given a set of varying atoms V ⊆ Hb(Π) and a set of fixed atoms F ⊆ Hb(Π), the parallel circumscription of Π is characterized by V, F -minimal models M |= Π each of which is minimal in the following sense: there is no model N |= Π such that N \ (V ∪ F ) ⊂ M \ (V ∪ F ) and N ∩ F = M ∩ F . The basic idea in the translation-based approach [8] is that the V, F minimal models of a positive DLP Π can be captured by projecting the stable models of the translation Trcirc2dlp (Π) = TrGEN (TrKK (Π)) ∪ TrEG (TrMIN (TrKK (Π)))
(1)
with respect to Hb(Π). The translation given in (1) is based on the following primitives: (i) TrKK (·) removes fixed atoms using a technique proposed in [1], (ii) TrGEN (·) produces a model generator for Π as a DLP, (iii) TrMIN (·) encodes a test for V, ∅-minimality as a propositional unsatisfiability problem, and (iv) TrEG (·) implements the required unsatisfiability check using the primitives of DLPs [3]. To summarize the properties of Trcirc2dlp (Π), the translation is linear in the length of the program ||Π|| and a bijective correspondence between stable models of the translation and the V, F -minimal models of Π is obtained. Further details and the correctness proof of Trcirc2dlp(Π) can be found in [8]. The model generator TrGEN (TrKK (Π)) can be enhanced by taking the set of varying atoms V properly into account. Actually, an improved model generator TrGEN2 (TrKK (Π)) is already used in the implementation. The idea is to replace the rules in items 1 and 2 in [8, Definition 6] by the following: 1 . a ← ∼a for each a ∈ V and a ← ∼a for each a ∈ Hb(Π), 2 . (A \ V ) ← (B \ V ), ∼(A ∩ V ), ∼B ∩ V for each rule A ← B in Π. The translation Trcirc2dlp (Π) optimized in this way is a DLP and thus a valid input for disjunctive solvers implementing the search for stable models [7,10]. Prioritized circumscription [11] can be translated into parallel circumscription using a scheme proposed by Lifschitz [11]: Circ(Π, P1 > . . . > Pk , V ) =
k
Circ(Π, Pi , Pi+1 ∪ · · · ∪ Pk ∪ V )
(2)
i=1
where P1 , . . . , Pk are sets of minimized atoms with decreasing priority, V is the set of varying atoms, and the sets of fixed atoms remain implicit. In our translation-based approach, the equation (2) is understood as a join of k parallel circumscriptions. The respective subtranslations can be concatenated so that Hb(Π) is shared and the new atoms produced by Trcirc2dlp remain distinct for each part. It follows that the time complexity is O(k × ||Π||) in general.
circ2dlp — Translating Circumscription into DLP
3
407
Some Instructions for Use
The translator circ2dlp has been implemented in C under Linux operating system and is available at http://www.tcs.hut.fi/Software/circ2dlp/. The translator takes a DLP Π combined with sets of varying and fixed atoms as input and produces translation Trcirc2dlp(Π) as output. The input format is the internal format of GnT produced by the front-end lparse. Rules with variables can be used, although lparse performs an instantiation for the rules. circ2dlp produces output compatible with both GnT (default) and dlv. All atoms are minimized by default, unless explicitly stated to be varying or fixed. Default behaviour can be altered using option --vary. Notice that lparse might produce invisible atoms that have no name in the symbol table. Option --vary cannot be applied to programs containing invisible atoms, as the semantics of invisible atoms becomes unclear. circ2dlp can also handle programs containing negation. For such programs the translation yields the V, F -minimal models of the Gelfond-Lifschitz reduct of the original program which can be understood as the V, F -stable models of the program. Command line options for circ2dlp are the following: • • • • •
-h or --help – Print a help message. -t – Print human readable output. --dlv – Print the output in dlv syntax. --vary – Vary all atoms by default. --all – Generate all classical model candidates, using the model generator TrGEN (TrKK (Π)). Otherwise, TrGEN2 (TrKK (Π)) is used. • --version – Print version information.
For example, all {a}, ∅-minimal models of a program stored in a file example.lp can be computed as follows: lparse --dlp example.lp > example.sm circ2dlp example.sm -v a | gnt 0 or, with dlv, circ2dlp --dlv example.sm -v a | dlv -n=0 -For more examples, see http://www.tcs.hut.fi/Software/circ2dlp/. The translator circ2dlp is accompanied by a Perl implementation of Lifschitz’s scheme for computing prioritized circumscription called prio circ2dlp. For example, the script is used to compute prioritized circumscription Circ(Π, {a} > {b}, ∅) for program Π given in file example.sm as follows: prio_circ2dlp example.sm a:b | gnt 0
4
Experiments
As a benchmark, we use the problem of finding Reiter-style minimal diagnoses [13] for digital circuits encoded as parallel circumscription. We generate circuits
E. Oikarinen and T. Janhunen 10000 1000
Seconds
100
10000
GnT max GnT ave GnT min DLV max DLV ave DLV min
1000 100 Seconds
408
10
10
1
1
0.1
0.1
0.01
GnT max GnT ave GnT min DLV max DLV ave DLV min
0.01 16
18
20 22 24 Number of nodes in the circuit
26
28
16
18
20 22 24 Number of nodes in the circuit
26
28
Fig. 1. Computing minimal diagnoses for faulty digital circuits. On the left all diagnoses are computed, whereas only one diagnosis on the right.
as follows. First, a random tree is generated using the inverse Pruefer algorithm. The leaves of the tree corresponding to the inputs of the digital circuit are assigned random Boolean values. The intermediate nodes are assigned random logical operations corresponding to the intermediate gates of the circuit. The gate at the root node of the tree produces the output of the circuit. The value of the output is calculated and flipped in order to obtain faulty behaviour for the circuit. The number of nodes N in the tree forming the digital circuit varies from 16 to 28. For each number of nodes we generate 100 random instances. These instances are available at http://www.tcs.hut.fi/Software/circ2dlp/. Typically an instance has less than ten minimal diagnoses when N = 28. The measured running time is the translation time of circ2dlp plus the duration of the search for stable models using GnT or dlv. The actual translation times are negligible, however. We use user+system time of /usr/bin/time command in UNIX. All the tests were run under the Debian GNU/Linux 2.4.26 operating system on a AMD Athlon XP 2000+ computer with 1 GB memory. Results are illustrated in Fig. 1. In the case of finding all minimal diagnoses, GnT outperforms dlv, but in the case of finding a single minimal diagnosis dlv is superior to GnT in most of the cases. One obvious advantage of our translation-based approach is that it is rather easy to use different solvers and thus gain from their development in the future. We also compared briefly the performance of our approach with that of the circum system [15] using some instances of our diagnosis benchmark. Our experiments suggest that in the case of parallel circumscription the running times for the circum system are one or two orders of magnitude higher than running times for circ2dlp+GnT. To compare the systems in the case of prioritized circumscription we used our diagnosis benchmarks and added random priorities for the minimized atoms varying the number of priority classes k. These experiments suggest that our approach is able to compete with circum when k is small, but as k grows, the quadratic blowup implied by (2) becomes apparent. There is also a diagnosis front-end in dlv [2], but there are restrictions in the case of minimal diagnoses: the theory has to be non-disjunctive and the
circ2dlp — Translating Circumscription into DLP
409
abnormality atoms may only appear negatively. This limits the applicability of the front-end so that our diagnosis benchmark cannot be represented naturally.
References 1. J. de Kleer and K. Konolige. Eliminating the fixed predicates from a circumscription. Artificial Intelligence, 39(3):391–398, July 1989. 2. T. Eiter, W. Faber, N. Leone, and G. Pfeifer. The diagnosis frontend of the DLV system. AI Communications, 12(1-2):99–111, 1999. 3. T. Eiter and G. Gottlob. On the computational cost of disjunctive logic programming: Propositional case. Annals of Math. and AI, 15:289–323, 1995. 4. M. Gelfond and V. Lifschitz. Compiling circumscriptive theories into logic programs. In Proceedings of the 7th National Conference on Artificial Intelligence, pages 455–449, St. Paul, MN, August 1988. AAAI Press. 5. M. Gelfond and V. Lifschitz. Classical negation in logic programs and disjunctive databases. New Generation Computing, 9:365–385, 1991. 6. K. Inoue and C. Sakama. Negation as failure in the head. Journal of Logic Programming, 35(1):39–78, 1998. 7. T. Janhunen, I. Niemel¨ a, D. Seipel, P. Simons, and J.-H. You. Unfolding partiality and disjunctions in stable model semantics. ACM Transactions on Computational Logic, 2005. To appear, see http://www.acm.org/tocl/accepted.html. 8. T. Janhunen and E. Oikarinen. Capturing parallel circumscription with disjunctive logic programs. In Proceedings of the 9th European Conference on Logics in Artificial Intelligence, JELIA’04, pages 134–146, Lisbon, Portugal, September 2004. Springer-Verlag. LNAI 3229. 9. J. Lee and F. Lin. Loop formulas for circumscription. In Proceedings of 19th National Conference on Artificial Intelligence, pages 281–286, San Jose, California, USA, July 2004. The MIT Press. 10. N. Leone, G. Pfeifer, W. Faber, T. Eiter, G. Gottlob, and F. Scarcello. The DLV system for knowledge representation and reasoning. ACM Transactions on Computational Logic, 2005. To appear, see http://www.acm.org/tocl/accepted.html. 11. V. Lifschitz. Computing circumscription. In Proceedings of the 9th International Joint Conference on Artificial Intelligence, pages 121–127, Los Angeles, California, USA, August 1985. Morgan Kaufmann. 12. T.C. Przymusinski. Stable semantics for disjunctive programs. New Generation Computing, 9:401–424, 1991. 13. R. Reiter. A theory of diagnosis from first principles. Artificial Intelligence, 32:57– 95, 1987. 14. C. Sakama and K. Inoue. Embedding circumscriptive theories in general disjunctive programs. In Proceedings of the 3rd International Conference on Logic Programming and Nonmonotonic Reasoning, pages 344–357. Springer-Verlag, 1995. 15. T. Wakaki and K. Inoue. Compiling prioritized circumscription into answer set programming. In Proceedings of the 20th International Conference on Logic Programming, pages 356–370, Saint-Malo, France, September 2004. Springer-Verlag.
Pbmodels — Software to Compute Stable Models by Pseudoboolean Solvers Lengning Liu and Mirosław Truszczy´nski Department of Computer Science, University of Kentucky, Lexington, KY 40506-0046, USA
Abstract. We describe a new software, pbmodels, that uses pseudo-boolean constraint solvers (PB solvers) to compute stable models of logic programs with weight atoms. To this end, pbmodels converts ground logic programs to propositional theories with weight atoms so that stable models correspond to models. Our approach is similar to that used by assat and cmodels. However, unlike these two systems, pbmodels does not compile the weight atoms away. Preliminary experimental results on the performance of pbmodels are promising.
1 Introduction We describe a system pbmodels to compute stable models of logic programs with weight atoms. We call such programs smodels programs, as we adopt for them the semantics implemented in smodels [1]. The key idea behind pbmodels is to translate programs into propositional theories and use propositional satisfiability solvers. However, unlike existing systems assat [2] and cmodels [3], which first exploited this direction, we do not replace weight atoms with propositional formulas. Instead, we translate programs with weight atoms directly into theories in propositional logic extended with weight atoms, which we refer to as the logic P Lwa [4]. We then use existing solvers for such theories as computational back-end engines. We refer to solvers testing satisfiability of PLwa theories as PB solvers. In some cases, prior to the use of a PB solver, additional simple transformations are needed to ensure the right input format. Compiling away weight atoms may lead to significantly larger programs and theories. Currently most advanced translations result in the growth by a logarithmic factor in the case of cardinality atoms, and a polynomial factor in the case of general weight atoms. Moreover, for some solvers, especially those based on the local-search idea, the structure of the resulting theories makes them difficult to process. The growth in size and the additional structure, which result from compiling weight atoms away, often render solvers that require that step, such as assat [2] and cmodels [3], less effective. That motivates our work. Pbmodels is designed to compute models of smodels programs without replacing weight atoms by their pure propositional representations.
2 Pbmodels — The Algorithm Our paper is based on theoretical results developed in [4] for an abstract setting of programs with monotone and convex constraints. The approach developed there specializes C. Baral et al. (Eds.): LPNMR 2005, LNAI 3662, pp. 410–415, 2005. c Springer-Verlag Berlin Heidelberg 2005
Pbmodels — Software to Compute Stable Models by Pseudoboolean Solvers
411
to smodels programs. In particular, it yields the concepts of the program completion, a loop, a terminating loop and a loop formula for an smodels program, with the completion and loop formulas being formulas in the logic PLwa . Results in [4] imply that stable models of an smodels program are in one-to-one correspondence with models (in the sense of the logic PLwa ) of the completion of the program extended with some loop formulas for the program. That result, generalizing a result of Lin and Zhao [2], allows us to extend the design of assat to the case of smodels programs in a way, which does not require that weight atoms be complied away. In a nutshell, we first compute the completion of the smodels program. Then we iteratively compute models of the completion using PB solvers. Whenever a non-stable model is found, we add to the completion loop formulas that guarantee that the same non-stable model will not be computed again. Our algorithm is shown in Figure 1.
Input: P — a ground logic program (possibly with weight atoms) A — a pseudo-boolean solver Output: M — a stable model of P if A finds one; “Failed” otherwise BEGIN compute the completion comp(P ) of P represented in PB logic; do M := a model of comp(P ) found by A; if (M does not exist) output “Failed” and terminate; if (M is stable) output M and terminate; compute the reduct P M of P with respect to M ; compute the greatest stable model M under M in P M ; M − := M \ M ; find all maximal loops in M − ; add loop formulas of the loops found in previous step to comp(P ); while (true); END Fig. 1. Algorithm of pbmodels
3 Pbmodels — The Package The pbmodels package, including executable PB solvers code, can be obtained at http://www.cs.uky.edu/ai/pbmodels/pbmodels-0.1.tar.gz. It is also installed at the asparagus site http://asparagus.cs.uni-potsdam.de. The package contains the source code of pbmodels and supported PB solvers: satzoo [5], pbs [6], wsatoip [7], and wsatcc [8]. The first two are complete PB solvers while the last two are incomplete PB solvers based on walksat [9] local-search algorithm. In addition, the package contains also two scripts: – esrapl: a perl script that recovers the structure of rules and weight atoms when lparse grounds the input program and converts it to a normal form required by smodels. We found that PB solvers are more effective when the original structure
412
L. Liu and M. Truszczy´nski
of rules and weight atoms is restored. We designed esrapl1 to “undo” conversion of ground programs to their normal form by lparse. – convert2: a perl script that takes a theory in the logic PLwa , and produces PB theories that are accepted by different PB solvers. It is invoked by the command: convert2 <source file> Values for are: satzoo, pbs, wsatcc, or wsatoip. They specify the format, to which the input PLwa theory in the file <source file> is to be converted. The script can be used as a stand alone format translation program.
4 Input, Output, and How to Invoke Pbmodels Pbmodels accepts on input programs obtained by grounding smodels programs with lparse and processing the result with esrapl. The output of pbmodels is similar to that of smodels. The string “False” indicates that there are no stable models for the input program2 . Otherwise, the first stable model of the input will be printed on the screen. The main options for pbmodels are: 1. --engine <engine name> It specifies which PB solver to use. Values for this option are: satzoo, pbs, wsatcc, and wsatoip 2. --option <list of options to the solver> It specifies options for a solver selected with the --engine option. Everything after --option is passed to the solver. In addition, there are also options that allow the user to specify the path to executable programs if they are not installed to the default bin directory. We do not discuss them here due to space constraints. The following examples show how to invoke pbmodels. We assume that the file prog.lp contains an input smodels program. We also assume that satzoo is to be used as the back-end engine. lparse prog.lp | esrapl | pbmodels --engine satzoo The following command will invoke pbmodels, use satzoo, and pass specific satzoo options to satzoo: lparse prog.lp | esrapl | pbmodels --engine satzoo --option -no-rand
5 Performance We report here briefly on our experiments comparing the performance of pbmodels and smodels. We considered several benchmark problems. Due to lack of space, we present 1 2
lparse spelled backwards. If an incomplete solver is used, “False” means that no stable models were found; the program may actually have stable models.
Pbmodels — Software to Compute Stable Models by Pseudoboolean Solvers
413
here only the results concerning the traveling salesperson problem, and the weighted nqueens problem. Specifications of both problems use general weight atoms. Additional experimental results can be found at http://www.cs.uky.edu/ai/pbmodels. We tested pbmodels with the four PB solvers mentioned earlier and compared the results with those obtained for smodels. All experiments were run on machines with 3.2GHz Pentium 4 CPU, 1GB memory, running Linux with kernel version 2.6.11, gcc version 3.3.4. In the following tables we report the number of instances a solver solved, and the number of times a solver won among all solvers, and among the complete solvers (that latter metric for complete solvers only). We also report the average and the median running times in seconds, over all instances that do not time out3 . Table 1 shows results on the traveling salesperson problem. We randomly generated 50 weighted complete graphs containing 20 vertices. For each of them, we set the upper bound on the length of the TSP cycle to w = 62. With this bound, the solvers we tested find that 31 instances have solutions. For the remaining 19, none of the solvers was able to find a solution within the 3000-second time limit we set. Table 1. TSP Problem TSP # of Instances # of Times Won (n = 20, w = 62) Solved v.s. All v.s. Complete smodels 19/50 1 7 pbmodels-satzoo 19/50 2 16 pbmodels-pbs 1/50 0 0 pbmodels-wsatcc 19/50 6 − pbmodels-wsatoip 28/50 22 −
Timing Mean Median 1558.37 1637.14 696.42 461.25 1482.24 1482.24 28.39 6.59 7.20 1.43
Among complete solvers, pbmodels-satzoo performs better than the other two. Even though pbmodels-satzoo and smodels solved the same number of instances, pbmodels-satzoo won more times among the three complete solvers. Moreover, the average running time of pbmodels-satzoo is about half of that of smodels and the median running time is about 1/3 of that of smodels. Over all, pbmodels-wsatoip is the winner. It solves the largest number of instances. Furthermore, its average and median running times are about three orders of magnitude less than the running time of smodels. Table 2 shows the results on the weighted n-queens problem. An instance to this problem consists of n2 non-negative integer weights, one for each square of an n × n chessboard, and of an integer bound w. A solution to an instance is a placement of n queens on the chessboard so that they do not attack each other and the total weight of the placement (the sum of the weights of the squares occupied by queens) is no greater than w. We randomly generated 50 weighted “chessboards” of the size 20 × 20 and, in each case, we set w = 50. In this group, 29 instances have solutions. For the remaining 21 we do not know whether they have solutions or not; none of the solvers we tested could decide that within the set time limit. 3
We do not include the time used by lparse and esrapl in the time reported, as we are only interested in the effectiveness of solvers.
414
L. Liu and M. Truszczy´nski Table 2. Weighted NQueens Problem W-NQueens # of Instances # of Times Won (n = 20, w = 50) Solved v.s. All v.s. Complete smodels 2/50 0 2 pbmodels-satzoo 0/50 0 0 pbmodels-pbs 0/50 0 0 pbmodels-wsatcc 29/50 15 − pbmodels-wsatoip 29/50 14 −
Timing Mean Median 697.81 661.20 N/A N/A N/A N/A 1.01 0.33 0.44 0.35
We observe that pbmodels-wsatcc and pbmodels-wsatoip outperformed smodels. Among the complete solvers, smodels is slightly better than pbmodels-satzoo and pbmodels-pbs (smodels managed to solve two instances in this category, other complete solvers timed-out on all). However, the local-search solvers are the overall winners in all metrics considered.
6 Conclusions We have presented software package pbmodels that computes models of smodels programs. The key feature of our system is that it supports the use of off-the-shelf PB solvers developed by the satisfiability community and capable of process weight atoms directly. Our experiments show that pbmodels performs better than smodels on benchmarks we considered. The results were especially good when local-search PB solvers were used. We observed the same phenomenon in experiments on other problems we considered: weighted Latin square problem, magic square problem, vertex-cover problem and the tower-of-Hanoi problem. The last two problems use only cardinality atoms. Hence we were able to include cmodels [3] in those two tests, too. The results showed that PB solvers are generally faster than cmodels on these two benchmark families.
Acknowledgments We acknowledge the support of NSF grants IIS-0097278 and IIS-0325063.
References 1. Simons, P., Niemel¨a, I., Soininen, T.: Extending and implementing the stable model semantics. Artificial Intelligence 138 (2002) 181–234. 2. Lin, F., Zhao, Y.: ASSAT: Computing answer sets of a logic program by SAT solvers. In: Proceedings of AAAI-2002, AAAI Press (2002) 112–117. 3. Babovich, Y., Lifschitz, V.: Cmodels package (2002) http://www.cs.utexas.edu/ users/tag/cmodels.html. 4. Liu, L., Truszczy´nski, M.: Properties of programs with monotone and convex constraints. In: Proceedings of AAAI-05, AAAI Press (2005).
Pbmodels — Software to Compute Stable Models by Pseudoboolean Solvers
415
5. E´en, N., S¨orensson, N.: An extensible SAT solver. In: Proceedings of SAT-2003. Volume 2919 of LNCS., Springer (2003) 502–518. 6. Aloul, F., Ramani, A., Markov, I., Sakallah, K.: PBS: a backtrack-search pseudo-boolean solver and optimizer. In: Proceedings of SAT-2003. 346 – 353. 7. Walser, J.: Solving linear pseudo-boolean constraints with local search. In: Proceedings of AAAI-97, AAAI Press (1997) 269–274. 8. Liu, L., Truszczy´nski, M.: Local-search techniques in propositional logic extended with cardinality atoms. In: Proceedings of CP-2003. Volume 2833 of LNCS, Springer (2003) 495–509. 9. Selman, B., Kautz, H., Cohen, B.: Noise strategies for improving local search. In: Proceedings of AAAI-1994, AAAI Press (1994) 337–343.
KM ONITOR – A Tool for Monitoring Plan Execution in Action Theories Thomas Eiter, Michael Fink, and J´an Senko Vienna University of Technology, Institute of Information Systems, Vienna, Austria {eiter, michael, jan}@kr.tuwien.ac.at
Abstract. We present a monitoring tool for plan execution in non-deterministic environments, which are described in an action language, based on non-monotonic logic programming. Thanks to it, deviations of concrete executions from expected ones can be detected, and diagnostic explanations in terms of unsuccessful action executions can be obtained. The latter may be exploited for execution recovery, and may help in rectifying an incoherent view of the planning domain.
1 Introduction In a non-deterministic environment, an agent’s plan for achieving a goal by taking a sequence of actions might fail, if some of the actions do not materialize as expected. For this reason, the plan execution might be monitored in order to detect an execution failure or potential problems at an early stage, from which the agent may then recover. Execution monitoring was considered for logical domain descriptions in Golog [7,8] and Flux [6], and for the action language AL in the APLAgent Manager [1,2]. To our knowledge it has not been considered for other KR action languages such as C, or K, and in particular for non-deterministic domains. In [4,3], a general monitoring approach for logic-based action languages with transition-based semantics is presented, in which it is checked from time to time whether the current state complies with a set T of trajectories which describe the expected executions of the plan. If a discrepancy is detected, then the execution is not on track and the agent might suitably reconsider it; in order to diagnose discrepancies, points of failure in the execution are computed, which informally explain discrepancies applying Occam’s Razor by the latest action execution which might have resulted in a “bad” outcome. Such information is useful for execution recovery, e.g., if actions are undone [3], but also for checking whether the user’s understanding of the domain is coherent with the formalization. Example 1. As a running example, we consider here a variant of the well-known Blocks World domain, in which a block being moved may end up at a location different from the intended one, because the agent might not grip it properly. Suppose we have the blocks a, i, p, r, s, x, and the plan P = move(r, x), move(i, s), move(r, i), move(p, x), move(a, r), move(p, a) for reaching the goal state S6 from the initial state S0 in 6 steps as in Figure 1, which shows all trajectories for P that establish the goal. If now at stage 4 the discrepancy is
Work supported by grants of FWF (P16536-N04) and the EC (FET-2001-37004 WASP).
C. Baral et al. (Eds.): LPNMR 2005, LNAI 3662, pp. 416–421, 2005. c Springer-Verlag Berlin Heidelberg 2005
KM ONITOR – A Tool for Monitoring Plan Execution in Action Theories
r p r x a i s initial state
S0
p x a
i
s
r
p x a
r p a
i
s
x
r p a
s
r p x a
x
r p x a
i
i s i s
i s
p
x
p a
S3
x
a
r i s
p
x
a
r i s
p x
a r i s
r i s p x
417
a r i s
p a r i x s goal state
S6
Fig. 1. Goal-establishing trajectories for the example plan
detected that p is on r, then the execution will fail, since the next action move(a, r) can not be taken. If all other blocks are situated as in S3 , an explanation is that the preceding action move(p, x) has failed (see [4, Ex. 3] for a formal description). In general, not all goal-establishing trajectories might be equally desired, and some preferred over others. To model this, T contains all preferred trajectories. Example 2. In our example, let the preferred trajectories T be those in which no block unintentionally falls on the table during execution. Hence, from the goal-establishing trajectories in Figure 1, those which pass through the dotted area are not preferred. KM ONITOR (http://www.kr.tuwien.ac.at/research/monitoring ) implements the execution monitoring approach of [4,3] for the action language K on top of the DLVK planning system [5]. Fig. 2 shows the main loop, which is entered when monitoring is issued. To keep the monitoring overhead low, the current state is analyzed only at certain checkpoints, which are determined by a respective component from a checkpoint policy specified by a non-monotonic logic program (see Section 2). State analysis is done by the tool KD IAGNOSE implementing the diagnosis method from [4]. If a discrepancy is detected, control is returned with this information and any diagnoses found. Example 3. Suppose that blocks x, p, r and s are known to be heavy, and that the policy is to check each time when a heavy block was moved (as such moves bear high likelihood of failure). Then, the checkpoints would be the stages 1, 3, 4, and 6.
2 Checkpointing Rather than checking for a discrepancy after each step, we may check only at certain stages, e.g., if a stage has higher likelihood of failure, or do a periodic check. Then monitoring can be less intrusive and the execution of the whole plan will be faster. In order to select stages for a discrepancy check, a “checkpointing policy” is specified in terms of a logic program, which has facts and rules over the sets of fluents and actions from the domain. The policy is evaluated for all stages in the plan, and if a fact checkpoint(t) is true for the current stage, then a check for discrepancy is issued. We distinguish two types of checkpointing policies – static and dynamic ones. In the static case, checkpoints are calculated one and for all from the policy logic program
418
T. Eiter, M. Fink, and J. Senko
Checkpoint generation component
Is this stage a checkpoint?
F
last stage ?
Diagnosis tool
Analyze the state
F
Wait for the next stage
DLV
T
F
T
KD IAGNOSE DLVK DLVK
Discrepancy found ? T
Fig. 2. Monitoring Loop in KM ONITOR
Preprocess input files
F
Static checkpoint policy?
T
Policy already evaluated?
T
F Compute model of policy
DLV
Check whether model contains
checkpoint(t)
Fig. 3. Checkpoint generation component
and the plan. In the dynamic case, a part of the current state is taken into consideration, yielding more expressive power, but also the need for re-evaluating checkpoints. Figure 3 gives an overview of the checkpoint generation utility. Static Checkpoints. When using a static checkpointing policy, we compute the model of a logic program, comprised of the checkpoint definition file and the modified plan. Actions of the plan are rewritten into facts with timestamps. (E.g., an action move(a, r) occurring at stage 2 is rewritten into move(a, r, 2).) The checkpoint definition file contains rules over the modified action predicates and the special predicate checkpoint(t), whose truth value defines whether we have to do a check at stage t or not. Example 4. To force a check after each move involving a heavy block, we can define the following static checkpointing policy: heavy(X). for X∈{x, p, r, s}, and checkpoint(Tj) : − move(X, Y, Ti), heavy(X), Tj = Ti + 1.
Dynamic Checkpoints. A dynamic checkpointing policy also involves information about some fluents of the current state; intuitively, they are sensed to steer the checkpointing. Therefore, we need to find models of the logic program – made up from the checkpoint declaration file, the plan, and partial state information – at each stage. At stage t we compute a model of this program, and if checkpoint(t) is true, a check for discrepancy is executed. The current stage t may be accessed via now(t).
KM ONITOR – A Tool for Monitoring Plan Execution in Action Theories
Compute match P lan Current state is in match T
& match P lan ?
T No discrepancy found
DLVK F Find the latest state which matches both
match T & match P lan
419
Preprocess input files
Compute match T DLVK Report the diagnoses (if found)
Fig. 4. KD IAGNOSE components and control flow
Example 5. For issuing a check after each step in which a block ends on a different location than intended, we can use the following dynamic checkpointing policy: checkpoint(Tj) : −move(X, Y, Ti), not on(X, Y), Tj = Ti + 1.
This policy will be evaluated at each stage and its result depends on the current state. In a “sleep” mode, policy re-evaluation can be suppressed until the next provisional checkpoint according to the last evaluation.
3 Diagnosis of Discrepancies Before we detail KD IAGNOSE, we informally introduce some terminology (cf. [4]). There is a discrepancy between a state Si and a set of preferred trajectories T rel ative to a plan P , if there is no trajectory S0 , A0 , S1 , . . . , Sn−1 , An−1 , Sn i.e., an alternating sequence of states and action occurrences in T , such that Si = Si and Sn is a goal state. Furthermore, we identify the point of failure for an observed discrepancy by finding the latest time stamp after which every evolution of Si deviates from every trajectory in T . Thus, a pair (Sk , k) is a point of failure, or a diagnosis, if: (S1) Some evolution of Si matches a goal-establishing trajectory in T at stage k (0 ≤ k < i ≤ n) in state Sk and deviates at stage k + 1. (S2) No evolution of Si matches a goal-establishing trajectory in T at stage k > k. Example 6. If, in our running example, (i) at stage 1 block r is on the table, or (ii) on(p, r) holds at stage 4 while the remaining blocks are as depicted in S3 , then in both cases we cannot find a preferred trajectory with a corresponding state, i.e., we detect a discrepancy. For (i) still a feasible trajectory to the goal exists (stages 1 and 2 along the dotted area), not so for (ii). Thus, discrepancy (i) cannot be detected in, or after, stage 3. Observe also that (S3 , 3) is the only diagnosis for (ii) and no diagnosis exists for (i). KD IAGNOSE detects discrepancies and, if found, computes all diagnoses as follows (cf. Figure 3). Besides P , T , and Si it takes a domain description and the planning problem as inputs. In a preprocessing step, the current state and the planning problem are transformed into slightly modified planning problems for calculating
420
T. Eiter, M. Fink, and J. Senko
– the set match T of all goal-establishing preferred trajectories, and – the set match Plan of all evolutions leading to Si according to P . Clearly, if Si is on a goal-establishing preferred trajectory of match T (and thus also in match Plan), then there is no discrepancy. Otherwise, KD IAGNOSE computes all diagnoses by comparing the above sets and searching maximal states Sj at which possible evolutions and goal-establishing preferred trajectories coincide.
4 Implementation Our implementation of KM ONITOR builds on KD IAGNOSE, which uses the DLVK system to compute diagnoses for a given state. It invokes the diagnosis tool sequentially at all stages singled out by the checkpoint policy. The inputs to KM ONITOR are: – – – –
plan - a plan (in DLVK syntax) to monitor for discrepancies; checkpoints.dl - the checkpoint definition file; background.dl and K.plan - the domain description and planning problem; T.plan - a list of preferred trajectories, or alternatively a (modified) planning prob-
lem defining preferred trajectories (by its solutions); – state.*, cstate.* - state & checkpointing information about the plan execution. The checkpoint generation component is invoked as described in Section 2. Checkpoint computation is accomplished by computing models using the DLV system. For static policies, facts checkpoint(t) are extracted into a temporary file, and at the respective stages KD IAGNOSE is invoked for state analysis. A state t of a concrete partial execution (run) of the plan is fetched from file state.t. For simulation, a run may be automatically generated using DLVK (e.g., by randomly generating a trajectory for a modified planning problem). In the dynamic case, checkpointing state information is fetched from file cstate.t. If state information is missing, checkpointing is skipped. Example 7. The static checkpoint policy of Ex. 4 yields checkpoint(t) , t ∈ {1, 3, 4, 6}. For a plan execution as in Ex. 6 (ii), KM ONITOR reports a discrepancy for state S4 : > > > >
No error at stage 1. No error at stage 3. Error at stage 4 - Point of failure at stage 3. State info: {on(x,table), on(a, table), on (p,a), ...
The dynamic policy of Ex. 5 would yield a run with the same result, but the check point policy would be evaluated at each step, and a check would occur only at stage 4. Note that if at stage 1 block r would unintentionally end on block p, then we would have another check but would not detect any discrepancy. We also remark that by simple refinements of our dynamic policy we could avoid evaluation at each step.
5 Conclusion and Future Work KM ONITOR is an execution monitoring tool for non-deterministic domains utilizing action language K. It detects deviations from intended execution paths and computes explanations for discrepancies. By means of a checkpointing policy, discrepancy checking
KM ONITOR – A Tool for Monitoring Plan Execution in Action Theories
421
and diagnosis can be restricted to certain stages of the execution. A detailed comparison with [1] is left for a longer version of the paper. For a comparison and further references to related work on diagnosis in answer-set programming, the reader is referred to [4]. Currently KD IAGNOSE handles no concurrent actions, which however is easy to overcome. Generalizing [4], it shall also support diagnosis w.r.t. partial state information restricted to a focus of interest. Finally, we plan to extend KM ONITOR towards a system capable of giving recovery support as well. To this end, implementing and integrating techniques for recovery as described e.g. in [3] is envisioned.
References 1. Balduccini, M.: APLAgent Manager. krlab.cs.ttu.edu/˜marcy/APLAgentMgr/ index.html. 2. Balduccini, M., Gelfond, M.: Diagnostic reasoning with A-Prolog. Theory and Practice of Logic Programming, 3(4–5), 425–461. 2003. 3. Eiter, T., Erdem, E., Faber, W.: Plan Reversals for Recovery in Execution Monitoring. In Proc. NMR, 147–154. 2004. 4. Eiter, T., Erdem, E., Faber, W., Senko, J.: A logic-based approach to finding explanations for plan execution discrepancies. TR INFSYS RR-1843-04-03. 2004. 5. Eiter, T., Faber, W., Leone, N., Pfeifer, G., Polleres, A.: A logic programming approach to knowledge-state planning, II: The DLVK system. AI, 144(1–2), 157–211. 2002. 6. Fichtner, M., Großmann, A., Thielscher, M.: Intelligent execution monitoring in dynamic environments. Fundamenta Informaticae, 57(2–4), 371–392. 2003. 7. Giacomo, G. D., Reiter, R., Soutchanski, M.: Execution monitoring of high-level robot programs. Proc. of KR’1998, 453–465. 1998. 8. Soutchanski, M.: High-level robot programming and program execution. Proc. of ICAPS Workshop on Plan Execution. 2003.
The nomore++ System Christian Anger, Martin Gebser, Thomas Linke, Andr´e Neumann, and Torsten Schaub Institut f¨ur Informatik, Universit¨at Potsdam, Postfach 90 03 27, D–14439 Potsdam
Abstract. We present a new answer set solver nomore++. Distinguishing features include its treatment of heads and bodies equitably as computational objects and a new hybrid lookahead. nomore++ is close to being competitive with stateof-the-art answer set solvers, as demonstrated by selected experimental results.
1 Introduction A large part of the success of Answer Set Programming (ASP) is owed to the easy availability of efficient solvers. We present a new ASP solver, called nomore++ that pursues a hybrid approach in combining features from literal-based approaches, like smodels [1] and dlv [2], with the rule-based approach of its predecessor noMoRe [3]. To this end, it treats heads and bodies equitably as computational objects. We argue that this approach allows for more effective (in terms of search space pruning) choices than obtainable when dealing with either heads or bodies only. In particular, we demonstrate that the resulting hybrid lookahead operation allows for propagating more than previous approaches. Also, we detail a special strategy keeping assignments unfounded-free and empirically show that it outperforms smodels on relevant benchmarks. Another feature of nomore++ is its configurable operator-based design. The system is available at [4].
2 Theoretical Background The nomore++ system deals with normal logic programs under the answer set semantics [5]. A normal logic program is a finite set of rules of the form p0 ← p1 , . . . , pm , not pm+1 , . . . , not pn , where n ≥ m ≥ 0, and each pi (0 ≤ i ≤ n) is an atom. A literal is an atom p or its (default) negation not p. For such a rule r, let head (r) = p0 be the head of r and body(r) = {p1 , . . . , pm , not pm+1 , . . . , not pn } be the body of r. For a program Π, we write head (Π) = {head (r) | r ∈ Π} and body(Π) = {body(r) | r ∈ Π}. Without loss of generality, we assume that each atom of a program is the head of at least one rule in the program.1 Given a normal logic program Π, nomore++ computes the answer sets of Π. Unlike other solvers, such as smodels [1] and dlv [2],2 the nomore++ approach is based 1
2
Affiliated with the School of Computing Science at Simon Fraser University, Burnaby, Canada. Atoms not occurring as heads are necessarily false. nomore++ removes such atoms during preprocessing. Note that dlv is designed to handle disjunctive logic programs, which are on a higher complexity level than normal ones.
C. Baral et al. (Eds.): LPNMR 2005, LNAI 3662, pp. 422–426, 2005. c Springer-Verlag Berlin Heidelberg 2005
The nomore++ System
423
on an extended concept of assignments. That is, nomore++ maps heads and bodies of a program into {⊕, }, indicating whether a head or body is true or false, respectively. Given program Π, we define a (partial) assignment as a partial mapping A : head (Π) ∪ body(Π) → {⊕, }. For simplicity, we often represent such assignments as pairs (A⊕ , A ), where A⊕ = {x | A(x) = ⊕} and A = {x | A(x) = }. Treating heads and bodies equitably as computational objects provides great flexibility. Bodies can be viewed as conjunctions, and their explicit representation allows for reasoning about applicability of rules, in addition to atoms’ truth values. Structurally more complex objects have recently been deployed in SAT [6] and neighboring fields [7,8]. However, to the best of our knowledge this has not been done in ASP, so far. nomore++ is a highly flexible, runtime-configurable system. Flexibility roots on an operator-based design, featuring (among others) the following basic operators: i) Forward propagation operator P, ii) Backward propagation operator B, iii) Unfounded set [9] operator U, and iv) Choice operator C.3 Omitting details, P generalizes Fitting’s operator [11] to bodies, combined operators (PU) coincide with the well-founded operators [9], and (PB) and U correspond to smodels’ functions atleast and atmost [1]. Differences to atom- and rule-based approaches come up at nomore++’s more general choice operator C. For instance, C can assign ⊕ to a body, enabling propagation to decide all the body’s literals and heads. Such complex choices are not possible with assignments restricted to atoms. Following [12], we characterize the process of answer set formation by a sequence of assignments. Based on the above operators, one possible strategy is to determine deterministic consequences with propagation operators P, B, and U and to apply choice operator C whenever a fix-point of propagation is not total. We abbreviate this strategy by (PBU)∗ C, where (PBU)∗ denotes the closure under operators P, B, and U. The ⊕-assigned atoms in a total assignment, constructed by (PBU)∗ C, form an answer set.4 However, other strategies for answer set formation can also be shown to be sound and complete. For instance, we can safely skip either backward or forward propagation, yielding strategies (PU)∗ C and (BU)∗ C. Due to its configurable design, nomore++ can handle those different strategies as well. An important concept, distinguishing answer set programming from propositional logic, is well-foundedness. It is thus desirable that no ⊕-assigned atom becomes unfounded later on. In fact, no atom in the positive part A⊕ of an assignment can become unfounded, if each atom in A⊕ is the head of a rule whose body is non-circularly justified in A⊕ . We call such an assignment unfounded-free,5 and nomore++ supports the computation of unfounded-free assignments by providing choice operator D as an alternative to C. As opposed to C, D is restricted to bodies whose positive preconditions are already present in A⊕ and where only negative literals are undecided. On the one hand, D restricts possible choices. But on the other hand, assignments are kept unfoundedfree, which pays off on non-tight problems (cf. Section 4).
3 4
5
For a detailed operational characterization of nomore++, please refer to [10]. Note that we derive a contradiction when different values are to be assigned to some head or body. In this case, a total assignment cannot be constructed. A related notion for disjunctive programs is described in [13].
424
C. Anger et al.
In addition to propagation operators P, B, and U, lookahead strengthens propagation by conflict-driven assertions (nomore++ provides operator L for this [10]). Answer set solvers like smodels and dlv apply lookahead to atoms only. In contrast to them, nomore++ provides a hybrid lookahead considering both heads and bodies. In order to limit efforts to approximately the same amount as with lookahead on atoms, nomore++’s hybrid lookahead assigns ⊕ to bodies and to atoms only. As shown in [10], this restriction does not decrease strength of propagation. Rather we demonstrate in Section 4 that hybrid lookahead can save exponentially many choices in comparison to lookahead applied to either atoms or bodies only.
3 System The input language of nomore++ is generated by the grounder lparse [14] from normal logic programs obeying the format “Logic Programs V1.0” as defined in [15].6 A major feature of nomore++ is that operators can be selected at runtime, enabling the use of a multitude of strategies (combinations of operators). Via command line option -op, the propagation and choice operators to be used can be determined. As lookahead allows for different degrees of propagation within, one can also determine which set of operators to use during lookahead via command line option -laop. nomore++’s default strategy applies operators P, B, and U in usual propagation as well as in lookahead. Furthermore, D is the default choice operator. Note that operators P, U, and D keep a given assignment unfounded-free, which is not guaranteed for B and lookahead. At the implementation level, nomore++ uses the additional truth value ⊗ for distinguishing between the unfounded-free part of an assignment and the part that must eventually be true but is not non-circularly justified, yet. The virtue of this is that the scope of unfounded set operator U can be restricted to ⊗-assigned and unassigned heads and bodies. In fact, U is implemented in a “lazy fashion” ignoring the ⊕-part of an assignment. The dlv system uses a similar feature, the truth value “must be true” [16]. Internally, nomore++’s primary data structure consists of a body-head dependency graph [17]. This is a very efficient structure, as it only stores each head-atom and each distinct body of a program, instead of each rule as most other ASP-solvers do. E.g., measuring over 241 randomly chosen ground programs in [15], the ratio of the number of distinct bodies over the number of rules is 0.41.
4 Selected Experimental Results Due to space limitations, we confine our listed experiments to selected benchmarks illustrating the major features of nomore++. A complete evaluation, including further ASP solvers, like assat and cmodels, can be found at the ASP benchmarking site [15]. All tests were run on an AMD Athlon 1.4GHz PC with 512MB RAM. A memory limit of 256MB as well as a time limit of 900s were enforced. All results given in Figure 1 reflect the average of 10 runs. Benchmarks 1-a to 1-d are taken from [4] and demonstrate the advantage of the hybrid lookahead strategy. For comparisons, we have in nomore++ implemented bodybased lookahead (“Body LaH”) in addition to hybrid lookahead (“Hybrid LaH”). Values 6
nomore++ currently does not support smodels-style cardinality and weight constraints.
The nomore++ System
425
on the x-axis are a measurement for the size of the problem, please check [4] for details. Examples denoted with “Body-Plus” (Figures 1-a and 1-b) are better suited for a body-based lookahead. The nomore++ version with body-based lookahead outperforms smodels on these. Examples “Head-Minus” (Figures 1-c and 1-d) can be solved optimally with a head-based lookahead. Consequently, we have smodels outperforming nomore++ with body-based lookahead. Please note that nomore++ with hybrid lookahead always performs similar to the better suited approach. Benchmark 1-e demonstrates the advantage of nomore++’s strategy of keeping assignments unfounded-free. The figure reflects results obtained on classical Hamiltonian 1000 100 t 10 i m e 1 [s] 0.1
+
+
+ ×× + × ♦ +×× × + ♦ × + ♦ × + × ♦ × + ♦ ×× + ×+ ♦ × + ♦
0.01 0.001
♦
♦
0
2
4
6
8 10 12 14 16
1000 100 t 10 i m e 1 [s] 0.1
+
♦ × + ♦ × + ♦
0.01
0.001 × 0 2
100 t 10 i m e 1 [s] 0.1
8 10 12 14 16
0.001
♦ ♦
0
2
0.001
2
× ×× × × × +× × ♦ × ♦ ♦ ♦ ♦ ♦ × ♦ × ♦♦ × ♦ + × ♦ ♦ ♦ × + + + × + +× +
4
6
8 10 12 14 16 18
Fig. 1-e) Hamilton Cycles, 1st AS dlv ♦
smodels +
4
6
8 10 12 14 16
Fig. 1-d) Head-Minus, 1st AS
100
+
0.01
1000
+
t i m 1 e 0.1 [s]
♦ ×××× ×× × × × ♦ ×××× ♦ + ×× × + ++ + + + + + + ++ + + +
Fig. 1-c) Head-Minus, all AS
100
♦
t 10 i m e 1 [s] 0.1
10
8 10 12 14 16 ♦
0.01 6
6
100
× ♦+ × + ♦
0.01 + × ♦+ 0.001 0 2 4
4
Fig. 1-b) Body-Plus, 1st AS
1000
+
+
+
+
+ ♦ ♦ + ♦ ×× × × × × × ♦ ♦ ♦ ♦ ♦ ♦ ♦ ♦× × × + × ×× × + × +
Fig. 1-a) Body-Plus, all AS
1000
+
+
+
+
t i m 10 e 1 [s]
× × ×
0.1 × +
0.01 ♦ 4
× + ♦
nomore++(Body LaH)
5
+ ♦
6
+ ♦
7
+ ♦
8
×
+
×
+
♦
+ ♦
♦
♦
9 10 11 12
Fig. 1-f) EqTest, 1st AS nomore++(Hybrid LaH) ×
426
C. Anger et al.
cycle problems on complete graphs, where values on the x-axis reflect the number of nodes in the graph. Let us note that, due to the fairly early development state of nomore++, its base speed is still inferior to more mature ASP solvers, like smodels or dlv. To reflect on this, we have in Figure 1-f included results from the “Equality Testing” benchmark taken from [15]. Please observe that, while nomore++ performs worse than either smodels or dlv, it scales like the other two systems, indicating that only improvements with the implementation are needed. Acknowledgments. This work was supported by DFG under grant SCHA 550/6-4 as well as the EC through IST-2001-37004 WASP project.
References 1. Simons, P., Niemel¨a, I., Soininen, T.: Extending and implementing the stable model semantics. Artificial Intelligence 138 (2002) 181–234 2. Leone, N., Faber, W., Pfeifer, G., Eiter, T., Gottlob, G., Koch, C., Mateis, C., Perri, S., Scarcello, F.: The DLV system for knowledge representation and reasoning. ACM Transactions on Computational Logic (2005) To appear. 3. Anger, C., Konczak, K., Linke, T.: noMoRe: A system for non-monotonic reasoning under answer set semantics. In Eiter, T., Faber, W., Truszczy´nski, M., eds.: Proceedings of the Int’l Conference on Logic Programming and Nonmonotonic Reasoning, Springer (2001) 406–410 4. (http://www.cs.uni-potsdam.de/nomore) 5. Gelfond, M., Lifschitz, V.: The stable model semantics for logic programming. In: Proceedings of the International Conference on Logic Programming, MIT Press (1988) 1070–1080 6. J¨arvisalo, M., Junttila, T., Niemel¨a, I.: Unrestricted vs restricted cut in a tableau method for Boolean circuits. Annals of Mathematics and Artificial Intelligence (to appear) 7. Baaz, M., Egly, U., Leitsch, A.: Normal form transformations. [8] chapter 5 273–333 8. Robinson, J., Voronkov, A., eds.: Handbook of Automated Reasoning. MIT Press (2001) 9. van Gelder, A., Ross, K., Schlipf, J.: The well-founded semantics for general logic programs. Journal of the ACM 38 (1991) 620–650 10. Anger, C., Gebser, M., Linke, T., Neumann, A., Schaub, T.: The nomore++ approach to answer set solving. Submitted for publication (2005) 11. Fitting, M.: Fixpoint semantics for logic programming: A survey. Theoretical Computer Science 278 (2002) 25–51 12. Konczak, K., Linke, T., Schaub, T.: Graphs and colorings for answer set programming. Theory and Practice of Logic Programming (2005) To appear. 13. Leone, N., Rullo, P., Scarcello, F.: Disjunctive stable models: Unfounded sets, fixpoint semantics, and computation. Information and Computation 135 (1997) 69–112 14. (http://www.tcs.hut.fi/Software/smodels/) 15. (http://asparagus.cs.uni-potsdam.de) 16. Faber, W., Leone, N., Pfeifer, G.: Pushing goal derivation in dlp computations. In: Proceedings of the International Conference on Logic Programming and Nonmonotonic Reasoning (LPNMR’99). (1999) 177–191 17. Linke, T., Sarsakov, V.: Suitable graphs for answer set programming. In Baader, F., Voronkov, A., eds.: Proceedings of the International Conference on Logic for Programming, Artificial Intelligence, and Reasoning (LPAR’05). Springer (2005) 154–168
S MODELSA — A System for Computing Answer Sets of Logic Programs with Aggregates Islam Elkabani, Enrico Pontelli, and Tran Cao Son New Mexico State University, Las Cruces, NM 88003, USA {tson, epontell, ielkaban}@cs.nmsu.edu
1 Introduction In [2], we presented a system called ASP-CLP for computing answer sets of logic programs with aggregates. The implementation of ASP-CLP relies on the use of an external constraint solver (ECLiPSe) to deal with aggregate literals and requires some modifications to the answer set solver used in the experiment (S MODELS). In general, the system is capable of computing answer sets of arbitrary programs with aggregates, i.e., there is no syntactical restrictions imposed on the inputs to the system. This makes ASP-CLP different from DLVA (built BEN/5/23/04) [1], which deals with stratified programs only. ASP-CLP, however, is based on a semantics that does not guarantee minimality of answer sets. Furthermore, our experiments with ASP-CLP indicate that the cost of communication between the constraint solver and the answer set solver proves to be significant in large instances. In this work, we explore an alternative to ASP-CLP and develop a new system for computing answer sets of logic programs with aggregates. We begin with the definition of a new semantics for programs with aggregates that has the following characteristics: • It applies to arbitrary programs with aggregates, e.g., no syntactic restrictions on the use of aggregates, and it is as intuitive as the traditional answer set semantics. • It does not explicitly require the satisfaction of desirable properties of answer sets (such as being closed, supported, or minimal), but the answer sets resulting from the new definition naturally satisfy such properties. • It can handle aggregates as head of rules (not supported yet in our implementation). • It can be implemented by integrating the definition directly in state-of-the-art answer set solvers. In particular, it requires only the addition of a module to determine the “solutions” of an aggregate, without any modifications to the mechanisms to computer answer sets. The syntax of the language is similar to ASP-CLP—where a new type of literals (aggregate literals) is used; an aggregate literal has the form F ({X | p(X1 , . . . , Xn )}) op V al where F is an aggregate function (e.g., SUM), and op is a relational operator (e.g., =, ≤). A similar literal with multisets is also available. The semantics and comparison with other approaches can be found in [3]. Its main features are: • it defines the concept of solution of an aggregate as a pair X, Y such that every model M of the program satisfying X ⊆ M and Y ∩ M = ∅ also satisfies ; • it defines the unfolding of a program based on the notion of solution. C. Baral et al. (Eds.): LPNMR 2005, LNAI 3662, pp. 427–431, 2005. c Springer-Verlag Berlin Heidelberg 2005
428
I. Elkabani, E. Pontelli, and T.C. Son
The unfolding of a program with aggregates is a normal logic program whose answer sets can be computed using off-the-shelf systems. A set of atoms M is an answer set of a program with aggregates P iff it is an answer set of unfolding(P ). We illustrate the semantics through the following examples. Example 1. Let P1 be the program p(1). p(2). p(3) ← q. q ← sum({X | p(X)}) > 5. The only aggregate solution of sum({X | p(X)}) > 5 is {p(1), p(2), p(3)}, ∅ and unfolding(P1) contains: p(1). p(2). p(3) ← q. q ← p(1), p(2), p(3). which has M1 = {p(1), p(2)} as its only answer set. M1 is the only answer set of P1 . Example 2. Consider the program P2 : p(2). p(1) ← min({X | p(X)}) ≥ 2. The aggregate literal min({X | p(X)}) ≥ 2 has a unique solution {p(2)}, {p(1)}. unfolding(P2 ) = {p(2). p(1) ← p(2), not p(1).} unfolding(P2) does not have answer sets, i.e., P2 does not have answer sets. We will now describe S MODELSA that implements the new semantics. Source code of the system can be found at www.cs.nmsu.edu/∼ielkaban/asp-aggr.html.
2 The S MODELSA System Our main goal in developing S MODELSA is to test the feasibility of a new approach to computing the answer sets of programs with aggregates by (i) computing the solutions of aggregate literals; (ii) computing the unfolding; and (iii) using standard answer set solvers to compute the answer sets. For this reason, we add to LPARSE and S MODELS two new modules. One for the preprocessing and another for the computation of the unfolding program. The overall structure of our system is shown in Fig. 1. The current implementation is built using S MODELS v.2.28 and LPARSE v.1.0.13. ASP A Program
ground program with aggregates
Preprocessor
Lparse pipe
unfolded ground normal logic program
Transformer pipe
simplified ground normal logic program
Lparse pipe
Answer Sets
Smodels pipe
Fig. 1. Overall System Structure
Similar to the S MODELS system, the computation of answer sets of a program with aggregates is piped through several stages. In the 2nd and 4th stage, LPARSE is used. In the last stage, S MODELS is used. Let us detail the modules used in the other stages. 2.1 The Preprocessor The Preprocessor is used to perform a number of simple syntactic transformations of the input program. These transformations are mostly aimed at rewriting the aggregate
S MODELSA — A System for Computing Answer Sets of Logic Programs
429
literals in a format acceptable by LPARSE. An aggregate literal of the form f ({X | p(X, Y )}) op R is transformed into an atom, t-aggregate atom, of the form ‘‘$agg’’(f, ‘‘$x’’, p(‘‘$x’’, Y), R, op) and a choice rule {‘‘$agg’’(f, ‘‘$x’’, p(‘‘$x’’, Y), R, op)} ← type(Y) where type(Y) is the domain predicate specifying the possible values of Y . For example, the rule q ← sum({X | p(X)}) > 3. is transformed to: q ← ‘‘$agg’’(sum,‘‘$x’’,p(‘‘$x’’),3,greater). {‘‘$agg’’(sum,‘‘$x’’,p(‘‘$x’’),3,greater)}.
The resulting program is processed by LPARSE and by the Transformer Module. 2.2 The Transformer Module The Transformer Module is the major component of S MODELSA . It is responsible for the computing of the unfolding of the input programs and has four components: Reader, Dependencies Analyzer, Aggregate Solver, and Rules Expander. The overall organization of the Transformer Module is shown in Fig. 2. The Transformer is completely written in Prolog. Reader. The Reader gets the output of the first LPARSE processing and constructs three tables: the Atoms Table, the Rules Table, and the Aggregates Table. These tables store the ground atoms, the ground rules, and the ground t-aggregate atoms (called aggregate atoms hereafter). For each aggregate atom, the Reader also stores other information, such as its aggregate function (e.g., S UM , C OUNT, etc.), its rela tional operator (e.g., >, <, etc.), Fig. 2. Transformer Module the compared value, the grouped variable, and the dependent atoms skeleton (e.g., p(X) where X is the grouped variable). For example, the values for these attributes are S UM, >, 3, “$x”, p(“$x”), respectively, for the aggregate atom “$agg”(sum, “$x”,p(“$x”),3,greater). Dependencies Analyzer (DA). The DA is responsible for the identification of the dependencies between aggregate atoms and atoms contributing to such aggregates. For each aggregate literal, the DA searches the Atoms Table for its atom dependencies, constructs a set (implemented as a list) of pointers to these atoms, and stores it as a part of the aggregate information in the Aggregates Table. These dependencies represent the domain from which the solutions of an aggregate constraint are built. For example, the set of
430
I. Elkabani, E. Pontelli, and T.C. Son
dependencies of the atom “$agg”(sum, “$x”,p(“$x”),3,greater) consists of all the atoms of the form p(X) and is {p(1), p(2), p(3)} in the previous example. Aggregate Solver (AS). The main task of the AS is to compute a minimal solution set for each aggregate atom in the program. It contains several constraint solving procedures, one for each aggregate function. Presently, it supports S UM , AVG , M IN , M AX , and C OUNT and the basics relational operators >, <, ≥, ≤, =, =. For every aggregate atom in the Aggregates Table, AS identifies its aggregate function and sends it, together with its set of dependencies, to the appropriate constraint solving procedure which produces either (i) a minimal set of solutions needed for the unfolding of the atom, if the aggregate literal has some solutions; or (ii) false otherwise. This information is then stored in the Aggregates Table. If we consider the previous example, AS will return the set {{p(1), p(2), p(3)}, ∅} for the aggregate atom “$agg”(sum, “$x”,p(“$x”),3,greater) with the set of dependencies {p(1), p(2), p(3)}. If the constant 3 in the aggregate literal is changed to 7, the AS will returns false. Rules Expander (RE). The RE module completes the job of the Transformer Module, by computing the unfolding of the program. For each rule r in the Rules Table, it generates unfolding(r), the set of rules obtained from r by simultaneously replacing each aggregate literal in r by the unfolding of one of its solutions (stored in the Aggregate Table). The RE also simplifies the code to remove the temporary choice rules introduced by the Reader. RE also performs some optimizations, such as removing rules whose body contains an unsatisfiable aggregate literal. For the program P1 , the result of this step is the following program: p(1). p(2). p(3) ← q. q ← p(1),p(2),p(3). Table 1. Benchmarks with Aggregates (times in sec.) Program Sample Size S MODELSA Time Transformer Time DLVA Time Company Control 20 0.010 0.080 N/A Company Control 40 0.020 0.340 N/A Company Control 80 0.030 2.850 N/A Company Control 120 0.040 12.100 N/A Shortest Path 20 0.220 0.740 N/A Shortest Path 30 0.790 2.640 N/A Shortest Path 50 3.510 13.400 N/A Shortest Path (All Pairs) 20 6.020 35.400 N/A Party Invitations 40 0.010 0.010 N/A Party Invitations 80 0.020 0.030 N/A Party Invitations 160 0.050 0.050 N/A Seating 16/4/4 11.40 0.330 4.337 Employee Raise 15/5 0.57 0.140 2.750 Employee Raise 21/15 2.88 1.770 6.235 Employee Raise 24/20 3.13 2.420 26.50 NM1 125 0.11 0.10 N/A NM1 150 0.16 0.13 N/A NM2 125 1.44 0.80 N/A NM2 150 2.08 1.28 N/A
S MODELSA — A System for Computing Answer Sets of Logic Programs
431
3 Experiments and Benchmarks We have experimented S MODELSA with various benchmarks (some from the literature and some newly created) and compared it with DLVA whenever possible (Table 1). The experiments have been performed on a Linux P4 (3.06GHz, 512MB). The column S MODELSA reports the time for computing answer sets of the unfolded program, while Transformer Time reports the unfolding time. The performance results are acceptable in most cases; on stratified programs, our system is occasionally faster than DLV, and occasionally slower, depending on the type of aggregate (some have many solutions, that we precompute, and that are not required during answer set computation).
4 Discussion We presented a new system for computing answer sets of logic programs with aggregates. The new system differs from our previous system in two ways: (i) it implements a different, intuitive, semantics, which leads only to minimal models; and (ii) it does not modify LPARSE and S MODELS. The result of our initial experimentation shows that this direction is promising. The system has not been optimized for performance and this will be our focus in the near future. In particular, we plan to 1. Improve the preprocessor, e.g., by using more sophisticated data structures (e.g., to speedup search of atoms during the DA phase) and to eliminate redundant aggregate atoms in the Aggregate Table. 2. Improve the aggregate solver to allow more than one grouping variable and additional aggregate functions (presently, it handles only one grouping variable and allows only basic aggregate functions); 3. Improve the rule expander to reduce the size of the unfolding program. A more important work, that is in progress, is to extend our system to support a second characterization of our aggregate semantics, equivalent to the one mentioned here, which relies on unfolding w.r.t. a specific answer set; this is expected to reduce the size of the unfolding for many aggregates and simplifies the handling of aggregates in the head of the rules. Furthermore, from our experiments, it is obvious that there are aggregates that are better handled with the approach described in this paper (as they lead to a small unfolding), and others that would benefit from additional knowledge about the answer set we are building (i.e., delay the unfolding until the actual answer set computation). We plan to develop classification methods that will select the appropriate unfolding approach.
References 1. T. Dell’Armi, W. Faber, G. Ielpa, N. Leone, G. Pfeifer. Aggregate Functions in Disjunctive Logic Programming: Semantics,Complexity,and Implementation in DLV. IJCAI, 2003. 2. I. Elkabani, E. Pontelli, and T.C. Son. Smodels with clp and its applications: A simple and effective approach to aggregates in asp. Int. Conference Logic Programming, pp. 73–89, 2004. 3. T.C. Son, E. Pontelli, and I. Elkabani. A Translational Semantics for Aggregates in Logic Programming. Technical Report NMSU-CS-2005-005, New Mexico State University, 2005.
A DLP System with Object-Oriented Features Francesco Ricca, Nicola Leone, Valerio De Bonis, Tina Dell’Armi, Stefania Galizia, and Giovanni Grasso Department of Mathematics, University of Calabria, Rende (CS) 87036, Italy
Abstract. The paper presents DLV+ a Disjunctive Logic Programming system with object-oriented constructs, including classes, objects, (multiple) inheritance, and types. DLV+ is built on top of DLV (a state-of-the art DLP system), and provides a graphical user interface that allows to specify, update, browse, query, and reason on knowledge bases. Two strong points of the system are the powerful type-checking mechanism, and the advanced interface for visual querying.
1
Introduction
Disjunctive Logic Programming (DLP) is an advanced formalism for Knowledge Representation and commonsense Reasoning (KR&R)[1]. DLP is very expressive in a precise mathematical sense: it is able to express all problems belonging to the complexity class Σ2P . Moreover, the availability of a couple of efficient DLP systems, like DLV [2], GnT [3] and, more recently, the disjunctive version of Cmodels [4] make DLP a powerful tool for developing advanced knowledge-based applications [5,6]. The recent application of DLV in the emerging areas of Knowledge Management (KM) and Information Integration [8], has confirmed, from the one hand, the viability of the DLP exploitation. On the other hand, it has evidenced some limitations of DLP language and systems. As far as the language is concerned, the need to represent complex real-world entities, like classes, objects, compound objects, and taxonomies, has emerged [7]. Moreover, the DLP systems are missing the tools for supporting the programmers, like type-checkers and easy-to-use graphical environments, to manage the large and complex domains to be dealt with in real-world applications. This paper describes the DLV+ system, a first step to overcome the above limitations. It is a cross-platform development environment for knowledge modeling and advanced knowledge-based reasoning. The DLV+ system allows to easily develop complex applications and allows to perform advanced reasoning tasks in a user friendly visual environment. The DLV+ system seamlessly integrates the DLV system exploiting the power of a stable and efficient ASP solver. A strong point of the system is its powerful language, extending DLP by object-oriented features. In particular, the language includes, besides the concept of relations, the object-oriented notions of classes, objects (class instances), object-identity, complex-objects, (multiple) inheritance, and the concept of modular programming by means of reasoning modules. C. Baral et al. (Eds.): LPNMR 2005, LNAI 3662, pp. 432–436, 2005. c Springer-Verlag Berlin Heidelberg 2005
A DLP System with Object-Oriented Features
433
A class can be thought of as a collection of individuals that belong together because they share some properties. An individual, or object, is any identifiable entity in the universe of discourse. Objects, also called class instances, are unambiguously identified by their object-identifier (oid) and belong to a class. A class is defined by a name (which is unique) and an ordered list of attributes, identifying the properties of its instances. Each attribute is identified by a name and can be of class type. This allows the specification of complex objects (objects made of other objects). Classes can be organized in a specialization hierarchy (or data-type taxonomy) using the built-in is-a relation (multiple inheritance). Relationships among objects are represented by means of relations, which, like classes, are defined by a (unique) name and an ordered list of attributes (with name and type). Importantly, DLP+ supports two kind of relations, base relations, corresponding to basic facts (that can be stored in a database), and derived relations corresponding to facts that can be inferred by logic programs. As in DLP, logic programs are a set of logic rules and constraints. However, DLP+ extends the definition of logic atom introducing class and relation predicates and complex terms, allowing a direct access to object properties. This way, DLP+ rules merge, in a simple and natural way, the declarative style of logic programming with the navigational style of the object-oriented systems. In addition, DLP+ logic programs are organized in reasoning modules, taking advantage of the benefits of modular programming. Importantly, the strongly-typed nature of DLP+ allowed the implementation of a number of type-checking routines that verify the correctness of a specification on the fly, resulting in a great help for the programmer. Moreover, DLV+ offers several important facilities driving the development of both the knowledge base and the reasoning modules. Using DLV+ , developers and domain experts can create, edit, navigate and query object-oriented knowledge bases by an easy-to-use visual environment, enriched by a full graphic query interface ` a la QBE.
2
Language Overview
Classes can be declared in DLV+ by using the keyword class followed by the class name and by a comma separated list of attributes. Each attribute is a couple (attribute-name : attribute-type). The attribute-type is either a userdefined class name, or a built-in class name (in order to deal with concrete data types, DLP+ features two built-in classes string and integer). For instance, the class faculty with an argument of type string can be declared as follows: class faculty(name:string).
Objects, that is class instances, are declared by asserting new facts. An instance for the class faculty, can be declared as follows: #1:faculty(name:"Faculty of Science").
The string “Faculty of science” values the attribute name; while #1 is the object-identifier (oid) of this instance (each instance is equipped by a unique oid). The possibility to specify user-defined classes as attribute types allows for
434
F. Ricca et al.
complex objects, i.e. objects made of other objects. The following declaration of class person includes, besides name and age, an attribute of type person, namely, partner. class person(name:string,age:integer,partner:person).
Note that this declaration is “recursive” (partner is of type person). A couple of partners can be specified as follows: #2:person(name:"Max", age:30,partner:#3). #3:person(name:"Mary", age:28, partner:#2).
Note that “Max” (identified by #2) is “Mary’s” partner and vice versa (“Mary” is identified by #3). In general, the object identifier can be assigned explicitly by the programmer (any DLP constant can be used as oid); if omitted, the oid is automatically provided by the system. Moreover, arguments are identified by name, allowing for an easier way to access attributes. Classes can be organized in a taxonomy. For example, the following student class extends the person class by two new attributes, code and enrol. class student isa {person} (code:string,enrol:faculty).
Instances of the class student are declared as usual, by asserting new facts. #6:student(name:"John",age:20,father:#2,partner:#7,code:0, enrol:#1). #7:student(name:"Alice",age:20,father:#2,partner:#6,code:1, enrol:#1).
Like in common object-oriented languages , each instance of a sub-class becomes, automatically, an instance of all super classes (isa relation induces an inclusion relation between classes). In the example, “John” and “Alice” are instances of both person and student. Moreover, sub-classes inherit attributes from all super-classes. In the example, the student class has all attributes of the person class (inherited) plus the (local) attributes code and enrol. The language provides a built-in most general class named object that is the class of all individuals and is a superclass of all DLP+ classes. Also multiple inheritance is supported. For example, class stud emp, declared next, inherits from both class student and class employee. class employee isa{person}(salary:integer,skill:string,company:string). class stud_emp isa{student,employee}(workload:integer).
Attribute inheritance in DLP+ follows the strategy adopted in the COMPLEX language, for a formal description refer to [9]. Relations represent relationships among objects. Base relations are declared like classes, and tuples are specified (as usual) asserting a set of facts (but tuples are not equipped with an oid). For instance, the base relation colleague, and a tuple asserting that “Max” and ”Mary” are colleague, follows: relation colleague(p1:person,p2:person). colleague(p1:#2,p2:#3).
Classes and base relations are, from a data-base point of view, the extensional part of the DLP+ language. Conversely, derived relation are the intensional (deductive) part of the language and are specified by using reasoning modules, which like DLP programs, are composed of logic rules and integrity constraints. DLP+ reasoning modules allow one to exploit the full power of DLP. As an example, consider the following module, encoding the team-building problem (compute a team satisfying some project restrictions).
A DLP System with Object-Oriented Features
435
class project(numEmp:integer, numSk:integer, budget:integer, maxSal:integer). module(teamBuilding){ inTeam(E,P) v outTeam(E,P) :- E:employee(), P:project(). :- P:project(numEmp:N),not #count{E: inTeam(E,P)}=N. :- P:project(numSk:S),not #count{Sk: inTeam(employee(skill:Sk),P)}>=S. :- P:project(budget:B),not #sum{Sa,E: E:employee(salary:Sa), inTeam(E,P)}<=B. :- P:project(maxSal:M),not #max{Sa: inTeam(employee(salary:Sa),P)}<=M. }
Predicate arguments can be valued both by specifying simple terms like variables or object identifiers, and by using a nested class predicate (complex term) which works like a function (e.g., above, in the second and fourth constraint, the first argument of inTeam relation is an employee specified by a complex term). Note that, the complex predicate terms allow to combine in a simple and natural way, the declarative style of logic programming with the navigational one of the object-oriented systems. Finally, in order to check the consistency of a knowledge base the user can specify global integrity constraints called axioms. Axioms can be defined as common logic rules by using the ”::-” operator instead of ”:-”. Importantly, axioms are different by logic rules because model sentences that must be always true and do not derive new knowledge. For example the following axiom asserts that colleguaes must work at the same company. X2:employee(company:C) ::- colleague(X1,X2), X1:employee(company:C).
3
System Architecture
The system architecture, depicted in Figure 1 (a), is a collection of seven modules: Parser, Data Handler, Type Checker, Intelligent Rewriter, Output Handler, Message Handler, and GUI. The Parser has the job to analyze and load the content of a DLP+ text file in the data structures supplied by the Data Handler. The Data Handler
Fig. 1. The DLV+ architecture (a) and GUI (b)
436
F. Ricca et al.
provides all the methods needed to access and manipulate the knowledge base components. In particular, data indexing and full-text search are based on the open-source library Lucene. The Type Checker module implements a number of type checking routines, in order to ensure the consistency of a knowledge base. The Intelligent Rewriter module translates DLP+ knowledge base, reasoning modules and queries in an equivalent disjunctive logic program which runs on the DLV system. The Intelligent Rewriter features a number of optimization and caching techniques in order to reduce the time wasted interacting with the computational engine. Reasoning results and possible error messages are handled respectively by the Output Handler and by the Message Handler modules. The user exploits the system through an easy-to-use visual environment called GUI (Graphical User Interface). The GUI combines a number of specialized visual tools for authoring, browsing and querying a DLP+ knowledge base. In particular, the GUI features a graph-based knowledge base viewer based on the JGraph library. The GUI, shown in Figure 1 (b), is written in Java, while, the computational engine, (the DLV system) is a highly portable software, available for various platforms. Thus, the DLV+ system runs under a variety of operating systems. An important feature of the system is the querying interface which provides both textual editing mode and visual editing mode a` la QBE. The user can create queries without wondering about the syntax, simply selecting classes and relations and creating links between class attributes and relation parameters. Query results are presented to the user in a friendly way, while details about the interaction with DLV are hidden by the system.
References 1. Gelfond, M., Lifschitz, V.: Classical Negation in Logic Programs and Disjunctive Databases. New Generation Computing 9 (1991) 365–385. 2. Leone, N., Pfeifer, G., Faber, W., Eiter, T., Gottlob, G., Perri, S., Scarcello, F.: The DLV System for Knowledge Representation and Reasoning. ACM Transactions on Computational Logic (2005). 3. Janhunen, T., Niemel¨ a, I.: GNT - A Solver for Disjunctive Logic Programs. In: Proc. of LPNMR 2004. LNCS, Fort Lauderdale, FL, USA, Springer (2004) 331–335 4. Lierler, Y.: Cmodels for Tight Disjunctive Logic Programs. In: Proc. of W(C)LP, Ulmer Informatik-Berichte, Ulm, Germany, Universit¨ at Ulm (2005) 163–166 5. Baral, C.: Knowledge Representation, Reasoning and Declarative Problem Solving. Cambridge University Press (2002) 6. Lobo, J., Minker, J., Rajasekar, A.: Foundations of Disjunctive Logic Programming. The MIT Press, Cambridge, Massachusetts (1992) 7. Massacci, F.: Computer Aided Security Requirements Engineering with ASP Nonmonotonic Reasoning, ASP and Constraints, Seminar N 05171, Dagstuhl, 2005. 8. Leone, N., T., Eiter, R., Rosati, etal: The INFOMIX System for Advanced Integration of Incomplete and Inconsistent Data. In: ACM SIGMOD 2005. 9. Greco, S., Leone, N., Rullo, P.: COMPLEX: An Object-Oriented Logic Programming System. IEEE Transactions on Knowledge and Data Engineering 4 (1992)
Testing Strong Equivalence of Datalog Programs Implementation and Examples Thomas Eiter1 , Wolfgang Faber2, , and Patrick Traxler1 1
Institute of Information Systems, Vienna University of Technology, 1040 Vienna, Austria [email protected], [email protected] 2 Department of Mathematics, University of Calabria, 87030 Rende (CS), Italy [email protected] Abstract. In this work we describe a system for determining strong equivalence of disjunctive non-ground datalog programs under the stable model semantics. The problem is tackled by reducing it to the unsatisfiability problem of firstorder formulas in the Bernays-Sch¨onfinkel fragment. We then employ a tableauxbased theorem prover, which (unlike most other currently available provers) is guaranteed to terminate for these formulas. To the best of our knowledge, this is the first strong equivalence tester for disjunctive non-ground datalog.
1 Introduction Answer Set Programming (ASP) [1] is by now an acknowledged tool for knowledge representation and reasoning. The availability of efficient solvers has furthermore stimulated its use in practical applications in recent years. This development had quite some implications on ASP research. For example, increasingly large applications require features for modular programming. Another requirement is the fact that in applications, ASP code is often generated automatically by so-called frontends, calling for optimization methods which remove redundancies, as also found in database query optimizers. For these purposes, the more recently suggested notion of strong equivalence for programs [2,3] can be used. Indeed, if two ASP programs are strongly equivalent, they can be used interchangeably in any context. This gives a handle on showing the equivalence of ASP modules. If a program is strongly equivalent to a subprogram of itself, then one can always use the subprogram instead of the original program, a technique which serves as an effective optimization method. So far, work on strong equivalence has mostly focused on propositional, or variablefree programs. The complexity of deciding whether two variable-free datalog programs are strong equivalent is in co-NP [4], however, when admitting variables, we obtain completeness for co-NEXPTIME [5]. Several systems have been proposed for testing strong equivalence of variable-free programs, some of which encode the problem again in ASP (e.g. [6]) or in propositional satisfiability [7,4]. In this work, we build on [4] and use a variant of the reduction described there, which in the non-ground case produces first-order formulas in the Bernays-Sch¨onfinkel class which are unsatisfiable iff the original logic programs are strongly equivalent.
This work was supported by FWF under project P18019-N04 and the European Commission under projects IST-2001-37004 WASP and IST-2001-33570 INFOMIX. Funded by an APART grant of the Austrian Academy of Sciences. C. Baral et al. (Eds.): LPNMR 2005, LNAI 3662, pp. 437–441, 2005. c Springer-Verlag Berlin Heidelberg 2005
438
T. Eiter, W. Faber, and P. Traxler
2 Preliminaries Disjunctive Datalog Programs. A (disjunctive) rule r is a formula a1 (¯ x1 )∨· · · ∨an (¯ xn ) :- b1 (¯ y1 ), · · · , bk (¯ yk ), not bk+1 (¯ yk+1 ), · · · , not bm (¯ ym ). (1) n ≥ 0, m ≥ k ≥ 0, where all ai (¯ xi ) and bj (¯ yj ) are function-free atoms; if n = 0, r is also called a constraint. A disjunctive datalog program P is a finite set of rules and constraints. Two programs Π1 and Π2 are strongly equivalent [2] iff every program extensions Π1 ∪ R and Π2 ∪ R have the same answer sets [1]. Bernays-Sch¨onfinkel Fragment of First-Order Logic. Any first-order sentence ψ of form ∃x1 ...xk ∀y1 ...yl ϕ(x1 , ..., xk , y1 , ..., yl )
(2)
where ϕ is quantifier-free and without function and constant symbols, is a BernaysSch¨onfinkel formula. Deciding satisfiability of such formulas is NEXPTIME-complete.
3 Reduction In this section, we describe a reduction from the complementary problem of strong equivalence to satisfiability of Bernays-Sch¨onfinkel formulas (whose quantifier-free part is in CNF), which is similar to the reduction defined in [4]. Given two logic programs Π and Π , let for each predicate p occurring in Π ∪ Π , be p a fresh predicate of the same arity. Then Σ(¯ x) := p∈P red(Π∪Π ) (p (¯ x) ∨ ¬p(¯ x)) For any rule r of the form (1), we define γr as the formula (¯ z=x ¯1 · · · x¯n y¯1 · · · y¯m ): ⎛ ⎞ (a1 (¯ x1 )∨· · ·∨an (¯ xn ) ∨ bk+1 (¯ yk+1 )∨·· ·∨bm (¯ ym ) ∨ ¬b1 (¯ y1 )∨· · ·∨¬bk (¯ yk )) ⎠ ∀¯ z⎝ (a1 (¯ x1 )∨· · ·∨an (¯ xn ) ∨ bk+1 (¯ yk+1 )∨· · ·∨bm (¯ ym ) ∨ ¬b1 (¯ y1 )∨· · ·∨¬bk (¯ yk )) For a program Π, we then define ΓΠ := r∈Π γr , which we can easily rewrite to ∀¯ xWΠ (¯ x) where WΠ (¯ x) is a quantifier-free CNF. We next define a formula encoding the unique name assumption for the constants c¯ = c1 , ..., cn occurring in Π and Π : n U := i=1 (Ui (ci ) ∧ j∈{1,...,n}\{i} ¬Ui (cj )). For a formula ϕ, let ϕxy be the formula with y replaced by x, and for a set S of formulas, let Syx = {ϕxy | ϕ ∈ S}. As shown in [4], Π and Π are not strongly equivalent iff at least one of the following two Bernays-Sch¨onfinkel sentences is finitely satisfiable: – ∃¯ u∃¯ y∀¯ z ∀¯ x(Uc¯u¯ (¯ u) ∧ Σ(¯ z ) ∧ WΠ uc¯¯ (¯ x, u¯) ∧ ¬WΠ uc¯¯ (¯ y, u ¯)), resp. – ∃¯ u∃¯ y∀¯ z ∀¯ x(Uc¯u¯ (¯ u) ∧ Σ(¯ z ) ∧ WΠ uc¯¯ (¯ x, u ¯) ∧ ¬WΠ uc¯¯ (¯ y, u ¯)). (By the finite model property of Bernays-Sch¨onfinkel, this is tantamount to unrestricted satisfiability.) Note that U , Σ, WΠ , and WΠ are CNFs, while ¬WΠ and
Testing Strong Equivalence of Datalog Programs - Implementation and Examples
439
¬WΠ are not (moving negation inside, they are in DNF). Instead of the simple conversion to CNF, which is exponential in the worst case, we may for our purpose re∗ ∗ place them with CNFs WΠ and WΠ , respectively, which are equivalent with respect to satisfiability. Tothis end, we use the following transformation of a quantifiern free DNF D(¯ x) = i=1 τi (¯ xi ) with free variables x ¯ = x¯1 · · · x ¯n , where τi (¯ xi ) = li,1 (¯ xi,1 ) ∧ · · · ∧ li,mi (¯ xi,mi ) into a CNF D∗ (¯ x) which is satisfiability-equivalent if the x ¯i and x¯j are pairwise disjoint: D∗ (¯ x) = (s(d1 ) ∨ · · · ∨ s(dn )) ∧ (li,j (¯ xi,j )∨¬s(dj )) 1≤i≤n 1≤j≤mi
where s is a new unary predicate symbol and d1 ,. . . , dn are fresh constant symbols. Lemma 1. ∀¯ xD(¯ x) is satisfiable iff ∀¯ xD∗ (¯ x) is satisfiable, if all x ¯i and x ¯j are disjoint. We note that the size of (¬WΠ )∗ is linear in the size of Π, since it is linear in the size of WΠ , which in turn is linear in the size of Π. Let nr and nc be the number of predicate and constant symbols, respectively, in Π and Π . Then, the size of Σ is linear in nr and the size of U is quadratic in nc . Let ∆(Π, Π ) denote the clausal form of ∃¯ u∃¯ y ∀¯ z ∀¯ x(Uc¯u¯ (¯ u)∧Σ(¯ z )∧WΠ uc¯¯ (¯ x, u¯)∧ u ¯ ∗ (¬WΠ (¯ y ) c¯ (¯ y, u ¯)) ) after Skolemization, i.e., the set of clauses in (U ∧Σ(¯ z )∧WΠ (¯ x) ∧ (¬WΠ (f y¯, f u ¯))∗ ). It can be easily generated, and its size is bounded as follows. Proposition 1. |∆(Π, Π )| ≤ k · (|Π| + |Π | + nr + n2c ) for some constant k.
4 Implementation The input language is similar to the one of DLV, but add-ons like built-ins, aggregates, weak constraints etc. are not supported. Also comments and anonymous variables are currently unsupported, as well as strong negation.3 The implementation is in C++ employing a flex/bison-generated parser. Our basic data structures include a symbol table and a collection of rules. The generation of the clausal forms ∆(Π, Π ) and ∆(Π , Π) is carried out via suitable functions working on these basic structures. We use the DARWIN theorem prover 4 as a back-end to solve the formulas. A distinguishing feature of DARWIN is that it is refutation-complete on our types of formulas, and thus strong equivalence of programs Π and Π , tantamount to refutations of ∆(Π, Π ) and ∆(Π , Π), is definitely answered in all cases. Indeed, we are not aware of other provers which would guarantee this property. The tool (including some examples) is available at http://www.kr.tuwien. ac.at/students/prak setest/.
5 Examples Example 1. Consider the program Π: a(k1). a(k2). h(X):- a(X). t(X):- h(X). a(X):- t(X). 3
4
a(X):- h(X).
In fact, strong negation ¬a(¯ x) is realized in DLV and other systems viewing ¬a as a new predicate and adding a constraint :-a(¯ x), ¬a(¯ x); this can be respected and handled accordingly. http://goedel.cs.uiowa.edu/Darwin/
440
T. Eiter, W. Faber, and P. Traxler
Π states that a ⊆ h ⊆ t ⊆ a, i.e. a = h = t. By dropping the last rule, we obtain Π : a(k1). a(k2). h(X):- a(X). t(X):- h(X). a(X):- t(X).
The components of the formula ∆(Π, Π ) are, in Darwin syntax, as follows. Σ: a (X1):-a(X1). t (X1):-t(X1). h (X1):-h(X1). WΠ : a(k1). a(k2). h(X):- a(X). a(X):- t(X). ∗ WΠ :
a (k1). a (k2). h (X):- a (X). t(X):- h(X). a (X):- t (X). a(X):- h(X).
-a(k1):- s (1). -a (k1):- s (6). -h(sk 1):- s (3). -h (sk 4):- s (8). -t(sk 2):- s (4). -t (sk 5):- s (9). -a(sk 3):- s (5). -a (sk 6):- s (0). s (1), s (2), s (3), s (4), s (5), s
t (X):- h (X). a (X):- h (X).
-a(k2):- s (2). -a (k2):- s (7). a(sk 1):- s (3). a (sk 4):- s (8). h(sk 2):- s (4). h (sk 5):- s (9). t(sk 3):- s (5). t (sk 6):- s (0). (6), s (7), s (8), s (9), s (0).
U : u1(k1). -u1(k2). -u2(k1). u2(k2). A refutation is found by Darwin for ∆(Π, Π ), and also for ∆(Π , Π). Hence, Π and Π are strongly equivalent. Example 2. Consider the two programs Π: t(X,Y):-a(X,Y). t(X,Z):-t(X,Y),t(Y,Z).
Π : t(X,Y):-a(X,Y). t(X,Z):-a(X,Y),t(Y,Z).
which both compute the transitive closure of a. They are, however, not strongly equivalent, since Π ∪ {t(1, 2)., t(2, 3).} and Π ∪ {t(1, 2)., t(2, 3).} have different answer sets. ∆(Π, Π ) is unsatisfiable and ∆(Π , Π) is satisfiable, reflecting this fact.
6 Benchmarks When experimenting with our tool, we have found that it often terminates quickly (less than one second), for instance for the examples presented in the previous section or for pairs of programs which differ substantially. We have been looking for parametric benchmark examples which create formulas that are increasingly hard to solve. These examples should be (1) scalable and (2) sufficiently similar to each other. We find that the following example interesting in this respect: Example 3. (n-Layer TC Programs) Let Πn be the following n-layer transitive closure: t1(X,Y):- r(X,Y). t1(X,Y):- r(X,Z), t1(Z,Y). t2(X,Y):- t1(X,Y). t2(X,Y):- t1(X,Z), t2(Z,Y). ··· tn(X,Y):- tn−1(X,Y). tn(X,Y):- tn−1(X,Z), tn(Z,Y).
Πn is similar but with one additional redundant rule for each layer except the first: t1(X,Y):t2(X,Y):t2(X,Y):··· tn(X,Y):tn(X,Y):-
r(X,Y). t1(X,Y):- r(X,Z), t1(Z,Y). t1(X,Y). t2(X,Y):- t1(X,Z), t2(Z,Y). r(X,Z), t2(Z,Y). tn−1(X,Y). tn(X,Y):- tn−1(X,Z), tn(Z,Y). r(X,Z), tn(Z,Y).
Testing Strong Equivalence of Datalog Programs - Implementation and Examples
441
Table 1. Run-times for n-layer transitive closure n 10 20 30 40 50 60 CPU time (sec) 0.38 1.43 3.66 7.93 13.55 23.56
The programs Πn and Πn are strongly equivalent. We have tested this for various n on an 800MHz PowerPC with 1GB main memory, running GNU/Linux and DARWIN in version 08-27-04. The results are shown in Table 1. We can observe that the runtimes roughly double when increasing n by 10. Thus the scaling shows exponential behavior. On the other hand, viewed from computational complexity the n-layer TC is not among the “hard” instances of the problem; such hard instances could be systematically generated from complexity proofs. We have also considered variants of these programs, where we added the rule in(X,Y) ∨ out(X,Y) :- tn.
to Πn , arriving at Πnf inal,∨ . To Πn , we added the two body-shift variants of this rule in(X,Y) :-tn(X,Y), not out(X,Y). out(X,Y) :-tn(X,Y), not in(X,Y).
to obtain Πnf inal,¬ . The programs Πnf inal,∨ and Πnf inal,¬ are not strongly equivalent, and our tool was always very fast (less than one second) to decide this. Finding testcases which are not strongly equivalent and hard for our tool remains as an open issue.
7 Conclusion We have implemented a non-ground strong equivalence tester, which works by a reduction to unsatisfiability of Bernays-Sch¨onfinkel formulas, which are solved by the theorem prover Darwin, which is guaranteed to terminate on these formulas. The size of the resulting Darwin programs is nearly linear in the size of the input programs. Hence, the overall performance of testing strong equivalence depends heavily on the automated theorem prover. We have made a positive experience with our tool. We could find a class of problems which is apparently hard for the employed prover. With similar examples that are not strongly equivalent, its performance was, however, very good.
References 1. Gelfond, M., Lifschitz, V.: Classical Negation in Logic Programs and Disjunctive Databases. New Generation Computing 9 (1991) 365–385 2. Lifschitz, V., Pearce, D., Valverde, A.: Strongly Equivalent Logic Programs. ACM Transactions on Computational Logic 2 (2001) 526–541 3. Turner, H.: Strong Equivalence Made Easy: Nested Expressions and Weight Constraints. Theory and Practice of Logic Programming 3 (2003) 602–622 4. Lin, F.: Reducing Strong Equivalence of Logic Programs to Entailment in Classical Propositional Logic. In: Proc. KR-2002. 170–176 5. Eiter, T., Faber, W., Greco, G., Fink, M., Lembo, D., Tompits, H., Woltran, S.: Methods and Techniques for Query Optimization. TR D5.3, EC Project IST-2001-33570 (INFOMIX) (2004) Available at http://www.mat.unical.it/infomix/. 6. Eiter, T., Fink, M., Tompits, H., Woltran, S.: Simplifying logic programs under uniform and strong equivalence. In Proc. LPNMR-7, Springer (2004) 87–99 7. Pearce, D., Tompits, H., Woltran, S.: Encodings for Equilibrium Logic and Logic Programs with Nested Expressions. In Proc. EPIA 2001. 306–320
SELP - A System for Studying Strong Equivalence Between Logic Programs Yin Chen1,2 , Fangzhen Lin3 , and Lei Li2 1
Department of Computer Science, South China Normal University, China 2 Software Institute, Sun Yat-sen University, China 3 Department of Computer Science, Hong Kong University of Science and Technology, Clear Water Bay, Kowloon, Hong Kong
Abstract. This paper describes a system called SELP for studying strong equivalence in answer set logic programming. The basic function of the system is to check if two given ground disjunctive logic programs are equivalent, and if not, return a counter-example. We have used the system to discover some interesting theorems about strong equivalence [Lin and Chen, 2005]. Here we briefly describe how the system can be used to find out whether a given set of rules is strongly equivalent to another, perhaps simpler set of rules.
1
Introduction
The notion of strongly equivalent logic programs was proposed by [Lifschitz et al., 2001]. It has been found useful for tasks such as program simplification. In this paper, we describe a system called SELP that can help us answer questions regarding this notion, from simple ones such as “are P and Q strongly equivalent” to more involved ones such as “is there another, preferably simpler logic program that is strongly equivalent to a given one”. The core of the system is checking whether two disjunctive logic programs are strongly equivalent. This is based on [Lin, 2002], which provides a simple mapping from logic programs to propositional theories that reduces strong equivalence to entailment in classical propositional logic. Thus, the problem of strong equivalence checking can be translated into a satisfiability problem in propositional logic, and solved using SAT solvers like zChaff. In addition, when two programs are not strongly equivalent, we may want to find some witnesses (counter-example). It is often hard to find a witness manually, but SELP can do this automatically: when two programs P1 and P2 are found not to be strongly equivalent, it will return a program P , such that P1 ∪P and P2 ∪P have different answer sets. Our motivation for developing SELP was to use it to study properties of the notion of strong equivalence. In [Lin and Chen, 2005], we described some results on classes of strongly equivalent logic programs discovered using the system. In this paper, we shall show how the system can help us answer questions of the
This work was supported in part by HK RGC CERG HKUST6170/04E.
C. Baral et al. (Eds.): LPNMR 2005, LNAI 3662, pp. 442–446, 2005. c Springer-Verlag Berlin Heidelberg 2005
SELP - A System for Studying Strong Equivalence Between Logic Programs
443
following form: Given a set P of rules, is there another set of rules of certain property that is strongly equivalent to P ? In [Janhunen and Oikarinen, 2004], a system call LPEQ was developed that can check if two normal programs are strongly equivalent, and was implemented using the answer set logic programming system smodels. Besides being implemented using a different technique, our system can deal with normal as well as disjunctive logic programs. Furthermore, our system can construct a counterexample when two programs are not strongly equivalent. The remainder of this paper is organized as follows. We introduce some basic notions in logic programming in section 2. In section 3, we describe the core of the system, i.e. how to check if two programs are strongly equivalent. In section 4, we show how to find all programs that are strongly equivalent to a given one. Finally, we conclude the paper in section 5.
2
Logic Programming
Let L be a propositional language, i.e. a set of atoms. In this paper we shall consider logic programs with rules of the following form: h1 ; · · · ; hk ← p1 , · · · , pm , not pm+1 , · · · , not pn
(1)
where hi ’s and pi ’s are atoms in L. So a logic program here can have default negation (not ), constraints (when k = 0), and disjunctions in the head of its rules. In the following, if r is a rule of the above form, we write Hdr to denote the set {h1 , ..., hk }, P sr the set {p1 , ..., pm }, and N gr the set {pm+1 , ..., pn }. Thus a rule r can also be written as Hdr ← P sr , not N gr . The semantics of program is given by answer sets as defined in [?]. Two logic programs P1 and P2 in L are said to be equivalent if they have the same answer sets, and strongly equivalent [Lifschitz et al., 2001] (in the language L) if for any logic program P in L, P ∪ P1 and P ∪ P2 are equivalent.
3
Checking Strong Equivalence Between Two Logic Programs
Lifschitz, Pearce, and Valverde [Lifschitz et al., 2001] showed that checking for strong equivalence between two logic programs can be done in the logic of hereand-there, a three-valued non-classical logic somewhere between classical logic and intuitionistic logic. Lin [Lin, 2002] provided a mapping from logic programs to propositional theories and showed that two logic programs are strongly equivalent iff their corresponding theories in propositional logic are equivalent. This result will be the basis that we are using in this paper for checking if two logic programs are strongly equivalent, and we repeat it here. Let P1 and P2 be two finite logic programs, and L the set of atoms in them.
444
Y. Chen, F. Lin, and L. Li
Theorem 1. [Lin, 2002] P1 and P2 are strongly equivalent iff in the propositional logic, the following two entailments hold: {p ⊃ p |p ∈ L} ∪ ∆(P1 ) |= ∆(P2 ), {p ⊃ p |p ∈ L} ∪ ∆(P2 ) |= ∆(P1 ).
(2) (3)
where for each p ∈ L, p is a new atom, and for each program P , ∆(P ) = {∆(r) | r ∈ P }, where for each rule r of the form (1), ∆(r) is the conjunction of the following two sentences: p1 ∧ · · · ∧ pm ∧ ¬pm+1 ∧ · · · ∧ ¬pn ⊃ h1 ∨ · · · ∨ hk , p1 ∧ · · · ∧ pm ∧ ¬pm+1 ∧ · · · ∧ ¬pn ⊃ h1 ∨ · · · ∨ hk .
(4) (5)
Notice that if m = n = 0, then the left sides of the implications in (4) and (5) are considered to be true, and if k = 0, then the right sides of the implications in (4) and (5) are considered to be f alse. Theorem 1 makes it possible to check the strong equivalence between two logic programs using a SAT solver. For instance, to verify (2), it is sufficient to check that both of the following two formulas are satisfied for all r ∈ P2 : {p ⊃ p | p ∈ L} ∪ ∆(P1 ) ∪ {p | p ∈ P sr } ∪ {¬p | p ∈ N gr } ∪ {¬p | p ∈ Hdr }, {p ⊃ p | p ∈ L} ∪ ∆(P1 ) ∪ {p | p ∈ P sr } ∪ {¬p | p ∈ N gr ∪ Hdr }. We implement this idea by using the SAT solver zChaff. If P1 and P2 are not strongly equivalent, then zChaff will return an assignment that is a counter-example to either (2) or (3), and from this assignment, we can construct a program P such that P ∪ P1 and P ∪ P2 are not equivalent, i.e. P is a witness of the fact that P1 and P2 are not strongly equivalent. The next theorem shows how to do this. Theorem 2. Let P1 and P2 be two programs, M a model of {p ⊃ p |p ∈ L} ∪ ∆(P1 ), and not ∆(P2 ). Let ML and ML be the two sets of atoms defined as follows: ML = {p | p ∈ L and M |= p}, ML = {p | p ∈ L and M |= p }.
(6) (7)
Then we have (1) If ML is not closed under P2 , then P1 ∪ P and P2 ∪ P is not equivalent, where P = {p ← | p ∈ ML }. (2) If ML is closed under P2 , then P1 ∪ P and P2 ∪ P is not equivalent, where P = {p ← | p ∈ ML } ∪ {p ← q | p, q ∈ ML \ ML , p = q}. While the basic function of our system SELP is to check whether two given logic programs are strongly equivalent, and if not provides a witness, we do not envision its use this way. Rather, we consider it a tool to systematically study the notion of strong equivalence. We have used this system to discover theorems about strongly equivalent logic programs in [Lin and Chen, 2005]. Here we describe how our system can be used to find whether there is a simpler set of rules that is strongly equivalent to a given set of rules.
SELP - A System for Studying Strong Equivalence Between Logic Programs
4
445
Finding Strongly Equivalent Logic Programs
One application of SELP is about finding out whether there is another, preferably simpler logic program that is strongly equivalent to a given one. For instance, we have seen that the self-loops (loops of length one) like p ← p, q are strongly equivalent to ∅. A natural follow-up question is then: what about loops of length two, like {(a ← b), (b ← a)}? Can they be simplified? Similarly, we know that an odd cycle of length one like {a ← not a} is strongly equivalent to a constraint like {← not a}. Is this also true for an odd cycle of greater length like {(a1 ← not a2 ), (a2 ← not a3 ), (a3 ← not a1 )}? Given a program P in the language L, an obvious way to look for another program in L that is strongly equivalent to P would be to generate all possible programs in L, and call SELP on them one by one. This is clearly infeasible even for a program with only three or four atoms. Fortunately, there is a much better way of doing it. Instead of considering all possible sets of rules, we can first find all possible rules that are redundant in the presence of P , i.e. all rules r such that P ∪ {r} is strongly equivalent to P , and consider sets of these rules only, as the following theorem says. Theorem 3. Let P be a logic program in L, and S the set of rules defined as follows: S = {r | r is in L, and P ∪ {r} and P are strongly equivalent }. For any program Q in L, if P and Q are strongly equivalent, then Q ⊆ S. Notice that the set S in the theorem includes “trivial” rules like p ← p. As we mentioned in [Lin and Chen, 2005], we need to consider only rules where each atom occurs at most once, i.e. non-redundant rules. Corollary 1. Let P be a logic program in L, and SP the set of rules defined as follows: SP = {r | r is a non-redundant rule in L, and P ∪ {r} and P are strongly equivalent }. For any program Q in L, if P and Q are strongly equivalent, then Q ⊆ SP , where Q is obtained from Q by deletion rules that are strongly equivalent to ∅, and replace each remaining rule r by Hdr \ N gr ← P sr , not N gr . Using this corollary, our system SELP finds all programs that are strongly equivalent to a given logic program in two steps: – generate all possible non-redundant rule r, and check if P is strongly equivalent to P ∪ {r}, thus computing the set SP , – for each subset of SP , check if it is strongly equivalent to P . For instance, consider again the following set of rules that is in fact a positive loop with length two: P1 = {(a ← b), (b ← a)}. Using SELP, we can see that SP1 consists of the following rules:
446
Y. Chen, F. Lin, and L. Li
a←b
b←a
← a, not b
← b, not a
As it turned out, there is no subset of SP1 that is strongly equivalent to P1 yet does not contain P1 , i.e. P1 cannot be simplified using strong equivalence. Similarly, the odd cycle with length three {(a1 ← not a2 ), (a2 ← not a3 ), (a3 ← not a1 )} is not strongly equivalent to any constraints.
5
Concluding Remarks and Future Work
We have developed a system called SELP for studying strong equivalence between logic programs. It plays a central role in discovering some theorems about strong equivalence as described in [Lin and Chen, 2005]. Here we have shown that it can also be used to check if a given set of rules is strongly equivalent to another, hopefully “simpler” set of rules. There are several directions for future work. One of them is to develop a similar system for studying the notion of uniform equivalence between two logic programs [Eiter and Fink, 2003]. In particular, it is interesting to see if theorems like those for strong equivalence discovered in [Lin and Chen, 2005] can be discovered for uniform equivalence.
References [Eiter and Fink, 2003] Thomas Eiter and Michael Fink. Uniform equivalence of logic programs under the stable model semantics. In Catuscia Palamidessi, editor, ICLP, volume 2916 of Lecture Notes in Computer Science, pages 224–238. Springer, 2003. [Gelfond and Lifschitz, 1991] Michael Gelfond and Vladimir Lifschitz. Classical negation in logic programs and disjunctive databases. New Generation Computing, 9:365– 385, 1991. [Janhunen and Oikarinen, 2004] Tomi Janhunen and Emilia Oikarinen. Lpeq and dlpeq - translators for automated equivalence testing of logic programs. In Vladimir Lifschitz and Ilkka Niemel¨ a, editors, LPNMR, volume 2923 of Lecture Notes in Computer Science, pages 336–340. Springer, 2004. [Lifschitz et al., 2001] V. Lifschitz, D. Pearce, and A. Valverde. Strongly equivalent logic programs. ACM Transactions on Computational Logic, 2(4):526–541, 2001. [Lin and Chen, 2005] Fangzhen Lin and Yin Chen. Discovering classes of strongly equivalent logic programs. In Proceedings of the Nineteenth International Joint Conference on Artificial Intelligence (IJCAI–05), 2005. To appear. [Lin, 2002] Fangzhen Lin. Reducing strong equivalence of logic programs to entailment in classical propositional logic. In Proceedings of the Eighth International Conference on Principles of Knowledge Representation and Reasoning (KR2002), pages 170–176, 2002.
CMODELS
– SAT-Based Disjunctive Answer Set Solver Yuliya Lierler
Erlangen-N¨urnberg Universit¨at [email protected]
1 Introduction Disjunctive logic programming under the stable model semantics [GL91] is a new methodology called answer set programming (ASP) for solving combinatorial search problems. This programming method uses answer set solvers, such as DLV [Lea05], GNT [Jea05], SMODELS [SS05], ASSAT [LZ02], CMODELS [Lie05a]. Systems DLV and GNT are more general as they work with the class of disjunctive logic programs, while other systems cover only normal programs. DLV is uniquely designed to find the answer sets for disjunctive logic programs. On the other hand, GNT first generates possible stable model candidates and then tests the candidate on the minimality using system SMODELS as an inference engine for both tasks. Systems CMODELS and ASSAT use SAT solvers as search engines. They are based on the relationship between the completion semantics [Cla78], loop formulas [LZ02] and answer set semantics for logic programs. Here we present the implementation of a SAT-based algorithm for finding answer sets for disjunctive logic programs within CMODELS. The work is based on the definition of completion for disjunctive programs [LL03] and the generalisation of loop formulas [LZ02] to the case of disjunctive programs [LL03]. We propose the necessary modifications to the SAT based ASSAT algorithm [LZ02] as well as to the generate and test algorithm from [GLM04] in order to adapt them to the case of disjunctive programs. We implement the algorithms in CMODELS and demonstrate the experimental results.
2 Syntax of CMODELS A Disjunctive program (DP) is a set of rules with expressions that have the form A ← B, F
(1)
where A is the head of the rule and is a disjunction of atoms or symbol ⊥, B is a conjunction of atoms, and F is a formula of the following form not A1 , . . . , not Am , not not Am+1 , . . . , not not An where Ai are atoms. We call such rules disjunctive. If a head of a rule does not contain disjunction, we call such a rule normal. If the formula F of the rule (1) contains an expression of the form not not Ai then the rule is nested, otherwise the rule is nonnested. If all rules of a DP are normal we call the program normal. C. Baral et al. (Eds.): LPNMR 2005, LNAI 3662, pp. 447–451, 2005. c Springer-Verlag Berlin Heidelberg 2005
448
Y. Lierler
Our implementation – system CMODELS – uses the program LPARSE --dlp-choice for grounding disjunctive logic programs. The input of CMODELS may include rules of three types. It allows (i) non-nested disjunctive rules, (ii) choice rules that have the form {A0 , ...Ak } ← Ak+1 , . . . , Al , not Al+1 , . . . , not Am
(2)
where Ai are atoms, and (iii) weight constraints of the form A0 ← L[A1 = w1 , . . . , Am = wm , not Am+1 = wm+1 , . . . , not An = wn ]
(3)
where A0 is an atom or symbol ⊥; A1 , . . . , An are atoms; L (lower bound); and w1 . . . wn (weights) are integers. The concept of an answer set for programs containing rules (2) and (3) was introduced in [NS00]. The original rules given to the front end LPARSE --dlp-choice allow lower and upper bounds for choice rules and upper bounds for weight rules. They also allow use of literals (negated atoms) in place of atoms. LPARSE --dlp-choice translates all the rules to the forms specified above. In CMODELS, choice rules are translated into normal nested rules, and weight constraints are translated with the help of auxiliary variables into normal non-nested rules.[FL05] Note that CMODELS is the first answer set programming system that allows use of disjunctive and choice rules in the same program.
3 Details on the Modified Algorithms and the Implementation The implementation is based on definitions of completion, tightness and loop formula for DP introduced in [LL03]. We also refer the reader to [LL03] for formal definitions of a set of atoms satisfying a program, answer set, reduct, and positive dependency graph of DP. The implementation exploits the relationship between completion semantics, loop formulas and answer set semantics for DP. For class of programs called tight models of completion and answer sets are the same. For nontight programs the difference in semantics is due to the cycles (loops) in the program. Loop formulas serve a role of an extension to completion so that the semantics coincide again. Number of loop formulas is exponential and therefore precomputing all loop formulas at once is not feasible, and iterative approach is explored. The correctness of algorithms encoded in CMODELS follows from two theorems. Theorem for Tight Programs. [LL03] For any tight DP Π and any set X of atoms, X is an answer set for Π iff X satisfies program’s completion comp(Π). Theorem 1. Let Π be a DP, M be a model of its completion comp(Π), set of atoms M |= Π M , such that M ⊂ M . There must be a loop of Π under M \ M , s.t. M does not satisfy its loop formula. Deciding whether a model of the completion is an answer set of disjunctive program is co-NP-complete. Within this implementation of CMODELS we verify that a model of the completion is indeed an answer set by using the minimality requirement of an answer set. We invoke a SAT solver on formula Π M ∪M − ∪¬M , where (i) Π M denotes the reduct of Π under M , s.t. its rules are represented as propositional formulas with
CMODELS –
SAT-Based Disjunctive Answer Set Solver
449
the comma understood as conjunction, and A ← B as the material implication B ⊃ A; (ii) M − denotes the conjunction of negation of the atoms in Π that do not belong to M ; and (iii) ¬M denotes the negation of the conjunction of atoms in M . If this formula is unsatisfied then M is indeed an answer set of Π otherwise some model M ⊂ M is returned. Note that M |= Π. We call this procedure minimality test. It is similar to the procedure introduced in [JNSY00]. [KLP03] introduced a more sophisticated way of verifying whether a model is an answer set using SAT solvers by exploiting some modularity property of the program, that permits splitting verification step on the whole program into verification on its parts. It is a direction of future work to research the applicability of the approach to the case of nested programs. CMODELS ’ algorithm is enhanced to verify the tightness of DP at first. In case when a program is tight it performs a completion procedure on the program and uses a SAT solver for enumerating its answer sets, avoiding invocation of minimality test procedure. This way we allow efficient use of SAT solvers in ASP, by analysing program syntactically and identifying in advance disjunctive program involving lower computational complexity. For nontight programs we adapt ASSAT algorithm [LZ02] to the case of disjunctive programs based on Theorem 2. The modified algorithm follows — DP-assat-Proc: 1. Let T be the Completion of Π — Comp(Π) 2. Invoke SAT solver SAT-A to find a model M of T . If there is no such model then terminate with failure. 3. Invoke the minimality test procedure on program Π, and model M with SAT solver SAT-B to find model M . If there is no such model then exit with an answer set M . If there is a model M then M is not an answer set of Π. 4. Build the subgraph GM\M of the positive dependency graph of Π induced by M \ M . Look for loop L in GM\M , s.t. M |= FL , where FL is a loop formula of L. 5. Let T be T ∪ FL , and go back to step 2. The implementation also adapts another SAT-based answer set programming generate and test algorithm from [GLM04] to the case of nontight disjunctive programs. State-of-the-art SAT solvers are enhanced by the ability of performing backjumping and learning within standard SAT Davis-Logemann-Loveland (DLL) procedure. Backjumping and learning techniques are due to providing DLL procedure with a certain clause. We retrieve the necessary clause from some loop formula of a program that allows us to enhance SAT solver inner computation. The enhanced generate and test algorithm for DP — DP-generate-test-enhanced-Proc: 1. Compute completion of Π — Comp(Π) 2. Initiate SAT solver SAT-A with the completion Comp(Π). Invoke DLL to find model M of Comp(Π). If there is no such model then terminate with failure. 3, 4. The same as Step 3,4 of DP-assat-proc. 5. Calculate a clause Cl implied by FL such that M |= Cl. 6. Return control to the SAT-A procedure DLL by giving Cl as a clause to backjump and learn. Find the next model M of the completion. If there is no such model then terminate with failure. Go back to step 3.
450
Y. Lierler
4 Experimental Analyses Details on the performance of system CMODELS in case of tight disjunctive programs can be found in [Lie05b]. For experimental analysis of CMODELS’ performance on nontight programs we shall specify the algorithmic differences of SAT solvers’ invocations. Algorithm DP-assat-Proc is implemented in CMODELS using SAT solver MCHAFF1 in Step 2. Algorithm DP-generate-test-enhanced-Proc is implemented in CMODELS with SAT solver SIMO2 or ZCHAFF1 invoked in place of SAT-A in the procedure. In case of DP-generate-test-enhanced-Proc implementation of Step 6 when control is given back to the SAT solver, SIMO and ZCHAFF behave differently. SIMO continues its work with the same search tree it obtained in previous computations, while ZCHAFF starts building a new search tree. In all cases ZCHAFF is used for minimality test procedure. instance qbf7 qbf8 qbf9 qbf1 qbf2 qbf3 qbf4
sat dlv.5.02.23 SAT 15.67 SAT 92.45 SAT 7.50 UNSAT 19.81 UNSAT 5.43 UNSAT 5.27 UNSAT 6.83
cmodels+mchaff 0.01 (23) 0.01 (23) 0.01 (33) 0.21(10) memory
cmodels+zchaff 0.01 (16) 0.01 (5) 0.01 (12) 0.01 (16) 823.98 (19928) 1779.28 (28481) 10.55 (137)
cmodels+simo 0.14 (5) 0.09 (4) 0.09 (5) 0.01 (37) 239.68 (26523) 193.69 (21260) 33.64 (663)
gnt2 25.77 0.001 1466.30 -
Fig. 1. CMODELS using MCHAFF , ZCHAFF , SIMO vs. DLV, and GNT on 2QBF benchmark
The first experiment that we demonstrate is 2QBF benchmark. The problem is Σ2p hard. The encoding and the instances of the problem where obtained at the web-site of the University of Kentucky3. Figure 1 presents the results. The experiments were run on Pentium 4, CPU 3.00GHz. The columns 3 through 7 present the running times of the systems in seconds with 30 minutes cutoff time. Number in parentheses specifies how often CMODELS invoked the minimality test procedure during its run. In case of satisfiable instances of the problem we can see the payoff in using CMODELS in place of other disjunctive ASP solvers. The picture changes when unsatisfiable instances of the problem come into play. Implementation of DP-assat-Proc reaches time limit twice and in case of one instance reaches the memory limit. Implementation of DP-generatetest-enhanced-Proc shows better results but as a rule is slower than DLV running time by two orders of magnitude. If we pay attention to the number of minimality test procedure invocations, the slow performance is not surprising. The number of models of the completion is large in case of unsatisfiable instances qbf2, qbf3 instances and hence all found models must be verified and denied by the minimality test procedure. The second experiment that we present is the Strategic Company benchmark. The problem is Σ2p -hard. We used the encoding and the instances of the problem provided by the benchmark system for answer set programming – Asparagus4. Figure 2 presents 1 2 3 4
http://www.princeton.edu/∼chaff/ http://www.star.dist.unige.it/∼sim/simo/ http://www.cs.uky.edu/ai/benchmark-suite/ http://asparagus.cs.uni-potsdam.de/
CMODELS –
instance 160.1 160.3 75.37 150.2 150.26
dlv.4 5.23 0.64 0.87 0.51 6.66 2.24
SAT-Based Disjunctive Answer Set Solver
gnt2 cmodels cmod-s cmod-s instzchaff mchaff simo ance 1.08 0.33 0.40 0.34 125.45 1.23 0.34 0.40 0.34 105.38 6.78 1.20 2.49 1.49 155.0 41.25 1.52 2.10 5.04 135.11 5.64 5.99 27.04 14.27 155.3
dlv.4 5.23 9.03 15.55 26.15 49.01 144.00
gnt2 cmodels zchaff 41.02 79.99 315.41 16.56 8.00 191.89 188.14 43.11
cmod-s mchaff 404.72 62.25 755.12
451 cmod-s simo 580.23 577.12 215.46
Fig. 2. CMODELS using ZCHAFF , MCHAFF , SIMO vs. DLV, GNT on Strategic Company
running times of systems obtained from Asparagus, machine AMD Athlon 1.4GHz PC with 512MB RAM and cutoff time 15 minutes. All given instances are satisfiable. In case of strategic company benchmark there is no clear winner in the performance, but GNT and DLV are in general faster.
References [Cla78] [FL05] [GL91] [GLM04] [Jea05] [JNSY00] [KLP03] [Lea05] [Lie05a] [Lie05b] [LL03] [LZ02] [NS00] [SS05]
Keith Clark. Negation as failure. In Herve Gallaire and Jack Minker, editors, Logic and Data Bases, pages 293–322. Plenum Press, New York, 1978. Paolo Ferraris and Vladimir Lifschitz. Weight constraints as nested expressions. Theory and Practice of Logic Programming, 5:45–74, 2005. Michael Gelfond and Vladimir Lifschitz. Classical negation in logic programs and disjunctive databases. New Generation Computing, 9:365–385, 1991. Enrico Giunchiglia, Yuliya Lierler, and Marco Maratea. Sat-based answer set programming. In Proc. AAAI-04, pages 61–66, 2004. T. Janhunen and et al. GnT (Generate’n’Test): A Solver for Disjunctive Logic Programs. 2005. Available under http://www.tcs.hut.fi/Software/gnt/. T. Janhunen, I. Niemela, P. Simons, and J.H. You. Unfolding partiality and disjunctions in stable model semantics. In Proc. KR, 2000. C. Koch, N. Leone, and G. Pfeifer. Enhancing disjunctive logic programming systems by sat checkers. Artificial Intelligence, 151:177–212, 2003. N. Leone and et al. A disjunctive datalog system DLV (2005-02-23). 2005. Available under http://www.dbai.tuwien.ac.at/proj/dlv/. Y. Lierler. CMODELS – a tool for computing answer set using SAT solvers. 2005. Available under http://www.cs.utexas.edu/users/tag/cmodels. Yu. Lierler. Cmodels for tight disjunctive logic programs. In 19th Workshop on (Constraint) Logic Programming W(C)LP, 2005. Joohyung Lee and Vladimir Lifschitz. Loop formulas for disjunctive logic programs. In Proc. ICLP-03, pages 451–465, 2003. Fangzhen Lin and Yuting Zhao. ASSAT: Computing answer sets of a logic program by SAT solvers. In Proc. AAAI-02, 2002. Ilkka Niemel¨a and Patrik Simons. Extending the Smodels system with cardinality and weight constraints. In Logic-Based Artificial Intelligence, pages 491–521. 2000. P. Simons and T. Syrjaenen. SMODELS and LPARSE – a solver and a grounder for normal logic programs. 2005. http://saturn.hut.fi/pub/smodels/.
Author Index
Alferes, Jos´e J´ ulio 356 Angele, J¨ urgen 26 Anger, Christian 422 Arieli, Ofer 132, 145 Banti, Federico 356 Beierle, Christoph 374 Brogi, Antonio 356 Bruynooghe, Maurice 132, 145 Buccafurri, Francesco 317 Calimeri, Francesco 105 Caminiti, Gianluca 317 Chen, Yin 442 Ches˜ nevar, Carlos I. 158 Cort´es-Calabuig, Alvaro 132, 145 Craven, Robert 198 De Bonis, Valerio 432 Dekhtyar, Alex 330 Dekhtyar, Michael I. 330 Dell’Armi, Tina 432 Denecker, Marc 145, 291 Dusso, Oliver 374 Eiter, Thomas 13, 379, 416, 437 Elkabani, Islam 427 Elkhatib, Omar 399 Engan, Iselin 304 Faber, Wolfgang 40, 240, 379, 437 Ferraris, Paolo 79, 119 Fink, Michael 379, 416 Finzi, Alberto 185 Galizia, Stefania 432 Gebser, Martin 53, 422 Gelfond, Michael 172 Godo, Lluis 158 Gottlob, Georg 379 Granata, Luigi 379 Grasso, Giovanni 432 Greco, Gianluigi 379
Grell, Susanne 394 Gressmann, Jean 227 Guo, Hai-Feng 253 Heymans, Stijn Hitzler, Pascal
92 356
Ianni, Giovambattista Janhunen, Tomi
105, 379
227, 405
Kakas, Antonis 211, 389 Kalka, Edyta 379 Kern-Isberner, Gabriele 374 Kifer, Michael 1 Konczak, Kathrin 384, 394 Langholm, Tore 304 Lembo, Domenico 379 Lenzerini, Maurizio 379 Leone, Nicola 379, 432 Li, Lei 442 Lian, Espen H. 304 Lierler, Yuliya 447 Lin, Fangzhen 442 Lin, Guohui 369 Linke, Thomas 422 Lio, Vincenzino 379 Liu, Guohua 266 Liu, Lengning 410 Lukasiewicz, Thomas 185 Marek, Victor W. 66 Mercer, Robert E. 227 Michael, Loizos 211 Miller, Rob 211 Moench, Eddie 26 Morales, A. Ricardo 172 Neumann, Andr´e Nowicki, Bartosz
422 379
Odintsov, Sergei 343 Oikarinen, Emilia 405 Onuczko, Curtis 266 Opperman, Henrik 26
454
Author Index
Papatheodorou, Irene 389 Pearce, David 343 Pivkina, Inna 66 Pontelli, Enrico 399, 427
Traxler, Patrick 437 Truszczy´ nski, Miroslaw Tu, Phan Huy 172
66, 410
Ricca, Francesco 240, 432 Rosati, Riccardo 379 Ruzzi, Marco 379
Van Nieuwenborgh, Davy 92 Van Nuffelen, Bert 132, 145 Vennekens, Joost 291 Vermeir, Dirk 92 Vogel, Ralf 384
Schaub, Torsten 53, 227, 394, 422 Senko, J´ an 416 Sergot, Marek 198, 389 Simari, Guillermo R. 158 Son, Tran Cao 172, 399, 427 Staniszkis, Witold 379
Waaler, Arild 304 Wang, Kewen 279 Wenke, Dirk 26 Wu, Gang 369
Terracina, Giorgio 379 Thiele, Sven 227 Tichy, Richard 227
You, Jia-Huai Yuan, Li Yan Zhang, Yan
266, 369 266 279