Knowledgebases

The food/color/like facts are here; the thing facts are here.

Exercises

  1. Hiding the on-slide answers from yourself, do the queries on slides 38-39, 42-43
  2. Using the food/color/like facts, do these queries:
    1. Who likes carrots?
    2. Who likes baseball and a food?
    3. Who likes baseball and a red food?
    4. Who likes somebody who likes baseball?
    5. Create and solve two more queries.
  3. Using the thing facts, do these queries:
    1. What are the colors of non-foods?
    2. What are colors that are a color of both a food and a non-food?
    3. Create and solve one more query.
  4. Add a collection of two-term facts to your eca1 facts and then create and solve five multiple-goal queries.
    (If you missed Monday's lecture, see slide 13 for eca1.)
  5. Using only the little bit of unification we've seen, predict the results of the following queries:
    1. ?- A = B, C = 10, C = B, write(A).
    2. ?- write(A), A=999, write(A).
    3. ?- A=1, B=2, C=A, write(C), write(C=B).
    4. ?- Z=A+B, X=Y, Y=x(A,B), X=x(10,20).
  6. Devise and try two unification experiments.
  7. These are getting ahead of ourselves a little bit but see what you make of these:
    1. Try the query ?- write("testing").
    2. Try the query ?- display([one,two,three]).