1 (* Title: HOL/Codatatype/Tools/bnf_fp_sugar_tactics.ML
2 Author: Jasmin Blanchette, TU Muenchen
5 Tactics for the LFP/GFP sugar.
8 signature BNF_FP_SUGAR_TACTICS =
10 val mk_exhaust_tac: Proof.context -> int -> int list -> thm list -> thm -> thm -> tactic
11 val mk_fld_iff_unf_tac: Proof.context -> ctyp option list -> cterm -> cterm -> thm -> thm
15 structure BNF_FP_Sugar_Tactics : BNF_FP_SUGAR_TACTICS =
21 fun mk_exhaust_tac ctxt n ms ctr_defs fld_iff_unf sumEN' =
22 Local_Defs.unfold_tac ctxt (fld_iff_unf :: ctr_defs) THEN
24 Local_Defs.unfold_tac ctxt @{thms all_prod_eq} THEN
25 EVERY' (map2 (fn k => fn m =>
26 select_prem_tac n (REPEAT_DETERM_N m o dtac @{thm meta_spec} THEN' etac @{thm meta_mp}) k THEN'
27 atac) (1 upto n) ms) 1;
29 fun mk_fld_iff_unf_tac ctxt cTs cfld cunf fld_unf unf_fld =
31 EVERY' (map3 (fn cTs => fn cx => fn th =>
32 dtac (Drule.instantiate' cTs [NONE, NONE, SOME cx] arg_cong) THEN'
33 SELECT_GOAL (Local_Defs.unfold_tac ctxt [th]) THEN'
34 atac) [rev cTs, cTs] [cunf, cfld] [unf_fld, fld_unf])) 1;