diff -r 571909ef3103 -r 095dce9892e8 src/HOL/Algebra/Group.thy --- a/src/HOL/Algebra/Group.thy Sat Mar 30 15:37:27 2019 +0100 +++ b/src/HOL/Algebra/Group.thy Mon Apr 01 17:02:43 2019 +0100 @@ -425,7 +425,20 @@ end lemma int_pow_int: "x [^]\<^bsub>G\<^esub> (int n) = x [^]\<^bsub>G\<^esub> n" -by(simp add: int_pow_def nat_pow_def) + by(simp add: int_pow_def nat_pow_def) + +lemma pow_nat: + assumes "i\0" + shows "x [^]\<^bsub>G\<^esub> nat i = x [^]\<^bsub>G\<^esub> i" +proof (cases i rule: int_cases) + case (nonneg n) + then show ?thesis + by (simp add: int_pow_int) +next + case (neg n) + then show ?thesis + using assms by linarith +qed lemma int_pow_0 [simp]: "x [^]\<^bsub>G\<^esub> (0::int) = \\<^bsub>G\<^esub>" by (simp add: int_pow_def) @@ -450,6 +463,9 @@ "x \ carrier G \ x [^] (-i::int) = inv (x [^] i)" by (simp add: int_pow_def2) +lemma (in group) int_pow_neg_int: "x \ carrier G \ x [^] -(int n) = inv (x [^] n)" + by (simp add: int_pow_neg int_pow_int) + lemma (in group) int_pow_mult: assumes "x \ carrier G" shows "x [^] (i + j::int) = x [^] i \ x [^] j" proof - @@ -502,6 +518,38 @@ by(simp add: inj_on_def) +lemma (in monoid) group_commutes_pow: + fixes n::nat + shows "\x \ y = y \ x; x \ carrier G; y \ carrier G\ \ x [^] n \ y = y \ x [^] n" + apply (induction n, auto) + by (metis m_assoc nat_pow_closed) + +lemma (in monoid) pow_mult_distrib: + assumes eq: "x \ y = y \ x" and xy: "x \ carrier G" "y \ carrier G" + shows "(x \ y) [^] (n::nat) = x [^] n \ y [^] n" +proof (induct n) + case (Suc n) + have "x \ (y [^] n \ y) = y [^] n \ x \ y" + by (simp add: eq group_commutes_pow m_assoc xy) + then show ?case + using assms Suc.hyps m_assoc by auto +qed auto + +lemma (in group) int_pow_mult_distrib: + assumes eq: "x \ y = y \ x" and xy: "x \ carrier G" "y \ carrier G" + shows "(x \ y) [^] (i::int) = x [^] i \ y [^] i" +proof (cases i rule: int_cases) + case (nonneg n) + then show ?thesis + by (metis eq int_pow_int pow_mult_distrib xy) +next + case (neg n) + then show ?thesis + unfolding neg + apply (simp add: xy int_pow_neg_int del: of_nat_Suc) + by (metis eq inv_mult_group local.nat_pow_Suc nat_pow_closed pow_mult_distrib xy) +qed + subsection \Submonoids\ locale submonoid = \<^marker>\contributor \Martin Baillon\\ @@ -852,7 +900,7 @@ lemma id_iso: "id \ iso G G" by (simp add: iso_def hom_def inj_on_def bij_betw_def Pi_def) -corollary iso_refl : "G \ G" +corollary iso_refl [simp]: "G \ G" using iso_set_refl unfolding is_iso_def by auto lemma trivial_hom: @@ -901,11 +949,11 @@ corollary (in group) iso_sym: "G \ H \ H \ G" using iso_set_sym unfolding is_iso_def by auto -lemma (in group) iso_set_trans: - "[|h \ iso G H; i \ iso H I|] ==> (compose (carrier G) i h) \ iso G I" - by (auto simp add: iso_def hom_compose bij_betw_compose) +lemma iso_set_trans: + "\h \ Group.iso G H; i \ Group.iso H I\ \ i \ h \ Group.iso G I" + by (force simp: iso_def hom_compose intro: bij_betw_trans) -corollary (in group) iso_trans: "\G \ H ; H \ I\ \ G \ I" +corollary iso_trans [trans]: "\G \ H ; H \ I\ \ G \ I" using iso_set_trans unfolding is_iso_def by blast lemma iso_same_card: "G \ H \ card (carrier G) = card (carrier H)" @@ -1081,6 +1129,8 @@ fixes h assumes homh [simp]: "h \ hom G H" +declare group_hom.homh [simp] + lemma (in group_hom) hom_mult [simp]: "[| x \ carrier G; y \ carrier G |] ==> h (x \\<^bsub>G\<^esub> y) = h x \\<^bsub>H\<^esub> h y" proof - @@ -1170,14 +1220,21 @@ using subgroup.subgroup_is_group[OF assms is_group] is_group subgroup.subset[OF assms] by auto -lemma (in group_hom) nat_pow_hom: \<^marker>\contributor \Paulo Emílio de Vilhena\\ +lemma (in group_hom) hom_nat_pow: \<^marker>\contributor \Paulo Emílio de Vilhena\\ "x \ carrier G \ h (x [^] (n :: nat)) = (h x) [^]\<^bsub>H\<^esub> n" by (induction n) auto -lemma (in group_hom) int_pow_hom: \<^marker>\contributor \Paulo Emílio de Vilhena\\ +lemma (in group_hom) hom_int_pow: \<^marker>\contributor \Paulo Emílio de Vilhena\\ "x \ carrier G \ h (x [^] (n :: int)) = (h x) [^]\<^bsub>H\<^esub> n" - using nat_pow_hom by (simp add: int_pow_def2) + using hom_nat_pow by (simp add: int_pow_def2) +lemma hom_nat_pow: + "\h \ hom G H; x \ carrier G; group G; group H\ \ h (x [^]\<^bsub>G\<^esub> (n :: nat)) = (h x) [^]\<^bsub>H\<^esub> n" + by (simp add: group_hom.hom_nat_pow group_hom_axioms_def group_hom_def) + +lemma hom_int_pow: + "\h \ hom G H; x \ carrier G; group G; group H\ \ h (x [^]\<^bsub>G\<^esub> (n :: int)) = (h x) [^]\<^bsub>H\<^esub> n" + by (simp add: group_hom.hom_int_pow group_hom_axioms.intro group_hom_def) subsection \Commutative Structures\ @@ -1225,11 +1282,6 @@ shows "comm_monoid G" by (rule comm_monoidI) (auto intro: m_assoc m_comm) -lemma (in comm_monoid) nat_pow_distr: - "[| x \ carrier G; y \ carrier G |] ==> - (x \ y) [^] (n::nat) = x [^] n \ y [^] n" - by (induct n) (simp, simp add: m_ac) - lemma (in comm_monoid) submonoid_is_comm_monoid : assumes "submonoid H G" shows "comm_monoid (G\carrier := H\)" @@ -1279,6 +1331,17 @@ "[| x \ carrier G; y \ carrier G |] ==> inv (x \ y) = inv x \ inv y" by (simp add: m_ac inv_mult_group) +lemma (in comm_monoid) nat_pow_distrib: + fixes n::nat + assumes "x \ carrier G" "y \ carrier G" + shows "(x \ y) [^] n = x [^] n \ y [^] n" + by (simp add: assms pow_mult_distrib m_comm) + +lemma (in comm_group) int_pow_distrib: + assumes "x \ carrier G" "y \ carrier G" + shows "(x \ y) [^] (i::int) = x [^] i \ y [^] i" + by (simp add: assms int_pow_mult_distrib m_comm) + lemma (in comm_monoid) hom_imp_img_comm_monoid: \<^marker>\contributor \Paulo Emílio de Vilhena\\ assumes "h \ hom G H" shows "comm_monoid (H \ carrier := h ` (carrier G), one := h \\<^bsub>G\<^esub> \)" (is "comm_monoid ?h_img")