52 349 Logic Programming

Introductory Practical Notes - 1996


  1. Practicals will be held as two slots of one hour each. While they are running, there will be no tutorials for the class (unless we should subsequently agree to the contrary!). The practicals will be on Fridays between 3 and 5 p.m.

  2. Practicals will be in the Departmental Sun Lab, L10.07, on the tenth floor of the Livingstone Tower. They will be taken jointly by me and by Paul Murphy (Graduate Teaching Assistant) and Gordon McCormick (Mathematics & Computer Science 4).

  3. On the Department's machines, Prolog is in /usr/local/bin and so should already be available in your search path. If you want to use it on the Computer Centre Suns, and this is old information which may have changed, you should amend your search path so that it includes /packages/prolog/bin. You do this, of course, by amending your .cshrc file (or your .login file, if your search path is set there) and then - on the first occasion only - running that file, through source .cshrc.

  4. Files for consultation in Prolog are prepared in the usual way, using a screen or text editor. The language is invoked by typing the Unix command prolog, and is left by way of successful execution of the Prolog predicate halt/0: see chapter two of the lecture notes. When in Prolog, don't forget the final period after a clause! And don't accidentally consult the same file more than once in any one session.

  5. Many of the early practical exercises are constructed so that you can use the large fact base contained (with other files) within the directory /home/s3/paul/logic, this gives family details of Scots, English and U.K monarchs (with a fair few others!) over the last thousand or so years. Please do not print these files, since otherwise we'll become rather short of trees! The file contains data in the following format:

    PredicateExample
    male/1male(robert_i).
    female/1female(elizabeth_de_burgh).
    parent/3parent(robert_i,elizabeth_de_burgh,david_ii).
    lived/3lived(robert_i,Birth_date,Death_date).
    event/3event(battle,bannockburn,Battle_date).
    reign/2reign(david_ii,Country,Ascent,Descent).

    together with further predicates which, like the last two above, are of less immediate relevance.

  6. In particular, you should consult the single file roy_sco, containing details of Scottish monarchs. As a further exercise you may subsequently consult any of the files roy_*, where * stands for ear[ly_english], eng[land], eur[ope], fam[ilies]_eng[lish], fam[ilies]_sco[ttish] and uk, or the file roy_pea[sants], containing date-related information only. System limitations mean that it is unlikely that in any one Prolog session you will be able to consult more than one or perhaps two of the files.

  7. The various files referred to in these Introductory Practical Notes and in Practical 1 and Practical 2 may most readily be accessed by means of a symbolic link from your directory. Many of you will have realised this already; if in doubt, read man ln -s.


© Paul Goldfinch 1996 Return to 52 349 Menu