%trace
predicates
father(symbol,symbol)
mother(symbol,symbol)
male(symbol)
female(symbol)
% uncle(symbol,symbol)
husband(symbol,symbol)
sister(symbol,symbol)
brother(symbol,symbol)
grandfather(symbol,symbol)
grandmother(symbol,symbol)
aunty(symbol,symbol)
clauses
father(satishbhai,dhirajlal).
father(bharatbhai,dhirajlal).
father(hemal,satishbhai).
father(neha,satishbhai).
father(nirav,bharatbhai).
father(bhavanaben,kantilal).
father(gitaben,keshavbhai).
mother(hemal,bhavanaben).
mother(neha,bhavanaben).
mother(bhavanaben,vasumatiben).
mother(nirav,gitaben).
mother(pintu,gitaben).
mother(gitaben,sharadaben).
mother(satishbhai,sharadaben).
mother(bharatbhai,sharadaben).
male(hemal).
male(nirav).
male(satishbhai).
male(bharatbhai).
male(dhirajlal).
male(kantilal).
male(keshavbhai).
female(neha).
female(pintu).
female(bhavanaben).
female(bijal).
female(gitaben).
female(vasumatiben).
female(sharadaben).
husband(bhavanaben,satishbhai).
husband(gitaben,bharatbhai).
husband(bijal,nirav).
uncle(hemal,bharatbhai).
uncle(nirav,satishbhai).
brother(X,Y) :- father(X,A),father(Y,A),male(X),male(Y).
% brother(X,Y) :- brother(Y,X),male(X),male(Y).
sister(X,Y) :- father(X,A),father(Y,A),female(Y).
aunty(X,Y) :- husband(Y,Z),
brother(Z,W),
Z <> W,
father(X,W).
grandfather(X,Y) :-
male(Y),
father(X,W),
father(W,Y).
grandfather(X,Y) :-
male(Y),
mother(X,W),
father(W,Y).
grandmother(X,Y) :-
female(Y),
father(X,W),
mother(W,Y).
grandmother(X,Y) :-
female(Y),
mother(X,W),
mother(W,Y).