To answer this question, Prolog first finds a course, Subject, for which Jeff is the lecturer and then finds out if Fred studies the Subject which was just found. Prolog solves this problem by proceeding left to right and then backtracking . A good way of picturing what happens when Prolog tries to find a solution and backtracks, is to draw tree diagrams like the one on the next page. After the first solution is found, Prolog retraces its steps up the tree and looks for alternative solutions. This is also called a clause .
Facts are unit clauses and rules are non-unit clauses .
This symbol is often called the neck symbol. The left hand side of the neck is called the head . The right hand side of the neck is called the body . Functional terms can be used to construct complex datastructures. This statement tells us very little about the book.