3664
|
1 |
(* Title: HOLCF/IMP/HoareEx.thy
|
|
2 |
ID: $Id$
|
|
3 |
Author: Tobias Nipkow, TUM
|
|
4 |
Copyright 1997 TUM
|
|
5 |
*)
|
|
6 |
|
12431
|
7 |
header "Correctness of Hoare by Fixpoint Reasoning"
|
|
8 |
|
16417
|
9 |
theory HoareEx imports Denotational begin
|
3664
|
10 |
|
12431
|
11 |
text {*
|
12546
|
12 |
An example from the HOLCF paper by Müller, Nipkow, Oheimb, Slotosch
|
|
13 |
\cite{MuellerNvOS99}. It demonstrates fixpoint reasoning by showing
|
|
14 |
the correctness of the Hoare rule for while-loops.
|
12431
|
15 |
*}
|
3664
|
16 |
|
12431
|
17 |
types assn = "state => bool"
|
|
18 |
|
12600
|
19 |
constdefs
|
|
20 |
hoare_valid :: "[assn, com, assn] => bool" ("|= {(1_)}/ (_)/ {(1_)}" 50)
|
|
21 |
"|= {A} c {B} == \<forall>s t. A s \<and> D c $(Discr s) = Def t --> B t"
|
3664
|
22 |
|
12431
|
23 |
lemma WHILE_rule_sound:
|
12600
|
24 |
"|= {A} c {A} ==> |= {A} \<WHILE> b \<DO> c {\<lambda>s. A s \<and> \<not> b s}"
|
12431
|
25 |
apply (unfold hoare_valid_def)
|
|
26 |
apply (simp (no_asm))
|
|
27 |
apply (rule fix_ind)
|
12600
|
28 |
apply (simp (no_asm)) -- "simplifier with enhanced @{text adm}-tactic"
|
12431
|
29 |
apply (simp (no_asm))
|
|
30 |
apply (simp (no_asm))
|
|
31 |
apply blast
|
|
32 |
done
|
|
33 |
|
3664
|
34 |
end
|