Dafny cannot validate the m method for the following code:
predicate p(k: int)
requires k >= 0
{
true
}
method m() returns (k: int)
ensures p(k) //<-
{
k := 0;
}
It reports possible violation of function precondition
for the ensure line, which is k>=0
. This certainly cannot be a violation as the parameter is literally a constant 0 (0=0), why does dafny think this is not in compliance? And how do I fix it?