When we think of groups of symbols as propositions, we can see that a
production rule is a device which, given the fact that its left-hand
propositions are true, makes explicit the fact that the right-hand
propositions are true. We can therefore view production rules as rules of logical inference: rules which, given one set of true
propositions, infer another set of true propositions. The rule in
l1.pl infers the proposition
loves(john,mary) from the
likes(mary,wine). That is, if you tell the rule that
likes(mary,wine), it will infer that
This is what logic programming is all about. In languages such as Pascal and Basic, you program by telling the computer how to accomplish some task. Your program consists of a sequence of little instructions, which if obeyed in the right order will (hopefully) do the right thing.
But in logic programming, you describe your program in logic. Your program consists of an initial set of propositions, plus a set of rules which infer new propositions from old. In our production system, the initial set of propositions is the initial STM, and the rules are the production rules.
Logic programming became famous at the start of the 80's, with the growth of interest in expert systems, Prolog, and the Japanese Fifth Generation Project. For background reading on this, see The Guide to Expert Systems, by Alex Goodall (Learned Information, 1985; somewhere in PSY). Look at the chapters on logic programming (number 6, I think), and on the history of AI. The most famous logic programming language is Prolog, and in fact the Eden production system is built on Prolog. They therefore share a number of similarities, particularly in the syntax of predicates and in the way conditions are handled.
One of the important things about logic programming is that you can view the rules, as well as the propositions, as logical statements. The rule
likes(mary,wine) => loves(john,mary).can be read as an implication: ``If Mary likes wine then John loves Mary'' or ``Mary likes wine implies John loves Mary''. Similarly, the rule
far, hot => egypt, done.can be read as the implication ``If you can go somewhere far, and you like it hot, then Egypt would suit you''.
You should note that not all production systems can be used for logic programming. The Eden one can because it has facilities for grouping symbols into predicates and arguments, and because the matching and rule-firing were designed (with help from Prolog) to model logical inference. However, matching and rule-firing don't have to work this way.
Note also that, even in this production system, it's hard to interpret some rules logically. This is particularly true of rules which create symbols denoting a stage in the computation, or which obey actions. You see both in the rule
loves(_,_) => exec([forward]), exec([right]).I used this to trigger an action once a
lovesfact had been derived.
[The rest of this handout remains to be written when I have time. Ask me
what to do next. You could have a look at the bug
running it in
psworld0, and try making sense of it with the notes
at the end of the Editing your own programs handout.]