Useful Prolog references

Useful Prolog references

Note: This is a topic for adding links to useful Prolog information for any one to find.
If you have Trust level: Basic you can add to this list by clicking on the edit icon in the lower right. Capture

Note: Do not reply to this topic; questions, concerns, comments, etc. are to be handled in
Wiki Discussion: Useful Prolog references


SWI-Prolog Contributors

SWI-Prolog Getting Started

SWISH - A popular playground for learning SWI-Prolog online. Only requires an internet browser. If you know Jupyter for Python, then think SWISH for SWI-Prolog.

Prolog Visualizer

StackOverflow Prolog tag contains links to many Prolog implementations and free Prolog books.

Learn Prolog Now is a popular site for learning Prolog.
SO Documentation - Prolog Language
A test variation of Learn Prolog Now using SWISH.
Notes/Answers created by others using LearnPrologNow on GItHub

Using SWI-Prolog’s modules

SO Documentation for Prolog. - StackOverflow had a documentation facet for tags for a while then discontinued it. The documentation Prolog was moved to

Guidelines/Best Practices/Cheat Sheet

Coding Guidelines for Prolog
Prolog Cheat Sheet by Musa Al-hassy
Tips for CHR Programming Compiled by Amira Zaki, Thom Fr¨uhwirth, Jon Sneyers
s(ASP) & s(CASP) Best Practices

Newsletter (Free)

Association for Logic Programming



The Power of Prolog is a great online book (with some video links) explaining prolog from the ground up, including DCGs and Constraint Logic Programming; it is very good.
Simply Logical: Intelligent Reasoning by Example
By George F. Luger (site)


“The Art of Prolog” By Leon S. Sterlingand and Ehud Y. Shapiro (site) (free pdf)
“Prolog and Natural-Language Analysis” by Fernando C. N. Pereira and Stuart M. Shieber (site) (free pdf)
Covingon, Michael (1997). Prolog Programming in Depth (pdf) (source code)
Covingon, Michael (1994) Natural Language Processing for Prolog Programmers (pdf) (source code)
Spivey, Michael (1996) Introduction to Logic Programming Through Prolog (link)


(Ordered by skill level from beginner to expert)

