Disclosure: Class Central is learner-supported. When you buy through links on our site, we may earn an affiliate commission.

Best Courses Guides

6 Best Free Prolog Courses for 2024

Master Prolog, a powerful declarative logic programming language used for AI and NLP, with these free online books and courses.

Quick Access:


Interested in intelligent systems?

Prolog is a powerful declarative logic programming language that’s mainly used for artificial intelligence, natural language processing, and symbolic computation. It’s based on first-order logic, which means that programs in Prolog consist of logical statements that are interpreted as facts or rules (for example, the premise ‘If it rains, then the ground is wet’ and ‘It is raining’ lead to the conclusion ‘The ground is wet’).

These facts and rules can be used to make logical deductions which can help in developing intelligent systems that can reason, learn, and solve problems using logical rules and data, such as in complex decision making systems and AI.

In this guide, I’ve picked the best free online courses to learn Prolog.

Click on the shortcuts for more details:

Here are our Top Picks

Click to skip to the course details:

What is Prolog?

Prolog, short for Programming Logic, is a declarative programming language that was first developed in 1972 by Alain Colmerauer and Philippe Roussel. It is unique in that it is homoiconic, meaning it treats code as data, and is focused on specifying what you want to achieve rather than how to achieve it. This makes it well-suited for artificial intelligence and natural language processing tasks, as it allows the programmer to define a set of facts and rules that describe a problem and then use these to find a solution, or in other words, to ‘reason’.

Prolog is not only used in academia though; it has also seen commercial applications. The Java Virtual Machine Specification contains Prolog, NASA uses Prolog for voice-control, New Zealand’s stock broking system is written in Prolog, and a third of all airline tickets are handled by Prolog.

While Prolog has been around for more than half a century now, that hasn’t stopped it from evolving, with more declarative features that make it easier to understand and use to create general programs with less effort. If you need to model and solve complex problems through symbolic data and logical deductions, a logical programming language like Prolog can save the day.

Courses Overview

  • All these courses are free.
  • All of the courses except one are suitable for beginners to Prolog.
  • Four of the courses are text-based, whereas two are video-based. One course makes use of text and video formats.
  • Two of the courses are interactive in the browser — no installation required!

Best Overall Up-to-Date Comprehensive Prolog Course for Beginners (Markus Triska)

The Power of Prolog is the most comprehensive and up-to-date free course on Prolog. It aims to bring traditional old Prolog university textbooks up to date with the current modern state of the language. As the author, Markus Triska, has been consistently updating the book for over two decades, you can rest easy knowing you’ll learn the latest features Prolog has to offer.

The text-based course covers a wide range of topics, including simple integer arithmetic, web applications, theorem proving, and even artificial intelligence! In addition to its comprehensive course material, there are also sample programs for you to practice with and video tutorials to help guide your learning. Before you get started, watch the course’s trailer.

The course presumes no background knowledge about logic or logical programming, although some experience in programming is helpful.

In this course, you’ll learn:

  • Foundations of Logic
    • Prolog is based on Horn clauses, a subset of first-order predicate logic.
    • Enables theorem proving through resolution.
  • Basic Prolog Concepts
    • Introduction to Prolog’s program and data structures.
    • Writing and reading Prolog programs.
    • Performing integer arithmetic, sorting, and searching.
  • Advanced Prolog Concepts
    • Logical purity and definite clause grammars.
    • Practical techniques: declarative testing and debugging.
  • Applications of Prolog
    • Uses in web applications, databases, cryptography, and artificial intelligence.
    • Emulates human decision making, proves complex theorems, and solves logic puzzles.
    • Detailed exploration of Prolog’s application in these fields.

You’ll learn by reading through the course chapters, looking at the code examples, and watching the lecture videos. Find the course’s Github page here.

Markus Triska is a big contributor to the Prolog language, having created several libraries for SWI-Prolog and maintaining Prolog’s FAQ webpage. He has won the Prolog Programming Contest twice and received a Master’s degree and a doctoral degree in the field of Prolog and constraints. Triska has also published numerous scientific papers on combinatorial optimization, Prolog, and constraints, and has contributed to the Prolog ISO standard (N226) and the Prolog teaching environment GUPU. The website the course is hosted on uses a reverse proxy written in Prolog!

Website metalevel.at
Author Markus Triska
Level Beginner — Advanced
Workload N/A
Certificate None

