Artificial Intelligence Programming in Prolog (AIPP)

Lecturer | Module Description | Lectures | Assignments | Practicals | Exam | Exemptions | Software | References | Links


  1. Lecture slides are posted before each lecture.  Print them off from here if you wish to annotate them during lectures.
  2. Course notes are available for download (here). The course notes contain an introduction to Prolog as well as all practical exercises and revision exercises.
  3. Assignment 1 (An automatic puzzle solver) is available now (04/10/04). Download the specification and template file here.
  4. Practical code is available here along with updated instructions.
  5. ****** NO LECTURE Monday 25th October due to mid-semester break **********
  6. ****** Thursday 11th November lecture cancelled due to my absence *********
  7. Assignment 2 (Six Degrees of Kevin Bacon) now available here
  8. Final lecture is Monday 29/11/04
  9. Practical sessions continue in week 11 (29/11-3/12). Dedicated to catch-up and 2nd assignment.


Prolog(PROgrammation et LOGique) is a logic programming language widely utilised in Artificial Intelligence. It is a high-level programming language which enables the user to build programs by stating what they want the program to do rather than how it should do it. Due to Prolog's grounding in first-order predicate logic it is intended to be more analogous with human deductive reasoning than other programming languages.

AIPP is a Masters level course intended to provide students with all the technical skills needed to implement Artificial Intelligence techniques in compact and efficient Prolog programs. By the end of the module students will be able to construct Prolog programs of all sizes and complexity that implement a range of AI techniques. The students will be able to utilise the skills learnt during this course in many areas:


Tim Smith (e-mail: tim.smith (at) ed. ac. uk) Office 9, 2nd Floor/Left, 2 Buccleuch Place. Tel: x504437. Office hours 9am-12pm every Tuesday.

Module Description

A brief description of the course is available here.

The course notes are available here (.ps  .pdf) and will be available in hard copy from outside the ITO as soon as possible. Course notes contain all organisational details and weekly practical assignments. Please pick these up as soon as they become available. If you are printing the coursenotes please print two pages per side and duplex as the notes are 200 pages long!


All lectures start at 16:10 and end at 17:00 on Mondays and Thursdays. Lectures are held in A9/11, Ground Floor, Forest Hill.

Lecture notes will be posted below in PDF and Microsoft Powerpoint (.ppt)  format before each lecture. Hand outs will not be given in the lectures so you may find it useful to print off the slides before each lecture so that you can annotate them (please use this command when printing the slides on DICE, lpr -P<printername> -Zduplex,4up,landscape <filename>. Use a similar layout when printing from Powerpoint as well. This will help save paper).

Lecture 1        (Thurs 23/09)         An Introduction:   (.pdf)   (.ppt)
Lecture 2        (Mon 27/09)           Prolog fundamentals:    (.pdf)   (.ppt)
Lecture 3        (Thurs 30/09)         Tests, Backtracking, and Recursion: (.pdf)    (.ppt)
Lecture 4        (Mon 04/10)           Recursion, Structures, and Lists: (.pdf)   (.ppt)
Lecture 5        (Thurs 07/10)         List Processing:   (.pdf)   (.ppt) 
Lecture 6        (Mon 11/10)           Combining Lists and Built-in Predicates:   (.pdf)   (.ppt)
Lecture 7        (Thurs 14/10)         Controlling Backtracking: the Cut.   (.pdf)    (.ppt)
Lecture 8        (Mon 18/10)           State-Space Search:   (.pdf)    (.ppt)
Lecture 9        (Thurs 21/10)         Informed Search:    (.pdf)      (.ppt)
                          (Mon 25/10)            * No Lecture *
Lecture 10
      (Thurs 28/10)         Definite Clause Grammars(.pdf)   (.ppt)
Lecture 11      (Mon 01/11)           Parsing and Semantics using DCGs   (.pdf)    (.ppt)
Lecture 12      (Thurs 04/11)         Input / Output:   (.pdf)   (.ppt)
Lecture 13      (Mon 08/11)           Sentence Manipulation:   (.pdf)   (.ppt)
                          (Thurs 11/11)         * Cancelled *
Lecture 14      (Mon 15/11)           Database Manipulation    (.pdf)    (.ppt)
Lecture 15      (Thurs 18/11)         Planning    (.pdf)   (.ppt)
Lecture 16      (Mon 22/11)           More Planning and Prolog Operators    (.pdf)   (.ppt)
Lecture 17      (Thurs 25/11)         Meta-Interpretation      (.pdf)   (.ppt)
Lecture 18      (Mon 29/11)           Beyond the Text and Course Summary   (.pdf)    (.ppt)


There will be two assessed assignments during AIPP. Together they contribute 30% to your overall course mark.

Both assignments are to be submitted using the submit command on DICE. You should put all of your work into one prolog file (commenting out any written sections) and submit the file before the deadline. Details of how to use the submit command will be provided at the end of each assignment.

Both assignments require you to develop complete Prolog programs. You may develop these programs at home on a PC or Mac but you must test that they run under the DICE version of sicstus before submission.

Assignment 1 (10%): An automatic puzzle solver

Assignment 2 (20%): Six degrees of Kevin Bacon.


All students are required to attend one 2 hour tutorial per week beginning week 2. Practical exercises are published in the course notes (.ps  .pdf). Practicals will be held in Computer Lab West, level 5, Appleton Tower. There are two scheduled practical times, Wednesday 4-6pm and Friday 3-5pm. Students should choose the most practical time, register for that session during the first couple of lectures, and then attend that session for the rest of term.

Each practical exercise contains sections that need to be shown to a lab demonstrator and signed off on. The demonstrator will keep a log of every students progress to ensure that practicals are being completed at the right time. This will allow them to offer extra assistance to students who are slipping behind. The practicals are not formally assessed and do not contribute to your course grade but their completion is compulsory.

Practical code:    These Prolog files should be saved locally and modified during the corresponding practical exercises.


AIPP will be examined during the summer examination period. The exam counts for 70% of the overall course mark. All material contained in the course notes and the lectures is examinable unless otherwise indicated.

Previous exam papers are available here but be aware that this course has changed every year for the last few years. The 03-04 paper contains half Prolog and half Python. 02-03 contains Perl and Prolog. 01-02 was all Prolog and is the most representative of the exam that will be set this year.

Requirements and Exemptions

AIPP is aimed at students who already have programming experience in a language other than Prolog. If students have little or no programming experience they are advised to take Introduction to Java Programming (IJP). Students may choose to take both IJP and AIPP at the same time (they are both taught in Semester 1) but weaker students should inform me at the beginning of the course.

Different MSc degrees have different programming requirements:
Students can be made exempt from learning a required language if they can show sufficient previous experience with that language (either having taken a taught course in it or used it competently in industry). Students should contact their specialism supervisor for exemptions.


In AIPP we will use Sicstus Prolog which is installed on the DICE network and accessible from any terminal by typing sicstus at the command line. A free version of Sicstus Prolog for Windows is available for all Informatics students. Fill in the Informatics Support form to request a copy ( You are free to work on assignments on a Windows PC but all submitted code should work on the DICE installation of Sicstus. Therefore, please test all code on the DICE system before submission.


There is no required text book for AIPP, all essential information is included in the course notes and the lectures. However, there are three books which may be of interest (listed in order of relevance):

Useful Links

Top | Lecturer | Module Description | Lectures | Assignments | Practicals | Exam | Exemptions | Software | References | Links

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:
Please contact our webadmin with any comments or corrections. Logging and Cookies
Unless explicitly stated otherwise, all material is copyright © The University of Edinburgh