src/HOL/Algebra/Group.thy
author ballarin
Wed, 10 Dec 2003 14:29:05 +0100
changeset 14286 0ae66ffb9784
parent 14254 342634f38451
child 14551 2cb6ff394bfb
permissions -rw-r--r--
New structure "partial_object" as common root for lattices and magmas.
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
13835
12b2ffbe543a Change to meta simplifier: congruence rules may now have frees as head of term.
ballarin
parents: 13817
diff changeset
    11
theory Group = FuncSet:
13813
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
    12
13936
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
    13
section {* From Magmas to Groups *}
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
    14
13813
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
    15
text {*
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
    16
  Definitions follow Jacobson, Basic Algebra I, Freeman, 1985; with
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
    17
  the exception of \emph{magma} which, following Bourbaki, is a set
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
    18
  together with a binary, closed operation.
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
    19
*}
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
    20
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
    21
subsection {* Definitions *}
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
    22
14286
0ae66ffb9784 New structure "partial_object" as common root for lattices and magmas.
ballarin
parents: 14254
diff changeset
    23
(* Object with a carrier set. *)
0ae66ffb9784 New structure "partial_object" as common root for lattices and magmas.
ballarin
parents: 14254
diff changeset
    24
0ae66ffb9784 New structure "partial_object" as common root for lattices and magmas.
ballarin
parents: 14254
diff changeset
    25
record 'a partial_object =
13813
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
    26
  carrier :: "'a set"
14286
0ae66ffb9784 New structure "partial_object" as common root for lattices and magmas.
ballarin
parents: 14254
diff changeset
    27
0ae66ffb9784 New structure "partial_object" as common root for lattices and magmas.
ballarin
parents: 14254
diff changeset
    28
record 'a semigroup = "'a partial_object" +
13813
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
    29
  mult :: "['a, 'a] => 'a" (infixl "\<otimes>\<index>" 70)
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
    30
13817
7e031a968443 Product operator added --- preliminary.
ballarin
parents: 13813
diff changeset
    31
record 'a monoid = "'a semigroup" +
13813
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
    32
  one :: 'a ("\<one>\<index>")
13817
7e031a968443 Product operator added --- preliminary.
ballarin
parents: 13813
diff changeset
    33
13936
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
    34
constdefs
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
    35
  m_inv :: "[('a, 'm) monoid_scheme, 'a] => 'a" ("inv\<index> _" [81] 80)
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
    36
  "m_inv G x == (THE y. y \<in> carrier G &
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
    37
                  mult G x y = one G & mult G y x = one G)"
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
    38
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
    39
  Units :: "('a, 'm) monoid_scheme => 'a set"
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
    40
  "Units G == {y. y \<in> carrier G &
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
    41
                  (EX x : carrier G. mult G x y = one G & mult G y x = one G)}"
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
    42
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
    43
consts
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
    44
  pow :: "[('a, 'm) monoid_scheme, 'a, 'b::number] => 'a" (infixr "'(^')\<index>" 75)
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
    45
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
    46
defs (overloaded)
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
    47
  nat_pow_def: "pow G a n == nat_rec (one G) (%u b. mult G b a) n"
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
    48
  int_pow_def: "pow G a z ==
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
    49
    let p = nat_rec (one G) (%u b. mult G b a)
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
    50
    in if neg z then m_inv G (p (nat (-z))) else p (nat z)"
13813
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
    51
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
    52
locale magma = struct G +
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
    53
  assumes m_closed [intro, simp]:
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
    54
    "[| x \<in> carrier G; y \<in> carrier G |] ==> x \<otimes> y \<in> carrier G"
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
    55
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
    56
locale semigroup = magma +
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
    57
  assumes m_assoc:
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
    58
    "[| x \<in> carrier G; y \<in> carrier G; z \<in> carrier G |] ==>
13936
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
    59
    (x \<otimes> y) \<otimes> z = x \<otimes> (y \<otimes> z)"
13813
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
    60
13936
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
    61
locale monoid = semigroup +
13813
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
    62
  assumes one_closed [intro, simp]: "\<one> \<in> carrier G"
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
    63
    and l_one [simp]: "x \<in> carrier G ==> \<one> \<otimes> x = x"
13936
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
    64
    and r_one [simp]: "x \<in> carrier G ==> x \<otimes> \<one> = x"
13817
7e031a968443 Product operator added --- preliminary.
ballarin
parents: 13813
diff changeset
    65
13936
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
    66
lemma monoidI:
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
    67
  assumes m_closed:
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
    68
      "!!x y. [| x \<in> carrier G; y \<in> carrier G |] ==> mult G x y \<in> carrier G"
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
    69
    and one_closed: "one G \<in> carrier G"
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
    70
    and m_assoc:
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
    71
      "!!x y z. [| x \<in> carrier G; y \<in> carrier G; z \<in> carrier G |] ==>
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
    72
      mult G (mult G x y) z = mult G x (mult G y z)"
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
    73
    and l_one: "!!x. x \<in> carrier G ==> mult G (one G) x = x"
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
    74
    and r_one: "!!x. x \<in> carrier G ==> mult G x (one G) = x"
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
    75
  shows "monoid G"
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
    76
  by (fast intro!: monoid.intro magma.intro semigroup_axioms.intro
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
    77
    semigroup.intro monoid_axioms.intro
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
    78
    intro: prems)
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
    79
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
    80
lemma (in monoid) Units_closed [dest]:
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
    81
  "x \<in> Units G ==> x \<in> carrier G"
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
    82
  by (unfold Units_def) fast
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
    83
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
    84
lemma (in monoid) inv_unique:
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
    85
  assumes eq: "y \<otimes> x = \<one>" "x \<otimes> y' = \<one>"
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
    86
    and G: "x \<in> carrier G" "y \<in> carrier G" "y' \<in> carrier G"
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
    87
  shows "y = y'"
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
    88
proof -
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
    89
  from G eq have "y = y \<otimes> (x \<otimes> y')" by simp
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
    90
  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
    91
  also from G eq have "... = y'" by simp
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
    92
  finally show ?thesis .
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
    93
qed
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
    94
13940
c67798653056 HOL-Algebra: New polynomial development added.
ballarin
parents: 13936
diff changeset
    95
lemma (in monoid) Units_one_closed [intro, simp]:
c67798653056 HOL-Algebra: New polynomial development added.
ballarin
parents: 13936
diff changeset
    96
  "\<one> \<in> Units G"
c67798653056 HOL-Algebra: New polynomial development added.
ballarin
parents: 13936
diff changeset
    97
  by (unfold Units_def) auto
