Artificial Intelligence Programming in Prolog (AIPP)
| Module Description
- Lecture slides are posted before each lecture. Print them off from here if you wish to annotate them during lectures.
- Course notes are available for download (here). The course notes contain an introduction to Prolog as well as all practical exercises and revision exercises.
- Assignment 1 (An automatic puzzle solver) is available now (04/10/04). Download the specification and template file here.
- Practical code is available here along with updated instructions.
- ****** NO LECTURE Monday 25th October due to mid-semester break **********
- ****** Thursday 11th November lecture cancelled due to my absence *********
- Assignment 2 (Six Degrees of Kevin Bacon) now available here
- Final lecture is Monday 29/11/04
- 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
- Natural Language Processing and Generation,
- Knowledge Representation and Reasoning,
- Database Search,
- Problem Solving,
- Cognitive Modelling,
- Logic and Theorem Proving,
- as well as providing computational skills that can be utilised in their MSc project.
(e-mail: tim.smith (at) ed. ac. uk) Office 9, 2nd Floor/Left, 2 Buccleuch Place. Tel: x504437. Office hours 9am-12pm every Tuesday
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).
(Thurs 23/09) An Introduction
: (.pdf) (.ppt)
(Mon 27/09) Prolog fundamentals: (.pdf) (.ppt)
(Thurs 30/09) Tests, Backtracking, and Recursion: (.pdf) (.ppt)
(Mon 04/10) Recursion, Structures, and Lists: (.pdf) (.ppt)
(Thurs 07/10) List Processing: (.pdf) (.ppt)
(Mon 11/10) Combining Lists and Built-in Predicates: (.pdf) (.ppt)
(Thurs 14/10) Controlling Backtracking: the Cut. (.pdf) (.ppt)
(Mon 18/10) State-Space Search: (.pdf) (.ppt)
(Thurs 21/10) Informed Search: (.pdf) (.ppt)
(Mon 25/10) * No Lecture *
(Thurs 28/10) Definite Clause Grammars
: (.pdf) (.ppt)
(Mon 01/11) Parsing and Semantics using DCGs (.pdf) (.ppt)
(Thurs 04/11) Input / Output: (.pdf) (.ppt)
(Mon 08/11) Sentence Manipulation: (.pdf) (.ppt)
11/11) * Cancelled *
(Mon 15/11) Database Manipulation (.pdf) (.ppt)
(Thurs 18/11) Planning (.pdf) (.ppt)
(Mon 22/11) More Planning and Prolog Operators (.pdf) (.ppt)
(Thurs 25/11) Meta-Interpretation (.pdf) (.ppt)
(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 1 available now (04/10/04):
- due in week 7: Monday 1/11 4pm
Assignment 2 (20%): Six degrees of Kevin Bacon.
- Assignment 2 now available (08/11/04):
- Assignment specification (.pdf)
- Prolog Movie Database (PMDB) . You should download all of these
files to your home directory but only use them as instructed in the
assignment specification (* warning they are large files!)
- due in week 11: Friday 10th December at 4pm
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.
These Prolog files should be saved locally and modified during the corresponding practical exercises.
- Practical 4 (week 5) sticks.pl
- Alteration to practical instructions:
The second part of this weeks practical, the Sticks problem, is now
optional. Last week's practical exercises should be completed before
the Sticks problem is attempted. If you do choose to attempt the
Sticks problem then you will find better instructions than those in the
course notes included in the sticks.pl file.
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:
- AI MSc students are required to know Java and Prolog by the end of their MSc.
- Cognitive Science and Natural Language MSc students have to learn either Prolog or Java.
- Speech and Language Processing MSc have to learn either Prolog or Java.
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 (http://www.inf.ed.ac.uk/cgi-bin/support.cgi
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):
- Clocksin, W.F. and Mellish, C.S., Programming in Prolog: Using the ISO Standard (5th edition), 2003.
- A good basic introductory text. This is the most up to date text
book and conforms to the new ISO standard Prolog. This is the form of
Prolog that will be taught in AIPP. If you choose to use a text book
other than Clocksin and Mellish refer to the course notes for correct
syntax. Doesn't contain many of the AI components of the course.
- Bratko, I., Prolog Programming for Artificial Intelligence (3rd edition), 2001.
- An introductory book that leans heavily towards AI applications.
It's structure resembles that of AIPP more than Clocksin and Mellish.
Occasionally uses a poor programming style and incorrect syntax. Refer
to course notes for correct syntax. A major source of example AI
- Sterling, L. and Shapiro, E., The Art of Prolog (Second edition), 1994.
- Possibly the best general Prolog book around, but definitely not an
introduction, especially if you don't have much programming experience.