title: I'm new to Prolog. Trying to run this code but gives - ERROR: Undefined procedure: teaches/2 (DWIM could not correct goal)
body: <p>These are the facts I have written  </p>
  
  <pre><code>instructor(ahmed,mohammed, cs101,01).
  instructor(sara,salah,cs101,02).
  instructor(maryam,faisal,cs101,03).
  instructor(ali,hassan,cs311,01).
  
  enrolled(201110202,huda,issa,cs101,01).
  enrolled(20110303,mona,amer,cs101,01).
  enrolled(20115566,amal,omar,cs101,01).
  enrolled(20118899,ahmed,hassan,cs101,01).
  </code></pre>
  
  <p>The rules</p>
  
  <pre><code>teaches(D,S):-
     instructor(D,_,C,Z),
     enrolled(S,_,_,C,Z).
  
  classmate(s1,s2,C):-
    enrolled(s1,_,_,C,Z),
     enrolled(s2,_,_,C,Z).
  </code></pre>
  
  <p>But when I run a query that who teaches std with id <code>20110303</code>, it gives this error. I have checked it for all kind of errors. It is syntactically and logically correct, but still says undefined procedure  </p>
  
  <pre><code>?- debug.
     true.
  
  [debug]  ?-  teaches(D,20110303).
  ERROR: Undefined procedure: teaches/2 (DWIM could not correct goal)
  </code></pre>