equal
deleted
inserted
replaced
74 |
74 |
75 syntax (HTML) |
75 syntax (HTML) |
76 correct_state :: "[jvm_prog,prog_type,jvm_state] => bool" |
76 correct_state :: "[jvm_prog,prog_type,jvm_state] => bool" |
77 ("_,_ |-JVM _ [ok]" [51,51] 50) |
77 ("_,_ |-JVM _ [ok]" [51,51] 50) |
78 |
78 |
79 lemma sup_heap_newref: |
79 section {* approx-val *} |
80 "hp oref = None ==> hp \<le>| hp(oref \<mapsto> obj)" |
|
81 proof (unfold hext_def, intro strip) |
|
82 fix a C fs |
|
83 assume "hp oref = None" and hp: "hp a = Some (C, fs)" |
|
84 hence "a \<noteq> oref" by auto |
|
85 hence "(hp (oref\<mapsto>obj)) a = hp a" by (rule fun_upd_other) |
|
86 with hp |
|
87 show "\<exists>fs'. (hp(oref\<mapsto>obj)) a = Some (C, fs')" by auto |
|
88 qed |
|
89 |
|
90 lemma sup_heap_update_value: |
|
91 "hp a = Some (C,od') ==> hp \<le>| hp (a \<mapsto> (C,od))" |
|
92 by (simp add: hext_def) |
|
93 |
|
94 |
|
95 (** approx_val **) |
|
96 |
80 |
97 lemma approx_val_Err: |
81 lemma approx_val_Err: |
98 "approx_val G hp x Err" |
82 "approx_val G hp x Err" |
99 by (simp add: approx_val_def) |
83 by (simp add: approx_val_def) |
100 |
84 |
134 apply (auto intro: approx_val_imp_approx_val_sup |
118 apply (auto intro: approx_val_imp_approx_val_sup |
135 simp add: split_def all_set_conv_all_nth) |
119 simp add: split_def all_set_conv_all_nth) |
136 done |
120 done |
137 |
121 |
138 |
122 |
139 (** approx_loc **) |
123 section {* approx-loc *} |
140 |
124 |
141 lemma approx_loc_Cons [iff]: |
125 lemma approx_loc_Cons [iff]: |
142 "approx_loc G hp (s#xs) (l#ls) = |
126 "approx_loc G hp (s#xs) (l#ls) = |
143 (approx_val G hp s l \<and> approx_loc G hp xs ls)" |
127 (approx_val G hp s l \<and> approx_loc G hp xs ls)" |
144 by (simp add: approx_loc_def) |
128 by (simp add: approx_loc_def) |
194 done |
178 done |
195 |
179 |
196 lemmas [cong del] = conj_cong |
180 lemmas [cong del] = conj_cong |
197 |
181 |
198 |
182 |
199 (** approx_stk **) |
183 section {* approx-stk *} |
200 |
184 |
201 lemma approx_stk_rev_lem: |
185 lemma approx_stk_rev_lem: |
202 "approx_stk G hp (rev s) (rev t) = approx_stk G hp s t" |
186 "approx_stk G hp (rev s) (rev t) = approx_stk G hp s t" |
203 apply (unfold approx_stk_def approx_loc_def list_all2_def) |
187 apply (unfold approx_stk_def approx_loc_def list_all2_def) |
204 apply (auto simp add: zip_rev sym [OF rev_map]) |
188 apply (auto simp add: zip_rev sym [OF rev_map]) |
238 (\<exists>s stk'. stk = s@stk' \<and> length s = length S \<and> length stk' = length ST' \<and> |
222 (\<exists>s stk'. stk = s@stk' \<and> length s = length S \<and> length stk' = length ST' \<and> |
239 approx_stk G hp s S \<and> approx_stk G hp stk' ST')" |
223 approx_stk G hp s S \<and> approx_stk G hp stk' ST')" |
240 by (simp add: list_all2_append2 approx_stk_def approx_loc_def) |
224 by (simp add: list_all2_append2 approx_stk_def approx_loc_def) |
241 |
225 |
242 |
226 |
243 (** oconf **) |
227 section {* oconf *} |
244 |
228 |
245 lemma correct_init_obj: |
229 lemma correct_init_obj: |
246 "[|is_class G C; wf_prog wt G|] ==> |
230 "[|is_class G C; wf_prog wt G|] ==> |
247 G,h \<turnstile> (C, map_of (map (\<lambda>(f,fT).(f,default_val fT)) (fields(G,C)))) \<surd>" |
231 G,h \<turnstile> (C, map_of (map (\<lambda>(f,fT).(f,default_val fT)) (fields(G,C)))) \<surd>" |
248 apply (unfold oconf_def lconf_def) |
232 apply (unfold oconf_def lconf_def) |
258 |
242 |
259 lemma oconf_imp_oconf_heap_newref [rule_format]: |
243 lemma oconf_imp_oconf_heap_newref [rule_format]: |
260 "hp oref = None --> G,hp\<turnstile>obj\<surd> --> G,hp\<turnstile>obj'\<surd> --> G,(hp(oref\<mapsto>obj'))\<turnstile>obj\<surd>" |
244 "hp oref = None --> G,hp\<turnstile>obj\<surd> --> G,hp\<turnstile>obj'\<surd> --> G,(hp(oref\<mapsto>obj'))\<turnstile>obj\<surd>" |
261 apply (unfold oconf_def lconf_def) |
245 apply (unfold oconf_def lconf_def) |
262 apply simp |
246 apply simp |
263 apply (fast intro: conf_hext sup_heap_newref) |
247 apply (fast intro: conf_hext hext_new) |
264 done |
248 done |
265 |
249 |
266 lemma oconf_imp_oconf_heap_update [rule_format]: |
250 lemma oconf_imp_oconf_heap_update [rule_format]: |
267 "hp a = Some obj' --> obj_ty obj' = obj_ty obj'' --> G,hp\<turnstile>obj\<surd> |
251 "hp a = Some obj' --> obj_ty obj' = obj_ty obj'' --> G,hp\<turnstile>obj\<surd> |
268 --> G,hp(a\<mapsto>obj'')\<turnstile>obj\<surd>" |
252 --> G,hp(a\<mapsto>obj'')\<turnstile>obj\<surd>" |
270 apply simp |
254 apply simp |
271 apply (force intro: approx_val_imp_approx_val_heap_update) |
255 apply (force intro: approx_val_imp_approx_val_heap_update) |
272 done |
256 done |
273 |
257 |
274 |
258 |
275 (** hconf **) |
259 section {* hconf *} |
276 |
260 |
277 lemma hconf_imp_hconf_newref [rule_format]: |
261 lemma hconf_imp_hconf_newref [rule_format]: |
278 "hp oref = None --> G\<turnstile>h hp\<surd> --> G,hp\<turnstile>obj\<surd> --> G\<turnstile>h hp(oref\<mapsto>obj)\<surd>" |
262 "hp oref = None --> G\<turnstile>h hp\<surd> --> G,hp\<turnstile>obj\<surd> --> G\<turnstile>h hp(oref\<mapsto>obj)\<surd>" |
279 apply (simp add: hconf_def) |
263 apply (simp add: hconf_def) |
280 apply (fast intro: oconf_imp_oconf_heap_newref) |
264 apply (fast intro: oconf_imp_oconf_heap_newref) |
286 apply (simp add: hconf_def) |
270 apply (simp add: hconf_def) |
287 apply (force intro: oconf_imp_oconf_heap_update oconf_imp_oconf_field_update |
271 apply (force intro: oconf_imp_oconf_heap_update oconf_imp_oconf_field_update |
288 simp add: obj_ty_def) |
272 simp add: obj_ty_def) |
289 done |
273 done |
290 |
274 |
291 (** correct_frames **) |
275 section {* correct-frames *} |
292 |
276 |
293 lemmas [simp del] = fun_upd_apply |
277 lemmas [simp del] = fun_upd_apply |
294 |
278 |
295 lemma correct_frames_imp_correct_frames_field_update [rule_format]: |
279 lemma correct_frames_imp_correct_frames_field_update [rule_format]: |
296 "\<forall>rT C sig. correct_frames G hp phi rT sig frs --> |
280 "\<forall>rT C sig. correct_frames G hp phi rT sig frs --> |
310 apply simp |
294 apply simp |
311 apply force |
295 apply force |
312 apply simp |
296 apply simp |
313 apply (rule approx_stk_imp_approx_stk_sup_heap) |
297 apply (rule approx_stk_imp_approx_stk_sup_heap) |
314 apply simp |
298 apply simp |
315 apply (rule sup_heap_update_value) |
299 apply (rule hext_upd_obj) |
316 apply simp |
300 apply simp |
317 apply (rule approx_loc_imp_approx_loc_sup_heap) |
301 apply (rule approx_loc_imp_approx_loc_sup_heap) |
318 apply simp |
302 apply simp |
319 apply (rule sup_heap_update_value) |
303 apply (rule hext_upd_obj) |
320 apply simp |
304 apply simp |
321 done |
305 done |
322 |
306 |
323 lemma correct_frames_imp_correct_frames_newref [rule_format]: |
307 lemma correct_frames_imp_correct_frames_newref [rule_format]: |
324 "\<forall>rT C sig. hp x = None --> correct_frames G hp phi rT sig frs \<and> oconf G hp obj |
308 "\<forall>rT C sig. hp x = None --> correct_frames G hp phi rT sig frs \<and> oconf G hp obj |
331 apply simp |
315 apply simp |
332 apply force |
316 apply force |
333 apply simp |
317 apply simp |
334 apply (rule approx_stk_imp_approx_stk_sup_heap) |
318 apply (rule approx_stk_imp_approx_stk_sup_heap) |
335 apply simp |
319 apply simp |
336 apply (rule sup_heap_newref) |
320 apply (rule hext_new) |
337 apply simp |
321 apply simp |
338 apply (rule approx_loc_imp_approx_loc_sup_heap) |
322 apply (rule approx_loc_imp_approx_loc_sup_heap) |
339 apply simp |
323 apply simp |
340 apply (rule sup_heap_newref) |
324 apply (rule hext_new) |
341 apply simp |
325 apply simp |
342 done |
326 done |
343 |
327 |
344 end |
328 end |
345 |
329 |