src/HOL/Isar_Examples/Group.thy
author huffman
Tue, 02 Mar 2010 09:54:50 -0800
changeset 35512 d1ef88d7de5a
parent 35317 d57da4abb47d
child 37671 fa53d267dab3
permissions -rw-r--r--
remove dead code
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
33026
8f35633c4922 modernized session Isar_Examples;
wenzelm
parents: 31758
diff changeset
     1
(*  Title:      HOL/Isar_Examples/Group.thy
6763
df12aef00932 Some bits of group theory. Demonstrate calculational proofs.
wenzelm
parents:
diff changeset
     2
    Author:     Markus Wenzel, TU Muenchen
df12aef00932 Some bits of group theory. Demonstrate calculational proofs.
wenzelm
parents:
diff changeset
     3
*)
df12aef00932 Some bits of group theory. Demonstrate calculational proofs.
wenzelm
parents:
diff changeset
     4
10007
64bf7da1994a isar-strip-terminators;
wenzelm
parents: 8910
diff changeset
     5
header {* Basic group theory *}
7748
5b9c45b21782 improved presentation;
wenzelm
parents: 7740
diff changeset
     6
31758
3edd5f813f01 observe standard theory naming conventions;
wenzelm
parents: 16417
diff changeset
     7
theory Group
3edd5f813f01 observe standard theory naming conventions;
wenzelm
parents: 16417
diff changeset
     8
imports Main
3edd5f813f01 observe standard theory naming conventions;
wenzelm
parents: 16417
diff changeset
     9
begin
6763
df12aef00932 Some bits of group theory. Demonstrate calculational proofs.
wenzelm
parents:
diff changeset
    10
10007
64bf7da1994a isar-strip-terminators;
wenzelm
parents: 8910
diff changeset
    11
subsection {* Groups and calculational reasoning *} 
6784
687ddcad8581 proper calculation;
wenzelm
parents: 6763
diff changeset
    12
687ddcad8581 proper calculation;
wenzelm
parents: 6763
diff changeset
    13
text {*
7968
964b65b4e433 improved presentation;
wenzelm
parents: 7874
diff changeset
    14
 Groups over signature $({\times} :: \alpha \To \alpha \To \alpha,
10141
964d9dc47041 tuned names;
wenzelm
parents: 10007
diff changeset
    15
 \idt{one} :: \alpha, \idt{inverse} :: \alpha \To \alpha)$ are defined
964d9dc47041 tuned names;
wenzelm
parents: 10007
diff changeset
    16
 as an axiomatic type class as follows.  Note that the parent class
7968
964b65b4e433 improved presentation;
wenzelm
parents: 7874
diff changeset
    17
 $\idt{times}$ is provided by the basic HOL theory.
10007
64bf7da1994a isar-strip-terminators;
wenzelm
parents: 8910
diff changeset
    18
*}
6763
df12aef00932 Some bits of group theory. Demonstrate calculational proofs.
wenzelm
parents:
diff changeset
    19
35317
d57da4abb47d dropped axclass; dropped Id
haftmann
parents: 33026
diff changeset
    20
notation Groups.one ("one")
6763
df12aef00932 Some bits of group theory. Demonstrate calculational proofs.
wenzelm
parents:
diff changeset
    21
35317
d57da4abb47d dropped axclass; dropped Id
haftmann
parents: 33026
diff changeset
    22
class group = times + one + inverse +
d57da4abb47d dropped axclass; dropped Id
haftmann
parents: 33026
diff changeset
    23
  assumes group_assoc:         "(x * y) * z = x * (y * z)"
d57da4abb47d dropped axclass; dropped Id
haftmann
parents: 33026
diff changeset
    24
  assumes group_left_one:      "one * x = x"
d57da4abb47d dropped axclass; dropped Id
haftmann
parents: 33026
diff changeset
    25
  assumes group_left_inverse:  "inverse x * x = one"
6763
df12aef00932 Some bits of group theory. Demonstrate calculational proofs.
wenzelm
parents:
diff changeset
    26
6784
687ddcad8581 proper calculation;
wenzelm
parents: 6763
diff changeset
    27
text {*
10141
964d9dc47041 tuned names;
wenzelm
parents: 10007
diff changeset
    28
 The group axioms only state the properties of left one and inverse,
7874
180364256231 improved presentation;
wenzelm
parents: 7800
diff changeset
    29
 the right versions may be derived as follows.
10007
64bf7da1994a isar-strip-terminators;
wenzelm
parents: 8910
diff changeset
    30
*}
6763
df12aef00932 Some bits of group theory. Demonstrate calculational proofs.
wenzelm
parents:
diff changeset
    31
