Subj: PROLOG Location Date: Fri, Aug 25, 1995 1:39 PM PDT From: firstname.lastname@example.org To: email@example.com Prolog was invented by Alain Colmerauer and Phillipe Roussel at the University of Aix-Marseille in 1971. Linda Goranson
Date: Fri, Aug 25, 1995 1:39 AM PDT From: firstname.lastname@example.org To: email@example.com I checked last night and Prolog was developed by 'Alain Colmerauer' and associates around 1970 at Universite d'Aix-Marseille II. You can check Roussell 1975: Prolog: Manuel de Reference et Utilisation.
Subj: PROLOG sample Date: Fri, Aug 25, 1995 9:34 AM PDT From: firstname.lastname@example.org To: email@example.com We can often translate between normal English and PROLOG with little effort. For example, as soon as we know that :- means if and , means and, we can readily understand the following program: PROLOG English is_situated in( london, england ). London is in England. born_in( sarah, london ). Sarah was born in London. nationality( Person, english ):- A person is English if born_in( Person, City ), that person was born in a city is_situated_in( City, england ). and that city is in England However, beyond a certain point, a lot of effort is required, and the 'learning curve' rises steeply. For example, to solve the 'Towers of Hanoi' problem, you must transfer the three disks from pole A to pole B. But you can only move one disk at a time, and you must never put a disk on top of a smaller one. The PROLOG program below solves this problem very elegantly - and the same program can be used for any number of disks. towers(Number):- transfer(Number, left, middle, right). transfer(0, _, _, _). transfer(Number, Source, Destn, Spare):- N is Number -1, transfer(N, Source, Spare, Destn), write(['Move a disk from ',Source,' to ',Destn]), nl, transfer(N, Spare, Destn, Source). All you have to do is type: ?- towers(3). for 3 discs (or more or less if you wish), and PROLOG will reply: [Move a disk from ,left to ,middle] [Move a disk from ,left to ,right] [Move a disk from ,middle to ,right] [Move a disk from ,left to ,middle] [Move a disk from ,right to ,left] [Move a disk from ,right to ,middle] [Move a disk from ,left to ,middle] yes All well and good - but try understanding the program! For the newcomer to PROLOG, coming to understand the detailed workings poses considerable difficulties.