Question: (15 points) Family tree Probably the most common first example of a logic program is that involving a family tree. Give the following family tree:

 (15 points) Family tree Probably the most common first example of

(15 points) Family tree Probably the most common first example of a logic program is that involving a family tree.

Give the following family tree:

a) Build a knowledge base using the predicate parent/2, which encodes a person is the parent of another person; male/1, which encodes a person is a male; and female/1, which encodes a person is a female.

b) Add the following rules to the knowledge base:

i. mother(X, Y), which means X is Ys mother.

ii. father(X, Y), which means X is Ys father .

iii. grandfather(X, Y), which means X is Ys grandfather. (Note: Y can have two grandfathers: one on the maternal side, the other on the paternal side.)

iv. grandmother(X, Y), which means X is Ys grandmother. (Note: Y can have two grandfathers: one on the maternal side, the other on the paternal side.)

v. siblings(X,Y). which means X and Y are siblings.

vi. You may add aunt, uncle and cousin.

c) Test your implementation by asking queries. Write down your query and also the result.

i. Who are the siblings of Lisa?

ii. List all the grandparents of Lisa?

iii. List all family members? (Note: Same type of facts and rules should be grouped together, otherwise, you will get discontiguous error and clauses will be ignored.)

ABRAHAM MONA CLANCY JACKIE HERB HOME MARGE PATTY SELMA BART LISA MAGGIE ING

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!