Chapter 2
Logic Programming

Overview
This chapter is about logic programming. The first section gives an introduction. Because logic programming is not built into Mathematica, our first task is to develop an interpreter for a logic language. We do so in Section 2. This query evaluator is an interpreter for a subset of the programming language Prolog. A prerequisite for it is unification, which is a generalization of the pattern matching that underlies Mathematica own evaluator.

In the remainder of the chapter, we use the query evaluator to give examples of typical logic programming applications.

Among the examples considered are implementations of Prolog-style lists (Section 3), nondeterministic automata, backtracking, and exhaustive search (Section 4), as well as theorem proving and deductive databases (Section 5).

Programs
LogicProgramming.m
DAG.m
Unify.m
Lisp.m
FSA.m
NIM.m
Lists.m
JurassicPark.m
Notebooks
LogicExamples.nb
Resources on the Internet
Prolog 1000 Database
The Prolog 1000 is a database of real Prolog applications being assembled in conjunction with the Association for Logic Programming (ALP) and PVG. The aim is to demonstrate how Prolog is being used in the real world and it already contains over 500 programs with well over 2 million lines of code. The database is available for research use in SGML format from the Imperial College archive.
Jurassic Park
The Internet Movie Database entry for Jurassic Park.

Top Up Next Internet Updates

Rev. 1.0, REM, © 1996 Roman E. Maeder