title: Swi-Prolog: No permission to modify static procedure
body: <p>I'm a prolog beginner. I would really appreciate any help for compiling this example. I guess rules are in the form "consequent :- antecedent"</p>
  
  <pre><code>%rules
  prey(Y2), watch(X2,Y2) :- predator(X2).
  false :- predator(X1),prey(Y1),intelligent(Y1),watch(X1,Y1),catch(X1,Y1).
  catch(X3,Y3);hungry(X3) :- predator(X3),prey(Y3),watch(X3,Y3).
  
  %facts
  predator(shaki).
  prey(pelusa).
  intelligent(shaki).
  intelligent(pelusa).
  watch(shaki,pelusa).
  </code></pre>
  
  <p>I compiled the code using SWI-Prolog version 5.10.4 (i386, Ubuntu Natty Narwhal):</p>
  
  <pre><code>swipl -s "pathofthecode.pl"
  </code></pre>
  
  <p>Swi-Prolog threw this error for the second rule:</p>
  
  <pre><code>'$record_clause'/2: No permission to modify static_procedure `(;)/2'
  </code></pre>
  
  <hr>
  
  <p>Thanks azhrei, you said: " I think what you're trying to say is X1 will not be able to catch Y1, even though X1 is a predator watching the prey Y1, because Y1 is intelligent.", yes it is!!</p>
  
  <p>I found that prolog has some strong constrains [1]:</p>
  
  <ol>
  <li>Prolog doesn't allow "or" (disjunctive) facts or conclusions.</li>
  <li>Prolog doesn't allow "not" (negative) facts or conclusions.</li>
  <li>Prolog doesn't allow most facts or conclusions having existential quantification.</li>
  <li>Prolog doesn't directly allow second-order logic.</li>
  </ol>
  
  <p>So I changed the code like so: </p>
  
  <pre><code>%rules
  predator(X) :- prey(Y), watch(X,Y).
  catch(X,Y) :- predator(X),prey(Y),not(intelligent(Y)),watch(X,Y).
  hungry(X) :- predator(X),prey(Y),watch(X,Y),not(catch(X,Y)).
  
  %facts
  prey(pelusa).
  intelligent(shaki).
  intelligent(pelusa).
  watch(shaki,pelusa).
  </code></pre>
  
  <p>I also tried using:</p>
  
  <pre><code> false :- predator(X),prey(Y),intelligent(Y),watch(X,Y),catch(X,Y).
  </code></pre>
  
  <p>And it compiles, but when prolog needs to find whether catch(X,Y) is true or not, it can't because the predicate isn't in a rule consequent. </p>
  
  <p>--</p>
  
  <p>[1]. Neil C. Rowe, URL:<a href="http://faculty.nps.edu/ncrowe/book/chap14.html" rel="nofollow noreferrer">http://faculty.nps.edu/ncrowe/book/chap14.html</a></p>
  
  <p><strong>Note:</strong> this example was taken from professor Yadira Solano course at UCR, Costa Rica</p>