c67798653056 HOL-Algebra: New polynomial development added.
ballarin
parents: 13936
diff changeset
    98
13936
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
    99
lemma (in monoid) Units_inv_closed [intro, simp]:
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   100
  "x \<in> Units G ==> inv x \<in> carrier G"
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_l_inv:
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   107
  "x \<in> Units G ==> inv x \<otimes> x = \<one>"
13943
83d842ccd4aa moving Bij.thy from GroupTheory to Algebra
paulson
parents: 13940
diff changeset
   108
  apply (unfold Units_def m_inv_def, auto)
13936
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   109
  apply (rule theI2, fast)
13943
83d842ccd4aa moving Bij.thy from GroupTheory to Algebra
paulson
parents: 13940
diff changeset
   110
   apply (fast intro: inv_unique, fast)
13936
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   111
  done
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   112
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   113
lemma (in monoid) Units_r_inv:
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   114
  "x \<in> Units G ==> x \<otimes> inv x = \<one>"
13943
83d842ccd4aa moving Bij.thy from GroupTheory to Algebra
paulson
parents: 13940
diff changeset
   115
  apply (unfold Units_def m_inv_def, auto)
13936
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   116
  apply (rule theI2, fast)
13943
83d842ccd4aa moving Bij.thy from GroupTheory to Algebra
paulson
parents: 13940
diff changeset
   117
   apply (fast intro: inv_unique, fast)
13936
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   118
  done
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   119
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   120
lemma (in monoid) Units_inv_Units [intro, simp]:
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   121
  "x \<in> Units G ==> inv x \<in> Units G"
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   122
proof -
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   123
  assume x: "x \<in> Units G"
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   124
  show "inv x \<in> Units G"
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   125
    by (auto simp add: Units_def
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   126
      intro: Units_l_inv Units_r_inv x Units_closed [OF x])
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   127
qed
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   128
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   129
lemma (in monoid) Units_l_cancel [simp]:
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   130
  "[| x \<in> Units G; y \<in> carrier G; z \<in> carrier G |] ==>
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   131
   (x \<otimes> y = x \<otimes> z) = (y = z)"
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 eq: "x \<otimes> y = x \<otimes> z"
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   134
    and G: "x \<in> Units G" "y \<in> carrier G" "z \<in> carrier G"
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   135
  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
   136
    by (simp add: m_assoc Units_closed)
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   137
  with G show "y = z" by (simp add: Units_l_inv)
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   138
next
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   139
  assume eq: "y = z"
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   140
    and G: "x \<in> Units G" "y \<in> carrier G" "z \<in> carrier G"
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   141
  then show "x \<otimes> y = x \<otimes> z" by simp
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   142
qed
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   143
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   144
lemma (in monoid) Units_inv_inv [simp]:
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   145
  "x \<in> Units G ==> inv (inv x) = x"
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   146
proof -
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   147
  assume x: "x \<in> Units G"
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   148
  then have "inv x \<otimes> inv (inv x) = inv x \<otimes> x"
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   149
    by (simp add: Units_l_inv Units_r_inv)
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   150
  with x show ?thesis by (simp add: Units_closed)
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   151
qed
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   152
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   153
lemma (in monoid) inv_inj_on_Units:
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   154
  "inj_on (m_inv G) (Units G)"
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   155
proof (rule inj_onI)
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   156
  fix x y
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   157
  assume G: "x \<in> Units G" "y \<in> Units G" and eq: "inv x = inv y"
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   158
  then have "inv (inv x) = inv (inv y)" by simp
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   159
  with G show "x = y" by simp
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   160
qed
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   161
13940
c67798653056 HOL-Algebra: New polynomial development added.
ballarin
parents: 13936
diff changeset
   162
lemma (in monoid) Units_inv_comm:
c67798653056 HOL-Algebra: New polynomial development added.
ballarin
parents: 13936
diff changeset
   163
  assumes inv: "x \<otimes> y = \<one>"
c67798653056 HOL-Algebra: New polynomial development added.
ballarin
parents: 13936
diff changeset
   164
    and G: "x \<in> Units G" "y \<in> Units G"
c67798653056 HOL-Algebra: New polynomial development added.
ballarin
parents: 13936
diff changeset
   165
  shows "y \<otimes> x = \<one>"
c67798653056 HOL-Algebra: New polynomial development added.
ballarin
parents: 13936
diff changeset
   166
proof -
c67798653056 HOL-Algebra: New polynomial development added.
ballarin
parents: 13936
diff changeset
   167
  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
   168
  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
   169
qed
c67798653056 HOL-Algebra: New polynomial development added.
ballarin
parents: 13936
diff changeset
   170
