PPT Slide
Suppose the database of facts is:
| teaches( shapiro, cse341 ).
| teaches( notkin, cse341 ).
| teaches( young, cse322 ).
| teaches( hanks, cse 473 ).
Then we can query the system and Prolog will search for a match to our queries, starting at the top.
| ? - teaches( notkin, cse341 ) .
| ? - teaches( young, cse341 ) .
| ? - teaches( notkin, bluecheese ) .
| ? - teaches( watermelon, strawberries ) .