equal
deleted
inserted
replaced
155 fun instances_of thy algebra insts = |
155 fun instances_of thy algebra insts = |
156 let |
156 let |
157 val thy_classes = (#classes o Sorts.rep_algebra o Sign.classes_of) thy; |
157 val thy_classes = (#classes o Sorts.rep_algebra o Sign.classes_of) thy; |
158 fun all_classparams tyco class = |
158 fun all_classparams tyco class = |
159 these (try (#params o AxClass.get_info thy) class) |
159 these (try (#params o AxClass.get_info thy) class) |
160 |> map (fn (c, _) => Class.inst_const thy (c, tyco)) |
160 |> map (fn (c, _) => Class.param_of_inst thy (c, tyco)) |
161 in |
161 in |
162 Symtab.empty |
162 Symtab.empty |
163 |> fold (fn (tyco, class) => |
163 |> fold (fn (tyco, class) => |
164 Symtab.map_default (tyco, []) (insert (op =) class)) insts |
164 Symtab.map_default (tyco, []) (insert (op =) class)) insts |
165 |> (fn tab => Symtab.fold (fn (tyco, classes) => append (maps (all_classparams tyco) |
165 |> (fn tab => Symtab.fold (fn (tyco, classes) => append (maps (all_classparams tyco) |
209 let |
209 let |
210 val funcss = raw_funcss |
210 val funcss = raw_funcss |
211 |> resort_funcss thy algebra funcgr |
211 |> resort_funcss thy algebra funcgr |
212 |> filter_out (can (Graph.get_node funcgr) o fst); |
212 |> filter_out (can (Graph.get_node funcgr) o fst); |
213 fun typ_func c [] = Code.default_typ thy c |
213 fun typ_func c [] = Code.default_typ thy c |
214 | typ_func c (thms as thm :: _) = case Class.param_const thy c |
214 | typ_func c (thms as thm :: _) = case Class.inst_of_param thy c |
215 of SOME (c', tyco) => |
215 of SOME (c', tyco) => |
216 let |
216 let |
217 val (_, ty) = CodeUnit.head_func thm; |
217 val (_, ty) = CodeUnit.head_func thm; |
218 val SOME class = AxClass.class_of_param thy c'; |
218 val SOME class = AxClass.class_of_param thy c'; |
219 val sorts_decl = Sorts.mg_domain algebra tyco [class]; |
219 val sorts_decl = Sorts.mg_domain algebra tyco [class]; |