13936
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   171
text {* Power *}
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   172
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   173
lemma (in monoid) nat_pow_closed [intro, simp]:
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   174
  "x \<in> carrier G ==> x (^) (n::nat) \<in> carrier G"
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   175
  by (induct n) (simp_all add: nat_pow_def)
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   176
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   177
lemma (in monoid) nat_pow_0 [simp]:
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   178
  "x (^) (0::nat) = \<one>"
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   179
  by (simp add: nat_pow_def)
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   180
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   181
lemma (in monoid) nat_pow_Suc [simp]:
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   182
  "x (^) (Suc n) = x (^) n \<otimes> x"
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   183
  by (simp add: nat_pow_def)
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   184
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   185
lemma (in monoid) nat_pow_one [simp]:
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   186
  "\<one> (^) (n::nat) = \<one>"
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   187
  by (induct n) simp_all
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   188
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   189
lemma (in monoid) nat_pow_mult:
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   190
  "x \<in> carrier G ==> x (^) (n::nat) \<otimes> x (^) m = x (^) (n + m)"
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   191
  by (induct m) (simp_all add: m_assoc [THEN sym])
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   192
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   193
lemma (in monoid) nat_pow_pow:
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   194
  "x \<in> carrier G ==> (x (^) n) (^) m = x (^) (n * m::nat)"
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   195
  by (induct m) (simp, simp add: nat_pow_mult add_commute)
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   196
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   197
text {*
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   198
  A group is a monoid all of whose elements are invertible.
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   199
*}
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   200
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   201
locale group = monoid +
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   202
  assumes Units: "carrier G <= Units G"
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   203
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   204
theorem groupI:
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   205
  assumes m_closed [simp]:
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   206
      "!!x y. [| x \<in> carrier G; y \<in> carrier G |] ==> mult G x y \<in> carrier G"
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   207
    and one_closed [simp]: "one G \<in> carrier G"
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   208
    and m_assoc:
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   209
      "!!x y z. [| x \<in> carrier G; y \<in> carrier G; z \<in> carrier G |] ==>
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   210
      mult G (mult G x y) z = mult G x (mult G y z)"
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   211
    and l_one [simp]: "!!x. x \<in> carrier G ==> mult G (one G) x = x"
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   212
    and l_inv_ex: "!!x. x \<in> carrier G ==> EX y : carrier G. mult G y x = one G"
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   213
  shows "group G"
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   214
proof -
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   215
  have l_cancel [simp]:
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   216
    "!!x y z. [| x \<in> carrier G; y \<in> carrier G; z \<in> carrier G |] ==>
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   217
    (mult G x y = mult G x z) = (y = z)"
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   218
  proof
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: "mult G x y = mult G x z"
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   221
      and G: "x \<in> carrier G" "y \<in> carrier G" "z \<in> carrier G"
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   222
    with l_inv_ex obtain x_inv where xG: "x_inv \<in> carrier G"
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   223
      and l_inv: "mult G x_inv x = one G" by fast
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   224
    from G eq xG have "mult G (mult G x_inv x) y = mult G (mult G x_inv x) z"
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   225
      by (simp add: m_assoc)
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   226
    with G show "y = z" by (simp add: l_inv)
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   227
  next
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   228
    fix x y z
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   229
    assume eq: "y = z"
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   230
      and G: "x \<in> carrier G" "y \<in> carrier G" "z \<in> carrier G"
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   231
    then show "mult G x y = mult G x z" by simp
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   232
  qed
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   233
  have r_one:
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   234
    "!!x. x \<in> carrier G ==> mult G x (one G) = x"
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   235
  proof -
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   236
    fix x
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   237
    assume x: "x \<in> carrier G"
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   238
    with l_inv_ex obtain x_inv where xG: "x_inv \<in> carrier G"
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   239
      and l_inv: "mult G x_inv x = one G" by fast
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   240
    from x xG have "mult G x_inv (mult G x (one G)) = mult G x_inv x"
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   241
      by (simp add: m_assoc [symmetric] l_inv)
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   242
    with x xG show "mult G x (one G) = x" by simp 
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   243
  qed
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   244
  have inv_ex:
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   245
    "!!x. x \<in> carrier G ==> EX y : carrier G. mult G y x = one G &
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   246
      mult G x y = one G"
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   247
  proof -
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   248
    fix x
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   249
    assume x: "x \<in> carrier G"
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   250
    with l_inv_ex obtain y where y: "y \<in> carrier G"
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   251
      and l_inv: "mult G y x = one G" by fast
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   252
    from x y have "mult G y (mult G x y) = mult G y (one G)"
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   253
      by (simp add: m_assoc [symmetric] l_inv r_one)
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   254
    with x y have r_inv: "mult G x y = one G"
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   255
      by simp
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   256
    from x y show "EX y : carrier G. mult G y x = one G &
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   257
      mult G x y = one G"
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   258
      by (fast intro: l_inv r_inv)
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   259
  qed
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   260
  then have carrier_subset_Units: "carrier G <= Units G"
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   261
    by (unfold Units_def) fast
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   262
  show ?thesis
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   263
    by (fast intro!: group.intro magma.intro semigroup_axioms.intro
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   264
      semigroup.intro monoid_axioms.intro group_axioms.intro
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   265
      carrier_subset_Units intro: prems r_one)
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   266
qed
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   267
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   268
lemma (in monoid) monoid_groupI:
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   269
  assumes l_inv_ex:
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   270
    "!!x. x \<in> carrier G ==> EX y : carrier G. mult G y x = one G"
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   271
  shows "group G"
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   272
  by (rule groupI) (auto intro: m_assoc l_inv_ex)
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   273
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   274
lemma (in group) Units_eq [simp]:
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   275
  "Units G = carrier G"
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   276
proof
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   277
  show "Units G <= carrier G" by fast
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   278
next
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   279
  show "carrier G <= Units G" by (rule Units)
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   280
qed
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   281
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   282
lemma (in group) inv_closed [intro, simp]:
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   283
  "x \<in> carrier G ==> inv x \<in> carrier G"
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   284
  using Units_inv_closed by simp
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   285
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   286
lemma (in group) l_inv:
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   287
  "x \<in> carrier G ==> inv x \<otimes> x = \<one>"
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   288
  using Units_l_inv by simp
13813
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   289
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   290
subsection {* Cancellation Laws and Basic Properties *}
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   291
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   292
lemma (in group) l_cancel [simp]:
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   293
  "[| x \<in> carrier G; y \<in> carrier G; z \<in> carrier G |] ==>
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   294
   (x \<otimes> y = x \<otimes> z) = (y = z)"
13936
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   295
  using Units_l_inv by simp
13940
c67798653056 HOL-Algebra: New polynomial development added.
ballarin
parents: 13936
diff changeset
   296
13813
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   297
lemma (in group) r_inv:
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   298
  "x \<in> carrier G ==> x \<otimes> inv x = \<one>"
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   299
proof -
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   300
  assume x: "x \<in> carrier G"
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   301
  then have "inv x \<otimes> (x \<otimes> inv x) = inv x \<otimes> \<one>"
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   302
    by (simp add: m_assoc [symmetric] l_inv)
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   303
  with x show ?thesis by (simp del: r_one)
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   304
qed
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   305
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   306
lemma (in group) r_cancel [simp]:
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   307
  "[| x \<in> carrier G; y \<in> carrier G; z \<in> carrier G |] ==>
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   308
   (y \<otimes> x = z \<otimes> x) = (y = z)"
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   309
proof
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   310
  assume eq: "y \<otimes> x = z \<otimes> x"
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   311
    and G: "x \<in> carrier G" "y \<in> carrier G" "z \<in> carrier G"
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   312
  then have "y \<otimes> (x \<otimes> inv x) = z \<otimes> (x \<otimes> inv x)"
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   313
    by (simp add: m_assoc [symmetric])
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   314
  with G show "y = z" by (simp add: r_inv)
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   315
next
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   316
  assume eq: "y = z"
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   317
    and G: "x \<in> carrier G" "y \<in> carrier G" "z \<in> carrier G"
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   318
  then show "y \<otimes> x = z \<otimes> x" by simp
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   319
qed
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   320
13854
91c9ab25fece First distributed version of Group and Ring theory.
ballarin
parents: 13835
diff changeset
   321