Best Prolog Course for Artificial Intelligence and Computational Logic for Beginners (Simply Logical)

Do you want a free, text-based course in the form of an interactive online book? Simply Logical – Intelligent Reasoning by Example focuses on Prolog programming in the context of Artificial Intelligence, implementing intelligent behavior in machines, and Computational Logic, automating various kinds of reasoning. The course’s philosophy is ‘teaching by showing, learning by doing’, which is reflected in the interactive code blocks embedded in the course pages for you to experiment with. By the end, you’ll understand how logic can be used to solve problems in AI.

What you’ll learn:

  • Part I: Logic and Logic Programming
    • Introduction to Logic Programming with Prolog
    • Concepts: program clauses, query answering, proof trees, recursive data structures
    • Formal coverage: proving soundness and completeness
    • Common Prolog techniques: SLD-trees, arithmetic expressions, second-order predicates, programming techniques
  • Part II: Reasoning with Structured Knowledge
    • Focus on Artificial Intelligence concepts
    • Representing structured knowledge as graphs
    • Solving problems with blind and informed search methods
  • Part III: Advanced Reasoning Techniques
    • Beyond clausal logic: reasoning with sequences of events, incomplete information, non-logical forms (pictures, spoken text)
    • Turning natural language into clausal logics
    • Inductive reasoning: generalization and specialization.

You’ll learn by reading through the material, playing around with the interactive code samples, and completing the exercises given, some of them having answers.

Simply Logical is an open-source project providing a suite of online resources about Artificial Intelligence and Logic Programming with Prolog.

Peter Flach is a Professor of Artificial Intelligence at the University of Bristol. He served as Editor-in-Chief of the Machine Learning journal from 2010 to 2020. Prof Flach has also been involved in organizing several conferences in the field of machine learning, and is a founding board member and current President of the European Association for Data Science. He is a Fellow of the Alan Turing Institute for Data Science and Artificial Intelligence.

Institution Simply Logical
Website book.simply-logical.space
Author Peter Flach
Level Beginner
Workload N/A
Certificate None

Best Short Video Course for Beginners (Ryan Schachte)

Ryan Schachte’s Prolog Programming video series will teach you the fundamental concepts of Prolog and how to use it to solve complex problems through logical reasoning and symbolic data representation.

In this course:

  • Start by learning the basics of running and compiling Prolog code
  • Understand representation of facts as simple predicates (e.g., “The sky is blue”)
  • Define rules based on facts (e.g., “If the sky is blue and the sun is shining, then it is a nice day”)
  • Use Prolog to answer queries based on these rules (e.g., “Is it a nice day?”)
  • Represent information using variable syntax and structs
  • Ask sophisticated questions about the data
  • Perform arithmetic operations in Prolog
  • Learn about complex data structures, such as lists and pairs
  • Perform advanced operations including sorting and searching through lists.

You’ll learn by watching the lecture videos and following along as the instructor codes.

Ryan Schatche’s YouTube channel discusses programming in C, C++, Java, Javascript, HTML, CSS, Assembly, MIPS, computer architecture, mathematics, and computer science theory. He also covers numerous topics for web design, algorithm analysis, statistics, discrete mathematics, and more.

Channel Ryan Schachte
Provider YouTube
Instructor Ryan Schachte
Level Beginner
Workload 1–2 hours
Views 264K
Likes 2.9K
Certificate None

Also Great Short Prolog Tutorial (Derek Banas)

Derek Banas’s Prolog Tutorial is a very concise one-hour video teaching the essentials of Prolog. You’ll learn how to use Prolog to describe facts and relationships about problems to facilitate automated reasoning.

What you’ll learn:

  • Prolog focuses on describing facts and relationships rather than outlining steps to solve problems
  • Learn to define facts and rules for automated reasoning
  • Use variables as placeholders for values that may change
  • Create complex terms and rules using if statements
  • Utilize logical and arithmetic operators both sequentially and recursively
  • Read from and write to consoles and files
  • Modify the database of facts and rules directly
  • Create and manipulate lists and strings.

You’ll learn by watching the lecture videos and following along as the instructor codes. Find the Cheat Sheet here.

Derek Banas is a prolific YouTube educational content creator. He has made around 50 videos covering the basics of different programming languages, as well as covering topics like data science and machine learning, statistics, linear algebra, and even how to write a novel!

Channel Derek Banas
Provider YouTube
Instructor Derek Banas
Level Beginner
Workload 1 hour
Views 908K
Likes 15K
Certificate None

