1 (* Title: ZF/perm.ML |
1 (* Title: ZF/Perm.ML |
2 ID: $Id$ |
2 ID: $Id$ |
3 Author: Lawrence C Paulson, Cambridge University Computer Laboratory |
3 Author: Lawrence C Paulson, Cambridge University Computer Laboratory |
4 Copyright 1991 University of Cambridge |
4 Copyright 1991 University of Cambridge |
5 |
5 |
6 For perm.thy. The theory underlying permutation groups |
6 The theory underlying permutation groups |
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 |
41 \ |] ==> (lam x:A.c(x)) : surj(A,B)"; |
41 \ |] ==> (lam x:A.c(x)) : surj(A,B)"; |
42 by (res_inst_tac [("d", "d")] f_imp_surjective 1); |
42 by (res_inst_tac [("d", "d")] f_imp_surjective 1); |
43 by (ALLGOALS (asm_simp_tac (ZF_ss addsimps ([lam_type]@prems)) )); |
43 by (ALLGOALS (asm_simp_tac (ZF_ss addsimps ([lam_type]@prems)) )); |
44 val lam_surjective = result(); |
44 val lam_surjective = result(); |
45 |
45 |
|
46 (*Cantor's theorem revisited*) |
|
47 goalw Perm.thy [surj_def] "f ~: surj(A,Pow(A))"; |
|
48 by (safe_tac ZF_cs); |
|
49 by (cut_facts_tac [cantor] 1); |
|
50 by (fast_tac subset_cs 1); |
|
51 val cantor_surj = result(); |
|
52 |
46 |
53 |
47 (** Injective function space **) |
54 (** Injective function space **) |
48 |
55 |
49 goalw Perm.thy [inj_def] "!!f A B. f: inj(A,B) ==> f: A->B"; |
56 goalw Perm.thy [inj_def] "!!f A B. f: inj(A,B) ==> f: A->B"; |
50 by (etac CollectD1 1); |
57 by (etac CollectD1 1); |
233 val compEpair = |
240 val compEpair = |
234 rule_by_tactic (REPEAT_FIRST (etac Pair_inject ORELSE' bound_hyp_subst_tac) |
241 rule_by_tactic (REPEAT_FIRST (etac Pair_inject ORELSE' bound_hyp_subst_tac) |
235 THEN prune_params_tac) |
242 THEN prune_params_tac) |
236 (read_instantiate [("xz","<a,c>")] compE); |
243 (read_instantiate [("xz","<a,c>")] compE); |
237 |
244 |
238 val comp_cs = ZF_cs addIs [compI,idI] addSEs [compE,idE]; |
245 val comp_cs = ZF_cs addSIs [idI] addIs [compI] addSEs [compE,idE]; |
239 |
246 |
240 (** Domain and Range -- see Suppes, section 3.1 **) |
247 (** Domain and Range -- see Suppes, section 3.1 **) |
241 |
248 |
242 (*Boyer et al., Set Theory in First-Order Logic, JAR 2 (1986), 287-327*) |
249 (*Boyer et al., Set Theory in First-Order Logic, JAR 2 (1986), 287-327*) |
243 goal Perm.thy "range(r O s) <= range(r)"; |
250 goal Perm.thy "range(r O s) <= range(r)"; |
296 |
303 |
297 (** Composition preserves functions, injections, and surjections **) |
304 (** Composition preserves functions, injections, and surjections **) |
298 |
305 |
299 goalw Perm.thy [function_def] |
306 goalw Perm.thy [function_def] |
300 "!!f g. [| function(g); function(f) |] ==> function(f O g)"; |
307 "!!f g. [| function(g); function(f) |] ==> function(f O g)"; |
301 by (fast_tac (subset_cs addIs [compI] addSEs [compE, Pair_inject]) 1); |
308 by (fast_tac (ZF_cs addIs [compI] addSEs [compE, Pair_inject]) 1); |
302 val comp_function = result(); |
309 val comp_function = result(); |
303 |
310 |
304 goalw Perm.thy [Pi_def] |
311 goalw Perm.thy [Pi_def] |
305 "!!f g. [| g: A->B; f: B->C |] ==> (f O g) : A->C"; |
312 "!!f g. [| g: A->B; f: B->C |] ==> (f O g) : A->C"; |
306 by (safe_tac subset_cs); |
313 by (safe_tac subset_cs); |
387 by (fast_tac (comp_cs addIs [equalityI,apply_Pair] |
394 by (fast_tac (comp_cs addIs [equalityI,apply_Pair] |
388 addEs [domain_type, make_elim injfD]) 1); |
395 addEs [domain_type, make_elim injfD]) 1); |
389 val left_comp_inverse = result(); |
396 val left_comp_inverse = result(); |
390 |
397 |
391 (*right inverse of composition; one inclusion is |
398 (*right inverse of composition; one inclusion is |
392 f: A->B ==> f O converse(f) <= id(B) *) |
399 f: A->B ==> f O converse(f) <= id(B) |
|
400 *) |
393 val [prem] = goalw Perm.thy [surj_def] |
401 val [prem] = goalw Perm.thy [surj_def] |
394 "f: surj(A,B) ==> f O converse(f) = id(B)"; |
402 "f: surj(A,B) ==> f O converse(f) = id(B)"; |
395 val appfD = (prem RS CollectD1) RSN (3,apply_equality2); |
403 val appfD = (prem RS CollectD1) RSN (3,apply_equality2); |
396 by (cut_facts_tac [prem] 1); |
404 by (cut_facts_tac [prem] 1); |
397 by (rtac equalityI 1); |
405 by (rtac equalityI 1); |
464 "f: Pi(A,B) ==> f: surj(A, f``A)"; |
472 "f: Pi(A,B) ==> f: surj(A, f``A)"; |
465 val rls = apply_equality :: (prems RL [apply_Pair,Pi_type]); |
473 val rls = apply_equality :: (prems RL [apply_Pair,Pi_type]); |
466 by (fast_tac (ZF_cs addIs rls) 1); |
474 by (fast_tac (ZF_cs addIs rls) 1); |
467 val surj_image = result(); |
475 val surj_image = result(); |
468 |
476 |
469 goal Perm.thy |
477 goal Perm.thy "!!f. [| f: Pi(C,B); A<=C |] ==> restrict(f,A)``A = f``A"; |
470 "!!f. [| f: Pi(C,B); A<=C |] ==> restrict(f,A)``A = f``A"; |
|
471 by (rtac equalityI 1); |
478 by (rtac equalityI 1); |
472 by (SELECT_GOAL (rewtac restrict_def) 2); |
479 by (SELECT_GOAL (rewtac restrict_def) 2); |
473 by (REPEAT (eresolve_tac [imageE, apply_equality RS subst] 2 |
480 by (REPEAT (eresolve_tac [imageE, apply_equality RS subst] 2 |
474 ORELSE ares_tac [subsetI,lamI,imageI] 2)); |
481 ORELSE ares_tac [subsetI,lamI,imageI] 2)); |
475 by (REPEAT (ares_tac [image_mono,restrict_subset,subset_refl] 1)); |
482 by (REPEAT (ares_tac [image_mono,restrict_subset,subset_refl] 1)); |