Example of a compact explanation of key concepts in Prolog?



I am writing a paper that i want to submit to a scientific journal; the preliminary title is “Using Logic Programs to Represent and Infer Knowledge”. In the paper i want to explain some key Prolog concepts very compactly. This is tricky because most of the readers have never heard of Prolog or logic programming.

Does anybody know some good examples from the literature where the authors managed to explain key concepts in Prolog very briefly? The constructs that are (mostly) in focus in my paper are proof search, variables, numbers, atoms, nested compound terms, recursion, maplist, and findall.

EDIT: Added some more details in my post below.

I have seen the Wikipedia text about Prolog and i think it is quite good, but any additional suggestions are welcome!

If this is too off topic in this forum let me know and i’ll delete this post :slight_smile:

Kind regards/JCR

1 Like

Do you need to describe full Prolog or just a subset, such as Datalog?

Here’s one concise description of Prolog, but it requires knowing how Makefiles work: Prolog is make with parameters and logical variables.

I learned SQL by asking someone who knew both Prolog and SQL to translate Prolog queries into SQL (the SQL was inevitably far more complex than the Prolog); nowadays many people know SQL, so perhaps there exists an inverse explanation of Datalog in terms of SQL? (OQL would be a better starting point than SQL because it has a more principled handling of results as sets, which also maps nicely to Prolog’s bagof/setof (and member), but not many people know OQL.)


It is definitely not off topic. What is your audience though and what message do you want to get across?


Thank you Peter.

Sorry, I should have been more specific. The audience will be readers of a scientific journal in a social science discipline, so I can’t assume that they know anything about programming or Prolog. The message i want to get across is that logic programming is ideal for formalizing complex theories and draw inferences from them (to provide answers, suggest hypotheses and so on). In the paper i plan to give a concrete example of this (Prolog code); this involves explaining proof search, variables, numbers, atoms, nested compound terms, recursion, maplist, and findall.

I am aiming for around 3-4 A4 pages (maybe this is impossible).

Sorry about not showing my actual code or giving more details. The reason is that i want to finish and submit the paper first. When i do so i will definitely post here.


This paper might give you some ideas. It doesn’t have complex terms, maplist, findall; but it does give a brief and good description of basic Prolog, why it’s useful for one problem domain, and some of the issues that using Prolog has raised (spoiler alert: lawyers aren’t good programmers or logicians).

1 Like

(I forgot the link): http://opim.wharton.upenn.edu/~sok/papers/s/p370-sergot.pdf
(also, with some other examples: http://www.doc.ic.ac.uk/~rak/papers/law.pdf )

You might also want to look at Adrian Walker’s Syllog or “controlled natural language” (John Sowa).


Thanks for the suggestions!


Have a look at http://www.learnprolognow.org.

1 Like


Thanks to pointing to John Sowa’s paper that is focussed on our Attempto Controlled English (ACE), but is a bit outdated. To learn more about the current state of ACE one should peruse http://attempto.ifi.uzh.ch/site/.

— nef


Thanks for the suggestion!


I stumbled on David Warren’s online book at https://www3.cs.stonybrook.edu/~warren/xsbbook/book.html which helped my understanding of Prolog a lot.

Another treasure trove of free online reading is Robert Kowalski’s http://www.doc.ic.ac.uk/~rak/ which includes a pdf of his classic http://www.doc.ic.ac.uk/~rak/papers/LogicForProblemSolving.pdf


Thanks! Looks interesting.

1 Like