src/HOL/Algebra/Group.thy
author ballarin
Mon, 26 Jul 2004 15:48:50 +0200
changeset 15076 4b3d280ef06a
parent 14963 d584e32f7d46
child 15696 1da4ce092c0b
permissions -rw-r--r--
New prover for transitive and reflexive-transitive closure of relations. - Code in Provers/trancl.ML - HOL: Simplifier set up to use it as solver
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
13813
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
     1
(*
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
     2
  Title:  HOL/Algebra/Group.thy
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
     3
  Id:     $Id$
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
     4
  Author: Clemens Ballarin, started 4 February 2003
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
     5
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
     6
Based on work by Florian Kammueller, L C Paulson and Markus Wenzel.
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
     7
*)
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
     8
13949
0ce528cd6f19 HOL-Algebra complete for release Isabelle2003 (modulo section headers).
ballarin
parents: 13944
diff changeset
     9
header {* Groups *}
13813
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
    10
14751
0d7850e27fed Change of theory hierarchy: Group is now based in Lattice.
ballarin
parents: 14706
diff changeset
    11
theory Group = FuncSet + Lattice:
13813
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
    12
14761
28b5eb4a867f more results about isomorphisms
paulson
parents: 14751
diff changeset
    13
14963
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14852
diff changeset
    14
section {* Monoids and Groups *}
13936
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
    15
13813
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
    16
text {*
14963
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14852
diff changeset
    17
  Definitions follow \cite{Jacobson:1985}.
13813
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
    18
*}
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
    19
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
    20
subsection {* Definitions *}
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
    21
14963
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14852
diff changeset
    22
record 'a monoid =  "'a partial_object" +
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14852
diff changeset
    23
  mult    :: "['a, 'a] \<Rightarrow> 'a" (infixl "\<otimes>\<index>" 70)
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14852
diff changeset
    24
  one     :: 'a ("\<one>\<index>")
13817
7e031a968443 Product operator added --- preliminary.
ballarin
parents: 13813
diff changeset
    25
14651
02b8f3bcf7fe improved notation;
wenzelm
parents: 14551
diff changeset
    26
constdefs (structure G)
14852
paulson
parents: 14803
diff changeset
    27
  m_inv :: "('a, 'b) monoid_scheme => 'a => 'a" ("inv\<index> _" [81] 80)
14651
02b8f3bcf7fe improved notation;
wenzelm
parents: 14551
diff changeset
    28
  "inv x == (THE y. y \<in> carrier G & x \<otimes> y = \<one> & y \<otimes> x = \<one>)"
13936
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
    29
14651
02b8f3bcf7fe improved notation;
wenzelm
parents: 14551
diff changeset
    30
  Units :: "_ => 'a set"
14852
paulson
parents: 14803
diff changeset
    31
  --{*The set of invertible elements*}
14963
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14852
diff changeset
    32
  "Units G == {y. y \<in> carrier G & (\<exists>x \<in> carrier G. x \<otimes> y = \<one> & y \<otimes> x = \<one>)}"
13936
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
    33
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
    34
consts
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
    35
  pow :: "[('a, 'm) monoid_scheme, 'a, 'b::number] => 'a" (infixr "'(^')\<index>" 75)
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
    36
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
    37
defs (overloaded)
14693
4deda204e1d8 improved syntax;
wenzelm
parents: 14651
diff changeset
    38
  nat_pow_def: "pow G a n == nat_rec \<one>\<^bsub>G\<^esub> (%u b. b \<otimes>\<^bsub>G\<^esub> a) n"
13936
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
    39
  int_pow_def: "pow G a z ==
14693
4deda204e1d8 improved syntax;
wenzelm
parents: 14651
diff changeset
    40
    let p = nat_rec \<one>\<^bsub>G\<^esub> (%u b. b \<otimes>\<^bsub>G\<^esub> a)
4deda204e1d8 improved syntax;
wenzelm
parents: 14651
diff changeset
    41
    in if neg z then inv\<^bsub>G\<^esub> (p (nat (-z))) else p (nat z)"
13813
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
    42
14963
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14852
diff changeset
    43
locale monoid = struct G +
13813
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
    44
  assumes m_closed [intro, simp]:
14963
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14852
diff changeset
    45
         "\<lbrakk>x \<in> carrier G; y \<in> carrier G\<rbrakk> \<Longrightarrow> x \<otimes> y \<in> carrier G"
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14852
diff changeset
    46
      and m_assoc:
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14852
diff changeset
    47
         "\<lbrakk>x \<in> carrier G; y \<in> carrier G; z \<in> carrier G\<rbrakk> 
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14852
diff changeset
    48
          \<Longrightarrow> (x \<otimes> y) \<otimes> z = x \<otimes> (y \<otimes> z)"
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14852
diff changeset
    49
      and one_closed [intro, simp]: "\<one> \<in> carrier G"
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14852
diff changeset
    50
      and l_one [simp]: "x \<in> carrier G \<Longrightarrow> \<one> \<otimes> x = x"
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14852
diff changeset
    51
      and r_one [simp]: "x \<in> carrier G \<Longrightarrow> x \<otimes> \<one> = x"
13817
7e031a968443 Product operator added --- preliminary.
ballarin
parents: 13813
diff changeset
    52
13936
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
    53
lemma monoidI:
14693
4deda204e1d8 improved syntax;
wenzelm
parents: 14651
diff changeset
    54
  includes struct G
13936
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
    55
  assumes m_closed:
14693
4deda204e1d8 improved syntax;
wenzelm
parents: 14651
diff changeset
    56
      "!!x y. [| x \<in> carrier G; y \<in> carrier G |] ==> x \<otimes> y \<in> carrier G"
4deda204e1d8 improved syntax;
wenzelm
parents: 14651
diff changeset
    57
    and one_closed: "\<one> \<in> carrier G"
13936
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
    58
    and m_assoc:
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
    59
      "!!x y z. [| x \<in> carrier G; y \<in> carrier G; z \<in> carrier G |] ==>
14693
4deda204e1d8 improved syntax;
wenzelm
parents: 14651
diff changeset
    60
      (x \<otimes> y) \<otimes> z = x \<otimes> (y \<otimes> z)"
4deda204e1d8 improved syntax;
wenzelm
parents: 14651
diff changeset
    61
    and l_one: "!!x. x \<in> carrier G ==> \<one> \<otimes> x = x"
4deda204e1d8 improved syntax;
wenzelm
parents: 14651
diff changeset
    62
    and r_one: "!!x. x \<in> carrier G ==> x \<otimes> \<one> = x"
13936
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
    63
  shows "monoid G"
14963
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14852
diff changeset
    64
  by (fast intro!: monoid.intro intro: prems)
13936
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
    65
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
    66
lemma (in monoid) Units_closed [dest]:
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
    67
  "x \<in> Units G ==> x \<in> carrier G"
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
    68
  by (unfold Units_def) fast
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
    69
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
    70
lemma (in monoid) inv_unique:
14693
4deda204e1d8 improved syntax;
wenzelm
parents: 14651
diff changeset
    71
  assumes eq: "y \<otimes> x = \<one>"  "x \<otimes> y' = \<one>"
4deda204e1d8 improved syntax;
wenzelm
parents: 14651
diff changeset
    72
    and G: "x \<in> carrier G"  "y \<in> carrier G"  "y' \<in> carrier G"
13936
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
    73
  shows "y = y'"
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
    74
proof -
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
    75
  from G eq have "y = y \<otimes> (x \<otimes> y')" by simp
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
    76
  also from G have "... = (y \<otimes> x) \<otimes> y'" by (simp add: m_assoc)
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
    77
  also from G eq have "... = y'" by simp
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
    78
  finally show ?thesis .
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
    79
qed
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
    80
13940
c67798653056 HOL-Algebra: New polynomial development added.
ballarin
parents: 13936
diff changeset
    81
lemma (in monoid) Units_one_closed [intro, simp]:
c67798653056 HOL-Algebra: New polynomial development added.
ballarin
parents: 13936
diff changeset
    82
  "\<one> \<in> Units G"
c67798653056 HOL-Algebra: New polynomial development added.
ballarin
parents: 13936
diff changeset
    83
  by (unfold Units_def) auto
c67798653056 HOL-Algebra: New polynomial development added.
ballarin
parents: 13936
diff changeset
    84
13936
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
    85
lemma (in monoid) Units_inv_closed [intro, simp]:
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
    86
  "x \<in> Units G ==> inv x \<in> carrier G"
13943
83d842ccd4aa moving Bij.thy from GroupTheory to Algebra
paulson
parents: 13940
diff changeset
    87
  apply (unfold Units_def m_inv_def, auto)
13936
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
    88
  apply (rule theI2, fast)
13943
83d842ccd4aa moving Bij.thy from GroupTheory to Algebra
paulson
parents: 13940
diff changeset
    89
   apply (fast intro: inv_unique, fast)
13936
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
    90
  done
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
    91
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
    92
lemma (in monoid) Units_l_inv:
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
    93
  "x \<in> Units G ==> inv x \<otimes> x = \<one>"
13943
83d842ccd4aa moving Bij.thy from GroupTheory to Algebra
paulson
parents: 13940
diff changeset
    94
  apply (unfold Units_def m_inv_def, auto)
