Abstract

The original vision of logic programming called for using predicate logic as a programming language [35,48]. Prolog only partially realizes this vision, since it has many features with no corresponding feature in first-order predicate logic, and also fails to realize some features of predicate logic. Perhaps the main benefit of the system suggested in this paper, hereafter called Eqlog, is the way it combines the technology of Prolog (its efficient implementation with unification and backtracing) with functional programming (in an efficient first-order rewrite rule implementation) to yield more than just their sum: logical variables can be included in equations, giving the ability to find general solutions to equations over user defined abstract data types (ADTs). In addition, generic (i.e., parameterized) modules become available with a rigorous logical foundation; Eqlog also has a subsort facility that greatly increases its expressive power. The many advantages that have been claimed for logic programming, including simplicity, clarity, understandability, reusability and maintainability, are all compromised to the degree that the logic underlying the programming language is not a pure logic. Thus, it is highly desirable to extend the logic in such a way as to encompass a greater range of programming language features, provided that one can preserve reasonable efficiency. Our approach is based on many-sorted’ first-order Horn clause logic with equality, and also draws on some results from the theory of rewrite rules about “narrowing” [32,17] to get a complete implementation of equality; this approach can be seen as arising from the work of Plotkin [40], Robinson & Wos [43], and Slagle [45] on combining equations and resolution. Of course, we use unification [42], and our evaluation algorithm for Eqlog is an extension (by narrowing) of the standard Prolog evaluation mechanism (e.g., [lo, 81) and can be seen as a special kind of resolution. It can also be seen as a kind of “ universal unification” that solves a wide variety of “logical constraints.”

Full Text
Published version (Free)

Talk to us

Join us for a 30 min session where you can share your feedback and ask us any queries you have

Schedule a call