author | blanchet |
Tue, 01 Oct 2013 14:29:27 +0200 | |
changeset 54010 | 5ac1495fed4e |
parent 42154 | 478bdcea240a |
child 72990 | db8f94656024 |
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}" |
|
42154 | 17 |
by vcg_simp |
13875 | 18 |
|
13856 | 19 |
lemma "VARS (a::int list) i |
20 |
{True} |
|
21 |
i := 0; |
|
22 |
WHILE i < length a |
|
23 |
INV {i <= length a} |
|
13875 | 24 |
DO a[i] := 7; i := i+1 OD |
13856 | 25 |
{True}" |
42154 | 26 |
by vcg_simp |
13856 | 27 |
|
28 |
end |