13936
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
    95
  apply (rule theI2, fast)
13943
83d842ccd4aa moving Bij.thy from GroupTheory to Algebra
paulson
parents: 13940
diff changeset
    96
   apply (fast intro: inv_unique, fast)
13936
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
    97
  done
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
    98
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
    99
lemma (in monoid) Units_r_inv:
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   100
  "x \<in> Units G ==> x \<otimes> inv x = \<one>"
13943
83d842ccd4aa moving Bij.thy from GroupTheory to Algebra
paulson
parents: 13940
diff changeset
   101
  apply (unfold Units_def m_inv_def, auto)
13936
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   102
  apply (rule theI2, fast)
13943
83d842ccd4aa moving Bij.thy from GroupTheory to Algebra
paulson
parents: 13940
diff changeset
   103
   apply (fast intro: inv_unique, fast)
13936
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   104
  done
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   105
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   106
lemma (in monoid) Units_inv_Units [intro, simp]:
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   107
  "x \<in> Units G ==> inv x \<in> Units G"
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   108
proof -
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   109
  assume x: "x \<in> Units G"
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   110
  show "inv x \<in> Units G"
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   111
    by (auto simp add: Units_def
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   112
      intro: Units_l_inv Units_r_inv x Units_closed [OF x])
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   113
qed
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   114
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   115
lemma (in monoid) Units_l_cancel [simp]:
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   116
  "[| x \<in> Units G; y \<in> carrier G; z \<in> carrier G |] ==>
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   117
   (x \<otimes> y = x \<otimes> z) = (y = z)"
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   118
proof
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   119
  assume eq: "x \<otimes> y = x \<otimes> z"
14693
4deda204e1d8 improved syntax;
wenzelm
parents: 14651
diff changeset
   120
    and G: "x \<in> Units G"  "y \<in> carrier G"  "z \<in> carrier G"
13936
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   121
  then have "(inv x \<otimes> x) \<otimes> y = (inv x \<otimes> x) \<otimes> z"
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   122
    by (simp add: m_assoc Units_closed)
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   123
  with G show "y = z" by (simp add: Units_l_inv)
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   124
next
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   125
  assume eq: "y = z"
14693
4deda204e1d8 improved syntax;
wenzelm
parents: 14651
diff changeset
   126
    and G: "x \<in> Units G"  "y \<in> carrier G"  "z \<in> carrier G"
13936
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   127
  then show "x \<otimes> y = x \<otimes> z" by simp
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   128
qed
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   129
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   130
lemma (in monoid) Units_inv_inv [simp]:
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   131
  "x \<in> Units G ==> inv (inv x) = x"
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   132
proof -
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   133
  assume x: "x \<in> Units G"
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   134
  then have "inv x \<otimes> inv (inv x) = inv x \<otimes> x"
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   135
    by (simp add: Units_l_inv Units_r_inv)
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   136
  with x show ?thesis by (simp add: Units_closed)
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   137
qed
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   138
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   139
lemma (in monoid) inv_inj_on_Units:
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   140
  "inj_on (m_inv G) (Units G)"
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   141
proof (rule inj_onI)
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   142
  fix x y
14693
4deda204e1d8 improved syntax;
wenzelm
parents: 14651
diff changeset
   143
  assume G: "x \<in> Units G"  "y \<in> Units G" and eq: "inv x = inv y"
13936
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   144
  then have "inv (inv x) = inv (inv y)" by simp
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   145
  with G show "x = y" by simp
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   146
qed
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   147
13940
c67798653056 HOL-Algebra: New polynomial development added.
ballarin
parents: 13936
diff changeset
   148
lemma (in monoid) Units_inv_comm:
c67798653056 HOL-Algebra: New polynomial development added.
ballarin
parents: 13936
diff changeset
   149
  assumes inv: "x \<otimes> y = \<one>"
14693
4deda204e1d8 improved syntax;
wenzelm
parents: 14651
diff changeset
   150
    and G: "x \<in> Units G"  "y \<in> Units G"
13940
c67798653056 HOL-Algebra: New polynomial development added.
ballarin
parents: 13936
diff changeset
   151
  shows "y \<otimes> x = \<one>"
c67798653056 HOL-Algebra: New polynomial development added.
ballarin
parents: 13936
diff changeset
   152
proof -
c67798653056 HOL-Algebra: New polynomial development added.
ballarin
parents: 13936
diff changeset
   153
  from G have "x \<otimes> y \<otimes> x = x \<otimes> \<one>" by (auto simp add: inv Units_closed)
c67798653056 HOL-Algebra: New polynomial development added.
ballarin
parents: 13936
diff changeset
   154
  with G show ?thesis by (simp del: r_one add: m_assoc Units_closed)
c67798653056 HOL-Algebra: New polynomial development added.
ballarin
parents: 13936
diff changeset
   155
qed
c67798653056 HOL-Algebra: New polynomial development added.
ballarin
parents: 13936
diff changeset
   156
13936
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   157
text {* Power *}
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   158
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   159
lemma (in monoid) nat_pow_closed [intro, simp]:
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   160
  "x \<in> carrier G ==> x (^) (n::nat) \<in> carrier G"
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   161
  by (induct n) (simp_all add: nat_pow_def)
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   162
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   163
lemma (in monoid) nat_pow_0 [simp]:
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   164
  "x (^) (0::nat) = \<one>"
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   165
  by (simp add: nat_pow_def)
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   166
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   167
lemma (in monoid) nat_pow_Suc [simp]:
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   168
  "x (^) (Suc n) = x (^) n \<otimes> x"
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   169
  by (simp add: nat_pow_def)
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   170
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   171
lemma (in monoid) nat_pow_one [simp]:
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   172
  "\<one> (^) (n::nat) = \<one>"
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   173
  by (induct n) simp_all
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   174
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   175
lemma (in monoid) nat_pow_mult:
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   176
  "x \<in> carrier G ==> x (^) (n::nat) \<otimes> x (^) m = x (^) (n + m)"
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   177
  by (induct m) (simp_all add: m_assoc [THEN sym])
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   178
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   179
lemma (in monoid) nat_pow_pow:
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   180
  "x \<in> carrier G ==> (x (^) n) (^) m = x (^) (n * m::nat)"
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   181
  by (induct m) (simp, simp add: nat_pow_mult add_commute)
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   182
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   183
text {*
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   184
  A group is a monoid all of whose elements are invertible.
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   185
*}
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   186
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   187
locale group = monoid +
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   188
  assumes Units: "carrier G <= Units G"
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   189
14761
28b5eb4a867f more results about isomorphisms
paulson
parents: 14751
diff changeset
   190
28b5eb4a867f more results about isomorphisms
paulson
parents: 14751
diff changeset
   191
lemma (in group) is_group: "group G"
28b5eb4a867f more results about isomorphisms
paulson
parents: 14751
diff changeset
   192
  by (rule group.intro [OF prems]) 
28b5eb4a867f more results about isomorphisms
paulson
parents: 14751
diff changeset
   193
13936
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   194
theorem groupI:
14693
4deda204e1d8 improved syntax;
wenzelm
parents: 14651
diff changeset
   195
  includes struct G
13936
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   196
  assumes m_closed [simp]:
14693
4deda204e1d8 improved syntax;
wenzelm
parents: 14651
diff changeset
   197
      "!!x y. [| x \<in> carrier G; y \<in> carrier G |] ==> x \<otimes> y \<in> carrier G"
4deda204e1d8 improved syntax;
wenzelm
parents: 14651
diff changeset
   198
    and one_closed [simp]: "\<one> \<in> carrier G"
13936
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   199
    and m_assoc:
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   200
      "!!x y z. [| x \<in> carrier G; y \<in> carrier G; z \<in> carrier G |] ==>
14693
4deda204e1d8 improved syntax;
wenzelm
parents: 14651
diff changeset
   201
      (x \<otimes> y) \<otimes> z = x \<otimes> (y \<otimes> z)"
4deda204e1d8 improved syntax;
wenzelm
parents: 14651
diff changeset
   202
    and l_one [simp]: "!!x. x \<in> carrier G ==> \<one> \<otimes> x = x"
14963
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14852
diff changeset
   203
    and l_inv_ex: "!!x. x \<in> carrier G ==> \<exists>y \<in> carrier G. y \<otimes> x = \<one>"
13936
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   204
  shows "group G"
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   205
proof -
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   206
  have l_cancel [simp]:
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   207
    "!!x y z. [| x \<in> carrier G; y \<in> carrier G; z \<in> carrier G |] ==>
14693
4deda204e1d8 improved syntax;
wenzelm
parents: 14651
diff changeset
   208
    (x \<otimes> y = x \<otimes> z) = (y = z)"
13936
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   209
  proof
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   210
    fix x y z
14693
4deda204e1d8 improved syntax;
wenzelm
parents: 14651
diff changeset
   211
    assume eq: "x \<otimes> y = x \<otimes> z"
4deda204e1d8 improved syntax;
wenzelm
parents: 14651
diff changeset
   212
      and G: "x \<in> carrier G"  "y \<in> carrier G"  "z \<in> carrier G"
13936
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   213
    with l_inv_ex obtain x_inv where xG: "x_inv \<in> carrier G"
