Completely new to Prolog (SWI-Prolog in this case) so apologies for this very basic question. I have a simple program below.
loves(vincent,mia).
loves(marsellus,mia).
loves(pumpkin,honey_bunny).
loves(honey_bunny,pumpkin).
jealous(X, Y):- loves(X,Z), loves(Y,Z).
I'm a little confused as to the results of the following query:
?- jealous(vincent, X).
X = vincent ;
X = marsellus.
Perhaps I'm just not accustomed to the unification process of Prolog, but shouldn't the answer just be marsellus? Why is vincent included here as a valid result?
Also, as a followup question: Am I correct in that in order to get a result of all the 'jealous' people, I would write a query such as jealous(X, Y). ?
If so, can someone explain the following result of said query?
?- jealous(X, Y).
X = Y, Y = vincent ;
X = vincent,
Y = marsellus ;
X = marsellus,
Y = vincent ;
X = Y, Y = marsellus ;
X = Y, Y = pumpkin ;
X = Y, Y = honey_bunny.
Any help would be greatly appreciated. Thanks!