This course has been discontinued.
Last planned examination: Spring 2022
Decision to discontinue this course:No information inserted
In this course the student develops knowledge and skills in constructing and understanding the meaning of programs in the paradigm of logic programming. Logic programming is programming with a special class of logical expressions. In systems that execute logic programs the user poses questions to a database of statements (the program) and the system answers these questio
Content and learning outcomes
The course presents logic and logic programming for software development. This includes an overview of Horn clauses and their application in knowledge representation and reasoning as well as logic programming in Prolog and its semantics. The course presents algorithms over lists and trees as well as search algorithms in graphs, database programming, recursive programming, non-deterministic programming. Tools for arithmetic in Prolog, structure inspection, metalogic, control mechanisms for search, negation in Prolog, incomplete data structures, parsing by means of DCG. Various more efficient data structures, such as difference structures, are introduced. We show how techniques from functional programming fit in the framework of logic programming and can be expressed in the programming language Prolog. Finally, the course presents some AI applications, such as simple expert systems, and gives a short overview of current methodological trends.
In this course students will meet the theory and the basic design principles within logic programming while they in for example degree projects, can practise the methods.
Application: puzzles and games, parsing, compilation, formula manipulations, expert systems. Introduction to modifications and extensions of Prolog: parallel Prolog, equation and constraint solving, richer forms of clauses, modules, object orientation and Prolog.
In the project part of the course
- the student identifies and defines a problem-oriented project suited to illustrate the use of logic programming techniques
- the student formulates the project by means of the terminology of logic programming (implementation of a program or analysis of a program/system)
- the student carries out the project in a group or individually within the time frame
- the student presents her/his work with a short report and an oral presentation in a "mini workshop".
Intended learning outcomes
After passing the course, the student shall be able to
- explain the basic concepts in logic programming
- program syntax for Logic Programming
- the equality theory for terms and the unification procedure
- the search mechanisms in Prolog
- implement algorithms over trees and lists as logic programs
- explain and use the logical and the most common non-logical control structures in Prolog
- be able to account sketchily for whether and why a certain task is suited (or not suited) to be implemented using logic programming techniques
- carry out and present a smaller logic programming project in a group or individually in stated time frames.
For higher grades, the student should also be able to
- use DCG notation for grammars in Prolog
- explain the operational and declarative semantics for logic programs
- design adequate representations of abstract data types such as sets sparse matrices, hash tables in logic programs
- use and explain difference structures (e g d-lists)
- use metaprogramming techniques in logic programming languages.
Literature and preparations
- Completed course ID1018 Programming I or DD1393 Software Engineering, or the equivalent.
- Completed course ID1020 or DD1338 Algorithms and Data Structures, or the equivalent.
- Completed course SF1624 or IX1303 Algebra and Geometry, or the equivalent.
- Completed course SF1610 or IX1500 Discrete Mathematics, or the equivalent.
Programming in high level languages. Some experience of recursion as a programming technique.
Knowledge and skills in elementary logic (the language of logic, deductions, models).
Examination and completion
If the course is discontinued, students may request to be examined during the following two academic years.
- PRO1 - Project, 3.0 credits, grading scale: P, F
- TEN1 - Examination, 4.5 credits, grading scale: A, B, C, D, E, FX, F
Based on recommendation from KTH’s coordinator for disabilities, the examiner will decide how to adapt an examination for students with documented disability.
The examiner may apply another examination format when re-examining individual students.
Examination takes place with written or oral examination, oral project presentation as well as assessment of the presentations of fellow students, written project report as well as program code for the project.
Opportunity to complete the requirements via supplementary examination
Opportunity to raise an approved grade via renewed examination
- All members of a group are responsible for the group's work.
- In any assessment, every student shall honestly disclose any help received and sources used.
- In an oral assessment, every student shall be able to present and answer questions about the entire assignment and solution.
Further information about the course can be found on the Course web at the link below. Information on the Course web will later be moved to this site.Course web ID2213
Main field of study
Master thesis using logic programming.
In this course, the EECS code of honor applies, see: http://www.kth.se/en/eecs/utbildning/hederskodex.
The content overlaps with new basic course ID1213. This course on the advanced level contains a larger project.