| author | wenzelm | 
| Mon, 02 Oct 2017 13:45:36 +0200 | |
| changeset 66748 | 3efac90a11a7 | 
| parent 62042 | 6c6ccf573479 | 
| child 67443 | 3abf6a722518 | 
| permissions | -rw-r--r-- | 
| 13673 | 1 | (* Title: HOL/MicroJava/Comp/LemmasComp.thy | 
| 2 | Author: Martin Strecker | |
| 3 | *) | |
| 4 | ||
| 5 | (* Lemmas for compiler correctness proof *) | |
| 6 | ||
| 23022 
9872ef956276
added qualification for ambiguous definition names
 haftmann parents: 
22271diff
changeset | 7 | theory LemmasComp | 
| 
9872ef956276
added qualification for ambiguous definition names
 haftmann parents: 
22271diff
changeset | 8 | imports TranslComp | 
| 
9872ef956276
added qualification for ambiguous definition names
 haftmann parents: 
22271diff
changeset | 9 | begin | 
| 13673 | 10 | |
| 14045 | 11 | |
| 60304 | 12 | context | 
| 13 | begin | |
| 14 | ||
| 14045 | 15 | declare split_paired_All [simp del] | 
| 16 | declare split_paired_Ex [simp del] | |
| 17 | ||
| 18 | ||
| 13673 | 19 | (**********************************************************************) | 
| 20 | (* misc lemmas *) | |
| 21 | ||
| 22 | lemma c_hupd_conv: | |
| 23 | "c_hupd h' (xo, (h,l)) = (xo, (if xo = None then h' else h),l)" | |
| 60304 | 24 | by (simp add: c_hupd_def) | 
| 13673 | 25 | |
| 26 | lemma gl_c_hupd [simp]: "(gl (c_hupd h xs)) = (gl xs)" | |
| 60304 | 27 | by (simp add: gl_def c_hupd_def split_beta) | 
| 13673 | 28 | |
| 29 | lemma c_hupd_xcpt_invariant [simp]: "gx (c_hupd h' (xo, st)) = xo" | |
| 60304 | 30 | by (cases st) (simp only: c_hupd_conv gx_conv) | 
| 13673 | 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" | |
| 60304 | 34 | by (cases st) (simp add: c_hupd_conv gh_def) | 
| 13673 | 35 | |
| 36 | ||
| 14045 | 37 | lemma unique_map_fst [rule_format]: "(\<forall> x \<in> set xs. (fst x = fst (f x) )) \<longrightarrow> | 
| 38 | unique (map f xs) = unique xs" | |
| 39 | proof (induct xs) | |
| 40 | case Nil show ?case by simp | |
| 41 | next | |
| 42 | case (Cons a list) | |
| 43 | show ?case | |
| 44 | proof | |
| 45 | assume fst_eq: "\<forall>x\<in>set (a # list). fst x = fst (f x)" | |
| 46 | ||
| 47 | have fst_set: "(fst a \<in> fst ` set list) = (fst (f a) \<in> fst ` f ` set list)" | |
| 48 | proof | |
| 49 | assume as: "fst a \<in> fst ` set list" | |
| 50 | then obtain x where fst_a_x: "x\<in>set list \<and> fst a = fst x" | |
| 32960 
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
 wenzelm parents: 
30235diff
changeset | 51 | by (auto simp add: image_iff) | 
| 14045 | 52 | then have "fst (f a) = fst (f x)" by (simp add: fst_eq) | 
| 53 | with as show "(fst (f a) \<in> fst ` f ` set list)" by (simp add: fst_a_x) | |
| 54 | next | |
| 55 | assume as: "fst (f a) \<in> fst ` f ` set list" | |
| 56 | then obtain x where fst_a_x: "x\<in>set list \<and> fst (f a) = fst (f x)" | |
| 32960 
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
 wenzelm parents: 