lemma (in group) inv_one [simp]:
91c9ab25fece First distributed version of Group and Ring theory.
ballarin
parents: 13835
diff changeset
   322
  "inv \<one> = \<one>"
91c9ab25fece First distributed version of Group and Ring theory.
ballarin
parents: 13835
diff changeset
   323
proof -
91c9ab25fece First distributed version of Group and Ring theory.
ballarin
parents: 13835
diff changeset
   324
  have "inv \<one> = \<one> \<otimes> (inv \<one>)" by simp
91c9ab25fece First distributed version of Group and Ring theory.
ballarin
parents: 13835
diff changeset
   325
  moreover have "... = \<one>" by (simp add: r_inv)
91c9ab25fece First distributed version of Group and Ring theory.
ballarin
parents: 13835
diff changeset
   326
  finally show ?thesis .
91c9ab25fece First distributed version of Group and Ring theory.
ballarin
parents: 13835
diff changeset
   327
qed
91c9ab25fece First distributed version of Group and Ring theory.
ballarin
parents: 13835
diff changeset
   328
13813
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   329
lemma (in group) inv_inv [simp]:
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   330
  "x \<in> carrier G ==> inv (inv x) = x"
13936
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   331
  using Units_inv_inv by simp
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   332
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   333
lemma (in group) inv_inj:
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   334
  "inj_on (m_inv G) (carrier G)"
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   335
  using inv_inj_on_Units by simp
13813
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   336
13854
91c9ab25fece First distributed version of Group and Ring theory.
ballarin
parents: 13835
diff changeset
   337
lemma (in group) inv_mult_group:
13813
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   338
  "[| 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
   339
proof -
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   340
  assume G: "x \<in> carrier G" "y \<in> carrier G"
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   341
  then have "inv (x \<otimes> y) \<otimes> (x \<otimes> y) = (inv y \<otimes> inv x) \<otimes> (x \<otimes> y)"
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   342
    by (simp add: m_assoc l_inv) (simp add: m_assoc [symmetric] l_inv)
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   343
  with G show ?thesis by simp
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   344
qed
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   345
13940
c67798653056 HOL-Algebra: New polynomial development added.
ballarin
parents: 13936
diff changeset
   346
lemma (in group) inv_comm:
c67798653056 HOL-Algebra: New polynomial development added.
ballarin
parents: 13936
diff changeset
   347
  "[| x \<otimes> y = \<one>; x \<in> carrier G; y \<in> carrier G |] ==> y \<otimes> x = \<one>"
c67798653056 HOL-Algebra: New polynomial development added.
ballarin
parents: 13936
diff changeset
   348
  by (rule Units_inv_comm) auto                          
c67798653056 HOL-Algebra: New polynomial development added.
ballarin
parents: 13936
diff changeset
   349
13944
9b34607cd83e new proofs about direct products, etc.
paulson
parents: 13943
diff changeset
   350
lemma (in group) inv_equality:
13943
83d842ccd4aa moving Bij.thy from GroupTheory to Algebra
paulson
parents: 13940
diff changeset
   351
     "[|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
   352
apply (simp add: m_inv_def)
83d842ccd4aa moving Bij.thy from GroupTheory to Algebra
paulson
parents: 13940
diff changeset
   353
apply (rule the_equality)
83d842ccd4aa moving Bij.thy from GroupTheory to Algebra
paulson
parents: 13940
diff changeset
   354
 apply (simp add: inv_comm [of y x]) 
83d842ccd4aa moving Bij.thy from GroupTheory to Algebra
paulson
parents: 13940
diff changeset
   355
apply (rule r_cancel [THEN iffD1], auto) 
83d842ccd4aa moving Bij.thy from GroupTheory to Algebra
paulson
parents: 13940
diff changeset
   356
done
83d842ccd4aa moving Bij.thy from GroupTheory to Algebra
paulson
parents: 13940
diff changeset
   357
13936
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   358
text {* Power *}
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   359
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   360
lemma (in group) int_pow_def2:
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   361
  "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
   362
  by (simp add: int_pow_def nat_pow_def Let_def)
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   363
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   364
lemma (in group) int_pow_0 [simp]:
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   365
  "x (^) (0::int) = \<one>"
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   366
  by (simp add: int_pow_def2)
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   367
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   368
lemma (in group) int_pow_one [simp]:
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   369
  "\<one> (^) (z::int) = \<one>"
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   370
  by (simp add: int_pow_def2)
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   371
13813
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   372
subsection {* Substructures *}
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   373
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   374
locale submagma = var H + struct G +
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   375
  assumes subset [intro, simp]: "H \<subseteq> carrier G"
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   376
    and m_closed [intro, simp]: "[| x \<in> H; y \<in> H |] ==> x \<otimes> y \<in> H"
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   377
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   378
declare (in submagma) magma.intro [intro] semigroup.intro [intro]
13936
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   379
  semigroup_axioms.intro [intro]
13813
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   380
(*
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   381
alternative definition of submagma
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   382
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   383
locale submagma = var H + struct G +
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   384
  assumes subset [intro, simp]: "carrier H \<subseteq> carrier G"
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   385
    and m_equal [simp]: "mult H = mult G"
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   386
    and m_closed [intro, simp]:
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   387
      "[| x \<in> carrier H; y \<in> carrier H |] ==> x \<otimes> y \<in> carrier H"
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   388
*)
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   389
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   390
lemma submagma_imp_subset:
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   391
  "submagma H G ==> H \<subseteq> carrier G"
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   392
  by (rule submagma.subset)
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   393
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   394
lemma (in submagma) subsetD [dest, simp]:
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   395
  "x \<in> H ==> x \<in> carrier G"
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   396
  using subset by blast
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   397
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   398
lemma (in submagma) magmaI [intro]:
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   399
  includes magma G
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   400
  shows "magma (G(| carrier := H |))"
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   401
  by rule simp
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   402
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   403
lemma (in submagma) semigroup_axiomsI [intro]:
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   404
  includes semigroup G
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   405
  shows "semigroup_axioms (G(| carrier := H |))"
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   406
    by rule (simp add: m_assoc)
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   407
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   408
lemma (in submagma) semigroupI [intro]:
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   409
  includes semigroup G
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   410
  shows "semigroup (G(| carrier := H |))"
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   411
  using prems by fast
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   412
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   413
locale subgroup = submagma H G +
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   414
  assumes one_closed [intro, simp]: "\<one> \<in> H"
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   415
    and m_inv_closed [intro, simp]: "x \<in> H ==> inv x \<in> H"
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   416
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   417
declare (in subgroup) group.intro [intro]
13949
0ce528cd6f19 HOL-Algebra complete for release Isabelle2003 (modulo section headers).
ballarin
parents: 13944
diff changeset
   418
