UNIVERSITY OF SOUTH CAROLINA Department of Computer Science and Engineering Using Definite Knowledge: Two Short Examples Notes for Ch.3 of Poole et al. CSCE 580 Marco Valtorta
UNIVERSITY OF SOUTH CAROLINA Department of Computer Science and Engineering Likes? Use only two constants (for “my cat” and “me”) and invent predicate symbols to express these assumptions in definite clause logic. Ask what my cat eats. (likes.cil) Birds like worms Cats like fish Friends like each other My cat is my friend My cat eats everything it likes
UNIVERSITY OF SOUTH CAROLINA Department of Computer Science and Engineering Likes, ctd. % Birds like worms –likes(X,Y) <- bird(X) & worm(Y). % Cats like fish –likes(X,Y) <- cat(X) & fish(Y). % Friends like each other –likes(X,Y) <- friend(X,Y). –likes(X,Y) <- friend(Y,X). % My cat is my friend –friend(my_cat, me). % My cat eats everything it likes –eats(my_cat,X) <- likes(my_cat,X).
UNIVERSITY OF SOUTH CAROLINA Department of Computer Science and Engineering Likes, ctd. Query: –eats(my_cat,W). Derivation: –yes (W) eats(my_cat,W). –yes(W) likes(my_cat,W). –Yes(W) friend(my_cat,W). –yes(me) friend(my_cat, me). –yes(me). Issue: likes is ambiguous, as many terms in natural language are.
UNIVERSITY OF SOUTH CAROLINA Department of Computer Science and Engineering Exercise 3.1 animal(X) <- dog(X). gets_pleasure(X, feeding) <- animal(X). likes(X,Y) <- person(X) & animal(Y) & owns(X,Y). does(X,Y) <- person(X) & gets_pleasure(Z,Y) & likes(X,Z). dog(fido). person(mary). owns(mary, fido). (hw5.cil)