I am playing around with KeY (https://www.key-project.org) for a teaching project.
On one hand I was happy that KeY easily proves correctness of the following jml annotated java code
/*@ ensures ((\result == a) || (\result == b));
@ ensures ((\result >= a) && (\result >= b));
*/
public int max(int a, int b) {
if(a <= b)
return b;
else
return a;
}
but on the other hand I was surprisingly not enable to prove correctness of the following equivalent program
/*@ ensures ((\result == a) || (\result == b));
@ ensures ((\result >= a) && (\result >= b));
*/
public int max(int a, int b) {
return (a <= b) ? b : a;
}
Does somebody know whether I am missing something?