[Pycon] [new paper] "Massimo Nocentini" - microkanrenpy: an exercise in logic programming

info a pycon.it info a pycon.it
Ven 5 Gen 2018 14:49:21 CET


Title: microkanrenpy: an exercise in logic programming
Duration: 45 (includes Q&A)
Q&A Session: 15
Language: en
Type: Talk

Abstract: 
We present a pythonic port of *microkanren*, a relational DSL originally
written in Scheme by [Hemann and Friedman][1].  The language can be fully
specified on top of lambda calculus, therefore it fits nicely for a coding
exercise in Python. 

The framework lies on the fundamental concept of *unification* a la Robinson
instead of SLD-NF resolution used by Prolog systems; moreover, microkanren uses
goals that handle substitutions instead of Horn clauses as logic entities.  We
present the fundamental goals constructors:
- `succeed` is satisfied by each substitution,
- `fail` cannot be satisfied by any substitution, 
- `unify` is satisfied if two structures can be made equals,
- `fresh` introduces a new logic variable, 
- `conj` is satisfied if both subgoals can be satisfied,
- `disj` is satisfied if either one or both subgoals can be satisfied;
combining them with a *fair* and *complete* search strategy it is possible to
perform logic computation, providing pure and impure (aka cuts) operators. We
want to show design choices to spot the elegance and beauty of the original
implementation (40 loc of Scheme) which can be regained in Python too. The aim
of this talk is purely educational.

[Code][2] and [doc][3] are available.

Not particular prerequisite is mandatory, if you understand functions as values
to be passed around and you are a recursive person is enough!

[1]: https://github.com/jasonhemann/microKanren
[2]: https://github.com/massimo-nocentini/microkanrenpy
[3]: http://microkanrenpy.readthedocs.io/en/latest/


Tags: [u'calculus', u'dsl', u'lambda', u'logic', u'tdd']


Maggiori informazioni sulla lista Pycon