Created
June 6, 2018 07:38
-
-
Save ckazu/06697521ab2baee81344bda1904daee9 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
% facts. 磯野家 | |
male(波平). | |
male(カツオ). | |
male(タラ). | |
male(マスオ). | |
female(フネ). | |
female(ワカメ). | |
female(サザエ). | |
parent(波平, サザエ). | |
parent(波平, カツオ). | |
parent(波平, ワカメ). | |
parent(フネ, サザエ). | |
parent(フネ, カツオ). | |
parent(フネ, ワカメ). | |
parent(サザエ, タラ). | |
parent(マスオ, タラ). | |
% rules. | |
grandparent(X, Z):- | |
parent(X, Y), | |
parent(Y, Z). | |
father(X, Y):- | |
parent(X, Y), | |
male(X). | |
mother(X, Y):- | |
parent(X, Y), | |
female(X). | |
grandfather(X, Z):- | |
grandparent(X, Z), | |
male(X). | |
grandmother(X, Z):- | |
grandparent(X, Z), | |
female(X). | |
sibling(X, Y):- | |
father(A, X), | |
father(A, Y), | |
mother(B, X), | |
mother(B, Y), | |
X \= Y. | |
% 親戚関係 | |
male(波平の父). | |
female(波平の母). | |
parent(波平の父, 波平). | |
parent(波平の父, 海平). | |
parent(波平の父, なぎえ). | |
parent(波平の母, 波平). | |
parent(波平の母, 海平). | |
parent(波平の母, なぎえ). | |
parent(なぎえ, ノリスケ). | |
parent(ノリスケ, イクラ). | |
parent(タイ子, イクラ). | |
いとこ(X, Y):- | |
parent(A, X), | |
parent(B, Y), | |
sibling(A, B). | |
はとこ(X, Y):- | |
grandparent(A, X), | |
grandparent(B, Y), | |
sibling(A, B). |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment