954,499 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Need some help with Prolog problem

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.

lotrsimp12345
Posting Pro in Training
413 posts since Jun 2009
Reputation Points: 47
Solved Threads: 2
 

please help.

lotrsimp12345
Posting Pro in Training
413 posts since Jun 2009
Reputation Points: 47
Solved Threads: 2
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You