First part of TD

This commit is contained in:
Yorick Barbanneau 2023-05-03 00:57:37 +02:00
parent 522bdb0218
commit f295671946
3 changed files with 27 additions and 6 deletions

View file

@ -5,13 +5,17 @@
/*@ logic integer abs(integer n) = 0<n?n:-n;*/
/*@ terminates \true;
/*@
requires INT_MIN <= n;
terminates \true;
ensures \result == abs(n);
*/
int abs(int n);
/*@ terminates \true;
/*@
requires INT_MIN <= n * (int)((int)n % 2 + ((int)n +1)%2) <= INT_MAX;
terminates \true;
ensures \result == abs(n);*/
int abs2(int n);
#endif
#endif