Let’s say I have the following database:
birthday(jan,date(1975,11,9)). birthday(kim,date(1968,7,2)). birthday(rupert,date(2001,11,1)). birthday(eli,date(1975,1,2)). birthday(bobbie,date(1988,8,29)).
The question I want to answer is “Are there two distinct people who share a birthday, and if so, who are they?” To answer this, I queried the following, but it just cycles through all the options and I’m not sure why this is:
?- birthday(X, date(Y, M, D)), birthday(Z, date(Y, M, D)).
Why doesn’t this only return
Z have the same birthday?