by Jtsummers · 6y ago · 0 comments
for(int i = 0; i < n; i++) {..}
It looks like the invariant should be: 0 <= i < n
But if they mistyped the loop that would be wrong. You have to explicitly state your invariants. At best, you could detect them and ask for confirmation. And that's for an easy to detect case.Most of the time with Frama-C, all you have to provide is function pre- and post-conditions and loop invariants.
``` 0 <= i <= n ```
As the loop reaches this value to terminate. Else, we could not deduce for example that `i = n` at the end of the loop (`0 <= i <= n && !(i < n)`).