1478
|
1 |
(* Title: ZF/IMP/Equiv.thy
|
482
|
2 |
ID: $Id$
|
12610
|
3 |
Author: Heiko Loetzbeyer and Robert Sandner, TU München
|
482
|
4 |
*)
|
|
5 |
|
12610
|
6 |
header {* Equivalence *}
|
|
7 |
|
12606
|
8 |
theory Equiv = Denotation + Com:
|
|
9 |
|
|
10 |
lemma aexp_iff [rule_format]:
|
12610
|
11 |
"[| a \<in> aexp; sigma: loc -> nat |]
|
|
12 |
==> ALL n. <a,sigma> -a-> n <-> A(a,sigma) = n"
|
|
13 |
apply (erule aexp.induct)
|
|
14 |
apply (force intro!: evala.intros)+
|
|
15 |
done
|
12606
|
16 |
|
|
17 |
declare aexp_iff [THEN iffD1, simp]
|
|
18 |
aexp_iff [THEN iffD2, intro!]
|
|
19 |
|
12610
|
20 |
inductive_cases [elim!]:
|
|
21 |
"<true,sigma> -b-> x"
|
|
22 |
"<false,sigma> -b-> x"
|
|
23 |
"<ROp(f,a0,a1),sigma> -b-> x"
|
|
24 |
"<noti(b),sigma> -b-> x"
|
|
25 |
"<b0 andi b1,sigma> -b-> x"
|
|
26 |
"<b0 ori b1,sigma> -b-> x"
|
12606
|
27 |
|
|
28 |
|
|
29 |
lemma bexp_iff [rule_format]:
|
12610
|
30 |
"[| b \<in> bexp; sigma: loc -> nat |]
|
|
31 |
==> ALL w. <b,sigma> -b-> w <-> B(b,sigma) = w"
|
|
32 |
apply (erule bexp.induct)
|
|
33 |
apply (auto intro!: evalb.intros)
|
|
34 |
done
|
12606
|
35 |
|
|
36 |
declare bexp_iff [THEN iffD1, simp]
|
|
37 |
bexp_iff [THEN iffD2, intro!]
|
|
38 |
|
|
39 |
lemma com1: "<c,sigma> -c-> sigma' ==> <sigma,sigma'> \<in> C(c)"
|
12610
|
40 |
apply (erule evalc.induct)
|
|
41 |
apply simp_all
|
|
42 |
txt {* @{text skip} *}
|
|
43 |
apply fast
|
|
44 |
txt {* @{text assign} *}
|
|
45 |
apply (simp add: update_type)
|
|
46 |
txt {* @{text comp} *}
|
|
47 |
apply fast
|
|
48 |
txt {* @{text while} *}
|
|
49 |
apply (erule Gamma_bnd_mono [THEN lfp_unfold, THEN ssubst, OF C_subset])
|
|
50 |
apply (simp add: Gamma_def)
|
|
51 |
apply force
|
|
52 |
txt {* recursive case of @{text while} *}
|
|
53 |
apply (erule Gamma_bnd_mono [THEN lfp_unfold, THEN ssubst, OF C_subset])
|
|
54 |
apply (auto simp add: Gamma_def)
|
|
55 |
done
|
12606
|
56 |
|
|
57 |
declare B_type [intro!] A_type [intro!]
|
|
58 |
declare evalc.intros [intro]
|
|
59 |
|
|
60 |
|
|
61 |
lemma com2 [rule_format]: "c \<in> com ==> \<forall>x \<in> C(c). <c,fst(x)> -c-> snd(x)"
|
12610
|
62 |
apply (erule com.induct)
|
|
63 |
txt {* @{text skip} *}
|
|
64 |
apply force
|
|
65 |
txt {* @{text assign} *}
|
|
66 |
apply force
|
|
67 |
txt {* @{text comp} *}
|
|
68 |
apply force
|
|
69 |
txt {* @{text while} *}
|
|
70 |
apply safe
|
|
71 |
apply simp_all
|
|
72 |
apply (frule Gamma_bnd_mono [OF C_subset], erule Fixedpt.induct, assumption)
|
|
73 |
apply (unfold Gamma_def)
|
|
74 |
apply force
|
|
75 |
txt {* @{text if} *}
|
|
76 |
apply auto
|
|
77 |
done
|
12606
|
78 |
|
|
79 |
|
12610
|
80 |
subsection {* Main theorem *}
|
12606
|
81 |
|
12610
|
82 |
theorem com_equivalence:
|
|
83 |
"c \<in> com ==> C(c) = {io \<in> (loc->nat) \<times> (loc->nat). <c,fst(io)> -c-> snd(io)}"
|
|
84 |
by (force intro: C_subset [THEN subsetD] elim: com2 dest: com1)
|
12606
|
85 |
|
|
86 |
end
|
|
87 |
|