A Simple Complete Search for Logic Programming 1 Introduction

Jason Hemann, Daniel Friedman, William Byrd, Matthew Might, Jason Hemann, Daniel Friedman, William Byrd, Matthew Might
2017 licensed under Creative Commons License CC-BY Technical Communications of the 33rd International Conference on Logic Programming   unpublished
Here, we present a family of complete interleaving depth-first search strategies for embedded, domain-specific logic languages. We derive our search family from a stream-based implementation of incomplete depth-first search. The DSL's programs' texts induce particular strategies guaranteed to be complete. 1998 ACM Subject Classification D.3.2 Language Classifications: Applicative (functional) languages , Constraint and logic languages A common logic language implementation technique is the
more » ... owly-embedded, internal domain-specific language (DSL) [12, 8, 4]. In this technique, the logic-language programmer writes in the syntax of the underlying host language and the DSL's operators' behavior are described in terms of the host's semantics. Designers need implement only behaviors not supported natively by the host. For logic languages implemented in functional hosts, these may include backtracking and search, among others. Here, we present a family of complete interleaving depth-first search strategies induced by an embedding. Each logic program's text induces a particular search strategy. Unlike most other embeddings, our operators provide a complete search without the performance penalties associated with, for example, breadth-first search [12, 8]. We improve on earlier efforts [5] by combining the hand-off of control with relation definition, and in doing so decrease the amount of interleaving while maintaining a complete search. We achieve a minimal placement of interleaving points for arbitrary relation definitions. We host our embedding in Racket [3], but any eager language with functions as values is equally suited. We deliberately restrict ourselves to a small host language feature set. We rely chiefly on cons and lambda (λ). The data-structure interpolation operators ' and , are a shorthand for explicit conses, and the promise and force operators we use are shallow wrappers over function creation and application.