701 |
701 |
702 val cxIns = map2 (mk_cIn ctor) ks xss; |
702 val cxIns = map2 (mk_cIn ctor) ks xss; |
703 val cyIns = map2 (mk_cIn (Term.map_types B_ify_T ctor)) ks yss; |
703 val cyIns = map2 (mk_cIn (Term.map_types B_ify_T ctor)) ks yss; |
704 |
704 |
705 fun mk_map_thm ctr_def' cxIn = |
705 fun mk_map_thm ctr_def' cxIn = |
706 fold_thms lthy [ctr_def'] |
706 Local_Defs.fold lthy [ctr_def'] |
707 (unfold_thms lthy (o_apply :: pre_map_def :: |
707 (unfold_thms lthy (o_apply :: pre_map_def :: |
708 (if fp = Least_FP then [] else [dtor_ctor]) @ sumprod_thms_map @ abs_inverses) |
708 (if fp = Least_FP then [] else [dtor_ctor]) @ sumprod_thms_map @ abs_inverses) |
709 (infer_instantiate' lthy (map (SOME o Thm.cterm_of lthy) fs @ [SOME cxIn]) |
709 (infer_instantiate' lthy (map (SOME o Thm.cterm_of lthy) fs @ [SOME cxIn]) |
710 (if fp = Least_FP then fp_map_thm |
710 (if fp = Least_FP then fp_map_thm |
711 else fp_map_thm RS ctor_cong RS (ctor_dtor RS sym RS trans)))) |
711 else fp_map_thm RS ctor_cong RS (ctor_dtor RS sym RS trans)))) |
712 |> singleton (Proof_Context.export names_lthy lthy); |
712 |> singleton (Proof_Context.export names_lthy lthy); |
713 |
713 |
714 fun mk_set0_thm fp_set_thm ctr_def' cxIn = |
714 fun mk_set0_thm fp_set_thm ctr_def' cxIn = |
715 fold_thms lthy [ctr_def'] |
715 Local_Defs.fold lthy [ctr_def'] |
716 (unfold_thms lthy (pre_set_defs @ fp_nesting_set_maps @ live_nesting_set_maps @ |
716 (unfold_thms lthy (pre_set_defs @ fp_nesting_set_maps @ live_nesting_set_maps @ |
717 (if fp = Least_FP then [] else [dtor_ctor]) @ basic_sumprod_thms_set @ |
717 (if fp = Least_FP then [] else [dtor_ctor]) @ basic_sumprod_thms_set @ |
718 @{thms UN_Un sup_assoc[THEN sym]} @ abs_inverses) |
718 @{thms UN_Un sup_assoc[THEN sym]} @ abs_inverses) |
719 (infer_instantiate' lthy [SOME cxIn] fp_set_thm)) |
719 (infer_instantiate' lthy [SOME cxIn] fp_set_thm)) |
720 |> singleton (Proof_Context.export names_lthy lthy); |
720 |> singleton (Proof_Context.export names_lthy lthy); |
728 |> map (unfold_thms lthy @{thms insert_is_Un[THEN sym] Un_empty_left Un_insert_left}); |
728 |> map (unfold_thms lthy @{thms insert_is_Un[THEN sym] Un_empty_left Un_insert_left}); |
729 |
729 |
730 val rel_infos = (ctr_defs' ~~ cxIns, ctr_defs' ~~ cyIns); |
730 val rel_infos = (ctr_defs' ~~ cxIns, ctr_defs' ~~ cyIns); |
731 |
731 |
732 fun mk_rel_thm postproc ctr_defs' cxIn cyIn = |
732 fun mk_rel_thm postproc ctr_defs' cxIn cyIn = |
733 fold_thms lthy ctr_defs' |
733 Local_Defs.fold lthy ctr_defs' |
734 (unfold_thms lthy (pre_rel_def :: abs_inverses @ |
734 (unfold_thms lthy (pre_rel_def :: abs_inverses @ |
735 (if fp = Least_FP then [] else [dtor_ctor]) @ sumprod_thms_rel @ |
735 (if fp = Least_FP then [] else [dtor_ctor]) @ sumprod_thms_rel @ |
736 @{thms vimage2p_def sum.inject sum.distinct(1)[THEN eq_False[THEN iffD2]]}) |
736 @{thms vimage2p_def sum.inject sum.distinct(1)[THEN eq_False[THEN iffD2]]}) |
737 (infer_instantiate' lthy (map (SOME o Thm.cterm_of lthy) Rs @ [SOME cxIn, SOME cyIn]) |
737 (infer_instantiate' lthy (map (SOME o Thm.cterm_of lthy) Rs @ [SOME cxIn, SOME cyIn]) |
738 fp_rel_thm)) |
738 fp_rel_thm)) |