101k views
3 votes
Add a clause for identifying the sibling relationship. The predicate on the left handside of the rule should be sibling(X, Y), such that sibling(alice, edward) should be true, and X, Y do not need to be different.

1 Answer

6 votes

Answer:

following are the solution to this question:

Step-by-step explanation:

For Siblings (X,Y);

Alice(X),

Edward(Y),

parent(Edward,Victoria,Albert) //Albert is the father F

parent(Alice,Victoria,Albert) //Victoria is the Mother M

Therefore,

X is siblings of Y when;

X is the mother M and father is F, and Y is the same mother and father as X does, and satisfing the given condition.

It can be written as the following prolog rule:

Siblings_of(X,Y):

parents(X,M,F)

parents(Y,M,F)

Siblings_of(X,Y): parents(X,M,F), parents(Y,M,F)

|? - sibling_of(alice,edward).

yes

|? - Sibling_of(alice,X).

X=Edward

|? - Sibling_of(alice,alice).

yes

User Mnn
by
5.5k points