Logic Programming Fall term 2014

The aim of this course is to introduce you to the theory and practice of logic programming. We teach it in two parts:

There will be 18 lectures, starting Monday 15th September 2014.

Lectures are in Lecture Theatre 4 of 7 Bristo Square.

Lectures take place 1510-1600 on Mondays and Thursdays in weeks 1-4 and 6-10 of Semester 1. (Note that there are no lectures in week 5, i.e., no lectures on 13th and 16th October.)

Tutorials are held in weeks 3-10. (Note that tutorials take place as usual in Week 5.)

There will be two, summatively assessed, coursework exercises; each worth 10% of the final grade.

Course timetable

Mon Lec
Thu Lec
Coursework (CW)
1 15 Sep   Theory 1 Prog 1      
2 22 Sep   Prog 2 Prog 3    
3 29 Sep   Theory 2 Prog 4 Tut 1    
4 6 Oct   Theory 3 Prog 5 Tut 2   CW1 handed out: Mon 6
5 13 Oct       Tut 3    
6 20 Oct   Prog 6 Theory 4 Tut 4   CW1 deadline: 3pm Mon 20  
7 27 Oct   Theory 5 Theory 6 Tut 5   CW2 handed out: Mon 27
8 3 Nov   Prog 7 Theory 7 Tut 6    
9 10 Nov   Theory 8 Prog 8 Tut 7   CW2 deadline: 3pm Mon 10  
10 17 Nov   Theory 9 Prog 9 Tut 8    

Office hours

The course lecturers are available (during Semester 1) for discussion of course material at the following hours.

Meetings outside these hours are also possible by appointment.

Course Text and Supplementary Material

The primary book for the programming side of the course is Learn Prolog Now, by Blackburn, Bos and Striegnitz. The book is strongly recommended, and is available free on-line.

Other useful books on prolog programming are

For the theory lectures, the following background material on propositional and predicate will be useful for students who have not previously encountered propositional and predicate logic.

SICStus Prolog

SICStus Prolog is recommended for use in the course and will be used for the final exam. Any DICE machine (i.e. any Linux machine in an Informatics computer lab) should have SICStus installed; type sicstus at a command prompt to start.

The School also has a site license for student use, in case you would prefer to install and run SICStus on your own computer. Contact Computing Support in person or via this form to arrange this. Please specify which operating system you are running when requesting Sicstus (so Computing Support can send you the login details and appropriate OS license info in one response).

There is a good emacs mode for editing Prolog code and interacting with execution. To enable this mode for Prolog, add the following line to your .emacs file:

(load "/opt/sicstus-4.2.0/lib/sicstus-4.2.0/emacs/sicstus_emacs_init" t)

Then consulting a Prolog file will bring up a menu for Prolog features.

Introductory Prolog Programming Notes

To get you quickly informed of the essential aspects of the Prolog programming language, read the Quick Prolog notes. These refer to the Prolog programs: ancestors.pl, dcg.pl, declar_v_proc.pl and mapcolour.pl.

Prolog Programming Lecture Videos

Some lectures from this and previous years were recorded on video so if you want a re-run of those lectures then visit the video site for the full lectures; clips of smaller segments; and instructions on how to view them on the Informatics DICE system.

Programming Lecture Slides

Programming lecture slides will be posted here as the course proceeds.

Theory Lecture Slides

Theory lecture slides will be posted here as the course proceeds.


There will be two, summatively assessed, coursework exercises; each worth 10% of the final grade. Once marked, the coursework will be returned to students with feedback.


Tutorials start Week 3 (September 30). The tutorial group times and membership will be posted early in the semester. See tutorial groups with times and membership.

  1. Tutorial for week 3 and the file that you should download for it: simpsons.pl.
  2. Tutorial for week 4 and the file that you should download for it: deck.pl.
  3. Week 5 quiz tutorial and solutions
    Supplementary material: 2012 Week 5 tutorial (2012_tutorial3.pdf) and outline solutions (2012_tutorial3_solutions.txt).
  4. Tutorial for week 6 and solution.
  5. Tutorial for week 7 and solution.
  6. Tutorial for week 8 and solution.
  7. Tutorial for week 9 and solution.
  8. Tutorial for week 10 and solution.


Formative feedback provides students with feedback on performance and understanding in time to assist with the assessed aspects of the course (coursework and exam).

Logic programming offers the following formative feedback:

In addition, both summatively assessed coursework exercises will be marked, commented and made available for students to collect 2 weeks after submission.

Previous Exams

Home : Teaching : Courses 

Informatics Forum, 10 Crichton Street, Edinburgh, EH8 9AB, Scotland, UK
Tel: +44 131 651 5661, Fax: +44 131 651 1426, E-mail: school-office@inf.ed.ac.uk
Please contact our webadmin with any comments or corrections. Logging and Cookies
Unless explicitly stated otherwise, all material is copyright © The University of Edinburgh