src/HOL/Algebra/Coset.thy
changeset 20318 0e0ea63fe768
parent 19931 fb32b43e7f80
child 21404 eb85850d3eb7
equal deleted inserted replaced
20317:6e070b33e72b 20318:0e0ea63fe768
     1 (*  Title:      HOL/Algebra/Coset.thy
     1 (*  Title:      HOL/Algebra/Coset.thy
     2     ID:         $Id$
     2     ID:         $Id$
     3     Author:     Florian Kammueller, with new proofs by L C Paulson
     3     Author:     Florian Kammueller, with new proofs by L C Paulson, and
       
     4                 Stephan Hohe
     4 *)
     5 *)
     5 
     6 
     6 header{*Cosets and Quotient Groups*}
       
     7 
       
     8 theory Coset imports Group Exponent begin
     7 theory Coset imports Group Exponent begin
       
     8 
       
     9 
       
    10 section {*Cosets and Quotient Groups*}
     9 
    11 
    10 constdefs (structure G)
    12 constdefs (structure G)
    11   r_coset    :: "[_, 'a set, 'a] \<Rightarrow> 'a set"    (infixl "#>\<index>" 60)
    13   r_coset    :: "[_, 'a set, 'a] \<Rightarrow> 'a set"    (infixl "#>\<index>" 60)
    12   "H #> a \<equiv> \<Union>h\<in>H. {h \<otimes> a}"
    14   "H #> a \<equiv> \<Union>h\<in>H. {h \<otimes> a}"
    13 
    15 
    79 lemma (in group) coset_join2:
    81 lemma (in group) coset_join2:
    80      "\<lbrakk>x \<in> carrier G;  subgroup H G;  x\<in>H\<rbrakk> \<Longrightarrow> H #> x = H"
    82      "\<lbrakk>x \<in> carrier G;  subgroup H G;  x\<in>H\<rbrakk> \<Longrightarrow> H #> x = H"
    81   --{*Alternative proof is to put @{term "x=\<one>"} in @{text repr_independence}.*}
    83   --{*Alternative proof is to put @{term "x=\<one>"} in @{text repr_independence}.*}
    82 by (force simp add: subgroup.m_closed r_coset_def solve_equation)
    84 by (force simp add: subgroup.m_closed r_coset_def solve_equation)
    83 
    85 
    84 lemma (in group) r_coset_subset_G:
    86 lemma (in monoid) r_coset_subset_G:
    85      "[| H \<subseteq> carrier G; x \<in> carrier G |] ==> H #> x \<subseteq> carrier G"
    87      "[| H \<subseteq> carrier G; x \<in> carrier G |] ==> H #> x \<subseteq> carrier G"
    86 by (auto simp add: r_coset_def)
    88 by (auto simp add: r_coset_def)
    87 
    89 
    88 lemma (in group) rcosI:
    90 lemma (in group) rcosI:
    89      "[| h \<in> H; H \<subseteq> carrier G; x \<in> carrier G|] ==> h \<otimes> x \<in> H #> x"
    91      "[| h \<in> H; H \<subseteq> carrier G; x \<in> carrier G|] ==> h \<otimes> x \<in> H #> x"
   102 lemma (in group) rcos_self: "[| x \<in> carrier G; subgroup H G |] ==> x \<in> H #> x"
   104 lemma (in group) rcos_self: "[| x \<in> carrier G; subgroup H G |] ==> x \<in> H #> x"
   103 apply (simp add: r_coset_def)
   105 apply (simp add: r_coset_def)
   104 apply (blast intro: sym l_one subgroup.subset [THEN subsetD]
   106 apply (blast intro: sym l_one subgroup.subset [THEN subsetD]
   105                     subgroup.one_closed)
   107                     subgroup.one_closed)
   106 done
   108 done
       
   109 
       
   110 text {* Opposite of @{thm [locale=group,source] "repr_independence"} *}
       
   111 lemma (in group) repr_independenceD:
       
   112   includes subgroup H G
       
   113   assumes ycarr: "y \<in> carrier G"
       
   114       and repr:  "H #> x = H #> y"
       
   115   shows "y \<in> H #> x"
       
   116   by (subst repr, intro rcos_self)
       
   117 
       
   118 text {* Elements of a right coset are in the carrier *}
       
   119 lemma (in subgroup) elemrcos_carrier:
       
   120   includes group
       
   121   assumes acarr: "a \<in> carrier G"
       
   122     and a': "a' \<in> H #> a"
       
   123   shows "a' \<in> carrier G"
       
   124 proof -
       
   125   from subset and acarr
       
   126   have "H #> a \<subseteq> carrier G" by (rule r_coset_subset_G)
       
   127   from this and a'
       
   128   show "a' \<in> carrier G"
       
   129     by fast
       
   130 qed
       
   131 
       
   132 lemma (in subgroup) rcos_const:
       
   133   includes group
       
   134   assumes hH: "h \<in> H"
       
   135   shows "H #> h = H"
       
   136   apply (unfold r_coset_def)
       
   137   apply rule apply rule
       
   138   apply clarsimp
       
   139   apply (intro subgroup.m_closed)
       
   140   apply assumption+
       
   141   apply rule
       
   142   apply simp
       
   143 proof -
       
   144   fix h'
       
   145   assume h'H: "h' \<in> H"
       
   146   note carr = hH[THEN mem_carrier] h'H[THEN mem_carrier]
       
   147   from carr
       
   148   have a: "h' = (h' \<otimes> inv h) \<otimes> h" by (simp add: m_assoc)
       
   149   from h'H hH
       
   150   have "h' \<otimes> inv h \<in> H" by simp
       
   151   from this and a
       
   152   show "\<exists>x\<in>H. h' = x \<otimes> h" by fast
       
   153 qed
       
   154 
       
   155 text {* Step one for lemma @{text "rcos_module"} *}
       
   156 lemma (in subgroup) rcos_module_imp:
       
   157   includes group
       
   158   assumes xcarr: "x \<in> carrier G"
       
   159       and x'cos: "x' \<in> H #> x"
       
   160   shows "(x' \<otimes> inv x) \<in> H"
       
   161 proof -
       
   162   from xcarr x'cos
       
   163       have x'carr: "x' \<in> carrier G"
       
   164       by (rule elemrcos_carrier[OF is_group])
       
   165   from xcarr
       
   166       have ixcarr: "inv x \<in> carrier G"
       
   167       by simp
       
   168   from x'cos
       
   169       have "\<exists>h\<in>H. x' = h \<otimes> x"
       
   170       unfolding r_coset_def
       
   171       by fast
       
   172   from this
       
   173       obtain h
       
   174         where hH: "h \<in> H"
       
   175         and x': "x' = h \<otimes> x"
       
   176       by auto
       
   177   from hH and subset
       
   178       have hcarr: "h \<in> carrier G" by fast
       
   179   note carr = xcarr x'carr hcarr
       
   180   from x' and carr
       
   181       have "x' \<otimes> (inv x) = (h \<otimes> x) \<otimes> (inv x)" by fast
       
   182   also from carr
       
   183       have "\<dots> = h \<otimes> (x \<otimes> inv x)" by (simp add: m_assoc)
       
   184   also from carr
       
   185       have "\<dots> = h \<otimes> \<one>" by simp
       
   186   also from carr
       
   187       have "\<dots> = h" by simp
       
   188   finally
       
   189       have "x' \<otimes> (inv x) = h" by simp
       
   190   from hH this
       
   191       show "x' \<otimes> (inv x) \<in> H" by simp
       
   192 qed
       
   193 
       
   194 text {* Step two for lemma @{text "rcos_module"} *}
       
   195 lemma (in subgroup) rcos_module_rev:
       
   196   includes group
       
   197   assumes carr: "x \<in> carrier G" "x' \<in> carrier G"
       
   198       and xixH: "(x' \<otimes> inv x) \<in> H"
       
   199   shows "x' \<in> H #> x"
       
   200 proof -
       
   201   from xixH
       
   202       have "\<exists>h\<in>H. x' \<otimes> (inv x) = h" by fast
       
   203   from this
       
   204       obtain h
       
   205         where hH: "h \<in> H"
       
   206         and hsym: "x' \<otimes> (inv x) = h"
       
   207       by fast
       
   208   from hH subset have hcarr: "h \<in> carrier G" by simp
       
   209   note carr = carr hcarr
       
   210   from hsym[symmetric] have "h \<otimes> x = x' \<otimes> (inv x) \<otimes> x" by fast
       
   211   also from carr
       
   212       have "\<dots> = x' \<otimes> ((inv x) \<otimes> x)" by (simp add: m_assoc)
       
   213   also from carr
       
   214       have "\<dots> = x' \<otimes> \<one>" by (simp add: l_inv)
       
   215   also from carr
       
   216       have "\<dots> = x'" by simp
       
   217   finally
       
   218       have "h \<otimes> x = x'" by simp
       
   219   from this[symmetric] and hH
       
   220       show "x' \<in> H #> x"
       
   221       unfolding r_coset_def
       
   222       by fast
       
   223 qed
       
   224 
       
   225 text {* Module property of right cosets *}
       
   226 lemma (in subgroup) rcos_module:
       
   227   includes group
       
   228   assumes carr: "x \<in> carrier G" "x' \<in> carrier G"
       
   229   shows "(x' \<in> H #> x) = (x' \<otimes> inv x \<in> H)"
       
   230 proof
       
   231   assume "x' \<in> H #> x"
       
   232   from this and carr
       
   233       show "x' \<otimes> inv x \<in> H"
       
   234       by (intro rcos_module_imp[OF is_group])
       
   235 next
       
   236   assume "x' \<otimes> inv x \<in> H"
       
   237   from this and carr
       
   238       show "x' \<in> H #> x"
       
   239       by (intro rcos_module_rev[OF is_group])
       
   240 qed
       
   241 
       
   242 text {* Right cosets are subsets of the carrier. *} 
       
   243 lemma (in subgroup) rcosets_carrier:
       
   244   includes group
       
   245   assumes XH: "X \<in> rcosets H"
       
   246   shows "X \<subseteq> carrier G"
       
   247 proof -
       
   248   from XH have "\<exists>x\<in> carrier G. X = H #> x"
       
   249       unfolding RCOSETS_def
       
   250       by fast
       
   251   from this
       
   252       obtain x
       
   253         where xcarr: "x\<in> carrier G"
       
   254         and X: "X = H #> x"
       
   255       by fast
       
   256   from subset and xcarr
       
   257       show "X \<subseteq> carrier G"
       
   258       unfolding X
       
   259       by (rule r_coset_subset_G)
       
   260 qed
       
   261 
       
   262 text {* Multiplication of general subsets *}
       
   263 lemma (in monoid) set_mult_closed:
       
   264   assumes Acarr: "A \<subseteq> carrier G"
       
   265       and Bcarr: "B \<subseteq> carrier G"
       
   266   shows "A <#> B \<subseteq> carrier G"
       
   267 apply rule apply (simp add: set_mult_def, clarsimp)
       
   268 proof -
       
   269   fix a b
       
   270   assume "a \<in> A"
       
   271   from this and Acarr
       
   272       have acarr: "a \<in> carrier G" by fast
       
   273 
       
   274   assume "b \<in> B"
       
   275   from this and Bcarr
       
   276       have bcarr: "b \<in> carrier G" by fast
       
   277 
       
   278   from acarr bcarr
       
   279       show "a \<otimes> b \<in> carrier G" by (rule m_closed)
       
   280 qed
       
   281 
       
   282 lemma (in comm_group) mult_subgroups:
       
   283   assumes subH: "subgroup H G"
       
   284       and subK: "subgroup K G"
       
   285   shows "subgroup (H <#> K) G"
       
   286 apply (rule subgroup.intro)
       
   287    apply (intro set_mult_closed subgroup.subset[OF subH] subgroup.subset[OF subK])
       
   288   apply (simp add: set_mult_def) apply clarsimp defer 1
       
   289   apply (simp add: set_mult_def) defer 1
       
   290   apply (simp add: set_mult_def, clarsimp) defer 1
       
   291 proof -
       
   292   fix ha hb ka kb
       
   293   assume haH: "ha \<in> H" and hbH: "hb \<in> H" and kaK: "ka \<in> K" and kbK: "kb \<in> K"
       
   294   note carr = haH[THEN subgroup.mem_carrier[OF subH]] hbH[THEN subgroup.mem_carrier[OF subH]]
       
   295               kaK[THEN subgroup.mem_carrier[OF subK]] kbK[THEN subgroup.mem_carrier[OF subK]]
       
   296   from carr
       
   297       have "(ha \<otimes> ka) \<otimes> (hb \<otimes> kb) = ha \<otimes> (ka \<otimes> hb) \<otimes> kb" by (simp add: m_assoc)
       
   298   also from carr
       
   299       have "\<dots> = ha \<otimes> (hb \<otimes> ka) \<otimes> kb" by (simp add: m_comm)
       
   300   also from carr
       
   301       have "\<dots> = (ha \<otimes> hb) \<otimes> (ka \<otimes> kb)" by (simp add: m_assoc)
       
   302   finally
       
   303       have eq: "(ha \<otimes> ka) \<otimes> (hb \<otimes> kb) = (ha \<otimes> hb) \<otimes> (ka \<otimes> kb)" .
       
   304 
       
   305   from haH hbH have hH: "ha \<otimes> hb \<in> H" by (simp add: subgroup.m_closed[OF subH])
       
   306   from kaK kbK have kK: "ka \<otimes> kb \<in> K" by (simp add: subgroup.m_closed[OF subK])
       
   307   
       
   308   from hH and kK and eq
       
   309       show "\<exists>h'\<in>H. \<exists>k'\<in>K. (ha \<otimes> ka) \<otimes> (hb \<otimes> kb) = h' \<otimes> k'" by fast
       
   310 next
       
   311   have "\<one> = \<one> \<otimes> \<one>" by simp
       
   312   from subgroup.one_closed[OF subH] subgroup.one_closed[OF subK] this
       
   313       show "\<exists>h\<in>H. \<exists>k\<in>K. \<one> = h \<otimes> k" by fast
       
   314 next
       
   315   fix h k
       
   316   assume hH: "h \<in> H"
       
   317      and kK: "k \<in> K"
       
   318 
       
   319   from hH[THEN subgroup.mem_carrier[OF subH]] kK[THEN subgroup.mem_carrier[OF subK]]
       
   320       have "inv (h \<otimes> k) = inv h \<otimes> inv k" by (simp add: inv_mult_group m_comm)
       
   321 
       
   322   from subgroup.m_inv_closed[OF subH hH] and subgroup.m_inv_closed[OF subK kK] and this
       
   323       show "\<exists>ha\<in>H. \<exists>ka\<in>K. inv (h \<otimes> k) = ha \<otimes> ka" by fast
       
   324 qed
       
   325 
       
   326 lemma (in subgroup) lcos_module_rev:
       
   327   includes group
       
   328   assumes carr: "x \<in> carrier G" "x' \<in> carrier G"
       
   329       and xixH: "(inv x \<otimes> x') \<in> H"
       
   330   shows "x' \<in> x <# H"
       
   331 proof -
       
   332   from xixH
       
   333       have "\<exists>h\<in>H. (inv x) \<otimes> x' = h" by fast
       
   334   from this
       
   335       obtain h
       
   336         where hH: "h \<in> H"
       
   337         and hsym: "(inv x) \<otimes> x' = h"
       
   338       by fast
       
   339 
       
   340   from hH subset have hcarr: "h \<in> carrier G" by simp
       
   341   note carr = carr hcarr
       
   342   from hsym[symmetric] have "x \<otimes> h = x \<otimes> ((inv x) \<otimes> x')" by fast
       
   343   also from carr
       
   344       have "\<dots> = (x \<otimes> (inv x)) \<otimes> x'" by (simp add: m_assoc[symmetric])
       
   345   also from carr
       
   346       have "\<dots> = \<one> \<otimes> x'" by simp
       
   347   also from carr
       
   348       have "\<dots> = x'" by simp
       
   349   finally
       
   350       have "x \<otimes> h = x'" by simp
       
   351 
       
   352   from this[symmetric] and hH
       
   353       show "x' \<in> x <# H"
       
   354       unfolding l_coset_def
       
   355       by fast
       
   356 qed
   107 
   357 
   108 
   358 
   109 subsection {* Normal subgroups *}
   359 subsection {* Normal subgroups *}
   110 
   360 
   111 lemma normal_imp_subgroup: "H \<lhd> G \<Longrightarrow> subgroup H G"
   361 lemma normal_imp_subgroup: "H \<lhd> G \<Longrightarrow> subgroup H G"
   248 apply (auto simp add: subgroup.m_closed subgroup.one_closed
   498 apply (auto simp add: subgroup.m_closed subgroup.one_closed
   249                       r_one subgroup.subset [THEN subsetD])
   499                       r_one subgroup.subset [THEN subsetD])
   250 done
   500 done
   251 
   501 
   252 
   502 
   253 subsubsection {* Set of inverses of an @{text r_coset}. *}
   503 subsubsection {* Set of Inverses of an @{text r_coset}. *}
   254 
   504 
   255 lemma (in normal) rcos_inv:
   505 lemma (in normal) rcos_inv:
   256   assumes x:     "x \<in> carrier G"
   506   assumes x:     "x \<in> carrier G"
   257   shows "set_inv (H #> x) = H #> (inv x)" 
   507   shows "set_inv (H #> x) = H #> (inv x)" 
   258 proof (simp add: r_coset_def SET_INV_def x inv_mult_group, safe)
   508 proof (simp add: r_coset_def SET_INV_def x inv_mult_group, safe)
   372   assumes a: "a \<in> carrier G"
   622   assumes a: "a \<in> carrier G"
   373   shows "a <# H = rcong H `` {a}"
   623   shows "a <# H = rcong H `` {a}"
   374 by (force simp add: r_congruent_def l_coset_def m_assoc [symmetric] a ) 
   624 by (force simp add: r_congruent_def l_coset_def m_assoc [symmetric] a ) 
   375 
   625 
   376 
   626 
   377 subsubsection{*Two distinct right cosets are disjoint*}
   627 subsubsection{*Two Distinct Right Cosets are Disjoint*}
   378 
   628 
   379 lemma (in group) rcos_equation:
   629 lemma (in group) rcos_equation:
   380   includes subgroup H G
   630   includes subgroup H G
   381   shows
   631   shows
   382      "\<lbrakk>ha \<otimes> a = h \<otimes> b; a \<in> carrier G;  b \<in> carrier G;  
   632      "\<lbrakk>ha \<otimes> a = h \<otimes> b; a \<in> carrier G;  b \<in> carrier G;  
   391   includes subgroup H G
   641   includes subgroup H G
   392   shows "\<lbrakk>a \<in> rcosets H; b \<in> rcosets H; a\<noteq>b\<rbrakk> \<Longrightarrow> a \<inter> b = {}"
   642   shows "\<lbrakk>a \<in> rcosets H; b \<in> rcosets H; a\<noteq>b\<rbrakk> \<Longrightarrow> a \<inter> b = {}"
   393 apply (simp add: RCOSETS_def r_coset_def)
   643 apply (simp add: RCOSETS_def r_coset_def)
   394 apply (blast intro: rcos_equation prems sym)
   644 apply (blast intro: rcos_equation prems sym)
   395 done
   645 done
       
   646 
       
   647 subsection {* Further lemmas for @{text "r_congruent"} *}
       
   648 
       
   649 text {* The relation is a congruence *}
       
   650 
       
   651 lemma (in normal) congruent_rcong:
       
   652   shows "congruent2 (rcong H) (rcong H) (\<lambda>a b. a \<otimes> b <# H)"
       
   653 proof (intro congruent2I[of "carrier G" _ "carrier G" _] equiv_rcong is_group)
       
   654   fix a b c
       
   655   assume abrcong: "(a, b) \<in> rcong H"
       
   656     and ccarr: "c \<in> carrier G"
       
   657 
       
   658   from abrcong
       
   659       have acarr: "a \<in> carrier G"
       
   660         and bcarr: "b \<in> carrier G"
       
   661         and abH: "inv a \<otimes> b \<in> H"
       
   662       unfolding r_congruent_def
       
   663       by fast+
       
   664 
       
   665   note carr = acarr bcarr ccarr
       
   666 
       
   667   from ccarr and abH
       
   668       have "inv c \<otimes> (inv a \<otimes> b) \<otimes> c \<in> H" by (rule inv_op_closed1)
       
   669   moreover
       
   670       from carr and inv_closed
       
   671       have "inv c \<otimes> (inv a \<otimes> b) \<otimes> c = (inv c \<otimes> inv a) \<otimes> (b \<otimes> c)" 
       
   672       by (force cong: m_assoc)
       
   673   moreover 
       
   674       from carr and inv_closed
       
   675       have "\<dots> = (inv (a \<otimes> c)) \<otimes> (b \<otimes> c)"
       
   676       by (simp add: inv_mult_group)
       
   677   ultimately
       
   678       have "(inv (a \<otimes> c)) \<otimes> (b \<otimes> c) \<in> H" by simp
       
   679   from carr and this
       
   680      have "(b \<otimes> c) \<in> (a \<otimes> c) <# H"
       
   681      by (simp add: lcos_module_rev[OF is_group])
       
   682   from carr and this and is_subgroup
       
   683      show "(a \<otimes> c) <# H = (b \<otimes> c) <# H" by (intro l_repr_independence, simp+)
       
   684 next
       
   685   fix a b c
       
   686   assume abrcong: "(a, b) \<in> rcong H"
       
   687     and ccarr: "c \<in> carrier G"
       
   688 
       
   689   from ccarr have "c \<in> Units G" by (simp add: Units_eq)
       
   690   hence cinvc_one: "inv c \<otimes> c = \<one>" by (rule Units_l_inv)
       
   691 
       
   692   from abrcong
       
   693       have acarr: "a \<in> carrier G"
       
   694        and bcarr: "b \<in> carrier G"
       
   695        and abH: "inv a \<otimes> b \<in> H"
       
   696       by (unfold r_congruent_def, fast+)
       
   697 
       
   698   note carr = acarr bcarr ccarr
       
   699 
       
   700   from carr and inv_closed
       
   701      have "inv a \<otimes> b = inv a \<otimes> (\<one> \<otimes> b)" by simp
       
   702   also from carr and inv_closed
       
   703       have "\<dots> = inv a \<otimes> (inv c \<otimes> c) \<otimes> b" by simp
       
   704   also from carr and inv_closed
       
   705       have "\<dots> = (inv a \<otimes> inv c) \<otimes> (c \<otimes> b)" by (force cong: m_assoc)
       
   706   also from carr and inv_closed
       
   707       have "\<dots> = inv (c \<otimes> a) \<otimes> (c \<otimes> b)" by (simp add: inv_mult_group)
       
   708   finally
       
   709       have "inv a \<otimes> b = inv (c \<otimes> a) \<otimes> (c \<otimes> b)" .
       
   710   from abH and this
       
   711       have "inv (c \<otimes> a) \<otimes> (c \<otimes> b) \<in> H" by simp
       
   712 
       
   713   from carr and this
       
   714      have "(c \<otimes> b) \<in> (c \<otimes> a) <# H"
       
   715      by (simp add: lcos_module_rev[OF is_group])
       
   716   from carr and this and is_subgroup
       
   717      show "(c \<otimes> a) <# H = (c \<otimes> b) <# H" by (intro l_repr_independence, simp+)
       
   718 qed
   396 
   719 
   397 
   720 
   398 subsection {*Order of a Group and Lagrange's Theorem*}
   721 subsection {*Order of a Group and Lagrange's Theorem*}
   399 
   722 
   400 constdefs
   723 constdefs