|
1 | 1 | CORE |
2 | 2 | main.c |
3 | | ---apply-loop-contracts --replace-call-with-contract ackermann |
| 3 | +--replace-call-with-contract ackermann |
4 | 4 | ^\[ackermann.precondition\.\d+\] line \d+ Check requires clause of ackermann in main: SUCCESS$ |
5 | | -^\[ackermann.precondition\.\d+\] line \d+ Check requires clause of ackermann in ackermann: SUCCESS$ |
6 | | -^\[ackermann\.\d+\] line 21 Check loop invariant before entry: SUCCESS$ |
7 | | -^\[ackermann\.\d+\] line 21 Check that loop invariant is preserved: SUCCESS$ |
8 | | -^\[ackermann\.\d+\] line 21 Check decreases clause on loop iteration: SUCCESS$ |
9 | | -^\[ackermann.assigns.\d+\] line 29 Check that m is assignable: SUCCESS$ |
10 | | -^\[ackermann.assigns.\d+\] line 30 Check that n is assignable: SUCCESS$ |
11 | | -^\[ackermann.assigns.\d+\] line 34 Check that n is assignable: SUCCESS$ |
12 | | -^\[ackermann.assigns.\d+\] line 35 Check that m is assignable: SUCCESS$ |
13 | 5 | ^VERIFICATION SUCCESSFUL$ |
14 | 6 | ^EXIT=0$ |
15 | 7 | ^SIGNAL=0$ |
16 | 8 | -- |
17 | 9 | -- |
18 | | -It tests whether we can prove (only partially) the termination of the Ackermann |
19 | | -function using a multidimensional decreases clause. |
20 | | - |
21 | | -Note that this particular implementation of the Ackermann function contains |
22 | | -both a while-loop and recursion. Therefore, to fully prove the termination of |
23 | | -the Ackermann function, we must prove both |
24 | | -(i) the termination of the while-loop and |
25 | | -(ii) the termination of the recursion. |
26 | | -Because CBMC does not support termination proofs of recursions (yet), we cannot |
27 | | -prove the latter, but the former. Hence, the termination proof in the code is |
28 | | -only "partial." |
29 | | - |
30 | | -Furthermore, the Ackermann function has a function contract that the result |
| 10 | +The Ackermann function has a function contract that the result |
31 | 11 | is always non-negative. This post-condition is necessary for establishing |
32 | 12 | the loop invariant. However, in this test, we do not enforce the function |
33 | 13 | contract. Instead, we assume that the function contract is correct and use it |
34 | | -(i.e. replace a recursive call of the Ackermann function with its contract). |
| 14 | +(i.e. replace a recursive call of the Ackermann function with its contract). |
35 | 15 |
|
36 | 16 | We cannot verify/enforce the function contract of the Ackermann function, since |
37 | 17 | CBMC does not support function contracts for recursively defined functions. |
38 | | -As of now, CBMC only supports function contracts for non-recursive functions. |
| 18 | +As of now, CBMC only supports function contracts for non-recursive functions. |
0 commit comments