equal
deleted
inserted
replaced
1 (* Title: HOL/MicroJava/Comp/LemmasComp.thy |
1 (* Title: HOL/MicroJava/Comp/LemmasComp.thy |
2 ID: $Id$ |
|
3 Author: Martin Strecker |
2 Author: Martin Strecker |
4 *) |
3 *) |
5 |
4 |
6 (* Lemmas for compiler correctness proof *) |
5 (* Lemmas for compiler correctness proof *) |
7 |
6 |
54 |
53 |
55 have fst_set: "(fst a \<in> fst ` set list) = (fst (f a) \<in> fst ` f ` set list)" |
54 have fst_set: "(fst a \<in> fst ` set list) = (fst (f a) \<in> fst ` f ` set list)" |
56 proof |
55 proof |
57 assume as: "fst a \<in> fst ` set list" |
56 assume as: "fst a \<in> fst ` set list" |
58 then obtain x where fst_a_x: "x\<in>set list \<and> fst a = fst x" |
57 then obtain x where fst_a_x: "x\<in>set list \<and> fst a = fst x" |
59 by (auto simp add: image_iff) |
58 by (auto simp add: image_iff) |
60 then have "fst (f a) = fst (f x)" by (simp add: fst_eq) |
59 then have "fst (f a) = fst (f x)" by (simp add: fst_eq) |
61 with as show "(fst (f a) \<in> fst ` f ` set list)" by (simp add: fst_a_x) |
60 with as show "(fst (f a) \<in> fst ` f ` set list)" by (simp add: fst_a_x) |
62 next |
61 next |
63 assume as: "fst (f a) \<in> fst ` f ` set list" |
62 assume as: "fst (f a) \<in> fst ` f ` set list" |
64 then obtain x where fst_a_x: "x\<in>set list \<and> fst (f a) = fst (f x)" |
63 then obtain x where fst_a_x: "x\<in>set list \<and> fst (f a) = fst (f x)" |
65 by (auto simp add: image_iff) |
64 by (auto simp add: image_iff) |
66 then have "fst a = fst x" by (simp add: fst_eq) |
65 then have "fst a = fst x" by (simp add: fst_eq) |
67 with as show "fst a \<in> fst ` set list" by (simp add: fst_a_x) |
66 with as show "fst a \<in> fst ` set list" by (simp add: fst_a_x) |
68 qed |
67 qed |
69 |
68 |
70 with fst_eq Cons |
69 with fst_eq Cons |
305 apply (rule trans) |
304 apply (rule trans) |
306 |
305 |
307 apply (rule_tac f="(\<lambda>(s, m). (s, Object, m))" and |
306 apply (rule_tac f="(\<lambda>(s, m). (s, Object, m))" and |
308 g="(Fun.comp (\<lambda>(s, m). (s, Object, m)) (compMethod G Object))" |
307 g="(Fun.comp (\<lambda>(s, m). (s, Object, m)) (compMethod G Object))" |
309 in map_of_map_fst) |
308 in map_of_map_fst) |
310 defer (* inj \<dots> *) |
309 defer (* inj \<dots> *) |
311 apply (simp add: inj_on_def split_beta) |
310 apply (simp add: inj_on_def split_beta) |
312 apply (simp add: split_beta compMethod_def) |
311 apply (simp add: split_beta compMethod_def) |
313 apply (simp add: map_of_map [THEN sym]) |
312 apply (simp add: map_of_map [THEN sym]) |
314 apply (simp add: split_beta) |
313 apply (simp add: split_beta) |
315 apply (simp add: map_compose [THEN sym] Fun.comp_def split_beta) |
314 apply (simp add: map_compose [THEN sym] Fun.comp_def split_beta) |