The promise of logic programming is that programs can be written relationally , without distinguishing between input and output arguments. Relational programs are remarkably flexible—for example, a relational type-inferencer also performs type checking and type inhabitation, while a relational theorem prover generates theorems as well as proofs and can even be used as a simple proof assistant.
Unfortunately, writing relational programs is difficult, and requires many interesting and unusual tools and techniques. For example, a relational interpreter for a subset of Scheme might use nominal unification to support variable binding and scope, Constraint Logic Programming over Finite Domains (CLP(FD)) to implement relational arithmetic, and tabling to improve termination behavior.
In this dissertation I present miniKanren , a family of languages specifically designed for relational programming, and which supports a variety of relational idioms and techniques. I show how miniKanren can be used to write interesting relational programs, including an extremely flexible lean tableau theorem prover and a novel constraint-free binary arithmetic system with strong termination guarantees. I also present interesting and practical techniques used to implement miniKanren, including a nominal unifier that uses triangular rather than idempotent substitutions and a novel “walk”-based algorithm for variable lookup in triangular substitutions.
The result of this research is a family of languages that supports a variety of relational idioms and techniques, making it feasible and useful to write interesting programs as relations.
Cited By
- Lozov P and Boulytchev D Efficient fair conjunction for structurally-recursive relations Proceedings of the 2021 ACM SIGPLAN Workshop on Partial Evaluation and Program Manipulation, (58-73)
- Dabral C and Martens C Generating explorable narrative spaces with answer set programming Proceedings of the Sixteenth AAAI Conference on Artificial Intelligence and Interactive Digital Entertainment, (45-51)
- Mensing A, van Antwerpen H, Bach Poulsen C and Visser E From definitional interpreter to symbolic executor Proceedings of the 4th ACM SIGPLAN International Workshop on Meta-Programming Techniques and Reflection, (11-20)
- Rozplokhas D and Boulytchev D Improving Refutational Completeness of Relational Search via Divergence Test Proceedings of the 20th International Symposium on Principles and Practice of Declarative Programming, (1-13)
- Kristensen T Exploring melody space in a live context using declarative functional programming Proceedings of the 2nd ACM SIGPLAN international workshop on Functional art, music, modeling & design, (25-31)
- Byrd W, Holk E and Friedman D miniKanren, live and untagged Proceedings of the 2012 Annual Workshop on Scheme and Functional Programming, (8-29)
Recommendations
miniKanren, live and untagged: quine generation via relational interpreters (programming pearl)
Scheme '12: Proceedings of the 2012 Annual Workshop on Scheme and Functional ProgrammingWe present relational interpreters for several subsets of Scheme, written in the pure logic programming language miniKanren. We demonstrate these interpreters running "backwards"---that is, generating programs that evaluate to a specified value---and ...
A relational language for parallel programming
FPCA '81: Proceedings of the 1981 conference on Functional programming languages and computer architectureA parallel program often defines a relation not a function. The program constrains the output to lie in some relation R to the input, but the particular output produced during a computation can depend on the time behaviour of component processes. This ...