title: Prolog is/2, arguments not sufficiently instantiated
body: <p>I'm working on an assignment where I have created a parser for a prefix-notation arithmetic language. I need to write a predicate which builds an ast for any given value V (i.e. generate an ast A such that whenever A is evaluated it's value is V). My idea was simple enough:</p>
  
  <pre><code>genAst(Val, Env, Ast) :-
     ev(Ast, Env, Val).
  </code></pre>
  
  <p>where ev is the evaluate-predicate. When I run this I get the error on the title concerning this part of the ev-predicate:</p>
  
  <pre><code>ev(xer_(power(N)), Env, V) :-
     integer(N),
     V is Env^N. %THIS LINE
  </code></pre>
  
  <p>where both V and N are unbound. I'm struggling to think of another elegant way to do this, does anyone know how I could make prolog generate integers for these two variables?</p>
  
  <p>I hope this was understandable :)</p>