436 fold (fn atom => fn thy => |
436 fold (fn atom => fn thy => |
437 let val pt_name = pt_class_of thy atom |
437 let val pt_name = pt_class_of thy atom |
438 in |
438 in |
439 fold (fn (s, tvs) => fn thy => Axclass.prove_arity |
439 fold (fn (s, tvs) => fn thy => Axclass.prove_arity |
440 (s, map (inter_sort thy [pt_name] o snd) tvs, [pt_name]) |
440 (s, map (inter_sort thy [pt_name] o snd) tvs, [pt_name]) |
441 (fn _ => EVERY |
441 (fn ctxt => EVERY |
442 [Class.intro_classes_tac [], |
442 [Class.intro_classes_tac [], |
443 resolve_tac perm_empty_thms 1, |
443 resolve_tac perm_empty_thms 1, |
444 resolve_tac perm_append_thms 1, |
444 resolve_tac perm_append_thms 1, |
445 resolve_tac perm_eq_thms 1, assume_tac 1]) thy) |
445 resolve_tac perm_eq_thms 1, assume_tac ctxt 1]) thy) |
446 (full_new_type_names' ~~ tyvars) thy |
446 (full_new_type_names' ~~ tyvars) thy |
447 end) atoms |> |
447 end) atoms |> |
448 Global_Theory.add_thmss |
448 Global_Theory.add_thmss |
449 [((Binding.name (space_implode "_" new_type_names ^ "_unfolded_perm_eq"), |
449 [((Binding.name (space_implode "_" new_type_names ^ "_unfolded_perm_eq"), |
450 unfolded_perm_eq_thms), [Simplifier.simp_add]), |
450 unfolded_perm_eq_thms), [Simplifier.simp_add]), |
560 end) (rep_set_names'' ~~ recTs' ~~ perm_indnames'))))) |
560 end) (rep_set_names'' ~~ recTs' ~~ perm_indnames'))))) |
561 (fn {context = ctxt, ...} => EVERY |
561 (fn {context = ctxt, ...} => EVERY |
562 [Old_Datatype_Aux.ind_tac rep_induct [] 1, |
562 [Old_Datatype_Aux.ind_tac rep_induct [] 1, |
563 ALLGOALS (simp_tac (ctxt addsimps |
563 ALLGOALS (simp_tac (ctxt addsimps |
564 (Thm.symmetric perm_fun_def :: abs_perm))), |
564 (Thm.symmetric perm_fun_def :: abs_perm))), |
565 ALLGOALS (resolve_tac rep_intrs THEN_ALL_NEW assume_tac)])), |
565 ALLGOALS (resolve_tac rep_intrs THEN_ALL_NEW assume_tac ctxt)])), |
566 length new_type_names)); |
566 length new_type_names)); |
567 |
567 |
568 val perm_closed_thmss = map mk_perm_closed atoms; |
568 val perm_closed_thmss = map mk_perm_closed atoms; |
569 |
569 |
570 (**** typedef ****) |
570 (**** typedef ****) |
1719 (HOLogic.mk_Trueprop (foldr1 HOLogic.mk_conj |
1719 (HOLogic.mk_Trueprop (foldr1 HOLogic.mk_conj |
1720 (map (fn (((x, y), S), P) => HOLogic.mk_imp |
1720 (map (fn (((x, y), S), P) => HOLogic.mk_imp |
1721 (S $ Free x $ Free y, P $ (Free y))) |
1721 (S $ Free x $ Free y, P $ (Free y))) |
1722 (rec_unique_frees'' ~~ rec_unique_frees' ~~ |
1722 (rec_unique_frees'' ~~ rec_unique_frees' ~~ |
1723 rec_sets ~~ rec_preds))))) |
1723 rec_sets ~~ rec_preds))))) |
1724 (fn _ => |
1724 (fn {context = ctxt, ...} => |
1725 rtac rec_induct 1 THEN |
1725 rtac rec_induct 1 THEN |
1726 REPEAT ((resolve_tac P_ind_ths THEN_ALL_NEW assume_tac) 1)))); |
1726 REPEAT ((resolve_tac P_ind_ths THEN_ALL_NEW assume_tac ctxt) 1)))); |
1727 val rec_fin_supp_thms' = map |
1727 val rec_fin_supp_thms' = map |
1728 (fn (ths, (T, fin_ths)) => (T, map (curry op MRS fin_ths) ths)) |
1728 (fn (ths, (T, fin_ths)) => (T, map (curry op MRS fin_ths) ths)) |
1729 (rec_fin_supp_thms ~~ finite_thss); |
1729 (rec_fin_supp_thms ~~ finite_thss); |
1730 in EVERY |
1730 in EVERY |
1731 ([rtac induct_aux_rec 1] @ |
1731 ([rtac induct_aux_rec 1] @ |