7 -- Composition of relations, the identity relation |
7 -- Composition of relations, the identity relation |
8 -- Injections, surjections, bijections |
8 -- Injections, surjections, bijections |
9 -- Lemmas for the Schroeder-Bernstein Theorem |
9 -- Lemmas for the Schroeder-Bernstein Theorem |
10 *) |
10 *) |
11 |
11 |
12 Perm = mono + func + |
12 theory Perm = mono + func: |
13 consts |
13 |
14 O :: [i,i]=>i (infixr 60) |
14 constdefs |
15 |
15 |
16 defs |
|
17 (*composition of relations and functions; NOT Suppes's relative product*) |
16 (*composition of relations and functions; NOT Suppes's relative product*) |
18 comp_def "r O s == {xz : domain(s)*range(r) . |
17 comp :: "[i,i]=>i" (infixr "O" 60) |
19 EX x y z. xz=<x,z> & <x,y>:s & <y,z>:r}" |
18 "r O s == {xz : domain(s)*range(r) . |
20 |
19 EX x y z. xz=<x,z> & <x,y>:s & <y,z>:r}" |
21 constdefs |
20 |
22 (*the identity function for A*) |
21 (*the identity function for A*) |
23 id :: i=>i |
22 id :: "i=>i" |
24 "id(A) == (lam x:A. x)" |
23 "id(A) == (lam x:A. x)" |
25 |
24 |
26 (*one-to-one functions from A to B*) |
25 (*one-to-one functions from A to B*) |
27 inj :: [i,i]=>i |
26 inj :: "[i,i]=>i" |
28 "inj(A,B) == { f: A->B. ALL w:A. ALL x:A. f`w=f`x --> w=x}" |
27 "inj(A,B) == { f: A->B. ALL w:A. ALL x:A. f`w=f`x --> w=x}" |
29 |
28 |
30 (*onto functions from A to B*) |
29 (*onto functions from A to B*) |
31 surj :: [i,i]=>i |
30 surj :: "[i,i]=>i" |
32 "surj(A,B) == { f: A->B . ALL y:B. EX x:A. f`x=y}" |
31 "surj(A,B) == { f: A->B . ALL y:B. EX x:A. f`x=y}" |
33 |
32 |
34 (*one-to-one and onto functions*) |
33 (*one-to-one and onto functions*) |
35 bij :: [i,i]=>i |
34 bij :: "[i,i]=>i" |
36 "bij(A,B) == inj(A,B) Int surj(A,B)" |
35 "bij(A,B) == inj(A,B) Int surj(A,B)" |
|
36 |
|
37 |
|
38 (** Surjective function space **) |
|
39 |
|
40 lemma surj_is_fun: "f: surj(A,B) ==> f: A->B" |
|
41 apply (unfold surj_def) |
|
42 apply (erule CollectD1) |
|
43 done |
|
44 |
|
45 lemma fun_is_surj: "f : Pi(A,B) ==> f: surj(A,range(f))" |
|
46 apply (unfold surj_def) |
|
47 apply (blast intro: apply_equality range_of_fun domain_type) |
|
48 done |
|
49 |
|
50 lemma surj_range: "f: surj(A,B) ==> range(f)=B" |
|
51 apply (unfold surj_def) |
|
52 apply (best intro: apply_Pair elim: range_type) |
|
53 done |
|
54 |
|
55 (** A function with a right inverse is a surjection **) |
|
56 |
|
57 lemma f_imp_surjective: |
|
58 "[| f: A->B; !!y. y:B ==> d(y): A; !!y. y:B ==> f`d(y) = y |] |
|
59 ==> f: surj(A,B)" |
|
60 apply (simp add: surj_def) |
|
61 apply (blast) |
|
62 done |
|
63 |
|
64 lemma lam_surjective: |
|
65 "[| !!x. x:A ==> c(x): B; |
|
66 !!y. y:B ==> d(y): A; |
|
67 !!y. y:B ==> c(d(y)) = y |
|
68 |] ==> (lam x:A. c(x)) : surj(A,B)" |
|
69 apply (rule_tac d = "d" in f_imp_surjective) |
|
70 apply (simp_all add: lam_type) |
|
71 done |
|
72 |
|
73 (*Cantor's theorem revisited*) |
|
74 lemma cantor_surj: "f ~: surj(A,Pow(A))" |
|
75 apply (unfold surj_def) |
|
76 apply safe |
|
77 apply (cut_tac cantor) |
|
78 apply (best del: subsetI) |
|
79 done |
|
80 |
|
81 |
|
82 (** Injective function space **) |
|
83 |
|
84 lemma inj_is_fun: "f: inj(A,B) ==> f: A->B" |
|
85 apply (unfold inj_def) |
|
86 apply (erule CollectD1) |
|
87 done |
|
88 |
|
89 (*Good for dealing with sets of pairs, but a bit ugly in use [used in AC]*) |
|
90 lemma inj_equality: |
|
91 "[| <a,b>:f; <c,b>:f; f: inj(A,B) |] ==> a=c" |
|
92 apply (unfold inj_def) |
|
93 apply (blast dest: Pair_mem_PiD) |
|
94 done |
|
95 |
|
96 lemma inj_apply_equality: "[| f:inj(A,B); a:A; b:A; f`a=f`b |] ==> a=b" |
|
97 apply (unfold inj_def) |
|
98 apply blast |
|
99 done |
|
100 |
|
101 (** A function with a left inverse is an injection **) |
|
102 |
|
103 lemma f_imp_injective: "[| f: A->B; ALL x:A. d(f`x)=x |] ==> f: inj(A,B)" |
|
104 apply (simp (no_asm_simp) add: inj_def) |
|
105 apply (blast intro: subst_context [THEN box_equals]) |
|
106 done |
|
107 |
|
108 lemma lam_injective: |
|
109 "[| !!x. x:A ==> c(x): B; |
|
110 !!x. x:A ==> d(c(x)) = x |] |
|
111 ==> (lam x:A. c(x)) : inj(A,B)" |
|
112 apply (rule_tac d = "d" in f_imp_injective) |
|
113 apply (simp_all add: lam_type) |
|
114 done |
|
115 |
|
116 (** Bijections **) |
|
117 |
|
118 lemma bij_is_inj: "f: bij(A,B) ==> f: inj(A,B)" |
|
119 apply (unfold bij_def) |
|
120 apply (erule IntD1) |
|
121 done |
|
122 |
|
123 lemma bij_is_surj: "f: bij(A,B) ==> f: surj(A,B)" |
|
124 apply (unfold bij_def) |
|
125 apply (erule IntD2) |
|
126 done |
|
127 |
|
128 (* f: bij(A,B) ==> f: A->B *) |
|
129 lemmas bij_is_fun = bij_is_inj [THEN inj_is_fun, standard] |
|
130 |
|
131 lemma lam_bijective: |
|
132 "[| !!x. x:A ==> c(x): B; |
|
133 !!y. y:B ==> d(y): A; |
|
134 !!x. x:A ==> d(c(x)) = x; |
|
135 !!y. y:B ==> c(d(y)) = y |
|
136 |] ==> (lam x:A. c(x)) : bij(A,B)" |
|
137 apply (unfold bij_def) |
|
138 apply (blast intro!: lam_injective lam_surjective); |
|
139 done |
|
140 |
|
141 lemma RepFun_bijective: "(ALL y : x. EX! y'. f(y') = f(y)) |
|
142 ==> (lam z:{f(y). y:x}. THE y. f(y) = z) : bij({f(y). y:x}, x)" |
|
143 apply (rule_tac d = "f" in lam_bijective) |
|
144 apply (auto simp add: the_equality2) |
|
145 done |
|
146 |
|
147 |
|
148 (** Identity function **) |
|
149 |
|
150 lemma idI [intro!]: "a:A ==> <a,a> : id(A)" |
|
151 apply (unfold id_def) |
|
152 apply (erule lamI) |
|
153 done |
|
154 |
|
155 lemma idE [elim!]: "[| p: id(A); !!x.[| x:A; p=<x,x> |] ==> P |] ==> P" |
|
156 apply (simp add: id_def lam_def) |
|
157 apply (blast intro: elim:); |
|
158 done |
|
159 |
|
160 lemma id_type: "id(A) : A->A" |
|
161 apply (unfold id_def) |
|
162 apply (rule lam_type) |
|
163 apply assumption |
|
164 done |
|
165 |
|
166 lemma id_conv [simp]: "x:A ==> id(A)`x = x" |
|
167 apply (unfold id_def) |
|
168 apply (simp (no_asm_simp)) |
|
169 done |
|
170 |
|
171 lemma id_mono: "A<=B ==> id(A) <= id(B)" |
|
172 apply (unfold id_def) |
|
173 apply (erule lam_mono) |
|
174 done |
|
175 |
|
176 lemma id_subset_inj: "A<=B ==> id(A): inj(A,B)" |
|
177 apply (simp add: inj_def id_def) |
|
178 apply (blast intro: lam_type) |
|
179 done |
|
180 |
|
181 lemmas id_inj = subset_refl [THEN id_subset_inj, standard] |
|
182 |
|
183 lemma id_surj: "id(A): surj(A,A)" |
|
184 apply (unfold id_def surj_def) |
|
185 apply (simp (no_asm_simp)) |
|
186 done |
|
187 |
|
188 lemma id_bij: "id(A): bij(A,A)" |
|
189 apply (unfold bij_def) |
|
190 apply (blast intro: id_inj id_surj) |
|
191 done |
|
192 |
|
193 lemma subset_iff_id: "A <= B <-> id(A) : A->B" |
|
194 apply (unfold id_def) |
|
195 apply (force intro!: lam_type dest: apply_type); |
|
196 done |
|
197 |
|
198 |
|
199 (*** Converse of a function ***) |
|
200 |
|
201 lemma inj_converse_fun: "f: inj(A,B) ==> converse(f) : range(f)->A" |
|
202 apply (unfold inj_def) |
|
203 apply (simp (no_asm_simp) add: Pi_iff function_def) |
|
204 apply (erule CollectE) |
|
205 apply (simp (no_asm_simp) add: apply_iff) |
|
206 apply (blast dest: fun_is_rel) |
|
207 done |
|
208 |
|
209 (** Equations for converse(f) **) |
|
210 |
|
211 (*The premises are equivalent to saying that f is injective...*) |
|
212 lemma left_inverse_lemma: |
|
213 "[| f: A->B; converse(f): C->A; a: A |] ==> converse(f)`(f`a) = a" |
|
214 by (blast intro: apply_Pair apply_equality converseI) |
|
215 |
|
216 lemma left_inverse [simp]: "[| f: inj(A,B); a: A |] ==> converse(f)`(f`a) = a" |
|
217 apply (blast intro: left_inverse_lemma inj_converse_fun inj_is_fun) |
|
218 done |
|
219 |
|
220 lemmas left_inverse_bij = bij_is_inj [THEN left_inverse, standard] |
|
221 |
|
222 lemma right_inverse_lemma: |
|
223 "[| f: A->B; converse(f): C->A; b: C |] ==> f`(converse(f)`b) = b" |
|
224 apply (rule apply_Pair [THEN converseD [THEN apply_equality]]) |
|
225 apply (auto ); |
|
226 done |
|
227 |
|
228 (*Should the premises be f:surj(A,B), b:B for symmetry with left_inverse? |
|
229 No: they would not imply that converse(f) was a function! *) |
|
230 lemma right_inverse [simp]: |
|
231 "[| f: inj(A,B); b: range(f) |] ==> f`(converse(f)`b) = b" |
|
232 by (blast intro: right_inverse_lemma inj_converse_fun inj_is_fun) |
|
233 |
|
234 lemma right_inverse_bij: "[| f: bij(A,B); b: B |] ==> f`(converse(f)`b) = b" |
|
235 apply (force simp add: bij_def surj_range) |
|
236 done |
|
237 |
|
238 (** Converses of injections, surjections, bijections **) |
|
239 |
|
240 lemma inj_converse_inj: "f: inj(A,B) ==> converse(f): inj(range(f), A)" |
|
241 apply (rule f_imp_injective) |
|
242 apply (erule inj_converse_fun) |
|
243 apply (clarify ); |
|
244 apply (rule right_inverse); |
|
245 apply assumption |
|
246 apply (blast intro: elim:); |
|
247 done |
|
248 |
|
249 lemma inj_converse_surj: "f: inj(A,B) ==> converse(f): surj(range(f), A)" |
|
250 by (blast intro: f_imp_surjective inj_converse_fun left_inverse inj_is_fun |
|
251 range_of_fun [THEN apply_type]) |
|
252 |
|
253 (*Adding this as an intro! rule seems to cause looping*) |
|
254 lemma bij_converse_bij [TC]: "f: bij(A,B) ==> converse(f): bij(B,A)" |
|
255 apply (unfold bij_def) |
|
256 apply (fast elim: surj_range [THEN subst] inj_converse_inj inj_converse_surj) |
|
257 done |
|
258 |
|
259 |
|
260 |
|
261 (** Composition of two relations **) |
|
262 |
|
263 (*The inductive definition package could derive these theorems for (r O s)*) |
|
264 |
|
265 lemma compI [intro]: "[| <a,b>:s; <b,c>:r |] ==> <a,c> : r O s" |
|
266 apply (unfold comp_def) |
|
267 apply blast |
|
268 done |
|
269 |
|
270 lemma compE [elim!]: |
|
271 "[| xz : r O s; |
|
272 !!x y z. [| xz=<x,z>; <x,y>:s; <y,z>:r |] ==> P |] |
|
273 ==> P" |
|
274 apply (unfold comp_def) |
|
275 apply blast |
|
276 done |
|
277 |
|
278 lemma compEpair: |
|
279 "[| <a,c> : r O s; |
|
280 !!y. [| <a,y>:s; <y,c>:r |] ==> P |] |
|
281 ==> P" |
|
282 apply (erule compE) |
|
283 apply (simp add: ); |
|
284 done |
|
285 |
|
286 lemma converse_comp: "converse(R O S) = converse(S) O converse(R)" |
|
287 apply blast |
|
288 done |
|
289 |
|
290 |
|
291 (** Domain and Range -- see Suppes, section 3.1 **) |
|
292 |
|
293 (*Boyer et al., Set Theory in First-Order Logic, JAR 2 (1986), 287-327*) |
|
294 lemma range_comp: "range(r O s) <= range(r)" |
|
295 apply blast |
|
296 done |
|
297 |
|
298 lemma range_comp_eq: "domain(r) <= range(s) ==> range(r O s) = range(r)" |
|
299 apply (rule range_comp [THEN equalityI]) |
|
300 apply blast |
|
301 done |
|
302 |
|
303 lemma domain_comp: "domain(r O s) <= domain(s)" |
|
304 apply blast |
|
305 done |
|
306 |
|
307 lemma domain_comp_eq: "range(s) <= domain(r) ==> domain(r O s) = domain(s)" |
|
308 apply (rule domain_comp [THEN equalityI]) |
|
309 apply blast |
|
310 done |
|
311 |
|
312 lemma image_comp: "(r O s)``A = r``(s``A)" |
|
313 apply blast |
|
314 done |
|
315 |
|
316 |
|
317 (** Other results **) |
|
318 |
|
319 lemma comp_mono: "[| r'<=r; s'<=s |] ==> (r' O s') <= (r O s)" |
|
320 apply blast |
|
321 done |
|
322 |
|
323 (*composition preserves relations*) |
|
324 lemma comp_rel: "[| s<=A*B; r<=B*C |] ==> (r O s) <= A*C" |
|
325 apply blast |
|
326 done |
|
327 |
|
328 (*associative law for composition*) |
|
329 lemma comp_assoc: "(r O s) O t = r O (s O t)" |
|
330 apply blast |
|
331 done |
|
332 |
|
333 (*left identity of composition; provable inclusions are |
|
334 id(A) O r <= r |
|
335 and [| r<=A*B; B<=C |] ==> r <= id(C) O r *) |
|
336 lemma left_comp_id: "r<=A*B ==> id(B) O r = r" |
|
337 apply blast |
|
338 done |
|
339 |
|
340 (*right identity of composition; provable inclusions are |
|
341 r O id(A) <= r |
|
342 and [| r<=A*B; A<=C |] ==> r <= r O id(C) *) |
|
343 lemma right_comp_id: "r<=A*B ==> r O id(A) = r" |
|
344 apply blast |
|
345 done |
|
346 |
|
347 |
|
348 (** Composition preserves functions, injections, and surjections **) |
|
349 |
|
350 lemma comp_function: |
|
351 "[| function(g); function(f) |] ==> function(f O g)" |
|
352 apply (unfold function_def) |
|
353 apply blast |
|
354 done |
|
355 |
|
356 (*Don't think the premises can be weakened much*) |
|
357 lemma comp_fun: "[| g: A->B; f: B->C |] ==> (f O g) : A->C" |
|
358 apply (auto simp add: Pi_def comp_function Pow_iff comp_rel) |
|
359 apply (subst range_rel_subset [THEN domain_comp_eq]); |
|
360 apply (auto ); |
|
361 done |
|
362 |
|
363 (*Thanks to the new definition of "apply", the premise f: B->C is gone!*) |
|
364 lemma comp_fun_apply [simp]: |
|
365 "[| g: A->B; a:A |] ==> (f O g)`a = f`(g`a)" |
|
366 apply (frule apply_Pair, assumption) |
|
367 apply (simp add: apply_def image_comp) |
|
368 apply (blast dest: apply_equality) |
|
369 done |
|
370 |
|
371 (*Simplifies compositions of lambda-abstractions*) |
|
372 lemma comp_lam: |
|
373 "[| !!x. x:A ==> b(x): B |] |
|
374 ==> (lam y:B. c(y)) O (lam x:A. b(x)) = (lam x:A. c(b(x)))" |
|
375 apply (subgoal_tac "(lam x:A. b(x)) : A -> B") |
|
376 apply (rule fun_extension) |
|
377 apply (blast intro: comp_fun lam_funtype) |
|
378 apply (rule lam_funtype) |
|
379 apply (simp add: ); |
|
380 apply (simp add: lam_type); |
|
381 done |
|
382 |
|
383 lemma comp_inj: |
|
384 "[| g: inj(A,B); f: inj(B,C) |] ==> (f O g) : inj(A,C)" |
|
385 apply (frule inj_is_fun [of g]) |
|
386 apply (frule inj_is_fun [of f]) |
|
387 apply (rule_tac d = "%y. converse (g) ` (converse (f) ` y)" in f_imp_injective) |
|
388 apply (blast intro: comp_fun); |
|
389 apply (simp add: ); |
|
390 done |
|
391 |
|
392 lemma comp_surj: |
|
393 "[| g: surj(A,B); f: surj(B,C) |] ==> (f O g) : surj(A,C)" |
|
394 apply (unfold surj_def) |
|
395 apply (blast intro!: comp_fun comp_fun_apply) |
|
396 done |
|
397 |
|
398 lemma comp_bij: |
|
399 "[| g: bij(A,B); f: bij(B,C) |] ==> (f O g) : bij(A,C)" |
|
400 apply (unfold bij_def) |
|
401 apply (blast intro: comp_inj comp_surj) |
|
402 done |
|
403 |
|
404 |
|
405 (** Dual properties of inj and surj -- useful for proofs from |
|
406 D Pastre. Automatic theorem proving in set theory. |
|
407 Artificial Intelligence, 10:1--27, 1978. **) |
|
408 |
|
409 lemma comp_mem_injD1: |
|
410 "[| (f O g): inj(A,C); g: A->B; f: B->C |] ==> g: inj(A,B)" |
|
411 apply (unfold inj_def) |
|
412 apply (force ); |
|
413 done |
|
414 |
|
415 lemma comp_mem_injD2: |
|
416 "[| (f O g): inj(A,C); g: surj(A,B); f: B->C |] ==> f: inj(B,C)" |
|
417 apply (unfold inj_def surj_def) |
|
418 apply safe |
|
419 apply (rule_tac x1 = "x" in bspec [THEN bexE]) |
|
420 apply (erule_tac [3] x1 = "w" in bspec [THEN bexE]) |
|
421 apply assumption+ |
|
422 apply safe |
|
423 apply (rule_tac t = "op ` (g) " in subst_context) |
|
424 apply (erule asm_rl bspec [THEN bspec, THEN mp])+ |
|
425 apply (simp (no_asm_simp)) |
|
426 done |
|
427 |
|
428 lemma comp_mem_surjD1: |
|
429 "[| (f O g): surj(A,C); g: A->B; f: B->C |] ==> f: surj(B,C)" |
|
430 apply (unfold surj_def) |
|
431 apply (blast intro!: comp_fun_apply [symmetric] apply_funtype) |
|
432 done |
|
433 |
|
434 |
|
435 lemma comp_mem_surjD2: |
|
436 "[| (f O g): surj(A,C); g: A->B; f: inj(B,C) |] ==> g: surj(A,B)" |
|
437 apply (unfold inj_def surj_def) |
|
438 apply safe |
|
439 apply (drule_tac x = "f`y" in bspec); |
|
440 apply (auto ); |
|
441 apply (blast intro: apply_funtype) |
|
442 done |
|
443 |
|
444 (** inverses of composition **) |
|
445 |
|
446 (*left inverse of composition; one inclusion is |
|
447 f: A->B ==> id(A) <= converse(f) O f *) |
|
448 lemma left_comp_inverse: "f: inj(A,B) ==> converse(f) O f = id(A)" |
|
449 apply (unfold inj_def) |
|
450 apply (clarify ); |
|
451 apply (rule equalityI) |
|
452 apply (auto simp add: apply_iff) |
|
453 apply (blast intro: elim:); |
|
454 done |
|
455 |
|
456 (*right inverse of composition; one inclusion is |
|
457 f: A->B ==> f O converse(f) <= id(B) |
|
458 *) |
|
459 lemma right_comp_inverse: |
|
460 "f: surj(A,B) ==> f O converse(f) = id(B)" |
|
461 apply (simp add: surj_def) |
|
462 apply (clarify ); |
|
463 apply (rule equalityI) |
|
464 apply (best elim: domain_type range_type dest: apply_equality2) |
|
465 apply (blast intro: apply_Pair) |
|
466 done |
|
467 |
|
468 |
|
469 (** Proving that a function is a bijection **) |
|
470 |
|
471 lemma comp_eq_id_iff: |
|
472 "[| f: A->B; g: B->A |] ==> f O g = id(B) <-> (ALL y:B. f`(g`y)=y)" |
|
473 apply (unfold id_def) |
|
474 apply safe |
|
475 apply (drule_tac t = "%h. h`y " in subst_context) |
|
476 apply simp |
|
477 apply (rule fun_extension) |
|
478 apply (blast intro: comp_fun lam_type) |
|
479 apply auto |
|
480 done |
|
481 |
|
482 lemma fg_imp_bijective: |
|
483 "[| f: A->B; g: B->A; f O g = id(B); g O f = id(A) |] ==> f : bij(A,B)" |
|
484 apply (unfold bij_def) |
|
485 apply (simp add: comp_eq_id_iff) |
|
486 apply (blast intro: f_imp_injective f_imp_surjective apply_funtype); |
|
487 done |
|
488 |
|
489 lemma nilpotent_imp_bijective: "[| f: A->A; f O f = id(A) |] ==> f : bij(A,A)" |
|
490 apply (blast intro: fg_imp_bijective) |
|
491 done |
|
492 |
|
493 lemma invertible_imp_bijective: "[| converse(f): B->A; f: A->B |] ==> f : bij(A,B)" |
|
494 apply (simp (no_asm_simp) add: fg_imp_bijective comp_eq_id_iff left_inverse_lemma right_inverse_lemma) |
|
495 done |
|
496 |
|
497 (** Unions of functions -- cf similar theorems on func.ML **) |
|
498 |
|
499 (*Theorem by KG, proof by LCP*) |
|
500 lemma inj_disjoint_Un: |
|
501 "[| f: inj(A,B); g: inj(C,D); B Int D = 0 |] |
|
502 ==> (lam a: A Un C. if a:A then f`a else g`a) : inj(A Un C, B Un D)" |
|
503 apply (rule_tac d = "%z. if z:B then converse (f) `z else converse (g) `z" in lam_injective) |
|
504 apply (auto simp add: inj_is_fun [THEN apply_type]) |
|
505 apply (blast intro: inj_is_fun [THEN apply_type]) |
|
506 done |
|
507 |
|
508 lemma surj_disjoint_Un: |
|
509 "[| f: surj(A,B); g: surj(C,D); A Int C = 0 |] |
|
510 ==> (f Un g) : surj(A Un C, B Un D)" |
|
511 apply (unfold surj_def) |
|
512 apply (blast intro: fun_disjoint_apply1 fun_disjoint_apply2 fun_disjoint_Un trans) |
|
513 done |
|
514 |
|
515 (*A simple, high-level proof; the version for injections follows from it, |
|
516 using f:inj(A,B) <-> f:bij(A,range(f)) *) |
|
517 lemma bij_disjoint_Un: |
|
518 "[| f: bij(A,B); g: bij(C,D); A Int C = 0; B Int D = 0 |] |
|
519 ==> (f Un g) : bij(A Un C, B Un D)" |
|
520 apply (rule invertible_imp_bijective) |
|
521 apply (subst converse_Un) |
|
522 apply (auto intro: fun_disjoint_Un bij_is_fun bij_converse_bij) |
|
523 done |
|
524 |
|
525 |
|
526 (** Restrictions as surjections and bijections *) |
|
527 |
|
528 lemma surj_image: |
|
529 "f: Pi(A,B) ==> f: surj(A, f``A)" |
|
530 apply (simp add: surj_def); |
|
531 apply (blast intro: apply_equality apply_Pair Pi_type); |
|
532 done |
|
533 |
|
534 lemma restrict_image [simp]: "restrict(f,A) `` B = f `` (A Int B)" |
|
535 apply (auto simp add: restrict_def) |
|
536 done |
|
537 |
|
538 lemma restrict_inj: |
|
539 "[| f: inj(A,B); C<=A |] ==> restrict(f,C): inj(C,B)" |
|
540 apply (unfold inj_def) |
|
541 apply (safe elim!: restrict_type2); |
|
542 apply (auto ); |
|
543 done |
|
544 |
|
545 lemma restrict_surj: "[| f: Pi(A,B); C<=A |] ==> restrict(f,C): surj(C, f``C)" |
|
546 apply (insert restrict_type2 [THEN surj_image]) |
|
547 apply (simp add: restrict_image); |
|
548 done |
|
549 |
|
550 lemma restrict_bij: |
|
551 "[| f: inj(A,B); C<=A |] ==> restrict(f,C): bij(C, f``C)" |
|
552 apply (unfold inj_def bij_def) |
|
553 apply (blast intro!: restrict restrict_surj intro: box_equals surj_is_fun) |
|
554 done |
|
555 |
|
556 |
|
557 (*** Lemmas for Ramsey's Theorem ***) |
|
558 |
|
559 lemma inj_weaken_type: "[| f: inj(A,B); B<=D |] ==> f: inj(A,D)" |
|
560 apply (unfold inj_def) |
|
561 apply (blast intro: fun_weaken_type) |
|
562 done |
|
563 |
|
564 lemma inj_succ_restrict: |
|
565 "[| f: inj(succ(m), A) |] ==> restrict(f,m) : inj(m, A-{f`m})" |
|
566 apply (rule restrict_bij [THEN bij_is_inj, THEN inj_weaken_type]) |
|
567 apply assumption |
|
568 apply blast |
|
569 apply (unfold inj_def) |
|
570 apply (fast elim: range_type mem_irrefl dest: apply_equality) |
|
571 done |
|
572 |
|
573 |
|
574 lemma inj_extend: |
|
575 "[| f: inj(A,B); a~:A; b~:B |] |
|
576 ==> cons(<a,b>,f) : inj(cons(a,A), cons(b,B))" |
|
577 apply (unfold inj_def) |
|
578 apply (force intro: apply_type simp add: fun_extend) |
|
579 done |
|
580 |
|
581 |
|
582 ML |
|
583 {* |
|
584 val comp_def = thm "comp_def"; |
|
585 val id_def = thm "id_def"; |
|
586 val inj_def = thm "inj_def"; |
|
587 val surj_def = thm "surj_def"; |
|
588 val bij_def = thm "bij_def"; |
|
589 |
|
590 val surj_is_fun = thm "surj_is_fun"; |
|
591 val fun_is_surj = thm "fun_is_surj"; |
|
592 val surj_range = thm "surj_range"; |
|
593 val f_imp_surjective = thm "f_imp_surjective"; |
|
594 val lam_surjective = thm "lam_surjective"; |
|
595 val cantor_surj = thm "cantor_surj"; |
|
596 val inj_is_fun = thm "inj_is_fun"; |
|
597 val inj_equality = thm "inj_equality"; |
|
598 val inj_apply_equality = thm "inj_apply_equality"; |
|
599 val f_imp_injective = thm "f_imp_injective"; |
|
600 val lam_injective = thm "lam_injective"; |
|
601 val bij_is_inj = thm "bij_is_inj"; |
|
602 val bij_is_surj = thm "bij_is_surj"; |
|
603 val bij_is_fun = thm "bij_is_fun"; |
|
604 val lam_bijective = thm "lam_bijective"; |
|
605 val RepFun_bijective = thm "RepFun_bijective"; |
|
606 val idI = thm "idI"; |
|
607 val idE = thm "idE"; |
|
608 val id_type = thm "id_type"; |
|
609 val id_conv = thm "id_conv"; |
|
610 val id_mono = thm "id_mono"; |
|
611 val id_subset_inj = thm "id_subset_inj"; |
|
612 val id_inj = thm "id_inj"; |
|
613 val id_surj = thm "id_surj"; |
|
614 val id_bij = thm "id_bij"; |
|
615 val subset_iff_id = thm "subset_iff_id"; |
|
616 val inj_converse_fun = thm "inj_converse_fun"; |
|
617 val left_inverse_lemma = thm "left_inverse_lemma"; |
|
618 val left_inverse = thm "left_inverse"; |
|
619 val left_inverse_bij = thm "left_inverse_bij"; |
|
620 val right_inverse_lemma = thm "right_inverse_lemma"; |
|
621 val right_inverse = thm "right_inverse"; |
|
622 val right_inverse_bij = thm "right_inverse_bij"; |
|
623 val inj_converse_inj = thm "inj_converse_inj"; |
|
624 val inj_converse_surj = thm "inj_converse_surj"; |
|
625 val bij_converse_bij = thm "bij_converse_bij"; |
|
626 val compI = thm "compI"; |
|
627 val compE = thm "compE"; |
|
628 val compEpair = thm "compEpair"; |
|
629 val converse_comp = thm "converse_comp"; |
|
630 val range_comp = thm "range_comp"; |
|
631 val range_comp_eq = thm "range_comp_eq"; |
|
632 val domain_comp = thm "domain_comp"; |
|
633 val domain_comp_eq = thm "domain_comp_eq"; |
|
634 val image_comp = thm "image_comp"; |
|
635 val comp_mono = thm "comp_mono"; |
|
636 val comp_rel = thm "comp_rel"; |
|
637 val comp_assoc = thm "comp_assoc"; |
|
638 val left_comp_id = thm "left_comp_id"; |
|
639 val right_comp_id = thm "right_comp_id"; |
|
640 val comp_function = thm "comp_function"; |
|
641 val comp_fun = thm "comp_fun"; |
|
642 val comp_fun_apply = thm "comp_fun_apply"; |
|
643 val comp_lam = thm "comp_lam"; |
|
644 val comp_inj = thm "comp_inj"; |
|
645 val comp_surj = thm "comp_surj"; |
|
646 val comp_bij = thm "comp_bij"; |
|
647 val comp_mem_injD1 = thm "comp_mem_injD1"; |
|
648 val comp_mem_injD2 = thm "comp_mem_injD2"; |
|
649 val comp_mem_surjD1 = thm "comp_mem_surjD1"; |
|
650 val comp_mem_surjD2 = thm "comp_mem_surjD2"; |
|
651 val left_comp_inverse = thm "left_comp_inverse"; |
|
652 val right_comp_inverse = thm "right_comp_inverse"; |
|
653 val comp_eq_id_iff = thm "comp_eq_id_iff"; |
|
654 val fg_imp_bijective = thm "fg_imp_bijective"; |
|
655 val nilpotent_imp_bijective = thm "nilpotent_imp_bijective"; |
|
656 val invertible_imp_bijective = thm "invertible_imp_bijective"; |
|
657 val inj_disjoint_Un = thm "inj_disjoint_Un"; |
|
658 val surj_disjoint_Un = thm "surj_disjoint_Un"; |
|
659 val bij_disjoint_Un = thm "bij_disjoint_Un"; |
|
660 val surj_image = thm "surj_image"; |
|
661 val restrict_image = thm "restrict_image"; |
|
662 val restrict_inj = thm "restrict_inj"; |
|
663 val restrict_surj = thm "restrict_surj"; |
|
664 val restrict_bij = thm "restrict_bij"; |
|
665 val inj_weaken_type = thm "inj_weaken_type"; |
|
666 val inj_succ_restrict = thm "inj_succ_restrict"; |
|
667 val inj_extend = thm "inj_extend"; |
|
668 *} |
37 |
669 |
38 end |
670 end |