src/HOL/Tools/BNF/bnf_lfp_compat.ML
changeset 58665 50b229a5a097
parent 58659 6c9821c32dd5
child 58684 56b9eab818ca
equal deleted inserted replaced
58664:4e4a4c758f9c 58665:50b229a5a097
   497     |> Local_Theory.raw_theory register_interpret
   497     |> Local_Theory.raw_theory register_interpret
   498     |> Local_Theory.notes all_notes
   498     |> Local_Theory.notes all_notes
   499     |> snd
   499     |> snd
   500   end;
   500   end;
   501 
   501 
   502 val datatype_compat_global = map_local_theory o datatype_compat;
   502 val datatype_compat_global = Named_Target.theory_map o datatype_compat;
   503 
   503 
   504 fun datatype_compat_cmd raw_fpT_names lthy =
   504 fun datatype_compat_cmd raw_fpT_names lthy =
   505   let
   505   let
   506     val fpT_names =
   506     val fpT_names =
   507       map (fst o dest_Type o Proof_Context.read_type_name {proper = true, strict = false} lthy)
   507       map (fst o dest_Type o Proof_Context.read_type_name {proper = true, strict = false} lthy)
   525 
   525 
   526     val new_specs = map new_spec_of old_specs;
   526     val new_specs = map new_spec_of old_specs;
   527   in
   527   in
   528     (fpT_names,
   528     (fpT_names,
   529      thy
   529      thy
   530      |> map_local_theory (co_datatypes Least_FP construct_lfp (default_ctr_options, new_specs))
   530      |> Named_Target.theory_map
       
   531        (co_datatypes Least_FP construct_lfp (default_ctr_options, new_specs))
   531      |> not (member (op =) prefs Keep_Nesting) ? perhaps (try (datatype_compat_global fpT_names)))
   532      |> not (member (op =) prefs Keep_Nesting) ? perhaps (try (datatype_compat_global fpT_names)))
   532   end;
   533   end;
   533 
   534 
   534 val add_primrec = apfst (apsnd flat) ooo BNF_LFP_Rec_Sugar.add_primrec;
   535 val add_primrec = apfst (apsnd flat) ooo BNF_LFP_Rec_Sugar.add_primrec;
   535 val add_primrec_global = apfst (apsnd flat) ooo BNF_LFP_Rec_Sugar.add_primrec_global;
   536 val add_primrec_global = apfst (apsnd flat) ooo BNF_LFP_Rec_Sugar.add_primrec_global;