# CO2014 Logic Programming

 Credits: 10 Convenor: Dr. A. Kurz Semester: 2

 Prerequisites: essential: CO1011,CO1003 desirable: CO1004 Assessment: Coursework: 40% Two hour exam in May/June: 60%
 Lectures: 18 Problem Classes: none Tutorials: none Private Study: 39 Labs: 12 Seminars: none Project: none Other: none Surgeries: 6 Total: 75

### Subject Knowledge

#### Aims

The course is intended to give the student an understanding of the principles of logic programming and how these are applied to standard problems in AI.

#### Learning Outcomes

Students should understand (1) the principles and techniques of logic programming and how these can be applied in practice, for example in AI; (2) how Prolog relates to the predicate calculus, appreciate the declarative meaning of a program; (3) the execution mechanism of Prolog in terms of unification, resolution and SLD-trees.

#### Methods

Lectures together with course notes, recommended textbook, worksheets, supervised laboratories, printed solutions, web support.

#### Assessment

Marked coursework, traditional written examination.

### Subject Skills

#### Aims

To teach students programming in PROLOG and solving standard problems in AI.

#### Learning Outcomes

Students should be able (1) to solve standard problems in AI; (2) to write programs in Prolog using a mixture of recursion, arithmetic, lists/trees, negation, IO and other non-logical features such as assert and retract; (3) to improve the efficiency of a Prolog program using the cut operator.

#### Methods

Lectures together with course notes, recommended textbook, worksheets, supervised laboratories, printed solutions, web support.

#### Assessment

Marked coursework, traditional written examination.

### Explanation of Pre-requisites

The Prolog language is based on the predicate calculus so the knowledge of logic from CO1011 is essential. Some prior experience in computer programming is also important so CO1003 is essential and CO1004 is recommended.

### Course Description

Many of the programming tasks which arise in Artificial Intelligence can be formulated as search problems, e.g. find a series of moves which will guide the robot out of the maze, find a medical diagnosis which is consistent with the patient's symptoms, find a combination of components which fits the customer's requirements for a computer system, and so on. The predicate calculus introduced in CO1011 provides a convenient language to describe such problems; logic programming provides a means of finding the solution by the application of rules. Prolog is the prime example of a logic programming language and has become a standard tool in Artificial Intelligence programming.

### Syllabus

Fundamentals of Prolog: facts and rules, recursion, backtracking, simple examples; execution mechanism: unification, resolution, SLD-trees and search strategies; list processing in Prolog; cut operator and efficiency issues; worked examples; negation as finite failure; arithmetic; system predicates for IO; assert and retract; debugging programs by tracing.

#### Recommended:

I. Bratko, Prolog, Programming for Artificial Intelligence, 3rd edition, Addison-Wesley, 2001.

#### Background:

L. Sterling and E. Shapiro, The Art of Prolog, 2nd edition., MIT Press, 1994.

### Resources

Course notes, web page, study guide, worksheets, laboratories, lecture rooms with two OHPs and video beamer, past examination papers.

### Module Evaluation

Course questionnaires, course review.

Author: N. Rahman, tel: +44 (0)116 252 2593
Last updated: 2004-01-20
MCS Web Maintainer
This document has been approved by the Head of Department.
© University of Leicester.