Last active
October 19, 2018 18:06
-
-
Save reverendpaco/bf342ced3ca8447180d8df2c9bef6880 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
male(terah). | |
male(abraham). | |
male(nahor). | |
male(haran). | |
male(isaac). | |
male(ismael). | |
male(jacob). | |
female(sarah). | |
female(hagar). | |
father(terah, sarah). | |
father(terah, abraham). | |
father(abraham, isaac). | |
father(isaac, jacob). | |
father(abraham, ismael). | |
mother(sarah,isaac). | |
mother(hagar,ismael). | |
parent(Parent,Child) :- father(Parent,Child). | |
parent(Parent,Child) :- mother(Parent,Child). | |
son_of(Child,Parent) :- | |
male(Child), parent(Parent,Child). | |
daughter_of(Child,Parent) :- | |
female(Child), parent(Parent,Child). | |
grandparent_of(GrandChild,GrandParent) :- | |
distinct( (GrandParent,GrandChild), | |
(parent(GrandParent,Someone),parent(Someone,GrandChild)) ). | |
ancestor_of(Descendant,Ancestor) :- | |
distinct( (Ancestor,Descendant),parent(Ancestor,Descendant)). | |
ancestor_of(Descendant,Ancestor) :- | |
distinct((Ancestor,Descendant), | |
(parent(Ancestor,X), ancestor_of(Descendant,X))). |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment