To answer the question, Prolog has to find out the value of X, if it exists. As long as we do not know the value of a variable it is said to be unbound or uninstantiated . When a value is found, the variable is said to instantiated or bound to the value. When there is more than one possible answer, Prolog will try to find all of them. This can be answered by finding out if Jeff lectures in a subject which fred studies.
Subject is a variable.
The question consists of two goals . To answer this question, Prolog first finds a course, Subject, for which Norman 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 . After the first solution is found, Prolog retraces its steps up the tree and looks for alternative solutions. This is also called a clause .