You are on page 1of 2

male(karim).

male(rahim).
male(abul).
male(jasim).
male(tom).
male(rocky).

female(rahima).
female(mia).
female(mina).
female(poly).

husband(karim,rahima).
husband(rahim,mina).
husband(jasim,mia).

father(karim,rahim).
father(karim,abul).
father(karim,mia).
father(rahim,tom).
father(jasim,rocky).
father(jasim,poly).

mother(rahima,rahim).
mother(rahima,abul).
mother(rahima,mia).
mother(mina,tom).
mother(mia,rocky).
mother(mia,poly).

brother(rahim,abul).
brother(rahim,mia).
brother(abul,mia).
brother(abul,rahim).

sister(mia,rahim).
sister(mia,abul).
sister(poly,rocky).

grand_father(karim,tom).
grand_father(karim,rocky).
grand_father(karim,poly).

grand_mother(rahima,tom).
grand_mother(rahima,rocky).
grand_mother(rahima,poly).

son_wife(mina,karim).
son_wife(mina,rahima).
daughter_husband(jasim,karim).
daughter_husband(jasim,rahima).

uncle(rahim,rocky).
uncle(rahim,poly).
uncle(abul,rocky).
uncle(abul,poly).
uncle(abul,tom).
uncle(jasim,tom).
aunty(mia,tom).
aunty(mina,rocky).
aunty(mina,poly).

wife(X,Y):-female(X),husband(Y,X).
son(X,Y):-male(X),father(Y,X).
son(X,Y):-male(X),mother(Y,X).
daughter(X,Y):-female(X),father(Y,X).
daughter(X,Y):-female(X),mother(Y,X).
grand_son(X,Y):-male(X),grand_father(Y,X).
grand_son(X,Y):-male(X),grand_mother(Y,X).
grand_daughter(X,Y):-female(X),grand_father(Y,X).
grand_daughter(X,Y):-female(X),grand_mother(Y,X).

father_in_law(X,Y):-male(X),son_wife(Y,X).
father_in_law(X,Y):-male(X),daughter_husband(Y,X).
mother_in_law(X,Y):-female(X),son_wife(Y,X).
mother_in_law(X,Y):-female(X),daughter_husband(Y,X).
sister_in_law(X,Y):-wife(X,Z),brother(Z,Y).
brother_in_law(X,Y):-husband(X,Z),sister(Z,Y).
husband_brother(X,Y):-brother(X,Z),husband(Z,Y).
husband_sister(X,Y):-sister(X,Z),husband(Z,Y).
wife_brother(X,Y):-brother(X,Z),wife(Z,Y).
wife_sister(X,Y):-sister(X,Z),wife(Z,Y).
cousin(X,Y):-son(X,Z),uncle(Z,Y).
cousin(X,Y):-son(X,Z),aunty(Z,Y).
cousin(X,Y):-daughter(X,Z),uncle(Z,Y).
cousin(X,Y):-daughter(X,Z),aunty(Z,Y).

You might also like