Logic Programming
(V3 + Ü2, SS 2017)


If you have any question, please contact Jera Hensel.
News

We have added links to old exams for the lecture. Please use them when preparing for the
exam.

There were no lectures or exercise courses in the excursion week (June 59, 2017). This
was the plan for lectures and exercise courses in the week from
June 1216, 2017:
 On Monday (June 12) and Tuesday (June 13), there will be lectures as usual.
 On Friday (June 16), there will be no lecture and no exercise course. Therefore, Exercise
Sheet 5 is due on Friday, June 23.

This was the plan for lectures and exercise courses in the week from
May 29  June 2, 2017:
 On Monday (May 29), there was a lecture as usual.
 On Tuesday (May 30), there was
an exercise course instead of the lecture. Therefore, Exercise
Sheet 4 was due on Tuesday (May 30) at 8:30
am.
 On Friday (June 2), there was a lecture instead of the exercise course.

This was the plan for lectures and exercise courses in the week from
May 2226, 2017:
 On Monday (May 22), there was a lecture as usual.
 On Tuesday (May 23), there was
an exercise course instead of the lecture. Therefore, Exercise
Sheet 3 was due on Tuesday (May 23) at 8:30
am.
 On Friday (May 26), there was no lecture and no exercise course.

On Friday (May 19) there was a lecture instead of an exercise
course.

The inventor of the Prolog programming language, Alain Colmerauer,
passed away
on May 13, 2017.
 Due to the large number of students who registered for the exercises, we
encourage you to solve the exercises in groups of four instead of
three.
 In order to take part in the exercises, please sign up
here until Friday, April
28. You do not need to register for the exercises via Campus Office.
 The first lecture took place on Monday, April 24. There was no lecture on
April 18 and no
exercise course on April 21.
Language
English
Course Notes etc.
Contents
In addition to a short introduction to the programming language Prolog, the
lecture deals with the foundations of logic programming, with programming
techniques in these languages, with the implementation of logic
programming languages, and with their application in several areas.
More precisely, these are the topics of the lecture:
 Prerequisites from predicate logic
 Unification
 Resolution
 Horn clauses and SLDresolution

Logic programs
 Operational and denotational semantics
 Evaluation strategies

The programming language Prolog
 Syntax and semantics
 Negation as failure
 Nonlogical components of Prolog
 Programming techniques
 Applications and extensions of logic programming
References
 K. R. Apt: From logic programming to Prolog, Prentice Hall, 1997.
 I. Bratko: Prolog Programming for Artificial Intelligence, AddisonWesley, 2011.
 W. F. Clocksin, C. S. Mellish: Programming in Prolog, Springer, 2013.
 T. Frühwirth, S. Abdennadher:
Essentials of Constraint Programming, Springer, 2010.
 M. Hanus: Problemlösen mit Prolog, Teubner, 1987.
 J. W. Lloyd: Foundations of Logic Programming, Springer, 2013.
 K. Marriott, P. J. Stuckey:
Programming with Constraints, MIT Press, 1998.
 P. H. Schmitt: Theorie der logischen Programmierung, Springer, 1992.
 U. Schöning: Logik für Informatiker, Spektrum Akademischer Verlag, 2000.
 L. Sterling, E. Shapiro: The art of Prolog, MIT Press, 2000.
