src/HOL/Algebra/Group.thy
changeset 67341 df79ef3b3a41
parent 67091 1393c2340eec
child 67342 7905adb28bdc
equal deleted inserted replaced
67340:150d40a25622 67341:df79ef3b3a41
    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 \<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>)}"
    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"
    36 begin
    36 begin
    37   definition "nat_pow G a n = rec_nat \<one>\<^bsub>G\<^esub> (%u b. b \<otimes>\<^bsub>G\<^esub> a) n"
    37   definition "nat_pow G a n = rec_nat \<one>\<^bsub>G\<^esub> (%u b. b \<otimes>\<^bsub>G\<^esub> a) n"
    38 end
    38 end
    42   definition "int_pow G a z =
    42   definition "int_pow G a z =
    43    (let p = rec_nat \<one>\<^bsub>G\<^esub> (%u b. b \<otimes>\<^bsub>G\<^esub> a)
    43    (let p = rec_nat \<one>\<^bsub>G\<^esub> (%u b. b \<otimes>\<^bsub>G\<^esub> a)
    44     in if z < 0 then inv\<^bsub>G\<^esub> (p (nat (-z))) else p (nat z))"
    44     in if z < 0 then inv\<^bsub>G\<^esub> (p (nat (-z))) else p (nat z))"
    45 end
    45 end
    46 
    46 
    47 lemma int_pow_int: "x (^)\<^bsub>G\<^esub> (int n) = x (^)\<^bsub>G\<^esub> n"
    47 lemma int_pow_int: "x [^]\<^bsub>G\<^esub> (int n) = x [^]\<^bsub>G\<^esub> n"
    48 by(simp add: int_pow_def nat_pow_def)
    48 by(simp add: int_pow_def nat_pow_def)
    49 
    49 
    50 locale monoid =
    50 locale monoid =
    51   fixes G (structure)
    51   fixes G (structure)
    52   assumes m_closed [intro, simp]:
    52   assumes m_closed [intro, simp]:
   194 by auto
   194 by auto
   195 
   195 
   196 text \<open>Power\<close>
   196 text \<open>Power\<close>
   197 
   197 
   198 lemma (in monoid) nat_pow_closed [intro, simp]:
   198 lemma (in monoid) nat_pow_closed [intro, simp]:
   199   "x \<in> carrier G ==> x (^) (n::nat) \<in> carrier G"
   199   "x \<in> carrier G ==> x [^] (n::nat) \<in> carrier G"
   200   by (induct n) (simp_all add: nat_pow_def)
   200   by (induct n) (simp_all add: nat_pow_def)
   201 
   201 
   202 lemma (in monoid) nat_pow_0 [simp]:
   202 lemma (in monoid) nat_pow_0 [simp]:
   203   "x (^) (0::nat) = \<one>"
   203   "x [^] (0::nat) = \<one>"
   204   by (simp add: nat_pow_def)
   204   by (simp add: nat_pow_def)
   205 
   205 
   206 lemma (in monoid) nat_pow_Suc [simp]:
   206 lemma (in monoid) nat_pow_Suc [simp]:
   207   "x (^) (Suc n) = x (^) n \<otimes> x"
   207   "x [^] (Suc n) = x [^] n \<otimes> x"
   208   by (simp add: nat_pow_def)
   208   by (simp add: nat_pow_def)
   209 
   209 
   210 lemma (in monoid) nat_pow_one [simp]:
   210 lemma (in monoid) nat_pow_one [simp]:
   211   "\<one> (^) (n::nat) = \<one>"
   211   "\<one> [^] (n::nat) = \<one>"
   212   by (induct n) simp_all
   212   by (induct n) simp_all
   213 
   213 
   214 lemma (in monoid) nat_pow_mult:
   214 lemma (in monoid) nat_pow_mult:
   215   "x \<in> carrier G ==> x (^) (n::nat) \<otimes> x (^) m = x (^) (n + m)"
   215   "x \<in> carrier G ==> x [^] (n::nat) \<otimes> x [^] m = x [^] (n + m)"
   216   by (induct m) (simp_all add: m_assoc [THEN sym])
   216   by (induct m) (simp_all add: m_assoc [THEN sym])
   217 
   217 
   218 lemma (in monoid) nat_pow_pow:
   218 lemma (in monoid) nat_pow_pow:
   219   "x \<in> carrier G ==> (x (^) n) (^) m = x (^) (n * m::nat)"
   219   "x \<in> carrier G ==> (x [^] n) [^] m = x [^] (n * m::nat)"
   220   by (induct m) (simp, simp add: nat_pow_mult add.commute)
   220   by (induct m) (simp, simp add: nat_pow_mult add.commute)
   221 
   221 
   222 
   222 
   223 (* Jacobson defines submonoid here. *)
   223 (* Jacobson defines submonoid here. *)
   224 (* Jacobson defines the order of a monoid here. *)
   224 (* Jacobson defines the order of a monoid here. *)
   404   by (metis inv_equality l_inv_ex l_one m_assoc r_inv)
   404   by (metis inv_equality l_inv_ex l_one m_assoc r_inv)
   405 
   405 
   406 text \<open>Power\<close>
   406 text \<open>Power\<close>
   407 
   407 
   408 lemma (in group) int_pow_def2:
   408 lemma (in group) int_pow_def2:
   409   "a (^) (z::int) = (if z < 0 then inv (a (^) (nat (-z))) else a (^) (nat z))"
   409   "a [^] (z::int) = (if z < 0 then inv (a [^] (nat (-z))) else a [^] (nat z))"
   410   by (simp add: int_pow_def nat_pow_def Let_def)
   410   by (simp add: int_pow_def nat_pow_def Let_def)
   411 
   411 
   412 lemma (in group) int_pow_0 [simp]:
   412 lemma (in group) int_pow_0 [simp]:
   413   "x (^) (0::int) = \<one>"
   413   "x [^] (0::int) = \<one>"
   414   by (simp add: int_pow_def2)
   414   by (simp add: int_pow_def2)
   415 
   415 
   416 lemma (in group) int_pow_one [simp]:
   416 lemma (in group) int_pow_one [simp]:
   417   "\<one> (^) (z::int) = \<one>"
   417   "\<one> [^] (z::int) = \<one>"
   418   by (simp add: int_pow_def2)
   418   by (simp add: int_pow_def2)
   419 
   419 
   420 (* The following are contributed by Joachim Breitner *)
   420 (* The following are contributed by Joachim Breitner *)
   421 
   421 
   422 lemma (in group) int_pow_closed [intro, simp]:
   422 lemma (in group) int_pow_closed [intro, simp]:
   423   "x \<in> carrier G ==> x (^) (i::int) \<in> carrier G"
   423   "x \<in> carrier G ==> x [^] (i::int) \<in> carrier G"
   424   by (simp add: int_pow_def2)
   424   by (simp add: int_pow_def2)
   425 
   425 
   426 lemma (in group) int_pow_1 [simp]:
   426 lemma (in group) int_pow_1 [simp]:
   427   "x \<in> carrier G \<Longrightarrow> x (^) (1::int) = x"
   427   "x \<in> carrier G \<Longrightarrow> x [^] (1::int) = x"
   428   by (simp add: int_pow_def2)
   428   by (simp add: int_pow_def2)
   429 
   429 
   430 lemma (in group) int_pow_neg:
   430 lemma (in group) int_pow_neg:
   431   "x \<in> carrier G \<Longrightarrow> x (^) (-i::int) = inv (x (^) i)"
   431   "x \<in> carrier G \<Longrightarrow> x [^] (-i::int) = inv (x [^] i)"
   432   by (simp add: int_pow_def2)
   432   by (simp add: int_pow_def2)
   433 
   433 
   434 lemma (in group) int_pow_mult:
   434 lemma (in group) int_pow_mult:
   435   "x \<in> carrier G \<Longrightarrow> x (^) (i + j::int) = x (^) i \<otimes> x (^) j"
   435   "x \<in> carrier G \<Longrightarrow> x [^] (i + j::int) = x [^] i \<otimes> x [^] j"
   436 proof -
   436 proof -
   437   have [simp]: "-i - j = -j - i" by simp
   437   have [simp]: "-i - j = -j - i" by simp
   438   assume "x : carrier G" then
   438   assume "x : carrier G" then
   439   show ?thesis
   439   show ?thesis
   440     by (auto simp add: int_pow_def2 inv_solve_left inv_solve_right nat_add_distrib [symmetric] nat_pow_mult )
   440     by (auto simp add: int_pow_def2 inv_solve_left inv_solve_right nat_add_distrib [symmetric] nat_pow_mult )
   441 qed
   441 qed
   442 
   442 
   443 lemma (in group) int_pow_diff:
   443 lemma (in group) int_pow_diff:
   444   "x \<in> carrier G \<Longrightarrow> x (^) (n - m :: int) = x (^) n \<otimes> inv (x (^) m)"
   444   "x \<in> carrier G \<Longrightarrow> x [^] (n - m :: int) = x [^] n \<otimes> inv (x [^] m)"
   445 by(simp only: diff_conv_add_uminus int_pow_mult int_pow_neg)
   445 by(simp only: diff_conv_add_uminus int_pow_mult int_pow_neg)
   446 
   446 
   447 lemma (in group) inj_on_multc: "c \<in> carrier G \<Longrightarrow> inj_on (\<lambda>x. x \<otimes> c) (carrier G)"
   447 lemma (in group) inj_on_multc: "c \<in> carrier G \<Longrightarrow> inj_on (\<lambda>x. x \<otimes> c) (carrier G)"
   448 by(simp add: inj_on_def)
   448 by(simp add: inj_on_def)
   449 
   449 
   674   with x show ?thesis by (simp del: H.r_inv H.Units_r_inv)
   674   with x show ?thesis by (simp del: H.r_inv H.Units_r_inv)
   675 qed
   675 qed
   676 
   676 
   677 (* Contributed by Joachim Breitner *)
   677 (* Contributed by Joachim Breitner *)
   678 lemma (in group) int_pow_is_hom:
   678 lemma (in group) int_pow_is_hom:
   679   "x \<in> carrier G \<Longrightarrow> (op(^) x) \<in> hom \<lparr> carrier = UNIV, mult = op +, one = 0::int \<rparr> G "
   679   "x \<in> carrier G \<Longrightarrow> (op[^] x) \<in> hom \<lparr> carrier = UNIV, mult = op +, one = 0::int \<rparr> G "
   680   unfolding hom_def by (simp add: int_pow_mult)
   680   unfolding hom_def by (simp add: int_pow_mult)
   681 
   681 
   682 
   682 
   683 subsection \<open>Commutative Structures\<close>
   683 subsection \<open>Commutative Structures\<close>
   684 
   684 
   735   finally show ?thesis .
   735   finally show ?thesis .
   736 qed*)
   736 qed*)
   737 
   737 
   738 lemma (in comm_monoid) nat_pow_distr:
   738 lemma (in comm_monoid) nat_pow_distr:
   739   "[| x \<in> carrier G; y \<in> carrier G |] ==>
   739   "[| x \<in> carrier G; y \<in> carrier G |] ==>
   740   (x \<otimes> y) (^) (n::nat) = x (^) n \<otimes> y (^) n"
   740   (x \<otimes> y) [^] (n::nat) = x [^] n \<otimes> y [^] n"
   741   by (induct n) (simp, simp add: m_ac)
   741   by (induct n) (simp, simp add: m_ac)
   742 
   742 
   743 locale comm_group = comm_monoid + group
   743 locale comm_group = comm_monoid + group
   744 
   744 
   745 lemma (in group) group_comm_groupI:
   745 lemma (in group) group_comm_groupI: