equal
deleted
inserted
replaced
5 |
5 |
6 section "Correctness of Hoare by Fixpoint Reasoning" |
6 section "Correctness of Hoare by Fixpoint Reasoning" |
7 |
7 |
8 theory HoareEx imports Denotational begin |
8 theory HoareEx imports Denotational begin |
9 |
9 |
10 text {* |
10 text \<open> |
11 An example from the HOLCF paper by Mueller, Nipkow, Oheimb, Slotosch |
11 An example from the HOLCF paper by Mueller, Nipkow, Oheimb, Slotosch |
12 @{cite MuellerNvOS99}. It demonstrates fixpoint reasoning by showing |
12 @{cite MuellerNvOS99}. It demonstrates fixpoint reasoning by showing |
13 the correctness of the Hoare rule for while-loops. |
13 the correctness of the Hoare rule for while-loops. |
14 *} |
14 \<close> |
15 |
15 |
16 type_synonym assn = "state => bool" |
16 type_synonym assn = "state => bool" |
17 |
17 |
18 definition |
18 definition |
19 hoare_valid :: "[assn, com, assn] => bool" ("|= {(1_)}/ (_)/ {(1_)}" 50) where |
19 hoare_valid :: "[assn, com, assn] => bool" ("|= {(1_)}/ (_)/ {(1_)}" 50) where |
22 lemma WHILE_rule_sound: |
22 lemma WHILE_rule_sound: |
23 "|= {A} c {A} ==> |= {A} WHILE b DO c {\<lambda>s. A s \<and> \<not> bval b s}" |
23 "|= {A} c {A} ==> |= {A} WHILE b DO c {\<lambda>s. A s \<and> \<not> bval b s}" |
24 apply (unfold hoare_valid_def) |
24 apply (unfold hoare_valid_def) |
25 apply (simp (no_asm)) |
25 apply (simp (no_asm)) |
26 apply (rule fix_ind) |
26 apply (rule fix_ind) |
27 apply (simp (no_asm)) -- "simplifier with enhanced @{text adm}-tactic" |
27 apply (simp (no_asm)) \<comment> "simplifier with enhanced \<open>adm\<close>-tactic" |
28 apply (simp (no_asm)) |
28 apply (simp (no_asm)) |
29 apply (simp (no_asm)) |
29 apply (simp (no_asm)) |
30 apply blast |
30 apply blast |
31 done |
31 done |
32 |
32 |