title: Predicate that generates integers and tests if integer
body: <p>I'm trying to make a Prolog predicate that will let me test if a given value is a integer bigger than 0, and also give me a valid integer given a variable. It now looks like this:</p>
  
  <pre><code>intgr(1).
  intgr(X) :- intgr(Y), X is Y+1.
  </code></pre>
  
  <p>This will generate all integers, but when used as intgr(8), it will find that it's valid, and then loop forever. Any ideas of how to solve this?</p>