% Quiz 3 answers - 5pm class - following class discussion /* If Fluffy is a tabby, then Fluffy is a cat. If X is a tabby, then X is a cat. -- would have been clearer what was wanted cat(X) :- tabby(X). */ cat(Fluffy) :- tabby (Fluffy). /*cat(fluffy) :- tabby(fluffy). not general enough */ /* If it is Saturday and it is April, then it is raining. */ raining :- day(saturday), month(april). /* raining(today) :- saturday(today), april (today). -- not as good */ /* If Sally is a female and Sally is your child, then Sally is your daughter. which would be best would be dependent on the rest of the database and the context */ daughter(Sally) :- female(Sally) daughter(Sally) :- female(Sally), child(Sally). my_daughter(Sally) :- female(Sally), my_child(Sally). daughter(Sally,You) :- female(Sally), child_of(Sally,You). my(daughter,Sally) :- female(Sally), my(child,Sally). % If X is happy, then X is rich or X is beautiful. A -> B /= B -> A rich(X) :- happy(X). beautiful(X) :- happy(X). /* 1. happy(X) :- rich(X);beautiful(X). 2. happy(X) :- rich(X). 3. happy(X) :- beautiful(X). Note that 1 is identical to 2 and 3 together but that neither of them represents the given statement which may or may not make sense but is what was on the quiz. */