16 lines
388 B
Plaintext
16 lines
388 B
Plaintext
// The recursive call's measure is compared with N as it is at the call
|
|
// (N + 2), not with N as it was on entry. The run compares with entry.
|
|
// MUST-NOT-PROVE: decreases-step@12
|
|
// RUN-STOPS: decreases@7
|
|
FUNCTION F(N : INTEGER) RETURNS INTEGER
|
|
REQUIRE N >= 0
|
|
DECREASES N
|
|
IF N == 0 THEN
|
|
RETURN 0
|
|
ENDIF
|
|
N <- N + 2
|
|
RETURN F(N - 1)
|
|
ENDFUNCTION
|
|
|
|
OUTPUT F(3)
|