Functional computations in logic programs

Although the ability to simulate nondeterminism and to compute multiple solutions for a single query is a powerful and attractive feature of logic programming languages, it is expensive in both time and space. Since programs in such languages are very often functional, that is, they do not produce more than one distinct solution for a single input, this overhead is especially undesirable. This paper describes how programs may be analyzed statically to determine which literals and predicates are functional, and how the program may then be optimized using this information. Our notion of “functionality” subsumes the notion of “determinacy” that has been considered by various researchers. Our algorithm is less reliant on language features such as the cut, and thus extends more easily to parallel execution strategies, than others that have been proposed.

[1]  Doug DeGroot,et al.  Restricted AND-Parallelism , 1984, FGCS.

[2]  Alvin M. Despain,et al.  Semi-Intelligent Backtracking of Prolog Based on Static Data Dependency Analysis , 1985, SLP.

[3]  Manuel V. Hermenegildo,et al.  An Abstract Machine for Restricted AND-Parallel Execution of Logic Programs , 1986, ICLP.

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

[5]  Philippe Robert,et al.  The PEPSys Model: Combining Backtracking, AND- and OR-Parallelism , 1987, SLP.

[6]  Seif Haridi,et al.  OR-Parallel Prolog Made Efficient on Shared Memory Multiprocessors , 1987, SLP.

[7]  Lee Naish,et al.  Negation and Quantifiers in NU-Prolog , 1986, ICLP.

[8]  Lee Naish,et al.  Negation and Control in Prolog , 1986, Lecture Notes in Computer Science.

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

[10]  Laxmikant V. Kalé,et al.  The Reduce-Or Process Model for Parallel Execution of Logic Programs , 1991, J. Log. Program..

[11]  Jan Maluszynski,et al.  Relating Logic Programs and Attribute Grammars , 1985, J. Log. Program..

[12]  Keith L. Clark,et al.  Negation as Failure , 1987, Logic and Data Bases.

[13]  John S. Conery Parallel Execution of Logic Programs , 1987 .

[14]  David Maier,et al.  The Theory of Relational Databases , 1983 .

[15]  Saumya K. Debray,et al.  Denotational and Operational Semantics for Prolog , 1988, J. Log. Program..

[16]  Robert A. Kowalski,et al.  The Semantics of Predicate Logic as a Programming Language , 1976, JACM.

[17]  Neil D. Jones,et al.  Stepwise Development of Operational and Denotational Semantics for Prolog , 1984, International Conference on Spoken Language Processing.

[18]  Michael J. Wise,et al.  EPILOG: Re-interpreting and Extending Prolog for a Multiprocessor Environment , 1984, Implementations of Prolog.

[19]  Richard A. O'Keefe,et al.  On the Treatment of Cuts in Prolog Source-Level Tools , 1985, SLP.

[20]  David H. D. Warren,et al.  Efficient Processing of Interactive Relational Data Base Queries expressed in Logic , 1981, VLDB.

[21]  Chris Mellish,et al.  Some Global Optimizations for a Prolog Compiler , 1985, J. Log. Program..

[22]  Ehud Shapiro,et al.  Third International Conference on Logic Programming , 1986 .

[23]  Alberto O. Mendelzon Functional Dependencies in Logic Programs , 1985, VLDB.

[24]  Luís Moniz Pereira,et al.  Deduction Revision by Intelligent Backtracking , 1984, Implementations of Prolog.

[25]  Hajime Sawamura,et al.  Recursive Unsolvability of Determinacy, Solvable Cases of Determinancy and their Applications to Prolog Optimization , 1985, SLP.

[26]  Saumya K. Debray,et al.  Automatic Mode Inference for Logic Programs , 1988, J. Log. Program..

[27]  David H. D. Warren,et al.  The SRI Model for Or-Parallel Execution of Prolog: Abstract Design and Implementation Issues , 1987, SLP.

[28]  Laxmikant V. Kalé,et al.  Executing Distributed Prolog Programs on a Broadcast Network , 1984, International Conference on Spoken Language Processing.