We now present a solution to the practical problems posed in chapter 7 about how to control Prolog's search strategy. We summarised these issues as ones of:
The reason why cut ( !/0) is so unpleasant are that it effects Prolog's search tree. Consequently, by adding a cut, the program's meaning may change radically. We sometimes say that a cut that does this is a red cut. On the other hand, the placing of a cut may not change the intended meaning but simply junk a part of the search tree where it is known that there is no legal solution. Such a cut is termed a green cut. The Art of Prolog by Sterling and Shapiro has a nice section on the cut [Sterling & Shapiro, 1986].
We now go over how to solve the three control problems.