author | nipkow |
Thu, 10 May 2001 17:28:40 +0200 | |
changeset 11295 | 66925f23ac7f |
parent 11252 | 71c00cb091d2 |
child 11372 | 648795477bb5 |
permissions | -rw-r--r-- |
8011 | 1 |
(* Title: HOL/MicroJava/BV/Correct.thy |
2 |
ID: $Id$ |
|
3 |
Author: Cornelia Pusch |
|
4 |
Copyright 1999 Technische Universitaet Muenchen |
|
5 |
||
6 |
The invariant for the type safety proof. |
|
7 |
*) |
|
8 |
||
10056 | 9 |
header "BV Type Safety Invariant" |
9757
1024a2d80ac0
functional LBV style, dead code, type safety -> Isar
kleing
parents:
9549
diff
changeset
|
10 |
|
1024a2d80ac0
functional LBV style, dead code, type safety -> Isar
kleing
parents:
9549
diff
changeset
|
11 |
theory Correct = BVSpec: |
8011 | 12 |
|
11252 | 13 |
lemma list_all2_rev [simp]: |
14 |
"list_all2 P (rev l) (rev l') = list_all2 P l l'" |
|
15 |
apply (unfold list_all2_def) |
|
16 |
apply (simp add: zip_rev cong: conj_cong) |
|
17 |
done |
|
18 |
||
8011 | 19 |
constdefs |
10056 | 20 |
approx_val :: "[jvm_prog,aheap,val,ty err] => bool" |
10496 | 21 |
"approx_val G h v any == case any of Err => True | OK T => G,h\<turnstile>v::\<preceq>T" |
8011 | 22 |
|
10056 | 23 |
approx_loc :: "[jvm_prog,aheap,val list,locvars_type] => bool" |
24 |
"approx_loc G hp loc LT == list_all2 (approx_val G hp) loc LT" |
|
25 |
||
26 |
approx_stk :: "[jvm_prog,aheap,opstack,opstack_type] => bool" |
|
10496 | 27 |
"approx_stk G hp stk ST == approx_loc G hp stk (map OK ST)" |
9757
1024a2d80ac0
functional LBV style, dead code, type safety -> Isar
kleing
parents:
9549
diff
changeset
|
28 |
|
10056 | 29 |
correct_frame :: "[jvm_prog,aheap,state_type,nat,bytecode] => frame => bool" |
30 |
"correct_frame G hp == \<lambda>(ST,LT) maxl ins (stk,loc,C,sig,pc). |
|
31 |
approx_stk G hp stk ST \<and> approx_loc G hp loc LT \<and> |
|
32 |
pc < length ins \<and> length loc=length(snd sig)+maxl+1" |
|
8011 | 33 |
|
34 |
||
35 |
consts |
|
10042 | 36 |
correct_frames :: "[jvm_prog,aheap,prog_type,ty,sig,frame list] => bool" |
8011 | 37 |
primrec |
8045
816f566c414f
Fixed a problem with returning from the last frame.
nipkow
parents:
8034
diff
changeset
|
38 |
"correct_frames G hp phi rT0 sig0 [] = True" |
8011 | 39 |
|
8045
816f566c414f
Fixed a problem with returning from the last frame.
nipkow
parents:
8034
diff
changeset
|
40 |
"correct_frames G hp phi rT0 sig0 (f#frs) = |
11252 | 41 |
(let (stk,loc,C,sig,pc) = f in |
10592 | 42 |
(\<exists>ST LT rT maxs maxl ins. |
10625
022c6b2bcd6b
strengthened invariant: current class must be defined
kleing
parents:
10612
diff
changeset
|
43 |
phi C sig ! pc = Some (ST,LT) \<and> is_class G C \<and> |
10592 | 44 |
method (G,C) sig = Some(C,rT,(maxs,maxl,ins)) \<and> |
10625
022c6b2bcd6b
strengthened invariant: current class must be defined
kleing
parents:
10612
diff
changeset
|
45 |
(\<exists>C' mn pTs k. pc = k+1 \<and> ins!k = (Invoke C' mn pTs) \<and> |
9757
1024a2d80ac0
functional LBV style, dead code, type safety -> Isar
kleing
parents:
9549
diff
changeset
|
46 |
(mn,pTs) = sig0 \<and> |
1024a2d80ac0
functional LBV style, dead code, type safety -> Isar
kleing
parents:
9549
diff
changeset
|
47 |
(\<exists>apTs D ST' LT'. |
1024a2d80ac0
functional LBV style, dead code, type safety -> Isar
kleing
parents:
9549
diff
changeset
|
48 |
(phi C sig)!k = Some ((rev apTs) @ (Class D) # ST', LT') \<and> |
1024a2d80ac0
functional LBV style, dead code, type safety -> Isar
kleing
parents:
9549
diff
changeset
|
49 |
length apTs = length pTs \<and> |
10592 | 50 |
(\<exists>D' rT' maxs' maxl' ins'. |
51 |
method (G,D) sig0 = Some(D',rT',(maxs',maxl',ins')) \<and> |
|
9757
1024a2d80ac0
functional LBV style, dead code, type safety -> Isar
kleing
parents:
9549
diff
changeset
|
52 |
G \<turnstile> rT0 \<preceq> rT') \<and> |
1024a2d80ac0
functional LBV style, dead code, type safety -> Isar
kleing
parents:
9549
diff
changeset
|
53 |
correct_frame G hp (tl ST, LT) maxl ins f \<and> |
8045
816f566c414f
Fixed a problem with returning from the last frame.
nipkow
parents:
8034
diff
changeset
|
54 |
correct_frames G hp phi rT sig frs))))" |
8011 | 55 |
|
56 |
||
57 |
constdefs |
|
10042 | 58 |
correct_state :: "[jvm_prog,prog_type,jvm_state] => bool" |
10060 | 59 |
("_,_ \<turnstile>JVM _ \<surd>" [51,51] 50) |
10042 | 60 |
"correct_state G phi == \<lambda>(xp,hp,frs). |
8011 | 61 |
case xp of |
10042 | 62 |
None => (case frs of |
63 |
[] => True |
|
64 |
| (f#fs) => G\<turnstile>h hp\<surd> \<and> |
|
8045
816f566c414f
Fixed a problem with returning from the last frame.
nipkow
parents:
8034
diff
changeset
|
65 |
(let (stk,loc,C,sig,pc) = f |
8011 | 66 |
in |
10592 | 67 |
\<exists>rT maxs maxl ins s. |
10625
022c6b2bcd6b
strengthened invariant: current class must be defined
kleing
parents:
10612
diff
changeset
|
68 |
is_class G C \<and> |
10592 | 69 |
method (G,C) sig = Some(C,rT,(maxs,maxl,ins)) \<and> |
9757
1024a2d80ac0
functional LBV style, dead code, type safety -> Isar
kleing
parents:
9549
diff
changeset
|
70 |
phi C sig ! pc = Some s \<and> |
1024a2d80ac0
functional LBV style, dead code, type safety -> Isar
kleing
parents:
9549
diff
changeset
|
71 |
correct_frame G hp s maxl ins f \<and> |
8045
816f566c414f
Fixed a problem with returning from the last frame.
nipkow
parents:
8034
diff
changeset
|
72 |
correct_frames G hp phi rT sig fs)) |
10042 | 73 |
| Some x => True" |
9757
1024a2d80ac0
functional LBV style, dead code, type safety -> Isar
kleing
parents:
9549
diff
changeset
|
74 |
|
1024a2d80ac0
functional LBV style, dead code, type safety -> Isar
kleing
parents:
9549
diff
changeset
|
75 |
|
10060 | 76 |
syntax (HTML) |
77 |
correct_state :: "[jvm_prog,prog_type,jvm_state] => bool" |
|
78 |
("_,_ |-JVM _ [ok]" [51,51] 50) |
|
79 |
||
11252 | 80 |
|
81 |
lemma sup_ty_opt_OK: |
|
82 |
"(G \<turnstile> X <=o (OK T')) = (\<exists>T. X = OK T \<and> G \<turnstile> T \<preceq> T')" |
|
83 |
apply (cases X) |
|
84 |
apply auto |
|
85 |
done |
|
86 |
||
87 |
||
11085 | 88 |
section {* approx-val *} |
9757
1024a2d80ac0
functional LBV style, dead code, type safety -> Isar
kleing
parents:
9549
diff
changeset
|
89 |
|
11252 | 90 |
lemma approx_val_Err [simp,intro!]: |
9757
1024a2d80ac0
functional LBV style, dead code, type safety -> Isar
kleing
parents:
9549
diff
changeset
|
91 |
"approx_val G hp x Err" |
11252 | 92 |
by (simp add: approx_val_def) |
9757
1024a2d80ac0
functional LBV style, dead code, type safety -> Isar
kleing
parents:
9549
diff
changeset
|
93 |
|
11252 | 94 |
lemma approx_val_OK [iff]: |
95 |
"approx_val G hp x (OK T) = (G,hp \<turnstile> x ::\<preceq> T)" |
|
96 |
by (simp add: approx_val_def) |
|
9757
1024a2d80ac0
functional LBV style, dead code, type safety -> Isar
kleing
parents:
9549
diff
changeset
|
97 |
|
11252 | 98 |
lemma approx_val_Null [simp,intro!]: |
99 |
"approx_val G hp Null (OK (RefT x))" |
|
100 |
by (auto simp add: approx_val_def) |
|
9757
1024a2d80ac0
functional LBV style, dead code, type safety -> Isar
kleing
parents:
9549
diff
changeset
|
101 |
|
11252 | 102 |
lemma approx_val_sup_heap: |
103 |
"\<lbrakk> approx_val G hp v T; hp \<le>| hp' \<rbrakk> \<Longrightarrow> approx_val G hp' v T" |
|
104 |
by (cases T) (blast intro: conf_hext)+ |
|
9757
1024a2d80ac0
functional LBV style, dead code, type safety -> Isar
kleing
parents:
9549
diff
changeset
|
105 |
|
11252 | 106 |
lemma approx_val_heap_update: |
107 |
"[| hp a = Some obj'; G,hp\<turnstile> v::\<preceq>T; obj_ty obj = obj_ty obj'|] |
|
108 |
==> G,hp(a\<mapsto>obj)\<turnstile> v::\<preceq>T" |
|
109 |
by (cases v, auto simp add: obj_ty_def conf_def) |
|
9757
1024a2d80ac0
functional LBV style, dead code, type safety -> Isar
kleing
parents:
9549
diff
changeset
|
110 |
|
11252 | 111 |
lemma approx_val_widen: |
112 |
"\<lbrakk> approx_val G hp v T; G \<turnstile> T <=o T'; wf_prog wt G \<rbrakk> |
|
113 |
\<Longrightarrow> approx_val G hp v T'" |
|
114 |
by (cases T', auto simp add: sup_ty_opt_OK intro: conf_widen) |
|
9757
1024a2d80ac0
functional LBV style, dead code, type safety -> Isar
kleing
parents:
9549
diff
changeset
|
115 |
|
11085 | 116 |
section {* approx-loc *} |
9757
1024a2d80ac0
functional LBV style, dead code, type safety -> Isar
kleing
parents:
9549
diff
changeset
|
117 |
|
11252 | 118 |
lemma approx_loc_Nil [simp,intro!]: |
119 |
"approx_loc G hp [] []" |
|
120 |
by (simp add: approx_loc_def) |
|
121 |
||
9757
1024a2d80ac0
functional LBV style, dead code, type safety -> Isar
kleing
parents:
9549
diff
changeset
|
122 |
lemma approx_loc_Cons [iff]: |
11252 | 123 |
"approx_loc G hp (l#ls) (L#LT) = |
124 |
(approx_val G hp l L \<and> approx_loc G hp ls LT)" |
|
9757
1024a2d80ac0
functional LBV style, dead code, type safety -> Isar
kleing
parents:
9549
diff
changeset
|
125 |
by (simp add: approx_loc_def) |
1024a2d80ac0
functional LBV style, dead code, type safety -> Isar
kleing
parents:
9549
diff
changeset
|
126 |
|
11252 | 127 |
lemma approx_loc_nth: |
128 |
"\<lbrakk> approx_loc G hp loc LT; n < length LT \<rbrakk> |
|
129 |
\<Longrightarrow> approx_val G hp (loc!n) (LT!n)" |
|
130 |
by (simp add: approx_loc_def list_all2_conv_all_nth) |
|
131 |
||
132 |
lemma approx_loc_imp_approx_val_sup: |
|
133 |
"\<lbrakk>approx_loc G hp loc LT; n < length LT; LT ! n = OK T; G \<turnstile> T \<preceq> T'; wf_prog wt G\<rbrakk> |
|
134 |
\<Longrightarrow> G,hp \<turnstile> (loc!n) ::\<preceq> T'" |
|
135 |
apply (drule approx_loc_nth, assumption) |
|
136 |
apply simp |
|
137 |
apply (erule conf_widen, assumption+) |
|
138 |
done |
|
139 |
||
140 |
lemma approx_loc_conv_all_nth: |
|
141 |
"approx_loc G hp loc LT = |
|
142 |
(length loc = length LT \<and> (\<forall>n < length loc. approx_val G hp (loc!n) (LT!n)))" |
|
143 |
by (simp add: approx_loc_def list_all2_conv_all_nth) |
|
144 |
||
145 |
lemma approx_loc_sup_heap: |
|
146 |
"\<lbrakk> approx_loc G hp loc LT; hp \<le>| hp' \<rbrakk> |
|
147 |
\<Longrightarrow> approx_loc G hp' loc LT" |
|
148 |
apply (clarsimp simp add: approx_loc_conv_all_nth) |
|
149 |
apply (blast intro: approx_val_sup_heap) |
|
150 |
done |
|
151 |
||
152 |
lemma approx_loc_widen: |
|
153 |
"\<lbrakk> approx_loc G hp loc LT; G \<turnstile> LT <=l LT'; wf_prog wt G \<rbrakk> |
|
154 |
\<Longrightarrow> approx_loc G hp loc LT'" |
|
155 |
apply (unfold Listn.le_def lesub_def sup_loc_def) |
|
156 |
apply (simp (no_asm_use) only: list_all2_conv_all_nth approx_loc_conv_all_nth) |
|
157 |
apply (simp (no_asm_simp)) |
|
158 |
apply clarify |
|
159 |
apply (erule allE, erule impE) |
|
160 |
apply simp |
|
161 |
apply (erule approx_val_widen) |
|
162 |
apply simp |
|
163 |
apply assumption |
|
10056 | 164 |
done |
9757
1024a2d80ac0
functional LBV style, dead code, type safety -> Isar
kleing
parents:
9549
diff
changeset
|
165 |
|
11252 | 166 |
lemma approx_loc_subst: |
167 |
"\<lbrakk> approx_loc G hp loc LT; approx_val G hp x X \<rbrakk> |
|
168 |
\<Longrightarrow> approx_loc G hp (loc[idx:=x]) (LT[idx:=X])" |
|
9757
1024a2d80ac0
functional LBV style, dead code, type safety -> Isar
kleing
parents:
9549
diff
changeset
|
169 |
apply (unfold approx_loc_def list_all2_def) |
1024a2d80ac0
functional LBV style, dead code, type safety -> Isar
kleing
parents:
9549
diff
changeset
|
170 |
apply (auto dest: subsetD [OF set_update_subset_insert] simp add: zip_update) |
10056 | 171 |
done |
9757
1024a2d80ac0
functional LBV style, dead code, type safety -> Isar
kleing
parents:
9549
diff
changeset
|
172 |
|
11252 | 173 |
lemma approx_loc_append: |
174 |
"length l1=length L1 \<Longrightarrow> |
|
10056 | 175 |
approx_loc G hp (l1@l2) (L1@L2) = |
176 |
(approx_loc G hp l1 L1 \<and> approx_loc G hp l2 L2)" |
|
11252 | 177 |
apply (unfold approx_loc_def list_all2_def) |
178 |
apply (simp cong: conj_cong) |
|
179 |
apply blast |
|
180 |
done |
|
9757
1024a2d80ac0
functional LBV style, dead code, type safety -> Isar
kleing
parents:
9549
diff
changeset
|
181 |
|
11085 | 182 |
section {* approx-stk *} |
9757
1024a2d80ac0
functional LBV style, dead code, type safety -> Isar
kleing
parents:
9549
diff
changeset
|
183 |
|
1024a2d80ac0
functional LBV style, dead code, type safety -> Isar
kleing
parents:
9549
diff
changeset
|
184 |
lemma approx_stk_rev_lem: |
1024a2d80ac0
functional LBV style, dead code, type safety -> Isar
kleing
parents:
9549
diff
changeset
|
185 |
"approx_stk G hp (rev s) (rev t) = approx_stk G hp s t" |
11252 | 186 |
apply (unfold approx_stk_def approx_loc_def) |
187 |
apply (simp add: rev_map [THEN sym]) |
|
188 |
done |
|
9757
1024a2d80ac0
functional LBV style, dead code, type safety -> Isar
kleing
parents:
9549
diff
changeset
|
189 |
|
1024a2d80ac0
functional LBV style, dead code, type safety -> Isar
kleing
parents:
9549
diff
changeset
|
190 |
lemma approx_stk_rev: |
1024a2d80ac0
functional LBV style, dead code, type safety -> Isar
kleing
parents:
9549
diff
changeset
|
191 |
"approx_stk G hp (rev s) t = approx_stk G hp s (rev t)" |
11252 | 192 |
by (auto intro: subst [OF approx_stk_rev_lem]) |
9757
1024a2d80ac0
functional LBV style, dead code, type safety -> Isar
kleing
parents:
9549
diff
changeset
|
193 |
|
11252 | 194 |
lemma approx_stk_sup_heap: |
195 |
"\<lbrakk> approx_stk G hp stk ST; hp \<le>| hp' \<rbrakk> \<Longrightarrow> approx_stk G hp' stk ST" |
|
196 |
by (auto intro: approx_loc_sup_heap simp add: approx_stk_def) |
|
9757
1024a2d80ac0
functional LBV style, dead code, type safety -> Isar
kleing
parents:
9549
diff
changeset
|
197 |
|
11252 | 198 |
lemma approx_stk_widen: |
199 |
"\<lbrakk> approx_stk G hp stk ST; G \<turnstile> map OK ST <=l map OK ST'; wf_prog wt G \<rbrakk> |
|
200 |
\<Longrightarrow> approx_stk G hp stk ST'" |
|
201 |
by (auto elim: approx_loc_widen simp add: approx_stk_def) |
|
9757
1024a2d80ac0
functional LBV style, dead code, type safety -> Isar
kleing
parents:
9549
diff
changeset
|
202 |
|
1024a2d80ac0
functional LBV style, dead code, type safety -> Isar
kleing
parents:
9549
diff
changeset
|
203 |
lemma approx_stk_Nil [iff]: |
1024a2d80ac0
functional LBV style, dead code, type safety -> Isar
kleing
parents:
9549
diff
changeset
|
204 |
"approx_stk G hp [] []" |
11252 | 205 |
by (simp add: approx_stk_def) |
9757
1024a2d80ac0
functional LBV style, dead code, type safety -> Isar
kleing
parents:
9549
diff
changeset
|
206 |
|
1024a2d80ac0
functional LBV style, dead code, type safety -> Isar
kleing
parents:
9549
diff
changeset
|
207 |
lemma approx_stk_Cons [iff]: |
11252 | 208 |
"approx_stk G hp (x#stk) (S#ST) = |
209 |
(approx_val G hp x (OK S) \<and> approx_stk G hp stk ST)" |
|
210 |
by (simp add: approx_stk_def) |
|
9757
1024a2d80ac0
functional LBV style, dead code, type safety -> Isar
kleing
parents:
9549
diff
changeset
|
211 |
|
1024a2d80ac0
functional LBV style, dead code, type safety -> Isar
kleing
parents:
9549
diff
changeset
|
212 |
lemma approx_stk_Cons_lemma [iff]: |
1024a2d80ac0
functional LBV style, dead code, type safety -> Isar
kleing
parents:
9549
diff
changeset
|
213 |
"approx_stk G hp stk (S#ST') = |
10496 | 214 |
(\<exists>s stk'. stk = s#stk' \<and> approx_val G hp s (OK S) \<and> approx_stk G hp stk' ST')" |
11252 | 215 |
by (simp add: list_all2_Cons2 approx_stk_def approx_loc_def) |
216 |
||
217 |
lemma approx_stk_append: |
|
218 |
"approx_stk G hp stk (S@S') \<Longrightarrow> |
|
219 |
(\<exists>s stk'. stk = s@stk' \<and> length s = length S \<and> length stk' = length S' \<and> |
|
220 |
approx_stk G hp s S \<and> approx_stk G hp stk' S')" |
|
221 |
by (simp add: list_all2_append2 approx_stk_def approx_loc_def) |
|
9757
1024a2d80ac0
functional LBV style, dead code, type safety -> Isar
kleing
parents:
9549
diff
changeset
|
222 |
|
11252 | 223 |
lemma approx_stk_all_widen: |
224 |
"\<lbrakk> approx_stk G hp stk ST; \<forall>x \<in> set (zip ST ST'). x \<in> widen G; length ST = length ST'; wf_prog wt G \<rbrakk> |
|
225 |
\<Longrightarrow> approx_stk G hp stk ST'" |
|
226 |
apply (unfold approx_stk_def) |
|
227 |
apply (clarsimp simp add: approx_loc_conv_all_nth all_set_conv_all_nth) |
|
228 |
apply (erule allE, erule impE, assumption) |
|
229 |
apply (erule allE, erule impE, assumption) |
|
230 |
apply (erule conf_widen, assumption+) |
|
231 |
done |
|
9757
1024a2d80ac0
functional LBV style, dead code, type safety -> Isar
kleing
parents:
9549
diff
changeset
|
232 |
|
11085 | 233 |
section {* oconf *} |
9757
1024a2d80ac0
functional LBV style, dead code, type safety -> Isar
kleing
parents:
9549
diff
changeset
|
234 |
|
11252 | 235 |
lemma oconf_field_update: |
10042 | 236 |
"[|map_of (fields (G, oT)) FD = Some T; G,hp\<turnstile>v::\<preceq>T; G,hp\<turnstile>(oT,fs)\<surd> |] |
237 |
==> G,hp\<turnstile>(oT, fs(FD\<mapsto>v))\<surd>" |
|
11252 | 238 |
by (simp add: oconf_def lconf_def) |
9757
1024a2d80ac0
functional LBV style, dead code, type safety -> Isar
kleing
parents:
9549
diff
changeset
|
239 |
|
11252 | 240 |
lemma oconf_newref: |
241 |
"\<lbrakk>hp oref = None; G,hp \<turnstile> obj \<surd>; G,hp \<turnstile> obj' \<surd>\<rbrakk> \<Longrightarrow> G,hp(oref\<mapsto>obj') \<turnstile> obj \<surd>" |
|
242 |
apply (unfold oconf_def lconf_def) |
|
243 |
apply simp |
|
244 |
apply (blast intro: conf_hext hext_new) |
|
245 |
done |
|
9757
1024a2d80ac0
functional LBV style, dead code, type safety -> Isar
kleing
parents:
9549
diff
changeset
|
246 |
|
11252 | 247 |
lemma oconf_heap_update: |
248 |
"\<lbrakk> hp a = Some obj'; obj_ty obj' = obj_ty obj''; G,hp\<turnstile>obj\<surd> \<rbrakk> |
|
249 |
\<Longrightarrow> G,hp(a\<mapsto>obj'')\<turnstile>obj\<surd>" |
|
250 |
apply (unfold oconf_def lconf_def) |
|
251 |
apply (fastsimp intro: approx_val_heap_update) |
|
252 |
done |
|
9757
1024a2d80ac0
functional LBV style, dead code, type safety -> Isar
kleing
parents:
9549
diff
changeset
|
253 |
|
11085 | 254 |
section {* hconf *} |
9757
1024a2d80ac0
functional LBV style, dead code, type safety -> Isar
kleing
parents:
9549
diff
changeset
|
255 |
|
11252 | 256 |
lemma hconf_newref: |
257 |
"\<lbrakk> hp oref = None; G\<turnstile>h hp\<surd>; G,hp\<turnstile>obj\<surd> \<rbrakk> \<Longrightarrow> G\<turnstile>h hp(oref\<mapsto>obj)\<surd>" |
|
258 |
apply (simp add: hconf_def) |
|
259 |
apply (fast intro: oconf_newref) |
|
260 |
done |
|
9757
1024a2d80ac0
functional LBV style, dead code, type safety -> Isar
kleing
parents:
9549
diff
changeset
|
261 |
|
11252 | 262 |
lemma hconf_field_update: |
263 |
"\<lbrakk> map_of (fields (G, oT)) X = Some T; hp a = Some(oT,fs); |
|
264 |
G,hp\<turnstile>v::\<preceq>T; G\<turnstile>h hp\<surd> \<rbrakk> |
|
265 |
\<Longrightarrow> G\<turnstile>h hp(a \<mapsto> (oT, fs(X\<mapsto>v)))\<surd>" |
|
266 |
apply (simp add: hconf_def) |
|
267 |
apply (fastsimp intro: oconf_heap_update oconf_field_update |
|
268 |
simp add: obj_ty_def) |
|
269 |
done |
|
9757
1024a2d80ac0
functional LBV style, dead code, type safety -> Isar
kleing
parents:
9549
diff
changeset
|
270 |
|
11085 | 271 |
section {* correct-frames *} |
9757
1024a2d80ac0
functional LBV style, dead code, type safety -> Isar
kleing
parents:
9549
diff
changeset
|
272 |
|
1024a2d80ac0
functional LBV style, dead code, type safety -> Isar
kleing
parents:
9549
diff
changeset
|
273 |
lemmas [simp del] = fun_upd_apply |
1024a2d80ac0
functional LBV style, dead code, type safety -> Isar
kleing
parents:
9549
diff
changeset
|
274 |
|
11252 | 275 |
lemma correct_frames_field_update [rule_format]: |
276 |
"\<forall>rT C sig. |
|
277 |
correct_frames G hp phi rT sig frs --> |
|
278 |
hp a = Some (C,fs) --> |
|
279 |
map_of (fields (G, C)) fl = Some fd --> |
|
10042 | 280 |
G,hp\<turnstile>v::\<preceq>fd |
11252 | 281 |
--> correct_frames G (hp(a \<mapsto> (C, fs(fl\<mapsto>v)))) phi rT sig frs"; |
9757
1024a2d80ac0
functional LBV style, dead code, type safety -> Isar
kleing
parents:
9549
diff
changeset
|
282 |
apply (induct frs) |
1024a2d80ac0
functional LBV style, dead code, type safety -> Isar
kleing
parents:
9549
diff
changeset
|
283 |
apply simp |
10920 | 284 |
apply clarify |
11252 | 285 |
apply (simp (no_asm_use)) |
10920 | 286 |
apply clarify |
287 |
apply (unfold correct_frame_def) |
|
288 |
apply (simp (no_asm_use)) |
|
11252 | 289 |
apply clarify |
9757
1024a2d80ac0
functional LBV style, dead code, type safety -> Isar
kleing
parents:
9549
diff
changeset
|
290 |
apply (intro exI conjI) |
11252 | 291 |
apply assumption+ |
292 |
apply (erule approx_stk_sup_heap) |
|
293 |
apply (erule hext_upd_obj) |
|
294 |
apply (erule approx_loc_sup_heap) |
|
295 |
apply (erule hext_upd_obj) |
|
296 |
apply assumption+ |
|
297 |
apply blast |
|
10056 | 298 |
done |
9757
1024a2d80ac0
functional LBV style, dead code, type safety -> Isar
kleing
parents:
9549
diff
changeset
|
299 |
|
11252 | 300 |
lemma correct_frames_newref [rule_format]: |
301 |
"\<forall>rT C sig. |
|
302 |
hp x = None \<longrightarrow> |
|
303 |
correct_frames G hp phi rT sig frs \<longrightarrow> |
|
304 |
G,hp \<turnstile> obj \<surd> |
|
305 |
\<longrightarrow> correct_frames G (hp(x \<mapsto> obj)) phi rT sig frs" |
|
9757
1024a2d80ac0
functional LBV style, dead code, type safety -> Isar
kleing
parents:
9549
diff
changeset
|
306 |
apply (induct frs) |
1024a2d80ac0
functional LBV style, dead code, type safety -> Isar
kleing
parents:
9549
diff
changeset
|
307 |
apply simp |
11252 | 308 |
apply clarify |
309 |
apply (simp (no_asm_use)) |
|
310 |
apply clarify |
|
311 |
apply (unfold correct_frame_def) |
|
312 |
apply (simp (no_asm_use)) |
|
313 |
apply clarify |
|
9757
1024a2d80ac0
functional LBV style, dead code, type safety -> Isar
kleing
parents:
9549
diff
changeset
|
314 |
apply (intro exI conjI) |
11252 | 315 |
apply assumption+ |
316 |
apply (erule approx_stk_sup_heap) |
|
317 |
apply (erule hext_new) |
|
318 |
apply (erule approx_loc_sup_heap) |
|
319 |
apply (erule hext_new) |
|
320 |
apply assumption+ |
|
321 |
apply blast |
|
10056 | 322 |
done |
8011 | 323 |
|
324 |
end |