COMP 2411 Logic and Logic Programming
The University of
New South Wales
School of
Computer Science
and Engineering
_________________________________________________________________________________________
Logic pervades many fields of computer science. It plays a key role in:
The aim of the course is to help you master the theoretical notions and develop the practical skills related to logic that you will use from when you study those fields or some of them.
By the end of the course you will be able to:
There is no prerequisite for this course. It is a core subject if you are a software engineering student, and an elective otherwise. You will find this course especially useful in relation to the following courses:
At university, the focus is on your self-directed search for knowledge. Lectures, tutorials, labs, textbook and recommended reading, assignments and exams are all provided as a service to assist you in this endeavour. It is your choice as to how much work you do in this course, whether it be preparation for classes, completion of assignments, study for exams or seeking assistance or extra work to extend and clarify your understanding. You must choose the approach that best suits your learning style and goals in this course. The course is designed in such a way that passing the course will only require a good understanding of the fundamental notions as well as good practical skills, thanks to regular but limited work. If your aim is to obtain a high distinction then you will have to face more uncertainty, in the form of a broader range of questions and problems, of a more difficult type, and you will need to invest more time in this course.
The course will be assessed as follows.
| Assesment item | Maximum mark |
| Assignment 1 | 10 |
| Assignment 2 | 10 |
| Assignment 3 | 10 |
| Assignment 4 | 10 |
| Assignment 5 | 10 |
| Mid-session test | 15 |
| Final exam | 35 |
The whole material presented in lecture notes, tutorials and labs is assessable.
Please see Section 4 to find out on which week each of the five assignments is due. An assignment should be handed out to the School office and possibly part of it electronically submitted by 3 pm on Monday of the week when it is due. Late assignments will not be considered and no mark will be awarded. Assignment questions will be posted on the web at least one week before the assignment is due. For instance, Assignment 1 is due on Week 4, hence should be handed out to the School office and possibly part of it electronically submitted by 3 pm on Monday the 22th of March. It will be posted on the web by 3 pm on Monday the 15th of March (possibly earlier). For more information on the course’s web site see Section 3.
Every assignment will consist of a small number of questions. An assignment can be purely theoretical, or purely practical, or have both a theoretical and a practical component. An example would be an assignment with 5 questions, each worth 2 marks, with 3 theory questions plus 2 programming questions where you would have to write, modify, or analyse a Prolog program.
In each assignment, most groups of questions will be directly related to lecture notes, tutorial exercises and lab exercises, and 1 or 2 groups of questions will go beyond that material.
Your solutions to the theoretical components can be hand-written, but we appreciate when you type them; they should be handed out to the School office. Each assignment paper will specify whether your solutions to the practical components should be in the form of a program and output printout, also to be handed out to the School office, or submitted electronically.
The mid-term exam will consist of 30 multiple choice questions, all for 0.5 marks, with no negative marks awarded to incorrect answers. This exam will test your understanding of the fundamental notions that will be introduced during the first half of the session.
The final exam will have two components, for a total of 7 groups of questions, with a maximum of 5 marks awarded to each group:
Marks for theory questions will be awarded on the basis of the following criteria:
Marks for programming questions will be awarded on the basis of the following criteria:
The final mark will be the sum of the assessment items. Your final mark will determine your grade as follows.
| Final mark M | Grade |
| 50 < M < 65 | Pass |
| 65 < M < 75 | Credit |
| 75 < M < 85 | Distinction |
| M > 85 | High distinction |
Learning is the focus of this course. To help you learn, the following resources are made available. The documents mentioned below will be available in the form of .txt or .pdf files at the course’s web page:
Two lectures will be presented each week, as shown in the next table.
| Day | Time | Location |
| Tuesday | 2 pm - 3 pm | EE G24 |
| Thursday | 12 am - 2 pm | EE G24 |
The material that will be covered during a given lecture will be posted on the web as lecture notes and Prolog programs, on the day before that lecture. Attendance to lectures is recommended but not compulsory.
You should be enroled in one of the following tutorials. Attendance to tutorials is highly recommended but not compulsory.
| Day | Time | Location | Tutor |
| Monday | 2 pm - 3 pm | Quad G031 | Kevin Irwig |
| Monday | 3 pm - 4 pm | K17 B01 | Kevin Irwig |
| Tuesday | 9 am - 10 am | K17 B02 | Victor Jauregui |
| Thursday | 3 pm - 4 pm | K17 B01 | Victor Jauregui |
| Thursday | 3 pm - 4 pm | EE 218 | Kevin Irwig |
Tutorials commence in Week 2 (beginning 8 March 2004).
Tutorials are small group learning environments in which you have the opportunity to explore the course matter actively and in-depth. The structure of the course is such that lecture material for one week is, generally, the focus of the tutorial in the next week. Tutorial questions will be posted on the web on the week before that tutorial, and you are asked to look at the questions and try and answer them. In this way, tutorials will be more productive in targeting problems and issues. Solutions to tutorial questions will be posted on the web on the week after that tutorial.
Every week, starting in Week 2, lab exercises and solutions to the previous week’s questions will be posted on the web. But there is neither any lab booking nor any lab supervision for this course. It is your responsibility to work on the lab exercises, and either make your own lab booking or work on your personal computer. Lab exercises will give you the opportunity to develop programming skills in Prolog.
The textbook for this course is:
MORDECHAI BEN-ARI. Mathematical Logic for Computer Science (2nd edition). Springer Verlag.
It can be purchased from the UNSW bookshop. You are expected to read and work from the textbook as a complement to the other material that is made available. The textbook contains fragments of Prolog programs, with complete versions that can be downloaded from
Still you do not need to download these programs, since revised versions of those of the programs that are relevant for this course will be posted on the course’s web page.
The following reference books are listed as other sources you might wish to consult. You are encouraged but not expected to read them or part of them.
ANIL NERODE and RICHARD SHORE. Logic for Applications (2nd edition). Springer Verlag.
LEON STERLING and EHUD SHAPIRO. The Art of Prolog. The MIT Press
SWI-Prolog is a free implementation of Prolog that will be used for this course. SWI-Prolog is installed on the School machines, and is started with the swipl command. It is also included on the Home computing CD. Source code and binaries for most operating systems as well as various other resources (editor, etc.) can be downloaded from
When you have to make electronic submissions that will be auto-marked, you have to test your solutions on the School machines. Passing a test means passing a test with the version installed on the School machines on the submission date.
You might find useful the following web sites.
The following table outlines the structure of the course. Note that some material in the textbook won’t be covered in lectures, and some material presented during lectures is not in the textbook. The last column of the table mentions only what is to some extent common to textbook and lecture notes.
|
Week |
Topic |
Assessment |
Textbook reference |
|
1 March 7 March |
Introduction. Propositional calculus: formulas, interpretations, logical equivalence. Prolog: implementation of truth tables. |
|
Chap. 1 Chap. 2, Sect. 1 - 4 Chap. 2, end Sect. 5 |
| 8 March
14 March |
Propositional calculus: satisfiability, validity, logical consequence, semantic tableaux. Prolog: implementation of semantic tableaux. |
|
Chap. 2, beg. Sect. 5 Chap 2, Sect. 6 - 8 |
|
15 March 21 March |
Propositional calculus: deductive systems, Hilbert system, natural deduction (1). Prolog: implementation of a proof checker. |
|
Chap. 3 |
|
22 March 28 March |
Propositional calculus: natural deduction (2), resolution. Prolog: implementation of resolution. |
Assignment 1, due 22 March, 3 pm |
Chap 4, Sect. 1 |
|
29 March 4 April |
Predicate calculus with and without equality: formulas, interpretations, logical equivalence, satisfiability, validity, logical consequence. Prolog: the cut. |
|
Chap 5, Sect. 1 - 4 Chap. 5 Sect. 7, 8 |
|
5 April 11 April |
Predicate calculus without equality: semantic tableaux. Prolog: implementation of semantic tableaux. Revision for mid-term exam. |
Assignment 2, due 5 April, 3 pm |
Chap. 5, Sect. 5, 6 |
|
12 April 18 April |
Mid session recess. |
|
|
|
19 April 25 April |
Predicate calculus: deductive systems, Hilbert system, natural deduction (1). Prolog: implementation of a proof checker. |
Mid-term exam on Tuesday lecture time |
Chap. 6 |
|
26 April 2 May |
Predicate calculus: natural deduction (2), clausal form, skolemisation. Prolog: implementation of clausal form and skolemization. |
|
Chap. 7, Sect. 1, 2 |
|
3 May 9 May |
Predicate calculus without equality: Herbrand models, unification. Prolog: implementation of unification. |
Assignment 3, due 3 May, 3 pm |
Chap. 7, Sect. 3 - 7 |
|
10 May 16 May |
Predicate calculus without equality: resolution. Prolog: implementation of resolution. |
|
Chap. 7, Sect. 8 |
|
17 May 23 May |
Logic programming: SLD-resolution. Prolog: negation as finite failure. |
Assignment 4, due 17 May, 3 pm |
Chap. 8, Sect. 1 - 3 |
|
24 May 30 May |
Definite clause grammars. Prolog: a few data structures. |
|
|
|
31 May 6 June |
Semantics of programs, Hoare logic. Prolog: search techniques. |
Assignment 5, due 31 May, 3 pm |
Chap. 9 |
|
7 June 13 June |
Revision for final exam |
|
|
|
14 June 17 June |
Study period |
|
|
|
18 June 6 July |
Examinations |
|
|
|
|
|||
|
|
|||
You may seek consultation and send questions by email with any teaching staff for this course. However, you first point of reference should, where possible, be the lecturer in charge or your tutor.
Teaching staff will be answering e-mails related to the course, provided that they do not request extensive or substantive answers. These questions are best raised in tutorials or consultation.
The lecturer in charge will be available for consultation on Mondays from 10 am to 12 am, in K17 room 409.
| Name | Role | Room | Phone ext. | |
| Eric Martin | Lecturer in charge | 409 | emartin@cse.unsw.edu.au | 56936 |
| Patrick Caldon | Course administrator | 401-18 | patc@cse.unsw.edu.au | 56914 |
| Victor Jauregui | Tutor | 401-03 | vicj@cse.unsw.edu.au | 56913 |
| Kevin Irwig | Tutor | 401-06 | kevini@cse.unsw.edu.au | 56907 |
Students are reminded that the University regards academic misconduct as a very serious matter. Students found guilty of academic misconduct are usually excluded from the University for two years. However, because of the circumstances in individual cases, the period of expulsion can range from one session to permanent explusion from University.
The following are some of the actions which have resulted in students being found guilty of academic misconduct in recent years:
Students are reminded that the School’s policies on originality of assignment submissions and supplementary assessment are described in:
In particular, it should be noted that no supplementary midterm will be offered. Students unable to attend the midterm exam due to illness should submit a request for special consideration within seven days after the exam. Students whose requests are granted will have their midterm component computed on the basis of their results in the final exam. Students whose requests are denied will receive zero mark for the midterm. A supplementary final exam will be offered only to students who submit a request for special consideration meeting the School’s usual criteria (see the above) within seven days of the final exam, and perform at 50% or better in the midterm exam. (Students who were offered special consideration on the midterm exam and also request special consideration on the final will be handled at the discretion of the lecturer in charge, but will be expected to prove exceptional circumstances for both the midterm and final.) Please note that lodging an application for special consideration does not guarantee that you will be granted the opportunity to sit the supplementary exam. A supplementary final exam will only be offered to students who have been prevented from taking an end of session examination, and whose circumstances have improved considerably in the period since the exam was held. Students who apply for special consideration must be available during this period to sit the exam. No other opportunities to sit the final exam will be offered.