Prev Up
Go backward to Question 1
Go up to Top

Question 2

Consider the following Datalog program (also available here) with clauses numbered:
1: attends(P,D) <- proctors_exam(P,C) & exam(C,D).
2: proctors_exam(P,C) <- instructor(P,C).
3: proctors_exam(P,C) <- teaching_assistant(P,C).
4: exam(cs322,oct22).
5: exam(cs322,dec24).
6: instructor(david,cs322).
7: teaching_assistant(rita,cs322).
8: teaching_assistant(leslie,cs322).
CILog always selects the leftmost conjunct to resolve, and always chooses the topmost clause that leads to a solution.
  1. Give a top-down derivation, showing all substitutions, for the first answer for the query:
    ?attends(W,T).
    Specify which clause was chosen at each stage.
  2. Give a top-down derivation, showing all substitutions, for the second answer for the same query. Only show the part of the derivations that is not shared with the first answer.
  • Solution

  • David Poole

    Prev Up