Reading a cut ! in Prolog
<p>I am reading through <a href="http://www.learnprolognow.org/lpnpage.php?pagetype=html&amp;pageid=lpn-htmlse44" rel="nofollow noreferrer">Learn Prolog Now! 's chapter on cuts</a> and at the same time Bratko's Prolog Programming for Artificial Intelligence, Chapter 5: Controlling Backtracking. At first it seemed that a cut was a straight-forward way to mimic an if-else clause known from other programming languages, e.g.</p>

<pre><code># Find the largest number
max(X,Y,Y):- X =&lt; Y,!. 
max(X,Y,X).
</code></pre>

<p>However, as is noted down the line this code will fail in cases where all variables are instantiated even when we expect <code>false</code>, e.g.</p>

<pre><code>?- max(2,3,2).
true.
</code></pre>

<p>The reason is clear: the first rule fails, the second does not have any conditions connected to it anymore, so it will succeed. I understand that, but then a solution is proposed (here's a <a href="http://swish.swi-prolog.org/p/iHIufDuX.pl" rel="nofollow noreferrer">swish</a>):</p>

<pre><code>max(X,Y,Z):- X =&lt; Y,!, Y = Z. 
max(X,Y,X).
</code></pre>

<p>And I'm confused how I should read this. I thought <code>!</code> meant: 'if everything that comes before this <code>!</code> is true, stop termination including any other rules with the same predicate'. That can't be right, though, because that would mean that the instantiation of <code>Y = Z</code> only happens in case of failure, which would be useless for that rule.</p>

<p>So how should a cut be read in a 'human' way? And, as an extension, how should I read the proposed solution for <code>max/3</code> above?</p>