12.5 Summary (Ad)

We can summarize the main points of this chapter as follows:

  1. A subgoal is satisfied by matching with a clause. If the clause is a fact, and the subgoal matches the head of the fact, the subgoal is satisfied. If the clause is a rule, and the subgoal matches the head of the rule, the subgoal is only satisfied if all of the subgoals in the body of the rule can be satisfied.
  2. Matching occurs top-to-bottom, left-to-right.
  3. Backtracking is the process whereby, when a subgoal fails (or we successfully reach the end of the query), variable bindings are undone and the last subgoal that was satisfied is resatisfied. This starts at the next clause after the clause that satisfied the subgoal.


Prev: 12.4 How are all solutions found? (Ad)
Up: 12 Prolog's solution strategy (Ad)
Next: 12.6 Quiz: Prolog's solution strategy (Ad)