10141
964d9dc47041 tuned names;
wenzelm
parents: 10007
diff changeset
    32
theorem group_right_inverse: "x * inverse x = (one::'a::group)"
10007
64bf7da1994a isar-strip-terminators;
wenzelm
parents: 8910
diff changeset
    33
proof -
10141
964d9dc47041 tuned names;
wenzelm
parents: 10007
diff changeset
    34
  have "x * inverse x = one * (x * inverse x)"
964d9dc47041 tuned names;
wenzelm
parents: 10007
diff changeset
    35
    by (simp only: group_left_one)
964d9dc47041 tuned names;
wenzelm
parents: 10007
diff changeset
    36
  also have "... = one * x * inverse x"
10007
64bf7da1994a isar-strip-terminators;
wenzelm
parents: 8910
diff changeset
    37
    by (simp only: group_assoc)
10141
964d9dc47041 tuned names;
wenzelm
parents: 10007
diff changeset
    38
  also have "... = inverse (inverse x) * inverse x * x * inverse x"
10007
64bf7da1994a isar-strip-terminators;
wenzelm
parents: 8910
diff changeset
    39
    by (simp only: group_left_inverse)
10141
964d9dc47041 tuned names;
wenzelm
parents: 10007
diff changeset
    40
  also have "... = inverse (inverse x) * (inverse x * x) * inverse x"
10007
64bf7da1994a isar-strip-terminators;
wenzelm
parents: 8910
diff changeset
    41
    by (simp only: group_assoc)
10141
964d9dc47041 tuned names;
wenzelm
parents: 10007
diff changeset
    42
  also have "... = inverse (inverse x) * one * inverse x"
10007
64bf7da1994a isar-strip-terminators;
wenzelm
parents: 8910
diff changeset
    43
    by (simp only: group_left_inverse)
10141
964d9dc47041 tuned names;
wenzelm
parents: 10007
diff changeset
    44
  also have "... = inverse (inverse x) * (one * inverse x)"
10007
64bf7da1994a isar-strip-terminators;
wenzelm
parents: 8910
diff changeset
    45
    by (simp only: group_assoc)
10141
964d9dc47041 tuned names;
wenzelm
parents: 10007
diff changeset
    46
  also have "... = inverse (inverse x) * inverse x"
964d9dc47041 tuned names;
wenzelm
parents: 10007
diff changeset
    47
    by (simp only: group_left_one)
10007
64bf7da1994a isar-strip-terminators;
wenzelm
parents: 8910
diff changeset
    48
  also have "... = one"
64bf7da1994a isar-strip-terminators;
wenzelm
parents: 8910
diff changeset
    49
    by (simp only: group_left_inverse)
64bf7da1994a isar-strip-terminators;
wenzelm
parents: 8910
diff changeset
    50
  finally show ?thesis .
64bf7da1994a isar-strip-terminators;
wenzelm
parents: 8910
diff changeset
    51
qed
6763
df12aef00932 Some bits of group theory. Demonstrate calculational proofs.
wenzelm
parents:
diff changeset
    52
6784
687ddcad8581 proper calculation;
wenzelm
parents: 6763
diff changeset
    53
text {*
7982
d534b897ce39 improved presentation;
wenzelm
parents: 7968
diff changeset
    54
 With \name{group-right-inverse} already available,
10141
964d9dc47041 tuned names;
wenzelm
parents: 10007
diff changeset
    55
 \name{group-right-one}\label{thm:group-right-one} is now established
964d9dc47041 tuned names;
wenzelm
parents: 10007
diff changeset
    56
 much easier.
10007
64bf7da1994a isar-strip-terminators;
wenzelm
parents: 8910
diff changeset
    57
*}
6763
df12aef00932 Some bits of group theory. Demonstrate calculational proofs.
wenzelm
parents:
diff changeset
    58
10141
964d9dc47041 tuned names;
wenzelm
parents: 10007
diff changeset
    59
theorem group_right_one: "x * one = (x::'a::group)"
10007
64bf7da1994a isar-strip-terminators;
wenzelm
parents: 8910
diff changeset
    60
