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

**Logic programming - theory:**lectures given by Richard Mayr**Logic programming - programming:**lectures given by James Cheney

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.

Week |
Begins |
Mon Lec |
Thu Lec |
Tutorials |
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 |

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

- Richard Mayr (IF 4.11): TBA.
- James Cheney (IF 5.29): Wednesday 12pm-1pm.

Other useful books on prolog programming are

*Programming in Prolog*by Clocksin and Mellish, Springer. (There are many copies of this in the University library.)-
*The Art of Prolog*by Sterling and Shapiro, MIT Press *Prolog Programming for Artificial Intelligence*by Ivan Bratko, Addison Wesley.

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.

- Wikipedia page on
*Propositional calculus* - Wikipedia page on
*First-order logic* - Wikipedia page on
*Structure (mathematical logic)* - Introductory slides (pdf) on
*Predicate logic and quantifiers*from University of Nebraska

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.

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

- Lecture 1 (Getting started), September 18:
PDF
PPT. Reading: LPN chapter 1.
(Accompanying code: simpsons.pl)

- Lecture 2 (Terms, unification and proof search), September 22: PDF PPT. Reading: LPN chapter 2.
- Lecture 3 (Recursion, lists and data structures), September 25: PDF PPT. Reading: LPN chapter 3 and chapter 4.
- Lecture 4 (Nonlogical features), October 2: PDF PPT. Reading: LPN chapter 5 and chapter 10.
- Lecture 5 (Nonlogical features, continued), October 9: PDF PPT. Reading: LPN chapter 10 and chapter 11.
- Lecture 6 (Parsing and definite clause grammars), October 20: PDF PPT. Reading: LPN chapter 7 and 8.

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

- Course Admin, September 15 (PDF)
- Lecture 1 (Definite Clause Propositional Logic), September 15 (PDF)
- Lecture 2 ((In)completeness of Prolog proof search), September 29 (PDF)
- Lecture 3 (Definite Clause Predicate Logic), October 6 (PDF)
- Lecture 4 (Proof Search for Definite Clause Predicate Logic), October 23 (PDF)
- Lecture 5 ((In)completeness for Definite Clause Predicate Logic), October 27 (PDF)
- Lecture 6 (Fixed Points and Herbrand Models), October 30 (PDF)

- Coursework 1 (programming) was made available October 6:
programming coursework
**Due: 3pm October 20.**

Returned to students: available to collect from ITO from November 3rd. - Coursework 2 (theory) available since Oct. 24:
theory coursework
**Due: 3pm November 10.**Marked scripts will be available to collect from ITO from November 24th.

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.

- Tutorial for week 3 and the file that you should download for it: simpsons.pl.
- Tutorial for week 4 and the file that you should download for it: deck.pl.
- Week 5 quiz tutorial and
solutions

Supplementary material: 2012 Week 5 tutorial (2012_tutorial3.pdf) and outline solutions (2012_tutorial3_solutions.txt). - Tutorial for week 6.
- Tutorial for week 7.

Logic programming offers the following formative feedback:

- Interaction with tutors in tutorials provides general feedback on understanding.
- The week 5 tutorial will be a quiz tutorial. Solutions will be marked and discussed in tutorial.
- Both lecturers have office hours (see above) in which they are available to discuss any aspect of the course. You are very welcome to drop in either individually or in small groups (up to 3 students at a time).

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 |