31 type thmtab; |
31 type thmtab; |
32 val mk_thmtab: theory -> (string * typ) list -> thmtab; |
32 val mk_thmtab: theory -> (string * typ) list -> thmtab; |
33 val get_dtyp_of_cons: thmtab -> string * typ -> string option; |
33 val get_dtyp_of_cons: thmtab -> string * typ -> string option; |
34 val get_dtyp_spec: thmtab -> string |
34 val get_dtyp_spec: thmtab -> string |
35 -> ((string * sort) list * (string * typ list) list) option; |
35 -> ((string * sort) list * (string * typ list) list) option; |
|
36 val get_fun_typs: thmtab -> ((string * typ list) * typ) list; |
36 val get_fun_thms: thmtab -> string * typ -> thm list; |
37 val get_fun_thms: thmtab -> string * typ -> thm list; |
37 |
38 |
38 val pretty_funtab: theory -> thm list CodegenConsts.Consttab.table -> Pretty.T; |
39 val pretty_funtab: theory -> thm list CodegenConsts.Consttab.table -> Pretty.T; |
39 val print_thms: theory -> unit; |
40 val print_thms: theory -> unit; |
40 |
41 |
763 is_some o Consttab.lookup funtab o CodegenConsts.norminst_of_typ thy; |
764 is_some o Consttab.lookup funtab o CodegenConsts.norminst_of_typ thy; |
764 |
765 |
765 fun get_fun_thms (thy, (funtab, _), _) (c_ty as (c, _)) = |
766 fun get_fun_thms (thy, (funtab, _), _) (c_ty as (c, _)) = |
766 (check_thms c o these o Consttab.lookup funtab |
767 (check_thms c o these o Consttab.lookup funtab |
767 o CodegenConsts.norminst_of_typ thy) c_ty; |
768 o CodegenConsts.norminst_of_typ thy) c_ty; |
|
769 |
|
770 fun get_fun_typs (thy, (funtab, dtcotab), _) = |
|
771 (Consttab.dest funtab |
|
772 |> map (fn (c, thm :: _) => (c, extr_typ thy thm) |
|
773 | (c as (name, _), []) => (c, case AxClass.class_of_param thy name |
|
774 of SOME class => (case ClassPackage.the_consts_sign thy class of (v, cs) => |
|
775 (Logic.varifyT o map_type_tfree (fn u as (w, _) => |
|
776 if w = v then TFree (v, [class]) else TFree u)) |
|
777 ((the o AList.lookup (op =) cs) name)) |
|
778 | NONE => Sign.the_const_type thy name))) |
|
779 @ (Consttab.keys dtcotab |
|
780 |> AList.make (Sign.const_instance thy)); |
768 |
781 |
769 fun pretty_funtab thy funtab = |
782 fun pretty_funtab thy funtab = |
770 funtab |
783 funtab |
771 |> CodegenConsts.Consttab.dest |
784 |> CodegenConsts.Consttab.dest |
772 |> map (fn (c, thms) => |
785 |> map (fn (c, thms) => |