Programación Lógica /
Logic Programming (2023-2024)


Welcome to the home page of "Programación Lógica / Logic Programming," a one-semester course on logic and constraint logic programming, covering basic concepts and programming practice.

This course is a mandatory subject in third year of the current 4 year Bachelor in Computer Science and Mathematics program and an elective in the Master's in Artificial Intelligence taught at the School of Computer Science, Technical University of Madrid (Department of Artificial Intelligence).

Please note that these pages are all under permanent construction/change. Suggestions, comments, questions, raves, rants, etc. should be directed by email to <>.

Note for UPM students: Basic course info, bibliography, grading, mailing lists, etc. can be found in the UPM Moodle site for the course.

Course Slides (in English) (note that these notes may be improved during the course):
Programming system used in the course: Recommended textbook:
GNU Emacs Reference Card
Using this material: You are welcome to use all or part of this course material, but if you do so we ask you to please quote the origin. We would also very much appreciate if you let us know that you are using it and send us any errors you may find by email to <>. Thanks in advance.

General note: We used to start with basic theory (resolution, etc..), then Logic Programming, then Prolog. Soon, we decided to start directly with a quick introduction to Logic Programming and jump as soon as possible to actual programming (both traditional Prolog and its more recent extensions, including constraint programming), and to relate things at the end back to logic theory. This is the version in these pages -- which is not very different from the previous one, except for the order. If you prefer to start with theory, just use the theory slides first and remove some slides (first order languages and unification, mainly) from the introduction to logic programming. (One of the reasons for doing things this way is that our students take two semesters of logic prior to this course and are therefore quite familiar with, e.g., resolution, models. etc., but not with logic programming.)

See also Some Thoughts on How to Teach Prolog for some of the rationale behind this course material and Teaching Prolog with Active Logic Documents (both in the book Prolog - The Next 50 Years) for some of the tools that we have developed for teaching Prolog, LP, CLP, etc.