src/HOL/Tools/BNF/bnf_gfp_grec_sugar.ML
changeset 63352 4eaf35781b23
parent 63285 e9c777bfd78c
child 63391 6840e808fe44
equal deleted inserted replaced
63347:e344dc82f6c2 63352:4eaf35781b23
   283 fun mk_abs_rep_transfers ctxt fpT_name =
   283 fun mk_abs_rep_transfers ctxt fpT_name =
   284   [mk_abs_transfer ctxt fpT_name, mk_rep_transfer ctxt fpT_name]
   284   [mk_abs_transfer ctxt fpT_name, mk_rep_transfer ctxt fpT_name]
   285   handle Fail _ => [];
   285   handle Fail _ => [];
   286 
   286 
   287 fun set_transfer_rule_attrs thms =
   287 fun set_transfer_rule_attrs thms =
   288   snd o Local_Theory.notes [((Binding.empty, []), [(thms, transfer_rule_attrs)])];
   288   snd o Local_Theory.notes [(Binding.empty_atts, [(thms, transfer_rule_attrs)])];
   289 
   289 
   290 fun ensure_codatatype_extra fpT_name ctxt =
   290 fun ensure_codatatype_extra fpT_name ctxt =
   291   (case codatatype_extra_of ctxt fpT_name of
   291   (case codatatype_extra_of ctxt fpT_name of
   292     NONE =>
   292     NONE =>
   293     let val abs_rep_transfers = mk_abs_rep_transfers ctxt fpT_name in
   293     let val abs_rep_transfers = mk_abs_rep_transfers ctxt fpT_name in
  1993     val _ = can the_single raw_fixes orelse
  1993     val _ = can the_single raw_fixes orelse
  1994       error "Mutually corecursive functions not supported";
  1994       error "Mutually corecursive functions not supported";
  1995 
  1995 
  1996     val (plugins, friend, transfer) = get_options lthy opts;
  1996     val (plugins, friend, transfer) = get_options lthy opts;
  1997     val ([((b, fun_T), mx)], [(_, eq)]) =
  1997     val ([((b, fun_T), mx)], [(_, eq)]) =
  1998       fst (Specification.read_multi_specs raw_fixes [((Attrib.empty_binding, raw_eq), [], [])] lthy);
  1998       fst (Specification.read_multi_specs raw_fixes [((Binding.empty_atts, raw_eq), [], [])] lthy);
  1999 
  1999 
  2000     val _ = Sign.of_sort (Proof_Context.theory_of lthy) (fun_T, @{sort type}) orelse
  2000     val _ = Sign.of_sort (Proof_Context.theory_of lthy) (fun_T, @{sort type}) orelse
  2001       error ("Type of " ^ Binding.print b ^ " contains top sort");
  2001       error ("Type of " ^ Binding.print b ^ " contains top sort");
  2002 
  2002 
  2003     val (arg_Ts, res_T) = strip_type fun_T;
  2003     val (arg_Ts, res_T) = strip_type fun_T;