title: Exclamation mark in Prolog
body: <p>Given the following facts and predicates: </p>
  
  <pre><code>sound(time1).
  sound(time2).
  sun(time3).
  relax(X):-sound(X),!,sun(X).
  relax(_):-sun(_).
  </code></pre>
  
  <p>When executing <code>relax(S).</code> I'd expect to get <code>S=time1</code> due to the <code>!</code>, that says (correct me if I'm wrong), that if 'X' is satisfied , then stop the backtracking. </p>
  
  <p>Here is the trace: </p>
  
  <pre><code>3 ?- trace.
  true.
  
  [trace] 3 ?- relax(S).
     Call: (6) relax(_G1831) ? creep
     Call: (7) sound(_G1831) ? creep
     Exit: (7) sound(time1) ? creep
     Call: (7) sun(time1) ? creep
     Fail: (7) sun(time1) ? creep
     Fail: (6) relax(_G1831) ? creep
  false.
  </code></pre>
  
  <p>So why does Prolog also checks <code>sun(time1)</code>, even though that it met the exclamation mark after being satisfied by <code>sound(X)</code> (because <code>sound(time1)</code> is a fact). </p>