Best Exercises to Practice Prolog Programming (Werner Hett)

Prolog Problems is a free collection of problems aimed to help students practice their logic programming skills in Prolog, where your goal should be to find the most elegant or logically clear solution of the given problems. Problems are marked by their difficulty, from easiest to hardest.

The collection is structured into seven sections: Prolog Lists; Arithmetic; Logic and Codes; Binary Trees; Multiway Trees; Graphs; Miscellaneous.

  1. Prolog Lists: Manipulating lists in Prolog. Example questions:
    • Find the last but one element of a list.
    • Drop every N’th element from a list.
  2. Arithmetic: Primes, mathematical algorithms, and functions. Example questions:
    • Determine whether two positive integer numbers are coprime.
    • Determine whether a given integer number is prime.
  3. Logic and Codes: Creating truth tables and encoding sequences. Example questions:
    • Truth tables for logical expressions.
    • Huffman code.
  4. Binary Trees: Manipulation of binary trees. Example questions:
    • Check whether a given term represents a binary tree
    • Construct height-balanced binary trees
  5. Multiway Trees: Manipulation of Multiway Trees. Example questions:
    • Count the nodes of a multiway tree
    • Lisp-like tree representation
  6. Graphs: Manipulation of Graphs. Example questions:
    • Cycle from a given node
    • Construct all spanning trees
    • Generate K-regular simple graphs with N nodes
  7. Miscellaneous: Miscellaneous computer science questions. Example questions:
    • Syntax checker
    • Crossword puzzle
    • Von Koch’s conjecture

You’ll learn by going through the problems and solving them hands-on.

Author Werner Hett
Level Beginner — Advanced
Workload N/A
Certificate None

Best Beginner Prolog Course for SQL Programmers (Robert Laing)

If you’re intimate with SQL, then thinking of Prolog as a relational database query language can be a great way to understand the language. That’s what this free course is about.

An introduction to Prolog for SQL programmers teaches Prolog by simulating basic SQL operations through Prolog code, from querying to modifying databases.

Separated into three parts, you’ll learn:

  • Part I: Querying Databases
    • Simulate traditional SQL commands (SELECT, INSERT, WHERE, JOINs) in Prolog.
  • Part II: Translating Social-Network Quiz Questions
    • Convert natural language questions into Prolog prompts.
    • Based on content from the Stanford course “Databases: Relational Databases and SQL”.
  • Part III: Recursion and Transitive Closures
    • Learn recursion and transitive closures in Prolog.
    • Explore commands easy in Prolog but difficult in SQL, such as returning paths and guarding against endless cycles.

You’ll learn by going through each part and doing the interactive in-browser exercises for hands-on practice. Robert Laing has a Prolog Cookbook website where he writes down notes on logic programming with Prolog. He has also made a website where you can play Chinese Checkers coded in Prolog.

Provider SWISH: SWI-Prolog for Sharing
Author Robert Laing
Level Beginner
Workload N/A
Certificate None

Why You Should Trust Us

Class Central, a Tripadvisor for online education, has helped 60 million learners find their next course. We’ve been combing through online education for more than a decade to aggregate a catalog of 200,000 online courses and 200,000 reviews written by our users. And we’re online learners ourselves: combined, the Class Central team has completed over 400 online courses, including online degrees.

Best Courses Guides Methodology

I built this guide following the now tried-and-tested methodology used in previous Best Courses Guides (you can find them all here). It involves a three-step process:

  1. Research: I started by leveraging Class Central’s database and the internet. Then, I made a preliminary selection of Prolog courses by rating, reviews, and bookmarks.
  2. Evaluate: I read through reviews on Class Central, Reddit, and course providers to understand what other learners thought about each course and combined it with my own experience as a learner.
  3. Select: Well-made courses were picked if they presented valuable and engaging content. They have to fit a set of criteria: comprehensive curriculum, affordability, release date, ratings and enrollments.

Pat revised the research and the latest version of this article.
Best Courses Guides. Start Learning, Stop Procrastinating.

Elham Nazif Profile Image

Elham Nazif

Part-time content writer, full-time computer science student.

Comments 0

Leave a reply

Your email address will not be published. All comments go through moderation, so your comment won't display immediately.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Browse our catalog

Discover thousands of free online courses from top universities around the world like MIT, Stanford, and Harvard.

Browse all subjects