Annotated implementation of microKanren: an embeddable logic language

This page summarizes the projects mentioned and recommended in the original post on news.ycombinator.com

Our great sponsors
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • WorkOS - The modern identity platform for B2B SaaS
  • SaaSHub - Software Alternatives and Reviews
  • muKanren_reading

    [Mirror] A close reading of the μKanren paper.

  • microKanren-py

    Discontinued Simple python3 implementation of microKanren with lots of type annotations for clarity

    I did a mostly-true-to-the-paper python implementation a while back, that may be helpful as well: https://github.com/Erik-J-D/microKanren-py

  • InfluxDB

    Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.

  • scryer-prolog

    A modern Prolog implementation written mostly in Rust.

    No, what I'm describing is the "monadic" behaviour of `phrase_from_file/2` and similar predicates. In conjunction with definite clause grammars, this means that your I/O operations either conform to the provided spec or fail. This is a "hot topic" (if LP topics can really still be "hot") and sees active development in new prolog systems.

    Check this out:

    https://www.swi-prolog.org/pldoc/man?section=pio

    https://github.com/mthom/scryer-prolog/blob/084fc845902f7b43...

  • mediKanren

    Proof-of-concept for reasoning over the SemMedDB knowledge base, using miniKanren + heuristics + indexing.

    Not really production, but probably THE most impressive biomedicine research work I've seen (and I'm an academic MD):

    https://github.com/webyrd/mediKanren

    This is a FOL theorem prover that uses medical research articles as terms. They use it to do genetics and drug repurposing metaresearch. It's like the wet dream of all the biomed machine learning fanboys out there, except that:

    1. it's not machine learning

    and

    2. it really works

  • edcg

    Extended DCG syntax for Prolog by Peter Van Roy

  • wh40ksim

    Warhammer 40k Combat simulator

    Here's some stuff I've written in Prolog, some for my own enjoyment, one for my degree project.

    Most of the benefits I found come down to two things:

    a) Prolog, like the various kanrens, is a relational language so a program is effectively a database. There's no need to do anything special to glue together a data layer and a logic layer, because you have both written in Prolog.

    b) Prolog's declarative style makes translating rules and directives to code a breeze. The three projects below are all games and benefit heavily from this feature. I

    1. Warhammer 40K simulation:

    https://github.com/stassa/wh40ksim

    Runs simulations of combat between WH40k units.

    2. Gleemin, a Magic: the Gathering expert system:

    https://github.com/stassa/Gleemin

    Doesn't work anymore! Because backwards compatibility. Includes a) a parser for the rules text on M:tG cards written in Prolog's Definite Clause Grammars notation, b) a rules engine and c) a (primitive) AI player. The parser translates rules text from cards into rules engine calls. The cards themselves are Prolog predicates. Your data and your program are one and now you can also do stuff with them.

    3. Nests & Insects, a roguelike TTRPG:

    https://github.com/stassa/nests-and-insects

    WIP! Here I use Prolog to keep the data about my tabletop rpg organised, and also to automatically fill-in the character sheets typeset in the rulebook. The Prolog code runs a character creation process and generates completed character sheets. I plan to do the same for enemies' stat blocks, various procedural generation tables, etc. I also use Prolog to typeset the ASCII-styled rulebook, but that's probably not a good application of Prolog.

    You asked about "logic programming" in general and not miniKanren in particular. I haven't actually used miniKanren, so I commented about the logic programming language I've used the most, Prolog. I hope that's not a thread hijack!

    All three of the projects above are basically games. I have more "serious" stuff on my github but I feel a certain shortfall of gravitas, I suppose.

  • Gleemin

    A Magic: the Gathering™ expert system

    Here's some stuff I've written in Prolog, some for my own enjoyment, one for my degree project.

    Most of the benefits I found come down to two things:

    a) Prolog, like the various kanrens, is a relational language so a program is effectively a database. There's no need to do anything special to glue together a data layer and a logic layer, because you have both written in Prolog.

    b) Prolog's declarative style makes translating rules and directives to code a breeze. The three projects below are all games and benefit heavily from this feature. I

    1. Warhammer 40K simulation:

    https://github.com/stassa/wh40ksim

    Runs simulations of combat between WH40k units.

    2. Gleemin, a Magic: the Gathering expert system:

    https://github.com/stassa/Gleemin

    Doesn't work anymore! Because backwards compatibility. Includes a) a parser for the rules text on M:tG cards written in Prolog's Definite Clause Grammars notation, b) a rules engine and c) a (primitive) AI player. The parser translates rules text from cards into rules engine calls. The cards themselves are Prolog predicates. Your data and your program are one and now you can also do stuff with them.

    3. Nests & Insects, a roguelike TTRPG:

    https://github.com/stassa/nests-and-insects

    WIP! Here I use Prolog to keep the data about my tabletop rpg organised, and also to automatically fill-in the character sheets typeset in the rulebook. The Prolog code runs a character creation process and generates completed character sheets. I plan to do the same for enemies' stat blocks, various procedural generation tables, etc. I also use Prolog to typeset the ASCII-styled rulebook, but that's probably not a good application of Prolog.

    You asked about "logic programming" in general and not miniKanren in particular. I haven't actually used miniKanren, so I commented about the logic programming language I've used the most, Prolog. I hope that's not a thread hijack!

    All three of the projects above are basically games. I have more "serious" stuff on my github but I feel a certain shortfall of gravitas, I suppose.

  • WorkOS

    The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.

  • nests-and-insects

    A Roguelike Tabletop RPG

    Here's some stuff I've written in Prolog, some for my own enjoyment, one for my degree project.

    Most of the benefits I found come down to two things:

    a) Prolog, like the various kanrens, is a relational language so a program is effectively a database. There's no need to do anything special to glue together a data layer and a logic layer, because you have both written in Prolog.

    b) Prolog's declarative style makes translating rules and directives to code a breeze. The three projects below are all games and benefit heavily from this feature. I

    1. Warhammer 40K simulation:

    https://github.com/stassa/wh40ksim

    Runs simulations of combat between WH40k units.

    2. Gleemin, a Magic: the Gathering expert system:

    https://github.com/stassa/Gleemin

    Doesn't work anymore! Because backwards compatibility. Includes a) a parser for the rules text on M:tG cards written in Prolog's Definite Clause Grammars notation, b) a rules engine and c) a (primitive) AI player. The parser translates rules text from cards into rules engine calls. The cards themselves are Prolog predicates. Your data and your program are one and now you can also do stuff with them.

    3. Nests & Insects, a roguelike TTRPG:

    https://github.com/stassa/nests-and-insects

    WIP! Here I use Prolog to keep the data about my tabletop rpg organised, and also to automatically fill-in the character sheets typeset in the rulebook. The Prolog code runs a character creation process and generates completed character sheets. I plan to do the same for enemies' stat blocks, various procedural generation tables, etc. I also use Prolog to typeset the ASCII-styled rulebook, but that's probably not a good application of Prolog.

    You asked about "logic programming" in general and not miniKanren in particular. I haven't actually used miniKanren, so I commented about the logic programming language I've used the most, Prolog. I hope that's not a thread hijack!

    All three of the projects above are basically games. I have more "serious" stuff on my github but I feel a certain shortfall of gravitas, I suppose.

  • louise

    Polynomial-time Meta-Interpretive Learning

    Note you can do machine learning of logic programs. My PhD research:

    https://github.com/stassa/louise

    In which case it _is_ machine learning and it still really works :D

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts