src/HOL/Algebra/Group.thy
changeset 67091 1393c2340eec
parent 66579 2db3fe23fdaf
child 67341 df79ef3b3a41
equal deleted inserted replaced
67090:0ec94bb9cec4 67091:1393c2340eec
    20   mult    :: "['a, 'a] \<Rightarrow> 'a" (infixl "\<otimes>\<index>" 70)
    20   mult    :: "['a, 'a] \<Rightarrow> 'a" (infixl "\<otimes>\<index>" 70)
    21   one     :: 'a ("\<one>\<index>")
    21   one     :: 'a ("\<one>\<index>")
    22 
    22 
    23 definition
    23 definition
    24   m_inv :: "('a, 'b) monoid_scheme => 'a => 'a" ("inv\<index> _" [81] 80)
    24   m_inv :: "('a, 'b) monoid_scheme => 'a => 'a" ("inv\<index> _" [81] 80)
    25   where "inv\<^bsub>G\<^esub> x = (THE y. y \<in> carrier G & x \<otimes>\<^bsub>G\<^esub> y = \<one>\<^bsub>G\<^esub> & y \<otimes>\<^bsub>G\<^esub> x = \<one>\<^bsub>G\<^esub>)"
    25   where "inv\<^bsub>G\<^esub> x = (THE y. y \<in> carrier G \<and> x \<otimes>\<^bsub>G\<^esub> y = \<one>\<^bsub>G\<^esub> \<and> y \<otimes>\<^bsub>G\<^esub> x = \<one>\<^bsub>G\<^esub>)"
    26 
    26 
    27 definition
    27 definition
    28   Units :: "_ => 'a set"
    28   Units :: "_ => 'a set"
    29   \<comment>\<open>The set of invertible elements\<close>
    29   \<comment>\<open>The set of invertible elements\<close>
    30   where "Units G = {y. y \<in> carrier G & (\<exists>x \<in> carrier G. x \<otimes>\<^bsub>G\<^esub> y = \<one>\<^bsub>G\<^esub> & y \<otimes>\<^bsub>G\<^esub> x = \<one>\<^bsub>G\<^esub>)}"
    30   where "Units G = {y. y \<in> carrier G \<and> (\<exists>x \<in> carrier G. x \<otimes>\<^bsub>G\<^esub> y = \<one>\<^bsub>G\<^esub> \<and> y \<otimes>\<^bsub>G\<^esub> x = \<one>\<^bsub>G\<^esub>)}"
    31 
    31 
    32 consts
    32 consts
    33   pow :: "[('a, 'm) monoid_scheme, 'a, 'b::semiring_1] => 'a"  (infixr "'(^')\<index>" 75)
    33   pow :: "[('a, 'm) monoid_scheme, 'a, 'b::semiring_1] => 'a"  (infixr "'(^')\<index>" 75)
    34 
    34 
    35 overloading nat_pow == "pow :: [_, 'a, nat] => 'a"
    35 overloading nat_pow == "pow :: [_, 'a, nat] => 'a"
   275     from x xG have "x_inv \<otimes> (x \<otimes> \<one>) = x_inv \<otimes> x"
   275     from x xG have "x_inv \<otimes> (x \<otimes> \<one>) = x_inv \<otimes> x"
   276       by (simp add: m_assoc [symmetric] l_inv)
   276       by (simp add: m_assoc [symmetric] l_inv)
   277     with x xG show "x \<otimes> \<one> = x" by simp
   277     with x xG show "x \<otimes> \<one> = x" by simp
   278   qed
   278   qed
   279   have inv_ex:
   279   have inv_ex:
   280     "!!x. x \<in> carrier G ==> \<exists>y \<in> carrier G. y \<otimes> x = \<one> & x \<otimes> y = \<one>"
   280     "\<And>x. x \<in> carrier G \<Longrightarrow> \<exists>y \<in> carrier G. y \<otimes> x = \<one> \<and> x \<otimes> y = \<one>"
   281   proof -
   281   proof -
   282     fix x
   282     fix x
   283     assume x: "x \<in> carrier G"
   283     assume x: "x \<in> carrier G"
   284     with l_inv_ex obtain y where y: "y \<in> carrier G"
   284     with l_inv_ex obtain y where y: "y \<in> carrier G"
   285       and l_inv: "y \<otimes> x = \<one>" by fast
   285       and l_inv: "y \<otimes> x = \<one>" by fast
   286     from x y have "y \<otimes> (x \<otimes> y) = y \<otimes> \<one>"
   286     from x y have "y \<otimes> (x \<otimes> y) = y \<otimes> \<one>"
   287       by (simp add: m_assoc [symmetric] l_inv r_one)
   287       by (simp add: m_assoc [symmetric] l_inv r_one)
   288     with x y have r_inv: "x \<otimes> y = \<one>"
   288     with x y have r_inv: "x \<otimes> y = \<one>"
   289       by simp
   289       by simp
   290     from x y show "\<exists>y \<in> carrier G. y \<otimes> x = \<one> & x \<otimes> y = \<one>"
   290     from x y show "\<exists>y \<in> carrier G. y \<otimes> x = \<one> \<and> x \<otimes> y = \<one>"
   291       by (fast intro: l_inv r_inv)
   291       by (fast intro: l_inv r_inv)
   292   qed
   292   qed
   293   then have carrier_subset_Units: "carrier G <= Units G"
   293   then have carrier_subset_Units: "carrier G \<subseteq> Units G"
   294     by (unfold Units_def) fast
   294     by (unfold Units_def) fast
   295   show ?thesis
   295   show ?thesis
   296     by standard (auto simp: r_one m_assoc carrier_subset_Units)
   296     by standard (auto simp: r_one m_assoc carrier_subset_Units)
   297 qed
   297 qed
   298 
   298 
   303   by (rule groupI) (auto intro: m_assoc l_inv_ex)
   303   by (rule groupI) (auto intro: m_assoc l_inv_ex)
   304 
   304 
   305 lemma (in group) Units_eq [simp]:
   305 lemma (in group) Units_eq [simp]:
   306   "Units G = carrier G"
   306   "Units G = carrier G"
   307 proof
   307 proof
   308   show "Units G <= carrier G" by fast
   308   show "Units G \<subseteq> carrier G" by fast
   309 next
   309 next
   310   show "carrier G <= Units G" by (rule Units)
   310   show "carrier G \<subseteq> Units G" by (rule Units)
   311 qed
   311 qed
   312 
   312 
   313 lemma (in group) inv_closed [intro, simp]:
   313 lemma (in group) inv_closed [intro, simp]:
   314   "x \<in> carrier G ==> inv x \<in> carrier G"
   314   "x \<in> carrier G ==> inv x \<in> carrier G"
   315   using Units_inv_closed by simp
   315   using Units_inv_closed by simp
   508 
   508 
   509 declare monoid.one_closed [iff] group.inv_closed [simp]
   509 declare monoid.one_closed [iff] group.inv_closed [simp]
   510   monoid.l_one [simp] monoid.r_one [simp] group.inv_inv [simp]
   510   monoid.l_one [simp] monoid.r_one [simp] group.inv_inv [simp]
   511 
   511 
   512 lemma subgroup_nonempty:
   512 lemma subgroup_nonempty:
   513   "~ subgroup {} G"
   513   "\<not> subgroup {} G"
   514   by (blast dest: subgroup.one_closed)
   514   by (blast dest: subgroup.one_closed)
   515 
   515 
   516 lemma (in subgroup) finite_imp_card_positive:
   516 lemma (in subgroup) finite_imp_card_positive:
   517   "finite (carrier G) ==> 0 < card H"
   517   "finite (carrier G) ==> 0 < card H"
   518 proof (rule classical)
   518 proof (rule classical)
   519   assume "finite (carrier G)" and a: "~ 0 < card H"
   519   assume "finite (carrier G)" and a: "\<not> 0 < card H"
   520   then have "finite H" by (blast intro: finite_subset [OF subset])
   520   then have "finite H" by (blast intro: finite_subset [OF subset])
   521   with is_subgroup a have "subgroup {} G" by simp
   521   with is_subgroup a have "subgroup {} G" by simp
   522   with subgroup_nonempty show ?thesis by contradiction
   522   with subgroup_nonempty show ?thesis by contradiction
   523 qed
   523 qed
   524 
   524 
   589 subsection \<open>Homomorphisms and Isomorphisms\<close>
   589 subsection \<open>Homomorphisms and Isomorphisms\<close>
   590 
   590 
   591 definition
   591 definition
   592   hom :: "_ => _ => ('a => 'b) set" where
   592   hom :: "_ => _ => ('a => 'b) set" where
   593   "hom G H =
   593   "hom G H =
   594     {h. h \<in> carrier G \<rightarrow> carrier H &
   594     {h. h \<in> carrier G \<rightarrow> carrier H \<and>
   595       (\<forall>x \<in> carrier G. \<forall>y \<in> carrier G. h (x \<otimes>\<^bsub>G\<^esub> y) = h x \<otimes>\<^bsub>H\<^esub> h y)}"
   595       (\<forall>x \<in> carrier G. \<forall>y \<in> carrier G. h (x \<otimes>\<^bsub>G\<^esub> y) = h x \<otimes>\<^bsub>H\<^esub> h y)}"
   596 
   596 
   597 lemma (in group) hom_compose:
   597 lemma (in group) hom_compose:
   598   "[|h \<in> hom G H; i \<in> hom H I|] ==> compose (carrier G) i h \<in> hom G I"
   598   "[|h \<in> hom G H; i \<in> hom H I|] ==> compose (carrier G) i h \<in> hom G I"
   599 by (fastforce simp add: hom_def compose_def)
   599 by (fastforce simp add: hom_def compose_def)
   600 
   600 
   601 definition
   601 definition
   602   iso :: "_ => _ => ('a => 'b) set" (infixr "\<cong>" 60)
   602   iso :: "_ => _ => ('a => 'b) set" (infixr "\<cong>" 60)
   603   where "G \<cong> H = {h. h \<in> hom G H & bij_betw h (carrier G) (carrier H)}"
   603   where "G \<cong> H = {h. h \<in> hom G H \<and> bij_betw h (carrier G) (carrier H)}"
   604 
   604 
   605 lemma iso_refl: "(%x. x) \<in> G \<cong> G"
   605 lemma iso_refl: "(\<lambda>x. x) \<in> G \<cong> G"
   606 by (simp add: iso_def hom_def inj_on_def bij_betw_def Pi_def)
   606 by (simp add: iso_def hom_def inj_on_def bij_betw_def Pi_def)
   607 
   607 
   608 lemma (in group) iso_sym:
   608 lemma (in group) iso_sym:
   609      "h \<in> G \<cong> H \<Longrightarrow> inv_into (carrier G) h \<in> H \<cong> G"
   609      "h \<in> G \<cong> H \<Longrightarrow> inv_into (carrier G) h \<in> H \<cong> G"
   610 apply (simp add: iso_def bij_betw_inv_into) 
   610 apply (simp add: iso_def bij_betw_inv_into) 
   796 apply (rule subsetD [OF subgroup.subset], assumption)
   796 apply (rule subsetD [OF subgroup.subset], assumption)
   797 apply (rule_tac group.inv_closed [OF subgroup_imp_group, simplified], assumption+)
   797 apply (rule_tac group.inv_closed [OF subgroup_imp_group, simplified], assumption+)
   798 done
   798 done
   799 
   799 
   800 theorem (in group) subgroups_Inter:
   800 theorem (in group) subgroups_Inter:
   801   assumes subgr: "(!!H. H \<in> A ==> subgroup H G)"
   801   assumes subgr: "(\<And>H. H \<in> A \<Longrightarrow> subgroup H G)"
   802     and not_empty: "A ~= {}"
   802     and not_empty: "A \<noteq> {}"
   803   shows "subgroup (\<Inter>A) G"
   803   shows "subgroup (\<Inter>A) G"
   804 proof (rule subgroupI)
   804 proof (rule subgroupI)
   805   from subgr [THEN subgroup.subset] and not_empty
   805   from subgr [THEN subgroup.subset] and not_empty
   806   show "\<Inter>A \<subseteq> carrier G" by blast
   806   show "\<Inter>A \<subseteq> carrier G" by blast
   807 next
   807 next
   808   from subgr [THEN subgroup.one_closed]
   808   from subgr [THEN subgroup.one_closed]
   809   show "\<Inter>A ~= {}" by blast
   809   show "\<Inter>A \<noteq> {}" by blast
   810 next
   810 next
   811   fix x assume "x \<in> \<Inter>A"
   811   fix x assume "x \<in> \<Inter>A"
   812   with subgr [THEN subgroup.m_inv_closed]
   812   with subgr [THEN subgroup.m_inv_closed]
   813   show "inv x \<in> \<Inter>A" by blast
   813   show "inv x \<in> \<Inter>A" by blast
   814 next
   814 next
   826   have "greatest ?L (carrier G) (carrier ?L)"
   826   have "greatest ?L (carrier G) (carrier ?L)"
   827     by (unfold greatest_def) (simp add: subgroup.subset subgroup_self)
   827     by (unfold greatest_def) (simp add: subgroup.subset subgroup_self)
   828   then show "\<exists>G. greatest ?L G (carrier ?L)" ..
   828   then show "\<exists>G. greatest ?L G (carrier ?L)" ..
   829 next
   829 next
   830   fix A
   830   fix A
   831   assume L: "A \<subseteq> carrier ?L" and non_empty: "A ~= {}"
   831   assume L: "A \<subseteq> carrier ?L" and non_empty: "A \<noteq> {}"
   832   then have Int_subgroup: "subgroup (\<Inter>A) G"
   832   then have Int_subgroup: "subgroup (\<Inter>A) G"
   833     by (fastforce intro: subgroups_Inter)
   833     by (fastforce intro: subgroups_Inter)
   834   have "greatest ?L (\<Inter>A) (Lower ?L A)" (is "greatest _ ?Int _")
   834   have "greatest ?L (\<Inter>A) (Lower ?L A)" (is "greatest _ ?Int _")
   835   proof (rule greatest_LowerI)
   835   proof (rule greatest_LowerI)
   836     fix H
   836     fix H