3 Author: Tobias Nipkow, Cambridge University Computer Laboratory |
3 Author: Tobias Nipkow, Cambridge University Computer Laboratory |
4 Copyright 1993 University of Cambridge |
4 Copyright 1993 University of Cambridge |
5 |
5 |
6 Lemmas about functions. |
6 Lemmas about functions. |
7 *) |
7 *) |
8 |
|
9 |
8 |
10 Goal "(f = g) = (! x. f(x)=g(x))"; |
9 Goal "(f = g) = (! x. f(x)=g(x))"; |
11 by (rtac iffI 1); |
10 by (rtac iffI 1); |
12 by (Asm_simp_tac 1); |
11 by (Asm_simp_tac 1); |
13 by (rtac ext 1 THEN Asm_simp_tac 1); |
12 by (rtac ext 1 THEN Asm_simp_tac 1); |
173 Goalw [inj_on_def] "[| inj_on f A; ~x=y; x:A; y:A |] ==> ~ f(x)=f(y)"; |
172 Goalw [inj_on_def] "[| inj_on f A; ~x=y; x:A; y:A |] ==> ~ f(x)=f(y)"; |
174 by (Blast_tac 1); |
173 by (Blast_tac 1); |
175 qed "inj_on_contraD"; |
174 qed "inj_on_contraD"; |
176 |
175 |
177 Goal "inj (%s. {s})"; |
176 Goal "inj (%s. {s})"; |
178 br injI 1; |
177 by (rtac injI 1); |
179 be singleton_inject 1; |
178 by (etac singleton_inject 1); |
180 qed "inj_singleton"; |
179 qed "inj_singleton"; |
181 |
180 |
182 Goalw [inj_on_def] "[| A<=B; inj_on f B |] ==> inj_on f A"; |
181 Goalw [inj_on_def] "[| A<=B; inj_on f B |] ==> inj_on f A"; |
183 by (Blast_tac 1); |
182 by (Blast_tac 1); |
184 qed "subset_inj_on"; |
183 qed "subset_inj_on"; |
196 |
195 |
197 Goalw [surj_def] "surj f ==> EX x. y = f x"; |
196 Goalw [surj_def] "surj f ==> EX x. y = f x"; |
198 by (Blast_tac 1); |
197 by (Blast_tac 1); |
199 qed "surjD"; |
198 qed "surjD"; |
200 |
199 |
201 |
200 Goal "inj f ==> surj (inv f)"; |
202 (** Bijections **) |
201 by (blast_tac (claset() addIs [surjI, inv_f_f]) 1); |
203 |
202 qed "inj_imp_surj_inv"; |
204 Goalw [bij_def] "[| inj f; surj f |] ==> bij f"; |
|
205 by (Blast_tac 1); |
|
206 qed "bijI"; |
|
207 |
|
208 Goalw [bij_def] "bij f ==> inj f"; |
|
209 by (Blast_tac 1); |
|
210 qed "bij_is_inj"; |
|
211 |
|
212 Goalw [bij_def] "bij f ==> surj f"; |
|
213 by (Blast_tac 1); |
|
214 qed "bij_is_surj"; |
|
215 |
203 |
216 |
204 |
217 (*** Lemmas about injective functions and inv ***) |
205 (*** Lemmas about injective functions and inv ***) |
218 |
206 |
219 Goalw [o_def] "[| inj_on f A; inj_on g (f``A) |] ==> inj_on (g o f) A"; |
207 Goalw [o_def] "[| inj_on f A; inj_on g (f``A) |] ==> inj_on (g o f) A"; |
240 |
228 |
241 Goal "surj f ==> inj (inv f)"; |
229 Goal "surj f ==> inj (inv f)"; |
242 by (asm_simp_tac (simpset() addsimps [inj_on_inv, surj_range]) 1); |
230 by (asm_simp_tac (simpset() addsimps [inj_on_inv, surj_range]) 1); |
243 qed "surj_imp_inj_inv"; |
231 qed "surj_imp_inj_inv"; |
244 |
232 |
|
233 |
|
234 (** Bijections **) |
|
235 |
|
236 Goalw [bij_def] "[| inj f; surj f |] ==> bij f"; |
|
237 by (Blast_tac 1); |
|
238 qed "bijI"; |
|
239 |
|
240 Goalw [bij_def] "bij f ==> inj f"; |
|
241 by (Blast_tac 1); |
|
242 qed "bij_is_inj"; |
|
243 |
|
244 Goalw [bij_def] "bij f ==> surj f"; |
|
245 by (Blast_tac 1); |
|
246 qed "bij_is_surj"; |
|
247 |
|
248 Goalw [bij_def] "bij f ==> bij (inv f)"; |
|
249 by (asm_simp_tac (simpset() addsimps [inj_imp_surj_inv, surj_imp_inj_inv]) 1); |
|
250 qed "bij_imp_bij_inv"; |
|
251 |
|
252 val prems = |
|
253 Goalw [inv_def] "[| !! x. g (f x) = x; !! y. f (g y) = y |] ==> inv f = g"; |
|
254 by (rtac ext 1); |
|
255 by (auto_tac (claset(), simpset() addsimps prems)); |
|
256 qed "inv_equality"; |
|
257 |
|
258 Goalw [bij_def] "bij f ==> inv (inv f) = f"; |
|
259 by (rtac inv_equality 1); |
|
260 by (auto_tac (claset(), simpset() addsimps [surj_f_inv_f])); |
|
261 qed "inv_inv_eq"; |
|
262 |
|
263 Goalw [bij_def] "[| bij f; bij g |] ==> inv (f o g) = inv g o inv f"; |
|
264 by (rtac (inv_equality) 1); |
|
265 by (auto_tac (claset(), simpset() addsimps [surj_f_inv_f])); |
|
266 qed "o_inv_distrib"; |
|
267 |
|
268 |
245 (** We seem to need both the id-forms and the (%x. x) forms; the latter can |
269 (** We seem to need both the id-forms and the (%x. x) forms; the latter can |
246 arise by rewriting, while id may be used explicitly. **) |
270 arise by rewriting, while id may be used explicitly. **) |
247 |
271 |
248 Goal "(%x. x) `` Y = Y"; |
272 Goal "(%x. x) `` Y = Y"; |
249 by (Blast_tac 1); |
273 by (Blast_tac 1); |
278 |
302 |
279 Goal "surj f ==> f `` (f -`` A) = A"; |
303 Goal "surj f ==> f `` (f -`` A) = A"; |
280 by (asm_simp_tac (simpset() addsimps [surj_range]) 1); |
304 by (asm_simp_tac (simpset() addsimps [surj_range]) 1); |
281 qed "surj_image_vimage_eq"; |
305 qed "surj_image_vimage_eq"; |
282 |
306 |
|
307 Goal "surj f ==> f `` (inv f `` A) = A"; |
|
308 by (asm_simp_tac (simpset() addsimps [image_eq_UN, surj_f_inv_f]) 1); |
|
309 qed "image_surj_f_inv_f"; |
|
310 |
283 Goalw [inj_on_def] "inj f ==> f -`` (f `` A) = A"; |
311 Goalw [inj_on_def] "inj f ==> f -`` (f `` A) = A"; |
284 by (Blast_tac 1); |
312 by (Blast_tac 1); |
285 qed "inj_vimage_image_eq"; |
313 qed "inj_vimage_image_eq"; |
|
314 |
|
315 Goal "inj f ==> (inv f) `` (f `` A) = A"; |
|
316 by (asm_simp_tac (simpset() addsimps [image_eq_UN]) 1); |
|
317 qed "image_inv_f_f"; |
286 |
318 |
287 Goalw [surj_def] "surj f ==> f -`` B <= A ==> B <= f `` A"; |
319 Goalw [surj_def] "surj f ==> f -`` B <= A ==> B <= f `` A"; |
288 by (blast_tac (claset() addIs [sym]) 1); |
320 by (blast_tac (claset() addIs [sym]) 1); |
289 qed "vimage_subsetD"; |
321 qed "vimage_subsetD"; |
290 |
322 |
328 qed "inv_image_comp"; |
360 qed "inv_image_comp"; |
329 |
361 |
330 Goal "inj f ==> (f a : f``A) = (a : A)"; |
362 Goal "inj f ==> (f a : f``A) = (a : A)"; |
331 by (blast_tac (claset() addDs [injD]) 1); |
363 by (blast_tac (claset() addDs [injD]) 1); |
332 qed "inj_image_mem_iff"; |
364 qed "inj_image_mem_iff"; |
|
365 |
|
366 Goalw [inj_on_def] "inj f ==> (f``A <= f``B) = (A<=B)"; |
|
367 by (Blast_tac 1); |
|
368 qed "inj_image_subset_iff"; |
333 |
369 |
334 Goal "inj f ==> (f``A = f``B) = (A = B)"; |
370 Goal "inj f ==> (f``A = f``B) = (A = B)"; |
335 by (blast_tac (claset() addSEs [equalityE] addDs [injD]) 1); |
371 by (blast_tac (claset() addSEs [equalityE] addDs [injD]) 1); |
336 qed "inj_image_eq_iff"; |
372 qed "inj_image_eq_iff"; |
337 |
373 |