title: Prolog Recursive Method
body: <p>So I am writing a database that contains the rule <code>waywest(X,Y)</code>. <code>waywest</code> takes 2 buildings that are along a street and returns where or not the building <code>X</code> is more than one building west of building <code>Y</code>. I have: </p>
  
  <pre><code>waywest(X,Y) :- not(west(X,Y)).
  waywest(X,Y) :- not(west(X,Z)) , waywest(Z,Y).
  </code></pre>
  
  <p>This is a method that recursively loops through using the fact <code>west(X,Y)</code>, where building <code>X</code> is west of building <code>Y</code>. I keep getting this existence error and debugging doesn't work either.</p>