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