14693
4deda204e1d8 improved syntax;
wenzelm
parents: 14651
diff changeset
   214
      and l_inv: "x_inv \<otimes> x = \<one>" by fast
4deda204e1d8 improved syntax;
wenzelm
parents: 14651
diff changeset
   215
    from G eq xG have "(x_inv \<otimes> x) \<otimes> y = (x_inv \<otimes> x) \<otimes> z"
13936
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   216
      by (simp add: m_assoc)
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   217
    with G show "y = z" by (simp add: l_inv)
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   218
  next
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   219
    fix x y z
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   220
    assume eq: "y = z"
14693
4deda204e1d8 improved syntax;
wenzelm
parents: 14651
diff changeset
   221
      and G: "x \<in> carrier G"  "y \<in> carrier G"  "z \<in> carrier G"
4deda204e1d8 improved syntax;
wenzelm
parents: 14651
diff changeset
   222
    then show "x \<otimes> y = x \<otimes> z" by simp
13936
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   223
  qed
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   224
  have r_one:
14693
4deda204e1d8 improved syntax;
wenzelm
parents: 14651
diff changeset
   225
    "!!x. x \<in> carrier G ==> x \<otimes> \<one> = x"
13936
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   226
  proof -
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   227
    fix x
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   228
    assume x: "x \<in> carrier G"
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   229
    with l_inv_ex obtain x_inv where xG: "x_inv \<in> carrier G"
14693
4deda204e1d8 improved syntax;
wenzelm
parents: 14651
diff changeset
   230
      and l_inv: "x_inv \<otimes> x = \<one>" by fast
4deda204e1d8 improved syntax;
wenzelm
parents: 14651
diff changeset
   231
    from x xG have "x_inv \<otimes> (x \<otimes> \<one>) = x_inv \<otimes> x"
13936
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   232
      by (simp add: m_assoc [symmetric] l_inv)
14693
4deda204e1d8 improved syntax;
wenzelm
parents: 14651
diff changeset
   233
    with x xG show "x \<otimes> \<one> = x" by simp
13936
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   234
  qed
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   235
  have inv_ex:
14963
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14852
diff changeset
   236
    "!!x. x \<in> carrier G ==> \<exists>y \<in> carrier G. y \<otimes> x = \<one> & x \<otimes> y = \<one>"
13936
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   237
  proof -
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   238
    fix x
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   239
    assume x: "x \<in> carrier G"
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   240
    with l_inv_ex obtain y where y: "y \<in> carrier G"
14693
4deda204e1d8 improved syntax;
wenzelm
parents: 14651
diff changeset
   241
      and l_inv: "y \<otimes> x = \<one>" by fast
4deda204e1d8 improved syntax;
wenzelm
parents: 14651
diff changeset
   242
    from x y have "y \<otimes> (x \<otimes> y) = y \<otimes> \<one>"
13936
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   243
      by (simp add: m_assoc [symmetric] l_inv r_one)
14693
4deda204e1d8 improved syntax;
wenzelm
parents: 14651
diff changeset
   244
    with x y have r_inv: "x \<otimes> y = \<one>"
13936
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   245
      by simp
14963
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14852
diff changeset
   246
    from x y show "\<exists>y \<in> carrier G. y \<otimes> x = \<one> & x \<otimes> y = \<one>"
13936
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   247
      by (fast intro: l_inv r_inv)
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   248
  qed
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   249
  then have carrier_subset_Units: "carrier G <= Units G"
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   250
    by (unfold Units_def) fast
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   251
  show ?thesis
14963
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14852
diff changeset
   252
    by (fast intro!: group.intro monoid.intro group_axioms.intro
13936
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   253
      carrier_subset_Units intro: prems r_one)
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   254
qed
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   255
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   256
lemma (in monoid) monoid_groupI:
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   257
  assumes l_inv_ex:
14963
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14852
diff changeset
   258
    "!!x. x \<in> carrier G ==> \<exists>y \<in> carrier G. y \<otimes> x = \<one>"
13936
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   259
  shows "group G"
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   260
  by (rule groupI) (auto intro: m_assoc l_inv_ex)
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   261
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   262
lemma (in group) Units_eq [simp]:
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   263
  "Units G = carrier G"
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   264
proof
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   265
  show "Units G <= carrier G" by fast
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   266
next
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   267
  show "carrier G <= Units G" by (rule Units)
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   268
qed
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   269
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   270
lemma (in group) inv_closed [intro, simp]:
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   271
  "x \<in> carrier G ==> inv x \<in> carrier G"
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   272
  using Units_inv_closed by simp
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   273
14963
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14852
diff changeset
   274
lemma (in group) l_inv [simp]:
13936
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   275
  "x \<in> carrier G ==> inv x \<otimes> x = \<one>"
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   276
  using Units_l_inv by simp
13813
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   277
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   278
subsection {* Cancellation Laws and Basic Properties *}
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   279
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   280
lemma (in group) l_cancel [simp]:
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   281
  "[| x \<in> carrier G; y \<in> carrier G; z \<in> carrier G |] ==>
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   282
   (x \<otimes> y = x \<otimes> z) = (y = z)"
13936
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   283
  using Units_l_inv by simp
13940
c67798653056 HOL-Algebra: New polynomial development added.
ballarin
parents: 13936
diff changeset
   284
14963
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14852
diff changeset
   285
lemma (in group) r_inv [simp]:
13813
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   286
  "x \<in> carrier G ==> x \<otimes> inv x = \<one>"
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   287
proof -
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   288
  assume x: "x \<in> carrier G"
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   289
  then have "inv x \<otimes> (x \<otimes> inv x) = inv x \<otimes> \<one>"
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   290
    by (simp add: m_assoc [symmetric] l_inv)
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   291
  with x show ?thesis by (simp del: r_one)
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   292
qed
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   293
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   294
lemma (in group) r_cancel [simp]:
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   295
  "[| x \<in> carrier G; y \<in> carrier G; z \<in> carrier G |] ==>
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   296
   (y \<otimes> x = z \<otimes> x) = (y = z)"
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   297
proof
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   298
  assume eq: "y \<otimes> x = z \<otimes> x"
14693
4deda204e1d8 improved syntax;
wenzelm
parents: 14651
diff changeset
   299
    and G: "x \<in> carrier G"  "y \<in> carrier G"  "z \<in> carrier G"
13813
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   300
  then have "y \<otimes> (x \<otimes> inv x) = z \<otimes> (x \<otimes> inv x)"
14963
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14852
diff changeset
   301
    by (simp add: m_assoc [symmetric] del: r_inv)
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14852
diff changeset
   302
  with G show "y = z" by simp
13813
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   303
next
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   304
  assume eq: "y = z"
14693
4deda204e1d8 improved syntax;
wenzelm
parents: 14651
diff changeset
   305
    and G: "x \<in> carrier G"  "y \<in> carrier G"  "z \<in> carrier G"
13813
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   306
  then show "y \<otimes> x = z \<otimes> x" by simp
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   307
qed
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   308
13854
91c9ab25fece First distributed version of Group and Ring theory.
ballarin
parents: 13835
diff changeset
   309
lemma (in group) inv_one [simp]:
91c9ab25fece First distributed version of Group and Ring theory.
ballarin
parents: 13835
diff changeset
   310
  "inv \<one> = \<one>"
91c9ab25fece First distributed version of Group and Ring theory.
ballarin
parents: 13835
diff changeset
   311
proof -
14963
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14852
diff changeset
   312
  have "inv \<one> = \<one> \<otimes> (inv \<one>)" by (simp del: r_inv)
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14852
diff changeset
   313
  moreover have "... = \<one>" by simp
13854
91c9ab25fece First distributed version of Group and Ring theory.
ballarin
parents: 13835
diff changeset
   314
  finally show ?thesis .
91c9ab25fece First distributed version of Group and Ring theory.
ballarin
parents: 13835
diff changeset
   315
qed
91c9ab25fece First distributed version of Group and Ring theory.
ballarin
parents: 13835
diff changeset
   316
13813
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   317
lemma (in group) inv_inv [simp]:
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   318
  "x \<in> carrier G ==> inv (inv x) = x"
13936
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   319
  using Units_inv_inv by simp
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   320
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   321
lemma (in group) inv_inj:
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   322
  "inj_on (m_inv G) (carrier G)"
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   323
  using inv_inj_on_Units by simp
13813
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   324
13854
91c9ab25fece First distributed version of Group and Ring theory.
ballarin
parents: 13835
diff changeset
   325
lemma (in group) inv_mult_group:
13813
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   326
  "[| x \<in> carrier G; y \<in> carrier G |] ==> inv (x \<otimes> y) = inv y \<otimes> inv x"
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   327
proof -
14693
4deda204e1d8 improved syntax;
wenzelm
parents: 14651
diff changeset
   328
  assume G: "x \<in> carrier G"  "y \<in> carrier G"
13813
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   329
  then have "inv (x \<otimes> y) \<otimes> (x \<otimes> y) = (inv y \<otimes> inv x) \<otimes> (x \<otimes> y)"
14963
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14852
diff changeset
   330
    by (simp add: m_assoc l_inv) (simp add: m_assoc [symmetric])
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14852
diff changeset
   331
  with G show ?thesis by (simp del: l_inv)
