author | wenzelm |
Thu, 28 Sep 2000 19:07:09 +0200 | |
changeset 10111 | 78a0397eaec1 |
parent 9907 | 473a6604da94 |
permissions | -rw-r--r-- |
1461 | 1 |
(* Title: ZF/OrderArith.ML |
437 | 2 |
ID: $Id$ |
1461 | 3 |
Author: Lawrence C Paulson, Cambridge University Computer Laboratory |
437 | 4 |
Copyright 1994 University of Cambridge |
5 |
||
6 |
Towards ordinal arithmetic |
|
7 |
*) |
|
8 |
||
9 |
(**** Addition of relations -- disjoint sum ****) |
|
10 |
||
11 |
(** Rewrite rules. Can be used to obtain introduction rules **) |
|
12 |
||
5067 | 13 |
Goalw [radd_def] |
437 | 14 |
"<Inl(a), Inr(b)> : radd(A,r,B,s) <-> a:A & b:B"; |
2925 | 15 |
by (Blast_tac 1); |
760 | 16 |
qed "radd_Inl_Inr_iff"; |
437 | 17 |
|
5067 | 18 |
Goalw [radd_def] |
859 | 19 |
"<Inl(a'), Inl(a)> : radd(A,r,B,s) <-> a':A & a:A & <a',a>:r"; |
2925 | 20 |
by (Blast_tac 1); |
760 | 21 |
qed "radd_Inl_iff"; |
437 | 22 |
|
5067 | 23 |
Goalw [radd_def] |
859 | 24 |
"<Inr(b'), Inr(b)> : radd(A,r,B,s) <-> b':B & b:B & <b',b>:s"; |
2925 | 25 |
by (Blast_tac 1); |
760 | 26 |
qed "radd_Inr_iff"; |
437 | 27 |
|
5067 | 28 |
Goalw [radd_def] |
437 | 29 |
"<Inr(b), Inl(a)> : radd(A,r,B,s) <-> False"; |
2925 | 30 |
by (Blast_tac 1); |
760 | 31 |
qed "radd_Inr_Inl_iff"; |
437 | 32 |
|
33 |
(** Elimination Rule **) |
|
34 |
||
5268 | 35 |
val major::prems = Goalw [radd_def] |
1461 | 36 |
"[| <p',p> : radd(A,r,B,s); \ |
37 |
\ !!x y. [| p'=Inl(x); x:A; p=Inr(y); y:B |] ==> Q; \ |
|
38 |
\ !!x' x. [| p'=Inl(x'); p=Inl(x); <x',x>: r; x':A; x:A |] ==> Q; \ |
|
39 |
\ !!y' y. [| p'=Inr(y'); p=Inr(y); <y',y>: s; y':B; y:B |] ==> Q \ |
|
437 | 40 |
\ |] ==> Q"; |
41 |
by (cut_facts_tac [major] 1); |
|
42 |
(*Split into the three cases*) |
|
2925 | 43 |
by (REPEAT_FIRST (*can't use safe_tac: don't want hyp_subst_tac*) |
437 | 44 |
(eresolve_tac [CollectE, Pair_inject, conjE, exE, SigmaE, disjE])); |
45 |
(*Apply each premise to correct subgoal; can't just use fast_tac |
|
46 |
because hyp_subst_tac would delete equalities too quickly*) |
|
47 |
by (EVERY (map (fn prem => |
|
2493 | 48 |
EVERY1 [rtac prem, assume_tac, REPEAT o Fast_tac]) |
1461 | 49 |
prems)); |
760 | 50 |
qed "raddE"; |
437 | 51 |
|
52 |
(** Type checking **) |
|
53 |
||
5067 | 54 |
Goalw [radd_def] "radd(A,r,B,s) <= (A+B) * (A+B)"; |
437 | 55 |
by (rtac Collect_subset 1); |
760 | 56 |
qed "radd_type"; |
437 | 57 |
|
2469 | 58 |
bind_thm ("field_radd", radd_type RS field_rel_subset); |
437 | 59 |
|
60 |
(** Linearity **) |
|
61 |
||
9842 | 62 |
AddIffs [radd_Inl_iff, radd_Inr_iff, |
63 |
radd_Inl_Inr_iff, radd_Inr_Inl_iff]; |
|
437 | 64 |
|
5067 | 65 |
Goalw [linear_def] |
5147
825877190618
More tidying and removal of "\!\!... from Goal commands
paulson
parents:
5137
diff
changeset
|
66 |
"[| linear(A,r); linear(B,s) |] ==> linear(A+B,radd(A,r,B,s))"; |
8201 | 67 |
by (Force_tac 1); |
760 | 68 |
qed "linear_radd"; |
437 | 69 |
|
70 |
||
71 |
(** Well-foundedness **) |
|
72 |
||
5268 | 73 |
Goal "[| wf[A](r); wf[B](s) |] ==> wf[A+B](radd(A,r,B,s))"; |
437 | 74 |
by (rtac wf_onI2 1); |
75 |
by (subgoal_tac "ALL x:A. Inl(x): Ba" 1); |
|
76 |
(*Proving the lemma, which is needed twice!*) |
|
1957 | 77 |
by (thin_tac "y : A + B" 2); |
437 | 78 |
by (rtac ballI 2); |
79 |
by (eres_inst_tac [("r","r"),("a","x")] wf_on_induct 2 THEN assume_tac 2); |
|
4091 | 80 |
by (best_tac (claset() addSEs [raddE, bspec RS mp]) 2); |
437 | 81 |
(*Returning to main part of proof*) |
5488 | 82 |
by Safe_tac; |
3016 | 83 |
by (Blast_tac 1); |
437 | 84 |
by (eres_inst_tac [("r","s"),("a","ya")] wf_on_induct 1 THEN assume_tac 1); |
4091 | 85 |
by (best_tac (claset() addSEs [raddE, bspec RS mp]) 1); |
760 | 86 |
qed "wf_on_radd"; |
437 | 87 |
|
5268 | 88 |
Goal "[| wf(r); wf(s) |] ==> wf(radd(field(r),r,field(s),s))"; |
4091 | 89 |
by (asm_full_simp_tac (simpset() addsimps [wf_iff_wf_on_field]) 1); |
437 | 90 |
by (rtac (field_radd RSN (2, wf_on_subset_A)) 1); |
91 |
by (REPEAT (ares_tac [wf_on_radd] 1)); |
|
760 | 92 |
qed "wf_radd"; |
437 | 93 |
|
5268 | 94 |
Goal "[| well_ord(A,r); well_ord(B,s) |] ==> \ |
437 | 95 |
\ well_ord(A+B, radd(A,r,B,s))"; |
96 |
by (rtac well_ordI 1); |
|
4091 | 97 |
by (asm_full_simp_tac (simpset() addsimps [well_ord_def, wf_on_radd]) 1); |
437 | 98 |
by (asm_full_simp_tac |
4091 | 99 |
(simpset() addsimps [well_ord_def, tot_ord_def, linear_radd]) 1); |
760 | 100 |
qed "well_ord_radd"; |
437 | 101 |
|
859 | 102 |
(** An ord_iso congruence law **) |
103 |
||
5268 | 104 |
Goal "[| f: bij(A,C); g: bij(B,D) |] ==> \ |
859 | 105 |
\ (lam z:A+B. case(%x. Inl(f`x), %y. Inr(g`y), z)) : bij(A+B, C+D)"; |
106 |
by (res_inst_tac |
|
107 |
[("d", "case(%x. Inl(converse(f)`x), %y. Inr(converse(g)`y))")] |
|
108 |
lam_bijective 1); |
|
8201 | 109 |
by Safe_tac; |
2469 | 110 |
by (ALLGOALS (asm_simp_tac bij_inverse_ss)); |
859 | 111 |
qed "sum_bij"; |
112 |
||
5067 | 113 |
Goalw [ord_iso_def] |
5147
825877190618
More tidying and removal of "\!\!... from Goal commands
paulson
parents:
5137
diff
changeset
|
114 |
"[| f: ord_iso(A,r,A',r'); g: ord_iso(B,s,B',s') |] ==> \ |
1461 | 115 |
\ (lam z:A+B. case(%x. Inl(f`x), %y. Inr(g`y), z)) \ |
859 | 116 |
\ : ord_iso(A+B, radd(A,r,B,s), A'+B', radd(A',r',B',s'))"; |
4091 | 117 |
by (safe_tac (claset() addSIs [sum_bij])); |
859 | 118 |
(*Do the beta-reductions now*) |
2469 | 119 |
by (ALLGOALS (Asm_full_simp_tac)); |
4152 | 120 |
by Safe_tac; |
859 | 121 |
(*8 subgoals!*) |
122 |
by (ALLGOALS |
|
123 |
(asm_full_simp_tac |
|
4091 | 124 |
(simpset() addcongs [conj_cong] addsimps [bij_is_fun RS apply_type]))); |
859 | 125 |
qed "sum_ord_iso_cong"; |
126 |
||
127 |
(*Could we prove an ord_iso result? Perhaps |
|
128 |
ord_iso(A+B, radd(A,r,B,s), A Un B, r Un s) *) |
|
5268 | 129 |
Goal "A Int B = 0 ==> \ |
3840 | 130 |
\ (lam z:A+B. case(%x. x, %y. y, z)) : bij(A+B, A Un B)"; |
6068 | 131 |
by (res_inst_tac [("d", "%z. if z:A then Inl(z) else Inr(z)")] |
859 | 132 |
lam_bijective 1); |
8201 | 133 |
by Auto_tac; |
859 | 134 |
qed "sum_disjoint_bij"; |
135 |
||
136 |
(** Associativity **) |
|
137 |
||
5268 | 138 |
Goal "(lam z:(A+B)+C. case(case(Inl, %y. Inr(Inl(y))), %y. Inr(Inr(y)), z)) \ |
859 | 139 |
\ : bij((A+B)+C, A+(B+C))"; |
3840 | 140 |
by (res_inst_tac [("d", "case(%x. Inl(Inl(x)), case(%x. Inl(Inr(x)), Inr))")] |
859 | 141 |
lam_bijective 1); |
8201 | 142 |
by Auto_tac; |
859 | 143 |
qed "sum_assoc_bij"; |
144 |
||
5268 | 145 |
Goal "(lam z:(A+B)+C. case(case(Inl, %y. Inr(Inl(y))), %y. Inr(Inr(y)), z)) \ |
1461 | 146 |
\ : ord_iso((A+B)+C, radd(A+B, radd(A,r,B,s), C, t), \ |
859 | 147 |
\ A+(B+C), radd(A, r, B+C, radd(B,s,C,t)))"; |
148 |
by (resolve_tac [sum_assoc_bij RS ord_isoI] 1); |
|
8201 | 149 |
by Auto_tac; |
859 | 150 |
qed "sum_assoc_ord_iso"; |
151 |
||
437 | 152 |
|
153 |
(**** Multiplication of relations -- lexicographic product ****) |
|
154 |
||
155 |
(** Rewrite rule. Can be used to obtain introduction rules **) |
|
156 |
||
5067 | 157 |
Goalw [rmult_def] |
5147
825877190618
More tidying and removal of "\!\!... from Goal commands
paulson
parents:
5137
diff
changeset
|
158 |
"<<a',b'>, <a,b>> : rmult(A,r,B,s) <-> \ |
1461 | 159 |
\ (<a',a>: r & a':A & a:A & b': B & b: B) | \ |
437 | 160 |
\ (<b',b>: s & a'=a & a:A & b': B & b: B)"; |
2925 | 161 |
by (Blast_tac 1); |
760 | 162 |
qed "rmult_iff"; |
437 | 163 |
|
9842 | 164 |
AddIffs [rmult_iff]; |
2469 | 165 |
|
5268 | 166 |
val major::prems = Goal |
1461 | 167 |
"[| <<a',b'>, <a,b>> : rmult(A,r,B,s); \ |
168 |
\ [| <a',a>: r; a':A; a:A; b':B; b:B |] ==> Q; \ |
|
169 |
\ [| <b',b>: s; a:A; a'=a; b':B; b:B |] ==> Q \ |
|
437 | 170 |
\ |] ==> Q"; |
171 |
by (rtac (major RS (rmult_iff RS iffD1) RS disjE) 1); |
|
172 |
by (DEPTH_SOLVE (eresolve_tac ([asm_rl, conjE] @ prems) 1)); |
|
760 | 173 |
qed "rmultE"; |
437 | 174 |
|
175 |
(** Type checking **) |
|
176 |
||
5067 | 177 |
Goalw [rmult_def] "rmult(A,r,B,s) <= (A*B) * (A*B)"; |
437 | 178 |
by (rtac Collect_subset 1); |
760 | 179 |
qed "rmult_type"; |
437 | 180 |
|
782
200a16083201
added bind_thm for theorems defined by "standard ..."
clasohm
parents:
770
diff
changeset
|
181 |
bind_thm ("field_rmult", (rmult_type RS field_rel_subset)); |
437 | 182 |
|
183 |
(** Linearity **) |
|
184 |
||
9907 | 185 |
val [lina,linb] = goal (the_context ()) |
437 | 186 |
"[| linear(A,r); linear(B,s) |] ==> linear(A*B,rmult(A,r,B,s))"; |
187 |
by (rewtac linear_def); (*Note! the premises are NOT rewritten*) |
|
188 |
by (REPEAT_FIRST (ares_tac [ballI] ORELSE' etac SigmaE)); |
|
2469 | 189 |
by (Asm_simp_tac 1); |
437 | 190 |
by (res_inst_tac [("x","xa"), ("y","xb")] (lina RS linearE) 1); |
191 |
by (res_inst_tac [("x","ya"), ("y","yb")] (linb RS linearE) 4); |
|
2925 | 192 |
by (REPEAT_SOME (Blast_tac)); |
760 | 193 |
qed "linear_rmult"; |
437 | 194 |
|
195 |
||
196 |
(** Well-foundedness **) |
|
197 |
||
5268 | 198 |
Goal "[| wf[A](r); wf[B](s) |] ==> wf[A*B](rmult(A,r,B,s))"; |
437 | 199 |
by (rtac wf_onI2 1); |
200 |
by (etac SigmaE 1); |
|
201 |
by (etac ssubst 1); |
|
202 |
by (subgoal_tac "ALL b:B. <x,b>: Ba" 1); |
|
2925 | 203 |
by (Blast_tac 1); |
437 | 204 |
by (eres_inst_tac [("a","x")] wf_on_induct 1 THEN assume_tac 1); |
205 |
by (rtac ballI 1); |
|
206 |
by (eres_inst_tac [("a","b")] wf_on_induct 1 THEN assume_tac 1); |
|
4091 | 207 |
by (best_tac (claset() addSEs [rmultE, bspec RS mp]) 1); |
760 | 208 |
qed "wf_on_rmult"; |
437 | 209 |
|
210 |
||
5268 | 211 |
Goal "[| wf(r); wf(s) |] ==> wf(rmult(field(r),r,field(s),s))"; |
4091 | 212 |
by (asm_full_simp_tac (simpset() addsimps [wf_iff_wf_on_field]) 1); |
437 | 213 |
by (rtac (field_rmult RSN (2, wf_on_subset_A)) 1); |
214 |
by (REPEAT (ares_tac [wf_on_rmult] 1)); |
|
760 | 215 |
qed "wf_rmult"; |
437 | 216 |
|
5268 | 217 |
Goal "[| well_ord(A,r); well_ord(B,s) |] ==> \ |
437 | 218 |
\ well_ord(A*B, rmult(A,r,B,s))"; |
219 |
by (rtac well_ordI 1); |
|
4091 | 220 |
by (asm_full_simp_tac (simpset() addsimps [well_ord_def, wf_on_rmult]) 1); |
437 | 221 |
by (asm_full_simp_tac |
4091 | 222 |
(simpset() addsimps [well_ord_def, tot_ord_def, linear_rmult]) 1); |
760 | 223 |
qed "well_ord_rmult"; |
437 | 224 |
|
225 |
||
859 | 226 |
(** An ord_iso congruence law **) |
227 |
||
9842 | 228 |
Goal "[| f: bij(A,C); g: bij(B,D) |] \ |
229 |
\ ==> (lam <x,y>:A*B. <f`x, g`y>) : bij(A*B, C*D)"; |
|
1095
6d0aad5f50a5
Changed some definitions and proofs to use pattern-matching.
lcp
parents:
859
diff
changeset
|
230 |
by (res_inst_tac [("d", "%<x,y>. <converse(f)`x, converse(g)`y>")] |
859 | 231 |
lam_bijective 1); |
4152 | 232 |
by Safe_tac; |
859 | 233 |
by (ALLGOALS (asm_simp_tac bij_inverse_ss)); |
234 |
qed "prod_bij"; |
|
235 |
||
5067 | 236 |
Goalw [ord_iso_def] |
9842 | 237 |
"[| f: ord_iso(A,r,A',r'); g: ord_iso(B,s,B',s') |] \ |
238 |
\ ==> (lam <x,y>:A*B. <f`x, g`y>) \ |
|
239 |
\ : ord_iso(A*B, rmult(A,r,B,s), A'*B', rmult(A',r',B',s'))"; |
|
4091 | 240 |
by (safe_tac (claset() addSIs [prod_bij])); |
859 | 241 |
by (ALLGOALS |
4091 | 242 |
(asm_full_simp_tac (simpset() addsimps [bij_is_fun RS apply_type]))); |
243 |
by (blast_tac (claset() addIs [bij_is_inj RS inj_apply_equality]) 1); |
|
859 | 244 |
qed "prod_ord_iso_cong"; |
245 |
||
5067 | 246 |
Goal "(lam z:A. <x,z>) : bij(A, {x}*A)"; |
859 | 247 |
by (res_inst_tac [("d", "snd")] lam_bijective 1); |
8201 | 248 |
by Auto_tac; |
859 | 249 |
qed "singleton_prod_bij"; |
250 |
||
251 |
(*Used??*) |
|
5268 | 252 |
Goal "well_ord({x},xr) ==> \ |
859 | 253 |
\ (lam z:A. <x,z>) : ord_iso(A, r, {x}*A, rmult({x}, xr, A, r))"; |
254 |
by (resolve_tac [singleton_prod_bij RS ord_isoI] 1); |
|
2469 | 255 |
by (Asm_simp_tac 1); |
9173 | 256 |
by (blast_tac (claset() addDs [well_ord_is_wf RS wf_on_not_refl]) 1); |
859 | 257 |
qed "singleton_prod_ord_iso"; |
258 |
||
259 |
(*Here we build a complicated function term, then simplify it using |
|
260 |
case_cong, id_conv, comp_lam, case_case.*) |
|
5268 | 261 |
Goal "a~:C ==> \ |
3840 | 262 |
\ (lam x:C*B + D. case(%x. x, %y.<a,y>, x)) \ |
859 | 263 |
\ : bij(C*B + D, C*B Un {a}*D)"; |
1461 | 264 |
by (rtac subst_elem 1); |
859 | 265 |
by (resolve_tac [id_bij RS sum_bij RS comp_bij] 1); |
1461 | 266 |
by (rtac singleton_prod_bij 1); |
267 |
by (rtac sum_disjoint_bij 1); |
|
2925 | 268 |
by (Blast_tac 1); |
8201 | 269 |
by (asm_simp_tac (simpset() addcongs [case_cong]) 1); |
859 | 270 |
by (resolve_tac [comp_lam RS trans RS sym] 1); |
4091 | 271 |
by (fast_tac (claset() addSEs [case_type]) 1); |
272 |
by (asm_simp_tac (simpset() addsimps [case_case]) 1); |
|
859 | 273 |
qed "prod_sum_singleton_bij"; |
274 |
||
5268 | 275 |
Goal "[| a:A; well_ord(A,r) |] ==> \ |
3840 | 276 |
\ (lam x:pred(A,a,r)*B + pred(B,b,s). case(%x. x, %y.<a,y>, x)) \ |
1461 | 277 |
\ : ord_iso(pred(A,a,r)*B + pred(B,b,s), \ |
278 |
\ radd(A*B, rmult(A,r,B,s), B, s), \ |
|
859 | 279 |
\ pred(A,a,r)*B Un {a}*pred(B,b,s), rmult(A,r,B,s))"; |
280 |
by (resolve_tac [prod_sum_singleton_bij RS ord_isoI] 1); |
|
281 |
by (asm_simp_tac |
|
4091 | 282 |
(simpset() addsimps [pred_iff, well_ord_is_wf RS wf_on_not_refl]) 1); |
9173 | 283 |
by (auto_tac (claset() addSEs [well_ord_is_wf RS wf_on_asym, predE], |
284 |
simpset())); |
|
859 | 285 |
qed "prod_sum_singleton_ord_iso"; |
286 |
||
287 |
(** Distributive law **) |
|
288 |
||
5268 | 289 |
Goal "(lam <x,z>:(A+B)*C. case(%y. Inl(<y,z>), %y. Inr(<y,z>), x)) \ |
859 | 290 |
\ : bij((A+B)*C, (A*C)+(B*C))"; |
291 |
by (res_inst_tac |
|
1095
6d0aad5f50a5
Changed some definitions and proofs to use pattern-matching.
lcp
parents:
859
diff
changeset
|
292 |
[("d", "case(%<x,y>.<Inl(x),y>, %<x,y>.<Inr(x),y>)")] lam_bijective 1); |
8201 | 293 |
by Auto_tac; |
859 | 294 |
qed "sum_prod_distrib_bij"; |
295 |
||
5268 | 296 |
Goal "(lam <x,z>:(A+B)*C. case(%y. Inl(<y,z>), %y. Inr(<y,z>), x)) \ |
859 | 297 |
\ : ord_iso((A+B)*C, rmult(A+B, radd(A,r,B,s), C, t), \ |
298 |
\ (A*C)+(B*C), radd(A*C, rmult(A,r,C,t), B*C, rmult(B,s,C,t)))"; |
|
299 |
by (resolve_tac [sum_prod_distrib_bij RS ord_isoI] 1); |
|
8201 | 300 |
by Auto_tac; |
859 | 301 |
qed "sum_prod_distrib_ord_iso"; |
302 |
||
303 |
(** Associativity **) |
|
304 |
||
5268 | 305 |
Goal "(lam <<x,y>, z>:(A*B)*C. <x,<y,z>>) : bij((A*B)*C, A*(B*C))"; |
1095
6d0aad5f50a5
Changed some definitions and proofs to use pattern-matching.
lcp
parents:
859
diff
changeset
|
306 |
by (res_inst_tac [("d", "%<x, <y,z>>. <<x,y>, z>")] lam_bijective 1); |
8201 | 307 |
by Auto_tac; |
859 | 308 |
qed "prod_assoc_bij"; |
309 |
||
5268 | 310 |
Goal "(lam <<x,y>, z>:(A*B)*C. <x,<y,z>>) \ |
1461 | 311 |
\ : ord_iso((A*B)*C, rmult(A*B, rmult(A,r,B,s), C, t), \ |
859 | 312 |
\ A*(B*C), rmult(A, r, B*C, rmult(B,s,C,t)))"; |
313 |
by (resolve_tac [prod_assoc_bij RS ord_isoI] 1); |
|
8201 | 314 |
by Auto_tac; |
859 | 315 |
qed "prod_assoc_ord_iso"; |
316 |
||
437 | 317 |
(**** Inverse image of a relation ****) |
318 |
||
319 |
(** Rewrite rule **) |
|
320 |
||
8201 | 321 |
Goalw [rvimage_def] "<a,b> : rvimage(A,f,r) <-> <f`a,f`b>: r & a:A & b:A"; |
2925 | 322 |
by (Blast_tac 1); |
760 | 323 |
qed "rvimage_iff"; |
437 | 324 |
|
325 |
(** Type checking **) |
|
326 |
||
5067 | 327 |
Goalw [rvimage_def] "rvimage(A,f,r) <= A*A"; |
437 | 328 |
by (rtac Collect_subset 1); |
760 | 329 |
qed "rvimage_type"; |
437 | 330 |
|
782
200a16083201
added bind_thm for theorems defined by "standard ..."
clasohm
parents:
770
diff
changeset
|
331 |
bind_thm ("field_rvimage", (rvimage_type RS field_rel_subset)); |
437 | 332 |
|
8201 | 333 |
Goalw [rvimage_def] "rvimage(A,f, converse(r)) = converse(rvimage(A,f,r))"; |
2925 | 334 |
by (Blast_tac 1); |
835
313ac9b513f1
Added Krzysztof's theorems irrefl_rvimage, trans_on_rvimage,
lcp
parents:
815
diff
changeset
|
335 |
qed "rvimage_converse"; |
313ac9b513f1
Added Krzysztof's theorems irrefl_rvimage, trans_on_rvimage,
lcp
parents:
815
diff
changeset
|
336 |
|
313ac9b513f1
Added Krzysztof's theorems irrefl_rvimage, trans_on_rvimage,
lcp
parents:
815
diff
changeset
|
337 |
|
313ac9b513f1
Added Krzysztof's theorems irrefl_rvimage, trans_on_rvimage,
lcp
parents:
815
diff
changeset
|
338 |
(** Partial Ordering Properties **) |
313ac9b513f1
Added Krzysztof's theorems irrefl_rvimage, trans_on_rvimage,
lcp
parents:
815
diff
changeset
|
339 |
|
5067 | 340 |
Goalw [irrefl_def, rvimage_def] |
5147
825877190618
More tidying and removal of "\!\!... from Goal commands
paulson
parents:
5137
diff
changeset
|
341 |
"[| f: inj(A,B); irrefl(B,r) |] ==> irrefl(A, rvimage(A,f,r))"; |
4091 | 342 |
by (blast_tac (claset() addIs [inj_is_fun RS apply_type]) 1); |
835
313ac9b513f1
Added Krzysztof's theorems irrefl_rvimage, trans_on_rvimage,
lcp
parents:
815
diff
changeset
|
343 |
qed "irrefl_rvimage"; |
313ac9b513f1
Added Krzysztof's theorems irrefl_rvimage, trans_on_rvimage,
lcp
parents:
815
diff
changeset
|
344 |
|
5067 | 345 |
Goalw [trans_on_def, rvimage_def] |
5147
825877190618
More tidying and removal of "\!\!... from Goal commands
paulson
parents:
5137
diff
changeset
|
346 |
"[| f: inj(A,B); trans[B](r) |] ==> trans[A](rvimage(A,f,r))"; |
4091 | 347 |
by (blast_tac (claset() addIs [inj_is_fun RS apply_type]) 1); |
835
313ac9b513f1
Added Krzysztof's theorems irrefl_rvimage, trans_on_rvimage,
lcp
parents:
815
diff
changeset
|
348 |
qed "trans_on_rvimage"; |
313ac9b513f1
Added Krzysztof's theorems irrefl_rvimage, trans_on_rvimage,
lcp
parents:
815
diff
changeset
|
349 |
|
5067 | 350 |
Goalw [part_ord_def] |
5147
825877190618
More tidying and removal of "\!\!... from Goal commands
paulson
parents:
5137
diff
changeset
|
351 |
"[| f: inj(A,B); part_ord(B,r) |] ==> part_ord(A, rvimage(A,f,r))"; |
4091 | 352 |
by (blast_tac (claset() addSIs [irrefl_rvimage, trans_on_rvimage]) 1); |
835
313ac9b513f1
Added Krzysztof's theorems irrefl_rvimage, trans_on_rvimage,
lcp
parents:
815
diff
changeset
|
353 |
qed "part_ord_rvimage"; |
437 | 354 |
|
355 |
(** Linearity **) |
|
356 |
||
9907 | 357 |
val [finj,lin] = goalw (the_context ()) [inj_def] |
437 | 358 |
"[| f: inj(A,B); linear(B,r) |] ==> linear(A,rvimage(A,f,r))"; |
359 |
by (rewtac linear_def); (*Note! the premises are NOT rewritten*) |
|
360 |
by (REPEAT_FIRST (ares_tac [ballI])); |
|
4091 | 361 |
by (asm_simp_tac (simpset() addsimps [rvimage_iff]) 1); |
437 | 362 |
by (cut_facts_tac [finj] 1); |
363 |
by (res_inst_tac [("x","f`x"), ("y","f`y")] (lin RS linearE) 1); |
|
4091 | 364 |
by (REPEAT_SOME (blast_tac (claset() addIs [apply_funtype]))); |
760 | 365 |
qed "linear_rvimage"; |
437 | 366 |
|
5067 | 367 |
Goalw [tot_ord_def] |
5147
825877190618
More tidying and removal of "\!\!... from Goal commands
paulson
parents:
5137
diff
changeset
|
368 |
"[| f: inj(A,B); tot_ord(B,r) |] ==> tot_ord(A, rvimage(A,f,r))"; |
4091 | 369 |
by (blast_tac (claset() addSIs [part_ord_rvimage, linear_rvimage]) 1); |
835
313ac9b513f1
Added Krzysztof's theorems irrefl_rvimage, trans_on_rvimage,
lcp
parents:
815
diff
changeset
|
370 |
qed "tot_ord_rvimage"; |
313ac9b513f1
Added Krzysztof's theorems irrefl_rvimage, trans_on_rvimage,
lcp
parents:
815
diff
changeset
|
371 |
|
437 | 372 |
|
373 |
(** Well-foundedness **) |
|
374 |
||
9883 | 375 |
(*Not sure if wf_on_rvimage could be proved from this!*) |
376 |
Goal "wf(r) ==> wf(rvimage(A,f,r))"; |
|
377 |
by (full_simp_tac (simpset() addsimps [rvimage_def, wf_eq_minimal]) 1); |
|
378 |
by (Clarify_tac 1); |
|
379 |
by (subgoal_tac "EX w. w : {w: {f`x. x:Q}. EX x. x: Q & (f`x = w)}" 1); |
|
380 |
by (blast_tac (claset() delrules [allE]) 2); |
|
381 |
by (etac allE 1); |
|
382 |
by (mp_tac 1); |
|
383 |
by (Blast_tac 1); |
|
384 |
qed "wf_rvimage"; |
|
385 |
AddSIs [wf_rvimage]; |
|
386 |
||
5268 | 387 |
Goal "[| f: A->B; wf[B](r) |] ==> wf[A](rvimage(A,f,r))"; |
437 | 388 |
by (rtac wf_onI2 1); |
389 |
by (subgoal_tac "ALL z:A. f`z=f`y --> z: Ba" 1); |
|
2925 | 390 |
by (Blast_tac 1); |
437 | 391 |
by (eres_inst_tac [("a","f`y")] wf_on_induct 1); |
4091 | 392 |
by (blast_tac (claset() addSIs [apply_funtype]) 1); |
393 |
by (blast_tac (claset() addSIs [apply_funtype] |
|
8201 | 394 |
addSDs [rvimage_iff RS iffD1]) 1); |
760 | 395 |
qed "wf_on_rvimage"; |
437 | 396 |
|
835
313ac9b513f1
Added Krzysztof's theorems irrefl_rvimage, trans_on_rvimage,
lcp
parents:
815
diff
changeset
|
397 |
(*Note that we need only wf[A](...) and linear(A,...) to get the result!*) |
5268 | 398 |
Goal "[| f: inj(A,B); well_ord(B,r) |] ==> well_ord(A, rvimage(A,f,r))"; |
437 | 399 |
by (rtac well_ordI 1); |
400 |
by (rewrite_goals_tac [well_ord_def, tot_ord_def]); |
|
4091 | 401 |
by (blast_tac (claset() addSIs [wf_on_rvimage, inj_is_fun]) 1); |
402 |
by (blast_tac (claset() addSIs [linear_rvimage]) 1); |
|
760 | 403 |
qed "well_ord_rvimage"; |
815 | 404 |
|
5067 | 405 |
Goalw [ord_iso_def] |
5147
825877190618
More tidying and removal of "\!\!... from Goal commands
paulson
parents:
5137
diff
changeset
|
406 |
"f: bij(A,B) ==> f: ord_iso(A, rvimage(A,f,s), B, s)"; |
4091 | 407 |
by (asm_full_simp_tac (simpset() addsimps [rvimage_iff]) 1); |
815 | 408 |
qed "ord_iso_rvimage"; |
835
313ac9b513f1
Added Krzysztof's theorems irrefl_rvimage, trans_on_rvimage,
lcp
parents:
815
diff
changeset
|
409 |
|
5067 | 410 |
Goalw [ord_iso_def, rvimage_def] |
5147
825877190618
More tidying and removal of "\!\!... from Goal commands
paulson
parents:
5137
diff
changeset
|
411 |
"f: ord_iso(A,r, B,s) ==> rvimage(A,f,s) = r Int A*A"; |
3016 | 412 |
by (Blast_tac 1); |
835
313ac9b513f1
Added Krzysztof's theorems irrefl_rvimage, trans_on_rvimage,
lcp
parents:
815
diff
changeset
|
413 |
qed "ord_iso_rvimage_eq"; |
9883 | 414 |
|
415 |
||
416 |
(** The "measure" relation is useful with wfrec **) |
|
417 |
||
418 |
Goal "measure(A,f) = rvimage(A,Lambda(A,f),Memrel(Collect(RepFun(A,f),Ord)))"; |
|
419 |
by (simp_tac (simpset() addsimps [measure_def, rvimage_def, Memrel_iff]) 1); |
|
420 |
by (rtac equalityI 1); |
|
421 |
by Auto_tac; |
|
422 |
by (auto_tac (claset() addIs [Ord_in_Ord], simpset() addsimps [lt_def])); |
|
423 |
qed "measure_eq_rvimage_Memrel"; |
|
424 |
||
425 |
Goal "wf(measure(A,f))"; |
|
426 |
by (simp_tac (simpset() addsimps [measure_eq_rvimage_Memrel, wf_Memrel, |
|
427 |
wf_rvimage]) 1); |
|
428 |
qed "wf_measure"; |
|
429 |
AddIffs [wf_measure]; |
|
430 |
||
431 |
Goal "<x,y> : measure(A,f) <-> x:A & y:A & f(x)<f(y)"; |
|
432 |
by (simp_tac (simpset() addsimps [measure_def]) 1); |
|
433 |
qed "measure_iff"; |
|
434 |
AddIffs [measure_iff]; |