src/HOL/Tools/BNF/bnf_fp_n2m.ML
changeset 58375 7b92932ffea5
parent 58352 37745650a3f4
child 58446 e89f57d1e46c
equal deleted inserted replaced
58374:1b4d31b7bd10 58375:7b92932ffea5
   180       end;
   180       end;
   181 
   181 
   182     val castAs = map2 (curry HOLogic.mk_comp) absAs fp_repAs;
   182     val castAs = map2 (curry HOLogic.mk_comp) absAs fp_repAs;
   183     val castBs = map2 (curry HOLogic.mk_comp) absBs fp_repBs;
   183     val castBs = map2 (curry HOLogic.mk_comp) absBs fp_repBs;
   184 
   184 
   185     val rel_eqs = no_refl (map rel_eq_of_bnf fp_or_nesting_bnfs);
   185     val fp_or_nesting_rel_eqs = no_refl (map rel_eq_of_bnf fp_or_nesting_bnfs);
       
   186     val fp_or_nesting_rel_monos = map rel_mono_of_bnf fp_or_nesting_bnfs;
   186 
   187 
   187     val rel_xtor_co_induct_thm =
   188     val rel_xtor_co_induct_thm =
   188       mk_rel_xtor_co_induct_thm fp (map3 cast castAs castBs pre_rels) pre_phis rels phis xs ys
   189       mk_rel_xtor_co_induct_thm fp (map3 cast castAs castBs pre_rels) pre_phis rels phis xs ys
   189         xtors xtor's (mk_rel_xtor_co_induct_tactic fp abs_inverses rel_xtor_co_inducts rel_defs
   190         xtors xtor's (mk_rel_xtor_co_induct_tactic fp abs_inverses rel_xtor_co_inducts rel_defs
   190           rel_monos rel_eqs)
   191           rel_monos fp_or_nesting_rel_eqs fp_or_nesting_rel_monos)
   191         lthy;
   192         lthy;
   192 
   193 
   193     val map_id0s = no_refl (map map_id0_of_bnf bnfs);
   194     val map_id0s = no_refl (map map_id0_of_bnf bnfs);
   194 
   195 
   195     val xtor_co_induct_thm =
   196     val xtor_co_induct_thm =
   207             fun mk_type_copy_thms thm = map (curry op RS thm)
   208             fun mk_type_copy_thms thm = map (curry op RS thm)
   208               @{thms type_copy_Rep_o_Abs type_copy_vimage2p_Grp_Abs};
   209               @{thms type_copy_Rep_o_Abs type_copy_vimage2p_Grp_Abs};
   209           in
   210           in
   210             cterm_instantiate_pos cts rel_xtor_co_induct_thm
   211             cterm_instantiate_pos cts rel_xtor_co_induct_thm
   211             |> singleton (Proof_Context.export names_lthy lthy)
   212             |> singleton (Proof_Context.export names_lthy lthy)
   212             |> unfold_thms lthy (@{thms eq_le_Grp_id_iff all_simps(1,2)[symmetric]} @ rel_eqs)
   213             |> unfold_thms lthy (@{thms eq_le_Grp_id_iff all_simps(1,2)[symmetric]} @
       
   214                 fp_or_nesting_rel_eqs)
   213             |> funpow n (fn thm => thm RS spec)
   215             |> funpow n (fn thm => thm RS spec)
   214             |> unfold_thms lthy (@{thm eq_alt} :: map rel_Grp_of_bnf bnfs @ map_id0s)
   216             |> unfold_thms lthy (@{thm eq_alt} :: map rel_Grp_of_bnf bnfs @ map_id0s)
   215             |> unfold_thms lthy (@{thms vimage2p_id vimage2p_comp comp_apply comp_id
   217             |> unfold_thms lthy (@{thms vimage2p_id vimage2p_comp comp_apply comp_id
   216                Grp_id_mono_subst eqTrueI[OF subset_UNIV] simp_thms(22)} @
   218                Grp_id_mono_subst eqTrueI[OF subset_UNIV] simp_thms(22)} @
   217                maps mk_fp_type_copy_thms fp_type_definitions @
   219                maps mk_fp_type_copy_thms fp_type_definitions @
   222       | Greatest_FP =>
   224       | Greatest_FP =>
   223           let
   225           let
   224             val cts = NONE :: map (SOME o certify lthy) (map HOLogic.eq_const As);
   226             val cts = NONE :: map (SOME o certify lthy) (map HOLogic.eq_const As);
   225           in
   227           in
   226             cterm_instantiate_pos cts rel_xtor_co_induct_thm
   228             cterm_instantiate_pos cts rel_xtor_co_induct_thm
   227             |> unfold_thms lthy (@{thms le_fun_def le_bool_def all_simps(1,2)[symmetric]} @ rel_eqs)
   229             |> unfold_thms lthy (@{thms le_fun_def le_bool_def all_simps(1,2)[symmetric]} @
       
   230                 fp_or_nesting_rel_eqs)
   228             |> funpow (2 * n) (fn thm => thm RS spec)
   231             |> funpow (2 * n) (fn thm => thm RS spec)
   229             |> Conv.fconv_rule (Object_Logic.atomize lthy)
   232             |> Conv.fconv_rule (Object_Logic.atomize lthy)
   230             |> funpow n (fn thm => thm RS mp)
   233             |> funpow n (fn thm => thm RS mp)
   231           end);
   234           end);
   232 
   235