Logic programming, Bayesian programming, Deep Learning and Julia

Despite ubiquitous ML/DL/RL/whatever AI algorithms and tooling presence, some domains still continue to use the old school logic programming. Many heard horror stories about Prolog and its forgotten magicians. You would be surprised, that recent developments in mathematics, systems programming, genetics and bioinformatics pushed the boundary of pure AI and offered a hybrid approach. At first, ProbLog was created as a logic programming engine with every rule attached with probability. It looks something like that:


alarm :- burglary, earthquake, p_alarm1.
alarm :- burglary, \+earthquake, p_alarm2.
alarm :- \+burglary, earthquake, p_alarm3.



It is open source and has a Bitbucket repository. And according to the authors it is used in PheNetic and Biomine.

Then authors decided to go even further, and to integrate ProbLog with Deep Learning - this is when DeepProbLog was created. It effectively allows you to combine probabilistic logic reasoning along with a facts inference by a neural network. For example see the MNIST addition primer:

nn(mnist_net,[X],Y,[0,1,2,3,4,5,6,7,8,9]) :: digit(X,Y).

addition(X,Y,Z) :- digit(X,X2), digit(Y,Y2), Z is X2+Y2.

The problem is - it is written in Python and not as fast as might have been. I think it might be beneficial for Julia community to work along these lines too, consider implementing similar system, or somehow be inspired by this work. Hope you enjoy the read and will be interested in exploring more of these depths.


Specifically w.r.t. the logic programming, it’d be very interesting to create a JuMP like frontend for some solvers, like SAT solvers, ASP solvers, SMT, etc. That would be a great starting interface to be extended with Julia implementations and interfaces with other important optimization/math/dl/logic packages. A JuliaLogic org, like we have for bio, optimization, etc would be fantastic.

Julia is well suited to a lot of these solver technologies too since it’s far less verbose than the usual C/C++ solvers are implemented in, and what speed you lose will be more than made up for in readability and flexibility.


I recently wrote this Prolog(-like) interpreter in Julia, with the hope of eventually using it together with the Gen probabilistic programming library to do Bayesian inductive logic programming. It wouldn’t be quite the same thing as ProbLog (which only allows for Bernoulli and noisy-OR distributions, to my knowledge), but it’d be very cool if others would like to build on top of that interpreter and implement something ProbLog-like! :slight_smile:


Very cool!

1 Like

It would be nice to generalize beyond causality (i.e. information direction) enforced (e.g. first order logic) programming and start with relational logic/programming. See e.g.

Relational programming


Minikanren in Julia

Could you please provide cleaner links?

Just a heads up - the original ProbLog moved to GitHub repository now.

1 Like