src/HOL/Algebra/Bij.thy
changeset 13945 5433b2755e98
child 14666 65f8680c3f16
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/HOL/Algebra/Bij.thy	Fri May 02 10:25:42 2003 +0200
     1.3 @@ -0,0 +1,148 @@
     1.4 +(*  Title:      HOL/Algebra/Bij
     1.5 +    ID:         $Id$
     1.6 +    Author:     Florian Kammueller, with new proofs by L C Paulson
     1.7 +*)
     1.8 +
     1.9 +
    1.10 +header{*Bijections of a Set, Permutation Groups, Automorphism Groups*} 
    1.11 +
    1.12 +theory Bij = Group:
    1.13 +
    1.14 +constdefs
    1.15 +  Bij :: "'a set => (('a => 'a)set)" 
    1.16 +    --{*Only extensional functions, since otherwise we get too many.*}
    1.17 +    "Bij S == extensional S \<inter> {f. f`S = S & inj_on f S}"
    1.18 +
    1.19 +   BijGroup ::  "'a set => (('a => 'a) monoid)"
    1.20 +   "BijGroup S == (| carrier = Bij S, 
    1.21 +		     mult  = %g: Bij S. %f: Bij S. compose S g f,
    1.22 +		     one = %x: S. x |)"
    1.23 +
    1.24 +
    1.25 +declare Id_compose [simp] compose_Id [simp]
    1.26 +
    1.27 +lemma Bij_imp_extensional: "f \<in> Bij S ==> f \<in> extensional S"
    1.28 +by (simp add: Bij_def)
    1.29 +
    1.30 +lemma Bij_imp_funcset: "f \<in> Bij S ==> f \<in> S -> S"
    1.31 +by (auto simp add: Bij_def Pi_def)
    1.32 +
    1.33 +lemma Bij_imp_apply: "f \<in> Bij S ==> f ` S = S"
    1.34 +by (simp add: Bij_def)
    1.35 +
    1.36 +lemma Bij_imp_inj_on: "f \<in> Bij S ==> inj_on f S"
    1.37 +by (simp add: Bij_def)
    1.38 +
    1.39 +lemma BijI: "[| f \<in> extensional(S); f`S = S; inj_on f S |] ==> f \<in> Bij S"
    1.40 +by (simp add: Bij_def)
    1.41 +
    1.42 +
    1.43 +subsection{*Bijections Form a Group*}
    1.44 +
    1.45 +lemma restrict_Inv_Bij: "f \<in> Bij S ==> (%x:S. (Inv S f) x) \<in> Bij S"
    1.46 +apply (simp add: Bij_def)
    1.47 +apply (intro conjI)
    1.48 +txt{*Proving @{term "restrict (Inv S f) S ` S = S"}*}
    1.49 + apply (rule equalityI)
    1.50 +  apply (force simp add: Inv_mem) --{*first inclusion*}
    1.51 + apply (rule subsetI)   --{*second inclusion*}
    1.52 + apply (rule_tac x = "f x" in image_eqI)
    1.53 +  apply (force intro:  simp add: Inv_f_f, blast)
    1.54 +txt{*Remaining goal: @{term "inj_on (restrict (Inv S f) S) S"}*}
    1.55 +apply (rule inj_onI)
    1.56 +apply (auto elim: Inv_injective)
    1.57 +done
    1.58 +
    1.59 +lemma id_Bij: "(\<lambda>x\<in>S. x) \<in> Bij S "
    1.60 +apply (rule BijI)
    1.61 +apply (auto simp add: inj_on_def)
    1.62 +done
    1.63 +
    1.64 +lemma compose_Bij: "[| x \<in> Bij S; y \<in> Bij S|] ==> compose S x y \<in> Bij S"
    1.65 +apply (rule BijI)
    1.66 +  apply (simp add: compose_extensional) 
    1.67 + apply (blast del: equalityI
    1.68 +              intro: surj_compose dest: Bij_imp_apply Bij_imp_inj_on)
    1.69 +apply (blast intro: inj_on_compose dest: Bij_imp_apply Bij_imp_inj_on)
    1.70 +done
    1.71 +
    1.72 +lemma Bij_compose_restrict_eq:
    1.73 +     "f \<in> Bij S ==> compose S (restrict (Inv S f) S) f = (\<lambda>x\<in>S. x)"
    1.74 +apply (rule compose_Inv_id)
    1.75 + apply (simp add: Bij_imp_inj_on)
    1.76 +apply (simp add: Bij_imp_apply) 
    1.77 +done
    1.78 +
    1.79 +theorem group_BijGroup: "group (BijGroup S)"
    1.80 +apply (simp add: BijGroup_def) 
    1.81 +apply (rule groupI)
    1.82 +    apply (simp add: compose_Bij)
    1.83 +   apply (simp add: id_Bij)
    1.84 +  apply (simp add: compose_Bij)
    1.85 +  apply (blast intro: compose_assoc [symmetric] Bij_imp_funcset)
    1.86 + apply (simp add: id_Bij Bij_imp_funcset Bij_imp_extensional, simp)
    1.87 +apply (blast intro: Bij_compose_restrict_eq restrict_Inv_Bij) 
    1.88 +done
    1.89 +
    1.90 +
    1.91 +subsection{*Automorphisms Form a Group*}
    1.92 +
    1.93 +lemma Bij_Inv_mem: "[|  f \<in> Bij S;  x : S |] ==> Inv S f x : S"
    1.94 +by (simp add: Bij_def Inv_mem) 
    1.95 +
    1.96 +lemma Bij_Inv_lemma:
    1.97 + assumes eq: "!!x y. [|x \<in> S; y \<in> S|] ==> h(g x y) = g (h x) (h y)"
    1.98 + shows "[| h \<in> Bij S;  g \<in> S \<rightarrow> S \<rightarrow> S;  x \<in> S;  y \<in> S |]        
    1.99 +        ==> Inv S h (g x y) = g (Inv S h x) (Inv S h y)"
   1.100 +apply (simp add: Bij_def) 
   1.101 +apply (subgoal_tac "EX x':S. EX y':S. x = h x' & y = h y'", clarify)
   1.102 + apply (simp add: eq [symmetric] Inv_f_f funcset_mem [THEN funcset_mem], blast)
   1.103 +done
   1.104 +
   1.105 +constdefs
   1.106 + auto :: "('a,'b) monoid_scheme => ('a => 'a)set"
   1.107 +  "auto G == hom G G \<inter> Bij (carrier G)"
   1.108 +
   1.109 +  AutoGroup :: "[('a,'c) monoid_scheme] => ('a=>'a) monoid"
   1.110 +  "AutoGroup G == BijGroup (carrier G) (|carrier := auto G |)"
   1.111 +
   1.112 +lemma id_in_auto: "group G ==> (%x: carrier G. x) \<in> auto G"
   1.113 +  by (simp add: auto_def hom_def restrictI group.axioms id_Bij) 
   1.114 +
   1.115 +lemma mult_funcset: "group G ==> mult G \<in> carrier G -> carrier G -> carrier G"
   1.116 +  by (simp add:  Pi_I group.axioms)
   1.117 +
   1.118 +lemma restrict_Inv_hom:
   1.119 +      "[|group G; h \<in> hom G G; h \<in> Bij (carrier G)|]
   1.120 +       ==> restrict (Inv (carrier G) h) (carrier G) \<in> hom G G"
   1.121 +  by (simp add: hom_def Bij_Inv_mem restrictI mult_funcset
   1.122 +                group.axioms Bij_Inv_lemma)
   1.123 +
   1.124 +lemma inv_BijGroup:
   1.125 +     "f \<in> Bij S ==> m_inv (BijGroup S) f = (%x: S. (Inv S f) x)"
   1.126 +apply (rule group.inv_equality)
   1.127 +apply (rule group_BijGroup)
   1.128 +apply (simp_all add: BijGroup_def restrict_Inv_Bij Bij_compose_restrict_eq)  
   1.129 +done
   1.130 +
   1.131 +lemma subgroup_auto:
   1.132 +      "group G ==> subgroup (auto G) (BijGroup (carrier G))"
   1.133 +apply (rule group.subgroupI) 
   1.134 +    apply (rule group_BijGroup) 
   1.135 +   apply (force simp add: auto_def BijGroup_def) 
   1.136 +  apply (blast intro: dest: id_in_auto) 
   1.137 + apply (simp del: restrict_apply
   1.138 +	     add: inv_BijGroup auto_def restrict_Inv_Bij restrict_Inv_hom) 
   1.139 +apply (simp add: BijGroup_def auto_def Bij_imp_funcset compose_hom compose_Bij)
   1.140 +done
   1.141 +
   1.142 +theorem AutoGroup: "group G ==> group (AutoGroup G)"
   1.143 +apply (simp add: AutoGroup_def) 
   1.144 +apply (rule Group.subgroup.groupI)
   1.145 +apply (erule subgroup_auto)  
   1.146 +apply (insert Bij.group_BijGroup [of "carrier G"]) 
   1.147 +apply (simp_all add: group_def) 
   1.148 +done
   1.149 +
   1.150 +end
   1.151 +