Your rule of brother already verifies that brother(bob, bob)
will fail because it calls sibling(X, Y)
, which does the check to make sure X \= Y
already.
Also, it looks as though everything is working on my machine, but I had to change the dashes on these lines:
aunt(X, Y) :– female(X), sibling(X, Z), parent(Z, Y).
aunt(X, Y) :– female(X), spouse(X, W), sibling(W, Z), parent(Z, Y).
to:
aunt(X, Y) :- female(X), sibling(X, Z), parent(Z, Y).
aunt(X, Y) :- female(X), spouse(X, W), sibling(W, Z), parent(Z, Y).
Yeah, they look identical, but the dashes in the top version are slightly longer... and seemed to cause problems when I "consulted" the file.
I only caught that because I created a Prolog color scheme for Notepad++, if anyone is interested I can post it online.