title: Prolog Cuts and query results
body: <p>In a prolog program as stated below:</p>
  
  <pre><code>town(a).
  town(b).
  town(c).
  town(d).
  dam(e).
  dam(f).
  link(a,b).
  link(a,c).
  link(c,d).
  link(b,d).
  link(b,c).
  link(c,e).
  link(a,e).
  link(d,f).
  neighbour(X,Y):- link(X,Y) ; link(Y,X).
  </code></pre>
  
  <p>Are these the correct results from the following queries:</p>
  
  <p>Query 1 - <code>?-dam(X), once(neighbour(X,Y)),town(Y).</code></p>
  
  <p>Results: <code>X=e Y=c; X=f Y=d</code></p>
  
  <p>Query 2 - <code>?-dam(X), neighbour(X,Y),!,town(Y).</code></p>
  
  <p>Results: <code>X=e Y=c</code></p>
  
  <p>Query 3 - <code>?-dam(X),!,neighbour(X,Y),town(Y).</code></p>
  
  <p>Results: <code>X=e Y=c; X=e Y=a</code></p>