Area
Theoretical Computer Science, Theoretical Foundations of SSE
(Core Subjects)
Software
To write Prologprograms, we recommend the SWI Prolog System.
An alternative to SWIProlog is GNU
Prolog:
The exercises have to be solved in groups of four or three. We would prefer if you solve
them in groups of four.
50% of the points on the exercise sheets are
needed in order to take part in the final written exam. The written exam will be on
August 25, 2017. If you fail this exam, there will be a second written exam on
September 12, 2017. There will not be any extra oral exams, i.e., you need to take part in
the written exams in August or September 2017.
In order to take part in the exercises, please sign
up here until Friday, April 28.
You do not need to register for the exercises via Campus Office.
Transparencies
Here are the transparencies used in the lecture.
 Slide 1 (April 24, 2017)
 Slide 2 (April 25, 2017)
 Slide 3 (April 25, 2017)
 Slide 4 (May 8, 2017)
 Slide 5 (May 9, 2017)
 Slide 6 (May 15, 2017)
 Slide 7 (May 15, 2017)
 Slide 8 (May 16, 2017)
 Slide 9 (May 19, 2017)
 Slide 10 (May 22, 2017)
 Slide 11 (May 29, 2017)
 Slide 12 (June 2, 2017)
 Slide 13 (June 13, 2017)
 Slide 14 (June 13, 2017)
 Slide 15 (June 26, 2017)
 Slide 16 (June 27, 2017)
 Slide 17 (July 3, 2017)
Notes
Here are the notes from the lecture.
 1. Introduction (April 24, 2017)
 2.1 Syntax of Predicate Logic (April 25, 2017)
 2.2 Semantics of Predicate
Logic (April 25 + 28, 2017)
 3.1 Skolem Normal Form
(April 28 + May 2, 2017)
 3.2 Herbrand Structures
(May 2 + 8, 2017)
 3.3 Ground Resolution
(May 9 + 15, 2017)
 3.4 Resolution in Predicate
Logic
(May 15 + 16, 2017)
 3.5 Restrictions of Resolution
(May 16 + 19 + 22, 2017)
 4.1a Syntax and
Semantics of Logic Programs  Part 1
(May 22 + 29, 2017)
 4.1b Syntax and
Semantics of Logic Programs  Part 2
(May 29 + June 2, 2017)
 4.2 Universality of Logic Programming
(June 2 + 12, 2017)
 4.3 Indeterminism and Evaluation
(June 13 + 19, 2017)
 5.1 Arithmetic
(June 19 + 20, 2017)
 5.2 Lists
(June 20, 2017)
 5.3 Operators
(June 20 + 26, 2017)
 5.4 The Cut
Predicate and Negation (June 26 + 27, 2017)
 5.5 Input and Output
(June 27, 2017)
 5.6 MetaProgramming
(June 27, 2017)  to be continued
Here you find exams from the 2006, 2008, 2010, 2013, and 2015 lectures on logic
programming (partially in German).
However, as the computer science curriculum has been changed after
the 2008 lecture took place, the conditions for the 2006 and 2008 exams were different from
the ones since 2010. First, the old exams were not
designed to determine the final grade for the logic programming course, but they were only
needed for the
acquisition of the Übungsschein. Second, they only took 90 minutes, while the exams since
2010 take 120 minutes.
Note that in earlier versions of the lecture, there were sometimes
different exams for Bachelor and Master students ("V3B" and "V3M"). In contrast, there will be just one
exam this time. Keep these differences in mind when practising with the old
exams. Furthermore, we strongly recommend that you solve the old exams without looking
into the solutions first and that you also respect the time limit
(90 minutes for the exams of 2006 and 2008, 120 minutes for the exams of 2010, 2013, and 2015).
 Exam 2006, Solution 2006
 Exam 2008, Solution 2008
 Exam V3B 2010, Solution V3B 2010
 Exam V3M 2010, Solution V3M 2010
 Exam V4 2010, Solution V4 2010
 Exam V3B 2010 (2nd), Solution V3B 2010 (2nd)
 Exam V3M 2010 (2nd), Solution V3M 2010 (2nd)
 Exam V4 2010 (2nd), Solution V4 2010 (2nd)
 Exam V3B 2013, Solution V3B 2013
 Exam V3M 2013, Solution V3M 2013
 Exam V3B 2013 (2nd), Solution V3B 2013 (2nd)
 Exam V3M 2013 (2nd), Solution V3M 2013 (2nd)
 Exam V3B 2015, Solution V3B 2015
 Exam V3M 2015, Solution V3M 2015
 Exam V3B 2015 (2nd), Solution V3B 2015 (2nd)
 Exam V3M 2015 (2nd), Solution V3M 2015 (2nd)