proof -
10141
964d9dc47041 tuned names;
wenzelm
parents: 10007
diff changeset
    61
  have "x * one = x * (inverse x * x)"
10007
64bf7da1994a isar-strip-terminators;
wenzelm
parents: 8910
diff changeset
    62
    by (simp only: group_left_inverse)
10141
964d9dc47041 tuned names;
wenzelm
parents: 10007
diff changeset
    63
  also have "... = x * inverse x * x"
10007
64bf7da1994a isar-strip-terminators;
wenzelm
parents: 8910
diff changeset
    64
    by (simp only: group_assoc)
64bf7da1994a isar-strip-terminators;
wenzelm
parents: 8910
diff changeset
    65
  also have "... = one * x"
64bf7da1994a isar-strip-terminators;
wenzelm
parents: 8910
diff changeset
    66
    by (simp only: group_right_inverse)
64bf7da1994a isar-strip-terminators;
wenzelm
parents: 8910
diff changeset
    67
  also have "... = x"
10141
964d9dc47041 tuned names;
wenzelm
parents: 10007
diff changeset
    68
    by (simp only: group_left_one)
10007
64bf7da1994a isar-strip-terminators;
wenzelm
parents: 8910
diff changeset
    69
  finally show ?thesis .
64bf7da1994a isar-strip-terminators;
wenzelm
parents: 8910
diff changeset
    70
qed
6763
df12aef00932 Some bits of group theory. Demonstrate calculational proofs.
wenzelm
parents:
diff changeset
    71
6784
687ddcad8581 proper calculation;
wenzelm
parents: 6763
diff changeset
    72
text {*
7874
180364256231 improved presentation;
wenzelm
parents: 7800
diff changeset
    73
 \medskip The calculational proof style above follows typical
180364256231 improved presentation;
wenzelm
parents: 7800
diff changeset
    74
 presentations given in any introductory course on algebra.  The basic
180364256231 improved presentation;
wenzelm
parents: 7800
diff changeset
    75
 technique is to form a transitive chain of equations, which in turn
180364256231 improved presentation;
wenzelm
parents: 7800
diff changeset
    76
 are established by simplifying with appropriate rules.  The low-level
7982
d534b897ce39 improved presentation;
wenzelm
parents: 7968
diff changeset
    77
 logical details of equational reasoning are left implicit.
6784
687ddcad8581 proper calculation;
wenzelm
parents: 6763
diff changeset
    78
7982
d534b897ce39 improved presentation;
wenzelm
parents: 7968
diff changeset
    79
 Note that ``$\dots$'' is just a special term variable that is bound
d534b897ce39 improved presentation;
wenzelm
parents: 7968
diff changeset
    80
 automatically to the argument\footnote{The argument of a curried
d534b897ce39 improved presentation;
wenzelm
parents: 7968
diff changeset
    81
 infix expression happens to be its right-hand side.} of the last fact
d534b897ce39 improved presentation;
wenzelm
parents: 7968
diff changeset
    82
 achieved by any local assumption or proven statement.  In contrast to
d534b897ce39 improved presentation;
wenzelm
parents: 7968
diff changeset
    83
 $\var{thesis}$, the ``$\dots$'' variable is bound \emph{after} the
d534b897ce39 improved presentation;
wenzelm
parents: 7968
diff changeset
    84
 proof is finished, though.
7874
180364256231 improved presentation;
wenzelm
parents: 7800
diff changeset
    85
180364256231 improved presentation;
wenzelm
parents: 7800
diff changeset
    86
 There are only two separate Isar language elements for calculational
180364256231 improved presentation;
wenzelm
parents: 7800
diff changeset
    87
 proofs: ``\isakeyword{also}'' for initial or intermediate
180364256231 improved presentation;
wenzelm
parents: 7800
diff changeset
    88
 calculational steps, and ``\isakeyword{finally}'' for exhibiting the
180364256231 improved presentation;
wenzelm
parents: 7800
diff changeset
    89
 result of a calculation.  These constructs are not hardwired into
180364256231 improved presentation;
wenzelm
parents: 7800
diff changeset
    90
 Isabelle/Isar, but defined on top of the basic Isar/VM interpreter.
180364256231 improved presentation;
wenzelm
parents: 7800
diff changeset
    91
 Expanding the \isakeyword{also} and \isakeyword{finally} derived
7982
d534b897ce39 improved presentation;
wenzelm
parents: 7968
diff changeset
    92
 language elements, calculations may be simulated by hand as
d534b897ce39 improved presentation;
wenzelm
parents: 7968
diff changeset
    93
 demonstrated below.
10007
64bf7da1994a isar-strip-terminators;
wenzelm
parents: 8910
diff changeset
    94
*}
6784
687ddcad8581 proper calculation;
wenzelm
parents: 6763
diff changeset
    95
