NextPrevUpTopContentsIndex

cut

Backward Chaining Goal
Summary

The standard prolog predicate that stops backtracking.

Signature

cut

Description

cut is a standard prolog predicate. When first called it succeeds and freezes certain choices made by the backward chainer up to this point. It may no longer attempt to resatisfy any of the goals between the start of clause and the cut , and it may not attempt to use any other clauses to satisfy the same goal.

Examples
(defrule nice :backward
  ((nice ?x)
   <--
   (rottweiler ?x)
   (cut)
   (fail))
  ((nice ?x) <--))

implements "everything is nice unless it is a rottweiler". First the backward chainer will attempt to prove (nice fido) with the first clause. If fido is a rottweiler the cut then prevents the backward chainer from using the second clause which says "everything is nice". The fail ensures that (nice fido) fails.

See also

fail


KnowledgeWorks and Prolog User Guide (Macintosh version) - 29 Feb 2008

NextPrevUpTopContentsIndex