Challenge 2: classify/2 — Green or Red Cuts? — Possible Solution ==================================================================== classify_demo.pl: classify(X, negative) :- X < 0, !. classify(X, zero) :- X =:= 0, !. classify(X, positive). Queries: ?- classify(-5, R). R = negative. ?- classify(0, R). R = zero. ?- classify(7, R). R = positive. -- Are these cuts green or red? -- -- Both cuts here are RED cuts, not green ones. Without the first -- cut, classify(-5, R) would still correctly produce R = negative -- from clause 1 -- but backtracking (via ;) would then ALSO try -- clause 2 (X =:= 0, which fails for -5, so nothing extra happens -- there) and clause 3, which has NO guard at all and would -- incorrectly ALSO succeed with R = positive for -5. Without the -- cuts, classify(-5, R) would report TWO different answers -- (negative AND positive) instead of just one -- a genuinely -- different, WRONG set of solutions. Since removing the cuts -- changes which solutions come back (not just how many redundant -- alternatives get tried), these are red cuts by the chapter's own -- definition -- they are load-bearing for correctness, not just an -- efficiency optimization. WHY THIS WORKS AS AN ANSWER ------------------------------ This correctly identifies both cuts as red rather than green by applying the chapter's own test -- checking whether removing them would change the actual set of solutions returned, not just how many alternatives are explored -- and demonstrates the real, wrong extra answer that would appear without them.