10007
64bf7da1994a isar-strip-terminators;
wenzelm
parents: 8910
diff changeset
    96
theorem "x * one = (x::'a::group)"
64bf7da1994a isar-strip-terminators;
wenzelm
parents: 8910
diff changeset
    97
proof -
10141
964d9dc47041 tuned names;
wenzelm
parents: 10007
diff changeset
    98
  have "x * one = x * (inverse x * x)"
10007
64bf7da1994a isar-strip-terminators;
wenzelm
parents: 8910
diff changeset
    99
    by (simp only: group_left_inverse)
6763
df12aef00932 Some bits of group theory. Demonstrate calculational proofs.
wenzelm
parents:
diff changeset
   100
7433
27887c52b9c8 "this";
wenzelm
parents: 7356
diff changeset
   101
  note calculation = this
10007
64bf7da1994a isar-strip-terminators;
wenzelm
parents: 8910
diff changeset
   102
    -- {* first calculational step: init calculation register *}
6763
df12aef00932 Some bits of group theory. Demonstrate calculational proofs.
wenzelm
parents:
diff changeset
   103
10141
964d9dc47041 tuned names;
wenzelm
parents: 10007
diff changeset
   104
  have "... = x * inverse x * x"
10007
64bf7da1994a isar-strip-terminators;
wenzelm
parents: 8910
diff changeset
   105
    by (simp only: group_assoc)
6763
df12aef00932 Some bits of group theory. Demonstrate calculational proofs.
wenzelm
parents:
diff changeset
   106
7433
27887c52b9c8 "this";
wenzelm
parents: 7356
diff changeset
   107
  note calculation = trans [OF calculation this]
10007
64bf7da1994a isar-strip-terminators;
wenzelm
parents: 8910
diff changeset
   108
    -- {* general calculational step: compose with transitivity rule *}
6763
df12aef00932 Some bits of group theory. Demonstrate calculational proofs.
wenzelm
parents:
diff changeset
   109
10007
64bf7da1994a isar-strip-terminators;
wenzelm
parents: 8910
diff changeset
   110
  have "... = one * x"
64bf7da1994a isar-strip-terminators;
wenzelm
parents: 8910
diff changeset
   111
    by (simp only: group_right_inverse)
6763
df12aef00932 Some bits of group theory. Demonstrate calculational proofs.
wenzelm
parents:
diff changeset
   112
7433
27887c52b9c8 "this";
wenzelm
parents: 7356
diff changeset
   113
  note calculation = trans [OF calculation this]
10007
64bf7da1994a isar-strip-terminators;
wenzelm
parents: 8910
diff changeset
   114
    -- {* general calculational step: compose with transitivity rule *}
6763
df12aef00932 Some bits of group theory. Demonstrate calculational proofs.
wenzelm
parents:
diff changeset
   115
10007
64bf7da1994a isar-strip-terminators;
wenzelm
parents: 8910
diff changeset
   116
  have "... = x"
10141
964d9dc47041 tuned names;
wenzelm
parents: 10007
diff changeset
   117
    by (simp only: group_left_one)
6763
df12aef00932 Some bits of group theory. Demonstrate calculational proofs.
wenzelm
parents:
diff changeset
   118
7433
27887c52b9c8 "this";
wenzelm
parents: 7356
diff changeset
   119
  note calculation = trans [OF calculation this]
10007
64bf7da1994a isar-strip-terminators;
wenzelm
parents: 8910
diff changeset
   120
    -- {* final calculational step: compose with transitivity rule ... *}
6784
687ddcad8581 proper calculation;
wenzelm
parents: 6763
diff changeset
   121
  from calculation
10007
64bf7da1994a isar-strip-terminators;
wenzelm
parents: 8910
diff changeset
   122
    -- {* ... and pick up the final result *}
6763
df12aef00932 Some bits of group theory. Demonstrate calculational proofs.
wenzelm
parents:
diff changeset
   123
10007
64bf7da1994a isar-strip-terminators;
wenzelm
parents: 8910
diff changeset
   124
  show ?thesis .
