Fork me on GitHub

miniKanren.org

Twitter: @miniKanren    Github: @miniKanren    Google Group: miniKanren    IRC: irc.freenode.net, #minikanren


Next Google Hangout on Air: Sunday, May 26, 2013, 4-6pm EDT.  (URL to be posted at beginning of hangout)
Book | Implementations | Projects | Upcoming Talks | Talks | Tutorials | Theses | Papers | Screencasts | Weekly Hangouts | Podcasts | Blogs | Contact

What is miniKanren?

miniKanren is an embedded Domain Specific Language for logic programming.

The core miniKanren language is very simple, with only three logical operators and one interface operator.

miniKanren has been implemented in a growing number of host languages, including Scheme, Racket, Clojure, Haskell, Python, and Ruby.

miniKanren is designed to be easily modified and extended; extensions include Constraint Logic Programming,
probabilistic logic programming, nominal logic programming, and tabling.

The Book

Daniel P. Friedman, William E. Byrd and Oleg Kiselyov
The Reasoned Schemer
The MIT Press, Cambridge, MA, 2005

source code from the book

The Reasoned Schemer front cover

Implementations

Scheme

miniKanren

cKanren
miniKanren extended with Constraint Logic Programming (CLP), as described in the 2011 Scheme Workshop paper.

slpKanren
Stochastic Logic Programs (SLP) style probabilistic logic programming in miniKanren.

sokuza-kanren
Oleg Kiselyov's minimal implementation of logic programming.

Racket

miniKanren Racket port

Clojure

core.logic

Haskell

Molog

HaskellKanren (HK)

MiniKanrenT

Scala

minikanren-scala

Python

pykanren

pythological

JavaScript

lolkanren

jolic

CoffeeScript

Friebyrd

Ruby

mini_kanren

Mímir experimental rules engine

mímirKanren

Projects using miniKanren or core.logic

core.logic

webdriver-logic
Logic programming API for testing web applications using clj-webdriver.
Clojure/conj 2012 talk

damp.ekeko
Ekeko enables querying and manipulating an Eclipse workspace using applicative logic programs.
anouncement
screencast

