20 val mk_corec_tac: thm list -> thm list -> thm -> thm -> thm -> thm -> Proof.context -> tactic |
20 val mk_corec_tac: thm list -> thm list -> thm -> thm -> thm -> thm -> Proof.context -> tactic |
21 val mk_corec_disc_iff_tac: thm list -> thm list -> thm list -> Proof.context -> tactic |
21 val mk_corec_disc_iff_tac: thm list -> thm list -> thm list -> Proof.context -> tactic |
22 val mk_ctor_iff_dtor_tac: Proof.context -> ctyp option list -> cterm -> cterm -> thm -> thm -> |
22 val mk_ctor_iff_dtor_tac: Proof.context -> ctyp option list -> cterm -> cterm -> thm -> thm -> |
23 tactic |
23 tactic |
24 val mk_ctr_transfer_tac: thm list -> tactic |
24 val mk_ctr_transfer_tac: thm list -> tactic |
|
25 val mk_disc_transfer_tac: Proof.context -> thm -> thm -> thm list -> tactic |
25 val mk_exhaust_tac: Proof.context -> int -> thm list -> thm -> thm -> tactic |
26 val mk_exhaust_tac: Proof.context -> int -> thm list -> thm -> thm -> tactic |
26 val mk_half_distinct_tac: Proof.context -> thm -> thm -> thm list -> tactic |
27 val mk_half_distinct_tac: Proof.context -> thm -> thm -> thm list -> tactic |
27 val mk_induct_tac: Proof.context -> int -> int list -> int list list -> int list list list -> |
28 val mk_induct_tac: Proof.context -> int -> int list -> int list list -> int list list list -> |
28 thm list -> thm -> thm list -> thm list -> thm list -> thm list list -> tactic |
29 thm list -> thm -> thm list -> thm list -> thm list -> thm list list -> tactic |
29 val mk_inject_tac: Proof.context -> thm -> thm -> thm -> tactic |
30 val mk_inject_tac: Proof.context -> thm -> thm -> thm -> tactic |
95 unfold_thms_tac ctxt cases THEN |
96 unfold_thms_tac ctxt cases THEN |
96 ALLGOALS (fn k => (select_prem_tac n (dtac asm_rl) k THEN' rotate_tac ~1) k) THEN |
97 ALLGOALS (fn k => (select_prem_tac n (dtac asm_rl) k THEN' rotate_tac ~1) k) THEN |
97 ALLGOALS (REPEAT_ALL_NEW (atac ORELSE' rtac refl ORELSE' dtac @{thm rel_funD})) |
98 ALLGOALS (REPEAT_ALL_NEW (atac ORELSE' rtac refl ORELSE' dtac @{thm rel_funD})) |
98 end; |
99 end; |
99 |
100 |
|
101 fun mk_ctr_transfer_tac rel_intros = |
|
102 HEADGOAL Goal.conjunction_tac THEN |
|
103 ALLGOALS (REPEAT o (resolve_tac (@{thm rel_funI} :: rel_intros) THEN' |
|
104 REPEAT_DETERM o atac)); |
|
105 |
|
106 fun mk_disc_transfer_tac ctxt rel_sel exhaust_disc distinct_disc= |
|
107 let |
|
108 fun last_disc_tac iffD = |
|
109 HEADGOAL (rtac (rotate_prems ~1 exhaust_disc) THEN' atac THEN' |
|
110 REPEAT_DETERM o (rotate_tac ~1 THEN' dtac (rotate_prems 1 iffD) THEN' atac THEN' |
|
111 rotate_tac ~1 THEN' etac (rotate_prems 1 notE) THEN' eresolve_tac distinct_disc)); |
|
112 in |
|
113 HEADGOAL Goal.conjunction_tac THEN |
|
114 REPEAT_DETERM (HEADGOAL (rtac @{thm rel_funI} THEN' dtac (rel_sel RS iffD1) THEN' |
|
115 REPEAT_DETERM o (etac conjE) THEN' (atac ORELSE' rtac iffI))) THEN |
|
116 TRY (last_disc_tac iffD2) THEN TRY (last_disc_tac iffD1) |
|
117 end; |
|
118 |
100 fun mk_exhaust_tac ctxt n ctr_defs ctor_iff_dtor sumEN' = |
119 fun mk_exhaust_tac ctxt n ctr_defs ctor_iff_dtor sumEN' = |
101 unfold_thms_tac ctxt (ctor_iff_dtor :: ctr_defs) THEN HEADGOAL (rtac sumEN') THEN |
120 unfold_thms_tac ctxt (ctor_iff_dtor :: ctr_defs) THEN HEADGOAL (rtac sumEN') THEN |
102 HEADGOAL (EVERY' (maps (fn k => [select_prem_tac n (rotate_tac 1) k, |
121 HEADGOAL (EVERY' (maps (fn k => [select_prem_tac n (rotate_tac 1) k, |
103 REPEAT_DETERM o dtac meta_spec, etac meta_mp, atac]) (1 upto n))); |
122 REPEAT_DETERM o dtac meta_spec, etac meta_mp, atac]) (1 upto n))); |
104 |
123 |
106 HEADGOAL (rtac iffI THEN' |
125 HEADGOAL (rtac iffI THEN' |
107 EVERY' (map3 (fn cTs => fn cx => fn th => |
126 EVERY' (map3 (fn cTs => fn cx => fn th => |
108 dtac (Drule.instantiate' cTs [NONE, NONE, SOME cx] arg_cong) THEN' |
127 dtac (Drule.instantiate' cTs [NONE, NONE, SOME cx] arg_cong) THEN' |
109 SELECT_GOAL (unfold_thms_tac ctxt [th]) THEN' |
128 SELECT_GOAL (unfold_thms_tac ctxt [th]) THEN' |
110 atac) [rev cTs, cTs] [cdtor, cctor] [dtor_ctor, ctor_dtor])); |
129 atac) [rev cTs, cTs] [cdtor, cctor] [dtor_ctor, ctor_dtor])); |
111 |
|
112 fun mk_ctr_transfer_tac rel_intros = |
|
113 HEADGOAL Goal.conjunction_tac THEN |
|
114 ALLGOALS (REPEAT o (resolve_tac (@{thm rel_funI} :: rel_intros) THEN' |
|
115 REPEAT_DETERM o atac)); |
|
116 |
130 |
117 fun mk_half_distinct_tac ctxt ctor_inject abs_inject ctr_defs = |
131 fun mk_half_distinct_tac ctxt ctor_inject abs_inject ctr_defs = |
118 unfold_thms_tac ctxt (ctor_inject :: abs_inject :: @{thms sum.inject} @ ctr_defs) THEN |
132 unfold_thms_tac ctxt (ctor_inject :: abs_inject :: @{thms sum.inject} @ ctr_defs) THEN |
119 HEADGOAL (rtac @{thm sum.distinct(1)}); |
133 HEADGOAL (rtac @{thm sum.distinct(1)}); |
120 |
134 |