64bf7da1994a isar-strip-terminators;
wenzelm
parents: 8910
diff changeset
   125
qed
6763
df12aef00932 Some bits of group theory. Demonstrate calculational proofs.
wenzelm
parents:
diff changeset
   126
7874
180364256231 improved presentation;
wenzelm
parents: 7800
diff changeset
   127
text {*
180364256231 improved presentation;
wenzelm
parents: 7800
diff changeset
   128
 Note that this scheme of calculations is not restricted to plain
180364256231 improved presentation;
wenzelm
parents: 7800
diff changeset
   129
 transitivity.  Rules like anti-symmetry, or even forward and backward
7982
d534b897ce39 improved presentation;
wenzelm
parents: 7968
diff changeset
   130
 substitution work as well.  For the actual implementation of
d534b897ce39 improved presentation;
wenzelm
parents: 7968
diff changeset
   131
 \isacommand{also} and \isacommand{finally}, Isabelle/Isar maintains
d534b897ce39 improved presentation;
wenzelm
parents: 7968
diff changeset
   132
 separate context information of ``transitivity'' rules.  Rule
d534b897ce39 improved presentation;
wenzelm
parents: 7968
diff changeset
   133
 selection takes place automatically by higher-order unification.
10007
64bf7da1994a isar-strip-terminators;
wenzelm
parents: 8910
diff changeset
   134
*}
7874
180364256231 improved presentation;
wenzelm
parents: 7800
diff changeset
   135
6763
df12aef00932 Some bits of group theory. Demonstrate calculational proofs.
wenzelm
parents:
diff changeset
   136
10007
64bf7da1994a isar-strip-terminators;
wenzelm
parents: 8910
diff changeset
   137
subsection {* Groups as monoids *}
6793
88aba7f486cb groups as monoids;
wenzelm
parents: 6784
diff changeset
   138
88aba7f486cb groups as monoids;
wenzelm
parents: 6784
diff changeset
   139
text {*
7874
180364256231 improved presentation;
wenzelm
parents: 7800
diff changeset
   140
 Monoids over signature $({\times} :: \alpha \To \alpha \To \alpha,
180364256231 improved presentation;
wenzelm
parents: 7800
diff changeset
   141
 \idt{one} :: \alpha)$ are defined like this.
10007
64bf7da1994a isar-strip-terminators;
wenzelm
parents: 8910
diff changeset
   142
*}
6793
88aba7f486cb groups as monoids;
wenzelm
parents: 6784
diff changeset
   143
35317
d57da4abb47d dropped axclass; dropped Id
haftmann
parents: 33026
diff changeset
   144
class monoid = times + one +
d57da4abb47d dropped axclass; dropped Id
haftmann
parents: 33026
diff changeset
   145
  assumes monoid_assoc:       "(x * y) * z = x * (y * z)"
d57da4abb47d dropped axclass; dropped Id
haftmann
parents: 33026
diff changeset
   146
  assumes monoid_left_one:   "one * x = x"
d57da4abb47d dropped axclass; dropped Id
haftmann
parents: 33026
diff changeset
   147
  assumes monoid_right_one:  "x * one = x"
6793
88aba7f486cb groups as monoids;
wenzelm
parents: 6784
diff changeset
   148
88aba7f486cb groups as monoids;
wenzelm
parents: 6784
diff changeset
   149
text {*
7748
5b9c45b21782 improved presentation;
wenzelm
parents: 7740
diff changeset
   150
 Groups are \emph{not} yet monoids directly from the definition.  For
10141
964d9dc47041 tuned names;
wenzelm
parents: 10007
diff changeset
   151
 monoids, \name{right-one} had to be included as an axiom, but for
964d9dc47041 tuned names;
wenzelm
parents: 10007
diff changeset
   152
 groups both \name{right-one} and \name{right-inverse} are derivable
964d9dc47041 tuned names;
wenzelm
parents: 10007
diff changeset
   153
 from the other axioms.  With \name{group-right-one} derived as a
964d9dc47041 tuned names;
wenzelm
parents: 10007
diff changeset
   154
 theorem of group theory (see page~\pageref{thm:group-right-one}), we
964d9dc47041 tuned names;
wenzelm
parents: 10007
diff changeset
   155
 may still instantiate $\idt{group} \subseteq \idt{monoid}$ properly
964d9dc47041 tuned names;
wenzelm
parents: 10007
diff changeset
   156
 as follows.
10007
64bf7da1994a isar-strip-terminators;
wenzelm
parents: 8910
diff changeset
   157
*}
6793
88aba7f486cb groups as monoids;
wenzelm
parents: 6784
diff changeset
   158
