src/HOL/Algebra/Coset.thy
changeset 65035 b46fe5138cb0
parent 64587 8355a6e2df79
child 67091 1393c2340eec
equal deleted inserted replaced
65034:1846c4551153 65035:b46fe5138cb0
    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 
    17 definition
    17 definition
    18   l_coset    :: "[_, 'a, 'a set] \<Rightarrow> 'a set"    (infixl "\<subset>#\<index>" 60)
    18   l_coset    :: "[_, 'a, 'a set] \<Rightarrow> 'a set"    (infixl "<#\<index>" 60)
    19   where "a \<subset>#\<^bsub>G\<^esub> H = (\<Union>h\<in>H. {a \<otimes>\<^bsub>G\<^esub> h})"
    19   where "a <#\<^bsub>G\<^esub> H = (\<Union>h\<in>H. {a \<otimes>\<^bsub>G\<^esub> h})"
    20 
    20 
    21 definition
    21 definition
    22   RCOSETS  :: "[_, 'a set] \<Rightarrow> ('a set)set"   ("rcosets\<index> _" [81] 80)
    22   RCOSETS  :: "[_, 'a set] \<Rightarrow> ('a set)set"   ("rcosets\<index> _" [81] 80)
    23   where "rcosets\<^bsub>G\<^esub> H = (\<Union>a\<in>carrier G. {H #>\<^bsub>G\<^esub> a})"
    23   where "rcosets\<^bsub>G\<^esub> H = (\<Union>a\<in>carrier G. {H #>\<^bsub>G\<^esub> a})"
    24 
    24 
    25 definition
    25 definition
    26   set_mult  :: "[_, 'a set ,'a set] \<Rightarrow> 'a set" (infixl "\<subset>#>\<index>" 60)
    26   set_mult  :: "[_, 'a set ,'a set] \<Rightarrow> 'a set" (infixl "<#>\<index>" 60)
    27   where "H \<subset>#>\<^bsub>G\<^esub> K = (\<Union>h\<in>H. \<Union>k\<in>K. {h \<otimes>\<^bsub>G\<^esub> k})"
    27   where "H <#>\<^bsub>G\<^esub> K = (\<Union>h\<in>H. \<Union>k\<in>K. {h \<otimes>\<^bsub>G\<^esub> k})"
    28 
    28 
    29 definition
    29 definition
    30   SET_INV :: "[_,'a set] \<Rightarrow> 'a set"  ("set'_inv\<index> _" [81] 80)
    30   SET_INV :: "[_,'a set] \<Rightarrow> 'a set"  ("set'_inv\<index> _" [81] 80)
    31   where "set_inv\<^bsub>G\<^esub> H = (\<Union>h\<in>H. {inv\<^bsub>G\<^esub> h})"
    31   where "set_inv\<^bsub>G\<^esub> H = (\<Union>h\<in>H. {inv\<^bsub>G\<^esub> h})"
    32 
    32 
    33 
    33 
    34 locale normal = subgroup + group +
    34 locale normal = subgroup + group +
    35   assumes coset_eq: "(\<forall>x \<in> carrier G. H #> x = x \<subset># H)"
    35   assumes coset_eq: "(\<forall>x \<in> carrier G. H #> x = x <# H)"
    36 
    36 
    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 
   285 
   285 
   286 text \<open>Multiplication of general subsets\<close>
   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 \<subset>#> 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)
   292 proof -
   292 proof -
   293   fix a b
   293   fix a b
   294   assume "a \<in> A"
   294   assume "a \<in> A"
   295   from this and Acarr
   295   from this and Acarr
   304 qed
   304 qed
   305 
   305 
   306 lemma (in comm_group) mult_subgroups:
   306 lemma (in comm_group) mult_subgroups:
   307   assumes subH: "subgroup H G"
   307   assumes subH: "subgroup H G"
   308       and subK: "subgroup K G"
   308       and subK: "subgroup K G"
   309   shows "subgroup (H \<subset>#> K) G"
   309   shows "subgroup (H <#> K) G"
   310 apply (rule subgroup.intro)
   310 apply (rule subgroup.intro)
   311    apply (intro set_mult_closed subgroup.subset[OF subH] subgroup.subset[OF subK])
   311    apply (intro set_mult_closed subgroup.subset[OF subH] subgroup.subset[OF subK])
   312   apply (simp add: set_mult_def) apply clarsimp defer 1
   312   apply (simp add: set_mult_def) apply clarsimp defer 1
   313   apply (simp add: set_mult_def) defer 1
   313   apply (simp add: set_mult_def) defer 1
   314   apply (simp add: set_mult_def, clarsimp) defer 1
   314   apply (simp add: set_mult_def, clarsimp) defer 1
   349 
   349 
   350 lemma (in subgroup) lcos_module_rev:
   350 lemma (in subgroup) lcos_module_rev:
   351   assumes "group G"
   351   assumes "group G"
   352   assumes carr: "x \<in> carrier G" "x' \<in> carrier G"
   352   assumes carr: "x \<in> carrier G" "x' \<in> carrier G"
   353       and xixH: "(inv x \<otimes> x') \<in> H"
   353       and xixH: "(inv x \<otimes> x') \<in> H"
   354   shows "x' \<in> x \<subset># H"
   354   shows "x' \<in> x <# H"
   355 proof -
   355 proof -
   356   interpret group G by fact
   356   interpret group G by fact
   357   from xixH
   357   from xixH
   358       have "\<exists>h\<in>H. (inv x) \<otimes> x' = h" by fast
   358       have "\<exists>h\<in>H. (inv x) \<otimes> x' = h" by fast
   359   from this
   359   from this
   373       have "\<dots> = x'" by simp
   373       have "\<dots> = x'" by simp
   374   finally
   374   finally
   375       have "x \<otimes> h = x'" by simp
   375       have "x \<otimes> h = x'" by simp
   376 
   376 
   377   from this[symmetric] and hH
   377   from this[symmetric] and hH
   378       show "x' \<in> x \<subset># H"
   378       show "x' \<in> x <# H"
   379       unfolding l_coset_def
   379       unfolding l_coset_def
   380       by fast
   380       by fast
   381 qed
   381 qed
   382 
   382 
   383 
   383 
   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: 
   390   "subgroup H G \<Longrightarrow> (\<forall>x \<in> carrier G. H #> x = x \<subset># H) \<Longrightarrow> H \<lhd> G"
   390   "subgroup H G \<Longrightarrow> (\<forall>x \<in> carrier G. H #> x = x <# H) \<Longrightarrow> H \<lhd> G"
   391   by (simp add: normal_def normal_axioms_def is_group)
   391   by (simp add: normal_def normal_axioms_def is_group)
   392 
   392 
   393 lemma (in normal) inv_op_closed1:
   393 lemma (in normal) inv_op_closed1:
   394      "\<lbrakk>x \<in> carrier G; h \<in> H\<rbrakk> \<Longrightarrow> (inv x) \<otimes> h \<otimes> x \<in> H"
   394      "\<lbrakk>x \<in> carrier G; h \<in> H\<rbrakk> \<Longrightarrow> (inv x) \<otimes> h \<otimes> x \<in> H"
   395 apply (insert coset_eq) 
   395 apply (insert coset_eq) 
   458 
   458 
   459 subsection\<open>More Properties of Cosets\<close>
   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 \<subset># (h \<subset># M) = (g \<otimes> h) \<subset># 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)
   465 
   465 
   466 lemma (in group) lcos_mult_one: "M \<subseteq> carrier G ==> \<one> \<subset># M = M"
   466 lemma (in group) lcos_mult_one: "M \<subseteq> carrier G ==> \<one> <# M = M"
   467 by (force simp add: l_coset_def)
   467 by (force simp add: l_coset_def)
   468 
   468 
   469 lemma (in group) l_coset_subset_G:
   469 lemma (in group) l_coset_subset_G:
   470      "[| H \<subseteq> carrier G; x \<in> carrier G |] ==> x \<subset># H \<subseteq> carrier G"
   470      "[| H \<subseteq> carrier G; x \<in> carrier G |] ==> x <# H \<subseteq> carrier G"
   471 by (auto simp add: l_coset_def subsetD)
   471 by (auto simp add: l_coset_def subsetD)
   472 
   472 
   473 lemma (in group) l_coset_swap:
   473 lemma (in group) l_coset_swap:
   474      "\<lbrakk>y \<in> x \<subset># H;  x \<in> carrier G;  subgroup H G\<rbrakk> \<Longrightarrow> x \<in> y \<subset># H"
   474      "\<lbrakk>y \<in> x <# H;  x \<in> carrier G;  subgroup H G\<rbrakk> \<Longrightarrow> x \<in> y <# H"
   475 proof (simp add: l_coset_def)
   475 proof (simp add: l_coset_def)
   476   assume "\<exists>h\<in>H. y = x \<otimes> h"
   476   assume "\<exists>h\<in>H. y = x \<otimes> h"
   477     and x: "x \<in> carrier G"
   477     and x: "x \<in> carrier G"
   478     and sb: "subgroup H G"
   478     and sb: "subgroup H G"
   479   then obtain h' where h': "h' \<in> H & x \<otimes> h' = y" by blast
   479   then obtain h' where h': "h' \<in> H & x \<otimes> h' = y" by blast
   485       by (auto simp add: subgroup.subset [THEN subsetD] subgroup.m_inv_closed)
   485       by (auto simp add: subgroup.subset [THEN subsetD] subgroup.m_inv_closed)
   486   qed
   486   qed
   487 qed
   487 qed
   488 
   488 
   489 lemma (in group) l_coset_carrier:
   489 lemma (in group) l_coset_carrier:
   490      "[| y \<in> x \<subset># H;  x \<in> carrier G;  subgroup H G |] ==> y \<in> carrier G"
   490      "[| y \<in> x <# H;  x \<in> carrier G;  subgroup H G |] ==> y \<in> carrier G"
   491 by (auto simp add: l_coset_def m_assoc
   491 by (auto simp add: l_coset_def m_assoc
   492                    subgroup.subset [THEN subsetD] subgroup.m_closed)
   492                    subgroup.subset [THEN subsetD] subgroup.m_closed)
   493 
   493 
   494 lemma (in group) l_repr_imp_subset:
   494 lemma (in group) l_repr_imp_subset:
   495   assumes y: "y \<in> x \<subset># H" and x: "x \<in> carrier G" and sb: "subgroup H G"
   495   assumes y: "y \<in> x <# H" and x: "x \<in> carrier G" and sb: "subgroup H G"
   496   shows "y \<subset># H \<subseteq> x \<subset># H"
   496   shows "y <# H \<subseteq> x <# H"
   497 proof -
   497 proof -
   498   from y
   498   from y
   499   obtain h' where "h' \<in> H" "x \<otimes> h' = y" by (auto simp add: l_coset_def)
   499   obtain h' where "h' \<in> H" "x \<otimes> h' = y" by (auto simp add: l_coset_def)
   500   thus ?thesis using x sb
   500   thus ?thesis using x sb
   501     by (auto simp add: l_coset_def m_assoc
   501     by (auto simp add: l_coset_def m_assoc
   502                        subgroup.subset [THEN subsetD] subgroup.m_closed)
   502                        subgroup.subset [THEN subsetD] subgroup.m_closed)
   503 qed
   503 qed
   504 
   504 
   505 lemma (in group) l_repr_independence:
   505 lemma (in group) l_repr_independence:
   506   assumes y: "y \<in> x \<subset># H" and x: "x \<in> carrier G" and sb: "subgroup H G"
   506   assumes y: "y \<in> x <# H" and x: "x \<in> carrier G" and sb: "subgroup H G"
   507   shows "x \<subset># H = y \<subset># H"
   507   shows "x <# H = y <# H"
   508 proof
   508 proof
   509   show "x \<subset># H \<subseteq> y \<subset># H"
   509   show "x <# H \<subseteq> y <# H"
   510     by (rule l_repr_imp_subset,
   510     by (rule l_repr_imp_subset,
   511         (blast intro: l_coset_swap l_coset_carrier y x sb)+)
   511         (blast intro: l_coset_swap l_coset_carrier y x sb)+)
   512   show "y \<subset># H \<subseteq> x \<subset># H" by (rule l_repr_imp_subset [OF y x sb])
   512   show "y <# H \<subseteq> x <# H" by (rule l_repr_imp_subset [OF y x sb])
   513 qed
   513 qed
   514 
   514 
   515 lemma (in group) setmult_subset_G:
   515 lemma (in group) setmult_subset_G:
   516      "\<lbrakk>H \<subseteq> carrier G; K \<subseteq> carrier G\<rbrakk> \<Longrightarrow> H \<subset>#> K \<subseteq> carrier G"
   516      "\<lbrakk>H \<subseteq> carrier G; K \<subseteq> carrier G\<rbrakk> \<Longrightarrow> H <#> K \<subseteq> carrier G"
   517 by (auto simp add: set_mult_def subsetD)
   517 by (auto simp add: set_mult_def subsetD)
   518 
   518 
   519 lemma (in group) subgroup_mult_id: "subgroup H G \<Longrightarrow> H \<subset>#> H = H"
   519 lemma (in group) subgroup_mult_id: "subgroup H G \<Longrightarrow> H <#> H = H"
   520 apply (auto simp add: subgroup.m_closed set_mult_def Sigma_def)
   520 apply (auto simp add: subgroup.m_closed set_mult_def Sigma_def)
   521 apply (rule_tac x = x in bexI)
   521 apply (rule_tac x = x in bexI)
   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
   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 \<open>Theorems for \<open>\<subset>#>\<close> with \<open>#>\<close> or \<open>\<subset>#\<close>.\<close>
   552 subsubsection \<open>Theorems for \<open><#>\<close> with \<open>#>\<close> or \<open><#\<close>.\<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 \<subset>#> (K #> x) = (H \<subset>#> 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)
   558 
   558 
   559 lemma (in group) rcos_assoc_lcos:
   559 lemma (in group) rcos_assoc_lcos:
   560      "\<lbrakk>H \<subseteq> carrier G; K \<subseteq> carrier G; x \<in> carrier G\<rbrakk>
   560      "\<lbrakk>H \<subseteq> carrier G; K \<subseteq> carrier G; x \<in> carrier G\<rbrakk>
   561       \<Longrightarrow> (H #> x) \<subset>#> K = H \<subset>#> (x \<subset># K)"
   561       \<Longrightarrow> (H #> x) <#> K = H <#> (x <# K)"
   562 by (force simp add: r_coset_def l_coset_def set_mult_def m_assoc)
   562 by (force simp add: r_coset_def l_coset_def set_mult_def m_assoc)
   563 
   563 
   564 lemma (in normal) rcos_mult_step1:
   564 lemma (in normal) rcos_mult_step1:
   565      "\<lbrakk>x \<in> carrier G; y \<in> carrier G\<rbrakk>
   565      "\<lbrakk>x \<in> carrier G; y \<in> carrier G\<rbrakk>
   566       \<Longrightarrow> (H #> x) \<subset>#> (H #> y) = (H \<subset>#> (x \<subset># H)) #> y"
   566       \<Longrightarrow> (H #> x) <#> (H #> y) = (H <#> (x <# H)) #> y"
   567 by (simp add: setmult_rcos_assoc subset
   567 by (simp add: setmult_rcos_assoc subset
   568               r_coset_subset_G l_coset_subset_G rcos_assoc_lcos)
   568               r_coset_subset_G l_coset_subset_G rcos_assoc_lcos)
   569 
   569 
   570 lemma (in normal) rcos_mult_step2:
   570 lemma (in normal) rcos_mult_step2:
   571      "\<lbrakk>x \<in> carrier G; y \<in> carrier G\<rbrakk>
   571      "\<lbrakk>x \<in> carrier G; y \<in> carrier G\<rbrakk>
   572       \<Longrightarrow> (H \<subset>#> (x \<subset># H)) #> y = (H \<subset>#> (H #> x)) #> y"
   572       \<Longrightarrow> (H <#> (x <# H)) #> y = (H <#> (H #> x)) #> y"
   573 by (insert coset_eq, simp add: normal_def)
   573 by (insert coset_eq, simp add: normal_def)
   574 
   574 
   575 lemma (in normal) rcos_mult_step3:
   575 lemma (in normal) rcos_mult_step3:
   576      "\<lbrakk>x \<in> carrier G; y \<in> carrier G\<rbrakk>
   576      "\<lbrakk>x \<in> carrier G; y \<in> carrier G\<rbrakk>
   577       \<Longrightarrow> (H \<subset>#> (H #> x)) #> y = H #> (x \<otimes> y)"
   577       \<Longrightarrow> (H <#> (H #> x)) #> y = H #> (x \<otimes> y)"
   578 by (simp add: setmult_rcos_assoc coset_mult_assoc
   578 by (simp add: setmult_rcos_assoc coset_mult_assoc
   579               subgroup_mult_id normal.axioms subset normal_axioms)
   579               subgroup_mult_id normal.axioms subset normal_axioms)
   580 
   580 
   581 lemma (in normal) rcos_sum:
   581 lemma (in normal) rcos_sum:
   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) \<subset>#> (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 \<subset>#> M = M"
   586 lemma (in normal) rcosets_mult_eq: "M \<in> rcosets H \<Longrightarrow> H <#> M = M"
   587   \<comment> \<open>generalizes \<open>subgroup_mult_id\<close>\<close>
   587   \<comment> \<open>generalizes \<open>subgroup_mult_id\<close>\<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 
   643 *)
   643 *)
   644 
   644 
   645 lemma (in subgroup) l_coset_eq_rcong:
   645 lemma (in subgroup) l_coset_eq_rcong:
   646   assumes "group G"
   646   assumes "group G"
   647   assumes a: "a \<in> carrier G"
   647   assumes a: "a \<in> carrier G"
   648   shows "a \<subset># H = rcong H `` {a}"
   648   shows "a <# H = rcong H `` {a}"
   649 proof -
   649 proof -
   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 
   682 subsection \<open>Further lemmas for \<open>r_congruent\<close>\<close>
   682 subsection \<open>Further lemmas for \<open>r_congruent\<close>\<close>
   683 
   683 
   684 text \<open>The relation is a congruence\<close>
   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 \<subset># 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
   690   assume abrcong: "(a, b) \<in> rcong H"
   690   assume abrcong: "(a, b) \<in> rcong H"
   691     and ccarr: "c \<in> carrier G"
   691     and ccarr: "c \<in> carrier G"
   692 
   692 
   710       have "\<dots> = (inv (a \<otimes> c)) \<otimes> (b \<otimes> c)"
   710       have "\<dots> = (inv (a \<otimes> c)) \<otimes> (b \<otimes> c)"
   711       by (simp add: inv_mult_group)
   711       by (simp add: inv_mult_group)
   712   ultimately
   712   ultimately
   713       have "(inv (a \<otimes> c)) \<otimes> (b \<otimes> c) \<in> H" by simp
   713       have "(inv (a \<otimes> c)) \<otimes> (b \<otimes> c) \<in> H" by simp
   714   from carr and this
   714   from carr and this
   715      have "(b \<otimes> c) \<in> (a \<otimes> c) \<subset># H"
   715      have "(b \<otimes> c) \<in> (a \<otimes> c) <# H"
   716      by (simp add: lcos_module_rev[OF is_group])
   716      by (simp add: lcos_module_rev[OF is_group])
   717   from carr and this and is_subgroup
   717   from carr and this and is_subgroup
   718      show "(a \<otimes> c) \<subset># H = (b \<otimes> c) \<subset># H" by (intro l_repr_independence, simp+)
   718      show "(a \<otimes> c) <# H = (b \<otimes> c) <# H" by (intro l_repr_independence, simp+)
   719 next
   719 next
   720   fix a b c
   720   fix a b c
   721   assume abrcong: "(a, b) \<in> rcong H"
   721   assume abrcong: "(a, b) \<in> rcong H"
   722     and ccarr: "c \<in> carrier G"
   722     and ccarr: "c \<in> carrier G"
   723 
   723 
   744       have "inv a \<otimes> b = inv (c \<otimes> a) \<otimes> (c \<otimes> b)" .
   744       have "inv a \<otimes> b = inv (c \<otimes> a) \<otimes> (c \<otimes> b)" .
   745   from abH and this
   745   from abH and this
   746       have "inv (c \<otimes> a) \<otimes> (c \<otimes> b) \<in> H" by simp
   746       have "inv (c \<otimes> a) \<otimes> (c \<otimes> b) \<in> H" by simp
   747 
   747 
   748   from carr and this
   748   from carr and this
   749      have "(c \<otimes> b) \<in> (c \<otimes> a) \<subset># H"
   749      have "(c \<otimes> b) \<in> (c \<otimes> a) <# H"
   750      by (simp add: lcos_module_rev[OF is_group])
   750      by (simp add: lcos_module_rev[OF is_group])
   751   from carr and this and is_subgroup
   751   from carr and this and is_subgroup
   752      show "(c \<otimes> a) \<subset># H = (c \<otimes> b) \<subset># 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 \<open>Order of a Group and Lagrange's Theorem\<close>
   756 subsection \<open>Order of a Group and Lagrange's Theorem\<close>
   757 
   757 
   833   FactGroup :: "[('a,'b) monoid_scheme, 'a set] \<Rightarrow> ('a set) monoid" (infixl "Mod" 65)
   833   FactGroup :: "[('a,'b) monoid_scheme, 'a set] \<Rightarrow> ('a set) monoid" (infixl "Mod" 65)
   834     \<comment>\<open>Actually defined for groups rather than monoids\<close>
   834     \<comment>\<open>Actually defined for groups rather than monoids\<close>
   835    where "FactGroup G H = \<lparr>carrier = rcosets\<^bsub>G\<^esub> H, mult = set_mult G, one = H\<rparr>"
   835    where "FactGroup G H = \<lparr>carrier = rcosets\<^bsub>G\<^esub> H, mult = set_mult G, one = H\<rparr>"
   836 
   836 
   837 lemma (in normal) setmult_closed:
   837 lemma (in normal) setmult_closed:
   838      "\<lbrakk>K1 \<in> rcosets H; K2 \<in> rcosets H\<rbrakk> \<Longrightarrow> K1 \<subset>#> K2 \<in> rcosets H"
   838      "\<lbrakk>K1 \<in> rcosets H; K2 \<in> rcosets H\<rbrakk> \<Longrightarrow> K1 <#> K2 \<in> rcosets H"
   839 by (auto simp add: rcos_sum RCOSETS_def)
   839 by (auto simp add: rcos_sum RCOSETS_def)
   840 
   840 
   841 lemma (in normal) setinv_closed:
   841 lemma (in normal) setinv_closed:
   842      "K \<in> rcosets H \<Longrightarrow> set_inv K \<in> rcosets H"
   842      "K \<in> rcosets H \<Longrightarrow> set_inv K \<in> rcosets H"
   843 by (auto simp add: rcos_inv RCOSETS_def)
   843 by (auto simp add: rcos_inv RCOSETS_def)
   844 
   844 
   845 lemma (in normal) rcosets_assoc:
   845 lemma (in normal) rcosets_assoc:
   846      "\<lbrakk>M1 \<in> rcosets H; M2 \<in> rcosets H; M3 \<in> rcosets H\<rbrakk>
   846      "\<lbrakk>M1 \<in> rcosets H; M2 \<in> rcosets H; M3 \<in> rcosets H\<rbrakk>
   847       \<Longrightarrow> M1 \<subset>#> M2 \<subset>#> M3 = M1 \<subset>#> (M2 \<subset>#> M3)"
   847       \<Longrightarrow> M1 <#> M2 <#> M3 = M1 <#> (M2 <#> M3)"
   848 by (auto simp add: RCOSETS_def rcos_sum m_assoc)
   848 by (auto simp add: RCOSETS_def rcos_sum m_assoc)
   849 
   849 
   850 lemma (in subgroup) subgroup_in_rcosets:
   850 lemma (in subgroup) subgroup_in_rcosets:
   851   assumes "group G"
   851   assumes "group G"
   852   shows "H \<in> rcosets H"
   852   shows "H \<in> rcosets H"
   857   then show ?thesis
   857   then show ?thesis
   858     by (auto simp add: RCOSETS_def)
   858     by (auto simp add: RCOSETS_def)
   859 qed
   859 qed
   860 
   860 
   861 lemma (in normal) rcosets_inv_mult_group_eq:
   861 lemma (in normal) rcosets_inv_mult_group_eq:
   862      "M \<in> rcosets H \<Longrightarrow> set_inv M \<subset>#> M = H"
   862      "M \<in> rcosets H \<Longrightarrow> set_inv M <#> M = H"
   863 by (auto simp add: RCOSETS_def rcos_inv rcos_sum subgroup.subset normal.axioms normal_axioms)
   863 by (auto simp add: RCOSETS_def rcos_inv rcos_sum subgroup.subset normal.axioms normal_axioms)
   864 
   864 
   865 theorem (in normal) factorgroup_is_group:
   865 theorem (in normal) factorgroup_is_group:
   866   "group (G Mod H)"
   866   "group (G Mod H)"
   867 apply (simp add: FactGroup_def)
   867 apply (simp add: FactGroup_def)
   872  apply (simp add: normal_imp_subgroup
   872  apply (simp add: normal_imp_subgroup
   873                   subgroup_in_rcosets rcosets_mult_eq)
   873                   subgroup_in_rcosets rcosets_mult_eq)
   874 apply (auto dest: rcosets_inv_mult_group_eq simp add: setinv_closed)
   874 apply (auto dest: rcosets_inv_mult_group_eq simp add: setinv_closed)
   875 done
   875 done
   876 
   876 
   877 lemma mult_FactGroup [simp]: "X \<otimes>\<^bsub>(G Mod H)\<^esub> X' = X \<subset>#>\<^bsub>G\<^esub> X'"
   877 lemma mult_FactGroup [simp]: "X \<otimes>\<^bsub>(G Mod H)\<^esub> X' = X <#>\<^bsub>G\<^esub> X'"
   878   by (simp add: FactGroup_def) 
   878   by (simp add: FactGroup_def) 
   879 
   879 
   880 lemma (in normal) inv_FactGroup:
   880 lemma (in normal) inv_FactGroup:
   881      "X \<in> carrier (G Mod H) \<Longrightarrow> inv\<^bsub>G Mod H\<^esub> X = set_inv X"
   881      "X \<in> carrier (G Mod H) \<Longrightarrow> inv\<^bsub>G Mod H\<^esub> X = set_inv X"
   882 apply (rule group.inv_equality [OF factorgroup_is_group]) 
   882 apply (rule group.inv_equality [OF factorgroup_is_group]) 
   949              and "X = kernel G H h #> g" and "X' = kernel G H h #> g'"
   949              and "X = kernel G H h #> g" and "X' = kernel G H h #> g'"
   950     by (auto simp add: FactGroup_def RCOSETS_def)
   950     by (auto simp add: FactGroup_def RCOSETS_def)
   951   hence all: "\<forall>x\<in>X. h x = h g" "\<forall>x\<in>X'. h x = h g'" 
   951   hence all: "\<forall>x\<in>X. h x = h g" "\<forall>x\<in>X'. h x = h g'" 
   952     and Xsub: "X \<subseteq> carrier G" and X'sub: "X' \<subseteq> carrier G"
   952     and Xsub: "X \<subseteq> carrier G" and X'sub: "X' \<subseteq> carrier G"
   953     by (force simp add: kernel_def r_coset_def image_def)+
   953     by (force simp add: kernel_def r_coset_def image_def)+
   954   hence "h ` (X \<subset>#> X') = {h g \<otimes>\<^bsub>H\<^esub> h g'}" using X X'
   954   hence "h ` (X <#> X') = {h g \<otimes>\<^bsub>H\<^esub> h g'}" using X X'
   955     by (auto dest!: FactGroup_nonempty intro!: image_eqI
   955     by (auto dest!: FactGroup_nonempty intro!: image_eqI
   956              simp add: set_mult_def 
   956              simp add: set_mult_def 
   957                        subsetD [OF Xsub] subsetD [OF X'sub]) 
   957                        subsetD [OF Xsub] subsetD [OF X'sub]) 
   958   then show "the_elem (h ` (X \<subset>#> X')) = the_elem (h ` X) \<otimes>\<^bsub>H\<^esub> the_elem (h ` X')"
   958   then show "the_elem (h ` (X <#> X')) = the_elem (h ` X) \<otimes>\<^bsub>H\<^esub> the_elem (h ` X')"
   959     by (auto simp add: all FactGroup_nonempty X X' the_elem_image_unique)
   959     by (auto simp add: all FactGroup_nonempty X X' the_elem_image_unique)
   960 qed
   960 qed
   961 
   961 
   962 
   962 
   963 text\<open>Lemma for the following injectivity result\<close>
   963 text\<open>Lemma for the following injectivity result\<close>