Modular stratification and magic sets for Datalog programs with negation

A class of “modularly stratified” logic programs is defined. Modular stratification generalizes stratification and local stratification, while allowing programs that are not expressible as stratified programs. For modularly stratified programs, the well-founded semantics coincides with the stable model semantics and makes every ground literal true or false. Modularly stratified programs are weakly stratified, but the converse is false. Unlike some weakly stratified programs, modularly stratified programs can be evaluated in a subgoal-at-a time fashion. An extension of top-down methods with memoing that handles this broader class of programs is presented. A technique for rewriting a modularly stratified program for bottom-up evaluation is demonstrated and extended to include magic-set techniques. The rewritten program, when evaluated bottom-up, gives correct answers according to the well-founded semantics, but much more efficiently than computing the complete well-founded model. A one-to-one correspondence between steps of the extended top-down method and steps during the bottom-up evaluation of the magic-rewritten program is exhibited, demonstrating that the complexity of the two methods is the same. Extensions of modular stratification to other operators such as set-grouping and aggregation, which have traditionally been stratified to prevent semantic difficulties, are discussed.

[1]  Teodor C. Przymusinski,et al.  Weakly Perfect Model Semantics for Logic Programs , 1988, ICLP/SLP.

[2]  Divesh Srivastava,et al.  Rule Ordering in Bottom-Up Fixpoint Evaluation of Logic Programs , 1990, IEEE Trans. Knowl. Data Eng..

[3]  Catriel Beeri,et al.  On the power of magic , 1987, PODS '87.

[4]  François Bry,et al.  Logic programming as constructivism: a formalization and its application to databases , 1989, PODS.

[5]  David Maier,et al.  Magic sets and other strange ways to implement logic programs (extended abstract) , 1985, PODS '86.

[6]  Catriel Beeri,et al.  On the power of magic , 1987, J. Log. Program..

[7]  Hidenori Itoh,et al.  A Query Evaluation Method for Stratified Programs Under the Extended CWA , 1988, ICLP/SLP.

[8]  Laurent Vieille,et al.  A Database-Complete Proof Procedure Based on SLD-Resolution , 1987, ICLP.

[9]  Jeffrey D. Uuman Principles of database and knowledge- base systems , 1989 .

[10]  J. W. Lloyd,et al.  Foundations of logic programming; (2nd extended ed.) , 1987 .

[11]  Kenneth A. Ross,et al.  Glue-Nail: a deductive database system , 1991, SIGMOD '91.

[12]  Jeffrey D. Ullman,et al.  Principles of Database and Knowledge-Base Systems, Volume II , 1988, Principles of computer science series.

[13]  Kenneth A. Ross,et al.  The well-founded semantics for general logic programs , 1991, JACM.

[14]  Yehoshua Sagiv,et al.  Inference of monotonicity constraints in Datalog programs , 1989, PODS '89.

[15]  Phokion G. Kolaitis The Expressive Power of Stratified Programs , 1991, Inf. Comput..

[16]  Jeffrey D. Ullman,et al.  Bottom-up beats top-down for datalog , 1989, PODS '89.

[17]  Teodor C. Przymusinski Every logic program has a natural stratification and an iterated least fixed point model , 1989, PODS.

[18]  Klaus Estenfeld 6th International Conference on Logic Programming , 1989, Künstliche Intell..

[19]  Kotagiri Ramamohanarao,et al.  Efficient Bottom-UP Computation of Queries on Stratified Databases , 1991, J. Log. Program..

[20]  K. A. Ross Modular stratification and magic sets for DATALOG programs with negation , 1990, PODS 1990.

[21]  Kenneth A. Ross,et al.  Modular acyclicity and tail recursion in logic programs , 1991, PODS.

[22]  Teodor C. Przymusinski On Constructive Negation in Logic Programming , 1989, NACLP.

[23]  Kenneth A. Ross A Prodedural Semantics for Well-Founded Negation in Logic Programs , 1992, J. Log. Program..

[24]  Kenneth A. Ross,et al.  A procedural semantics for well founded negation in logic programs , 1989, J. Log. Program..

[25]  David Chan,et al.  Constructive Negation Based on the Completed Database , 1988, ICLP/SLP.

[26]  Jean-Marc Pugin,et al.  Efficient Query Answering on Stratified Databases , 1988, FGCS.

[27]  Hirohisa Seki,et al.  On the power of Alexander templates , 1989, PODS.

[28]  J. Lloyd Foundations of Logic Programming , 1984, Symbolic Computation.

[29]  David B. Kemp,et al.  Completeness of a Top-Down Query Evaluation Procedure for Stratified Databases , 1988, ICLP/SLP.

[30]  Michael Kifer,et al.  HiLog: A First-Order Semantics for Higher-Order Logic Programming Constructs , 1989, NACLP.

[31]  Raghu Ramakrishnan,et al.  Magic Templates: A Spellbinding Approach To Logic Programs , 1991, J. Log. Program..

[32]  Yehoshua Sagiv,et al.  Inference of Monotonicity Constraints in Datalog Programs , 1989, PODS.

[33]  H. Przymusinska,et al.  Weakly stratified logic programs , 1990 .

[34]  Teodor C. Przymusinski On the Declarative Semantics of Deductive Databases and Logic Programs , 1988, Foundations of Deductive Databases and Logic Programming..

[35]  Geoffrey Phipps Glue: A Deductive Database Programming Language , 1992 .

[36]  Kenneth A. Ross,et al.  Unfounded sets and well-founded semantics for general logic programs , 1988, PODS.

[37]  Laurent Vieille,et al.  Recursive Axioms in Deductive Databases: The Query/Subquery Approach , 1986, Expert Database Conf..

[38]  John Wylie Lloyd,et al.  Foundations of Logic Programming , 1987, Symbolic Computation.