# Tools for logic programming in OCaml

**URL:** <https://discuss.ocaml.org/t/tools-for-logic-programming-in-ocaml/2126>\
**Category:** Ecosystem\
**Tags:** logic, logic-programming\
**Created:** [June 11, 2018, 9:19pm UTC](https://discuss.ocaml.org/t/tools-for-logic-programming-in-ocaml/2126 "2018-06-11T21:19:49Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![egoholic](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/egoholic/32/574_2.png) [@egoholic](https://discuss.ocaml.org/u/egoholic)\
**Post date:** [June 11, 2018, 9:19pm UTC](https://discuss.ocaml.org/t/tools-for-logic-programming-in-ocaml/2126/1 "2018-06-11T21:19:49Z")

</div>

I have no experience with logic programming (LP) and I have no time and reason to learn Prolog or other language that are canonical in the area of LP. By the way I’m very interested in the topic of LP and related paradigms. Could you please mention some OCaml libraries for logic programming and related things?

---

<div class="post-metadata">

**Author:** ![dariusf](https://avatars.discourse-cdn.com/v4/letter/d/f07891/32.png) [@dariusf](https://discuss.ocaml.org/u/dariusf)\
**Post date:** [June 12, 2018, 5:33am UTC](https://discuss.ocaml.org/t/tools-for-logic-programming-in-ocaml/2126/2 "2018-06-12T05:33:12Z")

</div>

Check out [https://github.com/c-cube/choice](https://github.com/c-cube/choice). It’s based on the LogicT library/paper (worth a read), which is closely related to miniKanren. The ideas are similar in that you construct nondeterministic programs by manipulating streams of solutions.

---

<div class="post-metadata">

**Author:** ![dbuenzli](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/dbuenzli/32/18_2.png) [@dbuenzli](https://discuss.ocaml.org/u/dbuenzli)\
**Post date:** [June 12, 2018, 9:08am UTC](https://discuss.ocaml.org/t/tools-for-logic-programming-in-ocaml/2126/3 "2018-06-12T09:08:34Z")

</div>

For a minimal typed μKanren implementation you can have a look at [`rel`](https://github.com/dbuenzli/rel) a more powerful implementation is provided by [`ocanren`](https://github.com/dboulytchev/OCanren) (but wanders a bit too much on the `Obj` side for my taste).

---

<div class="post-metadata">

**Author:** ![th3rac25](https://avatars.discourse-cdn.com/v4/letter/t/ccd318/32.png) [@th3rac25](https://discuss.ocaml.org/u/th3rac25)\
**Post date:** [June 13, 2018, 9:21pm UTC](https://discuss.ocaml.org/t/tools-for-logic-programming-in-ocaml/2126/4 "2018-06-13T21:21:56Z")

</div>

Also [https://github.com/c-cube/datalog](https://github.com/c-cube/datalog), a Datalog implementation

---

<div class="post-metadata">

**Author:** ![Kakadu](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/kakadu/32/1204_2.png) [@Kakadu](https://discuss.ocaml.org/u/Kakadu)\
**Post date:** [June 18, 2018, 10:45am UTC](https://discuss.ocaml.org/t/tools-for-logic-programming-in-ocaml/2126/5 "2018-06-18T10:45:34Z")

</div>

+1 for [OCanren](https://github.com/dboulytchev/OCanren). As a committer to this project I’m curious about opinion of third-party users.
