author | wenzelm |
Wed, 08 Oct 2014 17:09:07 +0200 | |
changeset 58634 | 9f10d82e8188 |
parent 58446 | e89f57d1e46c |
child 59498 | 50b60f501b05 |
permissions | -rw-r--r-- |
55061 | 1 |
(* Title: HOL/Tools/BNF/bnf_lfp_tactics.ML |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
2 |
Author: Dmitriy Traytel, TU Muenchen |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
3 |
Author: Andrei Popescu, TU Muenchen |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
4 |
Copyright 2012 |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
5 |
|
58315 | 6 |
Tactics for the datatype construction. |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
7 |
*) |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
8 |
|
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
9 |
signature BNF_LFP_TACTICS = |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
10 |
sig |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
11 |
val mk_alg_min_alg_tac: int -> thm -> thm list -> thm -> thm -> thm list list -> thm list -> |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
12 |
thm list -> tactic |
51798 | 13 |
val mk_alg_not_empty_tac: Proof.context -> thm -> thm list -> thm list -> tactic |
55197 | 14 |
val mk_alg_select_tac: Proof.context -> thm -> tactic |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
15 |
val mk_alg_set_tac: thm -> tactic |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
16 |
val mk_bd_card_order_tac: thm list -> tactic |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
17 |
val mk_bd_limit_tac: int -> thm -> tactic |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
18 |
val mk_card_of_min_alg_tac: thm -> thm -> thm -> thm -> thm -> tactic |
56237 | 19 |
val mk_copy_tac: int -> thm -> thm -> thm list -> thm list list -> tactic |
51798 | 20 |
val mk_ctor_induct_tac: Proof.context -> int -> thm list list -> thm -> thm list -> thm -> |
21 |
thm list -> thm list -> thm list -> tactic |
|
55197 | 22 |
val mk_ctor_induct2_tac: Proof.context -> ctyp option list -> cterm option list -> thm -> |
23 |
thm list -> tactic |
|
49585
5c4a12550491
generate high-level "maps", "sets", and "rels" properties
blanchet
parents:
49544
diff
changeset
|
24 |
val mk_ctor_set_tac: thm -> thm -> thm list -> tactic |
58444 | 25 |
val mk_ctor_rec_transfer_tac: Proof.context -> int -> int -> thm list -> thm list -> thm list -> |
26 |
thm list -> tactic |
|
51893
596baae88a88
got rid of the set based relator---use (binary) predicate based relator instead
traytel
parents:
51812
diff
changeset
|
27 |
val mk_ctor_rel_tac: Proof.context -> thm list -> int -> thm -> thm -> thm -> thm -> thm list -> |
51798 | 28 |
thm -> thm -> thm list -> thm list -> thm list list -> tactic |
49506 | 29 |
val mk_dtor_o_ctor_tac: thm -> thm -> thm -> thm -> thm list -> tactic |
56237 | 30 |
val mk_init_ex_mor_tac: Proof.context -> thm -> thm -> thm list -> thm -> thm -> thm -> thm -> |
55197 | 31 |
tactic |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
32 |
val mk_init_induct_tac: int -> thm -> thm -> thm list -> thm list -> tactic |
56263 | 33 |
val mk_init_unique_mor_tac: cterm list -> int -> thm -> thm -> thm list -> thm list -> thm list -> |
34 |
thm list -> thm list -> tactic |
|
49504
df9b897fb254
renamed "iter"/"coiter" to "fold"/"unfold" (cf. Wadler)
blanchet
parents:
49502
diff
changeset
|
35 |
val mk_fold_unique_mor_tac: thm list -> thm list -> thm list -> thm -> thm -> thm -> tactic |
55197 | 36 |
val mk_fold_transfer_tac: Proof.context -> int -> thm -> thm list -> thm list -> tactic |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
37 |
val mk_least_min_alg_tac: thm -> thm -> tactic |
55197 | 38 |
val mk_le_rel_OO_tac: Proof.context -> int -> thm -> thm list -> thm list -> thm list -> |
39 |
thm list -> tactic |
|
53287 | 40 |
val mk_map_comp0_tac: thm list -> thm list -> thm -> int -> tactic |
53270 | 41 |
val mk_map_id0_tac: thm list -> thm -> tactic |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
42 |
val mk_map_tac: int -> int -> thm -> thm -> thm -> tactic |
55197 | 43 |
val mk_ctor_map_unique_tac: Proof.context -> thm -> thm list -> tactic |
44 |
val mk_mcong_tac: Proof.context -> (int -> tactic) -> thm list list list -> thm list -> |
|
45 |
thm list -> tactic |
|
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
46 |
val mk_min_algs_card_of_tac: ctyp -> cterm -> int -> thm -> thm list -> thm list -> thm -> thm -> |
51812 | 47 |
thm -> thm -> thm -> thm -> thm -> tactic |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
48 |
val mk_min_algs_least_tac: ctyp -> cterm -> thm -> thm list -> thm list -> tactic |
51798 | 49 |
val mk_min_algs_mono_tac: Proof.context -> thm -> tactic |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
50 |
val mk_min_algs_tac: thm -> thm list -> tactic |
56263 | 51 |
val mk_mor_Abs_tac: Proof.context -> cterm list -> thm list -> thm list -> thm list -> thm list -> |
52 |
tactic |
|
56237 | 53 |
val mk_mor_Rep_tac: Proof.context -> int -> thm list -> thm list -> thm list -> thm -> thm list -> |
54 |
thm list list -> tactic |
|
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
55 |
val mk_mor_UNIV_tac: int -> thm list -> thm -> tactic |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
56 |
val mk_mor_comp_tac: thm -> thm list list -> thm list -> tactic |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
57 |
val mk_mor_convol_tac: 'a list -> thm -> tactic |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
58 |
val mk_mor_elim_tac: thm -> tactic |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
59 |
val mk_mor_incl_tac: thm -> thm list -> tactic |
49504
df9b897fb254
renamed "iter"/"coiter" to "fold"/"unfold" (cf. Wadler)
blanchet
parents:
49502
diff
changeset
|
60 |
val mk_mor_fold_tac: ctyp -> cterm -> thm list -> thm -> thm -> tactic |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
61 |
val mk_mor_select_tac: thm -> thm -> thm -> thm -> thm -> thm -> thm list -> thm list list -> |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
62 |
thm list -> tactic |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
63 |
val mk_mor_str_tac: 'a list -> thm -> tactic |
55197 | 64 |
val mk_rel_induct_tac: Proof.context -> thm list -> int -> thm -> int list -> thm list -> |
65 |
thm list -> tactic |
|
66 |
val mk_rec_tac: Proof.context -> thm list -> thm -> thm list -> tactic |
|
67 |
val mk_rec_unique_mor_tac: Proof.context -> thm list -> thm list -> thm -> tactic |
|
68 |
val mk_set_bd_tac: Proof.context -> int -> (int -> tactic) -> thm -> thm list list -> thm list -> |
|
69 |
int -> tactic |
|
70 |
val mk_set_nat_tac: Proof.context -> int -> (int -> tactic) -> thm list list -> thm list -> |
|
71 |
cterm list -> thm list -> int -> tactic |
|
53289 | 72 |
val mk_set_map0_tac: thm -> tactic |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
73 |
val mk_set_tac: thm -> tactic |
51798 | 74 |
val mk_wit_tac: Proof.context -> int -> thm list -> thm list -> tactic |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
75 |
end; |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
76 |
|
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
77 |
structure BNF_LFP_Tactics : BNF_LFP_TACTICS = |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
78 |
struct |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
79 |
|
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
80 |
open BNF_Tactics |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
81 |
open BNF_LFP_Util |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
82 |
open BNF_Util |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
83 |
|
49306 | 84 |
val fst_snd_convs = @{thms fst_conv snd_conv}; |
85 |
val ord_eq_le_trans = @{thm ord_eq_le_trans}; |
|
86 |
val subset_trans = @{thm subset_trans}; |
|
87 |
val trans_fun_cong_image_id_id_apply = @{thm trans[OF fun_cong[OF image_id] id_apply]}; |
|
52659
58b87aa4dc3b
eliminate duplicated theorems (thanks to "Auto solve_direct" in jEdit)
traytel
parents:
52635
diff
changeset
|
88 |
val rev_bspec = Drule.rotate_prems 1 bspec; |
56114 | 89 |
val Un_cong = @{thm arg_cong2[of _ _ _ _ "op \<union>"]}; |
90 |
val relChainD = @{thm iffD2[OF meta_eq_to_obj_eq[OF relChain_def]]}; |
|
49306 | 91 |
|
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
92 |
fun mk_alg_set_tac alg_def = |
55541
fd9ea8ae28f6
syntactic simplifications of internal (co)datatype constructions
traytel
parents:
55414
diff
changeset
|
93 |
EVERY' [dtac (alg_def RS iffD1), REPEAT_DETERM o etac conjE, etac bspec, rtac CollectI, |
fd9ea8ae28f6
syntactic simplifications of internal (co)datatype constructions
traytel
parents:
55414
diff
changeset
|
94 |
REPEAT_DETERM o (rtac (subset_UNIV RS conjI) ORELSE' etac conjI), atac] 1; |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
95 |
|
51798 | 96 |
fun mk_alg_not_empty_tac ctxt alg_set alg_sets wits = |
97 |
(EVERY' [rtac notI, hyp_subst_tac ctxt, ftac alg_set] THEN' |
|
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
98 |
REPEAT_DETERM o FIRST' |
55541
fd9ea8ae28f6
syntactic simplifications of internal (co)datatype constructions
traytel
parents:
55414
diff
changeset
|
99 |
[EVERY' [rtac @{thm subset_emptyI}, eresolve_tac wits], |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
100 |
EVERY' [rtac subsetI, rtac FalseE, eresolve_tac wits], |
51798 | 101 |
EVERY' [rtac subsetI, dresolve_tac wits, hyp_subst_tac ctxt, |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
102 |
FIRST' (map (fn thm => rtac thm THEN' atac) alg_sets)]] THEN' |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
103 |
etac @{thm emptyE}) 1; |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
104 |
|
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
105 |
fun mk_mor_elim_tac mor_def = |
56114 | 106 |
(dtac (mor_def RS iffD1) THEN' |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
107 |
REPEAT o etac conjE THEN' |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
108 |
TRY o rtac @{thm image_subsetI} THEN' |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
109 |
etac bspec THEN' |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
110 |
atac) 1; |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
111 |
|
53285 | 112 |
fun mk_mor_incl_tac mor_def map_ids = |
56114 | 113 |
(rtac (mor_def RS iffD2) THEN' |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
114 |
rtac conjI THEN' |
56114 | 115 |
CONJ_WRAP' (K (EVERY' [rtac ballI, etac set_mp, etac (id_apply RS @{thm ssubst_mem})])) |
116 |
map_ids THEN' |
|
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
117 |
CONJ_WRAP' (fn thm => |
56114 | 118 |
(EVERY' [rtac ballI, rtac trans, rtac id_apply, stac thm, rtac refl])) map_ids) 1; |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
119 |
|
53290 | 120 |
fun mk_mor_comp_tac mor_def set_maps map_comp_ids = |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
121 |
let |
56114 | 122 |
val fbetw_tac = |
123 |
EVERY' [rtac ballI, rtac (o_apply RS @{thm ssubst_mem}), etac bspec, etac bspec, atac]; |
|
53290 | 124 |
fun mor_tac (set_map, map_comp_id) = |
56114 | 125 |
EVERY' [rtac ballI, rtac (o_apply RS trans), rtac trans, |
52659
58b87aa4dc3b
eliminate duplicated theorems (thanks to "Auto solve_direct" in jEdit)
traytel
parents:
52635
diff
changeset
|
126 |
rtac trans, dtac rev_bspec, atac, etac arg_cong, |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
127 |
REPEAT o eresolve_tac [CollectE, conjE], etac bspec, rtac CollectI] THEN' |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
128 |
CONJ_WRAP' (fn thm => |
49306 | 129 |
FIRST' [rtac subset_UNIV, |
130 |
(EVERY' [rtac ord_eq_le_trans, rtac thm, rtac @{thm image_subsetI}, |
|
53290 | 131 |
etac bspec, etac set_mp, atac])]) set_map THEN' |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
132 |
rtac (map_comp_id RS arg_cong); |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
133 |
in |
56114 | 134 |
(dtac (mor_def RS iffD1) THEN' dtac (mor_def RS iffD1) THEN' rtac (mor_def RS iffD2) THEN' |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
135 |
REPEAT o etac conjE THEN' |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
136 |
rtac conjI THEN' |
53290 | 137 |
CONJ_WRAP' (K fbetw_tac) set_maps THEN' |
138 |
CONJ_WRAP' mor_tac (set_maps ~~ map_comp_ids)) 1 |
|
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
139 |
end; |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
140 |
|
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
141 |
fun mk_mor_str_tac ks mor_def = |
56114 | 142 |
(rtac (mor_def RS iffD2) THEN' rtac conjI THEN' |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
143 |
CONJ_WRAP' (K (EVERY' [rtac ballI, rtac UNIV_I])) ks THEN' |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
144 |
CONJ_WRAP' (K (EVERY' [rtac ballI, rtac refl])) ks) 1; |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
145 |
|
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
146 |
fun mk_mor_convol_tac ks mor_def = |
56114 | 147 |
(rtac (mor_def RS iffD2) THEN' rtac conjI THEN' |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
148 |
CONJ_WRAP' (K (EVERY' [rtac ballI, rtac UNIV_I])) ks THEN' |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
149 |
CONJ_WRAP' (K (EVERY' [rtac ballI, rtac trans, rtac @{thm fst_convol'}, rtac o_apply])) ks) 1; |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
150 |
|
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
151 |
fun mk_mor_UNIV_tac m morEs mor_def = |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
152 |
let |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
153 |
val n = length morEs; |
55990 | 154 |
fun mor_tac morE = EVERY' [rtac @{thm ext}, rtac trans, rtac o_apply, rtac trans, etac morE, |
49306 | 155 |
rtac CollectI, CONJ_WRAP' (K (rtac subset_UNIV)) (1 upto m + n), |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
156 |
rtac sym, rtac o_apply]; |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
157 |
in |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
158 |
EVERY' [rtac iffI, CONJ_WRAP' mor_tac morEs, |
56114 | 159 |
rtac (mor_def RS iffD2), rtac conjI, CONJ_WRAP' (K (rtac ballI THEN' rtac UNIV_I)) morEs, |
160 |
REPEAT_DETERM o etac conjE, REPEAT_DETERM_N n o dtac (@{thm fun_eq_iff} RS iffD1), |
|
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
161 |
CONJ_WRAP' (K (EVERY' [rtac ballI, REPEAT_DETERM o etac allE, rtac trans, |
56114 | 162 |
etac (o_apply RS sym RS trans), rtac o_apply])) morEs] 1 |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
163 |
end; |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
164 |
|
56237 | 165 |
fun mk_copy_tac m alg_def mor_def alg_sets set_mapss = |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
166 |
let |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
167 |
val n = length alg_sets; |
56237 | 168 |
fun set_tac thm = |
169 |
EVERY' [rtac ord_eq_le_trans, rtac thm, rtac subset_trans, etac @{thm image_mono}, |
|
170 |
rtac equalityD1, etac @{thm bij_betw_imageE}]; |
|
171 |
val alg_tac = |
|
172 |
CONJ_WRAP' (fn (set_maps, alg_set) => |
|
49306 | 173 |
EVERY' [rtac ballI, REPEAT_DETERM o eresolve_tac [CollectE, conjE], rtac set_mp, |
56237 | 174 |
rtac equalityD1, etac @{thm bij_betw_imageE[OF bij_betw_the_inv_into]}, |
175 |
rtac imageI, etac alg_set, EVERY' (map set_tac (drop m set_maps))]) |
|
176 |
(set_mapss ~~ alg_sets); |
|
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
177 |
|
56237 | 178 |
val mor_tac = rtac conjI THEN' CONJ_WRAP' (K (etac @{thm bij_betwE})) alg_sets THEN' |
179 |
CONJ_WRAP' (fn (set_maps, alg_set) => |
|
180 |
EVERY' [rtac ballI, REPEAT_DETERM o eresolve_tac [CollectE, conjE], |
|
181 |
etac @{thm f_the_inv_into_f_bij_betw}, etac alg_set, |
|
182 |
EVERY' (map set_tac (drop m set_maps))]) |
|
183 |
(set_mapss ~~ alg_sets); |
|
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
184 |
in |
56237 | 185 |
(REPEAT_DETERM_N n o rtac exI THEN' rtac conjI THEN' |
186 |
rtac (alg_def RS iffD2) THEN' alg_tac THEN' rtac (mor_def RS iffD2) THEN' mor_tac) 1 |
|
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
187 |
end; |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
188 |
|
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
189 |
fun mk_bd_limit_tac n bd_Cinfinite = |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
190 |
EVERY' [REPEAT_DETERM o etac conjE, rtac rev_mp, rtac @{thm Cinfinite_limit_finite}, |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
191 |
REPEAT_DETERM_N n o rtac @{thm finite.insertI}, rtac @{thm finite.emptyI}, |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
192 |
REPEAT_DETERM_N n o etac @{thm insert_subsetI}, rtac @{thm empty_subsetI}, |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
193 |
rtac bd_Cinfinite, rtac impI, etac bexE, rtac bexI, |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
194 |
CONJ_WRAP' (fn i => |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
195 |
EVERY' [etac bspec, REPEAT_DETERM_N i o rtac @{thm insertI2}, rtac @{thm insertI1}]) |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
196 |
(0 upto n - 1), |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
197 |
atac] 1; |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
198 |
|
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
199 |
fun mk_min_algs_tac worel in_congs = |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
200 |
let |
56248
67dc9549fa15
generalized and strengthened cong rules on compound operators, similar to 1ed737a98198
haftmann
parents:
56237
diff
changeset
|
201 |
val minG_tac = EVERY' [rtac @{thm SUP_cong}, rtac refl, dtac bspec, atac, etac arg_cong]; |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
202 |
fun minH_tac thm = |
52659
58b87aa4dc3b
eliminate duplicated theorems (thanks to "Auto solve_direct" in jEdit)
traytel
parents:
52635
diff
changeset
|
203 |
EVERY' [rtac Un_cong, minG_tac, rtac @{thm image_cong}, rtac thm, |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
204 |
REPEAT_DETERM_N (length in_congs) o minG_tac, rtac refl]; |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
205 |
in |
56114 | 206 |
(rtac (worel RS (@{thm wo_rel.worec_fixpoint} RS fun_cong)) THEN' rtac iffD2 THEN' |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
207 |
rtac meta_eq_to_obj_eq THEN' rtac (worel RS @{thm wo_rel.adm_wo_def}) THEN' |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
208 |
REPEAT_DETERM_N 3 o rtac allI THEN' rtac impI THEN' |
56765 | 209 |
CONJ_WRAP_GEN' (EVERY' [rtac prod_injectI, rtac conjI]) minH_tac in_congs) 1 |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
210 |
end; |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
211 |
|
56114 | 212 |
fun mk_min_algs_mono_tac ctxt min_algs = EVERY' [rtac relChainD, rtac allI, rtac allI, rtac impI, |
213 |
rtac @{thm case_split}, rtac @{thm xt1(3)}, rtac min_algs, etac @{thm FieldI2}, rtac subsetI, |
|
214 |
rtac UnI1, rtac @{thm UN_I}, etac @{thm underS_I}, atac, atac, rtac equalityD1, |
|
215 |
dtac @{thm notnotD}, hyp_subst_tac ctxt, rtac refl] 1; |
|
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
216 |
|
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
217 |
fun mk_min_algs_card_of_tac cT ct m worel min_algs in_bds bd_Card_order bd_Cnotzero |
51812 | 218 |
suc_Card_order suc_Cinfinite suc_Cnotzero suc_Asuc Asuc_Cinfinite = |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
219 |
let |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
220 |
val induct = worel RS |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
221 |
Drule.instantiate' [SOME cT] [NONE, SOME ct] @{thm well_order_induct_imp}; |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
222 |
val src = 1 upto m + 1; |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
223 |
val dest = (m + 1) :: (1 upto m); |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
224 |
val absorbAs_tac = if m = 0 then K (all_tac) |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
225 |
else EVERY' [rtac @{thm ordIso_transitive}, rtac @{thm csum_cong1}, |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
226 |
rtac @{thm ordIso_transitive}, |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
227 |
BNF_Tactics.mk_rotate_eq_tac (rtac @{thm ordIso_refl} THEN' |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
228 |
FIRST' [rtac @{thm card_of_Card_order}, rtac @{thm Card_order_csum}, |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
229 |
rtac @{thm Card_order_cexp}]) |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
230 |
@{thm ordIso_transitive} @{thm csum_assoc} @{thm csum_com} @{thm csum_cong} |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
231 |
src dest, |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
232 |
rtac @{thm csum_absorb1}, rtac Asuc_Cinfinite, rtac ctrans, rtac @{thm ordLeq_csum1}, |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
233 |
FIRST' [rtac @{thm Card_order_csum}, rtac @{thm card_of_Card_order}], |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
234 |
rtac @{thm ordLeq_cexp1}, rtac suc_Cnotzero, rtac @{thm Card_order_csum}]; |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
235 |
|
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
236 |
val minG_tac = EVERY' [rtac @{thm UNION_Cinfinite_bound}, rtac @{thm ordLess_imp_ordLeq}, |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
237 |
rtac @{thm ordLess_transitive}, rtac @{thm card_of_underS}, rtac suc_Card_order, |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
238 |
atac, rtac suc_Asuc, rtac ballI, etac allE, dtac mp, etac @{thm underS_E}, |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
239 |
dtac mp, etac @{thm underS_Field}, REPEAT o etac conjE, atac, rtac Asuc_Cinfinite] |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
240 |
|
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
241 |
fun mk_minH_tac (min_alg, in_bd) = EVERY' [rtac @{thm ordIso_ordLeq_trans}, |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
242 |
rtac @{thm card_of_ordIso_subst}, etac min_alg, rtac @{thm Un_Cinfinite_bound}, |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
243 |
minG_tac, rtac ctrans, rtac @{thm card_of_image}, rtac ctrans, rtac in_bd, rtac ctrans, |
51782
84e7225f5ab6
removed unnecessary assumptions in some theorems about cardinal exponentiation
traytel
parents:
51766
diff
changeset
|
244 |
rtac @{thm cexp_mono1}, rtac @{thm csum_mono1}, |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
245 |
REPEAT_DETERM_N m o rtac @{thm csum_mono2}, |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
246 |
CONJ_WRAP_GEN' (rtac @{thm csum_cinfinite_bound}) (K minG_tac) min_algs, |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
247 |
REPEAT_DETERM o FIRST' |
51782
84e7225f5ab6
removed unnecessary assumptions in some theorems about cardinal exponentiation
traytel
parents:
51766
diff
changeset
|
248 |
[rtac @{thm card_of_Card_order}, rtac @{thm Card_order_csum}, |
84e7225f5ab6
removed unnecessary assumptions in some theorems about cardinal exponentiation
traytel
parents:
51766
diff
changeset
|
249 |
rtac Asuc_Cinfinite, rtac bd_Card_order], |
84e7225f5ab6
removed unnecessary assumptions in some theorems about cardinal exponentiation
traytel
parents:
51766
diff
changeset
|
250 |
rtac @{thm ordIso_ordLeq_trans}, rtac @{thm cexp_cong1}, absorbAs_tac, |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
251 |
rtac @{thm csum_absorb1}, rtac Asuc_Cinfinite, rtac @{thm ctwo_ordLeq_Cinfinite}, |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
252 |
rtac Asuc_Cinfinite, rtac bd_Card_order, |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
253 |
rtac @{thm ordIso_imp_ordLeq}, rtac @{thm cexp_cprod_ordLeq}, |
51782
84e7225f5ab6
removed unnecessary assumptions in some theorems about cardinal exponentiation
traytel
parents:
51766
diff
changeset
|
254 |
resolve_tac @{thms Card_order_csum Card_order_ctwo}, rtac suc_Cinfinite, |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
255 |
rtac bd_Cnotzero, rtac @{thm cardSuc_ordLeq}, rtac bd_Card_order, rtac Asuc_Cinfinite]; |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
256 |
in |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
257 |
(rtac induct THEN' |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
258 |
rtac impI THEN' |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
259 |
CONJ_WRAP' mk_minH_tac (min_algs ~~ in_bds)) 1 |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
260 |
end; |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
261 |
|
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
262 |
fun mk_min_algs_least_tac cT ct worel min_algs alg_sets = |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
263 |
let |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
264 |
val induct = worel RS |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
265 |
Drule.instantiate' [SOME cT] [NONE, SOME ct] @{thm well_order_induct_imp}; |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
266 |
|
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
267 |
val minG_tac = EVERY' [rtac @{thm UN_least}, etac allE, dtac mp, etac @{thm underS_E}, |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
268 |
dtac mp, etac @{thm underS_Field}, REPEAT_DETERM o etac conjE, atac]; |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
269 |
|
49306 | 270 |
fun mk_minH_tac (min_alg, alg_set) = EVERY' [rtac ord_eq_le_trans, etac min_alg, |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
271 |
rtac @{thm Un_least}, minG_tac, rtac @{thm image_subsetI}, |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
272 |
REPEAT_DETERM o eresolve_tac [CollectE, conjE], etac alg_set, |
55541
fd9ea8ae28f6
syntactic simplifications of internal (co)datatype constructions
traytel
parents:
55414
diff
changeset
|
273 |
REPEAT_DETERM o (etac subset_trans THEN' minG_tac)]; |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
274 |
in |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
275 |
(rtac induct THEN' |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
276 |
rtac impI THEN' |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
277 |
CONJ_WRAP' mk_minH_tac (min_algs ~~ alg_sets)) 1 |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
278 |
end; |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
279 |
|
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
280 |
fun mk_alg_min_alg_tac m alg_def min_alg_defs bd_limit bd_Cinfinite |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
281 |
set_bdss min_algs min_alg_monos = |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
282 |
let |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
283 |
val n = length min_algs; |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
284 |
fun mk_cardSuc_UNION_tac set_bds (mono, def) = EVERY' |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
285 |
[rtac bexE, rtac @{thm cardSuc_UNION_Cinfinite}, rtac bd_Cinfinite, rtac mono, |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
286 |
etac (def RSN (2, @{thm subset_trans[OF _ equalityD1]})), resolve_tac set_bds]; |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
287 |
fun mk_conjunct_tac (set_bds, (min_alg, min_alg_def)) = |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
288 |
EVERY' [rtac ballI, REPEAT_DETERM o eresolve_tac [CollectE, conjE], |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
289 |
EVERY' (map (mk_cardSuc_UNION_tac set_bds) (min_alg_monos ~~ min_alg_defs)), rtac bexE, |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
290 |
rtac bd_limit, REPEAT_DETERM_N (n - 1) o etac conjI, atac, |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
291 |
rtac (min_alg_def RS @{thm set_mp[OF equalityD2]}), |
49306 | 292 |
rtac @{thm UN_I}, REPEAT_DETERM_N (m + 3 * n) o etac thin_rl, atac, rtac set_mp, |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
293 |
rtac equalityD2, rtac min_alg, atac, rtac UnI2, rtac @{thm image_eqI}, rtac refl, |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
294 |
rtac CollectI, REPEAT_DETERM_N m o dtac asm_rl, REPEAT_DETERM_N n o etac thin_rl, |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
295 |
REPEAT_DETERM o etac conjE, |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
296 |
CONJ_WRAP' (K (FIRST' [atac, |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
297 |
EVERY' [etac subset_trans, rtac subsetI, rtac @{thm UN_I}, |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
298 |
etac @{thm underS_I}, atac, atac]])) |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
299 |
set_bds]; |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
300 |
in |
52904 | 301 |
(rtac (alg_def RS iffD2) THEN' |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
302 |
CONJ_WRAP' mk_conjunct_tac (set_bdss ~~ (min_algs ~~ min_alg_defs))) 1 |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
303 |
end; |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
304 |
|
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
305 |
fun mk_card_of_min_alg_tac min_alg_def card_of suc_Card_order suc_Asuc Asuc_Cinfinite = |
56114 | 306 |
EVERY' [rtac @{thm ordIso_ordLeq_trans}, rtac (min_alg_def RS @{thm card_of_ordIso_subst}), |
307 |
rtac @{thm UNION_Cinfinite_bound}, rtac @{thm ordIso_ordLeq_trans}, |
|
308 |
rtac @{thm card_of_Field_ordIso}, rtac suc_Card_order, rtac @{thm ordLess_imp_ordLeq}, |
|
309 |
rtac suc_Asuc, rtac ballI, dtac rev_mp, rtac card_of, REPEAT_DETERM o etac conjE, atac, |
|
310 |
rtac Asuc_Cinfinite] 1; |
|
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
311 |
|
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
312 |
fun mk_least_min_alg_tac min_alg_def least = |
56114 | 313 |
EVERY' [rtac (min_alg_def RS ord_eq_le_trans), rtac @{thm UN_least}, dtac least, dtac mp, atac, |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
314 |
REPEAT_DETERM o etac conjE, atac] 1; |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
315 |
|
55197 | 316 |
fun mk_alg_select_tac ctxt Abs_inverse = |
51798 | 317 |
EVERY' [rtac ballI, REPEAT_DETERM o eresolve_tac [CollectE, exE, conjE], hyp_subst_tac ctxt] 1 THEN |
49504
df9b897fb254
renamed "iter"/"coiter" to "fold"/"unfold" (cf. Wadler)
blanchet
parents:
49502
diff
changeset
|
318 |
unfold_thms_tac ctxt (Abs_inverse :: fst_snd_convs) THEN atac 1; |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
319 |
|
53290 | 320 |
fun mk_mor_select_tac mor_def mor_cong mor_comp mor_incl_min_alg alg_def alg_select alg_sets |
321 |
set_maps str_init_defs = |
|
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
322 |
let |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
323 |
val n = length alg_sets; |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
324 |
val fbetw_tac = |
52659
58b87aa4dc3b
eliminate duplicated theorems (thanks to "Auto solve_direct" in jEdit)
traytel
parents:
52635
diff
changeset
|
325 |
CONJ_WRAP' (K (EVERY' [rtac ballI, etac rev_bspec, etac CollectE, atac])) alg_sets; |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
326 |
val mor_tac = |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
327 |
CONJ_WRAP' (fn thm => EVERY' [rtac ballI, rtac thm]) str_init_defs; |
53290 | 328 |
fun alg_epi_tac ((alg_set, str_init_def), set_map) = |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
329 |
EVERY' [rtac ballI, REPEAT_DETERM o eresolve_tac [CollectE, conjE], rtac CollectI, |
56114 | 330 |
rtac ballI, ftac (alg_select RS bspec), rtac (str_init_def RS @{thm ssubst_mem}), |
331 |
etac alg_set, REPEAT_DETERM o EVERY' [rtac ord_eq_le_trans, resolve_tac set_map, |
|
332 |
rtac subset_trans, etac @{thm image_mono}, rtac @{thm image_Collect_subsetI}, etac bspec, |
|
333 |
atac]]; |
|
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
334 |
in |
56114 | 335 |
EVERY' [rtac mor_cong, REPEAT_DETERM_N n o (rtac sym THEN' rtac @{thm comp_id}), |
336 |
rtac (Thm.permute_prems 0 1 mor_comp), etac (Thm.permute_prems 0 1 mor_comp), |
|
337 |
rtac (mor_def RS iffD2), rtac conjI, fbetw_tac, mor_tac, rtac mor_incl_min_alg, |
|
338 |
rtac (alg_def RS iffD2), CONJ_WRAP' alg_epi_tac ((alg_sets ~~ str_init_defs) ~~ set_maps)] 1 |
|
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
339 |
end; |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
340 |
|
56237 | 341 |
fun mk_init_ex_mor_tac ctxt Abs_inverse copy card_of_min_algs mor_Rep mor_comp mor_select mor_incl = |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
342 |
let |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
343 |
val n = length card_of_min_algs; |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
344 |
in |
56237 | 345 |
EVERY' [Method.insert_tac (map (fn thm => thm RS @{thm ex_bij_betw}) card_of_min_algs), |
346 |
REPEAT_DETERM o etac exE, rtac rev_mp, rtac copy, REPEAT_DETERM_N n o atac, |
|
347 |
rtac impI, REPEAT_DETERM o eresolve_tac [exE, conjE], REPEAT_DETERM_N n o rtac exI, |
|
348 |
rtac mor_comp, rtac mor_Rep, rtac mor_select, rtac CollectI, REPEAT_DETERM o rtac exI, |
|
349 |
rtac conjI, rtac refl, atac, |
|
350 |
SELECT_GOAL (unfold_thms_tac ctxt (Abs_inverse :: fst_snd_convs)), |
|
351 |
etac mor_comp, rtac mor_incl, REPEAT_DETERM_N n o rtac subset_UNIV] 1 |
|
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
352 |
end; |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
353 |
|
56263 | 354 |
fun mk_init_unique_mor_tac cts m |
51761
4c9f08836d87
renamed "map_cong" axiom to "map_cong0" in preparation for real "map_cong"
blanchet
parents:
51739
diff
changeset
|
355 |
alg_def alg_min_alg least_min_algs in_monos alg_sets morEs map_cong0s = |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
356 |
let |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
357 |
val n = length least_min_algs; |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
358 |
val ks = (1 upto n); |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
359 |
|
49306 | 360 |
fun mor_tac morE in_mono = EVERY' [etac morE, rtac set_mp, rtac in_mono, |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
361 |
REPEAT_DETERM_N n o rtac @{thm Collect_restrict}, rtac CollectI, |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
362 |
REPEAT_DETERM_N (m + n) o (TRY o rtac conjI THEN' atac)]; |
56263 | 363 |
fun cong_tac ct map_cong0 = EVERY' |
364 |
[rtac (map_cong0 RS cterm_instantiate_pos [NONE, NONE, SOME ct] arg_cong), |
|
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
365 |
REPEAT_DETERM_N m o rtac refl, |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
366 |
REPEAT_DETERM_N n o (etac @{thm prop_restrict} THEN' atac)]; |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
367 |
|
56263 | 368 |
fun mk_alg_tac (ct, (alg_set, (in_mono, (morE, map_cong0)))) = |
369 |
EVERY' [rtac ballI, rtac CollectI, |
|
370 |
REPEAT_DETERM o eresolve_tac [CollectE, conjE], rtac conjI, rtac (alg_min_alg RS alg_set), |
|
371 |
REPEAT_DETERM_N n o (etac subset_trans THEN' rtac @{thm Collect_restrict}), |
|
372 |
rtac trans, mor_tac morE in_mono, |
|
373 |
rtac trans, cong_tac ct map_cong0, |
|
374 |
rtac sym, mor_tac morE in_mono]; |
|
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
375 |
|
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
376 |
fun mk_unique_tac (k, least_min_alg) = |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
377 |
select_prem_tac n (etac @{thm prop_restrict}) k THEN' rtac least_min_alg THEN' |
56114 | 378 |
rtac (alg_def RS iffD2) THEN' |
56263 | 379 |
CONJ_WRAP' mk_alg_tac (cts ~~ (alg_sets ~~ (in_monos ~~ (morEs ~~ map_cong0s)))); |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
380 |
in |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
381 |
CONJ_WRAP' mk_unique_tac (ks ~~ least_min_algs) 1 |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
382 |
end; |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
383 |
|
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
384 |
fun mk_init_induct_tac m alg_def alg_min_alg least_min_algs alg_sets = |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
385 |
let |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
386 |
val n = length least_min_algs; |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
387 |
|
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
388 |
fun mk_alg_tac alg_set = EVERY' [rtac ballI, rtac CollectI, |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
389 |
REPEAT_DETERM o eresolve_tac [CollectE, conjE], rtac conjI, rtac (alg_min_alg RS alg_set), |
49306 | 390 |
REPEAT_DETERM_N n o (etac subset_trans THEN' rtac @{thm Collect_restrict}), |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
391 |
rtac mp, etac bspec, rtac CollectI, |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
392 |
REPEAT_DETERM_N m o (rtac conjI THEN' atac), |
49306 | 393 |
CONJ_WRAP' (K (etac subset_trans THEN' rtac @{thm Collect_restrict})) alg_sets, |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
394 |
CONJ_WRAP' (K (rtac ballI THEN' etac @{thm prop_restrict} THEN' atac)) alg_sets]; |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
395 |
|
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
396 |
fun mk_induct_tac least_min_alg = |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
397 |
rtac ballI THEN' etac @{thm prop_restrict} THEN' rtac least_min_alg THEN' |
56114 | 398 |
rtac (alg_def RS iffD2) THEN' |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
399 |
CONJ_WRAP' mk_alg_tac alg_sets; |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
400 |
in |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
401 |
CONJ_WRAP' mk_induct_tac least_min_algs 1 |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
402 |
end; |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
403 |
|
56237 | 404 |
fun mk_mor_Rep_tac ctxt m defs Reps Abs_inverses alg_min_alg alg_sets set_mapss = |
405 |
unfold_thms_tac ctxt (@{thm o_apply} :: defs) THEN |
|
406 |
EVERY' [rtac conjI, |
|
407 |
CONJ_WRAP' (fn thm => rtac ballI THEN' rtac thm) Reps, |
|
408 |
CONJ_WRAP' (fn (Abs_inverse, (set_maps, alg_set)) => |
|
409 |
EVERY' [rtac ballI, rtac Abs_inverse, rtac (alg_min_alg RS alg_set), |
|
410 |
EVERY' (map2 (fn Rep => fn set_map => |
|
411 |
EVERY' [rtac (set_map RS ord_eq_le_trans), rtac @{thm image_subsetI}, rtac Rep]) |
|
412 |
Reps (drop m set_maps))]) |
|
413 |
(Abs_inverses ~~ (set_mapss ~~ alg_sets))] 1; |
|
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
414 |
|
56237 | 415 |
fun mk_mor_Abs_tac ctxt cts defs Abs_inverses map_comp_ids map_congLs = |
416 |
unfold_thms_tac ctxt (@{thm o_apply} :: defs) THEN |
|
417 |
EVERY' [rtac conjI, |
|
418 |
CONJ_WRAP' (K (rtac ballI THEN' rtac UNIV_I)) Abs_inverses, |
|
419 |
CONJ_WRAP' (fn (ct, thm) => |
|
420 |
EVERY' [rtac ballI, REPEAT_DETERM o eresolve_tac [CollectE, conjE], |
|
56263 | 421 |
rtac (thm RS (cterm_instantiate_pos [NONE, NONE, SOME ct] arg_cong) RS sym), |
56237 | 422 |
EVERY' (map (fn Abs_inverse => |
423 |
EVERY' [rtac (o_apply RS trans RS ballI), etac (set_mp RS Abs_inverse), atac]) |
|
424 |
Abs_inverses)]) |
|
425 |
(cts ~~ map2 mk_trans map_comp_ids map_congLs)] 1;; |
|
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
426 |
|
49504
df9b897fb254
renamed "iter"/"coiter" to "fold"/"unfold" (cf. Wadler)
blanchet
parents:
49502
diff
changeset
|
427 |
fun mk_mor_fold_tac cT ct fold_defs ex_mor mor = |
df9b897fb254
renamed "iter"/"coiter" to "fold"/"unfold" (cf. Wadler)
blanchet
parents:
49502
diff
changeset
|
428 |
(EVERY' (map stac fold_defs) THEN' EVERY' [rtac rev_mp, rtac ex_mor, rtac impI] THEN' |
df9b897fb254
renamed "iter"/"coiter" to "fold"/"unfold" (cf. Wadler)
blanchet
parents:
49502
diff
changeset
|
429 |
REPEAT_DETERM_N (length fold_defs) o etac exE THEN' |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
430 |
rtac (Drule.instantiate' [SOME cT] [SOME ct] @{thm someI}) THEN' etac mor) 1; |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
431 |
|
49504
df9b897fb254
renamed "iter"/"coiter" to "fold"/"unfold" (cf. Wadler)
blanchet
parents:
49502
diff
changeset
|
432 |
fun mk_fold_unique_mor_tac type_defs init_unique_mors Reps mor_comp mor_Abs mor_fold = |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
433 |
let |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
434 |
fun mk_unique type_def = |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
435 |
EVERY' [rtac @{thm surj_fun_eq}, rtac (type_def RS @{thm type_definition.Abs_image}), |
49227 | 436 |
rtac ballI, resolve_tac init_unique_mors, |
437 |
EVERY' (map (fn thm => atac ORELSE' rtac thm) Reps), |
|
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
438 |
rtac mor_comp, rtac mor_Abs, atac, |
49504
df9b897fb254
renamed "iter"/"coiter" to "fold"/"unfold" (cf. Wadler)
blanchet
parents:
49502
diff
changeset
|
439 |
rtac mor_comp, rtac mor_Abs, rtac mor_fold]; |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
440 |
in |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
441 |
CONJ_WRAP' mk_unique type_defs 1 |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
442 |
end; |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
443 |
|
51761
4c9f08836d87
renamed "map_cong" axiom to "map_cong0" in preparation for real "map_cong"
blanchet
parents:
51739
diff
changeset
|
444 |
fun mk_dtor_o_ctor_tac dtor_def foldx map_comp_id map_cong0L ctor_o_folds = |
56114 | 445 |
EVERY' [rtac @{thm ext}, rtac trans, rtac o_apply, rtac (dtor_def RS fun_cong RS trans), |
446 |
rtac trans, rtac foldx, rtac trans, rtac map_comp_id, rtac trans, rtac map_cong0L, |
|
49306 | 447 |
EVERY' (map (fn thm => rtac ballI THEN' rtac (trans OF [thm RS fun_cong, id_apply])) |
49504
df9b897fb254
renamed "iter"/"coiter" to "fold"/"unfold" (cf. Wadler)
blanchet
parents:
49502
diff
changeset
|
448 |
ctor_o_folds), |
49306 | 449 |
rtac sym, rtac id_apply] 1; |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
450 |
|
55197 | 451 |
fun mk_rec_tac ctxt rec_defs foldx fst_recs = |
49504
df9b897fb254
renamed "iter"/"coiter" to "fold"/"unfold" (cf. Wadler)
blanchet
parents:
49502
diff
changeset
|
452 |
unfold_thms_tac ctxt |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
453 |
(rec_defs @ map (fn thm => thm RS @{thm convol_expand_snd}) fst_recs) THEN |
49504
df9b897fb254
renamed "iter"/"coiter" to "fold"/"unfold" (cf. Wadler)
blanchet
parents:
49502
diff
changeset
|
454 |
EVERY' [rtac trans, rtac o_apply, rtac trans, rtac (foldx RS @{thm arg_cong[of _ _ snd]}), |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
455 |
rtac @{thm snd_convol'}] 1; |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
456 |
|
55197 | 457 |
fun mk_rec_unique_mor_tac ctxt rec_defs fst_recs fold_unique_mor = |
51739
3514b90d0a8b
(co)rec is (just as the (un)fold) the unique morphism;
traytel
parents:
49585
diff
changeset
|
458 |
unfold_thms_tac ctxt |
3514b90d0a8b
(co)rec is (just as the (un)fold) the unique morphism;
traytel
parents:
49585
diff
changeset
|
459 |
(rec_defs @ map (fn thm => thm RS @{thm convol_expand_snd'}) fst_recs) THEN |
3514b90d0a8b
(co)rec is (just as the (un)fold) the unique morphism;
traytel
parents:
49585
diff
changeset
|
460 |
etac fold_unique_mor 1; |
3514b90d0a8b
(co)rec is (just as the (un)fold) the unique morphism;
traytel
parents:
49585
diff
changeset
|
461 |
|
53290 | 462 |
fun mk_ctor_induct_tac ctxt m set_mapss init_induct morEs mor_Abs Rep_invs Abs_invs Reps = |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
463 |
let |
53290 | 464 |
val n = length set_mapss; |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
465 |
val ks = 1 upto n; |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
466 |
|
53290 | 467 |
fun mk_IH_tac Rep_inv Abs_inv set_map = |
56114 | 468 |
DETERM o EVERY' [dtac meta_mp, rtac (Rep_inv RS arg_cong RS iffD1), etac bspec, |
53290 | 469 |
dtac set_rev_mp, rtac equalityD1, rtac set_map, etac imageE, |
56114 | 470 |
hyp_subst_tac ctxt, rtac (Abs_inv RS @{thm ssubst_mem}), etac set_mp, atac, atac]; |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
471 |
|
53290 | 472 |
fun mk_closed_tac (k, (morE, set_maps)) = |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
473 |
EVERY' [select_prem_tac n (dtac asm_rl) k, rtac ballI, rtac impI, |
56114 | 474 |
rtac (mor_Abs RS morE RS arg_cong RS iffD2), atac, |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
475 |
REPEAT_DETERM o eresolve_tac [CollectE, conjE], dtac @{thm meta_spec}, |
58634
9f10d82e8188
added parameterized ML antiquotations @{map N}, @{fold N}, @{fold_map N}, @{split_list N};
wenzelm
parents:
58446
diff
changeset
|
476 |
EVERY' (@{map 3} mk_IH_tac Rep_invs Abs_invs (drop m set_maps)), atac]; |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
477 |
|
49227 | 478 |
fun mk_induct_tac (Rep, Rep_inv) = |
56114 | 479 |
EVERY' [rtac (Rep_inv RS arg_cong RS iffD1), etac (Rep RSN (2, bspec))]; |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
480 |
in |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
481 |
(rtac mp THEN' rtac impI THEN' |
49227 | 482 |
DETERM o CONJ_WRAP_GEN' (etac conjE THEN' rtac conjI) mk_induct_tac (Reps ~~ Rep_invs) THEN' |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
483 |
rtac init_induct THEN' |
53290 | 484 |
DETERM o CONJ_WRAP' mk_closed_tac (ks ~~ (morEs ~~ set_mapss))) 1 |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
485 |
end; |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
486 |
|
55197 | 487 |
fun mk_ctor_induct2_tac ctxt cTs cts ctor_induct weak_ctor_inducts = |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
488 |
let |
49501 | 489 |
val n = length weak_ctor_inducts; |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
490 |
val ks = 1 upto n; |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
491 |
fun mk_inner_induct_tac induct i = |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
492 |
EVERY' [rtac allI, fo_rtac induct ctxt, |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
493 |
select_prem_tac n (dtac @{thm meta_spec2}) i, |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
494 |
REPEAT_DETERM_N n o |
54742
7a86358a3c0b
proper context for basic Simplifier operations: rewrite_rule, rewrite_goals_rule, rewrite_goals_tac etc.;
wenzelm
parents:
53290
diff
changeset
|
495 |
EVERY' [dtac meta_mp THEN_ALL_NEW Goal.norm_hhf_tac ctxt, |
49306 | 496 |
REPEAT_DETERM o dtac @{thm meta_spec}, etac (spec RS meta_mp), atac], |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
497 |
atac]; |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
498 |
in |
49501 | 499 |
EVERY' [rtac rev_mp, rtac (Drule.instantiate' cTs cts ctor_induct), |
500 |
EVERY' (map2 mk_inner_induct_tac weak_ctor_inducts ks), rtac impI, |
|
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
501 |
REPEAT_DETERM o eresolve_tac [conjE, allE], |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
502 |
CONJ_WRAP' (K atac) ks] 1 |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
503 |
end; |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
504 |
|
51761
4c9f08836d87
renamed "map_cong" axiom to "map_cong0" in preparation for real "map_cong"
blanchet
parents:
51739
diff
changeset
|
505 |
fun mk_map_tac m n foldx map_comp_id map_cong0 = |
55990 | 506 |
EVERY' [rtac @{thm ext}, rtac trans, rtac o_apply, rtac trans, rtac foldx, rtac trans, |
507 |
rtac o_apply, |
|
51761
4c9f08836d87
renamed "map_cong" axiom to "map_cong0" in preparation for real "map_cong"
blanchet
parents:
51739
diff
changeset
|
508 |
rtac trans, rtac (map_comp_id RS arg_cong), rtac trans, rtac (map_cong0 RS arg_cong), |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
509 |
REPEAT_DETERM_N m o rtac refl, |
49306 | 510 |
REPEAT_DETERM_N n o (EVERY' (map rtac [trans, o_apply, id_apply])), |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
511 |
rtac sym, rtac o_apply] 1; |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
512 |
|
55197 | 513 |
fun mk_ctor_map_unique_tac ctxt fold_unique sym_map_comps = |
52911 | 514 |
rtac fold_unique 1 THEN |
55067 | 515 |
unfold_thms_tac ctxt (sym_map_comps @ @{thms comp_assoc id_comp comp_id}) THEN |
52911 | 516 |
ALLGOALS atac; |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
517 |
|
55990 | 518 |
fun mk_set_tac foldx = EVERY' [rtac @{thm ext}, rtac trans, rtac o_apply, |
49504
df9b897fb254
renamed "iter"/"coiter" to "fold"/"unfold" (cf. Wadler)
blanchet
parents:
49502
diff
changeset
|
519 |
rtac trans, rtac foldx, rtac sym, rtac o_apply] 1; |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
520 |
|
53290 | 521 |
fun mk_ctor_set_tac set set_map set_maps = |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
522 |
let |
53290 | 523 |
val n = length set_maps; |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
524 |
fun mk_UN thm = rtac (thm RS @{thm arg_cong[of _ _ Union]} RS trans) THEN' |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
525 |
rtac @{thm Union_image_eq}; |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
526 |
in |
52659
58b87aa4dc3b
eliminate duplicated theorems (thanks to "Auto solve_direct" in jEdit)
traytel
parents:
52635
diff
changeset
|
527 |
EVERY' [rtac (set RS @{thm comp_eq_dest} RS trans), rtac Un_cong, |
53290 | 528 |
rtac (trans OF [set_map, trans_fun_cong_image_id_id_apply]), |
52659
58b87aa4dc3b
eliminate duplicated theorems (thanks to "Auto solve_direct" in jEdit)
traytel
parents:
52635
diff
changeset
|
529 |
REPEAT_DETERM_N (n - 1) o rtac Un_cong, |
53290 | 530 |
EVERY' (map mk_UN set_maps)] 1 |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
531 |
end; |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
532 |
|
55197 | 533 |
fun mk_set_nat_tac ctxt m induct_tac set_mapss ctor_maps csets ctor_sets i = |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
534 |
let |
49541 | 535 |
val n = length ctor_maps; |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
536 |
|
56248
67dc9549fa15
generalized and strengthened cong rules on compound operators, similar to 1ed737a98198
haftmann
parents:
56237
diff
changeset
|
537 |
fun useIH set_nat = EVERY' [rtac trans, rtac @{thm image_UN}, rtac trans, rtac @{thm SUP_cong}, |
67dc9549fa15
generalized and strengthened cong rules on compound operators, similar to 1ed737a98198
haftmann
parents:
56237
diff
changeset
|
538 |
rtac refl, Goal.assume_rule_tac ctxt, rtac sym, rtac trans, rtac @{thm SUP_cong}, |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
539 |
rtac set_nat, rtac refl, rtac @{thm UN_simps(10)}]; |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
540 |
|
49585
5c4a12550491
generate high-level "maps", "sets", and "rels" properties
blanchet
parents:
49544
diff
changeset
|
541 |
fun mk_set_nat cset ctor_map ctor_set set_nats = |
56262 | 542 |
EVERY' [rtac trans, rtac @{thm image_cong}, rtac ctor_set, rtac refl, rtac sym, |
543 |
rtac (trans OF [ctor_map RS cterm_instantiate_pos [NONE, NONE, SOME cset] arg_cong, |
|
544 |
ctor_set RS trans]), |
|
52659
58b87aa4dc3b
eliminate duplicated theorems (thanks to "Auto solve_direct" in jEdit)
traytel
parents:
52635
diff
changeset
|
545 |
rtac sym, EVERY' (map rtac [trans, @{thm image_Un}, Un_cong]), |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
546 |
rtac sym, rtac (nth set_nats (i - 1)), |
52659
58b87aa4dc3b
eliminate duplicated theorems (thanks to "Auto solve_direct" in jEdit)
traytel
parents:
52635
diff
changeset
|
547 |
REPEAT_DETERM_N (n - 1) o EVERY' (map rtac [trans, @{thm image_Un}, Un_cong]), |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
548 |
EVERY' (map useIH (drop m set_nats))]; |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
549 |
in |
58634
9f10d82e8188
added parameterized ML antiquotations @{map N}, @{fold N}, @{fold_map N}, @{split_list N};
wenzelm
parents:
58446
diff
changeset
|
550 |
(induct_tac THEN' EVERY' (@{map 4} mk_set_nat csets ctor_maps ctor_sets set_mapss)) 1 |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
551 |
end; |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
552 |
|
55197 | 553 |
fun mk_set_bd_tac ctxt m induct_tac bd_Cinfinite set_bdss ctor_sets i = |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
554 |
let |
49542
b39354db8629
renamed low-level "set_simps" and "set_induct" to have "ctor" or "dtor" in the name
blanchet
parents:
49541
diff
changeset
|
555 |
val n = length ctor_sets; |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
556 |
|
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
557 |
fun useIH set_bd = EVERY' [rtac @{thm UNION_Cinfinite_bound}, rtac set_bd, rtac ballI, |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
558 |
Goal.assume_rule_tac ctxt, rtac bd_Cinfinite]; |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
559 |
|
49585
5c4a12550491
generate high-level "maps", "sets", and "rels" properties
blanchet
parents:
49544
diff
changeset
|
560 |
fun mk_set_nat ctor_set set_bds = |
5c4a12550491
generate high-level "maps", "sets", and "rels" properties
blanchet
parents:
49544
diff
changeset
|
561 |
EVERY' [rtac @{thm ordIso_ordLeq_trans}, rtac @{thm card_of_ordIso_subst}, rtac ctor_set, |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
562 |
rtac (bd_Cinfinite RSN (3, @{thm Un_Cinfinite_bound})), rtac (nth set_bds (i - 1)), |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
563 |
REPEAT_DETERM_N (n - 1) o rtac (bd_Cinfinite RSN (3, @{thm Un_Cinfinite_bound})), |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
564 |
EVERY' (map useIH (drop m set_bds))]; |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
565 |
in |
49542
b39354db8629
renamed low-level "set_simps" and "set_induct" to have "ctor" or "dtor" in the name
blanchet
parents:
49541
diff
changeset
|
566 |
(induct_tac THEN' EVERY' (map2 mk_set_nat ctor_sets set_bdss)) 1 |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
567 |
end; |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
568 |
|
55197 | 569 |
fun mk_mcong_tac ctxt induct_tac set_setsss map_cong0s ctor_maps = |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
570 |
let |
49306 | 571 |
fun use_asm thm = EVERY' [etac bspec, etac set_rev_mp, rtac thm]; |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
572 |
|
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
573 |
fun useIH set_sets = EVERY' [rtac mp, Goal.assume_rule_tac ctxt, |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
574 |
CONJ_WRAP' (fn thm => |
49306 | 575 |
EVERY' [rtac ballI, etac bspec, etac set_rev_mp, etac thm]) set_sets]; |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
576 |
|
51761
4c9f08836d87
renamed "map_cong" axiom to "map_cong0" in preparation for real "map_cong"
blanchet
parents:
51739
diff
changeset
|
577 |
fun mk_map_cong0 ctor_map map_cong0 set_setss = |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
578 |
EVERY' [rtac impI, REPEAT_DETERM o etac conjE, |
51761
4c9f08836d87
renamed "map_cong" axiom to "map_cong0" in preparation for real "map_cong"
blanchet
parents:
51739
diff
changeset
|
579 |
rtac trans, rtac ctor_map, rtac trans, rtac (map_cong0 RS arg_cong), |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
580 |
EVERY' (map use_asm (map hd set_setss)), |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
581 |
EVERY' (map useIH (transpose (map tl set_setss))), |
49541 | 582 |
rtac sym, rtac ctor_map]; |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
583 |
in |
58634
9f10d82e8188
added parameterized ML antiquotations @{map N}, @{fold N}, @{fold_map N}, @{split_list N};
wenzelm
parents:
58446
diff
changeset
|
584 |
(induct_tac THEN' EVERY' (@{map 3} mk_map_cong0 ctor_maps map_cong0s set_setsss)) 1 |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
585 |
end; |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
586 |
|
57967 | 587 |
fun mk_le_rel_OO_tac ctxt m induct ctor_nchotomys ctor_Irels rel_mono_strong0s le_rel_OOs = |
54841
af71b753c459
express weak pullback property of bnfs only in terms of the relator
traytel
parents:
54793
diff
changeset
|
588 |
EVERY' (rtac induct :: |
58634
9f10d82e8188
added parameterized ML antiquotations @{map N}, @{fold N}, @{fold_map N}, @{split_list N};
wenzelm
parents:
58446
diff
changeset
|
589 |
@{map 4} (fn nchotomy => fn Irel => fn rel_mono => fn le_rel_OO => |
54841
af71b753c459
express weak pullback property of bnfs only in terms of the relator
traytel
parents:
54793
diff
changeset
|
590 |
EVERY' [rtac impI, etac (nchotomy RS @{thm nchotomy_relcomppE}), |
af71b753c459
express weak pullback property of bnfs only in terms of the relator
traytel
parents:
54793
diff
changeset
|
591 |
REPEAT_DETERM_N 2 o dtac (Irel RS iffD1), rtac (Irel RS iffD2), |
57726 | 592 |
rtac rel_mono, rtac (le_rel_OO RS @{thm predicate2D}), |
54841
af71b753c459
express weak pullback property of bnfs only in terms of the relator
traytel
parents:
54793
diff
changeset
|
593 |
rtac @{thm relcomppI}, atac, atac, |
af71b753c459
express weak pullback property of bnfs only in terms of the relator
traytel
parents:
54793
diff
changeset
|
594 |
REPEAT_DETERM_N m o EVERY' [rtac ballI, rtac ballI, rtac impI, atac], |
57726 | 595 |
REPEAT_DETERM_N (length le_rel_OOs) o |
54841
af71b753c459
express weak pullback property of bnfs only in terms of the relator
traytel
parents:
54793
diff
changeset
|
596 |
EVERY' [rtac ballI, rtac ballI, Goal.assume_rule_tac ctxt]]) |
57967 | 597 |
ctor_nchotomys ctor_Irels rel_mono_strong0s le_rel_OOs) 1; |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
598 |
|
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
599 |
(* BNF tactics *) |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
600 |
|
53270 | 601 |
fun mk_map_id0_tac map_id0s unique = |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
602 |
(rtac sym THEN' rtac unique THEN' |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
603 |
EVERY' (map (fn thm => |
55067 | 604 |
EVERY' [rtac trans, rtac @{thm id_comp}, rtac trans, rtac sym, rtac @{thm comp_id}, |
53270 | 605 |
rtac (thm RS sym RS arg_cong)]) map_id0s)) 1; |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
606 |
|
53287 | 607 |
fun mk_map_comp0_tac map_comp0s ctor_maps unique iplus1 = |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
608 |
let |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
609 |
val i = iplus1 - 1; |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
610 |
val unique' = Thm.permute_prems 0 i unique; |
53288 | 611 |
val map_comp0s' = drop i map_comp0s @ take i map_comp0s; |
49541 | 612 |
val ctor_maps' = drop i ctor_maps @ take i ctor_maps; |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
613 |
fun mk_comp comp simp = |
55990 | 614 |
EVERY' [rtac @{thm ext}, rtac trans, rtac o_apply, rtac trans, rtac o_apply, |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
615 |
rtac trans, rtac (simp RS arg_cong), rtac trans, rtac simp, |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
616 |
rtac trans, rtac (comp RS arg_cong), rtac sym, rtac o_apply]; |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
617 |
in |
53288 | 618 |
(rtac sym THEN' rtac unique' THEN' EVERY' (map2 mk_comp map_comp0s' ctor_maps')) 1 |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
619 |
end; |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
620 |
|
53289 | 621 |
fun mk_set_map0_tac set_nat = |
55990 | 622 |
EVERY' (map rtac [@{thm ext}, trans, o_apply, sym, trans, o_apply, set_nat]) 1; |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
623 |
|
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
624 |
fun mk_bd_card_order_tac bd_card_orders = |
54793 | 625 |
CONJ_WRAP_GEN' (rtac @{thm card_order_csum}) rtac bd_card_orders 1; |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
626 |
|
51798 | 627 |
fun mk_wit_tac ctxt n ctor_set wit = |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
628 |
REPEAT_DETERM (atac 1 ORELSE |
49585
5c4a12550491
generate high-level "maps", "sets", and "rels" properties
blanchet
parents:
49544
diff
changeset
|
629 |
EVERY' [dtac set_rev_mp, rtac equalityD1, resolve_tac ctor_set, |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
630 |
REPEAT_DETERM o |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
631 |
(TRY o REPEAT_DETERM o etac UnE THEN' TRY o etac @{thm UN_E} THEN' |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
632 |
(eresolve_tac wit ORELSE' |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
633 |
(dresolve_tac wit THEN' |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
634 |
(etac FalseE ORELSE' |
51798 | 635 |
EVERY' [hyp_subst_tac ctxt, dtac set_rev_mp, rtac equalityD1, resolve_tac ctor_set, |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
636 |
REPEAT_DETERM_N n o etac UnE]))))] 1); |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
637 |
|
53287 | 638 |
fun mk_ctor_rel_tac ctxt in_Irels i in_rel map_comp0 map_cong0 ctor_map ctor_sets ctor_inject |
53289 | 639 |
ctor_dtor set_map0s ctor_set_incls ctor_set_set_inclss = |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
640 |
let |
49544
24094fa47e0d
renamed "set_incl" etc. to have "ctor" or "dtor" in the name
blanchet
parents:
49543
diff
changeset
|
641 |
val m = length ctor_set_incls; |
24094fa47e0d
renamed "set_incl" etc. to have "ctor" or "dtor" in the name
blanchet
parents:
49543
diff
changeset
|
642 |
val n = length ctor_set_set_inclss; |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
643 |
|
53289 | 644 |
val (passive_set_map0s, active_set_map0s) = chop m set_map0s; |
51893
596baae88a88
got rid of the set based relator---use (binary) predicate based relator instead
traytel
parents:
51812
diff
changeset
|
645 |
val in_Irel = nth in_Irels (i - 1); |
49501 | 646 |
val le_arg_cong_ctor_dtor = ctor_dtor RS arg_cong RS ord_eq_le_trans; |
647 |
val eq_arg_cong_ctor_dtor = ctor_dtor RS arg_cong RS trans; |
|
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
648 |
val if_tac = |
51893
596baae88a88
got rid of the set based relator---use (binary) predicate based relator instead
traytel
parents:
51812
diff
changeset
|
649 |
EVERY' [dtac (in_Irel RS iffD1), REPEAT_DETERM o eresolve_tac [exE, conjE, CollectE], |
596baae88a88
got rid of the set based relator---use (binary) predicate based relator instead
traytel
parents:
51812
diff
changeset
|
650 |
rtac (in_rel RS iffD2), rtac exI, rtac conjI, rtac CollectI, |
53289 | 651 |
EVERY' (map2 (fn set_map0 => fn ctor_set_incl => |
652 |
EVERY' [rtac conjI, rtac ord_eq_le_trans, rtac set_map0, |
|
49306 | 653 |
rtac ord_eq_le_trans, rtac trans_fun_cong_image_id_id_apply, |
49544
24094fa47e0d
renamed "set_incl" etc. to have "ctor" or "dtor" in the name
blanchet
parents:
49543
diff
changeset
|
654 |
rtac (ctor_set_incl RS subset_trans), etac le_arg_cong_ctor_dtor]) |
53289 | 655 |
passive_set_map0s ctor_set_incls), |
656 |
CONJ_WRAP' (fn (in_Irel, (set_map0, ctor_set_set_incls)) => |
|
657 |
EVERY' [rtac ord_eq_le_trans, rtac set_map0, rtac @{thm image_subsetI}, rtac CollectI, |
|
55414
eab03e9cee8a
renamed '{prod,sum,bool,unit}_case' to 'case_...'
blanchet
parents:
55197
diff
changeset
|
658 |
rtac @{thm case_prodI}, rtac (in_Irel RS iffD2), rtac exI, rtac conjI, rtac CollectI, |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
659 |
CONJ_WRAP' (fn thm => |
49501 | 660 |
EVERY' (map etac [thm RS subset_trans, le_arg_cong_ctor_dtor])) |
49544
24094fa47e0d
renamed "set_incl" etc. to have "ctor" or "dtor" in the name
blanchet
parents:
49543
diff
changeset
|
661 |
ctor_set_set_incls, |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
662 |
rtac conjI, rtac refl, rtac refl]) |
53289 | 663 |
(in_Irels ~~ (active_set_map0s ~~ ctor_set_set_inclss)), |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
664 |
CONJ_WRAP' (fn conv => |
53287 | 665 |
EVERY' [rtac trans, rtac map_comp0, rtac trans, rtac map_cong0, |
55067 | 666 |
REPEAT_DETERM_N m o rtac @{thm fun_cong[OF comp_id]}, |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
667 |
REPEAT_DETERM_N n o EVERY' (map rtac [trans, o_apply, conv]), |
49541 | 668 |
rtac (ctor_inject RS iffD1), rtac trans, rtac sym, rtac ctor_map, |
49501 | 669 |
etac eq_arg_cong_ctor_dtor]) |
49306 | 670 |
fst_snd_convs]; |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
671 |
val only_if_tac = |
51893
596baae88a88
got rid of the set based relator---use (binary) predicate based relator instead
traytel
parents:
51812
diff
changeset
|
672 |
EVERY' [dtac (in_rel RS iffD1), REPEAT_DETERM o eresolve_tac [exE, conjE, CollectE], |
596baae88a88
got rid of the set based relator---use (binary) predicate based relator instead
traytel
parents:
51812
diff
changeset
|
673 |
rtac (in_Irel RS iffD2), rtac exI, rtac conjI, rtac CollectI, |
53289 | 674 |
CONJ_WRAP' (fn (ctor_set, passive_set_map0) => |
49585
5c4a12550491
generate high-level "maps", "sets", and "rels" properties
blanchet
parents:
49544
diff
changeset
|
675 |
EVERY' [rtac ord_eq_le_trans, rtac ctor_set, rtac @{thm Un_least}, |
49306 | 676 |
rtac ord_eq_le_trans, rtac @{thm box_equals[OF _ refl]}, |
53289 | 677 |
rtac passive_set_map0, rtac trans_fun_cong_image_id_id_apply, atac, |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
678 |
CONJ_WRAP_GEN' (rtac (Thm.permute_prems 0 1 @{thm Un_least})) |
53289 | 679 |
(fn (active_set_map0, in_Irel) => EVERY' [rtac ord_eq_le_trans, |
56248
67dc9549fa15
generalized and strengthened cong rules on compound operators, similar to 1ed737a98198
haftmann
parents:
56237
diff
changeset
|
680 |
rtac @{thm SUP_cong[OF _ refl]}, rtac active_set_map0, rtac @{thm UN_least}, |
49306 | 681 |
dtac set_rev_mp, etac @{thm image_mono}, etac imageE, |
51893
596baae88a88
got rid of the set based relator---use (binary) predicate based relator instead
traytel
parents:
51812
diff
changeset
|
682 |
dtac @{thm ssubst_mem[OF pair_collapse]}, |
596baae88a88
got rid of the set based relator---use (binary) predicate based relator instead
traytel
parents:
51812
diff
changeset
|
683 |
REPEAT_DETERM o eresolve_tac (CollectE :: conjE :: |
56765 | 684 |
@{thms case_prodE iffD1[OF prod.inject, elim_format]}), |
51893
596baae88a88
got rid of the set based relator---use (binary) predicate based relator instead
traytel
parents:
51812
diff
changeset
|
685 |
hyp_subst_tac ctxt, |
596baae88a88
got rid of the set based relator---use (binary) predicate based relator instead
traytel
parents:
51812
diff
changeset
|
686 |
dtac (in_Irel RS iffD1), dtac @{thm someI_ex}, REPEAT_DETERM o etac conjE, |
596baae88a88
got rid of the set based relator---use (binary) predicate based relator instead
traytel
parents:
51812
diff
changeset
|
687 |
REPEAT_DETERM o eresolve_tac [CollectE, conjE], atac]) |
53289 | 688 |
(rev (active_set_map0s ~~ in_Irels))]) |
689 |
(ctor_sets ~~ passive_set_map0s), |
|
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
690 |
rtac conjI, |
49541 | 691 |
REPEAT_DETERM_N 2 o EVERY' [rtac trans, rtac ctor_map, rtac (ctor_inject RS iffD2), |
53287 | 692 |
rtac trans, rtac map_comp0, rtac trans, rtac map_cong0, |
55067 | 693 |
REPEAT_DETERM_N m o rtac @{thm fun_cong[OF comp_id]}, |
51893
596baae88a88
got rid of the set based relator---use (binary) predicate based relator instead
traytel
parents:
51812
diff
changeset
|
694 |
EVERY' (map (fn in_Irel => EVERY' [rtac trans, rtac o_apply, dtac set_rev_mp, atac, |
596baae88a88
got rid of the set based relator---use (binary) predicate based relator instead
traytel
parents:
51812
diff
changeset
|
695 |
dtac @{thm ssubst_mem[OF pair_collapse]}, |
56765 | 696 |
REPEAT_DETERM o eresolve_tac (CollectE :: conjE :: |
697 |
@{thms case_prodE iffD1[OF prod.inject, elim_format]}), |
|
51893
596baae88a88
got rid of the set based relator---use (binary) predicate based relator instead
traytel
parents:
51812
diff
changeset
|
698 |
hyp_subst_tac ctxt, |
596baae88a88
got rid of the set based relator---use (binary) predicate based relator instead
traytel
parents:
51812
diff
changeset
|
699 |
dtac (in_Irel RS iffD1), dtac @{thm someI_ex}, REPEAT_DETERM o etac conjE, atac]) |
596baae88a88
got rid of the set based relator---use (binary) predicate based relator instead
traytel
parents:
51812
diff
changeset
|
700 |
in_Irels), |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
701 |
atac]] |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
702 |
in |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
703 |
EVERY' [rtac iffI, if_tac, only_if_tac] 1 |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
704 |
end; |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
705 |
|
58444 | 706 |
fun mk_ctor_rec_transfer_tac ctxt n m ctor_rec_defs ctor_fold_transfers pre_T_map_transfers |
707 |
ctor_rels = |
|
58446 | 708 |
CONJ_WRAP (fn (ctor_rec_def, ctor_fold_transfer) => |
709 |
REPEAT_DETERM (HEADGOAL (rtac rel_funI)) THEN |
|
710 |
unfold_thms_tac ctxt [ctor_rec_def, o_apply] THEN |
|
711 |
HEADGOAL (rtac @{thm rel_funD[OF snd_transfer]} THEN' |
|
712 |
etac (mk_rel_funDN_rotated (n + 1) ctor_fold_transfer) THEN' |
|
713 |
EVERY' (map2 (fn pre_T_map_transfer => fn ctor_rel => |
|
714 |
etac (mk_rel_funDN_rotated 2 @{thm convol_transfer}) THEN' |
|
715 |
rtac (mk_rel_funDN_rotated 2 @{thm comp_transfer}) THEN' |
|
716 |
rtac (mk_rel_funDN (m + n) pre_T_map_transfer) THEN' |
|
717 |
REPEAT_DETERM_N m o rtac @{thm id_transfer} THEN' |
|
718 |
REPEAT_DETERM o rtac @{thm fst_transfer} THEN' |
|
719 |
rtac rel_funI THEN' |
|
720 |
etac (ctor_rel RS iffD2)) pre_T_map_transfers ctor_rels))) |
|
721 |
(ctor_rec_defs ~~ ctor_fold_transfers); |
|
58444 | 722 |
|
57967 | 723 |
fun mk_rel_induct_tac ctxt IHs m ctor_induct2 ks ctor_rels rel_mono_strong0s = |
51918 | 724 |
let val n = length ks; |
725 |
in |
|
54998 | 726 |
unfold_tac ctxt @{thms le_fun_def le_bool_def all_simps(1,2)[symmetric]} THEN |
51918 | 727 |
EVERY' [REPEAT_DETERM o rtac allI, rtac ctor_induct2, |
58634
9f10d82e8188
added parameterized ML antiquotations @{map N}, @{fold N}, @{fold_map N}, @{split_list N};
wenzelm
parents:
58446
diff
changeset
|
728 |
EVERY' (@{map 3} (fn IH => fn ctor_rel => fn rel_mono_strong0 => |
52506 | 729 |
EVERY' [rtac impI, dtac (ctor_rel RS iffD1), rtac (IH RS @{thm spec2} RS mp), |
57967 | 730 |
etac rel_mono_strong0, |
51918 | 731 |
REPEAT_DETERM_N m o rtac @{thm ballI[OF ballI[OF imp_refl]]}, |
732 |
EVERY' (map (fn j => |
|
733 |
EVERY' [select_prem_tac n (dtac asm_rl) j, rtac @{thm ballI[OF ballI]}, |
|
734 |
Goal.assume_rule_tac ctxt]) ks)]) |
|
57967 | 735 |
IHs ctor_rels rel_mono_strong0s)] 1 |
51918 | 736 |
end; |
737 |
||
55901
8c6d49dd8ae1
renamed a pair of low-level theorems to have c/dtor in their names (like the others)
blanchet
parents:
55756
diff
changeset
|
738 |
fun mk_fold_transfer_tac ctxt m ctor_rel_induct map_transfers folds = |
52731 | 739 |
let |
740 |
val n = length map_transfers; |
|
741 |
in |
|
742 |
unfold_thms_tac ctxt |
|
55945 | 743 |
@{thms rel_fun_def_butlast all_conj_distrib[symmetric] imp_conjR[symmetric]} THEN |
744 |
unfold_thms_tac ctxt @{thms rel_fun_iff_leq_vimage2p} THEN |
|
52731 | 745 |
HEADGOAL (EVERY' |
55901
8c6d49dd8ae1
renamed a pair of low-level theorems to have c/dtor in their names (like the others)
blanchet
parents:
55756
diff
changeset
|
746 |
[REPEAT_DETERM o resolve_tac [allI, impI], rtac ctor_rel_induct, |
52731 | 747 |
EVERY' (map (fn map_transfer => EVERY' |
748 |
[REPEAT_DETERM o resolve_tac [allI, impI, @{thm vimage2pI}], |
|
749 |
SELECT_GOAL (unfold_thms_tac ctxt folds), |
|
750 |
etac @{thm predicate2D_vimage2p}, |
|
58446 | 751 |
rtac (funpow (m + n + 1) (fn thm => thm RS rel_funD) map_transfer), |
52731 | 752 |
REPEAT_DETERM_N m o rtac @{thm id_transfer}, |
55945 | 753 |
REPEAT_DETERM_N n o rtac @{thm vimage2p_rel_fun}, |
52731 | 754 |
atac]) |
755 |
map_transfers)]) |
|
756 |
end; |
|
757 |
||
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
758 |
end; |