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
13 val mk_inject_tac: Proof.context -> thm -> thm -> tactic
16 structure BNF_FP_Sugar_Tactics : BNF_FP_SUGAR_TACTICS =
22 fun mk_exhaust_tac ctxt n ms ctr_defs fld_iff_unf sumEN' =
23 Local_Defs.unfold_tac ctxt (fld_iff_unf :: ctr_defs) THEN
25 Local_Defs.unfold_tac ctxt @{thms all_prod_eq} THEN
26 EVERY' (map2 (fn k => fn m =>
27 select_prem_tac n (REPEAT_DETERM_N m o dtac @{thm meta_spec} THEN' etac @{thm meta_mp}) k THEN'
28 atac) (1 upto n) ms) 1;
30 fun mk_fld_iff_unf_tac ctxt cTs cfld cunf fld_unf unf_fld =
32 EVERY' (map3 (fn cTs => fn cx => fn th =>
33 dtac (Drule.instantiate' cTs [NONE, NONE, SOME cx] arg_cong) THEN'
34 SELECT_GOAL (Local_Defs.unfold_tac ctxt [th]) THEN'
35 atac) [rev cTs, cTs] [cunf, cfld] [unf_fld, fld_unf])) 1;
37 fun mk_inject_tac ctxt ctr_def fld_inject =
38 Local_Defs.unfold_tac ctxt [ctr_def] THEN
39 rtac (fld_inject RS ssubst) 1 THEN
40 Local_Defs.unfold_tac ctxt @{thms sum.inject Pair_eq conj_assoc} THEN