13813
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   419
lemma (in subgroup) group_axiomsI [intro]:
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   420
  includes group G
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   421
  shows "group_axioms (G(| carrier := H |))"
14254
342634f38451 Isar/Locales: <loc>.intro and <loc>.axioms no longer intro? and elim? by
ballarin
parents: 13975
diff changeset
   422
  by (rule group_axioms.intro) (auto intro: l_inv r_inv simp add: Units_def)
13813
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   423
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   424
lemma (in subgroup) groupI [intro]:
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   425
  includes group G
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   426
  shows "group (G(| carrier := H |))"
13936
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   427
  by (rule groupI) (auto intro: m_assoc l_inv)
13813
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   428
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   429
text {*
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   430
  Since @{term H} is nonempty, it contains some element @{term x}.  Since
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   431
  it is closed under inverse, it contains @{text "inv x"}.  Since
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   432
  it is closed under product, it contains @{text "x \<otimes> inv x = \<one>"}.
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   433
*}
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   434
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   435
lemma (in group) one_in_subset:
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   436
  "[| 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
   437
   ==> \<one> \<in> H"
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   438
by (force simp add: l_inv)
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   439
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   440
text {* A characterization of subgroups: closed, non-empty subset. *}
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   441
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   442
lemma (in group) subgroupI:
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   443
  assumes subset: "H \<subseteq> carrier G" and non_empty: "H \<noteq> {}"
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   444
    and inv: "!!a. a \<in> H ==> inv a \<in> H"
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   445
    and mult: "!!a b. [|a \<in> H; b \<in> H|] ==> a \<otimes> b \<in> H"
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   446
  shows "subgroup H G"
14254
342634f38451 Isar/Locales: <loc>.intro and <loc>.axioms no longer intro? and elim? by
ballarin
parents: 13975
diff changeset
   447
proof (rule subgroup.intro)
342634f38451 Isar/Locales: <loc>.intro and <loc>.axioms no longer intro? and elim? by
ballarin
parents: 13975
diff changeset
   448
  from subset and mult show "submagma H G" by (rule submagma.intro)
13813
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   449
next
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   450
  have "\<one> \<in> H" by (rule one_in_subset) (auto simp only: prems)
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   451
  with inv show "subgroup_axioms H G"
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   452
    by (intro subgroup_axioms.intro) simp_all
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   453
qed
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   454
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   455
text {*
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   456
  Repeat facts of submagmas for subgroups.  Necessary???
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   457
*}
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   458
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   459
lemma (in subgroup) subset:
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   460
  "H \<subseteq> carrier G"
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   461
  ..
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   462
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   463
lemma (in subgroup) m_closed:
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   464
  "[| x \<in> H; y \<in> H |] ==> x \<otimes> y \<in> H"
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   465
  ..
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   466
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   467
declare magma.m_closed [simp]
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   468
13936
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   469
declare monoid.one_closed [iff] group.inv_closed [simp]
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   470
  monoid.l_one [simp] monoid.r_one [simp] group.inv_inv [simp]
13813
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   471
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   472
lemma subgroup_nonempty:
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   473
  "~ subgroup {} G"
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   474
  by (blast dest: subgroup.one_closed)
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   475
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   476
lemma (in subgroup) finite_imp_card_positive:
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   477
  "finite (carrier G) ==> 0 < card H"
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   478
proof (rule classical)
14254
342634f38451 Isar/Locales: <loc>.intro and <loc>.axioms no longer intro? and elim? by
ballarin
parents: 13975
diff changeset
   479
  have sub: "subgroup H G" using prems by (rule subgroup.intro)
13813
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   480
  assume fin: "finite (carrier G)"
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   481
    and zero: "~ 0 < card H"
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   482
  then have "finite H" by (blast intro: finite_subset dest: subset)
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   483
  with zero sub have "subgroup {} G" by simp
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   484
  with subgroup_nonempty show ?thesis by contradiction
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   485
qed
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   486
13936
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   487
(*
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   488
lemma (in monoid) Units_subgroup:
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   489
  "subgroup (Units G) G"
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   490
*)
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   491
13813
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   492
subsection {* Direct Products *}
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   493
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   494
constdefs
13817
7e031a968443 Product operator added --- preliminary.
ballarin
parents: 13813
diff changeset
   495
  DirProdSemigroup ::
13854
91c9ab25fece First distributed version of Group and Ring theory.
ballarin
parents: 13835
diff changeset
   496
    "[('a, 'm) semigroup_scheme, ('b, 'n) semigroup_scheme]
13817
7e031a968443 Product operator added --- preliminary.
ballarin
parents: 13813
diff changeset
   497
    => ('a \<times> 'b) semigroup"
7e031a968443 Product operator added --- preliminary.
ballarin
parents: 13813
diff changeset
   498
    (infixr "\<times>\<^sub>s" 80)
7e031a968443 Product operator added --- preliminary.
ballarin
parents: 13813
diff changeset
   499
  "G \<times>\<^sub>s H == (| carrier = carrier G \<times> carrier H,
7e031a968443 Product operator added --- preliminary.
ballarin
parents: 13813
diff changeset
   500
    mult = (%(xg, xh) (yg, yh). (mult G xg yg, mult H xh yh)) |)"
7e031a968443 Product operator added --- preliminary.
ballarin
parents: 13813
diff changeset
   501
13936
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   502
  DirProdGroup ::
13854
91c9ab25fece First distributed version of Group and Ring theory.
ballarin
parents: 13835
diff changeset
   503
    "[('a, 'm) monoid_scheme, ('b, 'n) monoid_scheme] => ('a \<times> 'b) monoid"
13936
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   504
    (infixr "\<times>\<^sub>g" 80)
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   505
  "G \<times>\<^sub>g H == (| carrier = carrier (G \<times>\<^sub>s H),
13817
7e031a968443 Product operator added --- preliminary.
ballarin
parents: 13813
diff changeset
   506
    mult = mult (G \<times>\<^sub>s H),
7e031a968443 Product operator added --- preliminary.
ballarin
parents: 13813
diff changeset
   507
    one = (one G, one H) |)"
13813
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   508
13817
7e031a968443 Product operator added --- preliminary.
ballarin
parents: 13813
diff changeset
   509
lemma DirProdSemigroup_magma:
13813
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   510
  includes magma G + magma H
13817
7e031a968443 Product operator added --- preliminary.
ballarin
parents: 13813
diff changeset
   511
  shows "magma (G \<times>\<^sub>s H)"
