2.7 The following program says that two people are relatives if (a) one is an ancestor of...

Question:

2.7 The following program says that two people are relatives if

(a) one is an ancestor of the other, or

(b) they have a common ancestor, or

(c) they have a common successor: relatives(X, Y) :- ancestor(X, Y). relatives(X, Y) :- ancestor( Y, X). relatives(X, Y) :- % X and Y have a common ancestor ancestor(Z, X), ancestor(Z, Y). relatives(X, Y) :- % X and Y have a common successor ancestor( X, Z), ancestor( Y, Z). Can you shorten this program by using the semicolon notation?

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  book-img-for-question
Question Posted: