src/HOL/Tools/BNF/bnf_fp_def_sugar.ML
changeset 58582 a408c72a849c
parent 58581 e2e2d775869c
child 58583 1dd83cbba636
equal deleted inserted replaced
58581:e2e2d775869c 58582:a408c72a849c
   647       val other_half_rel_distinct_thmss =
   647       val other_half_rel_distinct_thmss =
   648         map (map mk_other_half_rel_distinct_thm) half_rel_distinct_thmss;
   648         map (map mk_other_half_rel_distinct_thm) half_rel_distinct_thmss;
   649       val (rel_distinct_thms, _) =
   649       val (rel_distinct_thms, _) =
   650         join_halves n half_rel_distinct_thmss other_half_rel_distinct_thmss;
   650         join_halves n half_rel_distinct_thmss other_half_rel_distinct_thmss;
   651 
   651 
   652       val rel_eq_thms =
   652       val rel_code_thms =
   653         map (fn thm => thm RS @{thm eq_False[THEN iffD2]}) rel_distinct_thms @
   653         map (fn thm => thm RS @{thm eq_False[THEN iffD2]}) rel_distinct_thms @
   654         map2 (fn thm => fn 0 => thm RS @{thm eq_True[THEN iffD2]} | _ => thm) rel_inject_thms ms;
   654         map2 (fn thm => fn 0 => thm RS @{thm eq_True[THEN iffD2]} | _ => thm) rel_inject_thms ms;
   655 
   655 
   656       val ctr_transfer_thms =
   656       val ctr_transfer_thms =
   657         let val goals = map2 (mk_parametricity_goal names_lthy Rs) ctrAs ctrBs in
   657         let val goals = map2 (mk_parametricity_goal names_lthy Rs) ctrAs ctrBs in
   984         end;
   984         end;
   985 
   985 
   986       val code_attrs = if plugins code_plugin then [Code.add_default_eqn_attrib] else [];
   986       val code_attrs = if plugins code_plugin then [Code.add_default_eqn_attrib] else [];
   987 
   987 
   988       val anonymous_notes =
   988       val anonymous_notes =
   989         [(rel_eq_thms, code_attrs @ nitpicksimp_attrs)]
   989         [(rel_code_thms, code_attrs @ nitpicksimp_attrs)]
   990         |> map (fn (thms, attrs) => ((Binding.empty, attrs), [(thms, [])]));
   990         |> map (fn (thms, attrs) => ((Binding.empty, attrs), [(thms, [])]));
   991 
   991 
   992       val notes =
   992       val notes =
   993         [(case_transferN, [case_transfer_thm], K []),
   993         [(case_transferN, [case_transfer_thm], K []),
   994          (ctr_transferN, ctr_transfer_thms, K []),
   994          (ctr_transferN, ctr_transfer_thms, K []),
  1009 
  1009 
  1010       val (noted, lthy') =
  1010       val (noted, lthy') =
  1011         lthy
  1011         lthy
  1012         |> Spec_Rules.add Spec_Rules.Equational (`(single o lhs_head_of o hd) map_thms)
  1012         |> Spec_Rules.add Spec_Rules.Equational (`(single o lhs_head_of o hd) map_thms)
  1013         |> fp = Least_FP
  1013         |> fp = Least_FP
  1014           ? Spec_Rules.add Spec_Rules.Equational (`(single o lhs_head_of o hd) rel_eq_thms)
  1014           ? Spec_Rules.add Spec_Rules.Equational (`(single o lhs_head_of o hd) rel_code_thms)
  1015         |> Spec_Rules.add Spec_Rules.Equational (`(single o lhs_head_of o hd) set0_thms)
  1015         |> Spec_Rules.add Spec_Rules.Equational (`(single o lhs_head_of o hd) set0_thms)
  1016         |> Local_Theory.notes (anonymous_notes @ notes);
  1016         |> Local_Theory.notes (anonymous_notes @ notes);
  1017 
  1017 
  1018       val subst = Morphism.thm (substitute_noted_thm noted);
  1018       val subst = Morphism.thm (substitute_noted_thm noted);
  1019     in
  1019     in