SO it says given the follwing relations

father (X,Y) says that X is the father of Y
mother (X,Y) says that X is the mother of Y
female(X) says that X is female
male(X) says that X is male

Define a sister relation so that sister(X,Y) says that X is a sister of Y

Here's what I have:

father(X,Y).
mother(X,Y).
female(X).
male(X).

sister(X,Y):-female(X),mother(M,Y), mother(M,X), father(F,X), father(F,Y).

So basically to be a sister, X must be a female, and both X and Y must have same mother and father.

Is this the correct approach?

Thanks.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.