Up
Go up to Question 2

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.

    Here is the derivation, always selecting the leftmost atom in the body:

    yes(W,T) <- attends(W,T).
      choose clause 1, (with variables renamed) substitution: W/P1,T/D1
    yes(P1,D1) <- proctors_exam(P1,C1) & exam(C1,D1).
       choose clause 2, substitution  P1/P2,C1/C2
    yes(P2,D1) <- instructor(P2,C2) & exam(C2,D1).
       choose clause 6, substitution  P2/david, C2/cs322
    yes(david,D1) <- exam(cs322,D1)
       *** choose clause 4, substitution D1/oct22
    yes(david,oct22) <-
    
    You solution should be the same, up to renaming of variables.
  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.
       at *** choose clause 5, substitution D1/dec24
    yes(david,dec24) <-
    

David Poole

Up