What do people use Prolog for in the real world? I learned about it on a university course and it seems so esoteric compared to other things on the course. Like something invented just for computer scientists to enjoy.

20+ years ago, it was the backend for the business rules engine that processed various logging and monitoring events. The concept was interesting, the performance was terrible, and businesses mostly didn't want to touch it. After I setup clients with a generic set of rules that worked on Prolog facts, most all of my clients were happy to limit their changes to only those fact files.

Not used. Quote about prolog: The elegant solution is not efficient. The efficient solution is not elegant.

There was a neat helicopter landing game written in prolog way back in the day

Some applications were discussed in https://news.ycombinator.com/item?id=40994552

Dunno about Prolog, but Datomic uses datalog for its query language, and it’s excellent. Datalog is a subset of Prolog.

Datalog may appear to be a subset, but it is quite distinct semantically.

What is Datalog used for nowadays?

General programming [0], static analysis [1], RDF triple stores [2], authorization systems [3], incremental computation [4] [5], graph DBs [6]. But it is kind of hard to define Datalog exactly, since it is an entire family of technologies based on logic, each extending a clean mathematical model differently.

[0] https://github.com/flix/flix

[1] https://github.com/rust-lang/polonius

[2] RDFox

[3] https://github.com/eclipse-biscuit/biscuit

[4] https://github.com/vmware-archive/differential-datalog [5] https://github.com/brurucy/pydbsp

[6] https://github.com/cozodb/cozo

Other than databases, program analysis. The polonius borrow checker in rustc uses datalog internally.

But you can use it for lots of things. Whenever I'm frustrated with graph based tools being slow (like build systems), I run the graph through a datalog engine for comparison. It's usually much, much faster.

Datalog is not a subset of Prolog. It looks that way because both are based on Horn clause logic, while Prolog is more expressive.

This loops Prolog, but terminates in Datalog:

p :- p.

p.

?- p.

This is because the underlying mechanism is completely different. Datalog is like SQL with recursion, you start with known facts and repeatedly applies rules to derive all consequences until nothing new appears. In Prolog, you start from the query and works backward through rules until it either finds a proof or fails.

So, Datalog treats Horn clauses as database constraints/inference rules while Prolog treats Horn clauses as a search program. They use the same mathematical substrate, but completely different computational models.

> What do people use Prolog for in the real world?

Here[0] is an example of using Ruby and Prolog to solve a real-world AWS management problem.

0 - https://web.archive.org/web/20190525163234/https://dev.to/da...

That is brilliant and simple and shows that when Graph Databases were a big thing they probably should have used Prolog as a front end.

Everything, you heard the joke about those who don't know Lisp end up reinventing it, well, the same can be said for Prolog.

You can implement Prolog in Lisp trivially:

https://t3x.org/lisp64k/prolog.html

The linked code runs in this: Unix, DOS and CP/M

https://t3x.org/klisp/index.html

It will compile for CP/M and DOS (Turbo C), Unix, Windows and whatnot.

64k Lisp:

https://t3x.org/lisp64k/index.html

Zenlisp it's similar but almost gives an intro CS course (pre SICP) for the cheap implementing discrete Math and tons of stuff in pure Lisp, even rational and complex numbers. The end chapter it's about logic programmer of course.

https://t3x.org/zsp/index.html

One doesn’t simply create a Warren Abstract Machine by accident

no, first one goes down some wrong avenues before backtracking

[deleted]