src/HOL/Tools/BNF/bnf_lfp_size.ML
changeset 66251 cd935b7cb3fb
parent 64532 fc2835a932d9
child 66494 8645dc296dca
equal deleted inserted replaced
66250:56a87a5093be 66251:cd935b7cb3fb
   353                 replicate nn [];
   353                 replicate nn [];
   354           in
   354           in
   355             size_gen_o_map_thmss
   355             size_gen_o_map_thmss
   356           end;
   356           end;
   357 
   357 
   358       (* Ideally, the "[code]" attribute would be generated only if the "code" plugin is enabled. *)
       
   359       val code_attrs = Code.add_default_eqn_attrib Code.Equation;
       
   360 
       
   361       val massage_multi_notes =
   358       val massage_multi_notes =
   362         maps (fn (thmN, thmss, attrs) =>
   359         maps (fn (thmN, thmss, attrs) =>
   363           map2 (fn T_name => fn thms =>
   360           map2 (fn T_name => fn thms =>
   364               ((Binding.qualify true (Long_Name.base_name T_name) (Binding.name thmN), attrs),
   361               ((Binding.qualify true (Long_Name.base_name T_name) (Binding.name thmN), attrs),
   365                [(thms, [])]))
   362                [(thms, [])]))
   366             T_names thmss)
   363             T_names thmss)
   367         #> filter_out (null o fst o hd o snd);
   364         #> filter_out (null o fst o hd o snd);
   368 
   365 
   369       val notes =
   366       val notes =
   370         [(sizeN, size_thmss, code_attrs :: nitpicksimp_attrs @ simp_attrs),
   367         [(sizeN, size_thmss, nitpicksimp_attrs @ simp_attrs),
   371          (size_genN, size_gen_thmss, []),
   368          (size_genN, size_gen_thmss, []),
   372          (size_gen_o_mapN, size_gen_o_map_thmss, []),
   369          (size_gen_o_mapN, size_gen_o_map_thmss, []),
   373          (size_neqN, size_neq_thmss, [])]
   370          (size_neqN, size_neq_thmss, [])]
   374         |> massage_multi_notes;
   371         |> massage_multi_notes;
   375 
   372 
   376       val (noted, lthy3) =
   373       val (noted, lthy3) =
   377         lthy2
   374         lthy2
   378         |> Spec_Rules.add Spec_Rules.Equational (size_consts, size_simps)
   375         |> Spec_Rules.add Spec_Rules.Equational (size_consts, size_simps)
   379         |> Spec_Rules.add Spec_Rules.Equational (overloaded_size_consts, overloaded_size_simps)
   376         |> Spec_Rules.add Spec_Rules.Equational (overloaded_size_consts, overloaded_size_simps)
       
   377         |> Code.declare_default_eqns (map (rpair true) (flat size_thmss))
       
   378           (*Ideally, this would only be issued if the "code" plugin is enabled.*)
   380         |> Local_Theory.notes notes;
   379         |> Local_Theory.notes notes;
   381 
   380 
   382       val phi0 = substitute_noted_thm noted;
   381       val phi0 = substitute_noted_thm noted;
   383     in
   382     in
   384       lthy3
   383       lthy3