author | wenzelm |
Sat, 15 Apr 2000 15:00:57 +0200 | |
changeset 8717 | 20c42415c07d |
parent 8201 | a81d18b0a9b1 |
child 9173 | 422968aeed49 |
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 |
||
2469 | 62 |
Addsimps [radd_Inl_iff, radd_Inr_iff, |
2493 | 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 |
|
2469 | 164 |
Addsimps [rmult_iff]; |
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 |
||
185 |
val [lina,linb] = goal OrderArith.thy |
|
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 |
||
5268 | 228 |
Goal "[| f: bij(A,C); g: bij(B,D) |] ==> \ |
1095
6d0aad5f50a5
Changed some definitions and proofs to use pattern-matching.
lcp
parents:
859
diff
changeset
|
229 |
\ (lam <x,y>:A*B. <f`x, g`y>) : bij(A*B, C*D)"; |
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] |
5147
825877190618
More tidying and removal of "\!\!... from Goal commands
paulson
parents:
5137
diff
changeset
|
237 |
"[| f: ord_iso(A,r,A',r'); g: ord_iso(B,s,B',s') |] ==> \ |
1461 | 238 |
\ (lam <x,y>:A*B. <f`x, g`y>) \ |
859 | 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]))); |
2925 | 243 |
by (Blast_tac 1); |
4091 | 244 |
by (blast_tac (claset() addIs [bij_is_inj RS inj_apply_equality]) 1); |
859 | 245 |
qed "prod_ord_iso_cong"; |
246 |
||
5067 | 247 |
Goal "(lam z:A. <x,z>) : bij(A, {x}*A)"; |
859 | 248 |
by (res_inst_tac [("d", "snd")] lam_bijective 1); |
8201 | 249 |
by Auto_tac; |
859 | 250 |
qed "singleton_prod_bij"; |
251 |
||
252 |
(*Used??*) |
|
5268 | 253 |
Goal "well_ord({x},xr) ==> \ |
859 | 254 |
\ (lam z:A. <x,z>) : ord_iso(A, r, {x}*A, rmult({x}, xr, A, r))"; |
255 |
by (resolve_tac [singleton_prod_bij RS ord_isoI] 1); |
|
2469 | 256 |
by (Asm_simp_tac 1); |
4091 | 257 |
by (blast_tac (claset() addEs [well_ord_is_wf RS wf_on_not_refl RS notE]) 1); |
859 | 258 |
qed "singleton_prod_ord_iso"; |
259 |
||
260 |
(*Here we build a complicated function term, then simplify it using |
|
261 |
case_cong, id_conv, comp_lam, case_case.*) |
|
5268 | 262 |
Goal "a~:C ==> \ |
3840 | 263 |
\ (lam x:C*B + D. case(%x. x, %y.<a,y>, x)) \ |
859 | 264 |
\ : bij(C*B + D, C*B Un {a}*D)"; |
1461 | 265 |
by (rtac subst_elem 1); |
859 | 266 |
by (resolve_tac [id_bij RS sum_bij RS comp_bij] 1); |
1461 | 267 |
by (rtac singleton_prod_bij 1); |
268 |
by (rtac sum_disjoint_bij 1); |
|
2925 | 269 |
by (Blast_tac 1); |
8201 | 270 |
by (asm_simp_tac (simpset() addcongs [case_cong]) 1); |
859 | 271 |
by (resolve_tac [comp_lam RS trans RS sym] 1); |
4091 | 272 |
by (fast_tac (claset() addSEs [case_type]) 1); |
273 |
by (asm_simp_tac (simpset() addsimps [case_case]) 1); |
|
859 | 274 |
qed "prod_sum_singleton_bij"; |
275 |
||
5268 | 276 |
Goal "[| a:A; well_ord(A,r) |] ==> \ |
3840 | 277 |
\ (lam x:pred(A,a,r)*B + pred(B,b,s). case(%x. x, %y.<a,y>, x)) \ |
1461 | 278 |
\ : ord_iso(pred(A,a,r)*B + pred(B,b,s), \ |
279 |
\ radd(A*B, rmult(A,r,B,s), B, s), \ |
|
859 | 280 |
\ pred(A,a,r)*B Un {a}*pred(B,b,s), rmult(A,r,B,s))"; |
281 |
by (resolve_tac [prod_sum_singleton_bij RS ord_isoI] 1); |
|
282 |
by (asm_simp_tac |
|
4091 | 283 |
(simpset() addsimps [pred_iff, well_ord_is_wf RS wf_on_not_refl]) 1); |
2469 | 284 |
by (Asm_simp_tac 1); |
859 | 285 |
by (REPEAT_FIRST (eresolve_tac [SigmaE, sumE, predE])); |
3016 | 286 |
by (ALLGOALS Asm_simp_tac); |
4091 | 287 |
by (ALLGOALS (blast_tac (claset() addEs [well_ord_is_wf RS wf_on_asym]))); |
859 | 288 |
qed "prod_sum_singleton_ord_iso"; |
289 |
||
290 |
(** Distributive law **) |
|
291 |
||
5268 | 292 |
Goal "(lam <x,z>:(A+B)*C. case(%y. Inl(<y,z>), %y. Inr(<y,z>), x)) \ |
859 | 293 |
\ : bij((A+B)*C, (A*C)+(B*C))"; |
294 |
by (res_inst_tac |
|
1095
6d0aad5f50a5
Changed some definitions and proofs to use pattern-matching.
lcp
parents:
859
diff
changeset
|
295 |
[("d", "case(%<x,y>.<Inl(x),y>, %<x,y>.<Inr(x),y>)")] lam_bijective 1); |
8201 | 296 |
by Auto_tac; |
859 | 297 |
qed "sum_prod_distrib_bij"; |
298 |
||
5268 | 299 |
Goal "(lam <x,z>:(A+B)*C. case(%y. Inl(<y,z>), %y. Inr(<y,z>), x)) \ |
859 | 300 |
\ : ord_iso((A+B)*C, rmult(A+B, radd(A,r,B,s), C, t), \ |
301 |
\ (A*C)+(B*C), radd(A*C, rmult(A,r,C,t), B*C, rmult(B,s,C,t)))"; |
|
302 |
by (resolve_tac [sum_prod_distrib_bij RS ord_isoI] 1); |
|
8201 | 303 |
by Auto_tac; |
859 | 304 |
qed "sum_prod_distrib_ord_iso"; |
305 |
||
306 |
(** Associativity **) |
|
307 |
||
5268 | 308 |
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
|
309 |
by (res_inst_tac [("d", "%<x, <y,z>>. <<x,y>, z>")] lam_bijective 1); |
8201 | 310 |
by Auto_tac; |
859 | 311 |
qed "prod_assoc_bij"; |
312 |
||
5268 | 313 |
Goal "(lam <<x,y>, z>:(A*B)*C. <x,<y,z>>) \ |
1461 | 314 |
\ : ord_iso((A*B)*C, rmult(A*B, rmult(A,r,B,s), C, t), \ |
859 | 315 |
\ A*(B*C), rmult(A, r, B*C, rmult(B,s,C,t)))"; |
316 |
by (resolve_tac [prod_assoc_bij RS ord_isoI] 1); |
|
8201 | 317 |
by Auto_tac; |
859 | 318 |
qed "prod_assoc_ord_iso"; |
319 |
||
437 | 320 |
(**** Inverse image of a relation ****) |
321 |
||
322 |
(** Rewrite rule **) |
|
323 |
||
8201 | 324 |
Goalw [rvimage_def] "<a,b> : rvimage(A,f,r) <-> <f`a,f`b>: r & a:A & b:A"; |
2925 | 325 |
by (Blast_tac 1); |
760 | 326 |
qed "rvimage_iff"; |
437 | 327 |
|
328 |
(** Type checking **) |
|
329 |
||
5067 | 330 |
Goalw [rvimage_def] "rvimage(A,f,r) <= A*A"; |
437 | 331 |
by (rtac Collect_subset 1); |
760 | 332 |
qed "rvimage_type"; |
437 | 333 |
|
782
200a16083201
added bind_thm for theorems defined by "standard ..."
clasohm
parents:
770
diff
changeset
|
334 |
bind_thm ("field_rvimage", (rvimage_type RS field_rel_subset)); |
437 | 335 |
|
8201 | 336 |
Goalw [rvimage_def] "rvimage(A,f, converse(r)) = converse(rvimage(A,f,r))"; |
2925 | 337 |
by (Blast_tac 1); |
835
313ac9b513f1
Added Krzysztof's theorems irrefl_rvimage, trans_on_rvimage,
lcp
parents:
815
diff
changeset
|
338 |
qed "rvimage_converse"; |
313ac9b513f1
Added Krzysztof's theorems irrefl_rvimage, trans_on_rvimage,
lcp
parents:
815
diff
changeset
|
339 |
|
313ac9b513f1
Added Krzysztof's theorems irrefl_rvimage, trans_on_rvimage,
lcp
parents:
815
diff
changeset
|
340 |
|
313ac9b513f1
Added Krzysztof's theorems irrefl_rvimage, trans_on_rvimage,
lcp
parents:
815
diff
changeset
|
341 |
(** Partial Ordering Properties **) |
313ac9b513f1
Added Krzysztof's theorems irrefl_rvimage, trans_on_rvimage,
lcp
parents:
815
diff
changeset
|
342 |
|
5067 | 343 |
Goalw [irrefl_def, rvimage_def] |
5147
825877190618
More tidying and removal of "\!\!... from Goal commands
paulson
parents:
5137
diff
changeset
|
344 |
"[| f: inj(A,B); irrefl(B,r) |] ==> irrefl(A, rvimage(A,f,r))"; |
4091 | 345 |
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
|
346 |
qed "irrefl_rvimage"; |
313ac9b513f1
Added Krzysztof's theorems irrefl_rvimage, trans_on_rvimage,
lcp
parents:
815
diff
changeset
|
347 |
|
5067 | 348 |
Goalw [trans_on_def, rvimage_def] |
5147
825877190618
More tidying and removal of "\!\!... from Goal commands
paulson
parents:
5137
diff
changeset
|
349 |
"[| f: inj(A,B); trans[B](r) |] ==> trans[A](rvimage(A,f,r))"; |
4091 | 350 |
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
|
351 |
qed "trans_on_rvimage"; |
313ac9b513f1
Added Krzysztof's theorems irrefl_rvimage, trans_on_rvimage,
lcp
parents:
815
diff
changeset
|
352 |
|
5067 | 353 |
Goalw [part_ord_def] |
5147
825877190618
More tidying and removal of "\!\!... from Goal commands
paulson
parents:
5137
diff
changeset
|
354 |
"[| f: inj(A,B); part_ord(B,r) |] ==> part_ord(A, rvimage(A,f,r))"; |
4091 | 355 |
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
|
356 |
qed "part_ord_rvimage"; |
437 | 357 |
|
358 |
(** Linearity **) |
|
359 |
||
360 |
val [finj,lin] = goalw OrderArith.thy [inj_def] |
|
361 |
"[| f: inj(A,B); linear(B,r) |] ==> linear(A,rvimage(A,f,r))"; |
|
362 |
by (rewtac linear_def); (*Note! the premises are NOT rewritten*) |
|
363 |
by (REPEAT_FIRST (ares_tac [ballI])); |
|
4091 | 364 |
by (asm_simp_tac (simpset() addsimps [rvimage_iff]) 1); |
437 | 365 |
by (cut_facts_tac [finj] 1); |
366 |
by (res_inst_tac [("x","f`x"), ("y","f`y")] (lin RS linearE) 1); |
|
4091 | 367 |
by (REPEAT_SOME (blast_tac (claset() addIs [apply_funtype]))); |
760 | 368 |
qed "linear_rvimage"; |
437 | 369 |
|
5067 | 370 |
Goalw [tot_ord_def] |
5147
825877190618
More tidying and removal of "\!\!... from Goal commands
paulson
parents:
5137
diff
changeset
|
371 |
"[| f: inj(A,B); tot_ord(B,r) |] ==> tot_ord(A, rvimage(A,f,r))"; |
4091 | 372 |
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
|
373 |
qed "tot_ord_rvimage"; |
313ac9b513f1
Added Krzysztof's theorems irrefl_rvimage, trans_on_rvimage,
lcp
parents:
815
diff
changeset
|
374 |
|
437 | 375 |
|
376 |
(** Well-foundedness **) |
|
377 |
||
5268 | 378 |
Goal "[| f: A->B; wf[B](r) |] ==> wf[A](rvimage(A,f,r))"; |
437 | 379 |
by (rtac wf_onI2 1); |
380 |
by (subgoal_tac "ALL z:A. f`z=f`y --> z: Ba" 1); |
|
2925 | 381 |
by (Blast_tac 1); |
437 | 382 |
by (eres_inst_tac [("a","f`y")] wf_on_induct 1); |
4091 | 383 |
by (blast_tac (claset() addSIs [apply_funtype]) 1); |
384 |
by (blast_tac (claset() addSIs [apply_funtype] |
|
8201 | 385 |
addSDs [rvimage_iff RS iffD1]) 1); |
760 | 386 |
qed "wf_on_rvimage"; |
437 | 387 |
|
835
313ac9b513f1
Added Krzysztof's theorems irrefl_rvimage, trans_on_rvimage,
lcp
parents:
815
diff
changeset
|
388 |
(*Note that we need only wf[A](...) and linear(A,...) to get the result!*) |
5268 | 389 |
Goal "[| f: inj(A,B); well_ord(B,r) |] ==> well_ord(A, rvimage(A,f,r))"; |
437 | 390 |
by (rtac well_ordI 1); |
391 |
by (rewrite_goals_tac [well_ord_def, tot_ord_def]); |
|
4091 | 392 |
by (blast_tac (claset() addSIs [wf_on_rvimage, inj_is_fun]) 1); |
393 |
by (blast_tac (claset() addSIs [linear_rvimage]) 1); |
|
760 | 394 |
qed "well_ord_rvimage"; |
815 | 395 |
|
5067 | 396 |
Goalw [ord_iso_def] |
5147
825877190618
More tidying and removal of "\!\!... from Goal commands
paulson
parents:
5137
diff
changeset
|
397 |
"f: bij(A,B) ==> f: ord_iso(A, rvimage(A,f,s), B, s)"; |
4091 | 398 |
by (asm_full_simp_tac (simpset() addsimps [rvimage_iff]) 1); |
815 | 399 |
qed "ord_iso_rvimage"; |
835
313ac9b513f1
Added Krzysztof's theorems irrefl_rvimage, trans_on_rvimage,
lcp
parents:
815
diff
changeset
|
400 |
|
5067 | 401 |
Goalw [ord_iso_def, rvimage_def] |
5147
825877190618
More tidying and removal of "\!\!... from Goal commands
paulson
parents:
5137
diff
changeset
|
402 |
"f: ord_iso(A,r, B,s) ==> rvimage(A,f,s) = r Int A*A"; |
3016 | 403 |
by (Blast_tac 1); |
835
313ac9b513f1
Added Krzysztof's theorems irrefl_rvimage, trans_on_rvimage,
lcp
parents:
815
diff
changeset
|
404 |
qed "ord_iso_rvimage_eq"; |