1 (* Title: HOL/Codatatype/Tools/bnf_sugar_tactics.ML
2 Author: Jasmin Blanchette, TU Muenchen
5 Tactics for sugar on top of a BNF.
8 signature BNF_SUGAR_TACTICS =
10 val mk_disc_exhaust_tac: int -> thm -> thm list -> tactic
11 val mk_half_disc_disjoint_tac: int -> thm -> thm -> tactic
12 val mk_nchotomy_tac: int -> thm -> tactic
13 val mk_other_half_disc_disjoint_tac: thm -> tactic
16 structure BNF_Sugar_Tactics : BNF_SUGAR_TACTICS =
22 fun mk_nchotomy_tac n exhaust =
23 (rtac allI THEN' rtac exhaust THEN'
24 EVERY' (maps (fn k => [rtac (mk_disjIN n k), REPEAT_DETERM o rtac exI, atac]) (1 upto n))) 1;
26 fun mk_half_disc_disjoint_tac m disc_def disc'_thm =
27 (dtac (disc_def RS iffD1) THEN'
28 REPEAT_DETERM_N m o etac exE THEN'
32 fun mk_other_half_disc_disjoint_tac half_thm =
33 (etac @{thm contrapos_pn} THEN' etac half_thm) 1;
35 fun mk_disc_exhaust_tac n exhaust discIs =
37 EVERY' (map2 (fn k => fn discI =>
38 dtac discI THEN' select_prem_tac n (etac @{thm meta_mp}) k THEN' atac) (1 upto n) discIs)) 1;