Matching Clauses

Matching clauses form a language for writing determinate Prolog programs. A matching clause takes the following form:
      H, G  => B
or alternatively
      H :- G : B
where H is an atomic formula, G and B are two sequences of atomic formulas. H is called the head, G the guard, and B the body of the clause. No call in G can bind variables in H and all calls in G must be in-line tests. In other words, the guard must be flat. The following types of predicates can occur in G:

For a call C, matching rather than unification is used to select a matching clause in its predicate. The matching clause 'H, G => B' is applicable to C if C matches H (i.e., C and H become identical after a substitution is applied to H) and G succeeds. When applying the matching clause to C, the system rewrites C into B.



Subsections
Neng-Fa Zhou 2009-06-08