13813
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   332
qed
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   333
13940
c67798653056 HOL-Algebra: New polynomial development added.
ballarin
parents: 13936
diff changeset
   334
lemma (in group) inv_comm:
c67798653056 HOL-Algebra: New polynomial development added.
ballarin
parents: 13936
diff changeset
   335
  "[| x \<otimes> y = \<one>; x \<in> carrier G; y \<in> carrier G |] ==> y \<otimes> x = \<one>"
14693
4deda204e1d8 improved syntax;
wenzelm
parents: 14651
diff changeset
   336
  by (rule Units_inv_comm) auto
13940
c67798653056 HOL-Algebra: New polynomial development added.
ballarin
parents: 13936
diff changeset
   337
13944
9b34607cd83e new proofs about direct products, etc.
paulson
parents: 13943
diff changeset
   338
lemma (in group) inv_equality:
13943
83d842ccd4aa moving Bij.thy from GroupTheory to Algebra
paulson
parents: 13940
diff changeset
   339
     "[|y \<otimes> x = \<one>; x \<in> carrier G; y \<in> carrier G|] ==> inv x = y"
83d842ccd4aa moving Bij.thy from GroupTheory to Algebra
paulson
parents: 13940
diff changeset
   340
apply (simp add: m_inv_def)
83d842ccd4aa moving Bij.thy from GroupTheory to Algebra
paulson
parents: 13940
diff changeset
   341
apply (rule the_equality)
14693
4deda204e1d8 improved syntax;
wenzelm
parents: 14651
diff changeset
   342
 apply (simp add: inv_comm [of y x])
4deda204e1d8 improved syntax;
wenzelm
parents: 14651
diff changeset
   343
apply (rule r_cancel [THEN iffD1], auto)
13943
83d842ccd4aa moving Bij.thy from GroupTheory to Algebra
paulson
parents: 13940
diff changeset
   344
done
83d842ccd4aa moving Bij.thy from GroupTheory to Algebra
paulson
parents: 13940
diff changeset
   345
13936
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   346
text {* Power *}
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   347
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   348
lemma (in group) int_pow_def2:
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   349
  "a (^) (z::int) = (if neg z then inv (a (^) (nat (-z))) else a (^) (nat z))"
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   350
  by (simp add: int_pow_def nat_pow_def Let_def)
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   351
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   352
lemma (in group) int_pow_0 [simp]:
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   353
  "x (^) (0::int) = \<one>"
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   354
  by (simp add: int_pow_def2)
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   355
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   356
lemma (in group) int_pow_one [simp]:
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   357
  "\<one> (^) (z::int) = \<one>"
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   358
  by (simp add: int_pow_def2)
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   359
14963
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14852
diff changeset
   360
subsection {* Subgroups *}
13813
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   361
14963
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14852
diff changeset
   362
locale subgroup = var H + struct G + 
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14852
diff changeset
   363
  assumes subset: "H \<subseteq> carrier G"
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14852
diff changeset
   364
    and m_closed [intro, simp]: "\<lbrakk>x \<in> H; y \<in> H\<rbrakk> \<Longrightarrow> x \<otimes> y \<in> H"
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14852
diff changeset
   365
    and  one_closed [simp]: "\<one> \<in> H"
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14852
diff changeset
   366
    and m_inv_closed [intro,simp]: "x \<in> H \<Longrightarrow> inv x \<in> H"
13813
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   367
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   368
declare (in subgroup) group.intro [intro]
13949
0ce528cd6f19 HOL-Algebra complete for release Isabelle2003 (modulo section headers).
ballarin
parents: 13944
diff changeset
   369
14963
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14852
diff changeset
   370
lemma (in subgroup) mem_carrier [simp]:
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14852
diff changeset
   371
  "x \<in> H \<Longrightarrow> x \<in> carrier G"
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14852
diff changeset
   372
  using subset by blast
13813
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   373
14963
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14852
diff changeset
   374
lemma subgroup_imp_subset:
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14852
diff changeset
   375
  "subgroup H G \<Longrightarrow> H \<subseteq> carrier G"
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14852
diff changeset
   376
  by (rule subgroup.subset)
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14852
diff changeset
   377
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14852
diff changeset
   378
lemma (in subgroup) subgroup_is_group [intro]:
13813
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   379
  includes group G
14963
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14852
diff changeset
   380
  shows "group (G\<lparr>carrier := H\<rparr>)" 
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14852
diff changeset
   381
  by (rule groupI) (auto intro: m_assoc l_inv mem_carrier)
13813
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   382
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   383
text {*
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   384
  Since @{term H} is nonempty, it contains some element @{term x}.  Since
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   385
  it is closed under inverse, it contains @{text "inv x"}.  Since
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   386
  it is closed under product, it contains @{text "x \<otimes> inv x = \<one>"}.
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   387
*}
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   388
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   389
lemma (in group) one_in_subset:
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   390
  "[| H \<subseteq> carrier G; H \<noteq> {}; \<forall>a \<in> H. inv a \<in> H; \<forall>a\<in>H. \<forall>b\<in>H. a \<otimes> b \<in> H |]
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   391
   ==> \<one> \<in> H"
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   392
by (force simp add: l_inv)
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   393
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   394
text {* A characterization of subgroups: closed, non-empty subset. *}
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   395
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   396
lemma (in group) subgroupI:
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   397
  assumes subset: "H \<subseteq> carrier G" and non_empty: "H \<noteq> {}"
14963
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14852
diff changeset
   398
    and inv: "!!a. a \<in> H \<Longrightarrow> inv a \<in> H"
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14852
diff changeset
   399
    and mult: "!!a b. \<lbrakk>a \<in> H; b \<in> H\<rbrakk> \<Longrightarrow> a \<otimes> b \<in> H"
13813
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   400
  shows "subgroup H G"
14963
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14852
diff changeset
   401
proof (simp add: subgroup_def prems)
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14852
diff changeset
   402
  show "\<one> \<in> H" by (rule one_in_subset) (auto simp only: prems)
13813
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   403
qed
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   404
13936
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   405
declare monoid.one_closed [iff] group.inv_closed [simp]
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   406
  monoid.l_one [simp] monoid.r_one [simp] group.inv_inv [simp]
13813
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   407
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   408
lemma subgroup_nonempty:
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   409
  "~ subgroup {} G"
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   410
  by (blast dest: subgroup.one_closed)
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   411
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   412
lemma (in subgroup) finite_imp_card_positive:
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   413
  "finite (carrier G) ==> 0 < card H"
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   414
proof (rule classical)
14963
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14852
diff changeset
   415
  assume "finite (carrier G)" "~ 0 < card H"
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14852
diff changeset
   416
  then have "finite H" by (blast intro: finite_subset [OF subset])
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14852
diff changeset
   417
  with prems have "subgroup {} G" by simp
13813
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   418
  with subgroup_nonempty show ?thesis by contradiction
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   419
qed
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   420
13936
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   421
(*
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   422
lemma (in monoid) Units_subgroup:
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   423
  "subgroup (Units G) G"
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   424
*)
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   425
13813
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   426
subsection {* Direct Products *}
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   427
14963
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14852
diff changeset
   428
constdefs
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14852
diff changeset
   429
  DirProd :: "_ \<Rightarrow> _ \<Rightarrow> ('a \<times> 'b) monoid"  (infixr "\<times>\<times>" 80)
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14852
diff changeset
   430
  "G \<times>\<times> H \<equiv> \<lparr>carrier = carrier G \<times> carrier H,
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14852
diff changeset
   431
                mult = (\<lambda>(g, h) (g', h'). (g \<otimes>\<^bsub>G\<^esub> g', h \<otimes>\<^bsub>H\<^esub> h')),
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14852
diff changeset
   432
                one = (\<one>\<^bsub>G\<^esub>, \<one>\<^bsub>H\<^esub>)\<rparr>"
13813
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   433
14963
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14852
diff changeset
   434
lemma DirProd_monoid:
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14852
diff changeset
   435
  includes monoid G + monoid H
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14852
diff changeset
   436
  shows "monoid (G \<times>\<times> H)"
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14852
diff changeset
   437
proof -
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14852
diff changeset
   438
  from prems
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14852
diff changeset
   439
  show ?thesis by (unfold monoid_def DirProd_def, auto) 
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14852
diff changeset
   440
qed
13813
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   441
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   442
14963
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14852
diff changeset
   443
