CS322 Fall 1997
Assignment 2 -- Solution

Question 1

[10 marks] Consider the following knowledge base:
r(a).
r(e).
p(c).
q(b).
s(a,b).
s(d,b).
s(e,d).
p(X) <- q(X) & r(X).
q(X) <- s(X,Y) & q(Y).
Show the set of ground atomic formulae derivable from this KB. The atoms derivable from the KB, in order are:
r(a).
r(e).
p(c).
q(b).
s(a,b).
s(d,b).
s(e,d).
q(a).
p(a).
q(d).
q(e).
p(e).

Question 2

[10 marks] Using CILog syntax, write axioms to show how an overhead projector can be added to the electrical domain. The overhead projector needs to be plugged in to a live power outlet, the projector needs to be turned on, and the projector needs to be OK for it to be lit. The mirror needs to be in place and the projector focused in order to see a transparency that is on the projector. Your axiomatization should allow for multiple overhead projectors.

You need to:

We need the source program that included the intended interpretation of all symbols, and evidence that it runs.

Here is a simple extension:

% ohp_lit(OHP) is true if the projector OHP's lamp is lit.
ohp_lit(OHP) <-
   projector(OHP) &
   turned_on(OHP) &
   ok(OHP) &
   plugged_into(OHP,Outlet) &
   live(Outlet).

% could_see_transparency(OHP) is true if you could see a transparency
% that is on projector OHP.
could_see_transparency(OHP) <-
   projector(OHP) &
   ohp_lit(OHP) &
   mirror_in_place(OHP) &
   focussed(OHP).

% can_see(Tran) is true if you can see tansparency Trans
can_see(Tran) <-
   on(Tran,OHP) &
   could_see_transparency(OHP).

% projector(OHP) is true if OHP is an overhead projector
% ohp1, ohp2 and ohp3 are overhead projectors
projector(ohp1).
projector(ohp2).
projector(ohp3).

% turned_on(OHP) is true if projector OHP is turned on.
turned_on(ohp1).
turned_on(ohp2).

% ok(OHP) is true of projector OHP isn't broken
ok(ohp1).
ok(ohp2).

% plugged_into(OHP,Outlet) is true if projector OHP is plugged into
% electrical outlet Outlet
plugged_into(ohp1,p1).
plugged_into(ohp2,p2).

% mirror_in_place(OHP) is true if ptojector OHP's mirrir is where it
% should be.
mirror_in_place(ohp1).
mirror_in_place(ohp2).

% focussed(OHP) is true if projector OHP is focussed
focussed(ohp1).

% on(Tran,OHP) is true if transparency Tran is on projector OHP.
on(lect2_3,ohp1).
on(lect2_4,ohp2).
Here is a trace of this program (along with "elect.cil"):
CILOG Version 0.11. Copyright 1997, David Poole.
CILOG comes with absolutely no warranty.
All inputs end with a period. Type ``help.'' for help.
cilog: load 'elect.cil'.
CILOG theory elect.cil loaded.
cilog: load 'ohp.cil'.
CILOG theory ohp.cil loaded.
cilog: ask ohp_lit(OHP).
Answer: ohp_lit(ohp1).
  [ok,more,how,help]: more.
Answer: ohp_lit(ohp2).
  [ok,more,how,help]: more.
No more answers.
cilog: ask could_see_transparency(OHP).
Answer: could_see_transparency(ohp1).
  [ok,more,how,help]: more.
No more answers.
cilog: ask can_see(Tran).
Answer: can_see(lect2_3).
  [ok,more,how,help]: more.
No more answers.
cilog: