Question
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
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 LING ABRAHAM MONA CLANCY JACKIE HERB HOME MARGE PATTY SELMA BART LISA MAGGIE LINGStep 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