# Logic programming, Bayesian programming, Deep Learning and Julia

**URL:** https://discourse.julialang.org/t/logic-programming-bayesian-programming-deep-learning-and-julia/24714
**Category:** Community
**Created:** [May 29, 2019, 5:44am UTC](https://discourse.julialang.org/t/logic-programming-bayesian-programming-deep-learning-and-julia/24714 "2019-05-29T05:44:03Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![XVilka](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/xvilka/32/7155_2.png) [@XVilka](https://discourse.julialang.org/u/XVilka)
#### Post date: [May 29, 2019, 5:44am UTC](https://discourse.julialang.org/t/logic-programming-bayesian-programming-deep-learning-and-julia/24714/1 "2019-05-29T05:44:03Z")

</div>

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](https://dtai.cs.kuleuven.be/problog/) was created as a logic programming engine with every rule attached with probability. It looks something like that:

```nohighlight
0.7::burglary.
0.2::earthquake.
0.9::p_alarm1.
0.8::p_alarm2.
0.1::p_alarm3.

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

evidence(alarm,true).

query(burglary).
query(earthquake).

```

It is open source and has a [Bitbucket repository](https://bitbucket.org/problog/problog). And according to the authors it is used in [PheNetic](http://bioinformatics.intec.ugent.be/phenetic) and [Biomine](https://www.cs.helsinki.fi/u/htoivone/pubs/problog_biomine.pdf).

Then authors decided to go even further, and to integrate ProbLog with Deep Learning - this is when [DeepProbLog](https://bitbucket.org/problog/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](https://bitbucket.org/problog/deepproblog/src/c8bbdb5d2da212179f2a128690af7286339b9864/examples/NIPS/MNIST/):

```nohighlight
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.

---

<div class="post-metadata">

### Author: ![rayegun](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rayegun/32/26729_2.png) [@rayegun](https://discourse.julialang.org/u/rayegun)
#### Post date: [June 19, 2019, 8:50pm UTC](https://discourse.julialang.org/t/logic-programming-bayesian-programming-deep-learning-and-julia/24714/2 "2019-06-19T20:50:51Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![Xuan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/xuan/32/22100_2.png) [@Xuan](https://discourse.julialang.org/u/Xuan)
#### Post date: [January 4, 2020, 1:28am UTC](https://discourse.julialang.org/t/logic-programming-bayesian-programming-deep-learning-and-julia/24714/3 "2020-01-04T01:28:05Z")

</div>

I recently wrote this [Prolog(-like) interpreter in Julia](https://github.com/ztangent/FOL.jl), with the hope of eventually using it together with the [Gen probabilistic programming library](https://github.com/probcomp/Gen) 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! 🙂

---

<div class="post-metadata">

### Author: ![mohamed82008](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mohamed82008/32/18171_2.png) [@mohamed82008](https://discourse.julialang.org/u/mohamed82008)
#### Post date: [January 4, 2020, 1:59am UTC](https://discourse.julialang.org/t/logic-programming-bayesian-programming-deep-learning-and-julia/24714/4 "2020-01-04T01:59:03Z")

</div>

Very cool!

---

<div class="post-metadata">

### Author: ![stustd](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stustd/32/21430_2.png) [@stustd](https://discourse.julialang.org/u/stustd)
#### Post date: [January 5, 2020, 5:33pm UTC](https://discourse.julialang.org/t/logic-programming-bayesian-programming-deep-learning-and-julia/24714/5 "2020-01-05T17:33:02Z")

</div>

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](https://www.google.com/search?&q=%22relational+programming%22&oq=%22relational+programming)

[Minikanren](https://www.google.com/search?&q=minikanren&oq=Minikanren)

[Minikanren in Julia](https://www.google.com/search?&q=minikanren&oq=Minikanren+Julia)

---

<div class="post-metadata">

### Author: ![XVilka](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/xvilka/32/7155_2.png) [@XVilka](https://discourse.julialang.org/u/XVilka)
#### Post date: [January 8, 2020, 5:51am UTC](https://discourse.julialang.org/t/logic-programming-bayesian-programming-deep-learning-and-julia/24714/6 "2020-01-08T05:51:10Z")

</div>

Could you please provide cleaner links?

Just a heads up - the original ProbLog [moved to GitHub repository now](https://github.com/ML-KULeuven/problog/).