10007
64bf7da1994a isar-strip-terminators;
wenzelm
parents: 8910
diff changeset
   159
instance group < monoid
7356
1714c91b8729 expand_classes renamed to intro_classes;
wenzelm
parents: 7133
diff changeset
   160
  by (intro_classes,
6793
88aba7f486cb groups as monoids;
wenzelm
parents: 6784
diff changeset
   161
       rule group_assoc,
10141
964d9dc47041 tuned names;
wenzelm
parents: 10007
diff changeset
   162
       rule group_left_one,
964d9dc47041 tuned names;
wenzelm
parents: 10007
diff changeset
   163
       rule group_right_one)
6793
88aba7f486cb groups as monoids;
wenzelm
parents: 6784
diff changeset
   164
7874
180364256231 improved presentation;
wenzelm
parents: 7800
diff changeset
   165
text {*
180364256231 improved presentation;
wenzelm
parents: 7800
diff changeset
   166
 The \isacommand{instance} command actually is a version of
180364256231 improved presentation;
wenzelm
parents: 7800
diff changeset
   167
 \isacommand{theorem}, setting up a goal that reflects the intended
180364256231 improved presentation;
wenzelm
parents: 7800
diff changeset
   168
 class relation (or type constructor arity).  Thus any Isar proof
180364256231 improved presentation;
wenzelm
parents: 7800
diff changeset
   169
 language element may be involved to establish this statement.  When
7982
d534b897ce39 improved presentation;
wenzelm
parents: 7968
diff changeset
   170
 concluding the proof, the result is transformed into the intended
7874
180364256231 improved presentation;
wenzelm
parents: 7800
diff changeset
   171
 type signature extension behind the scenes.
10007
64bf7da1994a isar-strip-terminators;
wenzelm
parents: 8910
diff changeset
   172
*}
7874
180364256231 improved presentation;
wenzelm
parents: 7800
diff changeset
   173
10141
964d9dc47041 tuned names;
wenzelm
parents: 10007
diff changeset
   174
subsection {* More theorems of group theory *}
964d9dc47041 tuned names;
wenzelm
parents: 10007
diff changeset
   175
964d9dc47041 tuned names;
wenzelm
parents: 10007
diff changeset
   176
text {*
964d9dc47041 tuned names;
wenzelm
parents: 10007
diff changeset
   177
 The one element is already uniquely determined by preserving an
964d9dc47041 tuned names;
wenzelm
parents: 10007
diff changeset
   178
 \emph{arbitrary} group element.
964d9dc47041 tuned names;
wenzelm
parents: 10007
diff changeset
   179
*}
964d9dc47041 tuned names;
wenzelm
parents: 10007
diff changeset
   180
964d9dc47041 tuned names;
wenzelm
parents: 10007
diff changeset
   181
theorem group_one_equality: "e * x = x ==> one = (e::'a::group)"
964d9dc47041 tuned names;
wenzelm
parents: 10007
diff changeset
   182
proof -
964d9dc47041 tuned names;
wenzelm
parents: 10007
diff changeset
   183
  assume eq: "e * x = x"
964d9dc47041 tuned names;
wenzelm
parents: 10007
diff changeset
   184
  have "one = x * inverse x"
964d9dc47041 tuned names;
wenzelm
parents: 10007
diff changeset
   185
    by (simp only: group_right_inverse)
964d9dc47041 tuned names;
wenzelm
parents: 10007
diff changeset
   186
  also have "... = (e * x) * inverse x"
964d9dc47041 tuned names;
wenzelm
parents: 10007
diff changeset
   187
    by (simp only: eq)
964d9dc47041 tuned names;
wenzelm
parents: 10007
diff changeset
   188
  also have "... = e * (x * inverse x)"
964d9dc47041 tuned names;
wenzelm
parents: 10007
diff changeset
   189
    by (simp only: group_assoc)
964d9dc47041 tuned names;
wenzelm
parents: 10007
diff changeset
   190
  also have "... = e * one"
964d9dc47041 tuned names;
wenzelm
parents: 10007
diff changeset
   191
    by (simp only: group_right_inverse)
