src/HOL/Algebra/Coset.thy
changeset 61382 efac889fccbc
parent 57512 cc97b347b301
child 61628 8dd2bd4fe30b
equal deleted inserted replaced
61381:ddca85598c65 61382:efac889fccbc
     6 
     6 
     7 theory Coset
     7 theory Coset
     8 imports Group
     8 imports Group
     9 begin
     9 begin
    10 
    10 
    11 section {*Cosets and Quotient Groups*}
    11 section \<open>Cosets and Quotient Groups\<close>
    12 
    12 
    13 definition
    13 definition
    14   r_coset    :: "[_, 'a set, 'a] \<Rightarrow> 'a set"    (infixl "#>\<index>" 60)
    14   r_coset    :: "[_, 'a set, 'a] \<Rightarrow> 'a set"    (infixl "#>\<index>" 60)
    15   where "H #>\<^bsub>G\<^esub> a = (\<Union>h\<in>H. {h \<otimes>\<^bsub>G\<^esub> a})"
    15   where "H #>\<^bsub>G\<^esub> a = (\<Union>h\<in>H. {h \<otimes>\<^bsub>G\<^esub> a})"
    16 
    16 
    37 abbreviation
    37 abbreviation
    38   normal_rel :: "['a set, ('a, 'b) monoid_scheme] \<Rightarrow> bool"  (infixl "\<lhd>" 60) where
    38   normal_rel :: "['a set, ('a, 'b) monoid_scheme] \<Rightarrow> bool"  (infixl "\<lhd>" 60) where
    39   "H \<lhd> G \<equiv> normal H G"
    39   "H \<lhd> G \<equiv> normal H G"
    40 
    40 
    41 
    41 
    42 subsection {*Basic Properties of Cosets*}
    42 subsection \<open>Basic Properties of Cosets\<close>
    43 
    43 
    44 lemma (in group) coset_mult_assoc:
    44 lemma (in group) coset_mult_assoc:
    45      "[| M \<subseteq> carrier G; g \<in> carrier G; h \<in> carrier G |]
    45      "[| M \<subseteq> carrier G; g \<in> carrier G; h \<in> carrier G |]
    46       ==> (M #> g) #> h = M #> (g \<otimes> h)"
    46       ==> (M #> g) #> h = M #> (g \<otimes> h)"
    47 by (force simp add: r_coset_def m_assoc)
    47 by (force simp add: r_coset_def m_assoc)
    83                    subgroup.subset [THEN subsetD]
    83                    subgroup.subset [THEN subsetD]
    84                    subgroup.m_closed solve_equation)
    84                    subgroup.m_closed solve_equation)
    85 
    85 
    86 lemma (in group) coset_join2:
    86 lemma (in group) coset_join2:
    87      "\<lbrakk>x \<in> carrier G;  subgroup H G;  x\<in>H\<rbrakk> \<Longrightarrow> H #> x = H"
    87      "\<lbrakk>x \<in> carrier G;  subgroup H G;  x\<in>H\<rbrakk> \<Longrightarrow> H #> x = H"
    88   --{*Alternative proof is to put @{term "x=\<one>"} in @{text repr_independence}.*}
    88   --\<open>Alternative proof is to put @{term "x=\<one>"} in @{text repr_independence}.\<close>
    89 by (force simp add: subgroup.m_closed r_coset_def solve_equation)
    89 by (force simp add: subgroup.m_closed r_coset_def solve_equation)
    90 
    90 
    91 lemma (in monoid) r_coset_subset_G:
    91 lemma (in monoid) r_coset_subset_G:
    92      "[| H \<subseteq> carrier G; x \<in> carrier G |] ==> H #> x \<subseteq> carrier G"
    92      "[| H \<subseteq> carrier G; x \<in> carrier G |] ==> H #> x \<subseteq> carrier G"
    93 by (auto simp add: r_coset_def)
    93 by (auto simp add: r_coset_def)
    98 
    98 
    99 lemma (in group) rcosetsI:
    99 lemma (in group) rcosetsI:
   100      "\<lbrakk>H \<subseteq> carrier G; x \<in> carrier G\<rbrakk> \<Longrightarrow> H #> x \<in> rcosets H"
   100      "\<lbrakk>H \<subseteq> carrier G; x \<in> carrier G\<rbrakk> \<Longrightarrow> H #> x \<in> rcosets H"
   101 by (auto simp add: RCOSETS_def)
   101 by (auto simp add: RCOSETS_def)
   102 
   102 
   103 text{*Really needed?*}
   103 text\<open>Really needed?\<close>
   104 lemma (in group) transpose_inv:
   104 lemma (in group) transpose_inv:
   105      "[| x \<otimes> y = z;  x \<in> carrier G;  y \<in> carrier G;  z \<in> carrier G |]
   105      "[| x \<otimes> y = z;  x \<in> carrier G;  y \<in> carrier G;  z \<in> carrier G |]
   106       ==> (inv x) \<otimes> z = y"
   106       ==> (inv x) \<otimes> z = y"
   107 by (force simp add: m_assoc [symmetric])
   107 by (force simp add: m_assoc [symmetric])
   108 
   108 
   110 apply (simp add: r_coset_def)
   110 apply (simp add: r_coset_def)
   111 apply (blast intro: sym l_one subgroup.subset [THEN subsetD]
   111 apply (blast intro: sym l_one subgroup.subset [THEN subsetD]
   112                     subgroup.one_closed)
   112                     subgroup.one_closed)
   113 done
   113 done
   114 
   114 
   115 text (in group) {* Opposite of @{thm [source] "repr_independence"} *}
   115 text (in group) \<open>Opposite of @{thm [source] "repr_independence"}\<close>
   116 lemma (in group) repr_independenceD:
   116 lemma (in group) repr_independenceD:
   117   assumes "subgroup H G"
   117   assumes "subgroup H G"
   118   assumes ycarr: "y \<in> carrier G"
   118   assumes ycarr: "y \<in> carrier G"
   119       and repr:  "H #> x = H #> y"
   119       and repr:  "H #> x = H #> y"
   120   shows "y \<in> H #> x"
   120   shows "y \<in> H #> x"
   125    apply (rule ycarr)
   125    apply (rule ycarr)
   126    apply (rule is_subgroup)
   126    apply (rule is_subgroup)
   127   done
   127   done
   128 qed
   128 qed
   129 
   129 
   130 text {* Elements of a right coset are in the carrier *}
   130 text \<open>Elements of a right coset are in the carrier\<close>
   131 lemma (in subgroup) elemrcos_carrier:
   131 lemma (in subgroup) elemrcos_carrier:
   132   assumes "group G"
   132   assumes "group G"
   133   assumes acarr: "a \<in> carrier G"
   133   assumes acarr: "a \<in> carrier G"
   134     and a': "a' \<in> H #> a"
   134     and a': "a' \<in> H #> a"
   135   shows "a' \<in> carrier G"
   135   shows "a' \<in> carrier G"
   169     from this and a
   169     from this and a
   170     show "\<exists>x\<in>H. h' = x \<otimes> h" by fast
   170     show "\<exists>x\<in>H. h' = x \<otimes> h" by fast
   171   qed
   171   qed
   172 qed
   172 qed
   173 
   173 
   174 text {* Step one for lemma @{text "rcos_module"} *}
   174 text \<open>Step one for lemma @{text "rcos_module"}\<close>
   175 lemma (in subgroup) rcos_module_imp:
   175 lemma (in subgroup) rcos_module_imp:
   176   assumes "group G"
   176   assumes "group G"
   177   assumes xcarr: "x \<in> carrier G"
   177   assumes xcarr: "x \<in> carrier G"
   178       and x'cos: "x' \<in> H #> x"
   178       and x'cos: "x' \<in> H #> x"
   179   shows "(x' \<otimes> inv x) \<in> H"
   179   shows "(x' \<otimes> inv x) \<in> H"
   209       have "x' \<otimes> (inv x) = h" by simp
   209       have "x' \<otimes> (inv x) = h" by simp
   210   from hH this
   210   from hH this
   211       show "x' \<otimes> (inv x) \<in> H" by simp
   211       show "x' \<otimes> (inv x) \<in> H" by simp
   212 qed
   212 qed
   213 
   213 
   214 text {* Step two for lemma @{text "rcos_module"} *}
   214 text \<open>Step two for lemma @{text "rcos_module"}\<close>
   215 lemma (in subgroup) rcos_module_rev:
   215 lemma (in subgroup) rcos_module_rev:
   216   assumes "group G"
   216   assumes "group G"
   217   assumes carr: "x \<in> carrier G" "x' \<in> carrier G"
   217   assumes carr: "x \<in> carrier G" "x' \<in> carrier G"
   218       and xixH: "(x' \<otimes> inv x) \<in> H"
   218       and xixH: "(x' \<otimes> inv x) \<in> H"
   219   shows "x' \<in> H #> x"
   219   shows "x' \<in> H #> x"
   241       show "x' \<in> H #> x"
   241       show "x' \<in> H #> x"
   242       unfolding r_coset_def
   242       unfolding r_coset_def
   243       by fast
   243       by fast
   244 qed
   244 qed
   245 
   245 
   246 text {* Module property of right cosets *}
   246 text \<open>Module property of right cosets\<close>
   247 lemma (in subgroup) rcos_module:
   247 lemma (in subgroup) rcos_module:
   248   assumes "group G"
   248   assumes "group G"
   249   assumes carr: "x \<in> carrier G" "x' \<in> carrier G"
   249   assumes carr: "x \<in> carrier G" "x' \<in> carrier G"
   250   shows "(x' \<in> H #> x) = (x' \<otimes> inv x \<in> H)"
   250   shows "(x' \<in> H #> x) = (x' \<otimes> inv x \<in> H)"
   251 proof -
   251 proof -
   260     show "x' \<in> H #> x"
   260     show "x' \<in> H #> x"
   261       by (intro rcos_module_rev[OF is_group])
   261       by (intro rcos_module_rev[OF is_group])
   262   qed
   262   qed
   263 qed
   263 qed
   264 
   264 
   265 text {* Right cosets are subsets of the carrier. *} 
   265 text \<open>Right cosets are subsets of the carrier.\<close> 
   266 lemma (in subgroup) rcosets_carrier:
   266 lemma (in subgroup) rcosets_carrier:
   267   assumes "group G"
   267   assumes "group G"
   268   assumes XH: "X \<in> rcosets H"
   268   assumes XH: "X \<in> rcosets H"
   269   shows "X \<subseteq> carrier G"
   269   shows "X \<subseteq> carrier G"
   270 proof -
   270 proof -
   281       show "X \<subseteq> carrier G"
   281       show "X \<subseteq> carrier G"
   282       unfolding X
   282       unfolding X
   283       by (rule r_coset_subset_G)
   283       by (rule r_coset_subset_G)
   284 qed
   284 qed
   285 
   285 
   286 text {* Multiplication of general subsets *}
   286 text \<open>Multiplication of general subsets\<close>
   287 lemma (in monoid) set_mult_closed:
   287 lemma (in monoid) set_mult_closed:
   288   assumes Acarr: "A \<subseteq> carrier G"
   288   assumes Acarr: "A \<subseteq> carrier G"
   289       and Bcarr: "B \<subseteq> carrier G"
   289       and Bcarr: "B \<subseteq> carrier G"
   290   shows "A <#> B \<subseteq> carrier G"
   290   shows "A <#> B \<subseteq> carrier G"
   291 apply rule apply (simp add: set_mult_def, clarsimp)
   291 apply rule apply (simp add: set_mult_def, clarsimp)
   379       unfolding l_coset_def
   379       unfolding l_coset_def
   380       by fast
   380       by fast
   381 qed
   381 qed
   382 
   382 
   383 
   383 
   384 subsection {* Normal subgroups *}
   384 subsection \<open>Normal subgroups\<close>
   385 
   385 
   386 lemma normal_imp_subgroup: "H \<lhd> G \<Longrightarrow> subgroup H G"
   386 lemma normal_imp_subgroup: "H \<lhd> G \<Longrightarrow> subgroup H G"
   387   by (simp add: normal_def subgroup_def)
   387   by (simp add: normal_def subgroup_def)
   388 
   388 
   389 lemma (in group) normalI: 
   389 lemma (in group) normalI: 
   405 apply (subgoal_tac "inv (inv x) \<otimes> h \<otimes> (inv x) \<in> H") 
   405 apply (subgoal_tac "inv (inv x) \<otimes> h \<otimes> (inv x) \<in> H") 
   406 apply (simp add: ) 
   406 apply (simp add: ) 
   407 apply (blast intro: inv_op_closed1) 
   407 apply (blast intro: inv_op_closed1) 
   408 done
   408 done
   409 
   409 
   410 text{*Alternative characterization of normal subgroups*}
   410 text\<open>Alternative characterization of normal subgroups\<close>
   411 lemma (in group) normal_inv_iff:
   411 lemma (in group) normal_inv_iff:
   412      "(N \<lhd> G) = 
   412      "(N \<lhd> G) = 
   413       (subgroup N G & (\<forall>x \<in> carrier G. \<forall>h \<in> N. x \<otimes> h \<otimes> (inv x) \<in> N))"
   413       (subgroup N G & (\<forall>x \<in> carrier G. \<forall>h \<in> N. x \<otimes> h \<otimes> (inv x) \<in> N))"
   414       (is "_ = ?rhs")
   414       (is "_ = ?rhs")
   415 proof
   415 proof
   454     qed
   454     qed
   455   qed
   455   qed
   456 qed
   456 qed
   457 
   457 
   458 
   458 
   459 subsection{*More Properties of Cosets*}
   459 subsection\<open>More Properties of Cosets\<close>
   460 
   460 
   461 lemma (in group) lcos_m_assoc:
   461 lemma (in group) lcos_m_assoc:
   462      "[| M \<subseteq> carrier G; g \<in> carrier G; h \<in> carrier G |]
   462      "[| M \<subseteq> carrier G; g \<in> carrier G; h \<in> carrier G |]
   463       ==> g <# (h <# M) = (g \<otimes> h) <# M"
   463       ==> g <# (h <# M) = (g \<otimes> h) <# M"
   464 by (force simp add: l_coset_def m_assoc)
   464 by (force simp add: l_coset_def m_assoc)
   522 apply (rule bexI [of _ "\<one>"])
   522 apply (rule bexI [of _ "\<one>"])
   523 apply (auto simp add: subgroup.one_closed subgroup.subset [THEN subsetD])
   523 apply (auto simp add: subgroup.one_closed subgroup.subset [THEN subsetD])
   524 done
   524 done
   525 
   525 
   526 
   526 
   527 subsubsection {* Set of Inverses of an @{text r_coset}. *}
   527 subsubsection \<open>Set of Inverses of an @{text r_coset}.\<close>
   528 
   528 
   529 lemma (in normal) rcos_inv:
   529 lemma (in normal) rcos_inv:
   530   assumes x:     "x \<in> carrier G"
   530   assumes x:     "x \<in> carrier G"
   531   shows "set_inv (H #> x) = H #> (inv x)" 
   531   shows "set_inv (H #> x) = H #> (inv x)" 
   532 proof (simp add: r_coset_def SET_INV_def x inv_mult_group, safe)
   532 proof (simp add: r_coset_def SET_INV_def x inv_mult_group, safe)
   547       by (simp add: h x m_assoc [symmetric] inv_mult_group)
   547       by (simp add: h x m_assoc [symmetric] inv_mult_group)
   548   qed
   548   qed
   549 qed
   549 qed
   550 
   550 
   551 
   551 
   552 subsubsection {*Theorems for @{text "<#>"} with @{text "#>"} or @{text "<#"}.*}
   552 subsubsection \<open>Theorems for @{text "<#>"} with @{text "#>"} or @{text "<#"}.\<close>
   553 
   553 
   554 lemma (in group) setmult_rcos_assoc:
   554 lemma (in group) setmult_rcos_assoc:
   555      "\<lbrakk>H \<subseteq> carrier G; K \<subseteq> carrier G; x \<in> carrier G\<rbrakk>
   555      "\<lbrakk>H \<subseteq> carrier G; K \<subseteq> carrier G; x \<in> carrier G\<rbrakk>
   556       \<Longrightarrow> H <#> (K #> x) = (H <#> K) #> x"
   556       \<Longrightarrow> H <#> (K #> x) = (H <#> K) #> x"
   557 by (force simp add: r_coset_def set_mult_def m_assoc)
   557 by (force simp add: r_coset_def set_mult_def m_assoc)
   582      "\<lbrakk>x \<in> carrier G; y \<in> carrier G\<rbrakk>
   582      "\<lbrakk>x \<in> carrier G; y \<in> carrier G\<rbrakk>
   583       \<Longrightarrow> (H #> x) <#> (H #> y) = H #> (x \<otimes> y)"
   583       \<Longrightarrow> (H #> x) <#> (H #> y) = H #> (x \<otimes> y)"
   584 by (simp add: rcos_mult_step1 rcos_mult_step2 rcos_mult_step3)
   584 by (simp add: rcos_mult_step1 rcos_mult_step2 rcos_mult_step3)
   585 
   585 
   586 lemma (in normal) rcosets_mult_eq: "M \<in> rcosets H \<Longrightarrow> H <#> M = M"
   586 lemma (in normal) rcosets_mult_eq: "M \<in> rcosets H \<Longrightarrow> H <#> M = M"
   587   -- {* generalizes @{text subgroup_mult_id} *}
   587   -- \<open>generalizes @{text subgroup_mult_id}\<close>
   588   by (auto simp add: RCOSETS_def subset
   588   by (auto simp add: RCOSETS_def subset
   589         setmult_rcos_assoc subgroup_mult_id normal.axioms normal_axioms)
   589         setmult_rcos_assoc subgroup_mult_id normal.axioms normal_axioms)
   590 
   590 
   591 
   591 
   592 subsubsection{*An Equivalence Relation*}
   592 subsubsection\<open>An Equivalence Relation\<close>
   593 
   593 
   594 definition
   594 definition
   595   r_congruent :: "[('a,'b)monoid_scheme, 'a set] \<Rightarrow> ('a*'a)set"  ("rcong\<index> _")
   595   r_congruent :: "[('a,'b)monoid_scheme, 'a set] \<Rightarrow> ('a*'a)set"  ("rcong\<index> _")
   596   where "rcong\<^bsub>G\<^esub> H = {(x,y). x \<in> carrier G & y \<in> carrier G & inv\<^bsub>G\<^esub> x \<otimes>\<^bsub>G\<^esub> y \<in> H}"
   596   where "rcong\<^bsub>G\<^esub> H = {(x,y). x \<in> carrier G & y \<in> carrier G & inv\<^bsub>G\<^esub> x \<otimes>\<^bsub>G\<^esub> y \<in> H}"
   597 
   597 
   626       thus "inv x \<otimes> z \<in> H" by simp
   626       thus "inv x \<otimes> z \<in> H" by simp
   627     qed
   627     qed
   628   qed
   628   qed
   629 qed
   629 qed
   630 
   630 
   631 text{*Equivalence classes of @{text rcong} correspond to left cosets.
   631 text\<open>Equivalence classes of @{text rcong} correspond to left cosets.
   632   Was there a mistake in the definitions? I'd have expected them to
   632   Was there a mistake in the definitions? I'd have expected them to
   633   correspond to right cosets.*}
   633   correspond to right cosets.\<close>
   634 
   634 
   635 (* CB: This is correct, but subtle.
   635 (* CB: This is correct, but subtle.
   636    We call H #> a the right coset of a relative to H.  According to
   636    We call H #> a the right coset of a relative to H.  According to
   637    Jacobson, this is what the majority of group theory literature does.
   637    Jacobson, this is what the majority of group theory literature does.
   638    He then defines the notion of congruence relation ~ over monoids as
   638    He then defines the notion of congruence relation ~ over monoids as
   650   interpret group G by fact
   650   interpret group G by fact
   651   show ?thesis by (force simp add: r_congruent_def l_coset_def m_assoc [symmetric] a ) 
   651   show ?thesis by (force simp add: r_congruent_def l_coset_def m_assoc [symmetric] a ) 
   652 qed
   652 qed
   653 
   653 
   654 
   654 
   655 subsubsection{*Two Distinct Right Cosets are Disjoint*}
   655 subsubsection\<open>Two Distinct Right Cosets are Disjoint\<close>
   656 
   656 
   657 lemma (in group) rcos_equation:
   657 lemma (in group) rcos_equation:
   658   assumes "subgroup H G"
   658   assumes "subgroup H G"
   659   assumes p: "ha \<otimes> a = h \<otimes> b" "a \<in> carrier G" "b \<in> carrier G" "h \<in> H" "ha \<in> H" "hb \<in> H"
   659   assumes p: "ha \<otimes> a = h \<otimes> b" "a \<in> carrier G" "b \<in> carrier G" "h \<in> H" "ha \<in> H" "hb \<in> H"
   660   shows "hb \<otimes> a \<in> (\<Union>h\<in>H. {h \<otimes> b})"
   660   shows "hb \<otimes> a \<in> (\<Union>h\<in>H. {h \<otimes> b})"
   677     apply (blast intro: rcos_equation assms sym)
   677     apply (blast intro: rcos_equation assms sym)
   678     done
   678     done
   679 qed
   679 qed
   680 
   680 
   681 
   681 
   682 subsection {* Further lemmas for @{text "r_congruent"} *}
   682 subsection \<open>Further lemmas for @{text "r_congruent"}\<close>
   683 
   683 
   684 text {* The relation is a congruence *}
   684 text \<open>The relation is a congruence\<close>
   685 
   685 
   686 lemma (in normal) congruent_rcong:
   686 lemma (in normal) congruent_rcong:
   687   shows "congruent2 (rcong H) (rcong H) (\<lambda>a b. a \<otimes> b <# H)"
   687   shows "congruent2 (rcong H) (rcong H) (\<lambda>a b. a \<otimes> b <# H)"
   688 proof (intro congruent2I[of "carrier G" _ "carrier G" _] equiv_rcong is_group)
   688 proof (intro congruent2I[of "carrier G" _ "carrier G" _] equiv_rcong is_group)
   689   fix a b c
   689   fix a b c
   751   from carr and this and is_subgroup
   751   from carr and this and is_subgroup
   752      show "(c \<otimes> a) <# H = (c \<otimes> b) <# H" by (intro l_repr_independence, simp+)
   752      show "(c \<otimes> a) <# H = (c \<otimes> b) <# H" by (intro l_repr_independence, simp+)
   753 qed
   753 qed
   754 
   754 
   755 
   755 
   756 subsection {*Order of a Group and Lagrange's Theorem*}
   756 subsection \<open>Order of a Group and Lagrange's Theorem\<close>
   757 
   757 
   758 definition
   758 definition
   759   order :: "('a, 'b) monoid_scheme \<Rightarrow> nat"
   759   order :: "('a, 'b) monoid_scheme \<Rightarrow> nat"
   760   where "order S = card (carrier S)"
   760   where "order S = card (carrier S)"
   761 
   761 
   775      "\<lbrakk>c \<in> rcosets H;  H \<subseteq> carrier G;  finite (carrier G)\<rbrakk> \<Longrightarrow> finite c"
   775      "\<lbrakk>c \<in> rcosets H;  H \<subseteq> carrier G;  finite (carrier G)\<rbrakk> \<Longrightarrow> finite c"
   776 apply (auto simp add: RCOSETS_def)
   776 apply (auto simp add: RCOSETS_def)
   777 apply (simp add: r_coset_subset_G [THEN finite_subset])
   777 apply (simp add: r_coset_subset_G [THEN finite_subset])
   778 done
   778 done
   779 
   779 
   780 text{*The next two lemmas support the proof of @{text card_cosets_equal}.*}
   780 text\<open>The next two lemmas support the proof of @{text card_cosets_equal}.\<close>
   781 lemma (in group) inj_on_f:
   781 lemma (in group) inj_on_f:
   782     "\<lbrakk>H \<subseteq> carrier G;  a \<in> carrier G\<rbrakk> \<Longrightarrow> inj_on (\<lambda>y. y \<otimes> inv a) (H #> a)"
   782     "\<lbrakk>H \<subseteq> carrier G;  a \<in> carrier G\<rbrakk> \<Longrightarrow> inj_on (\<lambda>y. y \<otimes> inv a) (H #> a)"
   783 apply (rule inj_onI)
   783 apply (rule inj_onI)
   784 apply (subgoal_tac "x \<in> carrier G & y \<in> carrier G")
   784 apply (subgoal_tac "x \<in> carrier G & y \<in> carrier G")
   785  prefer 2 apply (blast intro: r_coset_subset_G [THEN subsetD])
   785  prefer 2 apply (blast intro: r_coset_subset_G [THEN subsetD])
   797 apply (rule card_bij_eq)
   797 apply (rule card_bij_eq)
   798      apply (rule inj_on_f, assumption+)
   798      apply (rule inj_on_f, assumption+)
   799     apply (force simp add: m_assoc subsetD r_coset_def)
   799     apply (force simp add: m_assoc subsetD r_coset_def)
   800    apply (rule inj_on_g, assumption+)
   800    apply (rule inj_on_g, assumption+)
   801   apply (force simp add: m_assoc subsetD r_coset_def)
   801   apply (force simp add: m_assoc subsetD r_coset_def)
   802  txt{*The sets @{term "H #> a"} and @{term "H"} are finite.*}
   802  txt\<open>The sets @{term "H #> a"} and @{term "H"} are finite.\<close>
   803  apply (simp add: r_coset_subset_G [THEN finite_subset])
   803  apply (simp add: r_coset_subset_G [THEN finite_subset])
   804 apply (blast intro: finite_subset)
   804 apply (blast intro: finite_subset)
   805 done
   805 done
   806 
   806 
   807 lemma (in group) rcosets_subset_PowG:
   807 lemma (in group) rcosets_subset_PowG:
   822  apply (simp add: card_cosets_equal subgroup.subset)
   822  apply (simp add: card_cosets_equal subgroup.subset)
   823 apply (simp add: rcos_disjoint)
   823 apply (simp add: rcos_disjoint)
   824 done
   824 done
   825 
   825 
   826 
   826 
   827 subsection {*Quotient Groups: Factorization of a Group*}
   827 subsection \<open>Quotient Groups: Factorization of a Group\<close>
   828 
   828 
   829 definition
   829 definition
   830   FactGroup :: "[('a,'b) monoid_scheme, 'a set] \<Rightarrow> ('a set) monoid" (infixl "Mod" 65)
   830   FactGroup :: "[('a,'b) monoid_scheme, 'a set] \<Rightarrow> ('a set) monoid" (infixl "Mod" 65)
   831     --{*Actually defined for groups rather than monoids*}
   831     --\<open>Actually defined for groups rather than monoids\<close>
   832    where "FactGroup G H = \<lparr>carrier = rcosets\<^bsub>G\<^esub> H, mult = set_mult G, one = H\<rparr>"
   832    where "FactGroup G H = \<lparr>carrier = rcosets\<^bsub>G\<^esub> H, mult = set_mult G, one = H\<rparr>"
   833 
   833 
   834 lemma (in normal) setmult_closed:
   834 lemma (in normal) setmult_closed:
   835      "\<lbrakk>K1 \<in> rcosets H; K2 \<in> rcosets H\<rbrakk> \<Longrightarrow> K1 <#> K2 \<in> rcosets H"
   835      "\<lbrakk>K1 \<in> rcosets H; K2 \<in> rcosets H\<rbrakk> \<Longrightarrow> K1 <#> K2 \<in> rcosets H"
   836 by (auto simp add: rcos_sum RCOSETS_def)
   836 by (auto simp add: rcos_sum RCOSETS_def)
   878      "X \<in> carrier (G Mod H) \<Longrightarrow> inv\<^bsub>G Mod H\<^esub> X = set_inv X"
   878      "X \<in> carrier (G Mod H) \<Longrightarrow> inv\<^bsub>G Mod H\<^esub> X = set_inv X"
   879 apply (rule group.inv_equality [OF factorgroup_is_group]) 
   879 apply (rule group.inv_equality [OF factorgroup_is_group]) 
   880 apply (simp_all add: FactGroup_def setinv_closed rcosets_inv_mult_group_eq)
   880 apply (simp_all add: FactGroup_def setinv_closed rcosets_inv_mult_group_eq)
   881 done
   881 done
   882 
   882 
   883 text{*The coset map is a homomorphism from @{term G} to the quotient group
   883 text\<open>The coset map is a homomorphism from @{term G} to the quotient group
   884   @{term "G Mod H"}*}
   884   @{term "G Mod H"}\<close>
   885 lemma (in normal) r_coset_hom_Mod:
   885 lemma (in normal) r_coset_hom_Mod:
   886   "(\<lambda>a. H #> a) \<in> hom G (G Mod H)"
   886   "(\<lambda>a. H #> a) \<in> hom G (G Mod H)"
   887   by (auto simp add: FactGroup_def RCOSETS_def Pi_def hom_def rcos_sum)
   887   by (auto simp add: FactGroup_def RCOSETS_def Pi_def hom_def rcos_sum)
   888 
   888 
   889  
   889  
   890 subsection{*The First Isomorphism Theorem*}
   890 subsection\<open>The First Isomorphism Theorem\<close>
   891 
   891 
   892 text{*The quotient by the kernel of a homomorphism is isomorphic to the 
   892 text\<open>The quotient by the kernel of a homomorphism is isomorphic to the 
   893   range of that homomorphism.*}
   893   range of that homomorphism.\<close>
   894 
   894 
   895 definition
   895 definition
   896   kernel :: "('a, 'm) monoid_scheme \<Rightarrow> ('b, 'n) monoid_scheme \<Rightarrow>  ('a \<Rightarrow> 'b) \<Rightarrow> 'a set"
   896   kernel :: "('a, 'm) monoid_scheme \<Rightarrow> ('b, 'n) monoid_scheme \<Rightarrow>  ('a \<Rightarrow> 'b) \<Rightarrow> 'a set"
   897     --{*the kernel of a homomorphism*}
   897     --\<open>the kernel of a homomorphism\<close>
   898   where "kernel G H h = {x. x \<in> carrier G & h x = \<one>\<^bsub>H\<^esub>}"
   898   where "kernel G H h = {x. x \<in> carrier G & h x = \<one>\<^bsub>H\<^esub>}"
   899 
   899 
   900 lemma (in group_hom) subgroup_kernel: "subgroup (kernel G H h) G"
   900 lemma (in group_hom) subgroup_kernel: "subgroup (kernel G H h) G"
   901 apply (rule subgroup.intro) 
   901 apply (rule subgroup.intro) 
   902 apply (auto simp add: kernel_def group.intro is_group) 
   902 apply (auto simp add: kernel_def group.intro is_group) 
   903 done
   903 done
   904 
   904 
   905 text{*The kernel of a homomorphism is a normal subgroup*}
   905 text\<open>The kernel of a homomorphism is a normal subgroup\<close>
   906 lemma (in group_hom) normal_kernel: "(kernel G H h) \<lhd> G"
   906 lemma (in group_hom) normal_kernel: "(kernel G H h) \<lhd> G"
   907 apply (simp add: G.normal_inv_iff subgroup_kernel)
   907 apply (simp add: G.normal_inv_iff subgroup_kernel)
   908 apply (simp add: kernel_def)
   908 apply (simp add: kernel_def)
   909 done
   909 done
   910 
   910 
   955   thus "the_elem (h ` (X <#> X')) = the_elem (h ` X) \<otimes>\<^bsub>H\<^esub> the_elem (h ` X')"
   955   thus "the_elem (h ` (X <#> X')) = the_elem (h ` X) \<otimes>\<^bsub>H\<^esub> the_elem (h ` X')"
   956     by (simp add: all image_eq_UN FactGroup_nonempty X X')
   956     by (simp add: all image_eq_UN FactGroup_nonempty X X')
   957 qed
   957 qed
   958 
   958 
   959 
   959 
   960 text{*Lemma for the following injectivity result*}
   960 text\<open>Lemma for the following injectivity result\<close>
   961 lemma (in group_hom) FactGroup_subset:
   961 lemma (in group_hom) FactGroup_subset:
   962      "\<lbrakk>g \<in> carrier G; g' \<in> carrier G; h g = h g'\<rbrakk>
   962      "\<lbrakk>g \<in> carrier G; g' \<in> carrier G; h g = h g'\<rbrakk>
   963       \<Longrightarrow>  kernel G H h #> g \<subseteq> kernel G H h #> g'"
   963       \<Longrightarrow>  kernel G H h #> g \<subseteq> kernel G H h #> g'"
   964 apply (clarsimp simp add: kernel_def r_coset_def image_def)
   964 apply (clarsimp simp add: kernel_def r_coset_def image_def)
   965 apply (rename_tac y)  
   965 apply (rename_tac y)  
   984   hence h: "h g = h g'"
   984   hence h: "h g = h g'"
   985     by (simp add: image_eq_UN all FactGroup_nonempty X X') 
   985     by (simp add: image_eq_UN all FactGroup_nonempty X X') 
   986   show "X=X'" by (rule equalityI) (simp_all add: FactGroup_subset h gX) 
   986   show "X=X'" by (rule equalityI) (simp_all add: FactGroup_subset h gX) 
   987 qed
   987 qed
   988 
   988 
   989 text{*If the homomorphism @{term h} is onto @{term H}, then so is the
   989 text\<open>If the homomorphism @{term h} is onto @{term H}, then so is the
   990 homomorphism from the quotient group*}
   990 homomorphism from the quotient group\<close>
   991 lemma (in group_hom) FactGroup_onto:
   991 lemma (in group_hom) FactGroup_onto:
   992   assumes h: "h ` carrier G = carrier H"
   992   assumes h: "h ` carrier G = carrier H"
   993   shows "(\<lambda>X. the_elem (h ` X)) ` carrier (G Mod kernel G H h) = carrier H"
   993   shows "(\<lambda>X. the_elem (h ` X)) ` carrier (G Mod kernel G H h) = carrier H"
   994 proof
   994 proof
   995   show "(\<lambda>X. the_elem (h ` X)) ` carrier (G Mod kernel G H h) \<subseteq> carrier H"
   995   show "(\<lambda>X. the_elem (h ` X)) ` carrier (G Mod kernel G H h) \<subseteq> carrier H"
  1006       by (auto intro!: bexI simp add: FactGroup_def RCOSETS_def image_eq_UN)
  1006       by (auto intro!: bexI simp add: FactGroup_def RCOSETS_def image_eq_UN)
  1007   qed
  1007   qed
  1008 qed
  1008 qed
  1009 
  1009 
  1010 
  1010 
  1011 text{*If @{term h} is a homomorphism from @{term G} onto @{term H}, then the
  1011 text\<open>If @{term h} is a homomorphism from @{term G} onto @{term H}, then the
  1012  quotient group @{term "G Mod (kernel G H h)"} is isomorphic to @{term H}.*}
  1012  quotient group @{term "G Mod (kernel G H h)"} is isomorphic to @{term H}.\<close>
  1013 theorem (in group_hom) FactGroup_iso:
  1013 theorem (in group_hom) FactGroup_iso:
  1014   "h ` carrier G = carrier H
  1014   "h ` carrier G = carrier H
  1015    \<Longrightarrow> (\<lambda>X. the_elem (h`X)) \<in> (G Mod (kernel G H h)) \<cong> H"
  1015    \<Longrightarrow> (\<lambda>X. the_elem (h`X)) \<in> (G Mod (kernel G H h)) \<cong> H"
  1016 by (simp add: iso_def FactGroup_hom FactGroup_inj_on bij_betw_def 
  1016 by (simp add: iso_def FactGroup_hom FactGroup_inj_on bij_betw_def 
  1017               FactGroup_onto) 
  1017               FactGroup_onto)