Deep, generative logic programming.
Sherlog is a logic programming language with value introductions that supports differentiable functions and probability distributions (both discrete and continuous).
For further examples, see the ./examples directory.
SherLog is constructed as the union of three separate sub-components:
- The externally-guarded generative logic programming core, Watson (
./lib/watson), - A translation layer converting problem files to Watson programs and the resulting abducted obligations to generative models (
./lib/sherlog), - And a host of inference techniques built around the produced generative models (
./sherlog).
Sub-components 1. and 2. are implemented in OCaml for speed. Sub-component 3. is implemented in Python so as to stand on the shoulders of PyTorch. Communication is handled through JSON serialization sent via a local network socket.
This section assumes you have the latest versions of OPAM (installation instructions here) and Python.
Just run make.
First, we can install the OCaml core with opam install .. This will install the executables sherlog-interpreter and sherlog-server in the default OPAM installation path (by default, at ~/.opam/default/bin); either run opam init to add the installation path to your path in your shell configuration file, or run eval $(opam env) to add the path temporarily.
Next, we can install the SherLog Python interface by running python3 -m pip install .. We recommend doing so in a virtual environment.
Open a Python interpreter and import sherlog to get started. Additionally, the OPAM build process installs sherlog-interpreter and sherlog-server: run them to see their command-line arguments.