964d9dc47041 tuned names;
wenzelm
parents: 10007
diff changeset
   192
  also have "... = e"
964d9dc47041 tuned names;
wenzelm
parents: 10007
diff changeset
   193
    by (simp only: group_right_one)
964d9dc47041 tuned names;
wenzelm
parents: 10007
diff changeset
   194
  finally show ?thesis .
964d9dc47041 tuned names;
wenzelm
parents: 10007
diff changeset
   195
qed
964d9dc47041 tuned names;
wenzelm
parents: 10007
diff changeset
   196
964d9dc47041 tuned names;
wenzelm
parents: 10007
diff changeset
   197
text {*
964d9dc47041 tuned names;
wenzelm
parents: 10007
diff changeset
   198
 Likewise, the inverse is already determined by the cancel property.
964d9dc47041 tuned names;
wenzelm
parents: 10007
diff changeset
   199
*}
964d9dc47041 tuned names;
wenzelm
parents: 10007
diff changeset
   200
964d9dc47041 tuned names;
wenzelm
parents: 10007
diff changeset
   201
theorem group_inverse_equality:
964d9dc47041 tuned names;
wenzelm
parents: 10007
diff changeset
   202
  "x' * x = one ==> inverse x = (x'::'a::group)"
964d9dc47041 tuned names;
wenzelm
parents: 10007
diff changeset
   203
proof -
964d9dc47041 tuned names;
wenzelm
parents: 10007
diff changeset
   204
  assume eq: "x' * x = one"
964d9dc47041 tuned names;
wenzelm
parents: 10007
diff changeset
   205
  have "inverse x = one * inverse x"
964d9dc47041 tuned names;
wenzelm
parents: 10007
diff changeset
   206
    by (simp only: group_left_one)
964d9dc47041 tuned names;
wenzelm
parents: 10007
diff changeset
   207
  also have "... = (x' * x) * inverse x"
964d9dc47041 tuned names;
wenzelm
parents: 10007
diff changeset
   208
    by (simp only: eq)
964d9dc47041 tuned names;
wenzelm
parents: 10007
diff changeset
   209
  also have "... = x' * (x * inverse x)"
964d9dc47041 tuned names;
wenzelm
parents: 10007
diff changeset
   210
    by (simp only: group_assoc)
964d9dc47041 tuned names;
wenzelm
parents: 10007
diff changeset
   211
  also have "... = x' * one"
964d9dc47041 tuned names;
wenzelm
parents: 10007
diff changeset
   212
    by (simp only: group_right_inverse)
964d9dc47041 tuned names;
wenzelm
parents: 10007
diff changeset
   213
  also have "... = x'"
964d9dc47041 tuned names;
wenzelm
parents: 10007
diff changeset
   214
    by (simp only: group_right_one)
964d9dc47041 tuned names;
wenzelm
parents: 10007
diff changeset
   215
  finally show ?thesis .
964d9dc47041 tuned names;
wenzelm
parents: 10007
diff changeset
   216
qed
964d9dc47041 tuned names;
wenzelm
parents: 10007
diff changeset
   217
964d9dc47041 tuned names;
wenzelm
parents: 10007
diff changeset
   218
text {*
964d9dc47041 tuned names;
wenzelm
parents: 10007
diff changeset
   219
 The inverse operation has some further characteristic properties.
964d9dc47041 tuned names;
wenzelm
parents: 10007
diff changeset
   220
*}
964d9dc47041 tuned names;
wenzelm
parents: 10007
diff changeset
   221
964d9dc47041 tuned names;
wenzelm
parents: 10007
diff changeset
   222
theorem group_inverse_times:
964d9dc47041 tuned names;
wenzelm
parents: 10007
diff changeset
   223
  "inverse (x * y) = inverse y * inverse (x::'a::group)"
964d9dc47041 tuned names;
wenzelm
parents: 10007
diff changeset
   224
proof (rule group_inverse_equality)
964d9dc47041 tuned names;
wenzelm
parents: 10007
diff changeset
   225
  show "(inverse y * inverse x) * (x * y) = one"
964d9dc47041 tuned names;
wenzelm
parents: 10007
diff changeset
   226
  proof -
964d9dc47041 tuned names;
wenzelm
parents: 10007
diff changeset
   227
    have "(inverse y * inverse x) * (x * y) =
964d9dc47041 tuned names;
wenzelm
parents: 10007
diff changeset
   228
        (inverse y * (inverse x * x)) * y"
