Next: The Basics of Up: Artificial Intelligence Programming Previous: Support for Exploratory

The Main AI Languages

The main programming languages used in AI are Lisp and Prolog. Both have features which make them suitable for AI programming, such as support for list processing, pattern matching and exploratory programming. Both are also widely used - Prolog especially in Europe and Japan, and Lisp in the US. This wide use within the field is another reason to choose Lisp or Prolog for AI implementations.

Lisp can be viewed as the grandfather of functional programming, developed in the late 1950s and based on function definitions. Although somewhat looked down upon by functional programming purists, it remains a useful, powerful and widely used programming language. Lisp uses the list as its fundamental representation for data structures and programs (function definitions), and provides a wide range of built in functions for manipulating lists. (In fact Lisp stands for LISt Processing.) Unlike pure functional languages, data structures may be modified - possibly theoretically undesirable but in practice sometimes very useful! Of course, it is still possible to use Lisp in a purely functional way, but this is not forced on you. Using lists to represent programs allows special purpose interpreters to be easily written, as there is little distinction between prolog and data. Lists also allow complex symbol structures (representing AI knowledge) to be easily manipulated, and pattern matchers can be easily be written to match list structures.

Prolog is a language based on logic. (Prolog = PROgramming in LOGic). In particular, it is based on first order predicate calculus. Writing simple Prolog programs is similar to writing statements in predicate calculus, and `running' them involves setting queries for Prolog to `prove' using its special purpose theorem prover.

Having said that, when writing larger prolog programs (once you have got the hang of Prolog's basic syntax and control and matching mechanisms) it is better to stop thinking of a program as statements in logic. As in any other programming language, you eventually have to start thinking more about what the program will do, not just what the statements mean. Prolog should be considered as a programming language derived from logic and theorem proving, but with its main strengths being its flexible symbolic data structures, powerful built in pattern matching, and built in search strategy (which we'll come to in the next lecture). The remainder of this lecture will introduce the basics of Prolog, in a fairly informal way, so you can get started on some exercises! However, you should also try to read the first chapter or two of your favourite Prolog text book. These will explain the basics in much more detail, and should give you a better grasp of the language.

[Exam-like questions (some of these need material from later in course):



Next: The Basics of Up: Artificial Intelligence Programming Previous: Support for Exploratory


alison@
Fri Aug 19 10:42:17 BST 1994