Learning outcomes of the course unit
The course is intended to provide the basic notions of declarative programming, through the presentation and practical application of the logic programming language Prolog.
Basic knowledge of: concepts and techniques of conventional programming (e.g., in C); foundamental data structures such as lists, trees, and graphs; functions, set theory, and logical connectives. Familiarity with computer usage.
Course contents summary
Declarative programming: definition, motivations, forms, languages. Main features of declarative programming languages.
A language for declarative programming: Prolog. History of Prolog (hints) - Variables and data types (simple and compound terms). Clauses and programs (syntax) - Semantics. Logical and procedural interpretations - Unification and substitution - Operational semantics. Derivation. SLD tree. Success set - Nondeterminism and search strategies. Backtracking. Incompleteness - Data structures: lists. List operations. Strings - Multiple solutions ('setof') - Declarative programming in Prolo. Logical variables and unification. partially specified data structures. Nodeterminism and recursion -Non-declarative features of Prolog. Number manipulation. Backtracking control ("cut"). Negation by failure (hints). Term/character input-output. File. Dynamic program modification (hints) - SWI-Prolog programming environment. Development and testing of simple SWI-Prolog programs.
Constraint logic programming (CLP). Weakness of Prolog - The notions of constraint and constraint solver - CLP. Programs, CLP computation, constraint solving (propagation and consistency check). A case study: CLP(FD). FD constraints. Fd constraint solving ("arc-consistency"). CLP(FD) in SWI-Prolog.
L. CONSOLE, E. LAMMA, P. MELLO, M. MILANO: Programmazione logica e Prolog (II edizione), UTET Libreria, 1997, Anno ristampa 2006, pp. 432.
Exams : Oral exams plus programming assignments