Prolog Programming for Artificial Intelligence (4th Edition) by Ivan Bratko (WorldCat)
Programming in Prolog by W F Clocksin and C S Mellish (WorldCat)
The Art of Prolog - advanced programming techniques by Leon S Sterling, Ehud Y Shapior and David H D Warren (WorldCat)
The Craft of Prolog by Richard A O`Keefe (WorldCat)


Free Programming Books - Prolog

Non-book resources


Markus Triska’s YouTube channel “The Power of Prolog” which go together with the site “The Power of Prolog”. Starting with “Logical Foundations of Prolog”:

The Stanford Encyclopedia of Philosophy has excellent overview articles:


Lecture Notes - An Introduction to Prolog Programming by Ulle Endriss (pdf)

Prolog reference manuals

Often contain useful examples

SWI-Prolog (HTML)
SICStus Prolog (HTML, PDF)
Quintus Prolog (HTML, PDF)
Ciao (HTML)
ECLiPSe (HTML, PDF links on page)
GNU Prolog (HTML, PDF)
Barry’s Prolog (PDF)
IF/Prolog (PDF)
Picat (PDF|HTML)
B-Prolog (PDF)
Logtalk (HTML, other formats)
ProbLog (HTML)

Sites hosting research papers for download


Professional organizations

require membership fee

Sites hosting bibliography

  • DBLP - The dblp computer science bibliography provides open bibliographic information on major computer science journals and proceedings.

Searching Internet for research papers - tips

  1. Add pdf as a keyword as it dramatically improves finding the paper if it is indexed by the search engine and avialble as a PDF.
  2. Some times the paper is not indexed by a search engine because the paper is stored on the public site of a professor but robots.txt excludes indexing personal pages. So if you know the author(s), go to their school site, search for the author, find their personal pages and manually search them. This has a low probably of working, but does sometimes work when Google or such fails.

SWI-Prolog predicate documentation

The SWI-Prolog library

Example: append/3

To see the source code for a specific predicate click on image (link)

Locating a library with a specific book

WorldCat - If you fill in your location on the page, it will show libraries near you where the book can be found, includes university libraries. Also includes places where you can purchase the book if desired, including out of print and used books.


Publications about SWI-Prolog
Unification theory
Intro to Web Prolog for Erlangers
Logical Loops
Use of Prolog for developing a new programming language and A History of the Erlang VM
Negation as failure
Definite Clause Grammars for Language Analysis --A Survey of the Formalism and a Comparison with Augmented Transition Networks
The Computational Power and Complexity of Constraint Handling Rules by Jon Sneyers, Tom Schrijvers, and Bart Demoen
On the Performance of Bytecode Interpreters in Prolog by Philipp K¨orner, David Schneider and Michael Leuschel


SWI-Prolog Built-in Predicates
SWI-Prolog Library
SWI-Prolog Packages
SWI-Prolog Packs

pengines 0.1.8 - A simple python library for interacting with SWI-Prologs Pengines - Note: This is not the more common use of the word Pengines.

Code repositories

RosettaCode has examples of lots of simple programming task implemented in many programming languages. If you know one programming language, you can often find the same implementation in another language. Prolog tasks.


Listing of all GitHub repositories with Prolog Code (ref)

Individuals by alphabetical order of last name

GitHub repositories by Samer Abdallah
GitHub repositories by Wouter Beek
GitHub repositories by Carlo Capelli
GitHub repositories by James Cash
GitHub repositories by Philipp Körner
GitHub repositories by Keri Harris
GitHub repositories by Michael Hendricks
GitHub repositories by Raivo Laanemets
GitHub repositories by Peter Ludemann
GitHub repositories by Edison Mera
GitHub repositories by Douglas R. Miles (TeamSPoon)
GitHub repositories by Falco Nogatz
GitHub repositories by Anne Ogborn
GitHub repositories by Fabrizio Riguzzi
GitHub repositories by Roy Ratcliffe
GitHub repositories by Markus Triska
GitHub repositories by Jan Wielemaker
GitHub repositories by Rick Workman (ridgeworks)
GitHub repositories for Blog-Core
GitHub repositories for The Ciao Programming Language
GitHub repositories for Logtalk by Paulo Moura
GitHub repositories for TerminusDB

Art of Prolog Code - The source code from the book “Sterling, Leon, and Ehud Y. Shapiro. The art of Prolog: advanced programming techniques. MIT press, 1994. APA”, by Noah Evans
Brachylog - is a declarative logic programming language much like Prolog. Brachylog is designed to be much terser than Prolog, while retaining some readability, by Julien Cumin
Embeddable λProlog Interpreter by Enrico Tassi
My SWI-Prolog page (GitHub) by Hakan Kjellerstrand
Learn Prolog Now Exercises by Peter Urbak
The Prolog GraphPlan Project - The Graphplan algorithm is an automatic planning algorithm that can compute, given a set of rules, a plan of action to go from an initial state to a final state, by Pierre Andrews
Toki Pona Parser - A Tool for Spelling, Grammar Check and Ambiguity Check of Toki Pona Sentences, by jan Lope
Thea2 - A collection of modules for parsing and manipulating OWL2 ontologies in Prolog, by Vangelis Vassiliadis
CMU Prolog Repository - This is some very old Prolog code but sometimes older code is easier to understand.
“Public-domain Prolog library” - Another collection of older Prolog code and libraries (1992-2010), by Jocelyn Ireson-Paine



Applications making use of Prolog

Pengines - Web Logic Programming made easy
Pharos Static Binary Analysis Framework (GitHub) (YouTube)
Gerrit Code Review - Uses Prolog for rules
PRESS: PRolog Equation Solving System - A System for Metamodeling and Method Engineering
EYE - Euler Yet another proof Engine (GitHub)


Prolog and Logic Programming Historical Sources Archive - This is a gold mine if you want to see the history of different Prolog implementations with archived code included.


  • The birth of Prolog by Alain Colmerauer and Philippe Roussel (PDF) (1992)
  • History of Logic Programming by Robert Kowalski (page with download link) (2014)
  • 1983–1993: The Wonder Years of Sequential Prolog Implementation by Peter Van Roy (page with download link) (1993)


PceEmacs - SWI-Prolog built-in editor


Visual Studio Code


Prolog Development Tools (ProDT) for the Eclipse IDE

SPIDER, the SICStus Prolog IDE based on Eclipse

Logtalk plugin for IntelliJ IDEA

Howto guides/Tutorial

By Anne Ogborn

By Robert Laing

The above are notes from developing a chess player at and a draughts player at which are still work in progress, so the guides are also improving gradually.

Other Tools

Termination inference - cTI_lt (constraint based termination inference for left termination)

SWI-Prolog Discourse categories


Dictionary of Algorithms and Data Structures
The Stony Brook Algorithm Repository
StackOverflow tag Language Agnostic - Contains Free Language Agnostic Programming Books


Awesome Prolog

Teaching Prolog as first programming language
Newbie‘s most wanted
30 years after having started coding in BASIC-DOS
Algebra in Prolog
Pengines docs
Ann: Paper about Web Prolog (Discussion)
Write A Prolog Rule
Learning resources
Calling Prolog from php
"Hexlife" in SWI Prolog — critique very much welcome!
How to find the best matching fact
Want to understand better how swi prolog works
Named constants?
Understanding Recursion in the Tower of Hanoi solver
Prolog in big projects - industrial scale
Terminology: "true", "entailed", "provable", "holds"
How to use or create AVL tree sets analog to assoc maps?
Please assist me with following SWI complier error?
Tabling the wolf, sheep, cabbage
Prolog Language Server: Enabling swipl integration with Python and other languages
Need Help UnderStanding the Code
Binary trees
What's the connection between Prolog and graph database?
Added Linkify words in post Theme
Added Linkify words in post Theme
Some newbie questions (e.g. how to get at most N solutions, what is template? what is @, :, +, - in arguments)
Stripped out modules, unit test no longer work
Visual Learning Environment
Extending an Imperative Language with Constraint Logic Programming
What happens if Dr. Wielemaker is hit by a van?
Backtracking issue on fail
Improving Wang's algorithm in Prolog
Weighted graphs
Problem with instanciation of list :)
Discourse Table of Contents Theme
Problem with saved state and http_server at Win10
How to set a global value during execution of a predicate
Error "Arguments are not sufficiently instantiated" - Order of the premisses in a rule matter?
Ann; SWI-Prolog 8.3.19
Wiki Discussion: Useful Prolog references
Facts and structures
How do I add variables together?
Best practice for catch/3 with multiple possible errors?
Recursive travel
New Badge, Useful Prolog Reference
Status of mode directed tabling, especially min/max