14254
342634f38451 Isar/Locales: <loc>.intro and <loc>.axioms no longer intro? and elim? by
ballarin
parents: 13975
diff changeset
   512
  by (rule magma.intro) (auto simp add: DirProdSemigroup_def)
13813
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   513
13817
7e031a968443 Product operator added --- preliminary.
ballarin
parents: 13813
diff changeset
   514
lemma DirProdSemigroup_semigroup_axioms:
13813
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   515
  includes semigroup G + semigroup H
13817
7e031a968443 Product operator added --- preliminary.
ballarin
parents: 13813
diff changeset
   516
  shows "semigroup_axioms (G \<times>\<^sub>s H)"
14254
342634f38451 Isar/Locales: <loc>.intro and <loc>.axioms no longer intro? and elim? by
ballarin
parents: 13975
diff changeset
   517
  by (rule semigroup_axioms.intro)
342634f38451 Isar/Locales: <loc>.intro and <loc>.axioms no longer intro? and elim? by
ballarin
parents: 13975
diff changeset
   518
    (auto simp add: DirProdSemigroup_def G.m_assoc H.m_assoc)
13813
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   519
13817
7e031a968443 Product operator added --- preliminary.
ballarin
parents: 13813
diff changeset
   520
lemma DirProdSemigroup_semigroup:
13813
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   521
  includes semigroup G + semigroup H
13817
7e031a968443 Product operator added --- preliminary.
ballarin
parents: 13813
diff changeset
   522
  shows "semigroup (G \<times>\<^sub>s H)"
13813
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   523
  using prems
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   524
  by (fast intro: semigroup.intro
13817
7e031a968443 Product operator added --- preliminary.
ballarin
parents: 13813
diff changeset
   525
    DirProdSemigroup_magma DirProdSemigroup_semigroup_axioms)
13813
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   526
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   527
lemma DirProdGroup_magma:
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   528
  includes magma G + magma H
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   529
  shows "magma (G \<times>\<^sub>g H)"
14254
342634f38451 Isar/Locales: <loc>.intro and <loc>.axioms no longer intro? and elim? by
ballarin
parents: 13975
diff changeset
   530
  by (rule magma.intro)
13936
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   531
    (auto simp add: DirProdGroup_def DirProdSemigroup_def)
13813
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   532
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   533
lemma DirProdGroup_semigroup_axioms:
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   534
  includes semigroup G + semigroup H
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   535
  shows "semigroup_axioms (G \<times>\<^sub>g H)"
14254
342634f38451 Isar/Locales: <loc>.intro and <loc>.axioms no longer intro? and elim? by
ballarin
parents: 13975
diff changeset
   536
  by (rule semigroup_axioms.intro)
13936
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   537
    (auto simp add: DirProdGroup_def DirProdSemigroup_def
13817
7e031a968443 Product operator added --- preliminary.
ballarin
parents: 13813
diff changeset
   538
      G.m_assoc H.m_assoc)
13813
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   539
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   540
lemma DirProdGroup_semigroup:
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   541
  includes semigroup G + semigroup H
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   542
  shows "semigroup (G \<times>\<^sub>g H)"
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   543
  using prems
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   544
  by (fast intro: semigroup.intro
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   545
    DirProdGroup_magma DirProdGroup_semigroup_axioms)
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   546
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   547
(* ... and further lemmas for group ... *)
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   548
13817
7e031a968443 Product operator added --- preliminary.
ballarin
parents: 13813
diff changeset
   549
lemma DirProdGroup_group:
13813
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   550
  includes group G + group H
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   551
  shows "group (G \<times>\<^sub>g H)"
13936
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   552
  by (rule groupI)
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   553
    (auto intro: G.m_assoc H.m_assoc G.l_inv H.l_inv
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   554
      simp add: DirProdGroup_def DirProdSemigroup_def)
13813
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   555
13944
9b34607cd83e new proofs about direct products, etc.
paulson
parents: 13943
diff changeset
   556
lemma carrier_DirProdGroup [simp]:
9b34607cd83e new proofs about direct products, etc.
paulson
parents: 13943
diff changeset
   557
     "carrier (G \<times>\<^sub>g H) = carrier G \<times> carrier H"
9b34607cd83e new proofs about direct products, etc.
paulson
parents: 13943
diff changeset
   558
  by (simp add: DirProdGroup_def DirProdSemigroup_def)
9b34607cd83e new proofs about direct products, etc.
paulson
parents: 13943
diff changeset
   559
9b34607cd83e new proofs about direct products, etc.
paulson
parents: 13943
diff changeset
   560
lemma one_DirProdGroup [simp]:
9b34607cd83e new proofs about direct products, etc.
paulson
parents: 13943
diff changeset
   561
     "one (G \<times>\<^sub>g H) = (one G, one H)"
9b34607cd83e new proofs about direct products, etc.
paulson
parents: 13943
diff changeset
   562
  by (simp add: DirProdGroup_def DirProdSemigroup_def);
9b34607cd83e new proofs about direct products, etc.
paulson
parents: 13943
diff changeset
   563
9b34607cd83e new proofs about direct products, etc.
paulson
parents: 13943
diff changeset
   564
lemma mult_DirProdGroup [simp]:
9b34607cd83e new proofs about direct products, etc.
paulson
parents: 13943
diff changeset
   565
     "mult (G \<times>\<^sub>g H) (g, h) (g', h') = (mult G g g', mult H h h')"
9b34607cd83e new proofs about direct products, etc.
paulson
parents: 13943
diff changeset
   566
  by (simp add: DirProdGroup_def DirProdSemigroup_def)
9b34607cd83e new proofs about direct products, etc.
paulson
parents: 13943
diff changeset
   567
9b34607cd83e new proofs about direct products, etc.
paulson
parents: 13943
diff changeset
   568
lemma inv_DirProdGroup [simp]:
9b34607cd83e new proofs about direct products, etc.
paulson
parents: 13943
diff changeset
   569
  includes group G + group H
9b34607cd83e new proofs about direct products, etc.
paulson
parents: 13943
diff changeset
   570
  assumes g: "g \<in> carrier G"
9b34607cd83e new proofs about direct products, etc.
paulson
parents: 13943
diff changeset
   571
      and h: "h \<in> carrier H"
9b34607cd83e new proofs about direct products, etc.
paulson
parents: 13943
diff changeset
   572
  shows "m_inv (G \<times>\<^sub>g H) (g, h) = (m_inv G g, m_inv H h)"
