195 val tname' = Long_Name.base_name tname |
195 val tname' = Long_Name.base_name tname |
196 val uname' = Long_Name.base_name uname |
196 val uname' = Long_Name.base_name uname |
197 in |
197 in |
198 if pi1 <> pi2 then (* only apply the composition rule in this case *) |
198 if pi1 <> pi2 then (* only apply the composition rule in this case *) |
199 if T = U then |
199 if T = U then |
200 SOME (Drule.instantiate' |
200 SOME (Thm.instantiate' |
201 [SOME (Thm.global_ctyp_of thy (fastype_of t))] |
201 [SOME (Thm.global_ctyp_of thy (fastype_of t))] |
202 [SOME (Thm.global_cterm_of thy pi1), SOME (Thm.global_cterm_of thy pi2), SOME (Thm.global_cterm_of thy t)] |
202 [SOME (Thm.global_cterm_of thy pi1), SOME (Thm.global_cterm_of thy pi2), SOME (Thm.global_cterm_of thy t)] |
203 (mk_meta_eq ([Global_Theory.get_thm thy ("pt_"^tname'^"_inst"), |
203 (mk_meta_eq ([Global_Theory.get_thm thy ("pt_"^tname'^"_inst"), |
204 Global_Theory.get_thm thy ("at_"^tname'^"_inst")] MRS pt_perm_compose_aux))) |
204 Global_Theory.get_thm thy ("at_"^tname'^"_inst")] MRS pt_perm_compose_aux))) |
205 else |
205 else |
206 SOME (Drule.instantiate' |
206 SOME (Thm.instantiate' |
207 [SOME (Thm.global_ctyp_of thy (fastype_of t))] |
207 [SOME (Thm.global_ctyp_of thy (fastype_of t))] |
208 [SOME (Thm.global_cterm_of thy pi1), SOME (Thm.global_cterm_of thy pi2), SOME (Thm.global_cterm_of thy t)] |
208 [SOME (Thm.global_cterm_of thy pi1), SOME (Thm.global_cterm_of thy pi2), SOME (Thm.global_cterm_of thy t)] |
209 (mk_meta_eq (Global_Theory.get_thm thy ("cp_"^tname'^"_"^uname'^"_inst") RS |
209 (mk_meta_eq (Global_Theory.get_thm thy ("cp_"^tname'^"_"^uname'^"_inst") RS |
210 cp1_aux))) |
210 cp1_aux))) |
211 else NONE |
211 else NONE |