Assignment 3, CS 156

100 points, due April 22, 1997

Assume that kinship information is represented by means of a ternary "children" predicate, where the first argument is a mother, the second a father, and the third a list of their children. Assume also unary "male" and "female" predicates.

(a) (30 points) Define "mother", "father", and "parent" predicates for this representation.

(b) (30 points) Define a binary "daughter" predicate for the relation that one individual is a daughter of another, and a binary "sons" predicate for the relation between an individual and the list of all that individual's sons. You should be able to handle cases where an individual has children by more than one partner, but you may assume that nobody is both a mother and a father, and that everyone is a male or a female but not both.

(c) (40 points) Define two predicates that relate a given individual to a list of all that individual's descendants, where the list is in preorder. For the first predicate, assume that all male children precede all female children. For the second, assume that the order of the children is the order given in the knowledge base.

Use the knowledge base publicized under the file name a3.dat.

Test with at least the following 18 queries:

mother(X,Y)      father(X,Y)    parent(X,Y)
daughter(X,Y)    sons(liz,X)    sons(phil,X)
sons(chuck,X)    sons(anne,X)   sons(queenie,X)
sons(rex,X)
descendants(liz,X)         descendants(phil,X)
descendants(queenie,X)     descendants(rex,X)
descendants2(liz,X)        descendants2(phil,X)
descendants2(queenie,X)    descendants2(rex,X)
You may (but you needn't) use the "findall" predicate to do the testing (making sure that it is clear what part of the printout counts as a result of the given tests and what doesn't).