9b34607cd83e new proofs about direct products, etc.
paulson
parents: 13943
diff changeset
   573
  apply (rule group.inv_equality [OF DirProdGroup_group])
9b34607cd83e new proofs about direct products, etc.
paulson
parents: 13943
diff changeset
   574
  apply (simp_all add: prems group_def group.l_inv)
9b34607cd83e new proofs about direct products, etc.
paulson
parents: 13943
diff changeset
   575
  done
9b34607cd83e new proofs about direct products, etc.
paulson
parents: 13943
diff changeset
   576
13813
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   577
subsection {* Homomorphisms *}
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   578
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   579
constdefs
13817
7e031a968443 Product operator added --- preliminary.
ballarin
parents: 13813
diff changeset
   580
  hom :: "[('a, 'c) semigroup_scheme, ('b, 'd) semigroup_scheme]
7e031a968443 Product operator added --- preliminary.
ballarin
parents: 13813
diff changeset
   581
    => ('a => 'b)set"
13813
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   582
  "hom G H ==
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   583
    {h. h \<in> carrier G -> carrier H &
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   584
      (\<forall>x \<in> carrier G. \<forall>y \<in> carrier G. h (mult G x y) = mult H (h x) (h y))}"
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   585
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   586
lemma (in semigroup) hom:
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   587
  includes semigroup G
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   588
  shows "semigroup (| carrier = hom G G, mult = op o |)"
14254
342634f38451 Isar/Locales: <loc>.intro and <loc>.axioms no longer intro? and elim? by
ballarin
parents: 13975
diff changeset
   589
proof (rule semigroup.intro)
13813
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   590
  show "magma (| carrier = hom G G, mult = op o |)"
14254
342634f38451 Isar/Locales: <loc>.intro and <loc>.axioms no longer intro? and elim? by
ballarin
parents: 13975
diff changeset
   591
    by (rule magma.intro) (simp add: Pi_def hom_def)
13813
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   592
next
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   593
  show "semigroup_axioms (| carrier = hom G G, mult = op o |)"
14254
342634f38451 Isar/Locales: <loc>.intro and <loc>.axioms no longer intro? and elim? by
ballarin
parents: 13975
diff changeset
   594
    by (rule semigroup_axioms.intro) (simp add: o_assoc)
13813
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   595
qed
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   596
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   597
lemma hom_mult:
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   598
  "[| h \<in> hom G H; x \<in> carrier G; y \<in> carrier G |] 
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   599
   ==> h (mult G x y) = mult H (h x) (h y)"
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   600
  by (simp add: hom_def) 
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   601
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   602
lemma hom_closed:
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   603
  "[| h \<in> hom G H; x \<in> carrier G |] ==> h x \<in> carrier H"
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   604
  by (auto simp add: hom_def funcset_mem)
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   605
13943
83d842ccd4aa moving Bij.thy from GroupTheory to Algebra
paulson
parents: 13940
diff changeset
   606
lemma compose_hom:
83d842ccd4aa moving Bij.thy from GroupTheory to Algebra
paulson
parents: 13940
diff changeset
   607
     "[|group G; h \<in> hom G G; h' \<in> hom G G; h' \<in> carrier G -> carrier G|]
83d842ccd4aa moving Bij.thy from GroupTheory to Algebra
paulson
parents: 13940
diff changeset
   608
      ==> compose (carrier G) h h' \<in> hom G G"
83d842ccd4aa moving Bij.thy from GroupTheory to Algebra
paulson
parents: 13940
diff changeset
   609
apply (simp (no_asm_simp) add: hom_def)
83d842ccd4aa moving Bij.thy from GroupTheory to Algebra
paulson
parents: 13940
diff changeset
   610
apply (intro conjI) 
83d842ccd4aa moving Bij.thy from GroupTheory to Algebra
paulson
parents: 13940
diff changeset
   611
 apply (force simp add: funcset_compose hom_def)
83d842ccd4aa moving Bij.thy from GroupTheory to Algebra
paulson
parents: 13940
diff changeset
   612
apply (simp add: compose_def group.axioms hom_mult funcset_mem) 
83d842ccd4aa moving Bij.thy from GroupTheory to Algebra
paulson
parents: 13940
diff changeset
   613
done
83d842ccd4aa moving Bij.thy from GroupTheory to Algebra
paulson
parents: 13940
diff changeset
   614
13813
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   615
locale group_hom = group G + group H + var h +
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   616
  assumes homh: "h \<in> hom G H"
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   617
  notes hom_mult [simp] = hom_mult [OF homh]
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   618
    and hom_closed [simp] = hom_closed [OF homh]
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   619
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   620
lemma (in group_hom) one_closed [simp]:
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   621
  "h \<one> \<in> carrier H"
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   622
  by simp
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   623
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   624
lemma (in group_hom) hom_one [simp]:
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   625
  "h \<one> = \<one>\<^sub>2"
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   626
proof -
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   627
  have "h \<one> \<otimes>\<^sub>2 \<one>\<^sub>2 = h \<one> \<otimes>\<^sub>2 h \<one>"
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   628
    by (simp add: hom_mult [symmetric] del: hom_mult)
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   629
  then show ?thesis by (simp del: r_one)
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   630
qed
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   631
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   632
lemma (in group_hom) inv_closed [simp]:
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   633
  "x \<in> carrier G ==> h (inv x) \<in> carrier H"
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   634
  by simp
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   635
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   636
lemma (in group_hom) hom_inv [simp]:
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   637
  "x \<in> carrier G ==> h (inv x) = inv\<^sub>2 (h x)"
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   638
proof -
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   639
  assume x: "x \<in> carrier G"
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   640
  then have "h x \<otimes>\<^sub>2 h (inv x) = \<one>\<^sub>2"
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   641
    by (simp add: hom_mult [symmetric] G.r_inv del: hom_mult)
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   642
  also from x have "... = h x \<otimes>\<^sub>2 inv\<^sub>2 (h x)"
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   643
    by (simp add: hom_mult [symmetric] H.r_inv del: hom_mult)
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   644
  finally have "h x \<otimes>\<^sub>2 h (inv x) = h x \<otimes>\<^sub>2 inv\<^sub>2 (h x)" .
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   645
  with x show ?thesis by simp
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   646
qed
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   647
13949
0ce528cd6f19 HOL-Algebra complete for release Isabelle2003 (modulo section headers).
ballarin
parents: 13944
diff changeset
   648
