Created
March 18, 2016 03:52
-
-
Save karsai5/b4213e2f73625d5eec62 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
father(james, patrick). | |
father(patrick,pjk). | |
father(pjk, joseph). | |
father(joseph, jfk). | |
father(joseph, bobby). | |
father(joseph, eunice). | |
father(jfk, caroline). | |
father(jfk, jfk_jr). | |
mother(maria, patrick). | |
mother(bridget, pjk). | |
mother(mary_augusta, joseph). | |
mother(rose, jfk). | |
mother(rose, bobby). | |
mother(rose, eunice). | |
mother(jacqueline, caroline). | |
mother(jacqueline, jfk_jr). | |
parent(X,Y) :- father(X,Y). | |
parent(X,Y) :- mother(X,Y). | |
sibling(A,B) :- parent(P,A), parent(P,B), not(A=B). | |
cousin(X,Y) :- parent(Xp,X), parent(Yp,Y), sibling(Xp,Yp). | |
cousin(X,Y) :- parent(Xp,X), parent(Yp,Y), cousin(Xp,Yp). | |
ancestor(A, B) :- parent(A, B). | |
ancestor(A, B) :- parent(A, C), ancestor(C, B). |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment