597 else error ("Missing instance proof for type " ^ quote (Proof_Context.markup_type lthy tyco))); |
597 else error ("Missing instance proof for type " ^ quote (Proof_Context.markup_type lthy tyco))); |
598 in lthy end; |
598 in lthy end; |
599 |
599 |
600 fun instantiation (tycos, vs, sort) thy = |
600 fun instantiation (tycos, vs, sort) thy = |
601 let |
601 let |
602 val naming = Sign.naming_of thy; |
|
603 |
|
604 val _ = if null tycos then error "At least one arity must be given" else (); |
602 val _ = if null tycos then error "At least one arity must be given" else (); |
605 val class_params = these_params thy (filter (can (Axclass.get_info thy)) sort); |
603 val class_params = these_params thy (filter (can (Axclass.get_info thy)) sort); |
606 fun get_param tyco (param, (_, (c, ty))) = |
604 fun get_param tyco (param, (_, (c, ty))) = |
607 if can (Axclass.param_of_inst thy) (c, tyco) |
605 if can (Axclass.param_of_inst thy) (c, tyco) |
608 then NONE else SOME ((c, tyco), |
606 then NONE else SOME ((c, tyco), |
635 |> (Overloading.map_improvable_syntax o apfst) |
633 |> (Overloading.map_improvable_syntax o apfst) |
636 (K ((primary_constraints, []), (((improve, K NONE), false), []))) |
634 (K ((primary_constraints, []), (((improve, K NONE), false), []))) |
637 |> Overloading.activate_improvable_syntax |
635 |> Overloading.activate_improvable_syntax |
638 |> Context.proof_map (Syntax_Phases.term_check 0 "resorting" resort_check) |
636 |> Context.proof_map (Syntax_Phases.term_check 0 "resorting" resort_check) |
639 |> synchronize_inst_syntax |
637 |> synchronize_inst_syntax |
640 |> Local_Theory.init naming |
638 |> Local_Theory.init (Sign.naming_of thy) |
641 {define = Generic_Target.define foundation, |
639 {define = Generic_Target.define foundation, |
642 notes = Generic_Target.notes Generic_Target.theory_notes, |
640 notes = Generic_Target.notes Generic_Target.theory_notes, |
643 abbrev = Generic_Target.abbrev Generic_Target.theory_abbrev, |
641 abbrev = Generic_Target.abbrev Generic_Target.theory_abbrev, |
644 declaration = K Generic_Target.theory_declaration, |
642 declaration = K Generic_Target.theory_declaration, |
645 subscription = Generic_Target.theory_registration, |
643 subscription = Generic_Target.theory_registration, |