Introduction to Prolog
Module aimsThis is a short, intensive 'taster' course intended to provide an introduction to: * the programming language Prolog and its basic features * logic programming concepts * a typical Prolog environment (Sicstus Prolog) * some common Prolog programming techniques The emphasis is on explaining that Prolog has both a declarative and a procedural reading, and on the importance of clear and concise programs.
Learning outcomesStudents will * be able to develop succinct and clear Prolog programs for unseen, but well specified, problems of small to medium scale; * have a sense of the computational efficiency of their programs and be able to employ some of Prolog's control primitives to improve efficiency; * have an awareness of the main differences and similarities between Prolog and functional programming languages (in particular Haskell).
Module syllabusDeclarative and procedural readings; variables and unification; computations, finite failure, and the search space; nondeterminism and multiple solutions. Logical and operational semantics. Prolog terms. Lists and list processing. Tail recursion and last call optimisations. Arithmetic and other built-in predicates. Negation as failure. Control primitives: the 'cut'; Prolog conditionals. Aggregation operators: findall and setof.