964d9dc47041 tuned names;
wenzelm
parents: 10007
diff changeset
   229
      by (simp only: group_assoc)
964d9dc47041 tuned names;
wenzelm
parents: 10007
diff changeset
   230
    also have "... = (inverse y * one) * y"
964d9dc47041 tuned names;
wenzelm
parents: 10007
diff changeset
   231
      by (simp only: group_left_inverse)
964d9dc47041 tuned names;
wenzelm
parents: 10007
diff changeset
   232
    also have "... = inverse y * y"
964d9dc47041 tuned names;
wenzelm
parents: 10007
diff changeset
   233
      by (simp only: group_right_one)
964d9dc47041 tuned names;
wenzelm
parents: 10007
diff changeset
   234
    also have "... = one"
964d9dc47041 tuned names;
wenzelm
parents: 10007
diff changeset
   235
      by (simp only: group_left_inverse)
964d9dc47041 tuned names;
wenzelm
parents: 10007
diff changeset
   236
    finally show ?thesis .
964d9dc47041 tuned names;
wenzelm
parents: 10007
diff changeset
   237
  qed
964d9dc47041 tuned names;
wenzelm
parents: 10007
diff changeset
   238
qed
964d9dc47041 tuned names;
wenzelm
parents: 10007
diff changeset
   239
964d9dc47041 tuned names;
wenzelm
parents: 10007
diff changeset
   240
theorem inverse_inverse: "inverse (inverse x) = (x::'a::group)"
964d9dc47041 tuned names;
wenzelm
parents: 10007
diff changeset
   241
proof (rule group_inverse_equality)
964d9dc47041 tuned names;
wenzelm
parents: 10007
diff changeset
   242
  show "x * inverse x = one"
964d9dc47041 tuned names;
wenzelm
parents: 10007
diff changeset
   243
    by (simp only: group_right_inverse)
964d9dc47041 tuned names;
wenzelm
parents: 10007
diff changeset
   244
qed
964d9dc47041 tuned names;
wenzelm
parents: 10007
diff changeset
   245
964d9dc47041 tuned names;
wenzelm
parents: 10007
diff changeset
   246
theorem inverse_inject: "inverse x = inverse y ==> x = (y::'a::group)"
964d9dc47041 tuned names;
wenzelm
parents: 10007
diff changeset
   247
proof -
964d9dc47041 tuned names;
wenzelm
parents: 10007
diff changeset
   248
  assume eq: "inverse x = inverse y"
964d9dc47041 tuned names;
wenzelm
parents: 10007
diff changeset
   249
  have "x = x * one"
964d9dc47041 tuned names;
wenzelm
parents: 10007
diff changeset
   250
    by (simp only: group_right_one)
964d9dc47041 tuned names;
wenzelm
parents: 10007
diff changeset
   251
  also have "... = x * (inverse y * y)"
964d9dc47041 tuned names;
wenzelm
parents: 10007
diff changeset
   252
    by (simp only: group_left_inverse)
964d9dc47041 tuned names;
wenzelm
parents: 10007
diff changeset
   253
  also have "... = x * (inverse x * y)"
964d9dc47041 tuned names;
wenzelm
parents: 10007
diff changeset
   254
    by (simp only: eq)
964d9dc47041 tuned names;
wenzelm
parents: 10007
diff changeset
   255
  also have "... = (x * inverse x) * y"
964d9dc47041 tuned names;
wenzelm
parents: 10007
diff changeset
   256
    by (simp only: group_assoc)
964d9dc47041 tuned names;
wenzelm
parents: 10007
diff changeset
   257
  also have "... = one * y"
964d9dc47041 tuned names;
wenzelm
parents: 10007
diff changeset
   258
    by (simp only: group_right_inverse)
964d9dc47041 tuned names;
wenzelm
parents: 10007
diff changeset
   259
  also have "... = y"
964d9dc47041 tuned names;
wenzelm
parents: 10007
diff changeset
   260
    by (simp only: group_left_one)
964d9dc47041 tuned names;
wenzelm
parents: 10007
diff changeset
   261
  finally show ?thesis .
964d9dc47041 tuned names;
wenzelm
parents: 10007
diff changeset
   262
qed
964d9dc47041 tuned names;
wenzelm
parents: 10007
diff changeset
   263
964d9dc47041 tuned names;
wenzelm
parents: 10007
diff changeset
   264
end