**Inference in Prolog


next up previous contents
Next: How expert systems explain themselves
Up: Logic programming
Previous: Logic programming
Back: to main list of student notes

**Inference in Prolog

Skip this section if you're not doing the Prolog block practical.

If you used Eden in the Prolog practical, you probably used the production system that came with it. This works by forward chaining. If you printed any traces from it, look back at them. Rule conditions can test STM (``stm predicates'') and sensory data (``perceptual predicates''). Rule actions can add data to STM, delete it from STM (using erase), or perform other actions (``motor commands'').

This production system was built (by me) as a Prolog program. Prolog itself works by backward chaining, not by forward chaining. If you tell it

needs( X, job ) :- is_a( X, third_year ).
and you then add the fact
is_a( john, third_year ).
and ask
?- needs( Who, job ).
it will reply with Who=john. (This will not mean a lot to you unless you've used raw Prolog.)

However, Prolog is not an expert system. It can't explain how it inferred an answer. And even if it could, its user interface leaves a lot to be desired! But it can be, and often is, used as a language in which expert systems are built.

Whether you've used Prolog or not, it's important to note that the Eden production system (a forward chainer) was written in a programming language whose inference strategy is different (backward chaining). This illustrates the point I made in lecture 1 about a hierarchy of functional architectures. It shows that when you investigate the behaviour of a system, you may get information about one level, but not about a level lower down.


next up previous contents
Next: How expert systems explain themselves
Up: Logic programming
Previous: Logic programming
Back: to main list of student notes



Jocelyn Ireson-Paine
Wed Feb 14 23:39:25 GMT 1996