subsection {* Commutative Structures *}
13936
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   649
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   650
text {*
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   651
  Naming convention: multiplicative structures that are commutative
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   652
  are called \emph{commutative}, additive structures are called
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   653
  \emph{Abelian}.
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   654
*}
13813
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   655
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   656
subsection {* Definition *}
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   657
13936
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   658
locale comm_semigroup = semigroup +
13813
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   659
  assumes m_comm: "[| x \<in> carrier G; y \<in> carrier G |] ==> x \<otimes> y = y \<otimes> x"
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   660
13936
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   661
lemma (in comm_semigroup) m_lcomm:
13813
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   662
  "[| x \<in> carrier G; y \<in> carrier G; z \<in> carrier G |] ==>
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   663
   x \<otimes> (y \<otimes> z) = y \<otimes> (x \<otimes> z)"
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   664
proof -
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   665
  assume xyz: "x \<in> carrier G" "y \<in> carrier G" "z \<in> carrier G"
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   666
  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
   667
  also from xyz have "... = (y \<otimes> x) \<otimes> z" by (simp add: m_comm)
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   668
  also from xyz have "... = y \<otimes> (x \<otimes> z)" by (simp add: m_assoc)
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   669
  finally show ?thesis .
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   670
qed
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   671
13936
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   672
lemmas (in comm_semigroup) m_ac = m_assoc m_comm m_lcomm
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   673
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   674
locale comm_monoid = comm_semigroup + monoid
13813
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   675
13936
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   676
lemma comm_monoidI:
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   677
  assumes m_closed:
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   678
      "!!x y. [| x \<in> carrier G; y \<in> carrier G |] ==> mult G x y \<in> carrier G"
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   679
    and one_closed: "one G \<in> carrier G"
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   680
    and m_assoc:
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   681
      "!!x y z. [| x \<in> carrier G; y \<in> carrier G; z \<in> carrier G |] ==>
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   682
      mult G (mult G x y) z = mult G x (mult G y z)"
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   683
    and l_one: "!!x. x \<in> carrier G ==> mult G (one G) x = x"
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   684
    and m_comm:
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   685
      "!!x y. [| x \<in> carrier G; y \<in> carrier G |] ==> mult G x y = mult G y x"
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   686
  shows "comm_monoid G"
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   687
  using l_one
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   688
  by (auto intro!: comm_monoid.intro magma.intro semigroup_axioms.intro
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   689
    comm_semigroup_axioms.intro monoid_axioms.intro
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   690
    intro: prems simp: m_closed one_closed m_comm)
13817
7e031a968443 Product operator added --- preliminary.
ballarin
parents: 13813
diff changeset
   691
13936
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   692
lemma (in monoid) monoid_comm_monoidI:
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   693
  assumes m_comm:
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   694
      "!!x y. [| x \<in> carrier G; y \<in> carrier G |] ==> mult G x y = mult G y x"
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   695
  shows "comm_monoid G"
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   696
  by (rule comm_monoidI) (auto intro: m_assoc m_comm)
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   697
(*
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   698
lemma (in comm_monoid) r_one [simp]:
13817
7e031a968443 Product operator added --- preliminary.
ballarin
parents: 13813
diff changeset
   699
  "x \<in> carrier G ==> x \<otimes> \<one> = x"
7e031a968443 Product operator added --- preliminary.
ballarin
parents: 13813
diff changeset
   700
proof -
7e031a968443 Product operator added --- preliminary.
ballarin
parents: 13813
diff changeset
   701
  assume G: "x \<in> carrier G"
7e031a968443 Product operator added --- preliminary.
ballarin
parents: 13813
diff changeset
   702
  then have "x \<otimes> \<one> = \<one> \<otimes> x" by (simp add: m_comm)
7e031a968443 Product operator added --- preliminary.
ballarin
parents: 13813
diff changeset
   703
  also from G have "... = x" by simp
7e031a968443 Product operator added --- preliminary.
ballarin
parents: 13813
diff changeset
   704
  finally show ?thesis .
7e031a968443 Product operator added --- preliminary.
ballarin
parents: 13813
diff changeset
   705
qed
13936
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   706
*)
13817
7e031a968443 Product operator added --- preliminary.
ballarin
parents: 13813
diff changeset
   707
13936
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   708
lemma (in comm_monoid) nat_pow_distr:
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   709
  "[| x \<in> carrier G; y \<in> carrier G |] ==>
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   710
  (x \<otimes> y) (^) (n::nat) = x (^) n \<otimes> y (^) n"
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   711
  by (induct n) (simp, simp add: m_ac)
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   712
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   713
locale comm_group = comm_monoid + group
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   714
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   715
lemma (in group) group_comm_groupI:
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   716
  assumes m_comm: "!!x y. [| x \<in> carrier G; y \<in> carrier G |] ==>
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   717
      mult G x y = mult G y x"
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   718
  shows "comm_group G"
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   719
  by (fast intro: comm_group.intro comm_semigroup_axioms.intro
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   720
    group.axioms prems)
13817
7e031a968443 Product operator added --- preliminary.
ballarin
parents: 13813
diff changeset
   721
13936
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   722
lemma comm_groupI:
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   723
  assumes m_closed:
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   724
      "!!x y. [| x \<in> carrier G; y \<in> carrier G |] ==> mult G x y \<in> carrier G"
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   725
    and one_closed: "one G \<in> carrier G"
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   726
    and m_assoc:
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   727
      "!!x y z. [| x \<in> carrier G; y \<in> carrier G; z \<in> carrier G |] ==>
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   728
      mult G (mult G x y) z = mult G x (mult G y z)"
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   729
    and m_comm:
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   730
      "!!x y. [| x \<in> carrier G; y \<in> carrier G |] ==> mult G x y = mult G y x"
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   731
    and l_one: "!!x. x \<in> carrier G ==> mult G (one G) x = x"
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   732
    and l_inv_ex: "!!x. x \<in> carrier G ==> EX y : carrier G. mult G y x = one G"
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   733
  shows "comm_group G"
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   734
  by (fast intro: group.group_comm_groupI groupI prems)
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   735
d3671b878828 Greatly extended CRing. Added Module.
ballarin
parents: 13854
diff changeset
   736
lemma (in comm_group) inv_mult:
13854
91c9ab25fece First distributed version of Group and Ring theory.
ballarin
parents: 13835
diff changeset
   737
  "[| 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
   738
  by (simp add: m_ac inv_mult_group)
13854
91c9ab25fece First distributed version of Group and Ring theory.
ballarin
parents: 13835
diff changeset
   739
13813
722593f2f068 New development of algebra: Groups.
ballarin
parents:
diff changeset
   740
end