src/HOL/Algebra/Coset.thy
changeset 14963 d584e32f7d46
parent 14803 f7557773cc87
child 15120 f0359f75682e
equal deleted inserted replaced
14962:3283b52ebcac 14963:d584e32f7d46
     5 
     5 
     6 header{*Cosets and Quotient Groups*}
     6 header{*Cosets and Quotient Groups*}
     7 
     7 
     8 theory Coset = Group + Exponent:
     8 theory Coset = Group + Exponent:
     9 
     9 
    10 declare (in group) l_inv [simp] and r_inv [simp]
       
    11 
       
    12 constdefs (structure G)
    10 constdefs (structure G)
    13   r_coset    :: "[_, 'a set, 'a] => 'a set"    (infixl "#>\<index>" 60)
    11   r_coset    :: "[_, 'a set, 'a] \<Rightarrow> 'a set"    (infixl "#>\<index>" 60)
    14   "H #> a == (% x. x \<otimes> a) ` H"
    12   "H #> a \<equiv> \<Union>h\<in>H. {h \<otimes> a}"
    15 
    13 
    16   l_coset    :: "[_, 'a, 'a set] => 'a set"    (infixl "<#\<index>" 60)
    14   l_coset    :: "[_, 'a, 'a set] \<Rightarrow> 'a set"    (infixl "<#\<index>" 60)
    17   "a <# H == (% x. a \<otimes> x) ` H"
    15   "a <# H \<equiv> \<Union>h\<in>H. {a \<otimes> h}"
    18 
    16 
    19   rcosets  :: "[_, 'a set] => ('a set)set"
    17   RCOSETS  :: "[_, 'a set] \<Rightarrow> ('a set)set"   ("rcosets\<index> _" [81] 80)
    20   "rcosets G H == r_coset G H ` (carrier G)"
    18   "rcosets H \<equiv> \<Union>a\<in>carrier G. {H #> a}"
    21 
    19 
    22   set_mult  :: "[_, 'a set ,'a set] => 'a set" (infixl "<#>\<index>" 60)
    20   set_mult  :: "[_, 'a set ,'a set] \<Rightarrow> 'a set" (infixl "<#>\<index>" 60)
    23   "H <#> K == (%(x,y). x \<otimes> y) ` (H \<times> K)"
    21   "H <#> K \<equiv> \<Union>h\<in>H. \<Union>k\<in>K. {h \<otimes> k}"
    24 
    22 
    25   set_inv   :: "[_,'a set] => 'a set"
    23   SET_INV :: "[_,'a set] \<Rightarrow> 'a set"  ("set'_inv\<index> _" [81] 80)
    26   "set_inv G H == m_inv G ` H"
    24   "set_inv H \<equiv> \<Union>h\<in>H. {inv h}"
    27 
    25 
    28   normal     :: "['a set, _] => bool"       (infixl "<|" 60)
    26 
    29   "normal H G == subgroup H G &
    27 locale normal = subgroup + group +
    30                   (\<forall>x \<in> carrier G. r_coset G H x = l_coset G x H)"
    28   assumes coset_eq: "(\<forall>x \<in> carrier G. H #> x = x <# H)"
    31 
    29 
    32 syntax (xsymbols)
    30 
    33   normal :: "['a set, ('a,'b) monoid_scheme] => bool"  (infixl "\<lhd>" 60)
    31 syntax
       
    32   "@normal" :: "['a set, ('a, 'b) monoid_scheme] \<Rightarrow> bool"  (infixl "\<lhd>" 60)
       
    33 
       
    34 translations
       
    35   "H \<lhd> G" == "normal H G"
    34 
    36 
    35 
    37 
    36 subsection {*Basic Properties of Cosets*}
    38 subsection {*Basic Properties of Cosets*}
    37 
       
    38 lemma (in group) r_coset_eq: "H #> a = {b . \<exists>h\<in>H. h \<otimes> a = b}"
       
    39 by (auto simp add: r_coset_def)
       
    40 
       
    41 lemma (in group) l_coset_eq: "a <# H = {b . \<exists>h\<in>H. a \<otimes> h = b}"
       
    42 by (auto simp add: l_coset_def)
       
    43 
       
    44 lemma (in group) setrcos_eq: "rcosets G H = {C . \<exists>a\<in>carrier G. C = H #> a}"
       
    45 by (auto simp add: rcosets_def)
       
    46 
       
    47 lemma (in group) set_mult_eq: "H <#> K = {c . \<exists>h\<in>H. \<exists>k\<in>K. c = h \<otimes> k}"
       
    48 by (simp add: set_mult_def image_def)
       
    49 
    39 
    50 lemma (in group) coset_mult_assoc:
    40 lemma (in group) coset_mult_assoc:
    51      "[| M \<subseteq> carrier G; g \<in> carrier G; h \<in> carrier G |]
    41      "[| M \<subseteq> carrier G; g \<in> carrier G; h \<in> carrier G |]
    52       ==> (M #> g) #> h = M #> (g \<otimes> h)"
    42       ==> (M #> g) #> h = M #> (g \<otimes> h)"
    53 by (force simp add: r_coset_def m_assoc)
    43 by (force simp add: r_coset_def m_assoc)
    70 done
    60 done
    71 
    61 
    72 lemma (in group) coset_join1:
    62 lemma (in group) coset_join1:
    73      "[| H #> x = H;  x \<in> carrier G;  subgroup H G |] ==> x \<in> H"
    63      "[| H #> x = H;  x \<in> carrier G;  subgroup H G |] ==> x \<in> H"
    74 apply (erule subst)
    64 apply (erule subst)
    75 apply (simp add: r_coset_eq)
    65 apply (simp add: r_coset_def)
    76 apply (blast intro: l_one subgroup.one_closed)
    66 apply (blast intro: l_one subgroup.one_closed sym)
    77 done
    67 done
    78 
    68 
    79 lemma (in group) solve_equation:
    69 lemma (in group) solve_equation:
    80     "\<lbrakk>subgroup H G; x \<in> H; y \<in> H\<rbrakk> \<Longrightarrow> \<exists>h\<in>H. h \<otimes> x = y"
    70     "\<lbrakk>subgroup H G; x \<in> H; y \<in> H\<rbrakk> \<Longrightarrow> \<exists>h\<in>H. y = h \<otimes> x"
    81 apply (rule bexI [of _ "y \<otimes> (inv x)"])
    71 apply (rule bexI [of _ "y \<otimes> (inv x)"])
    82 apply (auto simp add: subgroup.m_closed subgroup.m_inv_closed m_assoc
    72 apply (auto simp add: subgroup.m_closed subgroup.m_inv_closed m_assoc
    83                       subgroup.subset [THEN subsetD])
    73                       subgroup.subset [THEN subsetD])
    84 done
    74 done
    85 
    75 
       
    76 lemma (in group) repr_independence:
       
    77      "\<lbrakk>y \<in> H #> x;  x \<in> carrier G; subgroup H G\<rbrakk> \<Longrightarrow> H #> x = H #> y"
       
    78 by (auto simp add: r_coset_def m_assoc [symmetric]
       
    79                    subgroup.subset [THEN subsetD]
       
    80                    subgroup.m_closed solve_equation)
       
    81 
    86 lemma (in group) coset_join2:
    82 lemma (in group) coset_join2:
    87      "[| x \<in> carrier G;  subgroup H G;  x\<in>H |] ==> H #> x = H"
    83      "\<lbrakk>x \<in> carrier G;  subgroup H G;  x\<in>H\<rbrakk> \<Longrightarrow> H #> x = H"
    88 by (force simp add: subgroup.m_closed r_coset_eq solve_equation)
    84   --{*Alternative proof is to put @{term "x=\<one>"} in @{text repr_independence}.*}
       
    85 by (force simp add: subgroup.m_closed r_coset_def solve_equation)
    89 
    86 
    90 lemma (in group) r_coset_subset_G:
    87 lemma (in group) r_coset_subset_G:
    91      "[| H \<subseteq> carrier G; x \<in> carrier G |] ==> H #> x \<subseteq> carrier G"
    88      "[| H \<subseteq> carrier G; x \<in> carrier G |] ==> H #> x \<subseteq> carrier G"
    92 by (auto simp add: r_coset_def)
    89 by (auto simp add: r_coset_def)
    93 
    90 
    94 lemma (in group) rcosI:
    91 lemma (in group) rcosI:
    95      "[| h \<in> H; H \<subseteq> carrier G; x \<in> carrier G|] ==> h \<otimes> x \<in> H #> x"
    92      "[| h \<in> H; H \<subseteq> carrier G; x \<in> carrier G|] ==> h \<otimes> x \<in> H #> x"
    96 by (auto simp add: r_coset_def)
    93 by (auto simp add: r_coset_def)
    97 
    94 
    98 lemma (in group) setrcosI:
    95 lemma (in group) rcosetsI:
    99      "[| H \<subseteq> carrier G; x \<in> carrier G |] ==> H #> x \<in> rcosets G H"
    96      "\<lbrakk>H \<subseteq> carrier G; x \<in> carrier G\<rbrakk> \<Longrightarrow> H #> x \<in> rcosets H"
   100 by (auto simp add: setrcos_eq)
    97 by (auto simp add: RCOSETS_def)
   101 
       
   102 
    98 
   103 text{*Really needed?*}
    99 text{*Really needed?*}
   104 lemma (in group) transpose_inv:
   100 lemma (in group) transpose_inv:
   105      "[| x \<otimes> y = z;  x \<in> carrier G;  y \<in> carrier G;  z \<in> carrier G |]
   101      "[| x \<otimes> y = z;  x \<in> carrier G;  y \<in> carrier G;  z \<in> carrier G |]
   106       ==> (inv x) \<otimes> z = y"
   102       ==> (inv x) \<otimes> z = y"
   107 by (force simp add: m_assoc [symmetric])
   103 by (force simp add: m_assoc [symmetric])
   108 
   104 
   109 lemma (in group) repr_independence:
       
   110      "[| y \<in> H #> x;  x \<in> carrier G; subgroup H G |] ==> H #> x = H #> y"
       
   111 by (auto simp add: r_coset_eq m_assoc [symmetric]
       
   112                    subgroup.subset [THEN subsetD]
       
   113                    subgroup.m_closed solve_equation)
       
   114 
       
   115 lemma (in group) rcos_self: "[| x \<in> carrier G; subgroup H G |] ==> x \<in> H #> x"
   105 lemma (in group) rcos_self: "[| x \<in> carrier G; subgroup H G |] ==> x \<in> H #> x"
   116 apply (simp add: r_coset_eq)
   106 apply (simp add: r_coset_def)
   117 apply (blast intro: l_one subgroup.subset [THEN subsetD]
   107 apply (blast intro: sym l_one subgroup.subset [THEN subsetD]
   118                     subgroup.one_closed)
   108                     subgroup.one_closed)
   119 done
   109 done
   120 
   110 
   121 
   111 
   122 subsection {* Normal subgroups *}
   112 subsection {* Normal subgroups *}
   123 
   113 
   124 lemma normal_imp_subgroup: "H <| G ==> subgroup H G"
   114 lemma normal_imp_subgroup: "H \<lhd> G \<Longrightarrow> subgroup H G"
   125 by (simp add: normal_def)
   115   by (simp add: normal_def subgroup_def)
   126 
   116 
   127 lemma (in group) normal_inv_op_closed1:
   117 lemma (in group) normalI: 
   128      "\<lbrakk>H \<lhd> G; x \<in> carrier G; h \<in> H\<rbrakk> \<Longrightarrow> (inv x) \<otimes> h \<otimes> x \<in> H"
   118   "subgroup H G \<Longrightarrow> (\<forall>x \<in> carrier G. H #> x = x <# H) \<Longrightarrow> H \<lhd> G";
   129 apply (auto simp add: l_coset_def r_coset_def normal_def)
   119   by (simp add: normal_def normal_axioms_def prems) 
       
   120 
       
   121 lemma (in normal) inv_op_closed1:
       
   122      "\<lbrakk>x \<in> carrier G; h \<in> H\<rbrakk> \<Longrightarrow> (inv x) \<otimes> h \<otimes> x \<in> H"
       
   123 apply (insert coset_eq) 
       
   124 apply (auto simp add: l_coset_def r_coset_def)
   130 apply (drule bspec, assumption)
   125 apply (drule bspec, assumption)
   131 apply (drule equalityD1 [THEN subsetD], blast, clarify)
   126 apply (drule equalityD1 [THEN subsetD], blast, clarify)
   132 apply (simp add: m_assoc subgroup.subset [THEN subsetD])
   127 apply (simp add: m_assoc)
   133 apply (simp add: m_assoc [symmetric] subgroup.subset [THEN subsetD])
   128 apply (simp add: m_assoc [symmetric])
   134 done
   129 done
   135 
   130 
   136 lemma (in group) normal_inv_op_closed2:
   131 lemma (in normal) inv_op_closed2:
   137      "\<lbrakk>H \<lhd> G; x \<in> carrier G; h \<in> H\<rbrakk> \<Longrightarrow> x \<otimes> h \<otimes> (inv x) \<in> H"
   132      "\<lbrakk>x \<in> carrier G; h \<in> H\<rbrakk> \<Longrightarrow> x \<otimes> h \<otimes> (inv x) \<in> H"
   138 apply (drule normal_inv_op_closed1 [of H "(inv x)"])
   133 apply (subgoal_tac "inv (inv x) \<otimes> h \<otimes> (inv x) \<in> H") 
   139 apply auto
   134 apply (simp add: ); 
       
   135 apply (blast intro: inv_op_closed1) 
   140 done
   136 done
   141 
   137 
   142 text{*Alternative characterization of normal subgroups*}
   138 text{*Alternative characterization of normal subgroups*}
   143 lemma (in group) normal_inv_iff:
   139 lemma (in group) normal_inv_iff:
   144      "(N \<lhd> G) = 
   140      "(N \<lhd> G) = 
   145       (subgroup N G & (\<forall>x \<in> carrier G. \<forall>h \<in> N. x \<otimes> h \<otimes> (inv x) \<in> N))"
   141       (subgroup N G & (\<forall>x \<in> carrier G. \<forall>h \<in> N. x \<otimes> h \<otimes> (inv x) \<in> N))"
   146       (is "_ = ?rhs")
   142       (is "_ = ?rhs")
   147 proof
   143 proof
   148   assume N: "N \<lhd> G"
   144   assume N: "N \<lhd> G"
   149   show ?rhs
   145   show ?rhs
   150     by (blast intro: N normal_imp_subgroup normal_inv_op_closed2) 
   146     by (blast intro: N normal.inv_op_closed2 normal_imp_subgroup) 
   151 next
   147 next
   152   assume ?rhs
   148   assume ?rhs
   153   hence sg: "subgroup N G" 
   149   hence sg: "subgroup N G" 
   154     and closed: "!!x. x\<in>carrier G ==> \<forall>h\<in>N. x \<otimes> h \<otimes> inv x \<in> N" by auto
   150     and closed: "\<And>x. x\<in>carrier G \<Longrightarrow> \<forall>h\<in>N. x \<otimes> h \<otimes> inv x \<in> N" by auto
   155   hence sb: "N \<subseteq> carrier G" by (simp add: subgroup.subset) 
   151   hence sb: "N \<subseteq> carrier G" by (simp add: subgroup.subset) 
   156   show "N \<lhd> G"
   152   show "N \<lhd> G"
   157   proof (simp add: sg normal_def l_coset_def r_coset_def, clarify)
   153   proof (intro normalI [OF sg], simp add: l_coset_def r_coset_def, clarify)
   158     fix x
   154     fix x
   159     assume x: "x \<in> carrier G"
   155     assume x: "x \<in> carrier G"
   160     show "(\<lambda>n. n \<otimes> x) ` N = op \<otimes> x ` N"
   156     show "(\<Union>\<^bsub>h\<in>N\<^esub> {h \<otimes> x}) = (\<Union>\<^bsub>h\<in>N\<^esub> {x \<otimes> h})"
   161     proof
   157     proof
   162       show "(\<lambda>n. n \<otimes> x) ` N \<subseteq> op \<otimes> x ` N"
   158       show "(\<Union>\<^bsub>h\<in>N\<^esub> {h \<otimes> x}) \<subseteq> (\<Union>\<^bsub>h\<in>N\<^esub> {x \<otimes> h})"
   163       proof clarify
   159       proof clarify
   164         fix n
   160         fix n
   165         assume n: "n \<in> N" 
   161         assume n: "n \<in> N" 
   166         show "n \<otimes> x \<in> op \<otimes> x ` N"
   162         show "n \<otimes> x \<in> (\<Union>\<^bsub>h\<in>N\<^esub> {x \<otimes> h})"
   167         proof 
   163         proof 
   168           show "n \<otimes> x = x \<otimes> (inv x \<otimes> n \<otimes> x)"
   164           from closed [of "inv x"]
       
   165           show "inv x \<otimes> n \<otimes> x \<in> N" by (simp add: x n)
       
   166           show "n \<otimes> x \<in> {x \<otimes> (inv x \<otimes> n \<otimes> x)}"
   169             by (simp add: x n m_assoc [symmetric] sb [THEN subsetD])
   167             by (simp add: x n m_assoc [symmetric] sb [THEN subsetD])
   170           with closed [of "inv x"]
       
   171           show "inv x \<otimes> n \<otimes> x \<in> N" by (simp add: x n)
       
   172         qed
   168         qed
   173       qed
   169       qed
   174     next
   170     next
   175       show "op \<otimes> x ` N \<subseteq> (\<lambda>n. n \<otimes> x) ` N" 
   171       show "(\<Union>\<^bsub>h\<in>N\<^esub> {x \<otimes> h}) \<subseteq> (\<Union>\<^bsub>h\<in>N\<^esub> {h \<otimes> x})"
   176       proof clarify
   172       proof clarify
   177         fix n
   173         fix n
   178         assume n: "n \<in> N" 
   174         assume n: "n \<in> N" 
   179         show "x \<otimes> n \<in> (\<lambda>n. n \<otimes> x) ` N"
   175         show "x \<otimes> n \<in> (\<Union>\<^bsub>h\<in>N\<^esub> {h \<otimes> x})"
   180         proof 
   176         proof 
   181           show "x \<otimes> n = (x \<otimes> n \<otimes> inv x) \<otimes> x"
   177           show "x \<otimes> n \<otimes> inv x \<in> N" by (simp add: x n closed)
       
   178           show "x \<otimes> n \<in> {x \<otimes> n \<otimes> inv x \<otimes> x}"
   182             by (simp add: x n m_assoc sb [THEN subsetD])
   179             by (simp add: x n m_assoc sb [THEN subsetD])
   183           show "x \<otimes> n \<otimes> inv x \<in> N" by (simp add: x n closed)
       
   184         qed
   180         qed
   185       qed
   181       qed
   186     qed
   182     qed
   187   qed
   183   qed
   188 qed
   184 qed
   189 
   185 
       
   186 
   190 subsection{*More Properties of Cosets*}
   187 subsection{*More Properties of Cosets*}
   191 
   188 
   192 lemma (in group) lcos_m_assoc:
   189 lemma (in group) lcos_m_assoc:
   193      "[| M \<subseteq> carrier G; g \<in> carrier G; h \<in> carrier G |]
   190      "[| M \<subseteq> carrier G; g \<in> carrier G; h \<in> carrier G |]
   194       ==> g <# (h <# M) = (g \<otimes> h) <# M"
   191       ==> g <# (h <# M) = (g \<otimes> h) <# M"
   200 lemma (in group) l_coset_subset_G:
   197 lemma (in group) l_coset_subset_G:
   201      "[| H \<subseteq> carrier G; x \<in> carrier G |] ==> x <# H \<subseteq> carrier G"
   198      "[| H \<subseteq> carrier G; x \<in> carrier G |] ==> x <# H \<subseteq> carrier G"
   202 by (auto simp add: l_coset_def subsetD)
   199 by (auto simp add: l_coset_def subsetD)
   203 
   200 
   204 lemma (in group) l_coset_swap:
   201 lemma (in group) l_coset_swap:
   205      "[| y \<in> x <# H;  x \<in> carrier G;  subgroup H G |] ==> x \<in> y <# H"
   202      "\<lbrakk>y \<in> x <# H;  x \<in> carrier G;  subgroup H G\<rbrakk> \<Longrightarrow> x \<in> y <# H"
   206 proof (simp add: l_coset_eq)
   203 proof (simp add: l_coset_def)
   207   assume "\<exists>h\<in>H. x \<otimes> h = y"
   204   assume "\<exists>h\<in>H. y = x \<otimes> h"
   208     and x: "x \<in> carrier G"
   205     and x: "x \<in> carrier G"
   209     and sb: "subgroup H G"
   206     and sb: "subgroup H G"
   210   then obtain h' where h': "h' \<in> H & x \<otimes> h' = y" by blast
   207   then obtain h' where h': "h' \<in> H & x \<otimes> h' = y" by blast
   211   show "\<exists>h\<in>H. y \<otimes> h = x"
   208   show "\<exists>h\<in>H. x = y \<otimes> h"
   212   proof
   209   proof
   213     show "y \<otimes> inv h' = x" using h' x sb
   210     show "x = y \<otimes> inv h'" using h' x sb
   214       by (auto simp add: m_assoc subgroup.subset [THEN subsetD])
   211       by (auto simp add: m_assoc subgroup.subset [THEN subsetD])
   215     show "inv h' \<in> H" using h' sb
   212     show "inv h' \<in> H" using h' sb
   216       by (auto simp add: subgroup.subset [THEN subsetD] subgroup.m_inv_closed)
   213       by (auto simp add: subgroup.subset [THEN subsetD] subgroup.m_inv_closed)
   217   qed
   214   qed
   218 qed
   215 qed
   242         (blast intro: l_coset_swap l_coset_carrier y x sb)+)
   239         (blast intro: l_coset_swap l_coset_carrier y x sb)+)
   243   show "y <# H \<subseteq> x <# H" by (rule l_repr_imp_subset [OF y x sb])
   240   show "y <# H \<subseteq> x <# H" by (rule l_repr_imp_subset [OF y x sb])
   244 qed
   241 qed
   245 
   242 
   246 lemma (in group) setmult_subset_G:
   243 lemma (in group) setmult_subset_G:
   247      "[| H \<subseteq> carrier G; K \<subseteq> carrier G |] ==> H <#> K \<subseteq> carrier G"
   244      "\<lbrakk>H \<subseteq> carrier G; K \<subseteq> carrier G\<rbrakk> \<Longrightarrow> H <#> K \<subseteq> carrier G"
   248 by (auto simp add: set_mult_eq subsetD)
   245 by (auto simp add: set_mult_def subsetD)
   249 
   246 
   250 lemma (in group) subgroup_mult_id: "subgroup H G ==> H <#> H = H"
   247 lemma (in group) subgroup_mult_id: "subgroup H G \<Longrightarrow> H <#> H = H"
   251 apply (auto simp add: subgroup.m_closed set_mult_eq Sigma_def image_def)
   248 apply (auto simp add: subgroup.m_closed set_mult_def Sigma_def image_def)
   252 apply (rule_tac x = x in bexI)
   249 apply (rule_tac x = x in bexI)
   253 apply (rule bexI [of _ "\<one>"])
   250 apply (rule bexI [of _ "\<one>"])
   254 apply (auto simp add: subgroup.m_closed subgroup.one_closed
   251 apply (auto simp add: subgroup.m_closed subgroup.one_closed
   255                       r_one subgroup.subset [THEN subsetD])
   252                       r_one subgroup.subset [THEN subsetD])
   256 done
   253 done
   257 
   254 
   258 
   255 
   259 subsubsection {* Set of inverses of an @{text r_coset}. *}
   256 subsubsection {* Set of inverses of an @{text r_coset}. *}
   260 
   257 
   261 lemma (in group) rcos_inv:
   258 lemma (in normal) rcos_inv:
   262   assumes normalHG: "H <| G"
   259   assumes x:     "x \<in> carrier G"
   263       and x:     "x \<in> carrier G"
   260   shows "set_inv (H #> x) = H #> (inv x)" 
   264   shows "set_inv G (H #> x) = H #> (inv x)"
   261 proof (simp add: r_coset_def SET_INV_def x inv_mult_group, safe)
   265 proof -
   262   fix h
   266   have H_subset: "H \<subseteq> carrier G"
   263   assume "h \<in> H"
   267     by (rule subgroup.subset [OF normal_imp_subgroup, OF normalHG])
   264   show "inv x \<otimes> inv h \<in> (\<Union>\<^bsub>j\<in>H\<^esub> {j \<otimes> inv x})"
   268   show ?thesis
   265   proof
   269   proof (auto simp add: r_coset_eq image_def set_inv_def)
   266     show "inv x \<otimes> inv h \<otimes> x \<in> H"
   270     fix h
   267       by (simp add: inv_op_closed1 prems)
   271     assume "h \<in> H"
   268     show "inv x \<otimes> inv h \<in> {inv x \<otimes> inv h \<otimes> x \<otimes> inv x}"
   272       hence "((inv x) \<otimes> (inv h) \<otimes> x) \<otimes> inv x = inv (h \<otimes> x)"
   269       by (simp add: prems m_assoc)
   273         by (simp add: x m_assoc inv_mult_group H_subset [THEN subsetD])
       
   274       thus "\<exists>j\<in>H. j \<otimes> inv x = inv (h \<otimes> x)"
       
   275        using prems
       
   276         by (blast intro: normal_inv_op_closed1 normal_imp_subgroup
       
   277                          subgroup.m_inv_closed)
       
   278   next
       
   279     fix h
       
   280     assume "h \<in> H"
       
   281       hence eq: "(x \<otimes> (inv h) \<otimes> (inv x)) \<otimes> x = x \<otimes> inv h"
       
   282         by (simp add: x m_assoc H_subset [THEN subsetD])
       
   283       hence "(\<exists>j\<in>H. j \<otimes> x = inv  (h \<otimes> (inv x))) \<and> h \<otimes> inv x = inv (inv (h \<otimes> (inv x)))"
       
   284        using prems
       
   285         by (simp add: m_assoc inv_mult_group H_subset [THEN subsetD],
       
   286             blast intro: eq normal_inv_op_closed2 normal_imp_subgroup
       
   287                          subgroup.m_inv_closed)
       
   288       thus "\<exists>y. (\<exists>h\<in>H. h \<otimes> x = y) \<and> h \<otimes> inv x = inv y" ..
       
   289   qed
   270   qed
   290 qed
   271 next
   291 
   272   fix h
   292 lemma (in group) rcos_inv2:
   273   assume "h \<in> H"
   293      "[| H <| G; K \<in> rcosets G H; x \<in> K |] ==> set_inv G K = H #> (inv x)"
   274   show "h \<otimes> inv x \<in> (\<Union>\<^bsub>j\<in>H\<^esub> {inv x \<otimes> inv j})"
   294 apply (simp add: setrcos_eq, clarify)
   275   proof
   295 apply (subgoal_tac "x : carrier G")
   276     show "x \<otimes> inv h \<otimes> inv x \<in> H"
   296  prefer 2
   277       by (simp add: inv_op_closed2 prems)
   297  apply (blast dest: r_coset_subset_G subgroup.subset normal_imp_subgroup)
   278     show "h \<otimes> inv x \<in> {inv x \<otimes> inv (x \<otimes> inv h \<otimes> inv x)}"
   298 apply (drule repr_independence)
   279       by (simp add: prems m_assoc [symmetric] inv_mult_group)
   299   apply assumption
   280   qed
   300  apply (erule normal_imp_subgroup)
   281 qed
   301 apply (simp add: rcos_inv)
       
   302 done
       
   303 
   282 
   304 
   283 
   305 subsubsection {*Theorems for @{text "<#>"} with @{text "#>"} or @{text "<#"}.*}
   284 subsubsection {*Theorems for @{text "<#>"} with @{text "#>"} or @{text "<#"}.*}
   306 
   285 
   307 lemma (in group) setmult_rcos_assoc:
   286 lemma (in group) setmult_rcos_assoc:
   308      "[| H \<subseteq> carrier G; K \<subseteq> carrier G; x \<in> carrier G |]
   287      "\<lbrakk>H \<subseteq> carrier G; K \<subseteq> carrier G; x \<in> carrier G\<rbrakk>
   309       ==> H <#> (K #> x) = (H <#> K) #> x"
   288       \<Longrightarrow> H <#> (K #> x) = (H <#> K) #> x"
   310 apply (auto simp add: r_coset_def set_mult_def)
   289 by (force simp add: r_coset_def set_mult_def m_assoc)
   311 apply (force simp add: m_assoc)+
       
   312 done
       
   313 
   290 
   314 lemma (in group) rcos_assoc_lcos:
   291 lemma (in group) rcos_assoc_lcos:
   315      "[| H \<subseteq> carrier G; K \<subseteq> carrier G; x \<in> carrier G |]
   292      "\<lbrakk>H \<subseteq> carrier G; K \<subseteq> carrier G; x \<in> carrier G\<rbrakk>
   316       ==> (H #> x) <#> K = H <#> (x <# K)"
   293       \<Longrightarrow> (H #> x) <#> K = H <#> (x <# K)"
   317 apply (auto simp add: r_coset_def l_coset_def set_mult_def Sigma_def image_def)
   294 by (force simp add: r_coset_def l_coset_def set_mult_def m_assoc)
   318 apply (force intro!: exI bexI simp add: m_assoc)+
   295 
   319 done
   296 lemma (in normal) rcos_mult_step1:
   320 
   297      "\<lbrakk>x \<in> carrier G; y \<in> carrier G\<rbrakk>
   321 lemma (in group) rcos_mult_step1:
   298       \<Longrightarrow> (H #> x) <#> (H #> y) = (H <#> (x <# H)) #> y"
   322      "[| H <| G; x \<in> carrier G; y \<in> carrier G |]
   299 by (simp add: setmult_rcos_assoc subset
   323       ==> (H #> x) <#> (H #> y) = (H <#> (x <# H)) #> y"
       
   324 by (simp add: setmult_rcos_assoc normal_imp_subgroup [THEN subgroup.subset]
       
   325               r_coset_subset_G l_coset_subset_G rcos_assoc_lcos)
   300               r_coset_subset_G l_coset_subset_G rcos_assoc_lcos)
   326 
   301 
   327 lemma (in group) rcos_mult_step2:
   302 lemma (in normal) rcos_mult_step2:
   328      "[| H <| G; x \<in> carrier G; y \<in> carrier G |]
   303      "\<lbrakk>x \<in> carrier G; y \<in> carrier G\<rbrakk>
   329       ==> (H <#> (x <# H)) #> y = (H <#> (H #> x)) #> y"
   304       \<Longrightarrow> (H <#> (x <# H)) #> y = (H <#> (H #> x)) #> y"
   330 by (simp add: normal_def)
   305 by (insert coset_eq, simp add: normal_def)
   331 
   306 
   332 lemma (in group) rcos_mult_step3:
   307 lemma (in normal) rcos_mult_step3:
   333      "[| H <| G; x \<in> carrier G; y \<in> carrier G |]
   308      "\<lbrakk>x \<in> carrier G; y \<in> carrier G\<rbrakk>
   334       ==> (H <#> (H #> x)) #> y = H #> (x \<otimes> y)"
   309       \<Longrightarrow> (H <#> (H #> x)) #> y = H #> (x \<otimes> y)"
   335 by (simp add: setmult_rcos_assoc r_coset_subset_G coset_mult_assoc
   310 by (simp add: setmult_rcos_assoc coset_mult_assoc
   336               setmult_subset_G  subgroup_mult_id
   311               subgroup_mult_id subset prems)
   337               subgroup.subset normal_imp_subgroup)
   312 
   338 
   313 lemma (in normal) rcos_sum:
   339 lemma (in group) rcos_sum:
   314      "\<lbrakk>x \<in> carrier G; y \<in> carrier G\<rbrakk>
   340      "[| H <| G; x \<in> carrier G; y \<in> carrier G |]
   315       \<Longrightarrow> (H #> x) <#> (H #> y) = H #> (x \<otimes> y)"
   341       ==> (H #> x) <#> (H #> y) = H #> (x \<otimes> y)"
       
   342 by (simp add: rcos_mult_step1 rcos_mult_step2 rcos_mult_step3)
   316 by (simp add: rcos_mult_step1 rcos_mult_step2 rcos_mult_step3)
   343 
   317 
   344 lemma (in group) setrcos_mult_eq: "[|H <| G; M \<in> rcosets G H|] ==> H <#> M = M"
   318 lemma (in normal) rcosets_mult_eq: "M \<in> rcosets H \<Longrightarrow> H <#> M = M"
   345   -- {* generalizes @{text subgroup_mult_id} *}
   319   -- {* generalizes @{text subgroup_mult_id} *}
   346   by (auto simp add: setrcos_eq normal_imp_subgroup subgroup.subset
   320   by (auto simp add: RCOSETS_def subset
   347     setmult_rcos_assoc subgroup_mult_id)
   321         setmult_rcos_assoc subgroup_mult_id prems)
       
   322 
       
   323 
       
   324 subsubsection{*An Equivalence Relation*}
       
   325 
       
   326 constdefs (structure G)
       
   327   r_congruent :: "[('a,'b)monoid_scheme, 'a set] \<Rightarrow> ('a*'a)set"
       
   328                   ("rcong\<index> _")
       
   329    "rcong H \<equiv> {(x,y). x \<in> carrier G & y \<in> carrier G & inv x \<otimes> y \<in> H}"
       
   330 
       
   331 
       
   332 lemma (in subgroup) equiv_rcong:
       
   333    includes group G
       
   334    shows "equiv (carrier G) (rcong H)"
       
   335 proof (intro equiv.intro)
       
   336   show "refl (carrier G) (rcong H)"
       
   337     by (auto simp add: r_congruent_def refl_def) 
       
   338 next
       
   339   show "sym (rcong H)"
       
   340   proof (simp add: r_congruent_def sym_def, clarify)
       
   341     fix x y
       
   342     assume [simp]: "x \<in> carrier G" "y \<in> carrier G" 
       
   343        and "inv x \<otimes> y \<in> H"
       
   344     hence "inv (inv x \<otimes> y) \<in> H" by (simp add: m_inv_closed) 
       
   345     thus "inv y \<otimes> x \<in> H" by (simp add: inv_mult_group)
       
   346   qed
       
   347 next
       
   348   show "trans (rcong H)"
       
   349   proof (simp add: r_congruent_def trans_def, clarify)
       
   350     fix x y z
       
   351     assume [simp]: "x \<in> carrier G" "y \<in> carrier G" "z \<in> carrier G"
       
   352        and "inv x \<otimes> y \<in> H" and "inv y \<otimes> z \<in> H"
       
   353     hence "(inv x \<otimes> y) \<otimes> (inv y \<otimes> z) \<in> H" by simp
       
   354     hence "inv x \<otimes> (y \<otimes> inv y) \<otimes> z \<in> H" by (simp add: m_assoc del: r_inv) 
       
   355     thus "inv x \<otimes> z \<in> H" by simp
       
   356   qed
       
   357 qed
       
   358 
       
   359 text{*Equivalence classes of @{text rcong} correspond to left cosets.
       
   360   Was there a mistake in the definitions? I'd have expected them to
       
   361   correspond to right cosets.*}
       
   362 
       
   363 (* CB: This is correct, but subtle.
       
   364    We call H #> a the right coset of a relative to H.  According to
       
   365    Jacobson, this is what the majority of group theory literature does.
       
   366    He then defines the notion of congruence relation ~ over monoids as
       
   367    equivalence relation with a ~ a' & b ~ b' \<Longrightarrow> a*b ~ a'*b'.
       
   368    Our notion of right congruence induced by K: rcong K appears only in
       
   369    the context where K is a normal subgroup.  Jacobson doesn't name it.
       
   370    But in this context left and right cosets are identical.
       
   371 *)
       
   372 
       
   373 lemma (in subgroup) l_coset_eq_rcong:
       
   374   includes group G
       
   375   assumes a: "a \<in> carrier G"
       
   376   shows "a <# H = rcong H `` {a}"
       
   377 by (force simp add: r_congruent_def l_coset_def m_assoc [symmetric] a ) 
   348 
   378 
   349 
   379 
   350 subsubsection{*Two distinct right cosets are disjoint*}
   380 subsubsection{*Two distinct right cosets are disjoint*}
   351 
   381 
   352 lemma (in group) rcos_equation:
   382 lemma (in group) rcos_equation:
   353      "[|subgroup H G;  a \<in> carrier G;  b \<in> carrier G;  ha \<otimes> a = h \<otimes> b;
   383   includes subgroup H G
   354         h \<in> H;  ha \<in> H;  hb \<in> H|]
   384   shows
   355       ==> \<exists>h\<in>H. h \<otimes> b = hb \<otimes> a"
   385      "\<lbrakk>ha \<otimes> a = h \<otimes> b; a \<in> carrier G;  b \<in> carrier G;  
   356 apply (rule bexI [of _"hb \<otimes> ((inv ha) \<otimes> h)"])
   386         h \<in> H;  ha \<in> H;  hb \<in> H\<rbrakk>
   357 apply (simp  add: m_assoc transpose_inv subgroup.subset [THEN subsetD])
   387       \<Longrightarrow> hb \<otimes> a \<in> (\<Union>h\<in>H. {h \<otimes> b})"
   358 apply (simp add: subgroup.m_closed subgroup.m_inv_closed)
   388 apply (rule UN_I [of "hb \<otimes> ((inv ha) \<otimes> h)"])
       
   389 apply (simp add: ); 
       
   390 apply (simp add: m_assoc transpose_inv)
   359 done
   391 done
   360 
   392 
   361 lemma (in group) rcos_disjoint:
   393 lemma (in group) rcos_disjoint:
   362      "[|subgroup H G; a \<in> rcosets G H; b \<in> rcosets G H; a\<noteq>b|] ==> a \<inter> b = {}"
   394   includes subgroup H G
   363 apply (simp add: setrcos_eq r_coset_eq)
   395   shows "\<lbrakk>a \<in> rcosets H; b \<in> rcosets H; a\<noteq>b\<rbrakk> \<Longrightarrow> a \<inter> b = {}"
   364 apply (blast intro: rcos_equation sym)
   396 apply (simp add: RCOSETS_def r_coset_def)
       
   397 apply (blast intro: rcos_equation prems sym)
   365 done
   398 done
   366 
   399 
   367 
   400 
   368 subsection {*Order of a Group and Lagrange's Theorem*}
   401 subsection {*Order of a Group and Lagrange's Theorem*}
   369 
   402 
   370 constdefs
   403 constdefs
   371   order :: "('a, 'b) semigroup_scheme => nat"
   404   order :: "('a, 'b) monoid_scheme \<Rightarrow> nat"
   372   "order S == card (carrier S)"
   405   "order S \<equiv> card (carrier S)"
   373 
   406 
   374 lemma (in group) setrcos_part_G: "subgroup H G ==> \<Union>rcosets G H = carrier G"
   407 lemma (in group) rcos_self:
       
   408   includes subgroup
       
   409   shows "x \<in> carrier G \<Longrightarrow> x \<in> H #> x"
       
   410 apply (simp add: r_coset_def)
       
   411 apply (rule_tac x="\<one>" in bexI) 
       
   412 apply (auto simp add: ); 
       
   413 done
       
   414 
       
   415 lemma (in group) rcosets_part_G:
       
   416   includes subgroup
       
   417   shows "\<Union>(rcosets H) = carrier G"
   375 apply (rule equalityI)
   418 apply (rule equalityI)
   376 apply (force simp add: subgroup.subset [THEN subsetD]
   419  apply (force simp add: RCOSETS_def r_coset_def)
   377                        setrcos_eq r_coset_def)
   420 apply (auto simp add: RCOSETS_def intro: rcos_self prems)
   378 apply (auto simp add: setrcos_eq subgroup.subset rcos_self)
       
   379 done
   421 done
   380 
   422 
   381 lemma (in group) cosets_finite:
   423 lemma (in group) cosets_finite:
   382      "[| c \<in> rcosets G H;  H \<subseteq> carrier G;  finite (carrier G) |] ==> finite c"
   424      "\<lbrakk>c \<in> rcosets H;  H \<subseteq> carrier G;  finite (carrier G)\<rbrakk> \<Longrightarrow> finite c"
   383 apply (auto simp add: setrcos_eq)
   425 apply (auto simp add: RCOSETS_def)
   384 apply (simp (no_asm_simp) add: r_coset_subset_G [THEN finite_subset])
   426 apply (simp add: r_coset_subset_G [THEN finite_subset])
   385 done
   427 done
   386 
   428 
   387 text{*The next two lemmas support the proof of @{text card_cosets_equal}.*}
   429 text{*The next two lemmas support the proof of @{text card_cosets_equal}.*}
   388 lemma (in group) inj_on_f:
   430 lemma (in group) inj_on_f:
   389     "[|H \<subseteq> carrier G;  a \<in> carrier G|] ==> inj_on (\<lambda>y. y \<otimes> inv a) (H #> a)"
   431     "\<lbrakk>H \<subseteq> carrier G;  a \<in> carrier G\<rbrakk> \<Longrightarrow> inj_on (\<lambda>y. y \<otimes> inv a) (H #> a)"
   390 apply (rule inj_onI)
   432 apply (rule inj_onI)
   391 apply (subgoal_tac "x \<in> carrier G & y \<in> carrier G")
   433 apply (subgoal_tac "x \<in> carrier G & y \<in> carrier G")
   392  prefer 2 apply (blast intro: r_coset_subset_G [THEN subsetD])
   434  prefer 2 apply (blast intro: r_coset_subset_G [THEN subsetD])
   393 apply (simp add: subsetD)
   435 apply (simp add: subsetD)
   394 done
   436 done
   395 
   437 
   396 lemma (in group) inj_on_g:
   438 lemma (in group) inj_on_g:
   397     "[|H \<subseteq> carrier G;  a \<in> carrier G|] ==> inj_on (\<lambda>y. y \<otimes> a) H"
   439     "\<lbrakk>H \<subseteq> carrier G;  a \<in> carrier G\<rbrakk> \<Longrightarrow> inj_on (\<lambda>y. y \<otimes> a) H"
   398 by (force simp add: inj_on_def subsetD)
   440 by (force simp add: inj_on_def subsetD)
   399 
   441 
   400 lemma (in group) card_cosets_equal:
   442 lemma (in group) card_cosets_equal:
   401      "[| c \<in> rcosets G H;  H \<subseteq> carrier G; finite(carrier G) |]
   443      "\<lbrakk>c \<in> rcosets H;  H \<subseteq> carrier G; finite(carrier G)\<rbrakk>
   402       ==> card c = card H"
   444       \<Longrightarrow> card c = card H"
   403 apply (auto simp add: setrcos_eq)
   445 apply (auto simp add: RCOSETS_def)
   404 apply (rule card_bij_eq)
   446 apply (rule card_bij_eq)
   405      apply (rule inj_on_f, assumption+)
   447      apply (rule inj_on_f, assumption+)
   406     apply (force simp add: m_assoc subsetD r_coset_def)
   448     apply (force simp add: m_assoc subsetD r_coset_def)
   407    apply (rule inj_on_g, assumption+)
   449    apply (rule inj_on_g, assumption+)
   408   apply (force simp add: m_assoc subsetD r_coset_def)
   450   apply (force simp add: m_assoc subsetD r_coset_def)
   409  txt{*The sets @{term "H #> a"} and @{term "H"} are finite.*}
   451  txt{*The sets @{term "H #> a"} and @{term "H"} are finite.*}
   410  apply (simp add: r_coset_subset_G [THEN finite_subset])
   452  apply (simp add: r_coset_subset_G [THEN finite_subset])
   411 apply (blast intro: finite_subset)
   453 apply (blast intro: finite_subset)
   412 done
   454 done
   413 
   455 
   414 lemma (in group) setrcos_subset_PowG:
   456 lemma (in group) rcosets_subset_PowG:
   415      "subgroup H G  ==> rcosets G H \<subseteq> Pow(carrier G)"
   457      "subgroup H G  \<Longrightarrow> rcosets H \<subseteq> Pow(carrier G)"
   416 apply (simp add: setrcos_eq)
   458 apply (simp add: RCOSETS_def)
   417 apply (blast dest: r_coset_subset_G subgroup.subset)
   459 apply (blast dest: r_coset_subset_G subgroup.subset)
   418 done
   460 done
   419 
   461 
   420 
   462 
   421 theorem (in group) lagrange:
   463 theorem (in group) lagrange:
   422      "[| finite(carrier G); subgroup H G |]
   464      "\<lbrakk>finite(carrier G); subgroup H G\<rbrakk>
   423       ==> card(rcosets G H) * card(H) = order(G)"
   465       \<Longrightarrow> card(rcosets H) * card(H) = order(G)"
   424 apply (simp (no_asm_simp) add: order_def setrcos_part_G [symmetric])
   466 apply (simp (no_asm_simp) add: order_def rcosets_part_G [symmetric])
   425 apply (subst mult_commute)
   467 apply (subst mult_commute)
   426 apply (rule card_partition)
   468 apply (rule card_partition)
   427    apply (simp add: setrcos_subset_PowG [THEN finite_subset])
   469    apply (simp add: rcosets_subset_PowG [THEN finite_subset])
   428   apply (simp add: setrcos_part_G)
   470   apply (simp add: rcosets_part_G)
   429  apply (simp add: card_cosets_equal subgroup.subset)
   471  apply (simp add: card_cosets_equal subgroup.subset)
   430 apply (simp add: rcos_disjoint)
   472 apply (simp add: rcos_disjoint)
   431 done
   473 done
   432 
   474 
   433 
   475 
   434 subsection {*Quotient Groups: Factorization of a Group*}
   476 subsection {*Quotient Groups: Factorization of a Group*}
   435 
   477 
   436 constdefs
   478 constdefs
   437   FactGroup :: "[('a,'b) monoid_scheme, 'a set] => ('a set) monoid"
   479   FactGroup :: "[('a,'b) monoid_scheme, 'a set] \<Rightarrow> ('a set) monoid"
   438      (infixl "Mod" 65)
   480      (infixl "Mod" 65)
   439     --{*Actually defined for groups rather than monoids*}
   481     --{*Actually defined for groups rather than monoids*}
   440   "FactGroup G H ==
   482   "FactGroup G H \<equiv>
   441     (| carrier = rcosets G H, mult = set_mult G, one = H |)"
   483     \<lparr>carrier = rcosets\<^bsub>G\<^esub> H, mult = set_mult G, one = H\<rparr>"
   442 
   484 
   443 lemma (in group) setmult_closed:
   485 lemma (in normal) setmult_closed:
   444      "[| H <| G; K1 \<in> rcosets G H; K2 \<in> rcosets G H |]
   486      "\<lbrakk>K1 \<in> rcosets H; K2 \<in> rcosets H\<rbrakk> \<Longrightarrow> K1 <#> K2 \<in> rcosets H"
   445       ==> K1 <#> K2 \<in> rcosets G H"
   487 by (auto simp add: rcos_sum RCOSETS_def)
   446 by (auto simp add: normal_imp_subgroup [THEN subgroup.subset]
   488 
   447                    rcos_sum setrcos_eq)
   489 lemma (in normal) setinv_closed:
   448 
   490      "K \<in> rcosets H \<Longrightarrow> set_inv K \<in> rcosets H"
   449 lemma (in group) setinv_closed:
   491 by (auto simp add: rcos_inv RCOSETS_def)
   450      "[| H <| G; K \<in> rcosets G H |] ==> set_inv G K \<in> rcosets G H"
   492 
   451 by (auto simp add: normal_imp_subgroup
   493 lemma (in normal) rcosets_assoc:
   452                    subgroup.subset rcos_inv
   494      "\<lbrakk>M1 \<in> rcosets H; M2 \<in> rcosets H; M3 \<in> rcosets H\<rbrakk>
   453                    setrcos_eq)
   495       \<Longrightarrow> M1 <#> M2 <#> M3 = M1 <#> (M2 <#> M3)"
   454 
   496 by (auto simp add: RCOSETS_def rcos_sum m_assoc)
   455 lemma (in group) setrcos_assoc:
   497 
   456      "[|H <| G; M1 \<in> rcosets G H; M2 \<in> rcosets G H; M3 \<in> rcosets G H|]
   498 lemma (in subgroup) subgroup_in_rcosets:
   457       ==> M1 <#> M2 <#> M3 = M1 <#> (M2 <#> M3)"
   499   includes group G
   458 by (auto simp add: setrcos_eq rcos_sum normal_imp_subgroup
   500   shows "H \<in> rcosets H"
   459                    subgroup.subset m_assoc)
       
   460 
       
   461 lemma (in group) subgroup_in_rcosets:
       
   462   "subgroup H G ==> H \<in> rcosets G H"
       
   463 proof -
   501 proof -
   464   assume sub: "subgroup H G"
   502   have "H #> \<one> = H"
   465   have "r_coset G H \<one> = H"
   503     by (rule coset_join2, auto)
   466     by (rule coset_join2)
       
   467        (auto intro: sub subgroup.one_closed)
       
   468   then show ?thesis
   504   then show ?thesis
   469     by (auto simp add: setrcos_eq)
   505     by (auto simp add: RCOSETS_def)
   470 qed
   506 qed
   471 
   507 
   472 lemma (in group) setrcos_inv_mult_group_eq:
   508 lemma (in normal) rcosets_inv_mult_group_eq:
   473      "[|H <| G; M \<in> rcosets G H|] ==> set_inv G M <#> M = H"
   509      "M \<in> rcosets H \<Longrightarrow> set_inv M <#> M = H"
   474 by (auto simp add: setrcos_eq rcos_inv rcos_sum normal_imp_subgroup
   510 by (auto simp add: RCOSETS_def rcos_inv rcos_sum subgroup.subset prems)
   475                    subgroup.subset)
   511 
   476 (*
   512 theorem (in normal) factorgroup_is_group:
   477 lemma (in group) factorgroup_is_magma:
   513   "group (G Mod H)"
   478   "H <| G ==> magma (G Mod H)"
       
   479   by rule (simp add: FactGroup_def coset.setmult_closed [OF is_coset])
       
   480 
       
   481 lemma (in group) factorgroup_semigroup_axioms:
       
   482   "H <| G ==> semigroup_axioms (G Mod H)"
       
   483   by rule (simp add: FactGroup_def coset.setrcos_assoc [OF is_coset]
       
   484     coset.setmult_closed [OF is_coset])
       
   485 *)
       
   486 theorem (in group) factorgroup_is_group:
       
   487   "H <| G ==> group (G Mod H)"
       
   488 apply (simp add: FactGroup_def)
   514 apply (simp add: FactGroup_def)
   489 apply (rule groupI)
   515 apply (rule groupI)
   490     apply (simp add: setmult_closed)
   516     apply (simp add: setmult_closed)
   491    apply (simp add: normal_imp_subgroup subgroup_in_rcosets)
   517    apply (simp add: normal_imp_subgroup subgroup_in_rcosets [OF is_group])
   492   apply (simp add: restrictI setmult_closed setrcos_assoc)
   518   apply (simp add: restrictI setmult_closed rcosets_assoc)
   493  apply (simp add: normal_imp_subgroup
   519  apply (simp add: normal_imp_subgroup
   494                   subgroup_in_rcosets setrcos_mult_eq)
   520                   subgroup_in_rcosets rcosets_mult_eq)
   495 apply (auto dest: setrcos_inv_mult_group_eq simp add: setinv_closed)
   521 apply (auto dest: rcosets_inv_mult_group_eq simp add: setinv_closed)
   496 done
   522 done
   497 
   523 
   498 lemma mult_FactGroup [simp]: "X \<otimes>\<^bsub>(G Mod H)\<^esub> X' = X <#>\<^bsub>G\<^esub> X'"
   524 lemma mult_FactGroup [simp]: "X \<otimes>\<^bsub>(G Mod H)\<^esub> X' = X <#>\<^bsub>G\<^esub> X'"
   499   by (simp add: FactGroup_def) 
   525   by (simp add: FactGroup_def) 
   500 
   526 
   501 lemma (in group) inv_FactGroup:
   527 lemma (in normal) inv_FactGroup:
   502      "N <| G ==> X \<in> carrier (G Mod N) ==> inv\<^bsub>G Mod N\<^esub> X = set_inv G X"
   528      "X \<in> carrier (G Mod H) \<Longrightarrow> inv\<^bsub>G Mod H\<^esub> X = set_inv X"
   503 apply (rule group.inv_equality [OF factorgroup_is_group]) 
   529 apply (rule group.inv_equality [OF factorgroup_is_group]) 
   504 apply (simp_all add: FactGroup_def setinv_closed setrcos_inv_mult_group_eq)
   530 apply (simp_all add: FactGroup_def setinv_closed rcosets_inv_mult_group_eq)
   505 done
   531 done
   506 
   532 
   507 text{*The coset map is a homomorphism from @{term G} to the quotient group
   533 text{*The coset map is a homomorphism from @{term G} to the quotient group
   508   @{term "G Mod N"}*}
   534   @{term "G Mod H"}*}
   509 lemma (in group) r_coset_hom_Mod:
   535 lemma (in normal) r_coset_hom_Mod:
   510   assumes N: "N <| G"
   536   "(\<lambda>a. H #> a) \<in> hom G (G Mod H)"
   511   shows "(r_coset G N) \<in> hom G (G Mod N)"
   537   by (auto simp add: FactGroup_def RCOSETS_def Pi_def hom_def rcos_sum)
   512 by (simp add: FactGroup_def rcosets_def Pi_def hom_def rcos_sum N) 
   538 
   513 
   539  
   514 
   540 subsection{*The First Isomorphism Theorem*}
   515 subsection{*Quotienting by the Kernel of a Homomorphism*}
   541 
       
   542 text{*The quotient by the kernel of a homomorphism is isomorphic to the 
       
   543   range of that homomorphism.*}
   516 
   544 
   517 constdefs
   545 constdefs
   518   kernel :: "('a, 'm) monoid_scheme => ('b, 'n) monoid_scheme => 
   546   kernel :: "('a, 'm) monoid_scheme \<Rightarrow> ('b, 'n) monoid_scheme \<Rightarrow> 
   519              ('a => 'b) => 'a set" 
   547              ('a \<Rightarrow> 'b) \<Rightarrow> 'a set" 
   520     --{*the kernel of a homomorphism*}
   548     --{*the kernel of a homomorphism*}
   521   "kernel G H h == {x. x \<in> carrier G & h x = \<one>\<^bsub>H\<^esub>}";
   549   "kernel G H h \<equiv> {x. x \<in> carrier G & h x = \<one>\<^bsub>H\<^esub>}";
   522 
   550 
   523 lemma (in group_hom) subgroup_kernel: "subgroup (kernel G H h) G"
   551 lemma (in group_hom) subgroup_kernel: "subgroup (kernel G H h) G"
   524 apply (rule group.subgroupI) 
   552 apply (rule subgroup.intro) 
   525 apply (auto simp add: kernel_def group.intro prems) 
   553 apply (auto simp add: kernel_def group.intro prems) 
   526 done
   554 done
   527 
   555 
   528 text{*The kernel of a homomorphism is a normal subgroup*}
   556 text{*The kernel of a homomorphism is a normal subgroup*}
   529 lemma (in group_hom) normal_kernel: "(kernel G H h) <| G"
   557 lemma (in group_hom) normal_kernel: "(kernel G H h) \<lhd> G"
   530 apply (simp add: group.normal_inv_iff subgroup_kernel group.intro prems)
   558 apply (simp add: group.normal_inv_iff subgroup_kernel group.intro prems)
   531 apply (simp add: kernel_def)  
   559 apply (simp add: kernel_def)  
   532 done
   560 done
   533 
   561 
   534 lemma (in group_hom) FactGroup_nonempty:
   562 lemma (in group_hom) FactGroup_nonempty:
   536   shows "X \<noteq> {}"
   564   shows "X \<noteq> {}"
   537 proof -
   565 proof -
   538   from X
   566   from X
   539   obtain g where "g \<in> carrier G" 
   567   obtain g where "g \<in> carrier G" 
   540              and "X = kernel G H h #> g"
   568              and "X = kernel G H h #> g"
   541     by (auto simp add: FactGroup_def rcosets_def)
   569     by (auto simp add: FactGroup_def RCOSETS_def)
   542   thus ?thesis 
   570   thus ?thesis 
   543    by (force simp add: kernel_def r_coset_def image_def intro: hom_one)
   571    by (auto simp add: kernel_def r_coset_def image_def intro: hom_one)
   544 qed
   572 qed
   545 
   573 
   546 
   574 
   547 lemma (in group_hom) FactGroup_contents_mem:
   575 lemma (in group_hom) FactGroup_contents_mem:
   548   assumes X: "X \<in> carrier (G Mod (kernel G H h))"
   576   assumes X: "X \<in> carrier (G Mod (kernel G H h))"
   549   shows "contents (h`X) \<in> carrier H"
   577   shows "contents (h`X) \<in> carrier H"
   550 proof -
   578 proof -
   551   from X
   579   from X
   552   obtain g where g: "g \<in> carrier G" 
   580   obtain g where g: "g \<in> carrier G" 
   553              and "X = kernel G H h #> g"
   581              and "X = kernel G H h #> g"
   554     by (auto simp add: FactGroup_def rcosets_def)
   582     by (auto simp add: FactGroup_def RCOSETS_def)
   555   hence "h ` X = {h g}" by (force simp add: kernel_def r_coset_def image_def g)
   583   hence "h ` X = {h g}" by (auto simp add: kernel_def r_coset_def image_def g)
   556   thus ?thesis by (auto simp add: g)
   584   thus ?thesis by (auto simp add: g)
   557 qed
   585 qed
   558 
   586 
   559 lemma (in group_hom) FactGroup_hom:
   587 lemma (in group_hom) FactGroup_hom:
   560      "(%X. contents (h`X)) \<in> hom (G Mod (kernel G H h)) H"
   588      "(\<lambda>X. contents (h`X)) \<in> hom (G Mod (kernel G H h)) H"
       
   589 apply (simp add: hom_def FactGroup_contents_mem  normal.factorgroup_is_group [OF normal_kernel] group.axioms monoid.m_closed)  
   561 proof (simp add: hom_def funcsetI FactGroup_contents_mem, intro ballI) 
   590 proof (simp add: hom_def funcsetI FactGroup_contents_mem, intro ballI) 
   562   fix X and X'
   591   fix X and X'
   563   assume X:  "X  \<in> carrier (G Mod kernel G H h)"
   592   assume X:  "X  \<in> carrier (G Mod kernel G H h)"
   564      and X': "X' \<in> carrier (G Mod kernel G H h)"
   593      and X': "X' \<in> carrier (G Mod kernel G H h)"
   565   then
   594   then
   566   obtain g and g'
   595   obtain g and g'
   567            where "g \<in> carrier G" and "g' \<in> carrier G" 
   596            where "g \<in> carrier G" and "g' \<in> carrier G" 
   568              and "X = kernel G H h #> g" and "X' = kernel G H h #> g'"
   597              and "X = kernel G H h #> g" and "X' = kernel G H h #> g'"
   569     by (auto simp add: FactGroup_def rcosets_def)
   598     by (auto simp add: FactGroup_def RCOSETS_def)
   570   hence all: "\<forall>x\<in>X. h x = h g" "\<forall>x\<in>X'. h x = h g'" 
   599   hence all: "\<forall>x\<in>X. h x = h g" "\<forall>x\<in>X'. h x = h g'" 
   571     and Xsub: "X \<subseteq> carrier G" and X'sub: "X' \<subseteq> carrier G"
   600     and Xsub: "X \<subseteq> carrier G" and X'sub: "X' \<subseteq> carrier G"
   572     by (force simp add: kernel_def r_coset_def image_def)+
   601     by (force simp add: kernel_def r_coset_def image_def)+
   573   hence "h ` (X <#> X') = {h g \<otimes>\<^bsub>H\<^esub> h g'}" using X X'
   602   hence "h ` (X <#> X') = {h g \<otimes>\<^bsub>H\<^esub> h g'}" using X X'
   574     by (auto dest!: FactGroup_nonempty
   603     by (auto dest!: FactGroup_nonempty
   576                        subsetD [OF Xsub] subsetD [OF X'sub]) 
   605                        subsetD [OF Xsub] subsetD [OF X'sub]) 
   577   thus "contents (h ` (X <#> X')) = contents (h ` X) \<otimes>\<^bsub>H\<^esub> contents (h ` X')"
   606   thus "contents (h ` (X <#> X')) = contents (h ` X) \<otimes>\<^bsub>H\<^esub> contents (h ` X')"
   578     by (simp add: all image_eq_UN FactGroup_nonempty X X')  
   607     by (simp add: all image_eq_UN FactGroup_nonempty X X')  
   579 qed
   608 qed
   580 
   609 
       
   610 
   581 text{*Lemma for the following injectivity result*}
   611 text{*Lemma for the following injectivity result*}
   582 lemma (in group_hom) FactGroup_subset:
   612 lemma (in group_hom) FactGroup_subset:
   583      "[|g \<in> carrier G; g' \<in> carrier G; h g = h g'|]
   613      "\<lbrakk>g \<in> carrier G; g' \<in> carrier G; h g = h g'\<rbrakk>
   584       ==>  kernel G H h #> g \<subseteq> kernel G H h #> g'"
   614       \<Longrightarrow>  kernel G H h #> g \<subseteq> kernel G H h #> g'"
   585 apply (clarsimp simp add: kernel_def r_coset_def image_def);
   615 apply (clarsimp simp add: kernel_def r_coset_def image_def);
   586 apply (rename_tac y)  
   616 apply (rename_tac y)  
   587 apply (rule_tac x="y \<otimes> g \<otimes> inv g'" in exI) 
   617 apply (rule_tac x="y \<otimes> g \<otimes> inv g'" in exI) 
   588 apply (simp add: G.m_assoc); 
   618 apply (simp add: G.m_assoc); 
   589 done
   619 done
   596      and X': "X' \<in> carrier (G Mod kernel G H h)"
   626      and X': "X' \<in> carrier (G Mod kernel G H h)"
   597   then
   627   then
   598   obtain g and g'
   628   obtain g and g'
   599            where gX: "g \<in> carrier G"  "g' \<in> carrier G" 
   629            where gX: "g \<in> carrier G"  "g' \<in> carrier G" 
   600               "X = kernel G H h #> g" "X' = kernel G H h #> g'"
   630               "X = kernel G H h #> g" "X' = kernel G H h #> g'"
   601     by (auto simp add: FactGroup_def rcosets_def)
   631     by (auto simp add: FactGroup_def RCOSETS_def)
   602   hence all: "\<forall>x\<in>X. h x = h g" "\<forall>x\<in>X'. h x = h g'" 
   632   hence all: "\<forall>x\<in>X. h x = h g" "\<forall>x\<in>X'. h x = h g'" 
   603     by (force simp add: kernel_def r_coset_def image_def)+
   633     by (force simp add: kernel_def r_coset_def image_def)+
   604   assume "contents (h ` X) = contents (h ` X')"
   634   assume "contents (h ` X) = contents (h ` X')"
   605   hence h: "h g = h g'"
   635   hence h: "h g = h g'"
   606     by (simp add: image_eq_UN all FactGroup_nonempty X X') 
   636     by (simp add: image_eq_UN all FactGroup_nonempty X X') 
   622     with h obtain g where g: "g \<in> carrier G" "h g = y"
   652     with h obtain g where g: "g \<in> carrier G" "h g = y"
   623       by (blast elim: equalityE); 
   653       by (blast elim: equalityE); 
   624     hence "(\<Union>\<^bsub>x\<in>kernel G H h #> g\<^esub> {h x}) = {y}" 
   654     hence "(\<Union>\<^bsub>x\<in>kernel G H h #> g\<^esub> {h x}) = {y}" 
   625       by (auto simp add: y kernel_def r_coset_def) 
   655       by (auto simp add: y kernel_def r_coset_def) 
   626     with g show "y \<in> (\<lambda>X. contents (h ` X)) ` carrier (G Mod kernel G H h)" 
   656     with g show "y \<in> (\<lambda>X. contents (h ` X)) ` carrier (G Mod kernel G H h)" 
   627       by (auto intro!: bexI simp add: FactGroup_def rcosets_def image_eq_UN)
   657       by (auto intro!: bexI simp add: FactGroup_def RCOSETS_def image_eq_UN)
   628   qed
   658   qed
   629 qed
   659 qed
   630 
   660 
   631 
   661 
   632 text{*If @{term h} is a homomorphism from @{term G} onto @{term H}, then the
   662 text{*If @{term h} is a homomorphism from @{term G} onto @{term H}, then the
   633  quotient group @{term "G Mod (kernel G H h)"} is isomorphic to @{term H}.*}
   663  quotient group @{term "G Mod (kernel G H h)"} is isomorphic to @{term H}.*}
   634 theorem (in group_hom) FactGroup_iso:
   664 theorem (in group_hom) FactGroup_iso:
   635   "h ` carrier G = carrier H
   665   "h ` carrier G = carrier H
   636    \<Longrightarrow> (%X. contents (h`X)) \<in> (G Mod (kernel G H h)) \<cong> H"
   666    \<Longrightarrow> (\<lambda>X. contents (h`X)) \<in> (G Mod (kernel G H h)) \<cong> H"
   637 by (simp add: iso_def FactGroup_hom FactGroup_inj_on bij_betw_def 
   667 by (simp add: iso_def FactGroup_hom FactGroup_inj_on bij_betw_def 
   638               FactGroup_onto) 
   668               FactGroup_onto) 
   639 
   669 
       
   670 
   640 end
   671 end