Untitled

mail@pastecode.io avatar
unknown
prolog
2 years ago
3.4 kB
4
Indexable
Never

/* immediate family */
parent(mustafa,nehal).
parent(mustafa,farkhunda).
parent(mussab,nehal).
parent(mussab,farkhunda).
parent(omer,nehal).
parent(omer,farkhunda).
parent(osman,nehal).
parent(osman,farkhunda).

/*father's side cousins:*/
parent(rouza,nishat).
parent(rouza,musarrat).

parent(laiba,fayyaz).
parent(laiba,sabeeha).
parent(aymen,fayyaz).
parent(aymen,sabeeha).
parent(hamza,fayyaz).
parent(hamza,sabeeha).

parent(dawood,inam).
parent(dawood,huma).
parent(usama,inam).
parent(usama,huma).
parent(midra,inam).
parent(midra,huma).

parent(jawwad,allaudin).
parent(jawwad,hina).
parent(faiq,allaudin).
parent(faiq,hina).
parent(nabeel,allaudin).
parent(nabeel,hina).
parent(aqsa,allaudin).
parent(aqsa,hina).
parent(afifa,allaudin).
parent(afifa,hina).

/*both side mutual cousins*/
parent(huraira,athar).
parent(huraira,uzma).
parent(abdullah,athar).
parent(abdullah,uzma).
parent(mahnoor,athar).
parent(mahnoor,uzma).

/* mother's side cousins */
parent(sajjad,akbar).
parent(bilal,rakhshinda).
parent(bilal,iqbal).
parent(fatima,rakhshinda).
parent(fatima,iqbal).

/* paternal grandfather's family */
parent(nehal,niaz).
parent(nishat,niaz).
parent(fayyaz,niaz).
parent(nehal,tahira).
parent(nishat,tahira).
parent(fayyaz,tahira).
parent(huma,niaz).
parent(huma,tahira).
parent(hina,niaz).
parent(hina,tahira).
parent(uzma,niaz).
parent(uzma,tahira).

/* maternal grandfather's family */
parent(farkhunda,ayn).
parent(rakhshinda,ayn).
parent(farkhunda,suwaida).
parent(rakhshinda,suwaida).
parent(athar,ayn).
parent(athar,suwaida).
parent(akbar,ayn).
parent(akbar,suwaida).
parent(bashar,ayn).
parent(bashar,suwaida).

/* gender facts */
male(mustafa).
male(mussab).
male(omer).
male(osman).
male(nehal).
male(nishat).
male(niaz).
male(fayyaz).
male(hamza).
male(usama).
male(dawood).
male(inam).
male(jawwad).
male(faiq).
male(nabeel).
male(abdullah).
male(huraira).
male(athar).
male(allaudin).
male(akbar).
male(bashar).
male(ayn).
male(bilal).
male(iqbal).
male(sajjad).

female(huma).
female(hina).
female(uzma).
female(farkhunda).
female(rakhshinda).
female(suwaida).
female(tahira).
female(sabeeha).
female(musarrat).
female(laiba).
female(aymen).
female(rouza).
female(aqsa).
female(afifa).
female(mahnoor).
female(fatima).

mother(X,Y):- /* mother of X is Y */
    parent(X,Y),
    female(Y).

father(X,Y):- /* father of X is Y */
    parent(X,Y),
    male(Y).

husbandwife(X,Y) :- /* X is a husband of Y wife */
    father(Z,X),
    mother(Z,Y),
	X \= Y.

sibling(X,Y) :- /* X is a sibling of Y */
    father(X,Z),
    father(Y,Z),
    X \= Y.

grandfather(X,Y):- /* X is grandfather of Y */
    parent(Y,Z),
    parent(Z,X),
	male(X).

grandmother(X,Y):-
    parent(Y,Z),
    parent(Z,X),
    female(X).

aunt(X,Y):- /* X is an aunt of Y */
    parent(Y,Z),
    sibling(X,Z),
    female(X).
    
uncle(X,Y):- /* X is an uncle of Y */
    parent(Y,Z), sibling(X,Z),
	male(X).

cousinbrother(X,Y):- /* X is cousin brother of Y */
    parent(X,Z),
    parent(Y,W),
    sibling(Z,W),
	male(X).

cousinsister(X,Y):- /* X is cousin sister of Y */
    parent(X,Z),
    parent(Y,W),
    sibling(Z,W),
    female(X).

cousin(X,Y):- /* X is cousin of Y */
    parent(X,Z),
    parent(Y,W),
    sibling(Z,W).