Fifth Second Programming Assignment, CS 463

Due at the beginning of class on Friday, Nov. 6th.

There are two familial relations in this assignment: nth child and nth cousin, k times removed.

For now, you're going to write about your family. If necessary, make up some more family members so you can properly test these predicates. Include at least 4 generations, and at least 15 family members.

Remember that nth cousins share a common great^n-grandparent, where n is the same for both cousins. If the common ancestor is n steps from cousin1 and k steps from cousin2, and n > k, then cousin1 and cousin2 are kth cousins, n - k removed. Now define predicates for the following familial relations:

You will also need unary predicates for male, and female, and a way of discussing age (e.g., age(Mary,X)).

In your knowledge base, include as facts only the child relation, age, and gender of each of at least 10 people in your family. Do not state as facts any other relations. For the sake of simplicity, do not use twins, triplets, etc., or find a way of specifying age that will distinguish everyone's age.

Now (in script mode) query the program to find all pairs of nth cousins k times removed. Note that k and n are effectively bounded by the number of generations in your geneology database. Your query should have 4 variables: N, K, and X and Y (the nth cousins k times removed).

Next, still in script mode, find all kth children, where K is a variable, as is the variable for the kth child. And (if your family tree allows), find all second sons or all second daughters.

To submit

Your geneological database, your code, and the script of your queries. Also a brief statement of what you've learned.