Take a look at the following program for finding the minimum of 2 integers:

largest(X,Y,Y):-  X  =<  Y.
largest(X,Y,X):-  X>Y.

This is perfectly valid code. But it is inefficient. Consider what happens when backtracking is forced: Once we have unified largest(1,3,3) there is no need to check the second clause, even if backtracking occurs. If the first line does not match, that means that \(X \le Y\) is false, hence \(X > Y\) must be true. By adding some cuts we get the following code:

largest(X,Y,Y):-  X  =<  Y, !.
largest(X,Y,X).

How beautifully concise!

?- largest(5,3,X).
X = 5.

?- largest(2,9,X).
X = 9.

However, One does not simply add some cuts1. The program above is wrong, correct the first line to make it correct.