63 |
63 |
64 |
64 |
65 section "type and expression names" |
65 section "type and expression names" |
66 |
66 |
67 (** unfortunately cannot simply instantiate tnam **) |
67 (** unfortunately cannot simply instantiate tnam **) |
68 datatype tnam_ = HasFoo_ | Base_ | Ext_ | Main_ |
68 datatype tnam' = HasFoo' | Base' | Ext' | Main' |
69 datatype vnam_ = arr_ | vee_ | z_ | e_ |
69 datatype vnam' = arr' | vee' | z' | e' |
70 datatype label_ = lab1_ |
70 datatype label' = lab1' |
71 |
71 |
72 consts |
72 consts |
73 |
73 |
74 tnam_ :: "tnam_ \<Rightarrow> tnam" |
74 tnam' :: "tnam' \<Rightarrow> tnam" |
75 vnam_ :: "vnam_ \<Rightarrow> vname" |
75 vnam' :: "vnam' \<Rightarrow> vname" |
76 label_:: "label_ \<Rightarrow> label" |
76 label':: "label' \<Rightarrow> label" |
77 axioms (** tnam_, vnam_ and label are intended to be isomorphic |
77 axioms (** tnam', vnam' and label are intended to be isomorphic |
78 to tnam, vname and label **) |
78 to tnam, vname and label **) |
79 |
79 |
80 inj_tnam_ [simp]: "(tnam_ x = tnam_ y) = (x = y)" |
80 inj_tnam' [simp]: "(tnam' x = tnam' y) = (x = y)" |
81 inj_vnam_ [simp]: "(vnam_ x = vnam_ y) = (x = y)" |
81 inj_vnam' [simp]: "(vnam' x = vnam' y) = (x = y)" |
82 inj_label_ [simp]: "(label_ x = label_ y) = (x = y)" |
82 inj_label' [simp]: "(label' x = label' y) = (x = y)" |
83 |
83 |
84 |
84 |
85 surj_tnam_: "\<exists>m. n = tnam_ m" |
85 surj_tnam': "\<exists>m. n = tnam' m" |
86 surj_vnam_: "\<exists>m. n = vnam_ m" |
86 surj_vnam': "\<exists>m. n = vnam' m" |
87 surj_label_:" \<exists>m. n = label_ m" |
87 surj_label':" \<exists>m. n = label' m" |
88 |
88 |
89 abbreviation |
89 abbreviation |
90 HasFoo :: qtname where |
90 HasFoo :: qtname where |
91 "HasFoo == \<lparr>pid=java_lang,tid=TName (tnam_ HasFoo_)\<rparr>" |
91 "HasFoo == \<lparr>pid=java_lang,tid=TName (tnam' HasFoo')\<rparr>" |
92 |
92 |
93 abbreviation |
93 abbreviation |
94 Base :: qtname where |
94 Base :: qtname where |
95 "Base == \<lparr>pid=java_lang,tid=TName (tnam_ Base_)\<rparr>" |
95 "Base == \<lparr>pid=java_lang,tid=TName (tnam' Base')\<rparr>" |
96 |
96 |
97 abbreviation |
97 abbreviation |
98 Ext :: qtname where |
98 Ext :: qtname where |
99 "Ext == \<lparr>pid=java_lang,tid=TName (tnam_ Ext_)\<rparr>" |
99 "Ext == \<lparr>pid=java_lang,tid=TName (tnam' Ext')\<rparr>" |
100 |
100 |
101 abbreviation |
101 abbreviation |
102 Main :: qtname where |
102 Main :: qtname where |
103 "Main == \<lparr>pid=java_lang,tid=TName (tnam_ Main_)\<rparr>" |
103 "Main == \<lparr>pid=java_lang,tid=TName (tnam' Main')\<rparr>" |
104 |
104 |
105 abbreviation |
105 abbreviation |
106 arr :: vname where |
106 arr :: vname where |
107 "arr == (vnam_ arr_)" |
107 "arr == (vnam' arr')" |
108 |
108 |
109 abbreviation |
109 abbreviation |
110 vee :: vname where |
110 vee :: vname where |
111 "vee == (vnam_ vee_)" |
111 "vee == (vnam' vee')" |
112 |
112 |
113 abbreviation |
113 abbreviation |
114 z :: vname where |
114 z :: vname where |
115 "z == (vnam_ z_)" |
115 "z == (vnam' z')" |
116 |
116 |
117 abbreviation |
117 abbreviation |
118 e :: vname where |
118 e :: vname where |
119 "e == (vnam_ e_)" |
119 "e == (vnam' e')" |
120 |
120 |
121 abbreviation |
121 abbreviation |
122 lab1:: label where |
122 lab1:: label where |
123 "lab1 == label_ lab1_" |
123 "lab1 == label' lab1'" |
124 |
124 |
125 |
125 |
126 lemma neq_Base_Object [simp]: "Base\<noteq>Object" |
126 lemma neq_Base_Object [simp]: "Base\<noteq>Object" |
127 by (simp add: Object_def) |
127 by (simp add: Object_def) |
128 |
128 |
305 done |
305 done |
306 |
306 |
307 lemma not_TName_n_subcls_TName_n [rule_format (no_asm), elim!]: |
307 lemma not_TName_n_subcls_TName_n [rule_format (no_asm), elim!]: |
308 "(\<lparr>pid=java_lang,tid=TName tn\<rparr>, \<lparr>pid=java_lang,tid=TName tn\<rparr>) |
308 "(\<lparr>pid=java_lang,tid=TName tn\<rparr>, \<lparr>pid=java_lang,tid=TName tn\<rparr>) |
309 \<in> (subcls1 tprg)^+ \<longrightarrow> R" |
309 \<in> (subcls1 tprg)^+ \<longrightarrow> R" |
310 apply (rule_tac n1 = "tn" in surj_tnam_ [THEN exE]) |
310 apply (rule_tac n1 = "tn" in surj_tnam' [THEN exE]) |
311 apply (erule ssubst) |
311 apply (erule ssubst) |
312 apply (rule tnam_.induct) |
312 apply (rule tnam'.induct) |
313 apply safe |
313 apply safe |
314 apply (auto dest!: tranclD subcls1D simp add: BaseCl_def ExtCl_def MainCl_def) |
314 apply (auto dest!: tranclD subcls1D simp add: BaseCl_def ExtCl_def MainCl_def) |
315 apply (drule rtranclD) |
315 apply (drule rtranclD) |
316 apply auto |
316 apply auto |
317 done |
317 done |
433 lemma fields_tprg_SXcpt [simp]: "DeclConcepts.fields tprg (SXcpt xn) = []" |
433 lemma fields_tprg_SXcpt [simp]: "DeclConcepts.fields tprg (SXcpt xn) = []" |
434 apply (case_tac "xn = Throwable") |
434 apply (case_tac "xn = Throwable") |
435 apply (simp (no_asm_simp)) |
435 apply (simp (no_asm_simp)) |
436 by (rule ws_tprg [THEN fields_emptyI], force+) |
436 by (rule ws_tprg [THEN fields_emptyI], force+) |
437 |
437 |
438 lemmas fields_rec_ = fields_rec [OF _ ws_tprg] |
438 lemmas fields_rec' = fields_rec [OF _ ws_tprg] |
439 |
439 |
440 lemma fields_Base [simp]: |
440 lemma fields_Base [simp]: |
441 "DeclConcepts.fields tprg Base |
441 "DeclConcepts.fields tprg Base |
442 = [((arr,Base), \<lparr>access=Public,static=True ,type=PrimT Boolean.[]\<rparr>), |
442 = [((arr,Base), \<lparr>access=Public,static=True ,type=PrimT Boolean.[]\<rparr>), |
443 ((vee,Base), \<lparr>access=Public,static=False,type=Iface HasFoo \<rparr>)]" |
443 ((vee,Base), \<lparr>access=Public,static=False,type=Iface HasFoo \<rparr>)]" |
444 apply (subst fields_rec_) |
444 apply (subst fields_rec') |
445 apply (auto simp add: BaseCl_def) |
445 apply (auto simp add: BaseCl_def) |
446 done |
446 done |
447 |
447 |
448 lemma fields_Ext [simp]: |
448 lemma fields_Ext [simp]: |
449 "DeclConcepts.fields tprg Ext |
449 "DeclConcepts.fields tprg Ext |
450 = [((vee,Ext), \<lparr>access=Public,static=False,type= PrimT Integer\<rparr>)] |
450 = [((vee,Ext), \<lparr>access=Public,static=False,type= PrimT Integer\<rparr>)] |
451 @ DeclConcepts.fields tprg Base" |
451 @ DeclConcepts.fields tprg Base" |
452 apply (rule trans) |
452 apply (rule trans) |
453 apply (rule fields_rec_) |
453 apply (rule fields_rec') |
454 apply (auto simp add: ExtCl_def Object_def) |
454 apply (auto simp add: ExtCl_def Object_def) |
455 done |
455 done |
456 |
456 |
457 lemmas imethds_rec_ = imethds_rec [OF _ ws_tprg] |
457 lemmas imethds_rec' = imethds_rec [OF _ ws_tprg] |
458 lemmas methd_rec_ = methd_rec [OF _ ws_tprg] |
458 lemmas methd_rec' = methd_rec [OF _ ws_tprg] |
459 |
459 |
460 lemma imethds_HasFoo [simp]: |
460 lemma imethds_HasFoo [simp]: |
461 "imethds tprg HasFoo = o2s \<circ> empty(foo_sig\<mapsto>(HasFoo, foo_mhead))" |
461 "imethds tprg HasFoo = o2s \<circ> empty(foo_sig\<mapsto>(HasFoo, foo_mhead))" |
462 apply (rule trans) |
462 apply (rule trans) |
463 apply (rule imethds_rec_) |
463 apply (rule imethds_rec') |
464 apply (auto simp add: HasFooInt_def) |
464 apply (auto simp add: HasFooInt_def) |
465 done |
465 done |
466 |
466 |
467 lemma methd_tprg_Object [simp]: "methd tprg Object = empty" |
467 lemma methd_tprg_Object [simp]: "methd tprg Object = empty" |
468 apply (subst methd_rec_) |
468 apply (subst methd_rec') |
469 apply (auto simp add: Object_mdecls_def) |
469 apply (auto simp add: Object_mdecls_def) |
470 done |
470 done |
471 |
471 |
472 lemma methd_Base [simp]: |
472 lemma methd_Base [simp]: |
473 "methd tprg Base = table_of [(\<lambda>(s,m). (s, Base, m)) Base_foo]" |
473 "methd tprg Base = table_of [(\<lambda>(s,m). (s, Base, m)) Base_foo]" |
474 apply (rule trans) |
474 apply (rule trans) |
475 apply (rule methd_rec_) |
475 apply (rule methd_rec') |
476 apply (auto simp add: BaseCl_def) |
476 apply (auto simp add: BaseCl_def) |
477 done |
477 done |
478 |
478 |
479 lemma memberid_Base_foo_simp [simp]: |
479 lemma memberid_Base_foo_simp [simp]: |
480 "memberid (mdecl Base_foo) = mid foo_sig" |
480 "memberid (mdecl Base_foo) = mid foo_sig" |