Wiki | 2023-07-17 14:54:43 UTC | #1
Excerpt: Are you new to Prolog? Do you need more information related to Prolog? Do you need a memory jog to get an idea related to SWI-Prolog out of the attic of your brain? Then you have come to right place. # 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](https://blog.discourse.org/2018/06/understanding-discourse-trust-levels/): [Basic](https://swi-prolog.discourse.group/badges/1/basic) you can add to this list by clicking on the edit icon in the lower right. ![Capture|65x31](upload://rn12EgPXJSxwrNPzfZeIZYq83zd.png) > Note: Do not reply to this topic; questions, concerns, comments, etc. are to be handled in > [Wiki Discussion: Useful Prolog references](https://swi-prolog.discourse.group/t/wiki-discussion-bug-hunting-toolbox/711) ## References SWI-Prolog [Contributors](https://www.swi-prolog.org/Contributors.html) SWI-Prolog [Getting Started](https://www.swi-prolog.org/GetStarted.html) [SWISH](https://swish.swi-prolog.org) - A popular playground for learning SWI-Prolog online. Only requires an internet browser. If you know [Jupyter](https://jupyter.org/try) for Python, then think SWISH for SWI-Prolog. StackOverflow [Prolog tag](https://stackoverflow.com/tags/prolog/info) contains links to many Prolog implementations and free Prolog books. [Learn Prolog Now](http://www.learnprolognow.org/) is a popular site for learning Prolog. SO Documentation - [Prolog Language](https://sodocumentation.net/prolog) A [test variation](https://lpn.swi-prolog.org/lpnpage.php?pageid=online) of Learn Prolog Now using SWISH. [Notes/Answers](https://github.com/search?q=learn+prolog+now) created by others using LearnPrologNow on GItHub Prolog Visualizer ([Site](https://cdglabs.github.io/prolog-viz/#/)) ([GitHub](https://github.com/cdglabs/prolog-viz)) Note: Do the tutorial as some of the query syntax is slightly different than normal Prolog syntax. [Using SWI-Prolog's modules](https://chiselapp.com/user/ttmrichter/repository/gng/doc/trunk/output/tutorials/swiplmodtut.html) SO Documentation for Prolog. - StackOverflow had a documentation facet for tags for a while then discontinued it. The documentation Prolog was moved to https://sodocumentation.net/prolog ## Guidelines/Best Practices/Cheat Sheet [Coding Guidelines for Prolog](https://arxiv.org/pdf/0911.2899.pdf) [Prolog Cheat Sheet](https://github.com/alhassy/PrologCheatSheet/blob/master/CheatSheet.pdf) by Musa Al-hassy [Tips for CHR Programming](https://dtai.cs.kuleuven.be/CHR/files/CHR_cheatsheet.pdf) Compiled by Amira Zaki, Thom Fr¨uhwirth, Jon Sneyers [s(ASP) & s(CASP) Best Practices](https://personal.utdallas.edu/~gupta/courses/lp/SCASP-best-practices.pdf) ## Newsletter (Free) [Association for Logic Programming](https://www.cs.nmsu.edu/ALP/) ## Books ### Online * [The Power of Prolog](https://www.metalevel.at/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](https://book.simply-logical.space/) By George F. Luger ([site](https://www.cs.unm.edu/~luger/)) ### PDF * "Prolog and Natural-Language Analysis" by Fernando C. N. Pereira and Stuart M. Shieber ([site](http://www.mtome.com/Publications/PNLA/pnla.html)) (free [pdf](http://www.mtome.com/Publications/PNLA/prolog-digital.pdf)) Covingon, Michael (1997). * "Prolog Programming in Depth" ([pdf](http://www.covingtoninnovations.com/books/PPID.pdf)) ([source code](http://www.covingtoninnovations.com/books/PPID-programs.zip)) Covingon, Michael (1994) * "Natural Language Processing for Prolog Programmers" ([pdf](http://www.covingtoninnovations.com/books/NLPPP.pdf)) ([source code](http://www.covingtoninnovations.com/books/NLPPP-programs.zip)) Spivey, Michael (1996) * "Introduction to Logic Programming Through Prolog" ([site](https://spivey.oriel.ox.ac.uk/corner/An_introduction_to_logic_programming_through_Prolog)) (free [pdf](https://spivey.oriel.ox.ac.uk/wiki/files/logprog/logic.pdf)) * "Formal Syntax and Semantics of Programming Languages" by Kenneth Slonneger and Barry L. Kurtz (free [pdf](http://homepage.divms.uiowa.edu/~slonnegr/plf/Book/Title.pdf)) * "Simply Logical - Intelligent Reasoning by Example" by Peter Flach (free [pdf](http://people.cs.bris.ac.uk/~flach/SL/SL.pdf)) ([site](http://people.cs.bris.ac.uk/~flach/SimplyLogical.html)) * "Logic for Problem Solving" by Robert Kowalski (free [pdf](https://www.doc.ic.ac.uk/~rak/papers/LFPScommentary.pdf)) ### Classics (Ordered by skill level from beginner to expert) *Prolog Programming for Artificial Intelligence* (4th Edition) by Ivan Bratko ([WorldCat](http://www.worldcat.org/oclc/1090366230)) *Programming in Prolog* by W F Clocksin and C S Mellish ([WorldCat](http://www.worldcat.org/oclc/51752491)) *The Art of Prolog - advanced programming techniques* by Leon S Sterling, Ehud Y Shapior and David H D Warren ([WorldCat](http://www.worldcat.org/oclc/837861643)) *The Craft of Prolog* by Richard A O`Keefe ([WorldCat](http://www.worldcat.org/oclc/1024831685)) ### Free Free Programming Books - [Prolog](https://github.com/EbookFoundation/free-programming-books/blob/master/books/free-programming-books-langs.md#prolog) ## Non-book resources ### Sites Markus Triska's YouTube channel ["The Power of Prolog"](https://www.youtube.com/channel/UCFFeNyzCEQDS4KCecugmotg) which go together with the site ["The Power of Prolog"](https://www.metalevel.at/prolog). Starting with "Logical Foundations of Prolog": - [Logic](https://www.youtube.com/watch?v=nlTZQ0FF2Eo) - [Predicate Logic](https://www.youtube.com/watch?v=PCO3lzGfU90) - [Horn Clauses](https://www.youtube.com/watch?v=hgw59_HBU2A) The [Stanford Encyclopedia of Philosophy](https://plato.stanford.edu) has excellent overview articles: - [Classical Logic](https://plato.stanford.edu/entries/logic-classical/) - [Automated Reasoning](https://plato.stanford.edu/entries/reasoning-automated/) - ...and thereunder [Logic Programming](https://plato.stanford.edu/entries/reasoning-automated/#LogPro) - [Visualizing SEP](https://www.visualizingsep.com) is an interactive visualization and search engine for exploring the Stanford Encyclopedia of Philosophy beautifully and powerfully. ### PDFs Lecture Notes - An Introduction to Prolog Programming by Ulle Endriss ([pdf](https://staff.fnwi.uva.nl/u.endriss/teaching/prolog/prolog.pdf)) ## Prolog reference manuals Often contain useful examples SWI-Prolog ([HTML](https://www.swi-prolog.org/pldoc/doc_for?object=root)) SICStus Prolog ([HTML](https://sicstus.sics.se/sicstus/docs/latest4/html/sicstus.html/), [PDF](https://sicstus.sics.se/sicstus/docs/latest4/pdf/sicstus.pdf)) Quintus Prolog ([HTML](https://quintus.sics.se/isl/quintus/html/quintus/), [PDF](https://quintus.sics.se/isl/quintus/pdf/quintus.pdf)) Ciao ([HTML](https://ciao-lang.org/documentation.html)) YAP ([HTML](https://www.dcc.fc.up.pt/~vsc/yap/)) ECLiPSe ([HTML](https://eclipseclp.org/doc/), PDF links on page) GNU Prolog ([HTML](http://gprolog.org/manual/gprolog.html), [PDF](http://gprolog.org/manual/gprolog.pdf)) Barry’s Prolog ([PDF](https://barrywatson.se/download/manual.pdf)) IF/Prolog ([PDF](https://web.archive.org/web/20140908054146/http://www.ifcomputer.de/dateien/refman.pdf)) Picat ([PDF](http://picat-lang.org/download/picat_guide.pdf)|[HTML](http://retina.inf.ufsc.br/picat_guide/)) B-Prolog ([PDF](http://www.picat-lang.org/bprolog/download/manual.pdf)) Logtalk ([HTML](https://logtalk.org/manuals/index.html), [other formats](https://logtalk.org/documentation.html)) ProbLog ([HTML](https://problog.readthedocs.io/en/latest/)) Scryer Prolog ([HTML](https://www.scryer.pl/)) ## Sites hosting research papers for download ### Free * [CiteSeerX](http://citeseerx.ist.psu.edu/index) * [arXiv.org](https://arxiv.org/) * [Google Scholar](https://scholar.google.com/) * [Microsoft Academic Search](https://academic.microsoft.com/home) AKA MAS * [Electronic Colloquium on Computation Complexity](https://eccc.weizmann.ac.il//) * [Cryptology ePrint Archive](https://eprint.iacr.org/) * The open archive [HAL](https://hal.archives-ouvertes.fr/) * [Academia](https://www.academia.edu/) ### Professional organizations require membership fee * [ACM Digital Library](https://dl.acm.org/) * [IEEE Xplore Digital Library](https://ieeexplore.ieee.org/Xplore/home.jsp) ## Sites hosting bibliography * [DBLP](https://dblp.uni-trier.de/db/) - 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](https://support.google.com/webmasters/answer/6062608?hl=en) 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](https://www.swi-prolog.org/pldoc/man?section=libpl) Example: [append/3](https://www.swi-prolog.org/pldoc/doc_for?object=append/3) ![image|690x68,75%](upload://6tYz8sOMPBaloby3ekijP8io3Gx.png) To see the source code for a specific predicate click on ![image|37x35,75%](upload://xsilBjdInRYOrPtBBdfVHolhK5.png) ([link](https://www.swi-prolog.org/pldoc/doc/_SWI_/library/lists.pl?show=src#append/3)) ![image|690x276,75%](upload://oKODZcJ4LG6qEdeo8ZcosXLnfTT.png) ## Locating a library with a specific book [WorldCat](https://www.worldcat.org) - 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. ## Papers [Publications about SWI-Prolog](https://www.swi-prolog.org/Publications.html) [Unification theory](https://www.cs.bu.edu/~snyder/publications/UnifChapter.pdf) [Intro to Web Prolog for Erlangers](https://gup.ub.gu.se/file/207827) [Logical Loops](http://eclipseclp.org/reports/loops.pdf) [Use of Prolog for developing a new programming language](http://citeseerx.ist.psu.edu/viewdoc/download;jsessionid=2AB52E97BD258FB6419C6CFEA5278459?doi=10.1.1.34.3972&rep=rep1&type=pdf) and [A History of the Erlang VM](http://www.erlang-factory.com/upload/presentations/389/EFSF11-ErlangVM.pdf) [Negation as failure](https://www.doc.ic.ac.uk/~klc/NegAsFailure.pdf) [Definite Clause Grammars for Language Analysis](http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.458.3226&rep=rep1&type=pdf) --A Survey of the Formalism and a Comparison with Augmented Transition Networks [The Computational Power and Complexity of Constraint Handling Rules](https://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.594.18&rep=rep1&type=pdf) by Jon Sneyers, Tom Schrijvers, and Bart Demoen [On the Performance of Bytecode Interpreters in Prolog](https://www3.hhu.de/stups/downloads/pdf/interpreters-prolog.pdf) by Philipp K¨orner, David Schneider and Michael Leuschel ## Libraries SWI-Prolog [Built-in Predicates](https://www.swi-prolog.org/pldoc/man?section=builtin) SWI-Prolog [Library](https://www.swi-prolog.org/pldoc/doc_for?object=section%281,%27A%27,swi%28%27/doc/Manual/libpl.html%27%29%29) SWI-Prolog [Packages](https://www.swi-prolog.org/pldoc/doc_for?object=packages) SWI-Prolog [Packs](https://www.swi-prolog.org/pack/list) [pengines](https://pypi.org/project/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](https://pengines.swi-prolog.org/docs/index.html). ## Code repositories [RosettaCode](http://rosettacode.org/) has examples of lots of simple programming [task](http://rosettacode.org/wiki/Category:Programming_Tasks) implemented in many programming [languages](http://rosettacode.org/wiki/Category:Programming_Languages). If you know one programming language, you can often find the same implementation in another language. Prolog [tasks](http://rosettacode.org/wiki/Category:Prolog). ### GitHub - general General listing of all GitHub repositories with Prolog Code, YMMV. ([ref](https://github.com/search?l=Prolog&o=desc&q=Prolog&s=stars&type=Repositories)) ### GitHub - hand selected The following list were hand selected for the exceptional quality of the Prolog code. Individuals by alphabetical order of last name GitHub [repositories](https://github.com/samer--?tab=repositories) by Samer Abdallah GitHub [repositories](https://github.com/wouterbeek?tab=repositories) by Wouter Beek GitHub [repositories](https://github.com/CapelliC?tab=repositories) by Carlo Capelli GitHub [repositories](https://github.com/jamesnvc?tab=repositories) by James Cash GitHub [repositories](https://github.com/Genivia/Husky) by Robert van Engelen GitHub [repositories](https://github.com/keriharris?tab=repositories) by Keri Harris GitHub [repositories](https://github.com/mndrix?tab=repositories) by Michael Hendricks GitHub [repositories](https://github.com/pkoerner?tab=repositories) by Philipp Körner GitHub [repositories](https://github.com/rla?tab=repositories) by Raivo Laanemets GitHub [repositories](https://github.com/kamahen?tab=repositories) by Peter Ludemann GitHub [repositories](https://github.com/edisonm?tab=repositories) by Edison Mera GitHub [repositories](https://github.com/TeamSPoon) by Douglas R. Miles (TeamSPoon) GitHub [repositories](https://github.com/fnogatz?tab=repositories) by Falco Nogatz GitHub [repositories](https://github.com/Anniepoo?tab=repositories) by Anne Ogborn GitHub [repositories](https://github.com/Anniepoo?tab=repositories](https://github.com/jrvosse?tab=repositories&q=&type=source&language=prolog&sort=)) by Jacco van Ossenbruggen GitHub [repositories](https://github.com/royratcliffe?tab=repositories) by Roy Ratcliffe GitHub [repositories](https://github.com/friguzzi?tab=repositories) by Fabrizio Riguzzi GitHub [repositories](https://github.com/triska?tab=repositories) by Markus Triska GitHub [repositories](https://github.com/JanWielemaker?tab=repositories) by Jan Wielemaker GitHub [repositories](https://github.com/ridgeworks?tab=repositories) by Rick Workman (ridgeworks) GitHub [repositories](https://github.com/eshelyaron?tab=repositories&q=&type=source&language=prolog&sort=) by Eshel Yaron GitHub [repositories](https://github.com/Blog-Core) for Blog-Core GitHub [repositories](https://github.com/ciao-lang) for The Ciao Programming Language GitHub [repositories](https://github.com/LogtalkDotOrg) for Logtalk by Paulo Moura GitHub [repositories](https://github.com/terminusdb) for TerminusDB GitHub [repositories](https://github.com/SWI-Prolog) for SWI-Prolog GitHub [repositories](https://github.com/SWI-PrologTeamLudumDare32) for SWI-Prolog Ludum Dare Teams [Art of Prolog Code](https://github.com/npe9/aop) - 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](https://github.com/JCumin/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](https://github.com/LPCIC/elpi) by Enrico Tassi [My SWI-Prolog page](http://www.hakank.org/swi_prolog/) ([GitHub](https://github.com/hakank/hakank/tree/master/swi_prolog/)) by Hakan Kjellerstrand [Learn Prolog Now Exercises](https://github.com/dragonwasrobot/learn-prolog-now-exercises) by Peter Urbak [The Prolog GraphPlan Project](https://github.com/Mortimerp9/Prolog-Graphplan) - 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](https://github.com/jan-Lope/Toki_Pona-Parser) - A Tool for Spelling, Grammar Check and Ambiguity Check of Toki Pona Sentences, by jan Lope [Thea2](https://github.com/vangelisv/thea) - A collection of modules for parsing and manipulating OWL2 ontologies in Prolog, by Vangelis Vassiliadis [CMU Prolog Repository](http://www.cs.cmu.edu/afs/cs.cmu.edu/project/ai-repository/ai/lang/prolog/0.html) - This is some very old Prolog code but sometimes older code is easier to understand. ["Public-domain Prolog library"](https://www.j-paine.org/prolog/library.html) - Another collection of older Prolog code and libraries (1992-2010), by Jocelyn Ireson-Paine [SimGen](https://github.com/simularity/SimGen) - a simulation language. [ClioPatria](https://github.com/ClioPatria/ClioPatria) - an extension of the SWI-Prolog RDF infrastructure (semweb package) that provides you with a ready-to-run web-server that can be extended into a full-fledged Semantic Web application. ## Katas [Codewars](https://www.codewars.com/kata/search/prolog?q=&) ## Applications making use of Prolog [Pengines](https://pengines.swi-prolog.org/docs/index.html) - Web Logic Programming made easy Pharos Static Binary Analysis Framework ([GitHub](https://github.com/cmu-sei/pharos)) ([YouTube](https://www.youtube.com/watch?v=hnM252gU-g4)) [Gerrit Code Review](https://www.gerritcodereview.com/) - Uses Prolog for [rules](https://www.gerritcodereview.com/prolog-cookbook.html) [PRESS: PRolog Equation Solving System](https://github.com/maths/PRESS) [ConceptBase.cc](http://conceptbase.sourceforge.net/) - A System for Metamodeling and Method Engineering [EYE](https://josd.github.io/eye/) - Euler Yet another proof Engine ([GitHub](https://github.com/josd/eye)) [FCube](https://www.vidal-rosset.net/fcube_an_efficient_prover_for_intuitionistic_propositional_logic.html) - An Efficient Prover for Intuitionistic Propositional Logic RTEC: Run-Time Event Calculus ([GitHub](https://github.com/aartikis/RTEC)) ProjectTartarus - a multi-agent emulator for Static as well as Mobile Agents ([GitHub](https://github.com/roboticslab-cseiitg/ProjectTartarus)) [BigMAC](https://github.com/FICS/BigMAC) - Python tool that helps analysts understand DAC, MAC (SELinux), and capabilities (CAP) on Android devices. [Spectector](https://spectector.github.io/) - Automatic detection of speculative information flows ([GitHub](https://github.com/spectector/spectector)) [Marelle](https://github.com/larsyencken/marelle) - package dependency manager. [KnowRob](https://github.com/knowrob/knowrob) - knowledge processing system designed for robots. [Louise](https://github.com/stassa/louise) - meta-interpretive learning. [DFS Tools](https://github.com/hbrouwer/dfs-tools) - Distributional Formal Semantics (DFS) framework implementation in Prolog. ## History [Prolog and Logic Programming Historical Sources Archive](http://www.softwarepreservation.org/projects/prolog/index.html) - This is a gold mine if you want to see the history of different Prolog implementations with archived code included. Papers: - _The birth of Prolog_ by Alain Colmerauer and Philippe Roussel ([PDF](http://alain.colmerauer.free.fr/alcol/ArchivesPublications/PrologHistory/19november92.pdf)) (1992) - _History of Logic Programming_ by Robert Kowalski ([page with download link](https://www.researchgate.net/publication/277670164_History_of_Logic_Programming)) (2014) - _1983--1993: The Wonder Years of Sequential Prolog Implementation_ by Peter Van Roy ([page with download link](https://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.29.9583)) (1993) * _The Early Years of Logic Programming_ by Robert Kowalski, ([PDF](https://www.doc.ic.ac.uk/~rak/papers/the%20early%20years.pdf)), appeared in ["Communications of the ACM" January 1988](https://cacm.acm.org/magazines/1988/1) ## IDEs [PceEmacs](https://www.swi-prolog.org/pldoc/man?section=pceemacs) - SWI-Prolog built-in editor [Emacs](https://www.gnu.org/software/emacs/) [Visual Studio Code](https://code.visualstudio.com/) [Gedit](https://wiki.gnome.org/Apps/Gedit) [Prolog Development Tools (ProDT)](https://marketplace.eclipse.org/content/prolog-development-tools-prodt) for the [Eclipse IDE](https://www.eclipse.org/eclipseide/) [SPIDER](https://sicstus.sics.se/spider/), the SICStus Prolog IDE based on Eclipse [Logtalk plugin](https://plugins.jetbrains.com/plugin/9425-logtalk) for [IntelliJ IDEA](https://www.jetbrains.com/idea/) ## Howto guides/Tutorial ### By Anne Ogborn * [Creating Web Applications in SWI-Prolog](https://github.com/Anniepoo/swiplwebtut/blob/master/web.adoc) * [Playing with Prolog](https://www.youtube.com/c/PlayingWithProlog/videos) - Collection of YouTube videos. ### By Robert Laing * [Coursera MooC: Prolog for Beginners](https://www.coursera.org/projects/prolog-for-beginners-fhqrd) * [An introduction to Prolog for SQL programers](https://swish.swi-prolog.org/p/sql2prolog.swinb) * [Graph Traversal for Problem Solving](https://swish.swi-prolog.org/p/Graphs1.swinb) * [Web applications](https://github.com/roblaing/swipl-webapp-howto) * [ Various ways to iterate in Prolog](https://swish.swi-prolog.org/p/Iteration2.swinb) * [Compiler example from Art of Prolog](https://swish.swi-prolog.org/p/Compiler1.swinb) ## Other Tools Termination inference - [cTI_lt](http://www.complang.tuwien.ac.at/cti/) (constraint based termination inference for left termination) ## SWI-Prolog Discourse categories * https://swi-prolog.discourse.group/c/nice-to-know/17 * https://swi-prolog.discourse.group/c/useful-code/16 * https://swi-prolog.discourse.group/c/announce/7 ## Algorithms [Dictionary of Algorithms and Data Structures](https://xlinux.nist.gov/dads/) [NIST Digital Library of Mathematical Functions](https://dlmf.nist.gov/) [The Stony Brook Algorithm Repository](http://algorist.com/algorist.html) StackOverflow tag [Language Agnostic](https://stackoverflow.com/tags/language-agnostic/info) - Contains *Free Language Agnostic Programming Books* ## Other [Awesome Prolog](https://github.com/klaussinani/awesome-prolog#resources) -------------------------