text{*Does not use the previous result because it's easier just to use auto.*}
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14852
diff changeset
   444
lemma DirProd_group:
13813
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   445
  includes group G + group H
14963
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14852
diff changeset
   446
  shows "group (G \<times>\<times> H)"
13936
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   447
  by (rule groupI)
14963
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14852
diff changeset
   448
     (auto intro: G.m_assoc H.m_assoc G.l_inv H.l_inv
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14852
diff changeset
   449
           simp add: DirProd_def)
13813
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   450
14963
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14852
diff changeset
   451
lemma carrier_DirProd [simp]:
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14852
diff changeset
   452
     "carrier (G \<times>\<times> H) = carrier G \<times> carrier H"
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14852
diff changeset
   453
  by (simp add: DirProd_def)
13944
9b34607cd83e new proofs about direct products, etc.
paulson
parents: 13943
diff changeset
   454
14963
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14852
diff changeset
   455
lemma one_DirProd [simp]:
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14852
diff changeset
   456
     "\<one>\<^bsub>G \<times>\<times> H\<^esub> = (\<one>\<^bsub>G\<^esub>, \<one>\<^bsub>H\<^esub>)"
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14852
diff changeset
   457
  by (simp add: DirProd_def)
13944
9b34607cd83e new proofs about direct products, etc.
paulson
parents: 13943
diff changeset
   458
14963
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14852
diff changeset
   459
lemma mult_DirProd [simp]:
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14852
diff changeset
   460
     "(g, h) \<otimes>\<^bsub>(G \<times>\<times> H)\<^esub> (g', h') = (g \<otimes>\<^bsub>G\<^esub> g', h \<otimes>\<^bsub>H\<^esub> h')"
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14852
diff changeset
   461
  by (simp add: DirProd_def)
13944
9b34607cd83e new proofs about direct products, etc.
paulson
parents: 13943
diff changeset
   462
14963
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14852
diff changeset
   463
lemma inv_DirProd [simp]:
13944
9b34607cd83e new proofs about direct products, etc.
paulson
parents: 13943
diff changeset
   464
  includes group G + group H
9b34607cd83e new proofs about direct products, etc.
paulson
parents: 13943
diff changeset
   465
  assumes g: "g \<in> carrier G"
9b34607cd83e new proofs about direct products, etc.
paulson
parents: 13943
diff changeset
   466
      and h: "h \<in> carrier H"
14963
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14852
diff changeset
   467
  shows "m_inv (G \<times>\<times> H) (g, h) = (inv\<^bsub>G\<^esub> g, inv\<^bsub>H\<^esub> h)"
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14852
diff changeset
   468
  apply (rule group.inv_equality [OF DirProd_group])
13944
9b34607cd83e new proofs about direct products, etc.
paulson
parents: 13943
diff changeset
   469
  apply (simp_all add: prems group_def group.l_inv)
9b34607cd83e new proofs about direct products, etc.
paulson
parents: 13943
diff changeset
   470
  done
9b34607cd83e new proofs about direct products, etc.
paulson
parents: 13943
diff changeset
   471
14963
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14852
diff changeset
   472
text{*This alternative proof of the previous result demonstrates instantiate.
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14852
diff changeset
   473
   It uses @{text Prod.inv_equality} (available after instantiation) instead of
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14852
diff changeset
   474
   @{text "group.inv_equality [OF DirProd_group]"}. *}
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14852
diff changeset
   475
lemma
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14852
diff changeset
   476
  includes group G + group H
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14852
diff changeset
   477
  assumes g: "g \<in> carrier G"
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14852
diff changeset
   478
      and h: "h \<in> carrier H"
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14852
diff changeset
   479
  shows "m_inv (G \<times>\<times> H) (g, h) = (inv\<^bsub>G\<^esub> g, inv\<^bsub>H\<^esub> h)"
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14852
diff changeset
   480
proof -
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14852
diff changeset
   481
  have "group (G \<times>\<times> H)"
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14852
diff changeset
   482
    by (blast intro: DirProd_group group.intro prems)
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14852
diff changeset
   483
  then instantiate Prod: group
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14852
diff changeset
   484
  show ?thesis by (simp add: Prod.inv_equality g h)
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14852
diff changeset
   485
qed
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14852
diff changeset
   486
  
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14852
diff changeset
   487
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14852
diff changeset
   488
subsection {* Homomorphisms and Isomorphisms *}
13813
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   489
14651
02b8f3bcf7fe improved notation;
wenzelm
parents: 14551
diff changeset
   490
constdefs (structure G and H)
02b8f3bcf7fe improved notation;
wenzelm
parents: 14551
diff changeset
   491
  hom :: "_ => _ => ('a => 'b) set"
13813
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   492
  "hom G H ==
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   493
    {h. h \<in> carrier G -> carrier H &
14693
4deda204e1d8 improved syntax;
wenzelm
parents: 14651
diff changeset
   494
      (\<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)}"
13813
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   495
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   496
lemma hom_mult:
14693
4deda204e1d8 improved syntax;
wenzelm
parents: 14651
diff changeset
   497
  "[| h \<in> hom G H; x \<in> carrier G; y \<in> carrier G |]
4deda204e1d8 improved syntax;
wenzelm
parents: 14651
diff changeset
   498
   ==> h (x \<otimes>\<^bsub>G\<^esub> y) = h x \<otimes>\<^bsub>H\<^esub> h y"
4deda204e1d8 improved syntax;
wenzelm
parents: 14651
diff changeset
   499
  by (simp add: hom_def)
13813
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   500
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   501
lemma hom_closed:
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   502
  "[| h \<in> hom G H; x \<in> carrier G |] ==> h x \<in> carrier H"
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   503
  by (auto simp add: hom_def funcset_mem)
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   504
14761
28b5eb4a867f more results about isomorphisms
paulson
parents: 14751
diff changeset
   505
lemma (in group) hom_compose:
28b5eb4a867f more results about isomorphisms
paulson
parents: 14751
diff changeset
   506
     "[|h \<in> hom G H; i \<in> hom H I|] ==> compose (carrier G) i h \<in> hom G I"
28b5eb4a867f more results about isomorphisms
paulson
parents: 14751
diff changeset
   507
apply (auto simp add: hom_def funcset_compose) 
28b5eb4a867f more results about isomorphisms
paulson
parents: 14751
diff changeset
   508
apply (simp add: compose_def funcset_mem)
13943
83d842ccd4aa moving Bij.thy from GroupTheory to Algebra
paulson
parents: 13940
diff changeset
   509
done
83d842ccd4aa moving Bij.thy from GroupTheory to Algebra
paulson
parents: 13940
diff changeset
   510
14761
28b5eb4a867f more results about isomorphisms
paulson
parents: 14751
diff changeset
   511
28b5eb4a867f more results about isomorphisms
paulson
parents: 14751
diff changeset
   512
subsection {* Isomorphisms *}
28b5eb4a867f more results about isomorphisms
paulson
parents: 14751
diff changeset
   513
14803
f7557773cc87 more group isomorphisms
paulson
parents: 14761
diff changeset
   514
constdefs
f7557773cc87 more group isomorphisms
paulson
parents: 14761
diff changeset
   515
  iso :: "_ => _ => ('a => 'b) set"  (infixr "\<cong>" 60)
f7557773cc87 more group isomorphisms
paulson
parents: 14761
diff changeset
   516
  "G \<cong> H == {h. h \<in> hom G H & bij_betw h (carrier G) (carrier H)}"
14761
28b5eb4a867f more results about isomorphisms
paulson
parents: 14751
diff changeset
   517
14803
f7557773cc87 more group isomorphisms
paulson
parents: 14761
diff changeset
   518
lemma iso_refl: "(%x. x) \<in> G \<cong> G"
14761
28b5eb4a867f more results about isomorphisms
paulson
parents: 14751
diff changeset
   519
by (simp add: iso_def hom_def inj_on_def bij_betw_def Pi_def) 
28b5eb4a867f more results about isomorphisms
paulson
parents: 14751
diff changeset
   520
28b5eb4a867f more results about isomorphisms
paulson
parents: 14751
diff changeset
   521
lemma (in group) iso_sym:
14803
f7557773cc87 more group isomorphisms
paulson
parents: 14761
diff changeset
   522
     "h \<in> G \<cong> H \<Longrightarrow> Inv (carrier G) h \<in> H \<cong> G"
14761
28b5eb4a867f more results about isomorphisms
paulson
parents: 14751
diff changeset
   523
apply (simp add: iso_def bij_betw_Inv) 
28b5eb4a867f more results about isomorphisms
paulson
parents: 14751
diff changeset
   524
apply (subgoal_tac "Inv (carrier G) h \<in> carrier H \<rightarrow> carrier G") 
28b5eb4a867f more results about isomorphisms
paulson
parents: 14751
diff changeset
   525
 prefer 2 apply (simp add: bij_betw_imp_funcset [OF bij_betw_Inv]) 
28b5eb4a867f more results about isomorphisms
paulson
parents: 14751
diff changeset
   526
apply (simp add: hom_def bij_betw_def Inv_f_eq funcset_mem f_Inv_f) 
28b5eb4a867f more results about isomorphisms
paulson
parents: 14751
diff changeset
   527
done
28b5eb4a867f more results about isomorphisms
paulson
parents: 14751
diff changeset
   528
28b5eb4a867f more results about isomorphisms
paulson
parents: 14751
diff changeset
   529
lemma (in group) iso_trans: 
14803
f7557773cc87 more group isomorphisms
paulson
parents: 14761
diff changeset
   530
     "[|h \<in> G \<cong> H; i \<in> H \<cong> I|] ==> (compose (carrier G) i h) \<in> G \<cong> I"
14761
28b5eb4a867f more results about isomorphisms
paulson
parents: 14751
diff changeset
   531
by (auto simp add: iso_def hom_compose bij_betw_compose)
28b5eb4a867f more results about isomorphisms
paulson
parents: 14751
diff changeset
   532
14963
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14852
diff changeset
   533
lemma DirProd_commute_iso:
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14852
diff changeset
   534
  shows "(\<lambda>(x,y). (y,x)) \<in> (G \<times>\<times> H) \<cong> (H \<times>\<times> G)"
14761
28b5eb4a867f more results about isomorphisms
paulson
parents: 14751
diff changeset
   535
by (auto simp add: iso_def hom_def inj_on_def bij_betw_def Pi_def) 
28b5eb4a867f more results about isomorphisms
paulson
parents: 14751
diff changeset
   536
14963
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14852
diff changeset
   537
lemma DirProd_assoc_iso:
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14852
diff changeset
   538
  shows "(\<lambda>(x,y,z). (x,(y,z))) \<in> (G \<times>\<times> H \<times>\<times> I) \<cong> (G \<times>\<times> (H \<times>\<times> I))"
14761
28b5eb4a867f more results about isomorphisms
paulson
parents: 14751
diff changeset
   539
by (auto simp add: iso_def hom_def inj_on_def bij_betw_def Pi_def) 
28b5eb4a867f more results about isomorphisms
paulson
parents: 14751
diff changeset
   540
28b5eb4a867f more results about isomorphisms
paulson
parents: 14751
diff changeset
   541
14963
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14852
diff changeset
   542
text{*Basis for homomorphism proofs: we assume two groups @{term G} and
15076
4b3d280ef06a New prover for transitive and reflexive-transitive closure of relations.
ballarin
parents: 14963
diff changeset
   543
  @{term H}, with a homomorphism @{term h} between them*}
13813
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   544
locale group_hom = group G + group H + var h +
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   545
  assumes homh: "h \<in> hom G H"
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   546
  notes hom_mult [simp] = hom_mult [OF homh]
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   547
    and hom_closed [simp] = hom_closed [OF homh]
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   548
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   549
lemma (in group_hom) one_closed [simp]:
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   550
  "h \<one> \<in> carrier H"
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   551
  by simp
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   552
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   553
lemma (in group_hom) hom_one [simp]:
14693
4deda204e1d8 improved syntax;
wenzelm
parents: 14651
diff changeset
   554
  "h \<one> = \<one>\<^bsub>H\<^esub>"
13813
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   555
proof -
15076
4b3d280ef06a New prover for transitive and reflexive-transitive closure of relations.
ballarin
parents: 14963
diff changeset
   556
  have "h \<one> \<otimes>\<^bsub>H\<^esub> \<one>\<^bsub>H\<^esub> = h \<one> \<otimes>\<^bsub>H\<^esub> h \<one>"
13813
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   557
    by (simp add: hom_mult [symmetric] del: hom_mult)
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   558
  then show ?thesis by (simp del: r_one)
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   559
qed
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   560
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   561
lemma (in group_hom) inv_closed [simp]:
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   562
  "x \<in> carrier G ==> h (inv x) \<in> carrier H"
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   563
  by simp
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   564
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   565
lemma (in group_hom) hom_inv [simp]:
14693
4deda204e1d8 improved syntax;
wenzelm
parents: 14651
diff changeset
   566
  "x \<in> carrier G ==> h (inv x) = inv\<^bsub>H\<^esub> (h x)"
13813
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   567
proof -
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   568
  assume x: "x \<in> carrier G"
14693
4deda204e1d8 improved syntax;
wenzelm
parents: 14651
diff changeset
   569
  then have "h x \<otimes>\<^bsub>H\<^esub> h (inv x) = \<one>\<^bsub>H\<^esub>"
14963
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14852
diff changeset
   570
    by (simp add: hom_mult [symmetric] del: hom_mult)
14693
4deda204e1d8 improved syntax;
wenzelm
parents: 14651
diff changeset
   571
  also from x have "... = h x \<otimes>\<^bsub>H\<^esub> inv\<^bsub>H\<^esub> (h x)"
14963
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14852
diff changeset
   572
    by (simp add: hom_mult [symmetric] del: hom_mult)
14693
4deda204e1d8 improved syntax;
wenzelm
parents: 14651
diff changeset
   573
  finally have "h x \<otimes>\<^bsub>H\<^esub> h (inv x) = h x \<otimes>\<^bsub>H\<^esub> inv\<^bsub>H\<^esub> (h x)" .
14963
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14852
diff changeset
   574
  with x show ?thesis by (simp del: H.r_inv)
13813
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   575
qed
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   576
13949
0ce528cd6f19 HOL-Algebra complete for release Isabelle2003 (modulo section headers).
ballarin
parents: 13944
diff changeset
   577
subsection {* Commutative Structures *}
13936
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   578
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   579
text {*
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   580
  Naming convention: multiplicative structures that are commutative
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   581
  are called \emph{commutative}, additive structures are called
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   582
  \emph{Abelian}.
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   583
*}
13813
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   584
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   585
subsection {* Definition *}
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   586
14963
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14852
diff changeset
   587
locale comm_monoid = monoid +
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14852
diff changeset
   588
  assumes m_comm: "\<lbrakk>x \<in> carrier G; y \<in> carrier G\<rbrakk> \<Longrightarrow> x \<otimes> y = y \<otimes> x"
13813
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   589
14963
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14852
diff changeset
   590
lemma (in comm_monoid) m_lcomm:
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14852
diff changeset
   591
  "\<lbrakk>x \<in> carrier G; y \<in> carrier G; z \<in> carrier G\<rbrakk> \<Longrightarrow>
13813
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   592
   x \<otimes> (y \<otimes> z) = y \<otimes> (x \<otimes> z)"
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   593
proof -
14693
4deda204e1d8 improved syntax;
wenzelm
parents: 14651
diff changeset
   594
  assume xyz: "x \<in> carrier G"  "y \<in> carrier G"  "z \<in> carrier G"
13813
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   595
  from xyz have "x \<otimes> (y \<otimes> z) = (x \<otimes> y) \<otimes> z" by (simp add: m_assoc)
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   596
  also from xyz have "... = (y \<otimes> x) \<otimes> z" by (simp add: m_comm)
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   597
  also from xyz have "... = y \<otimes> (x \<otimes> z)" by (simp add: m_assoc)
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   598
  finally show ?thesis .
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   599
qed
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   600
14963
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14852
diff changeset
   601
lemmas (in comm_monoid) m_ac = m_assoc m_comm m_lcomm
13813
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   602
13936
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   603
lemma comm_monoidI:
14693
4deda204e1d8 improved syntax;
wenzelm
parents: 14651
diff changeset
   604
  includes struct G
13936
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   605
  assumes m_closed:
14693
4deda204e1d8 improved syntax;
wenzelm
parents: 14651
diff changeset
   606
      "!!x y. [| x \<in> carrier G; y \<in> carrier G |] ==> x \<otimes> y \<in> carrier G"
4deda204e1d8 improved syntax;
wenzelm
parents: 14651
diff changeset
   607
    and one_closed: "\<one> \<in> carrier G"
13936
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   608
    and m_assoc:
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   609
      "!!x y z. [| x \<in> carrier G; y \<in> carrier G; z \<in> carrier G |] ==>
14693
4deda204e1d8 improved syntax;
wenzelm
parents: 14651
diff changeset
   610
      (x \<otimes> y) \<otimes> z = x \<otimes> (y \<otimes> z)"
4deda204e1d8 improved syntax;
wenzelm
parents: 14651
diff changeset
   611
    and l_one: "!!x. x \<in> carrier G ==> \<one> \<otimes> x = x"
13936
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   612
    and m_comm:
14693
4deda204e1d8 improved syntax;
wenzelm
parents: 14651
diff changeset
   613
      "!!x y. [| x \<in> carrier G; y \<in> carrier G |] ==> x \<otimes> y = y \<otimes> x"
13936
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   614
  shows "comm_monoid G"
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   615
  using l_one
14963
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14852
diff changeset
   616
    by (auto intro!: comm_monoid.intro comm_monoid_axioms.intro monoid.intro 
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14852
diff changeset
   617
             intro: prems simp: m_closed one_closed m_comm)
13817
7e031a968443 Product operator added --- preliminary.
ballarin
parents: 13813
diff changeset
   618
13936
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   619
lemma (in monoid) monoid_comm_monoidI:
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   620
  assumes m_comm:
14693
4deda204e1d8 improved syntax;
wenzelm
parents: 14651
diff changeset
   621
      "!!x y. [| x \<in> carrier G; y \<in> carrier G |] ==> x \<otimes> y = y \<otimes> x"
13936
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   622
  shows "comm_monoid G"
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   623
  by (rule comm_monoidI) (auto intro: m_assoc m_comm)
14963
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14852
diff changeset
   624
14693
4deda204e1d8 improved syntax;
wenzelm
parents: 14651
diff changeset
   625
(*lemma (in comm_monoid) r_one [simp]:
13817
7e031a968443 Product operator added --- preliminary.
ballarin
parents: 13813
diff changeset
   626
  "x \<in> carrier G ==> x \<otimes> \<one> = x"
7e031a968443 Product operator added --- preliminary.
ballarin
parents: 13813
diff changeset
   627
proof -
7e031a968443 Product operator added --- preliminary.
ballarin
parents: 13813
diff changeset
   628
  assume G: "x \<in> carrier G"
7e031a968443 Product operator added --- preliminary.
ballarin
parents: 13813
diff changeset
   629
  then have "x \<otimes> \<one> = \<one> \<otimes> x" by (simp add: m_comm)
7e031a968443 Product operator added --- preliminary.
ballarin
parents: 13813
diff changeset
   630
  also from G have "... = x" by simp
7e031a968443 Product operator added --- preliminary.
ballarin
parents: 13813
diff changeset
   631
  finally show ?thesis .
14693
4deda204e1d8 improved syntax;
wenzelm
parents: 14651
diff changeset
   632
qed*)
14963
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14852
diff changeset
   633
13936
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   634
lemma (in comm_monoid) nat_pow_distr:
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   635
  "[| x \<in> carrier G; y \<in> carrier G |] ==>
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   636
  (x \<otimes> y) (^) (n::nat) = x (^) n \<otimes> y (^) n"
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   637
  by (induct n) (simp, simp add: m_ac)
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   638
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   639
locale comm_group = comm_monoid + group
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   640
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   641
lemma (in group) group_comm_groupI:
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   642
  assumes m_comm: "!!x y. [| x \<in> carrier G; y \<in> carrier G |] ==>
14693
4deda204e1d8 improved syntax;
wenzelm
parents: 14651
diff changeset
   643
      x \<otimes> y = y \<otimes> x"
13936
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   644
  shows "comm_group G"
14963
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14852
diff changeset
   645
  by (fast intro: comm_group.intro comm_monoid_axioms.intro
14761
28b5eb4a867f more results about isomorphisms
paulson
parents: 14751
diff changeset
   646
                  is_group prems)
13817
7e031a968443 Product operator added --- preliminary.
ballarin
parents: 13813
diff changeset
   647
13936
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   648
lemma comm_groupI:
14693
4deda204e1d8 improved syntax;
wenzelm
parents: 14651
diff changeset
   649
  includes struct G
13936
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   650
  assumes m_closed:
14693
4deda204e1d8 improved syntax;
wenzelm
parents: 14651
diff changeset
   651
      "!!x y. [| x \<in> carrier G; y \<in> carrier G |] ==> x \<otimes> y \<in> carrier G"
4deda204e1d8 improved syntax;
wenzelm
parents: 14651
diff changeset
   652
    and one_closed: "\<one> \<in> carrier G"
13936
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   653
    and m_assoc:
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   654
      "!!x y z. [| x \<in> carrier G; y \<in> carrier G; z \<in> carrier G |] ==>
14693
4deda204e1d8 improved syntax;
wenzelm
parents: 14651
diff changeset
   655
      (x \<otimes> y) \<otimes> z = x \<otimes> (y \<otimes> z)"
13936
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   656
    and m_comm:
14693
4deda204e1d8 improved syntax;
wenzelm
parents: 14651
diff changeset
   657
      "!!x y. [| x \<in> carrier G; y \<in> carrier G |] ==> x \<otimes> y = y \<otimes> x"
4deda204e1d8 improved syntax;
wenzelm
parents: 14651
diff changeset
   658
    and l_one: "!!x. x \<in> carrier G ==> \<one> \<otimes> x = x"
14963
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14852
diff changeset
   659
    and l_inv_ex: "!!x. x \<in> carrier G ==> \<exists>y \<in> carrier G. y \<otimes> x = \<one>"
13936
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   660
  shows "comm_group G"
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   661
  by (fast intro: group.group_comm_groupI groupI prems)
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   662
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   663
lemma (in comm_group) inv_mult:
13854
91c9ab25fece First distributed version of Group and Ring theory.
ballarin
parents: 13835
diff changeset
   664
  "[| x \<in> carrier G; y \<in> carrier G |] ==> inv (x \<otimes> y) = inv x \<otimes> inv y"
13936
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   665
  by (simp add: m_ac inv_mult_group)
13854
91c9ab25fece First distributed version of Group and Ring theory.
ballarin
parents: 13835
diff changeset
   666
14751
0d7850e27fed Change of theory hierarchy: Group is now based in Lattice.
ballarin
parents: 14706
diff changeset
   667
subsection {* Lattice of subgroups of a group *}
0d7850e27fed Change of theory hierarchy: Group is now based in Lattice.
ballarin
parents: 14706
diff changeset
   668
0d7850e27fed Change of theory hierarchy: Group is now based in Lattice.
ballarin
parents: 14706
diff changeset
   669
text_raw {* \label{sec:subgroup-lattice} *}
0d7850e27fed Change of theory hierarchy: Group is now based in Lattice.
ballarin
parents: 14706
diff changeset
   670
0d7850e27fed Change of theory hierarchy: Group is now based in Lattice.
ballarin
parents: 14706
diff changeset
   671
theorem (in group) subgroups_partial_order:
0d7850e27fed Change of theory hierarchy: Group is now based in Lattice.
ballarin
parents: 14706
diff changeset
   672
  "partial_order (| carrier = {H. subgroup H G}, le = op \<subseteq> |)"
0d7850e27fed Change of theory hierarchy: Group is now based in Lattice.
ballarin
parents: 14706
diff changeset
   673
  by (rule partial_order.intro) simp_all
0d7850e27fed Change of theory hierarchy: Group is now based in Lattice.
ballarin
parents: 14706
diff changeset
   674
0d7850e27fed Change of theory hierarchy: Group is now based in Lattice.
ballarin
parents: 14706
diff changeset
   675
lemma (in group) subgroup_self:
0d7850e27fed Change of theory hierarchy: Group is now based in Lattice.
ballarin
parents: 14706
diff changeset
   676
  "subgroup (carrier G) G"
0d7850e27fed Change of theory hierarchy: Group is now based in Lattice.
ballarin
parents: 14706
diff changeset
   677
  by (rule subgroupI) auto
0d7850e27fed Change of theory hierarchy: Group is now based in Lattice.
ballarin
parents: 14706
diff changeset
   678
0d7850e27fed Change of theory hierarchy: Group is now based in Lattice.
ballarin
parents: 14706
diff changeset
   679
lemma (in group) subgroup_imp_group:
0d7850e27fed Change of theory hierarchy: Group is now based in Lattice.
ballarin
parents: 14706
diff changeset
   680
  "subgroup H G ==> group (G(| carrier := H |))"
14963
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14852
diff changeset
   681
  using subgroup.subgroup_is_group [OF _ group.intro] .
14751
0d7850e27fed Change of theory hierarchy: Group is now based in Lattice.
ballarin
parents: 14706
diff changeset
   682
0d7850e27fed Change of theory hierarchy: Group is now based in Lattice.
ballarin
parents: 14706
diff changeset
   683
lemma (in group) is_monoid [intro, simp]:
0d7850e27fed Change of theory hierarchy: Group is now based in Lattice.
ballarin
parents: 14706
diff changeset
   684
  "monoid G"
14963
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14852
diff changeset
   685
  by (auto intro: monoid.intro m_assoc) 
14751
0d7850e27fed Change of theory hierarchy: Group is now based in Lattice.
ballarin
parents: 14706
diff changeset
   686
0d7850e27fed Change of theory hierarchy: Group is now based in Lattice.
ballarin
parents: 14706
diff changeset
   687
lemma (in group) subgroup_inv_equality:
0d7850e27fed Change of theory hierarchy: Group is now based in Lattice.
ballarin
parents: 14706
diff changeset
   688
  "[| subgroup H G; x \<in> H |] ==> m_inv (G (| carrier := H |)) x = inv x"
0d7850e27fed Change of theory hierarchy: Group is now based in Lattice.
ballarin
parents: 14706
diff changeset
   689
apply (rule_tac inv_equality [THEN sym])
14761
28b5eb4a867f more results about isomorphisms
paulson
parents: 14751
diff changeset
   690
  apply (rule group.l_inv [OF subgroup_imp_group, simplified], assumption+)
28b5eb4a867f more results about isomorphisms
paulson
parents: 14751
diff changeset
   691
 apply (rule subsetD [OF subgroup.subset], assumption+)
28b5eb4a867f more results about isomorphisms
paulson
parents: 14751
diff changeset
   692
apply (rule subsetD [OF subgroup.subset], assumption)
28b5eb4a867f more results about isomorphisms
paulson
parents: 14751
diff changeset
   693
apply (rule_tac group.inv_closed [OF subgroup_imp_group, simplified], assumption+)
14751
0d7850e27fed Change of theory hierarchy: Group is now based in Lattice.
ballarin
parents: 14706
diff changeset
   694
done
0d7850e27fed Change of theory hierarchy: Group is now based in Lattice.
ballarin
parents: 14706
diff changeset
   695
0d7850e27fed Change of theory hierarchy: Group is now based in Lattice.
ballarin
parents: 14706
diff changeset
   696
theorem (in group) subgroups_Inter:
0d7850e27fed Change of theory hierarchy: Group is now based in Lattice.
ballarin
parents: 14706
diff changeset
   697
  assumes subgr: "(!!H. H \<in> A ==> subgroup H G)"
0d7850e27fed Change of theory hierarchy: Group is now based in Lattice.
ballarin
parents: 14706
diff changeset
   698
    and not_empty: "A ~= {}"
0d7850e27fed Change of theory hierarchy: Group is now based in Lattice.
ballarin
parents: 14706
diff changeset
   699
  shows "subgroup (\<Inter>A) G"
0d7850e27fed Change of theory hierarchy: Group is now based in Lattice.
ballarin
parents: 14706
diff changeset
   700
proof (rule subgroupI)
0d7850e27fed Change of theory hierarchy: Group is now based in Lattice.
ballarin
parents: 14706
diff changeset
   701
  from subgr [THEN subgroup.subset] and not_empty
0d7850e27fed Change of theory hierarchy: Group is now based in Lattice.
ballarin
parents: 14706
diff changeset
   702
  show "\<Inter>A \<subseteq> carrier G" by blast
0d7850e27fed Change of theory hierarchy: Group is now based in Lattice.
ballarin
parents: 14706
diff changeset
   703
next
0d7850e27fed Change of theory hierarchy: Group is now based in Lattice.
ballarin
parents: 14706
diff changeset
   704
  from subgr [THEN subgroup.one_closed]
0d7850e27fed Change of theory hierarchy: Group is now based in Lattice.
ballarin
parents: 14706
diff changeset
   705
  show "\<Inter>A ~= {}" by blast
0d7850e27fed Change of theory hierarchy: Group is now based in Lattice.
ballarin
parents: 14706
diff changeset
   706
next
0d7850e27fed Change of theory hierarchy: Group is now based in Lattice.
ballarin
parents: 14706
diff changeset
   707
  fix x assume "x \<in> \<Inter>A"
0d7850e27fed Change of theory hierarchy: Group is now based in Lattice.
ballarin
parents: 14706
diff changeset
   708
  with subgr [THEN subgroup.m_inv_closed]
0d7850e27fed Change of theory hierarchy: Group is now based in Lattice.
ballarin
parents: 14706
diff changeset
   709
  show "inv x \<in> \<Inter>A" by blast
0d7850e27fed Change of theory hierarchy: Group is now based in Lattice.
ballarin
parents: 14706
diff changeset
   710
next
0d7850e27fed Change of theory hierarchy: Group is now based in Lattice.
ballarin
parents: 14706
diff changeset
   711
  fix x y assume "x \<in> \<Inter>A" "y \<in> \<Inter>A"
0d7850e27fed Change of theory hierarchy: Group is now based in Lattice.
ballarin
parents: 14706
diff changeset
   712
  with subgr [THEN subgroup.m_closed]
0d7850e27fed Change of theory hierarchy: Group is now based in Lattice.
ballarin
parents: 14706
diff changeset
   713
  show "x \<otimes> y \<in> \<Inter>A" by blast
0d7850e27fed Change of theory hierarchy: Group is now based in Lattice.
ballarin
parents: 14706
diff changeset
   714
qed
0d7850e27fed Change of theory hierarchy: Group is now based in Lattice.
ballarin
parents: 14706
diff changeset
   715
0d7850e27fed Change of theory hierarchy: Group is now based in Lattice.
ballarin
parents: 14706
diff changeset
   716
theorem (in group) subgroups_complete_lattice:
0d7850e27fed Change of theory hierarchy: Group is now based in Lattice.
ballarin
parents: 14706
diff changeset
   717
  "complete_lattice (| carrier = {H. subgroup H G}, le = op \<subseteq> |)"
0d7850e27fed Change of theory hierarchy: Group is now based in Lattice.
ballarin
parents: 14706
diff changeset
   718
    (is "complete_lattice ?L")
0d7850e27fed Change of theory hierarchy: Group is now based in Lattice.
ballarin
parents: 14706
diff changeset
   719
proof (rule partial_order.complete_lattice_criterion1)
0d7850e27fed Change of theory hierarchy: Group is now based in Lattice.
ballarin
parents: 14706
diff changeset
   720
  show "partial_order ?L" by (rule subgroups_partial_order)
0d7850e27fed Change of theory hierarchy: Group is now based in Lattice.
ballarin
parents: 14706
diff changeset
   721
next
0d7850e27fed Change of theory hierarchy: Group is now based in Lattice.
ballarin
parents: 14706
diff changeset
   722
  have "greatest ?L (carrier G) (carrier ?L)"
0d7850e27fed Change of theory hierarchy: Group is now based in Lattice.
ballarin
parents: 14706
diff changeset
   723
    by (unfold greatest_def) (simp add: subgroup.subset subgroup_self)
14963
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14852
diff changeset
   724
  then show "\<exists>G. greatest ?L G (carrier ?L)" ..
14751
0d7850e27fed Change of theory hierarchy: Group is now based in Lattice.
ballarin
parents: 14706
diff changeset
   725
next
0d7850e27fed Change of theory hierarchy: Group is now based in Lattice.
ballarin
parents: 14706
diff changeset
   726
  fix A
0d7850e27fed Change of theory hierarchy: Group is now based in Lattice.
ballarin
parents: 14706
diff changeset
   727
  assume L: "A \<subseteq> carrier ?L" and non_empty: "A ~= {}"
0d7850e27fed Change of theory hierarchy: Group is now based in Lattice.
ballarin
parents: 14706
diff changeset
   728
  then have Int_subgroup: "subgroup (\<Inter>A) G"
0d7850e27fed Change of theory hierarchy: Group is now based in Lattice.
ballarin
parents: 14706
diff changeset
   729
    by (fastsimp intro: subgroups_Inter)
0d7850e27fed Change of theory hierarchy: Group is now based in Lattice.
ballarin
parents: 14706
diff changeset
   730
  have "greatest ?L (\<Inter>A) (Lower ?L A)"
0d7850e27fed Change of theory hierarchy: Group is now based in Lattice.
ballarin
parents: 14706
diff changeset
   731
    (is "greatest ?L ?Int _")
0d7850e27fed Change of theory hierarchy: Group is now based in Lattice.
ballarin
parents: 14706
diff changeset
   732
  proof (rule greatest_LowerI)
0d7850e27fed Change of theory hierarchy: Group is now based in Lattice.
ballarin
parents: 14706
diff changeset
   733
    fix H
0d7850e27fed Change of theory hierarchy: Group is now based in Lattice.
ballarin
parents: 14706
diff changeset
   734
    assume H: "H \<in> A"
0d7850e27fed Change of theory hierarchy: Group is now based in Lattice.
ballarin
parents: 14706
diff changeset
   735
    with L have subgroupH: "subgroup H G" by auto
0d7850e27fed Change of theory hierarchy: Group is now based in Lattice.
ballarin
parents: 14706
diff changeset
   736
    from subgroupH have groupH: "group (G (| carrier := H |))" (is "group ?H")
0d7850e27fed Change of theory hierarchy: Group is now based in Lattice.
ballarin
parents: 14706
diff changeset
   737
      by (rule subgroup_imp_group)
0d7850e27fed Change of theory hierarchy: Group is now based in Lattice.
ballarin
parents: 14706
diff changeset
   738
    from groupH have monoidH: "monoid ?H"
0d7850e27fed Change of theory hierarchy: Group is now based in Lattice.
ballarin
parents: 14706
diff changeset
   739
      by (rule group.is_monoid)
0d7850e27fed Change of theory hierarchy: Group is now based in Lattice.
ballarin
parents: 14706
diff changeset
   740
    from H have Int_subset: "?Int \<subseteq> H" by fastsimp
0d7850e27fed Change of theory hierarchy: Group is now based in Lattice.
ballarin
parents: 14706
diff changeset
   741
    then show "le ?L ?Int H" by simp
0d7850e27fed Change of theory hierarchy: Group is now based in Lattice.
ballarin
parents: 14706
diff changeset
   742
  next
0d7850e27fed Change of theory hierarchy: Group is now based in Lattice.
ballarin
parents: 14706
diff changeset
   743
    fix H
0d7850e27fed Change of theory hierarchy: Group is now based in Lattice.
ballarin
parents: 14706
diff changeset
   744
    assume H: "H \<in> Lower ?L A"
0d7850e27fed Change of theory hierarchy: Group is now based in Lattice.
ballarin
parents: 14706
diff changeset
   745
    with L Int_subgroup show "le ?L H ?Int" by (fastsimp intro: Inter_greatest)
0d7850e27fed Change of theory hierarchy: Group is now based in Lattice.
ballarin
parents: 14706
diff changeset
   746
  next
0d7850e27fed Change of theory hierarchy: Group is now based in Lattice.
ballarin
parents: 14706
diff changeset
   747
    show "A \<subseteq> carrier ?L" by (rule L)
0d7850e27fed Change of theory hierarchy: Group is now based in Lattice.
ballarin
parents: 14706
diff changeset
   748
  next
0d7850e27fed Change of theory hierarchy: Group is now based in Lattice.
ballarin
parents: 14706
diff changeset
   749
    show "?Int \<in> carrier ?L" by simp (rule Int_subgroup)
0d7850e27fed Change of theory hierarchy: Group is now based in Lattice.
ballarin
parents: 14706
diff changeset
   750
  qed
14963
d584e32f7d46 removal of magmas and semigroups
paulson
parents: 14852
diff changeset
   751
  then show "\<exists>I. greatest ?L I (Lower ?L A)" ..
14751
0d7850e27fed Change of theory hierarchy: Group is now based in Lattice.
ballarin
parents: 14706
diff changeset
   752
qed
0d7850e27fed Change of theory hierarchy: Group is now based in Lattice.
ballarin
parents: 14706
diff changeset
   753
13813
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   754
end