A small embedding of logic programming with a simple complete search
|
Tools and Resources
Share: |
|||||||||||||||||||||||||||||||
ABSTRACTWe present a straightforward, call-by-value embedding of a small logic programming language with a simple complete search. We construct the entire language in 54 lines of Racket---half of which implement unification. We then layer over it, in 43 lines, a reconstruction of an existing logic programming language, miniKanren, and attest to our implementation's pedagogical value. Evidence suggests our combination of expressiveness, concision, and elegance is compelling: since microKanren's release, it has spawned over 50 embeddings in over two dozen host languages, including Go, Haskell, Prolog and Smalltalk.
AUTHORS
|
|
||||||||||||||||||||||||||||||||||||||||
| View colleagues of Jason Hemann | |||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| View colleagues of Daniel P. Friedman | |||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| View colleagues of William E. Byrd | |||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| View colleagues of Matthew Might | |||||||||||||||||||||||||||||||||||||||||
REFERENCESNote: OCR errors may be found in this Reference List extracted from the full text article. ACM has opted to expose the complete List rather than only correct and linked references.
|
1
|
Franz Baader and Wayne Snyder. Unification theory. In John Alan Robinson and Andrei Voronkov, editors, Handbook of Automated Reasoning, pages 445–532. Elsevier and MIT Press, 2001.
|
|
|
2
|
||
|
3
|
||
|
4
|
William E. Byrd and Daniel P. Friedman. αKanren: A Fresh Name in Nominal Logic Programming. In Scheme 8, pages 79–90 (see also http://webyrd.net/alphamk/alphamk.pdf for improvements ), 2007.
|
|
| |
5
|
William E. Byrd , Eric Holk , Daniel P. Friedman, miniKanren, live and untagged: quine generation via relational interpreters (programming pearl), Proceedings of the 2012 Annual Workshop on Scheme and Functional Programming, p.8-29, September 09-15, 2012, Copenhagen, Denmark [doi>10.1145/2661103.2661105]
|
|
6
|
Venanzio Capretta. General recursion via coinductive types. Logical Methods in Computer Science, 1(2), 2005.
|
|
|
7
|
Mats Carlsson. On implementing Prolog in functional programming. New Generation Computing, 2(4):347–359, 1984.
|
|
|
8
|
Matthew Flatt and PLT. Reference: Racket. Technical Report PLT-TR-2010-1, PLT Design Inc., 2010. http:// racket-lang.org/tr1/.
|
|
|
9
|
Andreas Fordan. Projection in Constraint Logic Programming. Ios Press, 1999.
|
|
|
10
|
Daniel P. Friedman and Oleg Kiselyov. A declarative applicative logic programming system, 2005.
|
|
|
11
|
||
| |
12
|
|
|
13
|
Jason Hemann and Daniel P. Friedman. µKanren: A minimal functional core for relational programming. In Scheme 13, 2013.
|
|
|
14
|
Jason Hemann and Daniel P. Friedman. A framework for extending microkanren with constraints. In Scheme 15, 2015.
|
|
|
15
|
Forthcoming.
|
|
| |
16
|
|
|
17
|
Ralf Hinze. Prolog’s control constructs in a functional setting: Axioms and implementation. International Journal of Foundations of Computer Science, 12(02):125–170, 2001.
|
|
|
18
|
Joxan Jaffar, Michael J. Maher, Peter J. Stuckey, and Roland HC Yap. Output in CLP(R). In Fifth Generation Computing Systems, pages 987–995, 1992.
|
|
|
19
|
Oleg Kiselyov. The taste of logic programming, 2006.
|
|
| |
20
|
Oleg Kiselyov , Chung-chieh Shan , Daniel P. Friedman , Amr Sabry, Backtracking, interleaving, and terminating monad transformers: (functional pearl), Proceedings of the tenth ACM SIGPLAN international conference on Functional programming, September 26-28, 2005, Tallinn, Estonia [doi>10.1145/1086365.1086390]
|
|
21
|
H. J. Komorowski. QLOG: The programming environment for PROLOG in LISP. In K. L. Clark et al., editors, Logic Programming, pages 315–324. Academic Press, 1982.
|
|
|
22
|
||
|
23
|
Ramana Kumar. Mechanising Aspects of miniKanren in HOL, 2010. Australian National University. Bachelors thesis.
|
|
|
24
|
Lee Naish. Pruning in logic programming. Technical report, Technical Report 95/16, Department of Computer Science, University of Melbourne, June 1995.
|
|
|
25
|
Joseph P. Near, William E. Byrd, and Daniel P. Friedman. αleanTAP : A declarative theorem prover for first-order classical logic.
|
|
| |
26
|
|
|
27
|
Silvija Seres. The Algebra of Logic Programming. PhD thesis, University of Oxford, 2001.
|
|
|
28
|
Olin Shivers. List Library. Scheme Request for Implementation. SRFI-1, 1999.
|
|
| |
29
|
|
|
30
|
JM Spivey and Silvija Seres. Embedding Prolog in Haskell. In E. Meier, editor, Haskell 99, 1999.
|
CITED BY
INDEX TERMSThe ACM Computing Classification System (CCS rev.2012)
PUBLICATION| · Proceeding | |||||||||||||||||||||||||||||||||||||||||||||||
| Title | DLS 2016 Proceedings of the 12th Symposium on Dynamic Languages table of contents | ||||||||||||||||||||||||||||||||||||||||||||||
| Program Chair | Roberto Ierusalimschy PUC-Rio, Brazil | ||||||||||||||||||||||||||||||||||||||||||||||
| Pages | 96-107 | ||||||||||||||||||||||||||||||||||||||||||||||
| Publication Date | 2016-11-01 (yyyy-mm-dd) | ||||||||||||||||||||||||||||||||||||||||||||||
| Sponsors | SIGPLAN ACM Special Interest Group on Programming Languages | ||||||||||||||||||||||||||||||||||||||||||||||
| In-Cooperations | SIGADA ACM Special Interest Group on Ada Programming Language | ||||||||||||||||||||||||||||||||||||||||||||||
| Publisher | ACM New York, NY, USA ©2016 | ||||||||||||||||||||||||||||||||||||||||||||||
| ISBN: 978-1-4503-4445-6 doi>10.1145/2989225.2989230 | |||||||||||||||||||||||||||||||||||||||||||||||
| Conference |
SPLASHSystems, Programming, and Applications
|
||||||||||||||||||||||||||||||||||||||||||||||
| Overall Acceptance Rate 79 of 205 submissions, 39% | |||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||||||
| · Newsletter | |||||||||||||||||||||||||||||||||||||||||||||||
| Title | ACM SIGPLAN Notices - DLS '16 table of contents archive | ||||||||||||||||||||||||||||||||||||||||||||||
| Volume 52 Issue 2, February 2017 | |||||||||||||||||||||||||||||||||||||||||||||||
| Editor | Matthew Fluet | ||||||||||||||||||||||||||||||||||||||||||||||
| Pages | 96-107 | ||||||||||||||||||||||||||||||||||||||||||||||
| Publication Date | 2017-05-11 (yyyy-mm-dd) | ||||||||||||||||||||||||||||||||||||||||||||||
| Sponsor | SIGPLAN ACM Special Interest Group on Programming Languages | ||||||||||||||||||||||||||||||||||||||||||||||
| Publisher | ACM New York, NY, USA | ||||||||||||||||||||||||||||||||||||||||||||||
| ISSN: 0362-1340 EISSN: 1558-1160 doi>10.1145/3093334.2989230 | |||||||||||||||||||||||||||||||||||||||||||||||
REVIEWS
COMMENTSBe the first to comment To Post a comment please sign in or create a free Web account
Table of Contents| SESSION: Papers | ||
| Type safety analysis for Dart | ||
| Thomas S. Heinze, Anders Møller, Fabio Strocco | ||
| Pages: 1-12 | ||
| doi>10.1145/2989225.2989226 | ||
Full text: PDF
|
||
|
Optional typing is traditionally viewed as a compromise between static and dynamic type checking, where code without type annotations is not checked until runtime. We demonstrate that optional type annotations in Dart programs can be integrated into ...
expand
|
||
| Type unsoundness in practice: an empirical study of Dart | ||
| Gianluca Mezzetti, Anders Møller, Fabio Strocco | ||
| Pages: 13-24 | ||
| doi>10.1145/2989225.2989227 | ||
Full text: PDF
|
||
|
The type system in the Dart programming language is deliberately designed to be unsound: for a number of reasons, it may happen that a program encounters type errors at runtime although the static type checker reports no warnings. According to the language ...
expand
|
||
| Precise and scalable static analysis of jQuery using a regular expression domain | ||
| Changhee Park, Hyeonseung Im, Sukyoung Ryu | ||
| Pages: 25-36 | ||
| doi>10.1145/2989225.2989228 | ||
Full text: PDF
|
||
|
jQuery is the most popular JavaScript library but the state-of-the-art static analyzers for JavaScript applications fail to analyze simple programs that use jQuery. In this paper, we present a novel abstract string domain whose elements are simple regular ...
expand
|
||
| Just-in-time inheritance: a dynamic and implicit multiple inheritance mechanism | ||
| Mattias De Wael, Janwillem Swalens, Wolfgang De Meuter | ||
| Pages: 37-47 | ||
| doi>10.1145/2989225.2989229 | ||
Full text: PDF
|
||
|
Multiple inheritance is often criticised for the ambiguity that arises when multiple parents want to pass on a feature with the same name to their offspring. A survey of programming languages reveals that no programming language has an inherently implicit ...
expand
|
||
| Parallel virtual machines with RPython | ||
| Remigius Meier, Armin Rigo, Thomas R. Gross | ||
| Pages: 48-59 | ||
| doi>10.1145/2989225.2989233 | ||
Full text: PDF
|
||
|
The RPython framework takes an interpreter for a dynamic language as its input and produces a Virtual Machine (VM) for that language. RPython is being used to develop PyPy, a high-performance Python interpreter. However, the produced VM does not support ...
expand
|
||
| Building efficient and highly run-time adaptable virtual machines | ||
| Guido Chari, Diego Garbervetsky, Stefan Marr | ||
| Pages: 60-71 | ||
| doi>10.1145/2989225.2989234 | ||
Full text: PDF
|
||
|
Programming language virtual machines (VMs) realize language semantics, enforce security properties, and execute applications efficiently. Fully Reflective Execution Environments (EEs) are VMs that additionally expose their whole structure and behavior ...
expand
|
||
| Efficiently implementing the copy semantics of MATLAB's arrays in JavaScript | ||
| Vincent Foley-Bourgon, Laurie Hendren | ||
| Pages: 72-83 | ||
| doi>10.1145/2989225.2989235 | ||
Full text: PDF
|
||
|
Compiling MATLAB---a dynamic, array-based language---to JavaScript is an attractive proposal: the output code can be deployed on a platform used by billions and can leverage the countless hours that have gone into making JavaScript JIT engines fast. ...
expand
|
||
| Optimizing R language execution via aggressive speculation | ||
| Lukas Stadler, Adam Welc, Christian Humer, Mick Jordan | ||
| Pages: 84-95 | ||
| doi>10.1145/2989225.2989236 | ||
Full text: PDF
|
||
|
The R language, from the point of view of language design and implementation, is a unique combination of various programming language concepts. It has functional characteristics like lazy evaluation of arguments, but also allows expressions to have ...
expand
|
||
| A small embedding of logic programming with a simple complete search | ||
| Jason Hemann, Daniel P. Friedman, William E. Byrd, Matthew Might | ||
| Pages: 96-107 | ||
| doi>10.1145/2989225.2989230 | ||
Full text: PDF
|
||
|
We present a straightforward, call-by-value embedding of a small logic programming language with a simple complete search. We construct the entire language in 54 lines of Racket---half of which implement unification. We then layer over it, in 43 lines, ...
expand
|
||
| Modular semantic actions | ||
| Alessandro Warth, Patrick Dubroy, Tony Garnock-Jones | ||
| Pages: 108-119 | ||
| doi>10.1145/2989225.2989231 | ||
Full text: PDF
|
||
|
Parser generators give programmers a convenient and declarative way to write parsers and other language-processing applications, but their mechanisms for extension and code reuse often leave something to be desired. We introduce Ohm, a parser generator ...
expand
|
||
| Cross-language compiler benchmarking: are we fast yet? | ||
| Stefan Marr, Benoit Daloze, Hanspeter Mössenböck | ||
| Pages: 120-131 | ||
| doi>10.1145/2989225.2989232 | ||
Full text: PDF
|
||
|
Comparing the performance of programming languages is difficult because they differ in many aspects including preferred programming abstractions, available frameworks, and their runtime systems. Nonetheless, the question about relative performance comes ...
expand
|
||