Department of Computer Science and Technology

Course pages 2019–20

Prolog

Our Prolog course has some of the characteristics of a flipped classroom: the core material is provided in a series of online lectures which for Lecture 2 onwards you should view before the lecture, where we will reprise that content with the help of worked examples.

All lectures this year are in the William Gates Building, Lecture Theatre 1.

So for this course we have two sets of material:

1. The video material, with the embedded slides (each also available as PDF):

This is provided via a dedicated site:

http://prolog.cl.cam.ac.uk/ls/teaching/1920/prolog

For example the first introductory video is Prolog Basics (Raven login).

The 'PDF's containing the slides used in each video (should you want to print them to annotate with your own notes) are available by clicking the 'PDF' link at the bottom-right of each video as in the example above (PDF: here).

2. We also have the lecture slides:

  1. Lecture 1 is an introduction to Prolog and this course. We will view the "Prolog Basics" video and spend time talking about why Prolog is a language you should learn about.
  2. Slides for Lecture 2 Prolog rules and lists.
  3. Slides for Lecture 3 Arithmetic, Backtracking
  4. Slides for Lecture 4 More backtracking, Generate and Test, the Search Tree.
  5. Slides for Lecture 5 The minefield of extralogical predicates like Cut, Negation, Database update.
  6. Slides for Lecture 6 Graph search. Exam considerations.
  7. Slides for Lecture 7 Difference Lists, Accumulators
  8. Slides for Lecture 8 Q&A catchup, iterative deepening.

Errata

Errors in the lecture videos and questions are indexed by video number (V), slide number (S) and time (T).

ErrataCorrigeFrom
15bNo slide or question indexSlide and question index builtrsa33
1210divintdiv (div is an infix operator in some versions of prolog)hp343
86-94:30Video and audio are not quite in sync(under investigation)awc32, vbt22
7138queenseightQueensns532
7When asking to generalise from 8-Queens to n-Queens its not clear what the chessboard size should doYou should generalise to n-Queens on an nxn chessboardcdk23
38The text typed during the lecture on this slide should read rule2 rather than rule.Correct....jp581
38Implicit binding of the exists quantifier is too large. This is important because otherwise the statement holds when thing(1,2) and thang(2) is true but rule2(1) is false - this happens because false implies anything and the overlarge capture of the exists allows you pick a z for which the LHS is false.There should be an open bracket before the exists and a close bracket before the implication arrowjp581
8610:00eval(mult(A2,B2),C2) :- eval(A2,A3),eval(B2,B3), C2 is A2*B2 is incorrect.It should read C2 is A3*B3.mjh233
1723The domain of P is {1,2,3,4}The domain of P is {1,4}.arg58