# Logic programming

2011HT

Status Archive National Graduate School in Computer Science (CUGS) TCSLAB Wlodzimierz Drabent http://www.ida.liu.se/~wlodr/phd.lp/

## Course plan

30 h

#### Recommended for

PdD students in computer science

2010

#### Goals

Provide a solid introduction into the paradigm of logic programming.

The course presents the logic programming paradigms, which differ from that of mainstream programming (i.e. procedural and object oriented). The latter can be seen as still related to the architecture of computer hardware. Their main concept - a mutable variable - is an abstraction of a RAM memory cell. In such languages, roughly speaking, programs are descriptions of sequences of computational steps. The role of the steps is to modify the state.
In contrast, programs in (pure) logic programming describe the tasks of the computations. There is no state and mutable data; this makes it easy to reason about complex programs.

Logic programming (LP) employs (a subset of) the language of the standard first order logic as a programming language. In principle, a program is a set of axioms describing a problem to be solved; the computed results are logical consequences of the program. In practice, programs also describe how the results are computed; this can be modified by the programmer without changing the logical meaning of the program.
Hence reasoning about the meaning of programs and their correctness (declarative semantics) can be separated from that about program execution (operational semantics). Efficient implementations of LP exist.

#### Prerequisites

Some mathematical maturity, for instance given by introductory courses on discrete mathematics, formal languages and automata theory, and logic.
Some experience of programming; familiarity with some programming languages.

#### Organization

Lectures.
Exercises and project work.

#### Contents

[subject to modifications]

- Definite clause logic programs, their declarative and operational semantics.
- Prolog as an implementation of LP.
- Programming examples, LP as a declarative programming paradigm.
- Negation in LP, including Answer Set Programming.
- Reasoning about logic programs (formal & practical).
- Extensions of "classical" LP. Constraint logic programming.

#### Literature

Articles, handouts, book chapters.
U. Nilsson and J. Maluszynski. Logic, Programming and Prolog (2ed).

W. Drabent

W. Drabent

#### Examination

Home assignments and a minor project.

5hp maximally