| 1 |
# frama-c -wp [...] |
| 2 |
[kernel] Parsing axioms.i (no preprocessing) |
| 3 |
[wp] Running WP plugin... |
| 4 |
[wp] Warning: Missing RTE guards |
| 5 |
------------------------------------------------------------ |
| 6 |
Function f |
| 7 |
------------------------------------------------------------ |
| 8 |
|
| 9 |
Goal Post-condition 'P,todo' in 'f': |
| 10 |
Let a_1 = shift_sint32(t, a). |
| 11 |
Let x = -a. |
| 12 |
Let a_2 = havoc(Mint_undef_0, Mint_0, a_1, i - a). |
| 13 |
Let x_1 = 1 + b. |
| 14 |
Assume { |
| 15 |
Type: is_sint32(a) /\ is_sint32(b) /\ is_sint32(i). |
| 16 |
(* Heap *) |
| 17 |
Type: (region(t.base) <= 0) /\ linked(Malloc_0). |
| 18 |
(* Pre-condition *) |
| 19 |
Have: valid_rw(Malloc_0, a_1, 1 + b - a). |
| 20 |
(* Pre-condition *) |
| 21 |
Have: a <= b. |
| 22 |
(* Invariant 'Index' *) |
| 23 |
Have: a <= x_1. |
| 24 |
(* Invariant 'Index' *) |
| 25 |
Have: (a <= i) /\ (i <= x_1). |
| 26 |
(* Invariant 'Positive' *) |
| 27 |
Have: forall i_1 : Z. ((a <= i_1) -> ((i_1 < i) -> |
| 28 |
(0 < a_2[shift_sint32(t, i_1)]))). |
| 29 |
(* Else *) |
| 30 |
Have: b < i. |
| 31 |
} |
| 32 |
Prove: P_P(a_2, t, a, b). |
| 33 |
|
| 34 |
------------------------------------------------------------ |
| 35 |
|
| 36 |
Goal Post-condition 'Q' in 'f': |
| 37 |
Let a_1 = shift_sint32(t, a). |
| 38 |
Let x = -a. |
| 39 |
Let a_2 = havoc(Mint_undef_0, Mint_0, a_1, i - a). |
| 40 |
Let x_1 = 1 + b. |
| 41 |
Assume { |
| 42 |
Type: is_sint32(a) /\ is_sint32(b) /\ is_sint32(i). |
| 43 |
(* Heap *) |
| 44 |
Type: (region(t.base) <= 0) /\ linked(Malloc_0). |
| 45 |
(* Pre-condition *) |
| 46 |
Have: valid_rw(Malloc_0, a_1, 1 + b - a). |
| 47 |
(* Pre-condition *) |
| 48 |
Have: a <= b. |
| 49 |
(* Invariant 'Index' *) |
| 50 |
Have: a <= x_1. |
| 51 |
(* Invariant 'Index' *) |
| 52 |
Have: (a <= i) /\ (i <= x_1). |
| 53 |
(* Invariant 'Positive' *) |
| 54 |
Have: forall i_1 : Z. ((a <= i_1) -> ((i_1 < i) -> |
| 55 |
(0 < a_2[shift_sint32(t, i_1)]))). |
| 56 |
(* Else *) |
| 57 |
Have: b < i. |
| 58 |
} |
| 59 |
Prove: P_Q(Malloc_0, a_2, t, a, b). |
| 60 |
|
| 61 |
------------------------------------------------------------ |
| 62 |
|
| 63 |
Goal Preservation of Invariant 'Index' (file axioms.i, line 30): |
| 64 |
Let a_1 = shift_sint32(t, a). |
| 65 |
Let x = -a. |
| 66 |
Let x_1 = 1 + b. |
| 67 |
Let x_2 = 1 + i. |
| 68 |
Assume { |
| 69 |
Type: is_sint32(a) /\ is_sint32(b) /\ is_sint32(i) /\ is_sint32(x_2). |
| 70 |
(* Heap *) |
| 71 |
Type: (region(t.base) <= 0) /\ linked(Malloc_0). |
| 72 |
(* Pre-condition *) |
| 73 |
Have: valid_rw(Malloc_0, a_1, 1 + b - a). |
| 74 |
(* Pre-condition *) |
| 75 |
Have: a <= b. |
| 76 |
(* Invariant 'Index' *) |
| 77 |
Have: a <= x_1. |
| 78 |
(* Invariant 'Index' *) |
| 79 |
Have: (a <= i) /\ (i <= x_1). |
| 80 |
(* Invariant 'Positive' *) |
| 81 |
Have: forall i_1 : Z. ((a <= i_1) -> ((i_1 < i) -> |
| 82 |
(0 < havoc(Mint_undef_0, Mint_0, a_1, i - a)[shift_sint32(t, i_1)]))). |
| 83 |
(* Then *) |
| 84 |
Have: i <= b. |
| 85 |
} |
| 86 |
Prove: a <= x_2. |
| 87 |
|
| 88 |
------------------------------------------------------------ |
| 89 |
|
| 90 |
Goal Establishment of Invariant 'Index' (file axioms.i, line 30): |
| 91 |
Assume { |
| 92 |
Type: is_sint32(a) /\ is_sint32(b). |
| 93 |
(* Heap *) |
| 94 |
Type: (region(t.base) <= 0) /\ linked(Malloc_0). |
| 95 |
(* Pre-condition *) |
| 96 |
Have: valid_rw(Malloc_0, shift_sint32(t, a), 1 + b - a). |
| 97 |
(* Pre-condition *) |
| 98 |
Have: a <= b. |
| 99 |
} |
| 100 |
Prove: a <= (1 + b). |
| 101 |
|
| 102 |
------------------------------------------------------------ |
| 103 |
|
| 104 |
Goal Preservation of Invariant 'Positive' (file axioms.i, line 31): |
| 105 |
Let x = 1 + i. |
| 106 |
Let a_1 = shift_sint32(t, a). |
| 107 |
Let x_1 = -a. |
| 108 |
Let a_2 = havoc(Mint_undef_0, Mint_0, a_1, i - a). |
| 109 |
Let x_2 = 1 + b. |
| 110 |
Assume { |
| 111 |
Type: is_sint32(a) /\ is_sint32(b) /\ is_sint32(i) /\ is_sint32(x). |
| 112 |
(* Heap *) |
| 113 |
Type: (region(t.base) <= 0) /\ linked(Malloc_0). |
| 114 |
(* Goal *) |
| 115 |
When: (a <= i_1) /\ (i_1 <= i). |
| 116 |
(* Pre-condition *) |
| 117 |
Have: valid_rw(Malloc_0, a_1, 1 + b - a). |
| 118 |
(* Pre-condition *) |
| 119 |
Have: a <= b. |
| 120 |
(* Invariant 'Index' *) |
| 121 |
Have: a <= x_2. |
| 122 |
(* Invariant 'Index' *) |
| 123 |
Have: (a <= i) /\ (i <= x_2). |
| 124 |
(* Invariant 'Positive' *) |
| 125 |
Have: forall i_2 : Z. ((a <= i_2) -> ((i_2 < i) -> |
| 126 |
(0 < a_2[shift_sint32(t, i_2)]))). |
| 127 |
(* Then *) |
| 128 |
Have: i <= b. |
| 129 |
(* Invariant 'Index' *) |
| 130 |
Have: a <= x. |
| 131 |
} |
| 132 |
Prove: 0 < a_2[shift_sint32(t, i) <- 1][shift_sint32(t, i_1)]. |
| 133 |
|
| 134 |
------------------------------------------------------------ |
| 135 |
|
| 136 |
Goal Establishment of Invariant 'Positive' (file axioms.i, line 31): |
| 137 |
Prove: true. |
| 138 |
|
| 139 |
------------------------------------------------------------ |
| 140 |
|
| 141 |
Goal Loop assigns (file axioms.i, line 32) (1/3): |
| 142 |
Prove: true. |
| 143 |
|
| 144 |
------------------------------------------------------------ |
| 145 |
|
| 146 |
Goal Loop assigns (file axioms.i, line 32) (2/3): |
| 147 |
Effect at line 34 |
| 148 |
Prove: true. |
| 149 |
|
| 150 |
------------------------------------------------------------ |
| 151 |
|
| 152 |
Goal Loop assigns (file axioms.i, line 32) (3/3): |
| 153 |
Effect at line 34 |
| 154 |
Let a_1 = shift_sint32(t, a). |
| 155 |
Let x = -a. |
| 156 |
Let a_2 = havoc(Mint_undef_0, Mint_0, a_1, i - a). |
| 157 |
Let a_3 = shift_sint32(t, i). |
| 158 |
Let x_1 = 1 + i. |
| 159 |
Let x_2 = 1 + b. |
| 160 |
Assume { |
| 161 |
Type: is_sint32(a) /\ is_sint32(b) /\ is_sint32(i) /\ is_sint32(x_1). |
| 162 |
(* Heap *) |
| 163 |
Type: (region(t.base) <= 0) /\ linked(Malloc_0). |
| 164 |
(* Goal *) |
| 165 |
When: !invalid(Malloc_0, a_3, 1). |
| 166 |
(* Pre-condition *) |
| 167 |
Have: valid_rw(Malloc_0, a_1, 1 + b - a). |
| 168 |
(* Pre-condition *) |
| 169 |
Have: a <= b. |
| 170 |
(* Invariant 'Index' *) |
| 171 |
Have: a <= x_2. |
| 172 |
(* Invariant 'Index' *) |
| 173 |
Have: (a <= i) /\ (i <= x_2). |
| 174 |
(* Invariant 'Positive' *) |
| 175 |
Have: forall i_1 : Z. ((a <= i_1) -> ((i_1 < i) -> |
| 176 |
(0 < a_2[shift_sint32(t, i_1)]))). |
| 177 |
(* Then *) |
| 178 |
Have: i <= b. |
| 179 |
(* Invariant 'Index' *) |
| 180 |
Have: a <= x_1. |
| 181 |
(* Invariant 'Positive' *) |
| 182 |
Have: forall i_1 : Z. ((i_1 <= i) -> ((a <= i_1) -> |
| 183 |
(0 < a_2[a_3 <- 1][shift_sint32(t, i_1)]))). |
| 184 |
} |
| 185 |
Prove: included(a_3, 1, a_1, 1 + i - a). |
| 186 |
|
| 187 |
------------------------------------------------------------ |
| 188 |
|
| 189 |
Goal Assigns 'todo' in 'f': |
| 190 |
Effect at line 34 |
| 191 |
Let x = 1 + b. |
| 192 |
Let a_1 = shift_sint32(t, a). |
| 193 |
Let x_1 = -a. |
| 194 |
Assume { |
| 195 |
Have: a < i. |
| 196 |
Have: !invalid(Malloc_0, a_1, i - a). |
| 197 |
Type: is_sint32(a) /\ is_sint32(b) /\ is_sint32(i). |
| 198 |
(* Heap *) |
| 199 |
Type: (region(t.base) <= 0) /\ linked(Malloc_0). |
| 200 |
(* Pre-condition *) |
| 201 |
Have: valid_rw(Malloc_0, a_1, 1 + b - a). |
| 202 |
(* Pre-condition *) |
| 203 |
Have: a <= b. |
| 204 |
(* Invariant 'Index' *) |
| 205 |
Have: a <= x. |
| 206 |
} |
| 207 |
Prove: i <= x. |
| 208 |
|
| 209 |
------------------------------------------------------------ |