Next: Example 2
Up: No Title
Previous: Example 1
There are some branches, given the nature of a relation,
are going to fail - idea is to prune them using a cut.
(1) relation(...) :- ... .
(2) relation(...) :- ... .
...
(i) relation(...) :-
t1,t2,t3,!,t4,t5,t6.
(i+1) relation(...) :- ... .
(n) relation(...) :- ... .
- Relation has n clauses (in order indicated)
- Relation (i) examined if relation (1) to (i-1) fail
- t1,t2,t3 fails - the cut doesn't take place so instance
(i+1) of relation is chosen
- If t1,t2,t3 succeeds, the cut takes place and computation
proceeds to prove t4,t5,t6
- if t4,t5,t6 fails, because of the cut, there is backtracking
on t1,t2,t3, instance (i) of relation fails and instances (i+1)
to (n) of relation are ignored (not considered as possible candidates
to unification for a subgoal)
Omer F Rana
Sun Feb 16 21:01:24 GMT 1997