1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366
|
(* This file was originally generated by why.
It can be modified; only the generated parts will be overwritten. *)
Require Export average_spec_why.
(* Why obligation from file "why/average.why", characters 488-489 *)
Lemma average_impl_po_1 :
forall (t: pointer),
forall (n: Z),
forall (alloc: alloc_table),
forall (intP: ((memory) Z)),
forall (Pre7: (valid_range alloc t 0 n) /\ n > 0),
forall (sum: Z),
forall (Post6: sum = 0),
forall (i1: Z),
forall (Post1: i1 = 0),
forall (Variant1: Z),
forall (i2: Z),
forall (sum1: Z),
forall (Pre5: Variant1 = (n - i2)),
forall (Pre4: (0 <= i2 /\ i2 <= n) /\ (i2 * (min alloc intP t i2)) <= sum1),
forall (Test2: i2 < n),
(forall (result:pointer),
(result = (shift t i2) ->
(forall (result0:Z),
(result0 = (acc intP result) -> (sum1 + result0) =
(sum1 + (acc intP (shift t i2))))) /\
(valid alloc result))).
Proof.
intuition.
subst; auto.
Save.
(* Why obligation from file "why/average.why", characters 464-595 *)
Lemma average_impl_po_2 :
forall (t: pointer),
forall (n: Z),
forall (alloc: alloc_table),
forall (intP: ((memory) Z)),
forall (Pre7: (valid_range alloc t 0 n) /\ n > 0),
forall (sum: Z),
forall (Post6: sum = 0),
forall (i1: Z),
forall (Post1: i1 = 0),
forall (Variant1: Z),
forall (i2: Z),
forall (sum1: Z),
forall (Pre5: Variant1 = (n - i2)),
forall (Pre4: (0 <= i2 /\ i2 <= n) /\ (i2 * (min alloc intP t i2)) <= sum1),
forall (Test2: i2 < n),
forall (sum2: Z),
forall (Post3: sum2 = (sum1 + (acc intP (shift t i2)))),
forall (i3: Z),
forall (Post4: i3 = (i2 + 1)),
((0 <= i3 /\ i3 <= n) /\ (i3 * (min alloc intP t i3)) <= sum2) /\
(Zwf 0 (n - i3) (n - i2)).
Proof.
intuition; subst; auto.
Qed.
(* Why obligation from file "why/average.why", characters 266-605 *)
Lemma average_impl_po_3 :
forall (t: pointer),
forall (n: Z),
forall (alloc: alloc_table),
forall (intP: ((memory) Z)),
forall (Pre7: (valid_range alloc t 0 n) /\ n > 0),
forall (sum: Z),
forall (Post6: sum = 0),
forall (i1: Z),
forall (Post1: i1 = 0),
forall (Variant1: Z),
forall (i2: Z),
forall (sum1: Z),
forall (Pre5: Variant1 = (n - i2)),
forall (Pre4: (0 <= i2 /\ i2 <= n) /\ (i2 * (min alloc intP t i2)) <= sum1),
forall (Test1: i2 >= n),
(forall (result:Z),
(result = ((Zdiv sum1 n)) -> (min alloc intP t n) <= result)) /\
~(n = 0).
Proof.
intuition.
subst.
assert (i2 = n). omega. subst.
replace (min intP t n) with ((0 + min intP t n * n) / n).
apply Zge_le.
apply Z_div_ge; auto.
rewrite Zmult_comm.
omega.
rewrite Z_div_plus; auto.
Save.
(* Why obligation from file "why/average.why", characters 323-419 *)
Lemma average_impl_po_4 :
forall (t: pointer),
forall (n: Z),
forall (alloc: alloc_table),
forall (intP: ((memory) Z)),
forall (Pre7: (valid_range alloc t 0 n) /\ n > 0),
forall (sum: Z),
forall (Post6: sum = 0),
forall (i1: Z),
forall (Post1: i1 = 0),
(0 <= i1 /\ i1 <= n) /\ (i1 * (min alloc intP t i1)) <= sum.
Proof.
intuition.
subst; omega.
Qed.
Proof.
intuition.
(* FILL PROOF HERE *)
Save.
(* Why obligation from file "why/average.why", characters 902-916 *)
Lemma min_impl_po_1 :
forall (t: pointer),
forall (n: Z),
forall (alloc: alloc_table),
forall (Pre9: n > 0 /\ (valid_range alloc t 0 n)),
(valid alloc t).
Proof.
intuition.
subst; auto.
Save.
(* Why obligation from file "why/average.why", characters 1177-1264 *)
Lemma min_impl_po_2 :
forall (t: pointer),
forall (n: Z),
forall (alloc: alloc_table),
forall (intP: ((memory) Z)),
forall (Pre9: n > 0 /\ (valid_range alloc t 0 n)),
forall (Pre8: (valid alloc t)),
forall (tmp: Z),
forall (Post8: tmp = (acc intP t)),
forall (i1: Z),
forall (Post1: i1 = 1),
forall (Variant1: Z),
forall (i2: Z),
forall (tmp1: Z),
forall (Pre7: Variant1 = (n - i2)),
forall (Pre6: (1 <= i2 /\ i2 <= n) /\ (is_min alloc intP t i2 tmp1)),
forall (Test4: i2 < n),
(valid alloc (shift t i2)).
Proof.
unfold is_min; intuition; subst; auto with *.
assert (i1=0). omega.
subst; intuition.
exists 0; intuition.
assert (i3<i1 \/ i3=i1). omega. intuition.
generalize (H3 i3); intuition.
subst; omega.
exists i1; intuition.
assert (i3<i1 \/ i3=i1). omega. intuition.
subst; omega.
elim H6; intros i2 Hi2; exists i2; intuition.
assert (i1=n). omega. subst; trivial.
Save.
Proof.
intuition.
(* FILL PROOF HERE *)
assert (i2=0 \/ i2>0). omega. intuition.
subst; ring (0+1).
assert (min intP t 1 = shift t 0 # intP).
generalize (min_is_min alloc intP t 1).
assert (1>0). omega. unfold is_min in *|-*. intuition.
elim H7; intros i Hi. assert (i=0). omega.
subst; intuition.
omega.
replace ((i2 + 1) * min intP t (i2 + 1)) with ((i2 * min intP t (i2+1)) + min intP t (i2+1)).
2:ring.
assert (min intP t (i2 + 1) <= min intP t i2).
generalize (min_is_min alloc intP t i2).
assert (i2+1>0). omega.
generalize (min_is_min alloc intP t (i2+1)).
unfold is_min; intuition.
elim H9; intros i Hi.
intuition.
rewrite H11.
intuition.
assert (i2 * min intP t (i2 + 1) <= i2 * min intP t i2).
apply Zmult_le_compat_l; auto with *.
assert (min intP t (i2 + 1) <= shift t i2 # intP).
assert (i2+1>0). omega.
generalize (min_is_min alloc intP t (i2+1)).
unfold is_min; intuition.
omega.
Save.
Proof.
intuition.
(* FILL PROOF HERE *)
Save.
Proof.
intuition.
(* FILL PROOF HERE *)
Save.
(* Why obligation from file "why/average.why", characters 1287-1315 *)
Lemma min_impl_po_3 :
forall (t: pointer),
forall (n: Z),
forall (alloc: alloc_table),
forall (intP: ((memory) Z)),
forall (Pre9: n > 0 /\ (valid_range alloc t 0 n)),
forall (Pre8: (valid alloc t)),
forall (tmp: Z),
forall (Post8: tmp = (acc intP t)),
forall (i1: Z),
forall (Post1: i1 = 1),
forall (Variant1: Z),
forall (i2: Z),
forall (tmp1: Z),
forall (Pre7: Variant1 = (n - i2)),
forall (Pre6: (1 <= i2 /\ i2 <= n) /\ (is_min alloc intP t i2 tmp1)),
forall (Test4: i2 < n),
forall (Pre5: (valid alloc (shift t i2))),
forall (Test3: (acc intP (shift t i2)) < tmp1),
forall (aux_2: pointer),
forall (Post18: aux_2 = (shift t i2)),
(valid alloc aux_2).
Proof.
intuition.
(* FILL PROOF HERE *)
Save.
(* Why obligation from file "why/average.why", characters 1287-1315 *)
Lemma min_impl_po_4 :
forall (t: pointer),
forall (n: Z),
forall (alloc: alloc_table),
forall (intP: ((memory) Z)),
forall (Pre9: n > 0 /\ (valid_range alloc t 0 n)),
forall (Pre8: (valid alloc t)),
forall (tmp: Z),
forall (Post8: tmp = (acc intP t)),
forall (i1: Z),
forall (Post1: i1 = 1),
forall (Variant1: Z),
forall (i2: Z),
forall (tmp1: Z),
forall (Pre7: Variant1 = (n - i2)),
forall (Pre6: (1 <= i2 /\ i2 <= n) /\ (is_min alloc intP t i2 tmp1)),
forall (Test4: i2 < n),
forall (Pre5: (valid alloc (shift t i2))),
forall (Test3: (acc intP (shift t i2)) < tmp1),
forall (aux_2: pointer),
forall (Post18: aux_2 = (shift t i2)),
forall (Pre2: (valid alloc aux_2)),
forall (result2: Z),
forall (Post20: result2 = (acc intP aux_2)),
result2 = (acc intP (shift t i2)).
Proof.
intuition.
(* FILL PROOF HERE *)
Save.
(* Why obligation from file "why/average.why", characters 1280-1315 *)
Lemma min_impl_po_5 :
forall (t: pointer),
forall (n: Z),
forall (alloc: alloc_table),
forall (intP: ((memory) Z)),
forall (Pre9: n > 0 /\ (valid_range alloc t 0 n)),
forall (Pre8: (valid alloc t)),
forall (tmp: Z),
forall (Post8: tmp = (acc intP t)),
forall (i1: Z),
forall (Post1: i1 = 1),
forall (Variant1: Z),
forall (i2: Z),
forall (tmp1: Z),
forall (Pre7: Variant1 = (n - i2)),
forall (Pre6: (1 <= i2 /\ i2 <= n) /\ (is_min alloc intP t i2 tmp1)),
forall (Test4: i2 < n),
forall (Pre5: (valid alloc (shift t i2))),
forall (Test3: (acc intP (shift t i2)) < tmp1),
forall (tmp2: Z),
forall (Post4: tmp2 = (acc intP (shift t i2))),
(forall (i:Z),
(i = (i2 + 1) -> ((1 <= i /\ i <= n) /\ (is_min alloc intP t i tmp2)) /\
(Zwf 0 (n - i) (n - i2)))).
Proof.
intuition.
(* FILL PROOF HERE *)
Save.
(* Why obligation from file "why/average.why", characters 1331-1331 *)
Lemma min_impl_po_6 :
forall (t: pointer),
forall (n: Z),
forall (alloc: alloc_table),
forall (intP: ((memory) Z)),
forall (Pre9: n > 0 /\ (valid_range alloc t 0 n)),
forall (Pre8: (valid alloc t)),
forall (tmp: Z),
forall (Post8: tmp = (acc intP t)),
forall (i1: Z),
forall (Post1: i1 = 1),
forall (Variant1: Z),
forall (i2: Z),
forall (tmp1: Z),
forall (Pre7: Variant1 = (n - i2)),
forall (Pre6: (1 <= i2 /\ i2 <= n) /\ (is_min alloc intP t i2 tmp1)),
forall (Test4: i2 < n),
forall (Pre5: (valid alloc (shift t i2))),
forall (Test2: (acc intP (shift t i2)) >= tmp1),
forall (result2: unit),
forall (Post3: result2 = tt),
(forall (i:Z),
(i = (i2 + 1) -> ((1 <= i /\ i <= n) /\ (is_min alloc intP t i tmp1)) /\
(Zwf 0 (n - i) (n - i2)))).
Proof.
intuition.
(* FILL PROOF HERE *)
Save.
(* Why obligation from file "why/average.why", characters 993-1376 *)
Lemma min_impl_po_7 :
forall (t: pointer),
forall (n: Z),
forall (alloc: alloc_table),
forall (intP: ((memory) Z)),
forall (Pre9: n > 0 /\ (valid_range alloc t 0 n)),
forall (Pre8: (valid alloc t)),
forall (tmp: Z),
forall (Post8: tmp = (acc intP t)),
forall (i1: Z),
forall (Post1: i1 = 1),
forall (Variant1: Z),
forall (i2: Z),
forall (tmp1: Z),
forall (Pre7: Variant1 = (n - i2)),
forall (Pre6: (1 <= i2 /\ i2 <= n) /\ (is_min alloc intP t i2 tmp1)),
forall (Test1: i2 >= n),
(forall (result:Z), (result = tmp1 -> (is_min alloc intP t n result))).
Proof.
intuition.
(* FILL PROOF HERE *)
Save.
(* Why obligation from file "why/average.why", characters 1050-1129 *)
Lemma min_impl_po_8 :
forall (t: pointer),
forall (n: Z),
forall (alloc: alloc_table),
forall (intP: ((memory) Z)),
forall (Pre9: n > 0 /\ (valid_range alloc t 0 n)),
forall (Pre8: (valid alloc t)),
forall (tmp: Z),
forall (Post8: tmp = (acc intP t)),
forall (i1: Z),
forall (Post1: i1 = 1),
(1 <= i1 /\ i1 <= n) /\ (is_min alloc intP t i1 tmp).
Proof.
intuition.
(* FILL PROOF HERE *)
Save.
|