Frama-C-discuss mailing list archives

This page gathers the archives of the old Frama-C-discuss archives, that was hosted by Inria's gforge before its demise at the end of 2020. To search for mails newer than September 2020, please visit the page of the new mailing list on Renater.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Frama-c-discuss] Verifying recursive functions



>
> I don't understand the assert clause in the code below:
> - "0 <= n" follows from the precondition
> - "n-1 < n" is a tautology
> So the assert clause should always evaluate to true, irrespective of  
> what the program does?

The assertion is there to illustrate how decreases clauses will
work when they are supported.

If the decreases clause had been supported by Jessie, it would
have been translated into a verification condition very much like
the property 0 <= n && n-1 < n; to be proved at the point of the assert.

The fact that the property holds means that the decreases clause is a  
valid one,
and consequently that the termination of the function is guaranteed.

Pascal