Compiling Logic Programs with Equality

Horn clause logic with equality is an amalgamation of functional and logic programming languages. A sound and complete operational semantics for logic programs with equality is based on resolution to solve literals, and rewriting and narrowing to evaluate functional expressions. This paper proposes a technique for compiling programs with these inference rules into programs of a low-level abstract machine which can be efficiently executed on conventional architectures. The presented approach is based on an extension of the Warren abstract machine (WAM). In our approach pure logic programs without function definitions are compiled in the same way as in the WAM-approach, and for logic programs with function definitions particular instructions are generated for occurrences of functions inside clause bodies. In order to obtain an efficient implementation of functional computations, a stack of occurrences of function symbols in goals is managed by the abstract machine. The compiler generates the necessary instructions for the efficient manipulation of the occurrence stack from the given equational logic programs.

[1]  Michael Hanus,et al.  Formal Specification of a Prolog Compiler , 1988, PLILP.

[2]  Nachum Dershowitz,et al.  An Implementation of Narrowing , 1989, J. Log. Program..

[3]  Rita Loogen,et al.  Graph-based Implementation of a Functional Logic Langugage , 1990, ESOP.

[4]  William F. Clocksin,et al.  Programming in Prolog , 1987, Springer Berlin Heidelberg.

[5]  Laurent Fribourg,et al.  SLOG: A Logic Programming Language Interpreter Based on Clausal Superposition and Rewriting , 1985, SLP.

[6]  Akihiro Yamamoto A Theoretical Combination of SLD-Resolution and Narrowing , 1987, ICLP.

[7]  Corrado Moiso,et al.  Refined Strategies for Semantic Unification , 1987, TAPSOFT, Vol.2.

[8]  Bart Demoen,et al.  Improving the register allocation in WAM by reordering unification , 1988 .

[9]  Harald Ganzinger,et al.  Completion-Time Optimization of Rewrite-Time Goal Solving , 1989, RTA.

[10]  José Meseguer,et al.  EQLOG: Equality, Types, and Generic Modules For Logic Programming , 1986, Logic Programming: Functions, Relations, and Equations.

[11]  Jean-Marie Hullot,et al.  Canonical Forms and Unification , 1980, CADE.

[12]  Saumya K. Debray Register Allocation in a Prolog Machine , 1986, SLP.

[13]  Steffen Hölldobler From Paramodulation to Narrowing , 1988, ICLP/SLP.

[14]  Michael Hanus,et al.  A Functional and Logic Language with Polymorphic Types (Extended Abstract) , 1990, DISCO.

[15]  Corrado Moiso,et al.  An Extension of WAM for K-LEAF: A WAM-based Compilation of Conditional Narrowing , 1989, ICLP.

[16]  Martin Huber,et al.  Extended Prolog for Order-Sorted Resolution , 1987, SLP.

[17]  Doug DeGroot,et al.  Logic programming - functions, relations and equations , 1986 .

[18]  Peter Padawitz,et al.  Computing in Horn Clause Theories , 1988, EATCS Monographs on Theoretical Computer Science.

[19]  Thierry Heuillard Compiling Conditional Rewriting Systems , 1987, CTRS.

[20]  Michael Hanus Horn Clause Specifications with Polymorphic Types , 1988, ADT.