|
1 lemma exi: "\<exists>(pi :: perm). P pi \<Longrightarrow> (\<And>(p :: perm). P p \<Longrightarrow> Q (pi \<bullet> p)) \<Longrightarrow> \<exists>pi. Q pi" |
|
2 apply (erule exE) |
|
3 apply (rule_tac x="pi \<bullet> pia" in exI) |
|
4 by auto |
|
5 |
|
6 ML {* |
|
7 fun alpha_eqvt_tac induct simps ctxt = |
|
8 rtac induct THEN_ALL_NEW |
|
9 simp_tac (HOL_basic_ss addsimps simps) THEN_ALL_NEW split_conj_tac THEN_ALL_NEW |
|
10 REPEAT o etac @{thm exi[of _ _ "p"]} THEN' split_conj_tac THEN_ALL_NEW |
|
11 asm_full_simp_tac (HOL_ss addsimps (all_eqvts ctxt @ simps)) THEN_ALL_NEW |
|
12 asm_full_simp_tac (HOL_ss addsimps |
|
13 @{thms supp_eqvt[symmetric] inter_eqvt[symmetric] empty_eqvt alphas prod_rel.simps prod_fv.simps}) THEN_ALL_NEW |
|
14 (split_conj_tac THEN_ALL_NEW TRY o resolve_tac |
|
15 @{thms fresh_star_permute_iff[of "- p", THEN iffD1] permute_eq_iff[of "- p", THEN iffD1]}) |
|
16 THEN_ALL_NEW |
|
17 asm_full_simp_tac (HOL_ss addsimps (@{thms split_conv permute_minus_cancel permute_plus permute_eqvt[symmetric]} @ all_eqvts ctxt @ simps)) |
|
18 *} |
|
19 |
|
20 ML {* |
|
21 fun build_alpha_eqvt alpha names = |
|
22 let |
|
23 val pi = Free ("p", @{typ perm}); |
|
24 val (tys, _) = strip_type (fastype_of alpha) |
|
25 val indnames = Name.variant_list names (Datatype_Prop.make_tnames (map body_type tys)); |
|
26 val args = map Free (indnames ~~ tys); |
|
27 val perm_args = map (fn x => mk_perm pi x) args |
|
28 in |
|
29 (HOLogic.mk_imp (list_comb (alpha, args), list_comb (alpha, perm_args)), indnames @ names) |
|
30 end |
|
31 *} |
|
32 |
|
33 ML {* |
|
34 fun build_alpha_eqvts funs tac ctxt = |
|
35 let |
|
36 val (gls, names) = fold_map build_alpha_eqvt funs ["p"] |
|
37 val gl = HOLogic.mk_Trueprop (foldr1 HOLogic.mk_conj gls) |
|
38 val thm = Goal.prove ctxt names [] gl tac |
|
39 in |
|
40 map (fn x => mp OF [x]) (HOLogic.conj_elims thm) |
|
41 end |
|
42 *} |
|
43 |