src/HOL/Tools/Quotient/quotient_type.ML
changeset 45795 2d8949268303
parent 45698 fd8e140ae879
child 45835 14bf7ca4ef3a
equal deleted inserted replaced
45793:331ebffe0593 45795:2d8949268303
   195   in
   195   in
   196     if null errs then () else error (cat_lines errs)
   196     if null errs then () else error (cat_lines errs)
   197   end
   197   end
   198 
   198 
   199 (* check for existence of map functions *)
   199 (* check for existence of map functions *)
   200 fun map_check thy (_, (rty, _, _), _) =
   200 fun map_check ctxt (_, (rty, _, _), _) =
   201   let
   201   let
   202     fun map_check_aux rty warns =
   202     fun map_check_aux rty warns =
   203       (case rty of
   203       (case rty of
   204         Type (_, []) => warns
   204         Type (_, []) => warns
   205       | Type (s, _) =>
   205       | Type (s, _) =>
   206           if is_some (Quotient_Info.lookup_quotmaps_global thy s) then warns else s :: warns
   206           if Symtab.defined (Enriched_Type.entries ctxt) s then warns else s :: warns
   207       | _ => warns)
   207       | _ => warns)
   208 
   208 
   209     val warns = map_check_aux rty []
   209     val warns = map_check_aux rty []
   210   in
   210   in
   211     if null warns then ()
   211     if null warns then ()
   232 
   232 
   233 fun quotient_type quot_list lthy =
   233 fun quotient_type quot_list lthy =
   234   let
   234   let
   235     (* sanity check *)
   235     (* sanity check *)
   236     val _ = List.app sanity_check quot_list
   236     val _ = List.app sanity_check quot_list
   237     val _ = List.app (map_check (Proof_Context.theory_of lthy)) quot_list
   237     val _ = List.app (map_check lthy) quot_list
   238 
   238 
   239     fun mk_goal (rty, rel, partial) =
   239     fun mk_goal (rty, rel, partial) =
   240       let
   240       let
   241         val equivp_ty = ([rty, rty] ---> @{typ bool}) --> @{typ bool}
   241         val equivp_ty = ([rty, rty] ---> @{typ bool}) --> @{typ bool}
   242         val const =
   242         val const =