13673
|
1 |
(* Title: HOL/MicroJava/Comp/LemmasComp.thy
|
|
2 |
ID: $Id$
|
|
3 |
Author: Martin Strecker
|
|
4 |
Copyright GPL 2002
|
|
5 |
*)
|
|
6 |
|
|
7 |
(* Lemmas for compiler correctness proof *)
|
|
8 |
|
|
9 |
theory LemmasComp = TranslComp:
|
|
10 |
|
|
11 |
(**********************************************************************)
|
|
12 |
(* misc lemmas *)
|
|
13 |
|
|
14 |
lemma split_pairs: "(\<lambda>(a,b). (F a b)) (ab) = F (fst ab) (snd ab)"
|
|
15 |
proof -
|
|
16 |
have "(\<lambda>(a,b). (F a b)) (fst ab,snd ab) = F (fst ab) (snd ab)"
|
|
17 |
by (simp add: split_def)
|
|
18 |
then show ?thesis by simp
|
|
19 |
qed
|
|
20 |
|
|
21 |
|
|
22 |
lemma c_hupd_conv:
|
|
23 |
"c_hupd h' (xo, (h,l)) = (xo, (if xo = None then h' else h),l)"
|
|
24 |
by (simp add: c_hupd_def)
|
|
25 |
|
|
26 |
lemma gl_c_hupd [simp]: "(gl (c_hupd h xs)) = (gl xs)"
|
|
27 |
by (simp add: gl_def c_hupd_def split_pairs)
|
|
28 |
|
|
29 |
lemma c_hupd_xcpt_invariant [simp]: "gx (c_hupd h' (xo, st)) = xo"
|
|
30 |
by (case_tac st, simp only: c_hupd_conv gx_conv)
|
|
31 |
|
|
32 |
(* not added to simpset because of interference with c_hupd_conv *)
|
|
33 |
lemma c_hupd_hp_invariant: "gh (c_hupd hp (None, st)) = hp"
|
|
34 |
by (case_tac st, simp add: c_hupd_conv gh_def)
|
|
35 |
|
|
36 |
|
|
37 |
(**********************************************************************)
|
|
38 |
(* invariance of properties under compilation *)
|
|
39 |
|
|
40 |
lemma comp_class_imp:
|
|
41 |
"(class G C = Some(D, fs, ms)) \<Longrightarrow>
|
|
42 |
(class (comp G) C = Some(D, fs, map (compMethod G C) ms))"
|
|
43 |
apply (simp add: class_def comp_def compClass_def)
|
|
44 |
apply (rule HOL.trans)
|
|
45 |
apply (rule map_of_map2)
|
|
46 |
apply auto
|
|
47 |
done
|
|
48 |
|
|
49 |
lemma comp_class_None:
|
|
50 |
"(class G C = None) = (class (comp G) C = None)"
|
|
51 |
apply (simp add: class_def comp_def compClass_def)
|
|
52 |
apply (simp add: map_of_in_set)
|
|
53 |
apply (simp add: image_compose [THEN sym] o_def split_beta del: image_compose)
|
|
54 |
done
|
|
55 |
|
|
56 |
lemma comp_is_class: "is_class G C = is_class (comp G) C"
|
|
57 |
by (case_tac "class G C", auto simp: is_class_def comp_class_None dest: comp_class_imp)
|
|
58 |
|
|
59 |
|
|
60 |
lemma comp_is_type: "is_type G T = is_type (comp G) T"
|
|
61 |
by ((cases T),simp,(induct G)) ((simp),(simp only: comp_is_class),(simp add: comp_is_class),(simp only: comp_is_class))
|
|
62 |
|
|
63 |
lemma SIGMA_cong: "\<lbrakk> A = B; !!x. x \<in> B \<Longrightarrow> C x = D x \<rbrakk> \<Longrightarrow> (\<Sigma> x \<in> A. C x) = (\<Sigma> x \<in> B. D x)"
|
|
64 |
by auto
|
|
65 |
|
|
66 |
lemma comp_classname: "is_class G C \<Longrightarrow> fst (the (class G C)) = fst (the (class (comp G) C))"
|
|
67 |
by (case_tac "class G C", auto simp: is_class_def dest: comp_class_imp)
|
|
68 |
|
|
69 |
|
|
70 |
lemma comp_subcls1: "subcls1 G = subcls1 (comp G)"
|
|
71 |
apply (simp add: subcls1_def2 comp_is_class)
|
|
72 |
apply (rule SIGMA_cong, simp)
|
|
73 |
apply (simp add: comp_is_class [THEN sym])
|
|
74 |
apply (simp add: comp_classname)
|
|
75 |
done
|
|
76 |
|
|
77 |
lemma comp_subcls: "(subcls1 G)^* = (subcls1 (comp G))^*"
|
|
78 |
by (induct G) (simp_all add: comp_def comp_subcls1)
|
|
79 |
|
|
80 |
lemma comp_widen: "((ty1,ty2) \<in> widen G) = ((ty1,ty2) \<in> widen (comp G))"
|
|
81 |
apply rule
|
|
82 |
apply (cases "(ty1,ty2)" G rule: widen.cases)
|
|
83 |
apply (simp_all add: comp_subcls widen.null)
|
|
84 |
apply (cases "(ty1,ty2)" "comp G" rule: widen.cases)
|
|
85 |
apply (simp_all add: comp_subcls widen.null)
|
|
86 |
done
|
|
87 |
|
|
88 |
lemma comp_cast: "((ty1,ty2) \<in> cast G) = ((ty1,ty2) \<in> cast (comp G))"
|
|
89 |
apply rule
|
|
90 |
apply (cases "(ty1,ty2)" G rule: cast.cases)
|
|
91 |
apply (simp_all add: comp_subcls cast.widen cast.subcls)
|
|
92 |
apply (cases "(ty1,ty2)" "comp G" rule: cast.cases)
|
|
93 |
apply (simp_all add: comp_subcls cast.widen cast.subcls)
|
|
94 |
done
|
|
95 |
|
|
96 |
lemma comp_cast_ok: "cast_ok G = cast_ok (comp G)"
|
|
97 |
by (simp add: expand_fun_eq cast_ok_def comp_widen)
|
|
98 |
|
|
99 |
|
|
100 |
lemma comp_wf_fdecl: "wf_fdecl G fd \<Longrightarrow> wf_fdecl (comp G) fd"
|
|
101 |
apply (case_tac fd)
|
|
102 |
apply (simp add: wf_fdecl_def comp_is_type)
|
|
103 |
done
|
|
104 |
|
|
105 |
lemma comp_wf_syscls: "wf_syscls G = wf_syscls (comp G)"
|
|
106 |
apply (simp add: wf_syscls_def comp_def compClass_def split_beta)
|
|
107 |
apply (simp only: image_compose [THEN sym])
|
|
108 |
apply (subgoal_tac "(Fun.comp fst (\<lambda>(C, cno::cname, fdls::fdecl list, jmdls). (C, cno, fdls, map (compMethod G C) jmdls))) = fst")
|
|
109 |
(*
|
|
110 |
apply (subgoal_tac "(fst o (\<lambda>(C, cno::cname, fdls::fdecl list, jmdls). (C, cno, fdls, map (compMethod G C) jmdls))) = fst")
|
|
111 |
*)
|
|
112 |
apply (simp del: image_compose)
|
|
113 |
apply (simp add: expand_fun_eq split_beta)
|
|
114 |
done
|
|
115 |
|
|
116 |
|
|
117 |
lemma comp_wf_mhead: "wf_mhead G S rT = wf_mhead (comp G) S rT"
|
|
118 |
by (simp add: wf_mhead_def split_beta comp_is_type)
|
|
119 |
|
|
120 |
lemma comp_wf_mdecl: "\<lbrakk> wf_mdecl wf_mb G C jmdl;
|
|
121 |
(wf_mb G C jmdl) \<longrightarrow> (wf_mb_comp (comp G) C (compMethod G C jmdl)) \<rbrakk>
|
|
122 |
\<Longrightarrow>
|
|
123 |
wf_mdecl wf_mb_comp (comp G) C (compMethod G C jmdl)"
|
|
124 |
by (simp add: wf_mdecl_def wf_mhead_def comp_is_type split_beta compMethod_def)
|
|
125 |
|
|
126 |
|
|
127 |
lemma comp_class_rec: " wf ((subcls1 G)^-1) \<Longrightarrow>
|
|
128 |
class_rec (comp G) C t f =
|
|
129 |
class_rec G C t (\<lambda> C' fs' ms' r'. f C' fs' (map (compMethod G C') ms') r')"
|
|
130 |
apply (rule_tac a = C in wf_induct) apply assumption
|
|
131 |
apply (subgoal_tac "wf ((subcls1 (comp G))\<inverse>)")
|
|
132 |
apply (subgoal_tac "(class G x = None) \<or> (\<exists> D fs ms. (class G x = Some (D, fs, ms)))")
|
|
133 |
apply (erule disjE)
|
|
134 |
|
|
135 |
(* case class G x = None *)
|
|
136 |
apply (simp (no_asm_simp) add: class_rec_def comp_subcls1 wfrec cut_apply)
|
|
137 |
apply (simp add: comp_class_None)
|
|
138 |
|
|
139 |
(* case \<exists> D fs ms. (class G x = Some (D, fs, ms)) *)
|
|
140 |
apply (erule exE)+
|
|
141 |
apply (frule comp_class_imp)
|
|
142 |
apply (frule_tac G="comp G" and C=x and t=t and f=f in class_rec_lemma)
|
|
143 |
apply assumption
|
|
144 |
apply (frule_tac G=G and C=x and t=t
|
|
145 |
and f="(\<lambda>C' fs' ms'. f C' fs' (map (compMethod G C') ms'))" in class_rec_lemma)
|
|
146 |
apply assumption
|
|
147 |
apply (simp only:)
|
|
148 |
|
|
149 |
apply (case_tac "x = Object")
|
|
150 |
apply simp
|
|
151 |
apply (frule subcls1I, assumption)
|
|
152 |
apply (drule_tac x=D in spec, drule mp, simp)
|
|
153 |
apply simp
|
|
154 |
|
|
155 |
(* subgoals *)
|
|
156 |
apply (case_tac "class G x")
|
|
157 |
apply auto
|
|
158 |
apply (simp add: comp_subcls1)
|
|
159 |
done
|
|
160 |
|
|
161 |
lemma comp_fields: "wf ((subcls1 G)^-1) \<Longrightarrow>
|
|
162 |
fields (G,C) = fields (comp G,C)"
|
|
163 |
by (simp add: fields_def comp_class_rec)
|
|
164 |
|
|
165 |
lemma comp_field: "wf ((subcls1 G)^-1) \<Longrightarrow>
|
|
166 |
field (G,C) = field (comp G,C)"
|
|
167 |
by (simp add: field_def comp_fields)
|
|
168 |
|
|
169 |
|
|
170 |
|
|
171 |
lemma class_rec_relation [rule_format (no_asm)]: "\<lbrakk> wf_prog wf_mb G;
|
|
172 |
\<forall> fs ms. R (f1 Object fs ms t1) (f2 Object fs ms t2);
|
|
173 |
\<forall> C fs ms r1 r2. (R r1 r2) \<longrightarrow> (R (f1 C fs ms r1) (f2 C fs ms r2)) \<rbrakk>
|
|
174 |
\<Longrightarrow> ((class G C) \<noteq> None) \<longrightarrow>
|
|
175 |
R (class_rec G C t1 f1) (class_rec G C t2 f2)"
|
|
176 |
apply (frule wf_subcls1) (* establish wf ((subcls1 G)^-1) *)
|
|
177 |
apply (rule_tac a = C in wf_induct) apply assumption
|
|
178 |
apply (intro strip)
|
|
179 |
apply (subgoal_tac "(\<exists>D rT mb. class G x = Some (D, rT, mb))")
|
|
180 |
apply (erule exE)+
|
|
181 |
apply (frule_tac C=x and t=t1 and f=f1 in class_rec_lemma)
|
|
182 |
apply assumption
|
|
183 |
apply (frule_tac C=x and t=t2 and f=f2 in class_rec_lemma)
|
|
184 |
apply assumption
|
|
185 |
apply (simp only:)
|
|
186 |
|
|
187 |
apply (case_tac "x = Object")
|
|
188 |
apply simp
|
|
189 |
apply (frule subcls1I, assumption)
|
|
190 |
apply (drule_tac x=D in spec, drule mp, simp)
|
|
191 |
apply simp
|
|
192 |
apply (subgoal_tac "(\<exists>D' rT' mb'. class G D = Some (D', rT', mb'))")
|
|
193 |
apply blast
|
|
194 |
|
|
195 |
(* subgoals *)
|
|
196 |
|
|
197 |
apply (frule class_wf) apply assumption
|
|
198 |
apply (simp add: wf_cdecl_def is_class_def)
|
|
199 |
|
|
200 |
apply (simp add: subcls1_def2 is_class_def)
|
|
201 |
done
|
|
202 |
|
|
203 |
|
|
204 |
syntax
|
|
205 |
mtd_mb :: "cname \<times> ty \<times> 'c \<Rightarrow> 'c"
|
|
206 |
translations
|
|
207 |
"mtd_mb" => "Fun.comp snd snd"
|
|
208 |
|
|
209 |
|
|
210 |
lemma map_of_map_fst: "\<lbrakk> map_of (map f xs) k = Some e; inj f;
|
|
211 |
\<forall>x\<in>set xs. fst (f x) = fst x; \<forall>x\<in>set xs. fst (g x) = fst x \<rbrakk>
|
|
212 |
\<Longrightarrow> map_of (map g xs) k = Some (snd (g ((inv f) (k, e))))"
|
|
213 |
apply (induct xs)
|
|
214 |
apply simp
|
|
215 |
apply (simp del: split_paired_All)
|
|
216 |
apply (case_tac "k = fst a")
|
|
217 |
apply (simp del: split_paired_All)
|
|
218 |
apply (subgoal_tac "(fst a, e) = f a")
|
|
219 |
apply simp
|
|
220 |
apply (rule_tac s= "(fst (f a), snd (f a))" in trans)
|
|
221 |
apply simp
|
|
222 |
apply (rule surjective_pairing [THEN sym])
|
|
223 |
apply (simp del: split_paired_All)
|
|
224 |
done
|
|
225 |
|
|
226 |
|
|
227 |
lemma comp_method [rule_format (no_asm)]: "\<lbrakk> wf_prog wf_mb G; is_class G C\<rbrakk> \<Longrightarrow>
|
|
228 |
(method (G, C) S) = Some (D, rT, mb) \<longrightarrow>
|
|
229 |
(method (comp G, C) S) = Some (D, rT, mtd_mb (compMethod G D (S, rT, mb)))"
|
|
230 |
apply (simp add: method_def)
|
|
231 |
apply (frule wf_subcls1)
|
|
232 |
apply (simp add: comp_class_rec)
|
|
233 |
apply (simp add: map_compose [THEN sym] split_iter split_compose del: map_compose)
|
|
234 |
apply (rule_tac R="%x y. (x S) = Some (D, rT, mb) \<longrightarrow> (y S) = Some (D, rT, snd (snd (compMethod G D (S, rT, mb))))" in class_rec_relation) apply assumption
|
|
235 |
|
|
236 |
apply (intro strip)
|
|
237 |
apply simp
|
|
238 |
|
|
239 |
apply (frule_tac f="(\<lambda>(s, m). (s, Object, m))"
|
|
240 |
and g="(Fun.comp (\<lambda>(s, m). (s, Object, m)) (compMethod G Object))" in map_of_map_fst)
|
|
241 |
(*
|
|
242 |
apply (frule_tac f="(\<lambda>(s, m). (s, Object, m))"
|
|
243 |
and g="((\<lambda>(s, m). (s, Object, m)) \<circ> compMethod G Object)" in map_of_map_fst)
|
|
244 |
*)
|
|
245 |
apply (simp add: inj_on_def)
|
|
246 |
apply (simp add: split_beta compMethod_def)
|
|
247 |
apply (simp add: split_beta compMethod_def)
|
|
248 |
apply (simp only:)
|
|
249 |
apply (subgoal_tac "(inv (\<lambda>(s, m). (s, Object, m)) (S, D, rT, mb)) = (S, rT, mb)")
|
|
250 |
apply (simp only:)
|
|
251 |
apply (simp add: compMethod_def split_beta)
|
|
252 |
apply (simp add: map_of_map) apply (erule exE)+ apply simp
|
|
253 |
apply (simp add: map_of_map) apply (erule exE)+ apply simp
|
|
254 |
apply (rule inv_f_eq) apply (simp add: inj_on_def) apply simp
|
|
255 |
|
|
256 |
apply (intro strip)
|
|
257 |
apply (simp add: override_Some_iff map_of_map del: split_paired_Ex)
|
|
258 |
apply (subgoal_tac "\<forall>x\<in>set ms. fst ((Fun.comp (\<lambda>(s, m). (s, Ca, m)) (compMethod G Ca)) x) = fst x")
|
|
259 |
(*
|
|
260 |
apply (subgoal_tac "\<forall>x\<in>set ms. fst (((\<lambda>(s, m). (s, Ca, m)) \<circ> compMethod G Ca) x) = fst x")
|
|
261 |
*)
|
|
262 |
apply (erule disjE)
|
|
263 |
apply (rule disjI1)
|
|
264 |
apply (simp add: map_of_map2)
|
|
265 |
apply (simp (no_asm_simp) add: compMethod_def split_beta)
|
|
266 |
|
|
267 |
apply (rule disjI2)
|
|
268 |
apply (simp add: map_of_map2)
|
|
269 |
|
|
270 |
-- "subgoal"
|
|
271 |
apply (simp (no_asm_simp) add: compMethod_def split_beta)
|
|
272 |
|
|
273 |
apply (simp add: is_class_def)
|
|
274 |
done
|
|
275 |
|
|
276 |
|
|
277 |
constdefs comp_method_result :: "java_mb prog \<Rightarrow> sig \<Rightarrow>
|
|
278 |
(cname \<times> ty \<times> java_mb) option \<Rightarrow> (cname \<times> ty \<times> jvm_method) option"
|
|
279 |
"comp_method_result G S m == case m of
|
|
280 |
None \<Rightarrow> None
|
|
281 |
| Some (D, rT, mb) \<Rightarrow> Some (D, rT, mtd_mb (compMethod G D (S, rT, mb)))"
|
|
282 |
|
|
283 |
|
|
284 |
lemma map_of_map_compMethod: "map_of (map (\<lambda>(s, m). (s, C, m)) (map (compMethod G C) ms)) S =
|
|
285 |
(case map_of (map (\<lambda>(s, m). (s, C, m)) ms) S of None \<Rightarrow> None
|
|
286 |
| Some (D, rT, mb) \<Rightarrow> Some (D, rT, mtd_mb (compMethod G D (S, rT, mb))))"
|
|
287 |
apply (induct ms)
|
|
288 |
apply simp
|
|
289 |
apply (simp only: map_compose [THEN sym])
|
|
290 |
apply (simp add: o_def split_beta del: map.simps)
|
|
291 |
apply (simp (no_asm_simp) only: map.simps map_of.simps)
|
|
292 |
apply (simp add: compMethod_def split_beta)
|
|
293 |
done
|
|
294 |
|
|
295 |
(* the following is more expressive than comp_method and should replace it *)
|
|
296 |
lemma comp_method_eq [rule_format (no_asm)]: "wf_prog wf_mb G \<Longrightarrow> is_class G C \<longrightarrow>
|
|
297 |
method (comp G, C) S = comp_method_result G S (method (G,C) S)"
|
|
298 |
apply (subgoal_tac "wf ((subcls1 G)^-1)") prefer 2 apply (rule wf_subcls1, assumption)
|
|
299 |
|
|
300 |
apply (rule subcls_induct)
|
|
301 |
apply assumption
|
|
302 |
apply (intro strip)
|
|
303 |
apply (subgoal_tac "\<exists> D fs ms. class G C = Some (D, fs, ms)")
|
|
304 |
prefer 2 apply (simp add: is_class_def)
|
|
305 |
apply (erule exE)+
|
|
306 |
|
|
307 |
apply (case_tac "C = Object")
|
|
308 |
|
|
309 |
(* C = Object *)
|
|
310 |
apply (subst method_rec_lemma) apply assumption+ apply simp
|
|
311 |
apply (subst method_rec_lemma) apply (frule comp_class_imp) apply assumption+
|
|
312 |
apply (simp add: comp_subcls1)
|
|
313 |
apply (simp add: comp_method_result_def)
|
|
314 |
apply (rule map_of_map_compMethod)
|
|
315 |
|
|
316 |
(* C \<noteq> Object *)
|
|
317 |
apply (subgoal_tac "(C, D) \<in> (subcls1 G)\<^sup>+")
|
|
318 |
prefer 2 apply (frule subcls1I, assumption+) apply blast
|
|
319 |
apply (subgoal_tac "is_class G D")
|
|
320 |
apply (drule spec, drule mp, assumption, drule mp, assumption)
|
|
321 |
apply (frule wf_subcls1)
|
|
322 |
apply (subgoal_tac "wf ((subcls1 (comp G))\<inverse>)")
|
|
323 |
apply (frule_tac G=G in method_rec_lemma, assumption)
|
|
324 |
apply (frule comp_class_imp)
|
|
325 |
apply (frule_tac G="comp G" in method_rec_lemma, assumption)
|
|
326 |
apply (simp only:)
|
|
327 |
apply (simp (no_asm_simp) add: comp_method_result_def expand_fun_eq)
|
|
328 |
|
|
329 |
apply (case_tac "(method (G, D) ++ map_of (map (\<lambda>(s, m). (s, C, m)) ms)) S")
|
|
330 |
|
|
331 |
(* case None *)
|
|
332 |
apply (simp (no_asm_simp) add: override_None)
|
|
333 |
apply (simp add: map_of_map_compMethod comp_method_result_def)
|
|
334 |
|
|
335 |
(* case Some *)
|
|
336 |
apply (simp add: override_Some_iff)
|
|
337 |
apply (erule disjE)
|
|
338 |
apply (simp add: split_beta map_of_map_compMethod)
|
|
339 |
apply (simp add: override_def comp_method_result_def map_of_map_compMethod)
|
|
340 |
|
|
341 |
(* show subgoals *)
|
|
342 |
apply (simp add: comp_subcls1)
|
|
343 |
(* show is_class G D *)
|
|
344 |
apply (simp add: wf_prog_def wf_cdecl_def)
|
|
345 |
apply (subgoal_tac "(C, D, fs, ms)\<in>set G")
|
|
346 |
apply blast
|
|
347 |
apply (simp add: class_def map_of_SomeD)
|
|
348 |
done
|
|
349 |
|
|
350 |
(* ### this proof is horrid and has to be redone *)
|
|
351 |
lemma unique_map_fst [rule_format]: "(\<forall> x \<in> set xs. (fst x = fst (f x) )) \<longrightarrow>
|
|
352 |
unique xs = unique (map f xs)"
|
|
353 |
apply (induct_tac "xs")
|
|
354 |
apply simp
|
|
355 |
apply (intro strip)
|
|
356 |
apply simp
|
|
357 |
apply (case_tac a, simp)
|
|
358 |
apply (case_tac "f (aa, b)")
|
|
359 |
apply (simp only:)
|
|
360 |
apply (simp only: unique_Cons)
|
|
361 |
|
|
362 |
apply simp
|
|
363 |
apply (subgoal_tac "(\<exists>y. (ab, y) \<in> set list) = (\<exists>y. (ab, y) \<in> f ` set list)")
|
|
364 |
apply blast
|
|
365 |
apply (rule iffI)
|
|
366 |
|
|
367 |
apply clarify
|
|
368 |
apply (rule_tac x="(snd (f(ab, y)))" in exI)
|
|
369 |
apply simp
|
|
370 |
apply (subgoal_tac "(ab, snd (f (ab, y))) = (fst (f (ab, y)), snd (f (ab, y)))")
|
|
371 |
apply (simp only:)
|
|
372 |
apply (simp add: surjective_pairing [THEN sym])
|
|
373 |
apply (subgoal_tac "fst (f (ab, y)) = fst (ab, y)")
|
|
374 |
apply simp
|
|
375 |
apply (drule bspec) apply assumption apply simp
|
|
376 |
|
|
377 |
apply clarify
|
|
378 |
apply (drule bspec) apply assumption apply simp
|
|
379 |
apply (subgoal_tac "ac = ab")
|
|
380 |
apply simp
|
|
381 |
apply blast
|
|
382 |
apply (drule sym)
|
|
383 |
apply (drule sym)
|
|
384 |
apply (drule_tac f=fst in arg_cong)
|
|
385 |
apply simp
|
|
386 |
done
|
|
387 |
|
|
388 |
lemma comp_unique: "unique G = unique (comp G)"
|
|
389 |
apply (simp add: comp_def)
|
|
390 |
apply (rule unique_map_fst)
|
|
391 |
apply (simp add: compClass_def split_beta)
|
|
392 |
done
|
|
393 |
|
|
394 |
|
|
395 |
(**********************************************************************)
|
|
396 |
(* DIVERSE OTHER LEMMAS *)
|
|
397 |
(**********************************************************************)
|
|
398 |
|
|
399 |
|
|
400 |
(* already proved less elegantly in CorrComp.thy;
|
|
401 |
to be moved into a common super-theory *)
|
|
402 |
lemma max_spec_preserves_length:
|
|
403 |
"max_spec G C (mn, pTs) = {((md,rT),pTs')}
|
|
404 |
\<Longrightarrow> length pTs = length pTs'"
|
|
405 |
apply (frule max_spec2mheads)
|
|
406 |
apply (erule exE)+
|
|
407 |
apply (simp add: list_all2_def)
|
|
408 |
done
|
|
409 |
|
|
410 |
|
|
411 |
(* already proved in CorrComp.thy \<longrightarrow> into common supertheory *)
|
|
412 |
lemma ty_exprs_length [simp]: "(E\<turnstile>es[::]Ts \<longrightarrow> length es = length Ts)"
|
|
413 |
apply (subgoal_tac "(E\<turnstile>e::T \<longrightarrow> True) \<and> (E\<turnstile>es[::]Ts \<longrightarrow> length es = length Ts) \<and> (E\<turnstile>s\<surd> \<longrightarrow> True)")
|
|
414 |
apply blast
|
|
415 |
apply (rule ty_expr_ty_exprs_wt_stmt.induct)
|
|
416 |
apply auto
|
|
417 |
done
|
|
418 |
|
|
419 |
|
|
420 |
lemma max_spec_preserves_method_rT [simp]:
|
|
421 |
"max_spec G C (mn, pTs) = {((md,rT),pTs')}
|
|
422 |
\<Longrightarrow> method_rT (the (method (G, C) (mn, pTs'))) = rT"
|
|
423 |
apply (frule max_spec2mheads)
|
|
424 |
apply (erule exE)+
|
|
425 |
apply (simp add: method_rT_def)
|
|
426 |
done
|
|
427 |
|
|
428 |
|
|
429 |
end
|