30235diff
changeset | 57 | by (auto simp add: image_iff) | 
| 14045 | 58 | then have "fst a = fst x" by (simp add: fst_eq) | 
| 59 | with as show "fst a \<in> fst ` set list" by (simp add: fst_a_x) | |
| 60 | qed | |
| 61 | ||
| 62 | with fst_eq Cons | |
| 63 | show "unique (map f (a # list)) = unique (a # list)" | |
| 56154 
f0a927235162
more complete set of lemmas wrt. image and composition
 haftmann parents: 
55524diff
changeset | 64 | by (simp add: unique_def fst_set image_comp) | 
| 14045 | 65 | qed | 
| 66 | qed | |
| 67 | ||
| 68 | lemma comp_unique: "unique (comp G) = unique G" | |
| 60304 | 69 | apply (simp add: comp_def) | 
| 70 | apply (rule unique_map_fst) | |
| 71 | apply (simp add: compClass_def split_beta) | |
| 72 | done | |
| 14045 | 73 | |
| 74 | ||
| 13673 | 75 | (**********************************************************************) | 
| 76 | (* invariance of properties under compilation *) | |
| 77 | ||
| 78 | lemma comp_class_imp: | |
| 79 | "(class G C = Some(D, fs, ms)) \<Longrightarrow> | |
| 80 | (class (comp G) C = Some(D, fs, map (compMethod G C) ms))" | |
| 60304 | 81 | apply (simp add: class_def comp_def compClass_def) | 
| 82 | apply (rule trans) | |
| 83 | apply (rule map_of_map2) | |
| 84 | apply auto | |
| 85 | done | |
| 13673 | 86 | |
| 87 | lemma comp_class_None: | |
| 88 | "(class G C = None) = (class (comp G) C = None)" | |
| 60304 | 89 | apply (simp add: class_def comp_def compClass_def) | 
| 90 | apply (simp add: map_of_in_set) | |
| 91 | apply (simp add: image_comp [symmetric] o_def split_beta) | |
| 92 | done | |
| 13673 | 93 | |
| 14045 | 94 | lemma comp_is_class: "is_class (comp G) C = is_class G C" | 
| 60304 | 95 | by (cases "class G C") (auto simp: is_class_def comp_class_None dest: comp_class_imp) | 
| 13673 | 96 | |
| 97 | ||
| 14045 | 98 | lemma comp_is_type: "is_type (comp G) T = is_type G T" | 
| 60304 | 99 | apply (cases T, simp) | 
| 52857 | 100 | apply (induct G) | 
| 60304 | 101 | apply simp | 
| 102 | apply (simp only: comp_is_class) | |
| 52857 | 103 | apply (simp add: comp_is_class) | 
| 104 | apply (simp only: comp_is_class) | |
| 105 | done | |
| 13673 | 106 | |
| 60304 | 107 | lemma comp_classname: | 
| 108 | "is_class G C \<Longrightarrow> fst (the (class G C)) = fst (the (class (comp G) C))" | |
| 109 | by (cases "class G C") (auto simp: is_class_def dest: comp_class_imp) | |
| 13673 | 110 | |
| 14045 | 111 | lemma comp_subcls1: "subcls1 (comp G) = subcls1 G" | 
| 60304 | 112 | by (auto simp add: subcls1_def2 comp_classname comp_is_class) | 
| 13673 | 113 | |
| 22271 | 114 | lemma comp_widen: "widen (comp G) = widen G" | 
| 39302 
d7728f65b353
renamed lemmas: ext_iff -> fun_eq_iff, set_ext_iff -> set_eq_iff, set_ext -> set_eqI
 nipkow parents: 
39198diff
changeset | 115 | apply (simp add: fun_eq_iff) | 
| 22271 | 116 | apply (intro allI iffI) | 
| 60304 | 117 | apply (erule widen.cases) | 
| 118 | apply (simp_all add: comp_subcls1 widen.null) | |
| 119 | apply (erule widen.cases) | |
| 120 | apply (simp_all add: comp_subcls1 widen.null) | |
| 13673 | 121 | done | 
| 122 | ||
| 22271 | 123 | lemma comp_cast: "cast (comp G) = cast G" | 
| 39302 
d7728f65b353
renamed lemmas: ext_iff -> fun_eq_iff, set_ext_iff -> set_eq_iff, set_ext -> set_eqI
 nipkow parents: 
