vater_von(yoshihito, hirohito). mutter_von(sadako, hirohito). vater_von(kunioshi, nagako). mutter_von(chikako, nagako). vater_von(hirohito, akihito). vater_von(hirohito, hitachi). mutter_von(nagako, akihito). mutter_von(nagako, hitachi). grossvater_von(G,E) :- vater_von(G, V), vater_von(V, E). grossvater_von(G,E) :- vater_von(G, M), mutter_von(M, E). geschwister(X,Y) :- vater_von(V, X), vater_von(V, Y), mutter_von(M, X), mutter_von(M, Y). elter_von(X, Y) :- vater_von(X, Y). elter_von(X, Y) :- mutter_von(X, Y). ?- mutter_von(sadako, hirohito). ?- mutter_von(sadako, sadako). ?- mutter_von(X, hirohito). ?- elter_von(X, akihito). ?- geschwister(Y, X). --- Ergebnis: -------------------------------------------------------- ?- mutter_von(sadako, hirohito). Resolution 1: Yes. Resolution 2: No. ?- mutter_von(sadako, sadako). Resolution 1: No. ?- mutter_von(X{0}, hirohito). Resolution 1: Yes. X = sadako Resolution 2: No. ?- elter_von(X{0}, akihito). Resolution 1: Yes. X = hirohito Resolution 2: Yes. X = nagako Resolution 3: No. ?- geschwister(Y{0}, X{0}). Resolution 1: Yes. X = hirohito Y = hirohito Resolution 2: Yes. X = nagako Y = nagako Resolution 3: Yes. X = akihito Y = akihito Resolution 4: Yes. X = hitachi Y = akihito Resolution 5: Yes. X = akihito Y = hitachi Resolution 6: Yes. X = hitachi Y = hitachi Resolution 7: No.