| 1 |
# frama-c -wp [...] |
| 2 |
[kernel] Parsing terminates_variant_option.i (no preprocessing) |
| 3 |
[wp] Running WP plugin... |
| 4 |
[wp] [CFG] Goal f1_terminates : Valid (Trivial) |
| 5 |
[wp] Warning: Missing RTE guards |
| 6 |
[wp] [CFG] Goal fails_decreases_terminates : Valid (Trivial) |
| 7 |
[wp] [CFG] Goal fails_positive_terminates : Valid (Trivial) |
| 8 |
[wp] [CFG] Goal trivial_variant_terminates : Valid (Trivial) |
| 9 |
------------------------------------------------------------ |
| 10 |
Function f1 |
| 11 |
------------------------------------------------------------ |
| 12 |
|
| 13 |
Goal Preservation of Invariant (file terminates_variant_option.i, line 37): |
| 14 |
Assume { |
| 15 |
Type: is_sint32(c1_0) /\ is_sint32(cpt_0) /\ is_sint32(cpt_0 - 1). |
| 16 |
(* Residual *) |
| 17 |
When: c1_0 != 0. |
| 18 |
(* Goal *) |
| 19 |
When: 0 <= c1_0. |
| 20 |
(* Invariant *) |
| 21 |
Have: (cpt_0 <= c1_0) /\ (0 <= cpt_0). |
| 22 |
(* Else *) |
| 23 |
Have: 2 <= cpt_0. |
| 24 |
} |
| 25 |
Prove: (0 < cpt_0) /\ (cpt_0 <= (1 + c1_0)). |
| 26 |
|
| 27 |
------------------------------------------------------------ |
| 28 |
|
| 29 |
Goal Establishment of Invariant (file terminates_variant_option.i, line 37): |
| 30 |
Prove: true. |
| 31 |
|
| 32 |
------------------------------------------------------------ |
| 33 |
|
| 34 |
Goal Loop assigns (file terminates_variant_option.i, line 38): |
| 35 |
Prove: true. |
| 36 |
|
| 37 |
------------------------------------------------------------ |
| 38 |
|
| 39 |
Goal Decreasing of Loop variant at loop (file terminates_variant_option.i, line 41): |
| 40 |
Assume { |
| 41 |
Type: is_sint32(cpt_0). |
| 42 |
(* Invariant *) |
| 43 |
Have: (cpt_0 <= 0) /\ (0 <= cpt_0). |
| 44 |
} |
| 45 |
Prove: false. |
| 46 |
|
| 47 |
------------------------------------------------------------ |
| 48 |
|
| 49 |
Goal Positivity of Loop variant at loop (file terminates_variant_option.i, line 41): |
| 50 |
Assume { |
| 51 |
Type: is_sint32(c1_0) /\ is_sint32(cpt_0) /\ is_sint32(cpt_0 - 1). |
| 52 |
(* Residual *) |
| 53 |
When: c1_0 != 0. |
| 54 |
(* Invariant *) |
| 55 |
Have: ((0 <= c1_0) -> ((cpt_0 <= c1_0) /\ (0 <= cpt_0))). |
| 56 |
(* Else *) |
| 57 |
Have: 2 <= cpt_0. |
| 58 |
(* Invariant *) |
| 59 |
Have: ((0 <= c1_0) -> (cpt_0 <= (1 + c1_0))). |
| 60 |
} |
| 61 |
Prove: 0 <= cpt_0. |
| 62 |
|
| 63 |
------------------------------------------------------------ |
| 64 |
------------------------------------------------------------ |
| 65 |
Function fails_decreases |
| 66 |
------------------------------------------------------------ |
| 67 |
|
| 68 |
Goal Loop assigns (file terminates_variant_option.i, line 26): |
| 69 |
Prove: true. |
| 70 |
|
| 71 |
------------------------------------------------------------ |
| 72 |
|
| 73 |
Goal Decreasing of Loop variant at loop (file terminates_variant_option.i, line 29): |
| 74 |
Assume { |
| 75 |
Type: is_uint32(i_1) /\ is_uint32(i) /\ is_sint32(keep_going_0). |
| 76 |
(* Then *) |
| 77 |
Have: 0 < i_1. |
| 78 |
If keep_going_0 = 0 |
| 79 |
Then { Have: to_uint32(i_1 - 1) = i. } |
| 80 |
Else { Have: i = i_1. } |
| 81 |
} |
| 82 |
Prove: i < i_1. |
| 83 |
|
| 84 |
------------------------------------------------------------ |
| 85 |
|
| 86 |
Goal Positivity of Loop variant at loop (file terminates_variant_option.i, line 29): |
| 87 |
Prove: true. |
| 88 |
|
| 89 |
------------------------------------------------------------ |
| 90 |
------------------------------------------------------------ |
| 91 |
Function fails_positive |
| 92 |
------------------------------------------------------------ |
| 93 |
|
| 94 |
Goal Preservation of Invariant (file terminates_variant_option.i, line 15): |
| 95 |
Let x = Mint_0[p]. |
| 96 |
Assume { |
| 97 |
Type: is_sint32(v) /\ is_sint32(x) /\ is_sint32(v - 1). |
| 98 |
(* Heap *) |
| 99 |
Type: region(p.base) <= 0. |
| 100 |
(* Goal *) |
| 101 |
When: 0 <= x. |
| 102 |
(* Invariant *) |
| 103 |
Have: (0 <= v) /\ (v <= x). |
| 104 |
(* Then *) |
| 105 |
Have: v != 0. |
| 106 |
} |
| 107 |
Prove: (0 < v) /\ (v <= (1 + x)). |
| 108 |
|
| 109 |
------------------------------------------------------------ |
| 110 |
|
| 111 |
Goal Establishment of Invariant (file terminates_variant_option.i, line 15): |
| 112 |
Prove: true. |
| 113 |
|
| 114 |
------------------------------------------------------------ |
| 115 |
|
| 116 |
Goal Loop assigns (file terminates_variant_option.i, line 16) (1/2): |
| 117 |
Prove: true. |
| 118 |
|
| 119 |
------------------------------------------------------------ |
| 120 |
|
| 121 |
Goal Loop assigns (file terminates_variant_option.i, line 16) (2/2): |
| 122 |
Effect at line 19 |
| 123 |
Prove: true. |
| 124 |
|
| 125 |
------------------------------------------------------------ |
| 126 |
|
| 127 |
Goal Decreasing of Loop variant at loop (file terminates_variant_option.i, line 19): |
| 128 |
Prove: true. |
| 129 |
|
| 130 |
------------------------------------------------------------ |
| 131 |
|
| 132 |
Goal Positivity of Loop variant at loop (file terminates_variant_option.i, line 19): |
| 133 |
Let x = Mint_0[p]. |
| 134 |
Assume { |
| 135 |
Type: is_sint32(v) /\ is_sint32(x) /\ is_sint32(v - 1). |
| 136 |
(* Heap *) |
| 137 |
Type: region(p.base) <= 0. |
| 138 |
(* Invariant *) |
| 139 |
Have: ((0 <= x) -> ((0 <= v) /\ (v <= x))). |
| 140 |
(* Then *) |
| 141 |
Have: v != 0. |
| 142 |
(* Invariant *) |
| 143 |
Have: ((0 <= x) -> ((0 < v) /\ (v <= (1 + x)))). |
| 144 |
} |
| 145 |
Prove: 0 <= v. |
| 146 |
|
| 147 |
------------------------------------------------------------ |
| 148 |
------------------------------------------------------------ |
| 149 |
Function trivial_variant |
| 150 |
------------------------------------------------------------ |
| 151 |
|
| 152 |
Goal Loop assigns nothing: |
| 153 |
Prove: true. |
| 154 |
|
| 155 |
------------------------------------------------------------ |
| 156 |
|
| 157 |
Goal Decreasing of Loop variant at loop (file terminates_variant_option.i, line 54): |
| 158 |
Prove: false. |
| 159 |
|
| 160 |
------------------------------------------------------------ |
| 161 |
|
| 162 |
Goal Positivity of Loop variant at loop (file terminates_variant_option.i, line 54): |
| 163 |
Prove: false. |
| 164 |
|
| 165 |
------------------------------------------------------------ |
| 166 |
------------------------------------------------------------ |
| 167 |
Function trivial_variant_default |
| 168 |
------------------------------------------------------------ |
| 169 |
|
| 170 |
Goal Loop assigns nothing: |
| 171 |
Prove: true. |
| 172 |
|
| 173 |
------------------------------------------------------------ |
| 174 |
|
| 175 |
Goal Decreasing of Loop variant at loop (file terminates_variant_option.i, line 61): |
| 176 |
Prove: false. |
| 177 |
|
| 178 |
------------------------------------------------------------ |
| 179 |
|
| 180 |
Goal Positivity of Loop variant at loop (file terminates_variant_option.i, line 61): |
| 181 |
Prove: false. |
| 182 |
|
| 183 |
------------------------------------------------------------ |