author | wenzelm |
Fri, 01 Dec 2000 19:43:06 +0100 | |
changeset 10569 | e8346dad78e1 |
parent 10199 | 7b6f9d34f737 |
child 10797 | 028d22926a41 |
permissions | -rw-r--r-- |
9791 | 1 |
(* Title: HOL/BCV/JVM.thy |
2 |
ID: $Id$ |
|
3 |
Author: Tobias Nipkow |
|
4 |
Copyright 2000 TUM |
|
5 |
*) |
|
6 |
||
7 |
Addsimps [Let_def]; |
|
8 |
||
9 |
Addsimps [is_type_def]; |
|
10 |
||
11 |
Goalw [states_def,JVM.sl_def,Opt.sl_def,Err.sl_def, |
|
12 |
stk_esl_def,reg_sl_def,Product.esl_def, |
|
13 |
Listn.sl_def,upto_esl_def,JType.esl_def,Err.esl_def] |
|
14 |
"states S maxs maxr == opt(err((Union {list n (types S) |n. n <= maxs}) <*>\ |
|
15 |
\ list maxr (err(types S))))"; |
|
10172 | 16 |
by (Simp_tac 1); |
9791 | 17 |
qed "JVM_states_unfold"; |
18 |
||
19 |
Goalw [JVM.le_def,JVM.sl_def,Opt.sl_def,Err.sl_def, |
|
20 |
stk_esl_def,reg_sl_def,Product.esl_def, |
|
21 |
Listn.sl_def,upto_esl_def,JType.esl_def,Err.esl_def] |
|
22 |
"JVM.le S m n == \ |
|
23 |
\ Opt.le(Err.le(Product.le(Listn.le(subtype S))(Listn.le(Err.le(subtype S)))))"; |
|
10172 | 24 |
by (Simp_tac 1); |
9791 | 25 |
qed "JVM_le_unfold"; |
26 |
||
27 |
Goalw [wfis_def,wfi_def] |
|
28 |
"[| wfis S md maxr bs; bs!p = Load n; p < size bs |] ==> n < maxr"; |
|
10172 | 29 |
by (auto_tac (claset(),simpset()addsimps [all_set_conv_all_nth])); |
9791 | 30 |
qed "wf_LoadD"; |
31 |
||
32 |
Goalw [wfis_def,wfi_def] |
|
33 |
"[| wfis S md maxr bs; bs!p = Store n; p < size bs |] ==> n < maxr"; |
|
10172 | 34 |
by (auto_tac (claset(),simpset()addsimps [all_set_conv_all_nth])); |
9791 | 35 |
qed "wf_StoreD"; |
36 |
||
37 |
Goalw [wfis_def,wfi_def] |
|
38 |
"[| wfis S md m bs; bs!p = New C; p < size bs |] ==> (C,Object):S^*"; |
|
10172 | 39 |
by (auto_tac (claset(),simpset()addsimps [all_set_conv_all_nth])); |
9791 | 40 |
qed "wf_NewD"; |
41 |
||
42 |
Goalw [wfis_def,wfi_def,wf_mdict_def] |
|
43 |
"[| wfis S md maxr bs; wf_mdict S md; bs!p = Invoke C m pT (Class R); \ |
|
44 |
\ p < size bs |] ==> (R,Object):S^*"; |
|
10172 | 45 |
by (force_tac (claset(),simpset()addsimps [all_set_conv_all_nth]) 1); |
9791 | 46 |
qed "wf_InvokeD"; |
47 |
||
48 |
Goalw [wfis_def,wfi_def] |
|
49 |
"[|wfis S md m bs; bs!p = Getfield (Class C) D; p < size bs|] ==> \ |
|
50 |
\ (C,Object):S^*"; |
|
10172 | 51 |
by (auto_tac (claset(),simpset()addsimps [all_set_conv_all_nth])); |
9791 | 52 |
qed "wf_GetfieldD"; |
53 |
||
54 |
Goal "(? X. (? n. X = A n & P n) & Q X) = (? n. Q(A n) & P n)"; |
|
10172 | 55 |
by (Blast_tac 1); |
9791 | 56 |
qed "special_ex_swap_lemma"; |
57 |
AddIffs [special_ex_swap_lemma]; |
|
58 |
||
59 |
Goalw [pres_type_def,list_def,step_def,JVM_states_unfold] |
|
60 |
"[| wfis S md maxr bs; wf_mdict S md |] ==> \ |
|
61 |
\ pres_type (step S maxs rT bs) (size bs) (states S maxs maxr)"; |
|
10172 | 62 |
by (clarify_tac (claset() addSEs [option_map_in_optionI,lift_in_errI]) 1); |
63 |
by (asm_simp_tac (simpset()addsimps [exec_def] addsplits [instr.split]) 1); |
|
9791 | 64 |
|
10172 | 65 |
by (rtac conjI 1); |
66 |
by (fast_tac (claset() addDs [refl RS nth_in] addSEs [wf_LoadD] addss |
|
9791 | 67 |
(simpset() delsimps [is_type_def]addsplits [err.split])) 1); |
68 |
||
10172 | 69 |
by (rtac conjI 1); |
9791 | 70 |
by (fast_tac (claset() addDs [set_update_subset_insert RS subsetD] |
71 |
addSEs [wf_StoreD] addss (simpset() addsplits [list.split])) 1); |
|
72 |
||
10172 | 73 |
by (rtac conjI 1); |
9791 | 74 |
by (fast_tac (claset() addss (simpset() addsplits [list.split])) 1); |
75 |
||
10172 | 76 |
by (rtac conjI 1); |
9791 | 77 |
by (fast_tac (claset() addIs [wf_GetfieldD] |
78 |
addss (simpset() addsplits [list.split,ty.split])) 1); |
|
79 |
||
10172 | 80 |
by (rtac conjI 1); |
9791 | 81 |
by (fast_tac (claset() addss (simpset() addsplits [list.split])) 1); |
82 |
||
10172 | 83 |
by (rtac conjI 1); |
9791 | 84 |
by (fast_tac (claset() addIs [wf_NewD] addss simpset()) 1); |
85 |
||
10172 | 86 |
by (rtac conjI 1); |
87 |
by (DEPTH_SOLVE_1(rtac conjI 1 ORELSE |
|
9791 | 88 |
Clarify_tac 1 THEN asm_full_simp_tac (simpset() addsimps [wf_InvokeD] |
89 |
addsplits [list.split,ty.split,option.split]) 1)); |
|
90 |
||
91 |
by (fast_tac (claset() addss (simpset() addsplits [list.split])) 1); |
|
92 |
||
93 |
qed "exec_pres_type"; |
|
94 |
||
95 |
Goalw [wti_is_stable_topless_def,wti_def,stable_def,step_def, |
|
96 |
option_map_def,lift_def,bounded_def,JVM_le_unfold] |
|
97 |
"[| bounded (succs bs) (size bs) |] ==> \ |
|
98 |
\ wti_is_stable_topless (JVM.le S maxs maxr) \ |
|
99 |
\ (Some Err) \ |
|
100 |
\ (step S maxs rT bs) \ |
|
101 |
\ (wti S maxs rT bs) \ |
|
102 |
\ (succs bs) (size bs) (states S maxs maxr)"; |
|
10172 | 103 |
by (simp_tac (simpset() addsplits [option.split]) 1); |
104 |
by (simp_tac (simpset() addsplits [err.split]) 1); |
|
105 |
by (Clarify_tac 1); |
|
106 |
by (rtac conjI 1); |
|
107 |
by (Blast_tac 1); |
|
108 |
by (Clarify_tac 1); |
|
109 |
by (EVERY1[etac allE, mp_tac]); |
|
110 |
by (rewrite_goals_tac [exec_def,succs_def]); |
|
111 |
by (split_tac [instr.split] 1); |
|
9791 | 112 |
|
10172 | 113 |
by (rtac conjI 1); |
114 |
by (Clarify_tac 1); |
|
115 |
by (asm_full_simp_tac (simpset() addsplits [option.split,list.split,err.split]) 1); |
|
9791 | 116 |
|
10172 | 117 |
by (rtac conjI 1); |
118 |
by (Clarify_tac 1); |
|
119 |
by (asm_full_simp_tac (simpset() addsplits [option.split,list.split]) 1); |
|
9791 | 120 |
|
10172 | 121 |
by (rtac conjI 1); |
122 |
by (Clarify_tac 1); |
|
123 |
by (asm_full_simp_tac (simpset() addsplits [option.split,list.split]) 1); |
|
9791 | 124 |
|
10172 | 125 |
by (rtac conjI 1); |
126 |
by (Clarify_tac 1); |
|
127 |
by (asm_full_simp_tac (simpset() addsplits [option.split,list.split]) 1); |
|
9791 | 128 |
|
10172 | 129 |
by (rtac conjI 1); |
130 |
by (Clarify_tac 1); |
|
131 |
by (asm_full_simp_tac (simpset() addsplits [option.split,list.split]) 1); |
|
132 |
by (Blast_tac 1); |
|
9791 | 133 |
|
10172 | 134 |
by (rtac conjI 1); |
135 |
by (Clarify_tac 1); |
|
136 |
by (asm_full_simp_tac (simpset() addsplits [option.split,list.split]) 1); |
|
9791 | 137 |
|
10172 | 138 |
by (rtac conjI 1); |
139 |
by (Clarify_tac 1); |
|
140 |
by (asm_full_simp_tac (simpset() addsplits [option.split,list.split]) 1); |
|
9791 | 141 |
|
10172 | 142 |
by (rtac conjI 1); |
143 |
by (Clarify_tac 1); |
|
144 |
by (asm_full_simp_tac (simpset() addsplits [option.split,list.split]) 1); |
|
9791 | 145 |
|
10172 | 146 |
by (rtac conjI 1); |
147 |
by (Clarify_tac 1); |
|
148 |
by (asm_full_simp_tac (simpset() addsplits [option.split,list.split,ty.split]) 1); |
|
9791 | 149 |
|
10172 | 150 |
by (rtac conjI 1); |
151 |
by (Clarify_tac 1); |
|
152 |
by (asm_full_simp_tac (simpset() addsplits [option.split,list.split]) 1); |
|
153 |
by (Blast_tac 1); |
|
9791 | 154 |
|
10172 | 155 |
by (Clarify_tac 1); |
156 |
by (asm_full_simp_tac (simpset() addsplits [option.split,list.split] |
|
9791 | 157 |
addsimps [le_list_refl,le_err_refl] ) 1); |
158 |
qed "wti_is_stable_topless"; |
|
159 |
||
160 |
Goalw [mono_def,step_def,option_map_def,lift_def, |
|
161 |
JVM_states_unfold,JVM_le_unfold] |
|
162 |
"[| wfis S md maxr bs; wf_mdict S md |] ==> \ |
|
163 |
\ mono (JVM.le S maxs maxr) (step S maxs rT bs) (size bs) (states S maxs maxr)"; |
|
164 |
by (Clarify_tac 1); |
|
10172 | 165 |
by (simp_tac (simpset() addsplits [option.split]) 1); |
9791 | 166 |
by (Clarify_tac 1); |
10172 | 167 |
by (Asm_simp_tac 1); |
168 |
by (split_tac [err.split] 1); |
|
169 |
by (rtac conjI 1); |
|
9791 | 170 |
by (Clarify_tac 1); |
171 |
by (Clarify_tac 1); |
|
10172 | 172 |
by (simp_tac (simpset() addsimps [exec_def] delsplits [split_if]) 1); |
173 |
by (split_tac [instr.split] 1); |
|
9791 | 174 |
|
10172 | 175 |
by (rtac conjI 1); |
9791 | 176 |
by (fast_tac (claset() addDs [le_listD] addSEs [wf_LoadD] |
177 |
addss (simpset() addsplits [err.split])) 1); |
|
178 |
||
10172 | 179 |
by (rtac conjI 1); |
9791 | 180 |
by (fast_tac (claset() addIs [list_update_le_cong,le_listD] addSEs [wf_StoreD] |
181 |
addss (simpset() addsplits [list.split])) 1); |
|
182 |
||
10172 | 183 |
by (rtac conjI 1); |
184 |
by (Asm_simp_tac 1); |
|
9791 | 185 |
|
10172 | 186 |
by (rtac conjI 1); |
187 |
by (Asm_simp_tac 1); |
|
9791 | 188 |
|
10172 | 189 |
by (rtac conjI 1); |
10199
7b6f9d34f737
delrules [r_into_rtrancl] required because the new I-rule made a step slow.
paulson
parents:
10172
diff
changeset
|
190 |
by (force_tac (claset(), simpset() addsplits [list.split]) 1); |
9791 | 191 |
|
10172 | 192 |
by (rtac conjI 1); |
10199
7b6f9d34f737
delrules [r_into_rtrancl] required because the new I-rule made a step slow.
paulson
parents:
10172
diff
changeset
|
193 |
by (fast_tac (claset() delrules [r_into_rtrancl] |
7b6f9d34f737
delrules [r_into_rtrancl] required because the new I-rule made a step slow.
paulson
parents:
10172
diff
changeset
|
194 |
addDs [rtrancl_trans] |
9791 | 195 |
addss (simpset() addsplits [list.split])) 1); |
196 |
||
10172 | 197 |
by (rtac conjI 1); |
9791 | 198 |
by (Clarify_tac 1); |
10172 | 199 |
by (asm_full_simp_tac (simpset() addsplits [list.split]) 1); |
200 |
by (rtac conjI 1); |
|
9791 | 201 |
by (Clarify_tac 1); |
202 |
by (Clarify_tac 1); |
|
10172 | 203 |
by (rtac conjI 1); |
9791 | 204 |
by (Clarify_tac 1); |
205 |
by (Clarify_tac 1); |
|
10172 | 206 |
by (rtac conjI 1); |
9791 | 207 |
by (Clarify_tac 1); |
208 |
by (Clarify_tac 1); |
|
10172 | 209 |
by (Asm_full_simp_tac 1); |
9791 | 210 |
by (blast_tac (claset() addIs [rtrancl_trans,subtype_transD]) 1); |
211 |
||
10172 | 212 |
by (rtac conjI 1); |
213 |
by (asm_full_simp_tac (simpset() addsimps [reflD] addsplits [list.split]) 1); |
|
9791 | 214 |
|
10172 | 215 |
by (rtac conjI 1); |
9791 | 216 |
(* 39 *) |
217 |
by (Clarify_tac 1); |
|
10172 | 218 |
by (asm_full_simp_tac (simpset() addsplits [list.split]) 1); |
9791 | 219 |
by (blast_tac (claset() addIs [rtrancl_trans,subtype_transD]) 1); |
220 |
||
10172 | 221 |
by (rtac conjI 1); |
222 |
by (fast_tac (claset() addss (simpset() addsplits [list.split,ty.split_asm] |
|
9791 | 223 |
addsimps [is_Class_def,is_ref_def])) 1); |
224 |
||
10172 | 225 |
by (asm_simp_tac (simpset() addsplits [list.split]) 1); |
226 |
by (blast_tac (claset() addIs [subtype_transD]) 1); |
|
9791 | 227 |
|
228 |
qed "exec_mono"; |
|
229 |
||
230 |
||
231 |
Goalw [JVM.sl_def,stk_esl_def,reg_sl_def] |
|
232 |
"[| univalent S; acyclic S |] ==> semilat(JVM.sl S maxs maxr)"; |
|
10172 | 233 |
by (REPEAT(ares_tac [semilat_opt,err_semilat_Product_esl,err_semilat_upto_esl, |
9791 | 234 |
err_semilat_eslI,semilat_Listn_sl,err_semilat_JType_esl] 1)); |
235 |
qed "semilat_JVM_slI"; |
|
236 |
||
237 |
Goal "JVM.sl S maxs maxr == \ |
|
238 |
\ (states S maxs maxr, JVM.le S maxs maxr, JVM.sup S maxs maxr)"; |
|
10172 | 239 |
by (simp_tac (simpset() addsimps [states_def,JVM.le_def,JVM.sup_def, |
9791 | 240 |
surjective_pairing RS sym]) 1); |
241 |
qed "sl_triple_conv"; |
|
242 |
||
243 |
Goalw [kiljvm_def,sl_triple_conv] |
|
244 |
"[| univalent S; wf(S^-1); wfis S md maxr bs; wf_mdict S md; \ |
|
245 |
\ bounded (succs bs) (size bs) |] ==> \ |
|
246 |
\ is_bcv (JVM.le S maxs maxr) (Some Err) (wti S maxs rT bs) \ |
|
247 |
\ (size bs) (states S maxs maxr) (kiljvm S maxs maxr rT bs)"; |
|
10172 | 248 |
by (rtac is_bcv_kildall 1); |
249 |
by (simp_tac (simpset() addsimps [symmetric sl_triple_conv]) 1); |
|
250 |
by (blast_tac (claset() addSIs [semilat_JVM_slI] addDs [wf_acyclic]) 1); |
|
251 |
by (simp_tac (simpset() addsimps [JVM_le_unfold]) 1); |
|
252 |
by (blast_tac (claset() |
|
9791 | 253 |
addSIs [acyclic_impl_order_subtype,wf_converse_subcls1_impl_acc_subtype] |
254 |
addDs [wf_acyclic]) 1); |
|
10172 | 255 |
by (simp_tac (simpset() addsimps [JVM_le_unfold]) 1); |
256 |
by (etac exec_pres_type 1); |
|
257 |
by (assume_tac 1); |
|
258 |
by (assume_tac 1); |
|
259 |
by (etac exec_mono 1); |
|
260 |
by (assume_tac 1); |
|
261 |
by (etac wti_is_stable_topless 1); |
|
9791 | 262 |
qed "is_bcv_kiljvm"; |