title: Prolog beginner ERROR: Out of local stack
body: <p>I am very new to Prolog programming. Any help is greatly appreciated.
  I have the following program,</p>
  <pre><code>bigger(elephant, horse).
  bigger(horse, donkey).
  bigger(donkey, dog).
  bigger(donkey, monkey).
  
  is_bigger(X, Y) :- bigger(X, Y).
  is_bigger(X, Y) :- is_bigger(Z, Y), bigger(X,Z).
  </code></pre>
  <p>On running the query,</p>
  <pre><code>?- is_bigger(A, donkey)
  </code></pre>
  <p>I get the following output,</p>
  <pre><code>A = horse ;
  A = elephant ;
  ERROR: Out of local stack
  </code></pre>
  <p>While I do somewhat understand how A = horse and A = elephant, I am having a difficult time understanding why it's recursing infinitely (I used the builtin trace <em>trace</em> predicate but couldn't understand it after <em>A = elephant</em>).</p>
  <p>Thank you.</p>