This is the most wide spread language for programming in logic. It is very popular in some sectors of the AI community as it provides very powerful mechanisms for symbolic processing. It is a very elegant language

I've found its most important feature to be term unification, with backtracking search a very close second.


Please note that these examples are not intended to teach Prolog from scratch. To follow some of these programs, you'll need to be fairly familiar with the operation of Prolog.

N Queens

The N Queens problem is an abstract problem from Chess that is often used as a simple non-trivial example domain for algorithm design. The solutions discussed here apply Prolog's backtracking mechanism to perform a controlled search of the space.

This problem, and the following Logic Puzzle problem, provide good candidate problems for investigating how to design generate and test algorithms more efficiently than the purely brute force approach.

Details here DNF Minimizer

Logic Puzzle

You would hope that, being a logic programming language, Prolog would be good for solving logic puzzles. And indeed it is. This particular example shows how a generate and test design pattern can be applied and refined to create an efficient solution to a constraint satisfaction problem.

Details here DNF Minimizer

DNF Minimizer

This example is part of a larger, multi-language application for analysing and simplifying logical expressions. The Prolog component is embeded within a C# program and does the heavy lifting for transforming disjunctive normal forms into their simplest expression.

Details here DNF Minimizer