Skip to content

Instantly share code, notes, and snippets.

@esad
Created April 17, 2015 20:36
Show Gist options
  • Save esad/d21759d150554874c44f to your computer and use it in GitHub Desktop.
Save esad/d21759d150554874c44f to your computer and use it in GitHub Desktop.
birthday(5,15). birthday(5,16). birthday(5,19).
birthday(6,17). birthday(6,18).
birthday(7,14). birthday(7,16).
birthday(8,14). birthday(8,15). birthday(8,17).
countd(D,C) :- #count{X: birthday(X,D) } = C, birthday(_,D).
countm(M,C) :- #count{X: birthday(M,X) } = C, birthday(M,_).
% Satz 1
result(M,D) :- birthday(M,D), countm(M,C1), countd(D,C2), C1 > 1, C2 > 1.
% Satz 2
final_result(M,D) :- result(M,D), #count{D2: result(M,D2), D2 != D} = 0.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment