Weird unification in Prolog
<p>I have the following program:</p>

<pre><code>%% adjacent((Xs, Ys), (Xa, Ya)) - &lt;Xa, Ya&gt; is adjacent to &lt;Xs, Ys&gt;.
adjacent((Xs, Ys), (Right, Ys)) :- Right is Xs + 1.
adjacent((Xs, Ys), (Left, Ys)) :- Left is Xs - 1.
adjacent((Xs, Ys), (Xs, Up)) :- Up is Ys + 1.
adjacent((Xs, Ys), (Xs, Down)) :- Down is Ys - 1.
</code></pre>

<p>When I make</p>

<pre><code>?- adjacent((5, 6), (X, Y)).
</code></pre>

<p>it gives me</p>

<pre><code>X = Y, Y = 6 ;
X = 4,
Y = 6 ;
X = 5,
Y = 7 ;
X = Y, Y = 5.
</code></pre>

<p>What's happening?</p>