Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

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 LING

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Repairing And Querying Databases Under Aggregate Constraints

Authors: Sergio Flesca ,Filippo Furfaro ,Francesco Parisi

2011th Edition

146141640X, 978-1461416401

More Books

Students also viewed these Databases questions