How can you define mother/father/sister/brother relationships such that asserting sister(bart, maggie)
makes ?- female(maggie)
evaluate as true?
I'm working on a toy family relation problem. This is what I have:
parent(bart, homer).
parent(bart, marge).
parent(lisa, homer).
parent(lisa, marge).
male(homer).
male(bart).
female(marge).
female(lisa).
mother(X,Y) :- female(Y), parent(X,Y).
father(X,Y) :- male(Y), parent(X,Y).
sister(X,Y) :- female(Y), father(X,F), father(Y,F), mother(X,M), mother(Y,M), X/=Y.
I'd like to be able to do the following:
sister(bart, maggie).
?- female(maggie).
% expect yes
i.e. support the "common sense" definition where if you assert that maggie is bart's sister, we know that maggie is female, while still obtaining sister(bart, lisa)
being true based on the parent/gender assertions I already have.