title: Difference between two Implementation of even and odd in Prolog
body: <p>i have two implementation of Prolog , the Function is to decide if the given number is odd or even</p>
  
  <p>the first one works correctly </p>
  
  <pre><code>even1(0).
  even1(X) :- X&gt;0 ,X1 is X-1, odd1(X1).
  
  odd1(1).
  odd1(X) :- X&gt;1 , X1 is X-1, even1(X1).
  </code></pre>
  
  <p>even1(2) returns true</p>
  
  <p>but the second one doesnt work correctly  </p>
  
  <pre><code>even2(0).
  even2(X) :- X&gt;0 , odd2(X-1).
  
  odd2(1).
  odd2(X) :- X&gt;1 , even2(X-1).
  </code></pre>
  
  <p>even2(2) returns false
  can anyone explain to me whats is the difference between the two of them ? </p>