39198diff
changeset | 124 | apply (simp add: fun_eq_iff) | 
| 22271 | 125 | apply (intro allI iffI) | 
| 60304 | 126 | apply (erule cast.cases) | 
| 127 | apply (simp_all add: comp_subcls1 cast.widen cast.subcls) | |
| 128 | apply (rule cast.widen) | |
| 129 | apply (simp add: comp_widen) | |
| 22271 | 130 | apply (erule cast.cases) | 
| 60304 | 131 | apply (simp_all add: comp_subcls1 cast.widen cast.subcls) | 
| 132 | apply (rule cast.widen) | |
| 133 | apply (simp add: comp_widen) | |
| 13673 | 134 | done | 
| 135 | ||
| 14045 | 136 | lemma comp_cast_ok: "cast_ok (comp G) = cast_ok G" | 
| 39302 
d7728f65b353
renamed lemmas: ext_iff -> fun_eq_iff, set_ext_iff -> set_eq_iff, set_ext -> set_eqI
 nipkow parents: 
39198diff
changeset | 137 | by (simp add: fun_eq_iff cast_ok_def comp_widen) | 
| 13673 | 138 | |
| 139 | ||
| 14045 | 140 | lemma compClass_fst [simp]: "(fst (compClass G C)) = (fst C)" | 
| 60304 | 141 | by (simp add: compClass_def split_beta) | 
| 14045 | 142 | |
| 143 | lemma compClass_fst_snd [simp]: "(fst (snd (compClass G C))) = (fst (snd C))" | |
| 60304 | 144 | by (simp add: compClass_def split_beta) | 
| 14045 | 145 | |
| 146 | lemma compClass_fst_snd_snd [simp]: "(fst (snd (snd (compClass G C)))) = (fst (snd (snd C)))" | |
| 60304 | 147 | by (simp add: compClass_def split_beta) | 
| 14045 | 148 | |
| 149 | lemma comp_wf_fdecl [simp]: "wf_fdecl (comp G) fd = wf_fdecl G fd" | |
| 60304 | 150 | by (cases fd) (simp add: wf_fdecl_def comp_is_type) | 
| 14045 | 151 | |
| 152 | ||
| 60304 | 153 | lemma compClass_forall [simp]: | 
| 154 | "(\<forall>x\<in>set (snd (snd (snd (compClass G C)))). P (fst x) (fst (snd x))) = | |
| 14045 | 155 | (\<forall>x\<in>set (snd (snd (snd C))). P (fst x) (fst (snd x)))" | 
| 60304 | 156 | by (simp add: compClass_def compMethod_def split_beta) | 
| 14045 | 157 | |
| 158 | lemma comp_wf_mhead: "wf_mhead (comp G) S rT = wf_mhead G S rT" | |
| 60304 | 159 | by (simp add: wf_mhead_def split_beta comp_is_type) | 
| 14045 | 160 | |
| 60304 | 161 | lemma comp_ws_cdecl: | 
| 162 | "ws_cdecl (TranslComp.comp G) (compClass G C) = ws_cdecl G C" | |
| 163 | apply (simp add: ws_cdecl_def split_beta comp_is_class comp_subcls1) | |
| 164 | apply (simp (no_asm_simp) add: comp_wf_mhead) | |
| 165 | apply (simp add: compClass_def compMethod_def split_beta unique_map_fst) | |
| 166 | done | |
| 13673 | 167 | |
| 14045 | 168 | |
| 169 | lemma comp_wf_syscls: "wf_syscls (comp G) = wf_syscls G" | |
| 60304 | 170 | apply (simp add: wf_syscls_def comp_def compClass_def split_beta) | 
| 171 | apply (simp add: image_comp) | |
| 172 | apply (subgoal_tac "(Fun.comp fst (\<lambda>(C, cno::cname, fdls::fdecl list, jmdls). | |
| 173 | (C, cno, fdls, map (compMethod G C) jmdls))) = fst") | |
| 174 | apply simp | |
| 175 | apply (simp add: fun_eq_iff split_beta) | |
| 176 | done | |
| 13673 | 177 | |
| 178 | ||
| 14045 | 179 | lemma comp_ws_prog: "ws_prog (comp G) = ws_prog G" | 
| 60304 | 180 | apply (rule sym) | 
| 181 | apply (simp add: ws_prog_def comp_ws_cdecl comp_unique) | |
| 182 | apply (simp add: comp_wf_syscls) | |
| 183 | apply (auto simp add: comp_ws_cdecl [symmetric] TranslComp.comp_def) | |
| 184 | done | |
| 13673 | 185 | |
| 186 | ||
| 60304 | 187 | lemma comp_class_rec: | 
| 188 | "wf ((subcls1 G)^-1) \<Longrightarrow> | |
| 189 | class_rec (comp G) C t f = | |
| 13673 | 190 | class_rec G C t (\<lambda> C' fs' ms' r'. f C' fs' (map (compMethod G C') ms') r')" | 
| 60304 | 191 | apply (rule_tac a = C in wf_induct) | 
| 192 | apply assumption | |
| 193 | apply (subgoal_tac "wf ((subcls1 (comp G))^-1)") | |
| 194 | apply (subgoal_tac "(class G x = None) \<or> (\<exists> D fs ms. (class G x = Some (D, fs, ms)))") | |
| 195 | apply (erule disjE) | |
| 13673 | 196 | |
| 60304 | 197 | (* case class G x = None *) | 
| 198 | apply (simp (no_asm_simp) add: class_rec_def comp_subcls1 | |
| 199 | wfrec [where R="(subcls1 G)^-1", simplified]) | |
| 200 | apply (simp add: comp_class_None) | |
| 13673 | 201 | |
| 60304 | 202 | (* case \<exists> D fs ms. (class G x = Some (D, fs, ms)) *) | 
| 203 | apply (erule exE)+ | |
| 204 | apply (frule comp_class_imp) | |
| 205 | apply (frule_tac G="comp G" and C=x and t=t and f=f in class_rec_lemma) | |
| 206 | apply assumption | |
| 207 | apply (frule_tac G=G and C=x and t=t | |
| 208 | and f="(\<lambda>C' fs' ms'. f C' fs' (map (compMethod G C') ms'))" in class_rec_lemma) | |
| 209 | apply assumption | |
| 210 | apply (simp only:) | |
| 211 | apply (case_tac "x = Object") | |
| 212 | apply simp | |
| 213 | apply (frule subcls1I, assumption) | |
| 13673 | 214 | apply (drule_tac x=D in spec, drule mp, simp) | 
| 215 | apply simp | |
| 216 | ||
| 60304 | 217 | (* subgoals *) | 
| 218 | apply (case_tac "class G x") | |
| 219 | apply auto | |
| 220 | apply (simp add: comp_subcls1) | |
| 221 | done | |
| 13673 | 222 | |
| 33954 
1bc3b688548c
backported parts of abstract byte code verifier from AFP/Jinja
 haftmann parents: 
33640diff
changeset | 223 | lemma comp_fields: "wf ((subcls1 G)^-1) \<Longrightarrow> | 
| 14045 | 224 | fields (comp G,C) = fields (G,C)" | 
| 60304 | 225 | by (simp add: fields_def comp_class_rec) | 
| 13673 | 226 | |
| 33954 
1bc3b688548c
backported parts of abstract byte code verifier from AFP/Jinja
 haftmann parents: 
33640diff
changeset | 227 | lemma comp_field: "wf ((subcls1 G)^-1) \<Longrightarrow> | 
| 14045 | 228 | field (comp G,C) = field (G,C)" | 
| 60304 | 229 | by (simp add: TypeRel.field_def comp_fields) | 
| 13673 | 230 | |
| 231 | ||
| 14045 | 232 | lemma class_rec_relation [rule_format (no_asm)]: "\<lbrakk> ws_prog G; | 
| 60304 | 233 | \<forall>fs ms. R (f1 Object fs ms t1) (f2 Object fs ms t2); | 
| 234 | \<forall>C fs ms r1 r2. (R r1 r2) \<longrightarrow> (R (f1 C fs ms r1) (f2 C fs ms r2)) \<rbrakk> | |
| 235 | \<Longrightarrow> ((class G C) \<noteq> None) \<longrightarrow> R (class_rec G C t1 f1) (class_rec G C t2 f2)" | |
| 236 | apply (frule wf_subcls1) (* establish wf ((subcls1 G)^-1) *) | |
| 237 | apply (rule_tac a = C in wf_induct) | |
| 238 | apply assumption | |
| 239 | apply (intro strip) | |
| 240 | apply (subgoal_tac "(\<exists>D rT mb. class G x = Some (D, rT, mb))") | |
| 241 | apply (erule exE)+ | |
| 242 | apply (frule_tac C=x and t=t1 and f=f1 in class_rec_lemma) | |
| 243 | apply assumption | |
| 244 | apply (frule_tac C=x and t=t2 and f=f2 in class_rec_lemma) | |
| 245 | apply assumption | |
| 246 | apply (simp only:) | |
| 13673 | 247 | |
| 60304 | 248 | apply (case_tac "x = Object") | 
| 13673 | 249 | apply simp | 
| 60304 | 250 | apply (frule subcls1I, assumption) | 
| 251 | apply (drule_tac x=D in spec, drule mp, simp) | |
| 252 | apply simp | |
| 253 | apply (subgoal_tac "(\<exists>D' rT' mb'. class G D = Some (D', rT', mb'))") | |
| 13673 | 254 | apply blast | 
| 255 | ||
| 60304 | 256 | (* subgoals *) | 
| 257 | apply (frule class_wf_struct, assumption) | |
| 258 | apply (simp add: ws_cdecl_def is_class_def) | |
| 259 | apply (simp add: subcls1_def2 is_class_def) | |
| 260 | apply auto | |
| 261 | done | |
| 13673 | 262 | |
| 263 | ||
| 35102 | 264 | abbreviation (input) | 
| 265 | "mtd_mb == snd o snd" | |
| 13673 | 266 | |
| 35609 | 267 | lemma map_of_map: | 
| 55466 | 268 | "map_of (map (\<lambda>(k, v). (k, f v)) xs) k = map_option f (map_of xs k)" | 
| 35609 | 269 | by (simp add: map_of_map) | 
| 270 | ||
| 60304 | 271 | lemma map_of_map_fst: | 
| 272 | "\<lbrakk> inj f; \<forall>x\<in>set xs. fst (f x) = fst x; \<forall>x\<in>set xs. fst (g x) = fst x \<rbrakk> | |
| 273 | \<Longrightarrow> map_of (map g xs) k = map_option (\<lambda> e. (snd (g ((inv f) (k, e))))) (map_of (map f xs) k)" | |
| 274 | apply (induct xs) | |
| 275 | apply simp | |
| 276 | apply simp | |
| 277 | apply (case_tac "k = fst a") | |
| 278 | apply simp | |
| 279 | apply (subgoal_tac "(inv f (fst a, snd (f a))) = a", simp) | |
| 280 | apply (subgoal_tac "(fst a, snd (f a)) = f a", simp) | |
| 281 | apply (erule conjE)+ | |
| 282 | apply (drule_tac s ="fst (f a)" and t="fst a" in sym) | |
| 283 | apply simp | |
| 284 | apply (simp add: surjective_pairing) | |
| 285 | done | |
| 13673 | 286 | |
| 60304 | 287 | lemma comp_method [rule_format (no_asm)]: | 
| 288 | "\<lbrakk> ws_prog G; is_class G C\<rbrakk> \<Longrightarrow> | |
| 14045 | 289 | ((method (comp G, C) S) = | 
| 60304 | 290 | map_option (\<lambda> (D,rT,b). (D, rT, mtd_mb (compMethod G D (S, rT, b)))) | 
| 291 | (method (G, C) S))" | |
| 292 | apply (simp add: method_def) | |
| 293 | apply (frule wf_subcls1) | |
| 294 | apply (simp add: comp_class_rec) | |
| 295 | apply (simp add: split_iter split_compose map_map [symmetric] del: map_map) | |
| 296 | apply (rule_tac R="\<lambda>x y. ((x S) = (map_option (\<lambda>(D, rT, b). | |
| 297 | (D, rT, snd (snd (compMethod G D (S, rT, b))))) (y S)))" | |
| 298 | in class_rec_relation) | |
| 299 | apply assumption | |
| 13673 | 300 | |
| 60304 | 301 | apply (intro strip) | 
| 302 | apply simp | |
| 303 | apply (rule trans) | |
| 14045 | 304 | |
| 60304 | 305 | apply (rule_tac f="(\<lambda>(s, m). (s, Object, m))" and | 
| 306 | g="(Fun.comp (\<lambda>(s, m). (s, Object, m)) (compMethod G Object))" | |
| 307 | in map_of_map_fst) | |
| 308 | defer (* inj \<dots> *) | |
| 309 | apply (simp add: inj_on_def split_beta) | |
| 310 | apply (simp add: split_beta compMethod_def) | |
| 311 | apply (simp add: map_of_map [symmetric]) | |
| 312 | apply (simp add: split_beta) | |
| 313 | apply (simp add: Fun.comp_def split_beta) | |
| 61076 | 314 | apply (subgoal_tac "(\<lambda>x::(vname list \<times> fdecl list \<times> stmt \<times> expr) mdecl. | 
| 60304 | 315 | (fst x, Object, | 
| 316 | snd (compMethod G Object | |
| 61076 | 317 | (inv (\<lambda>(s::sig, m::ty \<times> vname list \<times> fdecl list \<times> stmt \<times> expr). | 
| 60304 | 318 | (s, Object, m)) | 
| 319 | (S, Object, snd x))))) | |
| 320 | = (\<lambda>x. (fst x, Object, fst (snd x), | |
| 321 | snd (snd (compMethod G Object (S, snd x)))))") | |
| 322 | apply (simp only:) | |
| 323 | apply (simp add: fun_eq_iff) | |
| 324 | apply (intro strip) | |
| 325 | apply (subgoal_tac "(inv (\<lambda>(s, m). (s, Object, m)) (S, Object, snd x)) = (S, snd x)") | |
| 326 | apply (simp only:) | |
| 327 | apply (simp add: compMethod_def split_beta) | |
| 328 | apply (rule inv_f_eq) | |
| 329 | defer | |
| 330 | defer | |
| 13673 | 331 | |
| 60304 | 332 | apply (intro strip) | 
| 333 | apply (simp add: map_add_Some_iff map_of_map) | |
| 334 | apply (simp add: map_add_def) | |
| 335 | apply (subgoal_tac "inj (\<lambda>(s, m). (s, Ca, m))") | |
| 336 | apply (drule_tac g="(Fun.comp (\<lambda>(s, m). (s, Ca, m)) (compMethod G Ca))" and xs=ms | |
| 337 | and k=S in map_of_map_fst) | |
| 338 | apply (simp add: split_beta) | |
| 339 | apply (simp add: compMethod_def split_beta) | |
| 340 | apply (case_tac "(map_of (map (\<lambda>(s, m). (s, Ca, m)) ms) S)") | |
| 341 | apply simp | |
| 342 | apply (simp add: split_beta map_of_map) | |
| 343 | apply (elim exE conjE) | |
| 344 | apply (drule_tac t=a in sym) | |
| 345 | apply (subgoal_tac "(inv (\<lambda>(s, m). (s, Ca, m)) (S, a)) = (S, snd a)") | |
| 346 | apply simp | |
| 347 | apply (subgoal_tac "\<forall>x\<in>set ms. fst ((Fun.comp (\<lambda>(s, m). (s, Ca, m)) (compMethod G Ca)) x) = fst x") | |
| 348 | prefer 2 apply (simp (no_asm_simp) add: compMethod_def split_beta) | |
| 349 | apply (simp add: map_of_map2) | |
| 350 | apply (simp (no_asm_simp) add: compMethod_def split_beta) | |
| 13673 | 351 | |
| 62042 | 352 | \<comment> "remaining subgoals" | 
| 60304 | 353 | apply (auto intro: inv_f_eq simp add: inj_on_def is_class_def) | 
| 354 | done | |
| 13673 | 355 | |
| 356 | ||
| 357 | ||
| 14045 | 358 | lemma comp_wf_mrT: "\<lbrakk> ws_prog G; is_class G D\<rbrakk> \<Longrightarrow> | 
| 359 | wf_mrT (TranslComp.comp G) (C, D, fs, map (compMethod G a) ms) = | |
| 360 | wf_mrT G (C, D, fs, ms)" | |
| 60304 | 361 | apply (simp add: wf_mrT_def compMethod_def split_beta) | 
| 362 | apply (simp add: comp_widen) | |
| 363 | apply (rule iffI) | |
| 364 | apply (intro strip) | |
| 365 | apply simp | |
| 366 | apply (drule (1) bspec) | |
| 367 | apply (drule_tac x=D' in spec) | |
| 368 | apply (drule_tac x=rT' in spec) | |
| 369 | apply (drule mp) | |
| 370 | prefer 2 apply assumption | |
| 371 | apply (simp add: comp_method [of G D]) | |
| 372 | apply (erule exE)+ | |
| 373 | apply (simp add: split_paired_all) | |
| 374 | apply (auto simp: comp_method) | |
| 375 | done | |
| 13673 | 376 | |
| 377 | ||
| 378 | (**********************************************************************) | |
| 379 | (* DIVERSE OTHER LEMMAS *) | |
| 380 | (**********************************************************************) | |
| 381 | ||
| 382 | lemma max_spec_preserves_length: | |
| 60304 | 383 |   "max_spec G C (mn, pTs) = {((md,rT),pTs')} \<Longrightarrow> length pTs = length pTs'"
 | 
| 384 | apply (frule max_spec2mheads) | |
| 385 | apply (clarsimp simp: list_all2_iff) | |
| 386 | done | |
| 13673 | 387 | |
| 388 | ||
| 389 | lemma ty_exprs_length [simp]: "(E\<turnstile>es[::]Ts \<longrightarrow> length es = length Ts)" | |
| 60304 | 390 | 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)") | 
| 391 | apply blast | |
| 392 | apply (rule ty_expr_ty_exprs_wt_stmt.induct, auto) | |
| 393 | done | |
| 13673 | 394 | |
| 395 | ||
| 396 | lemma max_spec_preserves_method_rT [simp]: | |
| 397 |   "max_spec G C (mn, pTs) = {((md,rT),pTs')}
 | |
| 398 | \<Longrightarrow> method_rT (the (method (G, C) (mn, pTs'))) = rT" | |
| 60304 | 399 | apply (frule max_spec2mheads) | 
| 400 | apply (clarsimp simp: method_rT_def) | |
| 401 | done | |
| 13673 | 402 | |
| 14045 | 403 | (**********************************************************************************) | 
| 404 | ||
| 60304 | 405 | end (* context *) | 
| 406 | ||
| 14045 | 407 | declare compClass_fst [simp del] | 
| 408 | declare compClass_fst_snd [simp del] | |
| 409 | declare compClass_fst_snd_snd [simp del] | |
| 410 | ||
| 13673 | 411 | end |