| author | krauss |
| Mon, 14 Feb 2011 15:27:23 +0100 | |
| changeset 41763 | 8ce56536fda7 |
| parent 35316 | 870dfea4f9c0 |
| child 42154 | 478bdcea240a |
| permissions | -rw-r--r-- |
| 13857 | 1 |
(* Title: HOL/Hoare/ExamplesAbort.thy |
2 |
Author: Tobias Nipkow |
|
3 |
Copyright 1998 TUM |
|
4 |
||
5 |
Some small examples for programs that may abort. |
|
6 |
*) |
|
7 |
||
|
35316
870dfea4f9c0
dropped axclass; dropped Id; session theory Hoare.thy
haftmann
parents:
16733
diff
changeset
|
8 |
theory ExamplesAbort imports Hoare_Logic_Abort begin |
| 13856 | 9 |
|
10 |
lemma "VARS x y z::nat |
|
11 |
{y = z & z \<noteq> 0} z \<noteq> 0 \<rightarrow> x := y div z {x = 1}"
|
|
12 |
by vcg_simp |
|
13 |
||
| 13875 | 14 |
lemma |
15 |
"VARS a i j |
|
16 |
{k <= length a & i < k & j < k} j < length a \<rightarrow> a[i] := a!j {True}"
|
|
17 |
apply vcg_simp |
|
18 |
done |
|
19 |
||
| 13856 | 20 |
lemma "VARS (a::int list) i |
21 |
{True}
|
|
22 |
i := 0; |
|
23 |
WHILE i < length a |
|
24 |
INV {i <= length a}
|
|
| 13875 | 25 |
DO a[i] := 7; i := i+1 OD |
| 13856 | 26 |
{True}"
|
27 |
apply vcg_simp |
|
28 |
done |
|
29 |
||
30 |
end |