peano
Using logic programming (Clojure's core.logic) for test data manipulation and generation.

kibit
kibit is a static code analyzer for Clojure which uses core.logic to search for patterns of code for which there might exist a more idiomatic function or macro.

parsing-packet-with-logic
A small experiment in parsing packets in a style similar to Erlang's <<...>> using core.logic.

maze.logic
Solving mazes using core.logic.

Monotony
Monotony is a solution to the problem of how to schedule things in a way that humans find intuitive.

QWAL
QWAL is a path expression library to allow querying graphlike structures using core.logic in Clojure.

FunnyQT
FunnyQT is a model querying and transformation library.

The core.logic wiki contains links to additional projects using core.logic.

Upcoming Talks

Strange Loop, St. Louis, September, 2013
Daniel P. Friedman and William E. Byrd
A Relational Exploration of the Chomsky Hierarchy

Recorded Talks

miniKanren

William E. Byrd and Daniel P. Friedman
Fun with Relational Interpreters in miniKanren
flatmap 2013, Oslo, Norway, May 14, 2013 (keynote).
(Video coming soon!)

William E. Byrd and Daniel P. Friedman
miniKanren Philosophy
Clojure/conj 2012, Raleigh, NC, November 16, 2012.
(Beware the pink tint!)

Daniel P. Friedman and William E. Byrd
Relational Programming in miniKanren
Strange Loop 2012, St. Louis, MO, September 24, 2012
source code

Daniel P. Friedman and William E. Byrd
miniKanren "untalk"
Clojure/conj 2011, Raleigh, NC, November 10, 2011.

core.logic

David Nolen
The Refined Clojurist
Clojure Exchange 2012, London, December 6, 2012

Daniel Gregoire
Web Testing with Logic Programming
Clojure/conj 2012, Raleigh, NC, November 17, 2012.
webdriver-logic project

Steve Miner
Challenges for Logic Programming
Clojure/conj 2012, Raleigh, NC, November 17, 2012.

Edmund Jackson
An Introduction to Logic Programming on the JVM with core.logic (Clojure)
FP Days 2012, Cambridge, October 25, 2012

David Nolen
core.logic: A tutorial reconstruction ("unsession")
Strange Loop 2012, St. Louis, MO, September 24, 2012

Edmund Jackson
core.logic.intro
EuroClojure 2012, London, May 24, 2012
source code

Ryan Senior
Practical core.logic
Clojure/West 2012, San Jose, March 17, 2012 March 2012

Ambrose Bonnaire-Sergeant
Introduction to Logic Programming with Clojure
Clojure/conj 2011, Raleigh, NC, November 10, 2011.

Clojure/West Confo, Portland, OR, March 19, 2013 (associated with Clojure/West)

(Videos coming soon!)

Gabriel Pickard
Logic programming in the wild

Ryan Senior
Intro to CLP with core.logic

Adam Foltzer
Molog: Typed Functional Logic Programming in Haskell
source code

David Nolen
The Architecture of core.logic

Nada Amin
core.logic.nominal
source code

William E. Byrd and Daniel P. Friedman
The Unreasonable Schemers
source code

Written Tutorials

core.logic

Introduction to Logic Programming with Clojure

A Core.logic Primer

Logic Programming for the Social Web

Theses

PhD

William E. Byrd
Relational Programming in miniKanren: Techniques, Applications, and Implementations.
Indiana University, Bloomington, IN,
September 30, 2009.

Undergraduate Honors

Ramana Kumar
Mechanising Aspects of miniKanren in HOL
Australian National University, Canberra, Australian Capital Territory, Australia,
May 2010.

Papers

William E. Byrd, Eric Holk, and Daniel P. Friedman.
miniKanren, Live and Untagged: Quine Generation via Relational Interpreters (Programming Pearl).
To appear in the Proceedings of the 2012 Workshop on Scheme and Functional Programming, Copenhagen, Denmark, 2012.
Complete source code (Scheme)

Claire E. Alvis, Jeremiah J. Willcock, Kyle M. Carter, William E. Byrd, and Daniel P. Friedman. 
cKanren: miniKanren with Constraints.
In Proceedings of the 2011 Workshop on Scheme and Functional Programming (Scheme '11), Portland, OR, 2011.
Complete source code (R6RS Scheme)

Ramana Kumar and Michael Norrish
(Nominal) unification by recursive descent with triangular substitutions
In Proceedings of the First international conference on Interactive Theorem Proving (ITP'10),
Springer-Verlag Berlin, pp. 51-66, 2010.

Andrew W. Keep, Michael D. Adams, Lindsey Kuper, William E. Byrd, and Daniel P. Friedman.
A Pattern-matcher for miniKanren -or- How to Get into Trouble with CPS Macros.
In Proceedings of the 2009 Workshop on Scheme and Functional Programming,
Cal Poly Technical Report CPSLO-CSC-09-03, pp. 37-45, 2009.

Joseph P. Near, William E. Byrd and Daniel P. Friedman.
alphaleanTAP: A Declarative Theorem Prover for First-Order Classical Logic.
In Proceedings of the 24th International Conference on Logic Programming (ICLP 2008),
LNCS vol. 5366, Springer-Verlag, Heidelberg, pp. 238-252, 2008.
Complete source code--R6RS Scheme and Prolog (.zip file)

Oleg Kiselyov, William E. Byrd, Daniel P. Friedman and Chung-chieh Shan
Pure, declarative, and constructive arithmetic relations (declarative pearl).
In Proceedings of the 9th International Symposium on Functional and Logic Programming,
ed. Jacques Garrigue and Manuel Hermenegildo, pp. 64-80.
LNCS vol. 4989, Springer, 2008.

William E. Byrd and Daniel P. Friedman
alphaKanren: A Fresh Name in Nominal Logic Programming.
In Proceedings of the 2007 Workshop on Scheme and Functional Programming,
Universite Laval Technical Report DIUL-RT-0701, pp. 79-90.
Authors' revised version (recommended)
Revised source code (R5RS Scheme)

William E. Byrd and Daniel P. Friedman
From Variadic Functions to Variadic Relations: A miniKanren Perspective.
In Proceedings of the 2006 Scheme and Functional Programming Workshop,
University of Chicago Technical Report TR-2006-06, 2006, pp. 105-117.

Oleg Kiselyov, Chung-chieh Shan, Daniel P. Friedman, and Amr Sabry
Backtracking, interleaving, and terminating monad transformers: (functional pearl).
In Proceedings of the 10th ACM SIGPLAN International Conference on Functional Programming (ICFP '05),
ACM Press, New York, pp. 192-203, 2005.

Screencasts

Thomas G. Kristensen
Composing music using core.logic and Overtone - The Composing Schemer
blog post
source code
January 2013.

Timothy Baldridge
Bytecode Assembler in Core.Logic
related blog post
Dec 13, 2012.

Coen De Roover
Getting started querying an Eclipse workspace using Ekeko
ekeko project
August 14, 2012.

Weekly Google Hangout on Air

Upcoming Hangouts

(Due to technical limitations of Hangouts on Air, the URL will be posted at the beginning of the the hangout.)

Hangout #10, Sunday, May 26, 2013, 4-6pm EDT.
Topic: TBA

Previous Hangouts

Hangout #9, Sunday, May 19, 2013.
Topic: Will shows off a meta-circular interpreter for miniKanren (code), and describes the outline for a new book he is writing on relational programming (book).

Hangout #8, Sunday, May 5, 2013.
Topic: Dan and Jason show off a cool way to implement mutual recursion in an interpreter. Will and the gang then live-code a relational interpreter for general Deterministic Finite Automata (code).

Hangout #7, Sunday, April 28, 2013.
Topic: Translating simple Scheme functions to miniKanren using correctness-preserving transformations.

Hangout #6, Sunday, April 21, 2013.
Topic: Live coding/real-time solution of a simple problem solved by Michael. Also, Claire discusses new features of cKanren in Racket.

Hangout #5, Sunday, April 14, 2013.
Topic: Stump the Chump! Will partially translates miniKanren's unify function from Scheme into miniKanren (code). Also, discussion of extra-logical operators, and new miniKanren features in progress: CLP(Set), constraint handling rules, lazy constraints for recursion.

Hangout #4, Sunday, April 7, 2013.
Topic: Debugging miniKanren programs; Constraint Logic Programming over sets (based on the paper Sets and Constraint Logic Programming by Dovier, et al., 2000).

Hangout #3, Sunday, March 31, 2013.
Implementation of simplified miniKanren (source code).

Hangout #2, March 24, 2013.
Implementing disequality constraints, absento/presento constraints, miniKanren Confo at Clojure/West, relational CESK machine.

Hangout #1, March 10, 2013.
A little miniKanren history, what it means to be relational, a relational variant of copy-term, debugging miniKanren programs.

Podcasts

Mostly lazy... a Clojure podcast
Episode 9 with Kevin Lynagh and Paul deGrandis: web dev ennui, CRDTs, and core.logic
Recorded December 14th, 2012.

Blogs

David Nolen - dosync

The Simply Typed Lambda Calculus in 20 Lines Redux

From David Nolen's old blog:

Know Your Bounds
friendlier
sudoku
A Logic Programming Reading List
Logic Programming & JavaScript
core.logic & VPRI STEPS
Another Taste of cKanren
A Taste of cKanren
Simple Type Inference For The Simply Typed Lambda Calculus in ~20 Lines
Logos -> core.logic
Crazy Ideas
Fun
Spring Cleaning
Simple Constraints
~2.1ms
Tabling in Logos
Pattern Matching
Finally ... a clue
Performance Matters
Faster Unification
Logic Programming and Performance
A Short Break
Life Without Tail Call Optimization
Announcing Logos
A miniKanren introduction via Clojure

Clojure & lx

Finite State Machines in core.logic
lx in core.logic #2: Jumps, Flexible Transitions and Parsing
lx in core.logic #3: Finite State Transducers
Another Logic Programming Reading List

Timothy Baldridge - (apply clojure @life)

Bytecode Assembler in Core.Logic
Byte Packing with core.logic

Thomas G. Kristensen - Clojure/tgk

The Composing Schemer
Finding cliques in graphs using core.logic
Maximum cliques algorithm in Clojure

Edmund Jackson - boss level

mini-Sudoku in mini-Kanren (in Clojure-"ish")
Logic Programming Part 3 (List Logic)
Logic Programming Part 2 (Building Blocks)
Logic Programming Part 1

clojure.com - Clojure/core (posts by Stuart Sierra)

Lojic Part Two
Lojic Part One

Jim Duey - A Clojure Story

More Core.logic
Messin With Core.logic

Christophe Grand - Clojure and me

Fair conjunction: status report
The Reasoned Scheduler

Ryan Senior - Object Commando

The Magical Island of Kanren - core.logic Intro Part 1
Appendo the Great

Martin Trojer

Some core.logic graph code
cKanren time!
Replicating Datomic/Datalog queries with core.logic, take 2
Replicating Datomic/Datalog queries with core.logic
N-Queens with core.logic, take 2
N-Queens with core.logic, take 1

Tim Yates

Using Clojure and core.logic from Groovy

Atomic Object - Atomic Spin

miniKanren in Haskell
The First Time Programming Scared Me

Lindsey Kuper

Generating tautologies with miniKanren

JR Heard

Explorations in Clojure's core.logic

Contact

This site is maintained by Will Byrd: webyrd@gmail.com.

Thanks to Shantanu Kumar, Martin Trojer, and Gergely Nagy for improving the site by submitting a pull request.