src/HOL/Algebra/Coset.thy
changeset 77406 c2013f617a70
parent 77362 1a6103f6ab0b
child 77407 02af8a1b97f6
equal deleted inserted replaced
77389:aac23f2e7f3c 77406:c2013f617a70
    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 lemma (in comm_group) subgroup_imp_normal: "subgroup A G \<Longrightarrow> A \<lhd> G"
    41 lemma (in comm_group) subgroup_imp_normal: "subgroup A G \<Longrightarrow> A \<lhd> G"
    42   by (simp add: normal_def normal_axioms_def is_group l_coset_def r_coset_def m_comm subgroup.mem_carrier)
    42   by (simp add: normal_def normal_axioms_def l_coset_def r_coset_def m_comm subgroup.mem_carrier)
    43 
    43 
    44 lemma l_coset_eq_set_mult: \<^marker>\<open>contributor \<open>Martin Baillon\<close>\<close>
    44 lemma l_coset_eq_set_mult: \<^marker>\<open>contributor \<open>Martin Baillon\<close>\<close>
    45   fixes G (structure)
    45   fixes G (structure)
    46   shows "x <# H = {x} <#> H"
    46   shows "x <# H = {x} <#> H"
    47   unfolding l_coset_def set_mult_def by simp
    47   unfolding l_coset_def set_mult_def by simp
   466   assumes "N \<lhd> G"
   466   assumes "N \<lhd> G"
   467   shows "subgroup N G" and "\<And>x h. \<lbrakk> x \<in> carrier G; h \<in> N \<rbrakk> \<Longrightarrow> x \<otimes> h \<otimes> inv x \<in> N"
   467   shows "subgroup N G" and "\<And>x h. \<lbrakk> x \<in> carrier G; h \<in> N \<rbrakk> \<Longrightarrow> x \<otimes> h \<otimes> inv x \<in> N"
   468   using assms normal_inv_iff apply blast
   468   using assms normal_inv_iff apply blast
   469   by (simp add: assms normal.inv_op_closed2)
   469   by (simp add: assms normal.inv_op_closed2)
   470 
   470 
   471 
       
   472 lemma (in group) one_is_normal: "{\<one>} \<lhd> G"
   471 lemma (in group) one_is_normal: "{\<one>} \<lhd> G"
   473 proof(intro normal_invI)
   472   using normal_invI triv_subgroup by force
   474   show "subgroup {\<one>} G"
   473 
   475     by (simp add: subgroup_def)
   474 text \<open>The intersection of two normal subgroups is, again, a normal subgroup.\<close>
   476 qed simp
   475 lemma (in group) normal_subgroup_intersect:
   477 
   476   assumes "M \<lhd> G" and "N \<lhd> G" shows "M \<inter> N \<lhd> G"
       
   477   using  assms normal_inv_iff subgroups_Inter_pair by force
       
   478 
       
   479 
       
   480 text \<open>Being a normal subgroup is preserved by surjective homomorphisms.\<close>
       
   481 
       
   482 lemma (in normal) surj_hom_normal_subgroup:
       
   483   assumes \<phi>: "group_hom G F \<phi>"
       
   484   assumes \<phi>surj: "\<phi> ` (carrier G) = carrier F"
       
   485   shows "(\<phi> ` H) \<lhd> F"
       
   486 proof (rule group.normalI)
       
   487   show "group F"
       
   488     using \<phi> group_hom.axioms(2) by blast
       
   489 next
       
   490   show "subgroup (\<phi> ` H) F"
       
   491     using \<phi> group_hom.subgroup_img_is_subgroup subgroup_axioms by blast
       
   492 next
       
   493   show "\<forall>x\<in>carrier F. \<phi> ` H #>\<^bsub>F\<^esub> x = x <#\<^bsub>F\<^esub> \<phi> ` H"
       
   494   proof
       
   495     fix f
       
   496     assume f: "f \<in> carrier F"
       
   497     with \<phi>surj obtain g where g: "g \<in> carrier G" "f = \<phi> g" by auto
       
   498     hence "\<phi> ` H #>\<^bsub>F\<^esub> f = \<phi> ` H #>\<^bsub>F\<^esub> \<phi> g" by simp
       
   499     also have "... = (\<lambda>x. (\<phi> x) \<otimes>\<^bsub>F\<^esub> (\<phi> g)) ` H" 
       
   500       unfolding r_coset_def image_def by auto
       
   501     also have "... = (\<lambda>x. \<phi> (x \<otimes> g)) ` H" 
       
   502       using subset g \<phi> group_hom.hom_mult unfolding image_def by fastforce
       
   503     also have "... = \<phi> ` (H #> g)" 
       
   504       using \<phi> unfolding r_coset_def by auto
       
   505     also have "... = \<phi> ` (g <# H)" 
       
   506       by (metis coset_eq g(1))
       
   507     also have "... = (\<lambda>x. \<phi> (g \<otimes> x)) ` H" 
       
   508       using \<phi> unfolding l_coset_def by auto
       
   509     also have "... = (\<lambda>x. (\<phi> g) \<otimes>\<^bsub>F\<^esub> (\<phi> x)) ` H" 
       
   510       using subset g \<phi> group_hom.hom_mult by fastforce
       
   511     also have "... = \<phi> g <#\<^bsub>F\<^esub> \<phi> ` H" 
       
   512       unfolding l_coset_def image_def by auto
       
   513     also have "... = f <#\<^bsub>F\<^esub> \<phi> ` H" 
       
   514       using g by simp
       
   515     finally show "\<phi> ` H #>\<^bsub>F\<^esub> f = f <#\<^bsub>F\<^esub> \<phi> ` H".
       
   516   qed
       
   517 qed
       
   518 
       
   519 text \<open>Being a normal subgroup is preserved by group isomorphisms.\<close>
       
   520 lemma iso_normal_subgroup:
       
   521   assumes \<phi>: "\<phi> \<in> iso G F" "group G" "group F" "H \<lhd> G"
       
   522   shows "(\<phi> ` H) \<lhd> F"
       
   523   by (meson assms Group.iso_iff group_hom_axioms_def group_hom_def normal.surj_hom_normal_subgroup)
       
   524 
       
   525 text \<open>The set product of two normal subgroups is a normal subgroup.\<close>
       
   526 lemma (in group) setmult_lcos_assoc:
       
   527   "\<lbrakk>H \<subseteq> carrier G; K \<subseteq> carrier G; x \<in> carrier G\<rbrakk>
       
   528       \<Longrightarrow> (x <# H) <#> K = x <# (H <#> K)"
       
   529   by (force simp add: l_coset_def set_mult_def m_assoc)
   478 
   530 
   479 subsection\<open>More Properties of Left Cosets\<close>
   531 subsection\<open>More Properties of Left Cosets\<close>
   480 
   532 
   481 lemma (in group) l_repr_independence:
   533 lemma (in group) l_repr_independence:
   482   assumes "y \<in> x <# H" "x \<in> carrier G" and HG: "subgroup H G"
   534   assumes "y \<in> x <# H" "x \<in> carrier G" and HG: "subgroup H G"
   768 
   820 
   769 definition
   821 definition
   770   order :: "('a, 'b) monoid_scheme \<Rightarrow> nat"
   822   order :: "('a, 'b) monoid_scheme \<Rightarrow> nat"
   771   where "order S = card (carrier S)"
   823   where "order S = card (carrier S)"
   772 
   824 
       
   825 lemma iso_same_order:
       
   826   assumes "\<phi> \<in> iso G H"
       
   827   shows "order G = order H"
       
   828   by (metis assms is_isoI iso_same_card order_def order_def)
       
   829 
   773 lemma (in monoid) order_gt_0_iff_finite: "0 < order G \<longleftrightarrow> finite (carrier G)"
   830 lemma (in monoid) order_gt_0_iff_finite: "0 < order G \<longleftrightarrow> finite (carrier G)"
   774 by(auto simp add: order_def card_gt_0_iff)
   831   by(auto simp add: order_def card_gt_0_iff)
       
   832 
       
   833 lemma (in group) order_one_triv_iff:
       
   834   shows "(order G = 1) = (carrier G = {\<one>})"
       
   835   by (metis One_nat_def card.empty card_Suc_eq empty_iff one_closed order_def singleton_iff)
   775 
   836 
   776 lemma (in group) rcosets_part_G:
   837 lemma (in group) rcosets_part_G:
   777   assumes "subgroup H G"
   838   assumes "subgroup H G"
   778   shows "\<Union>(rcosets H) = carrier G"
   839   shows "\<Union>(rcosets H) = carrier G"
   779 proof -
   840 proof -
   887     qed
   948     qed
   888     thus ?thesis using \<open>infinite (carrier G)\<close> by (simp add: order_def)
   949     thus ?thesis using \<open>infinite (carrier G)\<close> by (simp add: order_def)
   889   qed
   950   qed
   890 qed
   951 qed
   891 
   952 
       
   953 text \<open>The cardinality of the right cosets of the trivial subgroup is the cardinality of the group itself:\<close>
       
   954 corollary (in group) card_rcosets_triv:
       
   955   assumes "finite (carrier G)"
       
   956   shows "card (rcosets {\<one>}) = order G"
       
   957   using lagrange triv_subgroup by fastforce
   892 
   958 
   893 subsection \<open>Quotient Groups: Factorization of a Group\<close>
   959 subsection \<open>Quotient Groups: Factorization of a Group\<close>
   894 
   960 
   895 definition
   961 definition
   896   FactGroup :: "[('a,'b) monoid_scheme, 'a set] \<Rightarrow> ('a set) monoid" (infixl "Mod" 65)
   962   FactGroup :: "[('a,'b) monoid_scheme, 'a set] \<Rightarrow> ('a set) monoid" (infixl "Mod" 65)
  1521         DirProd_group[OF normal.factorgroup_is_group normal.factorgroup_is_group]
  1587         DirProd_group[OF normal.factorgroup_is_group normal.factorgroup_is_group]
  1522   by blast
  1588   by blast
  1523 
  1589 
  1524 subsubsection "More Lemmas about set multiplication"
  1590 subsubsection "More Lemmas about set multiplication"
  1525 
  1591 
  1526 (*A group multiplied by a subgroup stays the same*)
  1592 text \<open>A group multiplied by a subgroup stays the same\<close>
  1527 lemma (in group) set_mult_carrier_idem:
  1593 lemma (in group) set_mult_carrier_idem:
  1528   assumes "subgroup H G"
  1594   assumes "subgroup H G"
  1529   shows "(carrier G) <#> H = carrier G"
  1595   shows "(carrier G) <#> H = carrier G"
  1530 proof
  1596 proof
  1531   show "(carrier G)<#>H \<subseteq> carrier G"
  1597   show "(carrier G)<#>H \<subseteq> carrier G"
  1535   moreover have "(carrier G) #>  \<one> \<subseteq> (carrier G) <#> H" unfolding set_mult_def r_coset_def
  1601   moreover have "(carrier G) #>  \<one> \<subseteq> (carrier G) <#> H" unfolding set_mult_def r_coset_def
  1536     using assms subgroup.one_closed[OF assms] by blast
  1602     using assms subgroup.one_closed[OF assms] by blast
  1537   ultimately show "carrier G \<subseteq> (carrier G) <#> H" by simp
  1603   ultimately show "carrier G \<subseteq> (carrier G) <#> H" by simp
  1538 qed
  1604 qed
  1539 
  1605 
  1540 (*Same lemma as above, but everything is included in a subgroup*)
  1606 text \<open>Same lemma as above, but everything is included in a subgroup\<close>
  1541 lemma (in group) set_mult_subgroup_idem:
  1607 lemma (in group) set_mult_subgroup_idem:
  1542   assumes HG: "subgroup H G" and NG: "subgroup N (G \<lparr> carrier := H \<rparr>)"
  1608   assumes HG: "subgroup H G" and NG: "subgroup N (G \<lparr> carrier := H \<rparr>)"
  1543   shows "H <#> N = H"
  1609   shows "H <#> N = H"
  1544   using group.set_mult_carrier_idem[OF subgroup.subgroup_is_group[OF HG group_axioms] NG] by simp
  1610   using group.set_mult_carrier_idem[OF subgroup.subgroup_is_group[OF HG group_axioms] NG] by simp
  1545 
  1611 
  1546 (*A normal subgroup is commutative with set_mult*)
  1612 text \<open>A normal subgroup is commutative with set_mult\<close>
  1547 lemma (in group) commut_normal:
  1613 lemma (in group) commut_normal:
  1548   assumes "subgroup H G" and "N\<lhd>G"
  1614   assumes "subgroup H G" and "N\<lhd>G"
  1549   shows "H<#>N = N<#>H"
  1615   shows "H<#>N = N<#>H"
  1550 proof-
  1616 proof-
  1551   have aux1: "{H <#> N} = {\<Union>h\<in>H. h <# N }" unfolding set_mult_def l_coset_def by auto
  1617   have aux1: "{H <#> N} = {\<Union>h\<in>H. h <# N }" unfolding set_mult_def l_coset_def by auto
  1552   also have "... = {\<Union>h\<in>H. N #> h }" using assms normal.coset_eq subgroup.mem_carrier by fastforce
  1618   also have "... = {\<Union>h\<in>H. N #> h }" using assms normal.coset_eq subgroup.mem_carrier by fastforce
  1553   moreover have aux2: "{N <#> H} = {\<Union>h\<in>H. N #> h }"unfolding set_mult_def r_coset_def by auto
  1619   moreover have aux2: "{N <#> H} = {\<Union>h\<in>H. N #> h }"unfolding set_mult_def r_coset_def by auto
  1554   ultimately show "H<#>N = N<#>H" by simp
  1620   ultimately show "H<#>N = N<#>H" by simp
  1555 qed
  1621 qed
  1556 
  1622 
  1557 (*Same lemma as above, but everything is included in a subgroup*)
  1623 text \<open>Same lemma as above, but everything is included in a subgroup\<close>
  1558 lemma (in group) commut_normal_subgroup:
  1624 lemma (in group) commut_normal_subgroup:
  1559   assumes "subgroup H G" and "N \<lhd> (G\<lparr> carrier := H \<rparr>)"
  1625   assumes "subgroup H G" and "N \<lhd> (G\<lparr> carrier := H \<rparr>)"
  1560     and "subgroup K (G \<lparr> carrier := H \<rparr>)"
  1626     and "subgroup K (G \<lparr> carrier := H \<rparr>)"
  1561   shows "K <#> N = N <#> K"
  1627   shows "K <#> N = N <#> K"
  1562   using group.commut_normal[OF subgroup.subgroup_is_group[OF assms(1) group_axioms] assms(3,2)] by simp
  1628   by (metis assms(2) assms(3) group.commut_normal normal.axioms(2) set_mult_consistent)
  1563 
       
  1564 
  1629 
  1565 
  1630 
  1566 subsubsection "Lemmas about intersection and normal subgroups"
  1631 subsubsection "Lemmas about intersection and normal subgroups"
       
  1632 text \<open>Mostly by Jakob von Raumer\<close>
  1567 
  1633 
  1568 lemma (in group) normal_inter:
  1634 lemma (in group) normal_inter:
  1569   assumes "subgroup H G"
  1635   assumes "subgroup H G"
  1570     and "subgroup K G"
  1636     and "subgroup K G"
  1571     and "H1\<lhd>G\<lparr>carrier := H\<rparr>"
  1637     and "H1\<lhd>G\<lparr>carrier := H\<rparr>"
  1572   shows " (H1\<inter>K)\<lhd>(G\<lparr>carrier:= (H\<inter>K)\<rparr>)"
  1638   shows "(H1\<inter>K)\<lhd>(G\<lparr>carrier:= (H\<inter>K)\<rparr>)"
  1573 proof-
  1639 proof-
  1574   define HK and H1K and GH and GHK
  1640   define HK and H1K and GH and GHK
  1575     where "HK = H\<inter>K" and "H1K=H1\<inter>K" and "GH =G\<lparr>carrier := H\<rparr>" and "GHK = (G\<lparr>carrier:= (H\<inter>K)\<rparr>)"
  1641     where "HK = H\<inter>K" and "H1K=H1\<inter>K" and "GH =G\<lparr>carrier := H\<rparr>" and "GHK = (G\<lparr>carrier:= (H\<inter>K)\<rparr>)"
  1576   show "H1K\<lhd>GHK"
  1642   show "H1K\<lhd>GHK"
  1577   proof (intro group.normal_invI[of GHK H1K])
  1643   proof (intro group.normal_invI[of GHK H1K])
  1645   moreover have "K \<inter> H = H" using K_def assms subgroup.subset by blast
  1711   moreover have "K \<inter> H = H" using K_def assms subgroup.subset by blast
  1646   ultimately show "normal (N\<inter>H) (G\<lparr>carrier := H\<rparr>)"
  1712   ultimately show "normal (N\<inter>H) (G\<lparr>carrier := H\<rparr>)"
  1647  by auto
  1713  by auto
  1648 qed
  1714 qed
  1649 
  1715 
       
  1716 lemma (in group) normal_restrict_supergroup:
       
  1717   assumes "subgroup S G" "N \<lhd> G" "N \<subseteq> S"
       
  1718   shows "N \<lhd> (G\<lparr>carrier := S\<rparr>)"
       
  1719   by (metis assms inf.absorb_iff1 normal_Int_subgroup)
       
  1720 
       
  1721 text \<open>A subgroup relation survives factoring by a normal subgroup.\<close>
       
  1722 lemma (in group) normal_subgroup_factorize:
       
  1723   assumes "N \<lhd> G" and "N \<subseteq> H" and "subgroup H G"
       
  1724   shows "subgroup (rcosets\<^bsub>G\<lparr>carrier := H\<rparr>\<^esub> N) (G Mod N)"
       
  1725 proof -
       
  1726   interpret GModN: group "G Mod N" 
       
  1727     using assms(1) by (rule normal.factorgroup_is_group)
       
  1728   have "N \<lhd> G\<lparr>carrier := H\<rparr>" 
       
  1729     using assms by (metis normal_restrict_supergroup)
       
  1730   hence grpHN: "group (G\<lparr>carrier := H\<rparr> Mod N)" 
       
  1731     by (rule normal.factorgroup_is_group)
       
  1732   have "(<#>\<^bsub>G\<lparr>carrier:=H\<rparr>\<^esub>) = (\<lambda>U K. (\<Union>h\<in>U. \<Union>k\<in>K. {h \<otimes>\<^bsub>G\<lparr>carrier := H\<rparr>\<^esub> k}))" 
       
  1733     using set_mult_def by metis
       
  1734   moreover have "\<dots> = (\<lambda>U K. (\<Union>h\<in>U. \<Union>k\<in>K. {h \<otimes>\<^bsub>G\<^esub> k}))" 
       
  1735     by auto
       
  1736   moreover have "(<#>) = (\<lambda>U K. (\<Union>h\<in>U. \<Union>k\<in>K. {h \<otimes> k}))" 
       
  1737     using set_mult_def by metis
       
  1738   ultimately have "(<#>\<^bsub>G\<lparr>carrier:=H\<rparr>\<^esub>) = (<#>\<^bsub>G\<^esub>)" 
       
  1739     by simp
       
  1740   with grpHN have "group ((G Mod N)\<lparr>carrier := (rcosets\<^bsub>G\<lparr>carrier := H\<rparr>\<^esub> N)\<rparr>)" 
       
  1741     unfolding FactGroup_def by auto
       
  1742   moreover have "rcosets\<^bsub>G\<lparr>carrier := H\<rparr>\<^esub> N \<subseteq> carrier (G Mod N)" 
       
  1743     unfolding FactGroup_def RCOSETS_def r_coset_def using assms(3) subgroup.subset 
       
  1744     by fastforce
       
  1745   ultimately show ?thesis
       
  1746     using GModN.group_incl_imp_subgroup by blast
       
  1747 qed
       
  1748 
       
  1749 text \<open>A normality relation survives factoring by a normal subgroup.\<close>
       
  1750 lemma (in group) normality_factorization:
       
  1751   assumes NG: "N \<lhd> G" and NH: "N \<subseteq> H" and HG: "H \<lhd> G"
       
  1752   shows "(rcosets\<^bsub>G\<lparr>carrier := H\<rparr>\<^esub> N) \<lhd> (G Mod N)"
       
  1753 proof -
       
  1754   from assms(1) interpret GModN: group "G Mod N" by (metis normal.factorgroup_is_group)
       
  1755   show ?thesis
       
  1756     unfolding GModN.normal_inv_iff
       
  1757   proof (intro conjI strip)
       
  1758     show "subgroup (rcosets\<^bsub>G\<lparr>carrier := H\<rparr>\<^esub> N) (G Mod N)" 
       
  1759       using assms normal_imp_subgroup normal_subgroup_factorize by force
       
  1760   next
       
  1761     fix U V
       
  1762     assume U: "U \<in> carrier (G Mod N)" and V: "V \<in> rcosets\<^bsub>G\<lparr>carrier := H\<rparr>\<^esub> N"
       
  1763     then obtain g where g: "g \<in> carrier G" "U = N #> g"
       
  1764       unfolding FactGroup_def RCOSETS_def by auto
       
  1765     from V obtain h where h: "h \<in> H" "V = N #> h" 
       
  1766       unfolding FactGroup_def RCOSETS_def r_coset_def by auto
       
  1767     hence hG: "h \<in> carrier G" 
       
  1768       using HG normal_imp_subgroup subgroup.mem_carrier by force
       
  1769     hence ghG: "g \<otimes> h \<in> carrier G" 
       
  1770       using g m_closed by auto
       
  1771     from g h have "g \<otimes> h \<otimes> inv g \<in> H" 
       
  1772       using HG normal_inv_iff by auto
       
  1773     moreover have "U <#> V <#> inv\<^bsub>G Mod N\<^esub> U = N #> (g \<otimes> h \<otimes> inv g)"
       
  1774     proof -
       
  1775       from g U have "inv\<^bsub>G Mod N\<^esub> U = N #> inv g" 
       
  1776         using NG normal.inv_FactGroup normal.rcos_inv by fastforce
       
  1777       hence "U <#> V <#> inv\<^bsub>G Mod N\<^esub> U = (N #> g) <#> (N #> h) <#> (N #> inv g)" 
       
  1778         using g h by simp
       
  1779       also have "\<dots> = N #> (g \<otimes> h \<otimes> inv g)" 
       
  1780         using g hG NG inv_closed ghG normal.rcos_sum by force
       
  1781       finally show ?thesis .
       
  1782     qed
       
  1783     ultimately show "U \<otimes>\<^bsub>G Mod N\<^esub> V \<otimes>\<^bsub>G Mod N\<^esub> inv\<^bsub>G Mod N\<^esub> U \<in> rcosets\<^bsub>G\<lparr>carrier := H\<rparr>\<^esub> N" 
       
  1784       unfolding RCOSETS_def r_coset_def by auto
       
  1785   qed
       
  1786 qed
       
  1787 
       
  1788 text \<open>Factorizing by the trivial subgroup is an isomorphism.\<close>
       
  1789 lemma (in group) trivial_factor_iso:
       
  1790   shows "the_elem \<in> iso (G Mod {\<one>}) G"
       
  1791 proof -
       
  1792   have "group_hom G G (\<lambda>x. x)" 
       
  1793     unfolding group_hom_def group_hom_axioms_def hom_def using is_group by simp
       
  1794   moreover have "(\<lambda>x. x) ` carrier G = carrier G" 
       
  1795     by simp
       
  1796   moreover have "kernel G G (\<lambda>x. x) = {\<one>}" 
       
  1797     unfolding kernel_def by auto
       
  1798   ultimately show ?thesis using group_hom.FactGroup_iso_set 
       
  1799     by force
       
  1800 qed
       
  1801 
       
  1802 text \<open>And the dual theorem to the previous one: Factorizing by the group itself gives the trivial group\<close>
       
  1803 
       
  1804 lemma (in group) self_factor_iso:
       
  1805   shows "(\<lambda>X. the_elem ((\<lambda>x. \<one>) ` X)) \<in> iso (G Mod (carrier G)) (G\<lparr> carrier := {\<one>} \<rparr>)"
       
  1806 proof -
       
  1807   have "group (G\<lparr>carrier := {\<one>}\<rparr>)" 
       
  1808     by (metis subgroup_imp_group triv_subgroup)
       
  1809   hence "group_hom G (G\<lparr>carrier := {\<one>}\<rparr>) (\<lambda>x. \<one>)" 
       
  1810     unfolding group_hom_def group_hom_axioms_def hom_def using is_group by auto
       
  1811   moreover have "(\<lambda>x. \<one>) ` carrier G = carrier (G\<lparr>carrier := {\<one>}\<rparr>)" 
       
  1812     by auto
       
  1813   moreover have "kernel G (G\<lparr>carrier := {\<one>}\<rparr>) (\<lambda>x. \<one>) = carrier G" 
       
  1814     unfolding kernel_def by auto
       
  1815   ultimately show ?thesis using group_hom.FactGroup_iso_set 
       
  1816     by force
       
  1817 qed
       
  1818 
       
  1819 text \<open>Factoring by a normal subgroups yields the trivial group iff the subgroup is the whole group.\<close>
       
  1820 lemma (in normal) fact_group_trivial_iff:
       
  1821   assumes "finite (carrier G)"
       
  1822   shows "(carrier (G Mod H) = {\<one>\<^bsub>G Mod H\<^esub>}) \<longleftrightarrow> (H = carrier G)"
       
  1823 proof
       
  1824   assume "carrier (G Mod H) = {\<one>\<^bsub>G Mod H\<^esub>}" 
       
  1825   moreover have "order (G Mod H) * card H = order G"
       
  1826     by (simp add: FactGroup_def lagrange order_def subgroup_axioms)
       
  1827   ultimately have "card H = order G" unfolding order_def by auto
       
  1828   thus "H = carrier G"
       
  1829     by (simp add: assms card_subset_eq order_def subset)
       
  1830 next
       
  1831   assume "H = carrier G"
       
  1832   with assms is_subgroup lagrange 
       
  1833   have "card (rcosets H) * order G = order G"
       
  1834     by (simp add: order_def)
       
  1835   then have "card (rcosets H) = 1" 
       
  1836     using assms order_gt_0_iff_finite by auto
       
  1837   hence "order (G Mod H) = 1" 
       
  1838     unfolding order_def FactGroup_def by auto
       
  1839   thus "carrier (G Mod H) = {\<one>\<^bsub>G Mod H\<^esub>}" 
       
  1840     using factorgroup_is_group by (metis group.order_one_triv_iff)
       
  1841 qed
       
  1842 
       
  1843 text \<open>The union of all the cosets contained in a subgroup of a quotient group acts as a represenation for that subgroup.\<close>
       
  1844 
       
  1845 lemma (in normal) factgroup_subgroup_union_char:
       
  1846   assumes "subgroup A (G Mod H)"
       
  1847   shows "(\<Union>A) = {x \<in> carrier G. H #> x \<in> A}"
       
  1848 proof
       
  1849   show "\<Union>A \<subseteq> {x \<in> carrier G. H #> x \<in> A}"
       
  1850   proof
       
  1851     fix x
       
  1852     assume x: "x \<in> \<Union>A"
       
  1853     then obtain a where a: "a \<in> A" "x \<in> a" and xx: "x \<in> carrier G"
       
  1854       using subgroup.subset assms by (force simp add: FactGroup_def RCOSETS_def r_coset_def)
       
  1855     from assms a obtain y where y: "y \<in> carrier G" "a = H #> y" 
       
  1856       using subgroup.subset unfolding FactGroup_def RCOSETS_def by force
       
  1857     with a have "x \<in> H #> y" by simp
       
  1858     hence "H #> y = H #> x" using y is_subgroup repr_independence by auto
       
  1859     with y(2) a(1) have "H #> x \<in> A" 
       
  1860       by auto
       
  1861     with xx show "x \<in> {x \<in> carrier G. H #> x \<in> A}" by simp
       
  1862   qed
       
  1863 next
       
  1864   show "{x \<in> carrier G. H #> x \<in> A} \<subseteq> \<Union>A"
       
  1865     using rcos_self subgroup_axioms by auto
       
  1866 qed
       
  1867 
       
  1868 lemma (in normal) factgroup_subgroup_union_subgroup:
       
  1869   assumes "subgroup A (G Mod H)"
       
  1870   shows "subgroup (\<Union>A) G"
       
  1871 proof -
       
  1872   have "subgroup {x \<in> carrier G. H #> x \<in> A} G"
       
  1873   proof
       
  1874     show "{x \<in> carrier G. H #> x \<in> A} \<subseteq> carrier G" by auto
       
  1875   next
       
  1876     fix x y
       
  1877     assume xy: "x \<in> {x \<in> carrier G. H #> x \<in> A}" "y \<in> {x \<in> carrier G. H #> x \<in> A}"
       
  1878     then have "(H #> x) <#> (H #> y) \<in> A" 
       
  1879       using subgroup.m_closed assms unfolding FactGroup_def  by fastforce
       
  1880     hence "H #> (x \<otimes> y) \<in> A"
       
  1881       using xy rcos_sum by force
       
  1882     with xy show "x \<otimes> y \<in> {x \<in> carrier G. H #> x \<in> A}" by blast 
       
  1883   next
       
  1884     have "H #> \<one> \<in> A"
       
  1885       using assms subgroup.one_closed subset by fastforce
       
  1886     with assms one_closed show "\<one> \<in> {x \<in> carrier G. H #> x \<in> A}" by simp
       
  1887   next
       
  1888     fix x
       
  1889     assume x: "x \<in> {x \<in> carrier G. H #> x \<in> A}"
       
  1890     hence invx: "inv x \<in> carrier G" using inv_closed by simp
       
  1891     from assms x have "set_inv (H #> x) \<in> A" using subgroup.m_inv_closed
       
  1892       using inv_FactGroup subgroup.mem_carrier by fastforce
       
  1893     with invx show "inv x \<in> {x \<in> carrier G. H #> x \<in> A}"
       
  1894       using rcos_inv x by force
       
  1895   qed
       
  1896   with assms factgroup_subgroup_union_char show ?thesis by auto
       
  1897 qed
       
  1898 
       
  1899 lemma (in normal) factgroup_subgroup_union_normal:
       
  1900   assumes "A \<lhd> (G Mod H)"
       
  1901   shows "\<Union>A \<lhd> G"
       
  1902 proof - 
       
  1903   have "{x \<in> carrier G. H #> x \<in> A} \<lhd> G"
       
  1904     unfolding normal_def normal_axioms_def
       
  1905   proof (intro conjI strip)
       
  1906     from assms show "subgroup {x \<in> carrier G. H #> x \<in> A} G"
       
  1907       by (metis (full_types) factgroup_subgroup_union_char factgroup_subgroup_union_subgroup normal_imp_subgroup)
       
  1908   next
       
  1909     interpret Anormal: normal A "(G Mod H)" using assms by simp
       
  1910     show "{x \<in> carrier G. H #> x \<in> A} #> x = x <# {x \<in> carrier G. H #> x \<in> A}" if x: "x \<in> carrier G" for x
       
  1911     proof -
       
  1912       { fix y
       
  1913         assume y: "y \<in> {x \<in> carrier G. H #> x \<in> A} #> x"
       
  1914         then obtain x' where x': "x' \<in> carrier G" "H #> x' \<in> A" "y = x' \<otimes> x" 
       
  1915           unfolding r_coset_def by auto
       
  1916         from x(1) have Hx: "H #> x \<in> carrier (G Mod H)" 
       
  1917           unfolding FactGroup_def RCOSETS_def by force
       
  1918         with x' have "(inv\<^bsub>G Mod H\<^esub> (H #> x)) \<otimes>\<^bsub>G Mod H\<^esub> (H #> x') \<otimes>\<^bsub>G Mod H\<^esub> (H #> x) \<in> A" 
       
  1919           using Anormal.inv_op_closed1 by auto
       
  1920         hence "(set_inv (H #> x)) <#> (H #> x') <#> (H #> x) \<in> A" 
       
  1921           using inv_FactGroup Hx unfolding FactGroup_def by auto
       
  1922         hence "(H #> (inv x)) <#> (H #> x') <#> (H #> x) \<in> A" 
       
  1923           using x(1) by (metis rcos_inv)
       
  1924         hence "H #> (inv x \<otimes> x' \<otimes> x) \<in> A" 
       
  1925           by (metis inv_closed m_closed rcos_sum x'(1) x(1))
       
  1926         moreover have "inv x \<otimes> x' \<otimes> x \<in> carrier G" 
       
  1927           using x x' by (metis inv_closed m_closed)
       
  1928         ultimately have xcoset: "x \<otimes> (inv x \<otimes> x' \<otimes> x) \<in> x <# {x \<in> carrier G. H #> x \<in> A}" 
       
  1929           unfolding l_coset_def using x(1) by auto
       
  1930         have "x \<otimes> (inv x \<otimes> x' \<otimes> x) = (x \<otimes> inv x) \<otimes> x' \<otimes> x" 
       
  1931           by (metis Units_eq Units_inv_Units m_assoc m_closed x'(1) x(1))
       
  1932         also have "\<dots> = y"
       
  1933           by (simp add: x x')
       
  1934         finally have "x \<otimes> (inv x \<otimes> x' \<otimes> x) = y" .
       
  1935         with xcoset have "y \<in> x <# {x \<in> carrier G. H #> x \<in> A}" by auto}
       
  1936       moreover
       
  1937       { fix y
       
  1938         assume y: "y \<in> x <# {x \<in> carrier G. H #> x \<in> A}"
       
  1939         then obtain x' where x': "x' \<in> carrier G" "H #> x' \<in> A" "y = x \<otimes> x'" unfolding l_coset_def by auto
       
  1940         from x(1) have invx: "inv x \<in> carrier G" 
       
  1941           by (rule inv_closed)
       
  1942         hence Hinvx: "H #> (inv x) \<in> carrier (G Mod H)" 
       
  1943           unfolding FactGroup_def RCOSETS_def by force
       
  1944         with x' have "(inv\<^bsub>G Mod H\<^esub> (H #> inv x)) \<otimes>\<^bsub>G Mod H\<^esub> (H #> x') \<otimes>\<^bsub>G Mod H\<^esub> (H #> inv x) \<in> A" 
       
  1945           using invx Anormal.inv_op_closed1 by auto
       
  1946         hence "(set_inv (H #> inv x)) <#> (H #> x') <#> (H #> inv x) \<in> A" 
       
  1947           using inv_FactGroup Hinvx unfolding FactGroup_def by auto
       
  1948         hence "H #> (x \<otimes> x' \<otimes> inv x) \<in> A"
       
  1949           by (simp add: rcos_inv rcos_sum x x'(1))
       
  1950         moreover have "x \<otimes> x' \<otimes> inv x \<in> carrier G" using x x' by (metis inv_closed m_closed)
       
  1951         ultimately have xcoset: "(x \<otimes> x' \<otimes> inv x) \<otimes> x \<in> {x \<in> carrier G. H #> x \<in> A} #> x" 
       
  1952           unfolding r_coset_def using invx by auto
       
  1953         have "(x \<otimes> x' \<otimes> inv x) \<otimes> x = (x \<otimes> x') \<otimes> (inv x \<otimes> x)" 
       
  1954           by (metis Units_eq Units_inv_Units m_assoc m_closed x'(1) x(1))
       
  1955         also have "\<dots> = y"
       
  1956           by (simp add: x x')
       
  1957         finally have "x \<otimes> x' \<otimes> inv x \<otimes> x = y".
       
  1958         with xcoset have "y \<in> {x \<in> carrier G. H #> x \<in> A} #> x" by auto }
       
  1959       ultimately show ?thesis
       
  1960         by auto
       
  1961     qed
       
  1962   qed auto
       
  1963   with assms show ?thesis 
       
  1964     by (metis (full_types) factgroup_subgroup_union_char normal_imp_subgroup)
       
  1965 qed
       
  1966 
       
  1967 lemma (in normal) factgroup_subgroup_union_factor:
       
  1968   assumes "subgroup A (G Mod H)"
       
  1969   shows "A = rcosets\<^bsub>G\<lparr>carrier := \<Union>A\<rparr>\<^esub> H"
       
  1970   using assms subgroup.mem_carrier factgroup_subgroup_union_char by (fastforce simp: RCOSETS_def FactGroup_def)
       
  1971 
       
  1972 
       
  1973 section  \<open>Flattening the type of group carriers\<close>
       
  1974 
       
  1975 text \<open>Flattening here means to convert the type of group elements from 'a set to 'a.
       
  1976 This is possible whenever the empty set is not an element of the group. By Jakob von Raumer\<close>
       
  1977 
       
  1978 
       
  1979 definition flatten where
       
  1980   "flatten (G::('a set, 'b) monoid_scheme) rep = \<lparr>carrier=(rep ` (carrier G)),
       
  1981       monoid.mult=(\<lambda> x y. rep ((the_inv_into (carrier G) rep x) \<otimes>\<^bsub>G\<^esub> (the_inv_into (carrier G) rep y))), 
       
  1982       one=rep \<one>\<^bsub>G\<^esub> \<rparr>"
       
  1983 
       
  1984 lemma flatten_set_group_hom:
       
  1985   assumes group: "group G"
       
  1986   assumes inj: "inj_on rep (carrier G)"
       
  1987   shows "rep \<in> hom G (flatten G rep)"
       
  1988   by (force simp add: hom_def flatten_def inj the_inv_into_f_f)
       
  1989 
       
  1990 lemma flatten_set_group:
       
  1991   assumes "group G" "inj_on rep (carrier G)"
       
  1992   shows "group (flatten G rep)"
       
  1993 proof (rule groupI)
       
  1994   fix x y
       
  1995   assume "x \<in> carrier (flatten G rep)" and "y \<in> carrier (flatten G rep)"
       
  1996   then show "x \<otimes>\<^bsub>flatten G rep\<^esub> y \<in> carrier (flatten G rep)" 
       
  1997     using assms group.surj_const_mult the_inv_into_f_f by (fastforce simp: flatten_def)
       
  1998 next
       
  1999   show "\<one>\<^bsub>flatten G rep\<^esub> \<in> carrier (flatten G rep)" 
       
  2000     unfolding flatten_def by (simp add: assms group.is_monoid)
       
  2001 next
       
  2002   fix x y z
       
  2003   assume "x \<in> carrier (flatten G rep)" "y \<in> carrier (flatten G rep)" "z \<in> carrier (flatten G rep)"
       
  2004   then show "x \<otimes>\<^bsub>flatten G rep\<^esub> y \<otimes>\<^bsub>flatten G rep\<^esub> z = x \<otimes>\<^bsub>flatten G rep\<^esub> (y \<otimes>\<^bsub>flatten G rep\<^esub> z)"
       
  2005     by (auto simp: assms flatten_def group.is_monoid monoid.m_assoc monoid.m_closed the_inv_into_f_f)
       
  2006 next
       
  2007   fix x
       
  2008   assume x: "x \<in> carrier (flatten G rep)"
       
  2009   then show "\<one>\<^bsub>flatten G rep\<^esub> \<otimes>\<^bsub>flatten G rep\<^esub> x = x"
       
  2010     by (auto simp: assms group.is_monoid the_inv_into_f_f flatten_def)
       
  2011   then have "\<exists>y\<in>carrier G. rep (y \<otimes>\<^bsub>G\<^esub> z) = rep \<one>\<^bsub>G\<^esub>" if "z \<in> carrier G" for z
       
  2012     by (metis \<open>group G\<close> group.l_inv_ex that)
       
  2013   with assms x show "\<exists>y\<in>carrier (flatten G rep). y \<otimes>\<^bsub>flatten G rep\<^esub> x = \<one>\<^bsub>flatten G rep\<^esub>"
       
  2014     by (auto simp: flatten_def the_inv_into_f_f)
       
  2015 qed
       
  2016 
       
  2017 lemma (in normal) flatten_set_group_mod_inj:
       
  2018   shows "inj_on (\<lambda>U. SOME g. g \<in> U) (carrier (G Mod H))"
       
  2019 proof (rule inj_onI)
       
  2020   fix U V
       
  2021   assume U: "U \<in> carrier (G Mod H)" and V: "V \<in> carrier (G Mod H)"
       
  2022   then obtain g h where g: "U = H #> g" "g \<in> carrier G" and h: "V = H #> h" "h \<in> carrier G"
       
  2023     unfolding FactGroup_def RCOSETS_def by auto
       
  2024   hence notempty: "U \<noteq> {}" "V \<noteq> {}" 
       
  2025     by (metis empty_iff is_subgroup rcos_self)+
       
  2026   assume "(SOME g. g \<in> U) = (SOME g. g \<in> V)"
       
  2027   with notempty have "(SOME g. g \<in> U) \<in> U \<inter> V" 
       
  2028     by (metis IntI ex_in_conv someI)
       
  2029   thus "U = V" 
       
  2030     by (metis Int_iff g h is_subgroup repr_independence)
       
  2031 qed
       
  2032 
       
  2033 lemma (in normal) flatten_set_group_mod:
       
  2034   shows "group (flatten (G Mod H) (\<lambda>U. SOME g. g \<in> U))"
       
  2035   by (simp add: factorgroup_is_group flatten_set_group flatten_set_group_mod_inj)
       
  2036 
       
  2037 lemma (in normal) flatten_set_group_mod_iso:
       
  2038   shows "(\<lambda>U. SOME g. g \<in> U) \<in> iso (G Mod H) (flatten (G Mod H) (\<lambda>U. SOME g. g \<in> U))"
       
  2039 proof -
       
  2040   have "(\<lambda>U. SOME g. g \<in> U) \<in> hom (G Mod H) (flatten (G Mod H) (\<lambda>U. SOME g. g \<in> U))"
       
  2041     using factorgroup_is_group flatten_set_group_hom flatten_set_group_mod_inj by blast
       
  2042   moreover
       
  2043   have "inj_on (\<lambda>U. SOME g. g \<in> U) (carrier (G Mod H))"
       
  2044     using flatten_set_group_mod_inj by blast
       
  2045   ultimately show ?thesis
       
  2046     by (simp add: iso_def bij_betw_def flatten_def)
       
  2047 qed
       
  2048 
  1650 end
  2049 end