Question
The Family Tree Suppose that we want to represent a family tree, so that we can ask questions like is john related to ..., or
The Family Tree
Suppose that we want to represent a family tree, so that we can ask questions like "is john related to ...", or "list all john's sisters" and so on. The basic entities will be people; the properties we will want to look at will be father, mother, brother, sister, aunt, uncle, grandmother, grandfather, mother_in_law, father_in_law, ancestor, descendent. Below you have three basic predicates, male, female and parent, which will describe a family by a series of facts. Take the following family tree as an example:
James I m. Claudia
|
|
+----------------+-----------------+
| |
Charles I m. Fay Elizabeth m. Paul
| |
| |
+----------+------------+ |
| | | |
Catherine Charles II James II Sophia m. Sam
|
|
|
George I
male(james1).
male(charles1).
male(charles2).
male(james2).
male(george1).
male(paul).
male(sam).
female(catherine).
female(elizabeth).
female(sophia).
female(claudia).
female(fay).
/* parent ( parent, child). */
parent(charles1, james1).
parent(elizabeth, james1).
parent(charles2, charles1).
parent(catherine, charles1).
parent(james2, charles1).
parent(sophia, elizabeth).
parent(george1, sophia).
Copy the above facts into notepad. Add rules to determine each of the following relationships:
- father
- mother
- brother
- sister
- aunt
- uncle
- grandmother
- brother_in_law
- mother_in_law
- father_in_law
- ancestor
- descendent
Note: You will NOT get credit for typing in the above relationships as facts.
Helpful hint: Think carefully about what makes someone an aunt.
Be sure to document your program using the standard heading. You do not need to include an input or output description. You DO need to explain what the program does (in your documentation). You do not need a friendly user interface.
Turn in
- a print out of your program (showing your documentation, the above facts and your rules).
- a screen capture of a run showing a test of each rule.
Please name your text file: family.pro
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started