src/HOL/Isar_Examples/Group.thy
changeset 35317 d57da4abb47d
parent 33026 8f35633c4922
child 37671 fa53d267dab3
equal deleted inserted replaced
35316:870dfea4f9c0 35317:d57da4abb47d
    15  \idt{one} :: \alpha, \idt{inverse} :: \alpha \To \alpha)$ are defined
    15  \idt{one} :: \alpha, \idt{inverse} :: \alpha \To \alpha)$ are defined
    16  as an axiomatic type class as follows.  Note that the parent class
    16  as an axiomatic type class as follows.  Note that the parent class
    17  $\idt{times}$ is provided by the basic HOL theory.
    17  $\idt{times}$ is provided by the basic HOL theory.
    18 *}
    18 *}
    19 
    19 
    20 consts
    20 notation Groups.one ("one")
    21   one :: "'a"
    21 
    22   inverse :: "'a => 'a"
    22 class group = times + one + inverse +
    23 
    23   assumes group_assoc:         "(x * y) * z = x * (y * z)"
    24 axclass
    24   assumes group_left_one:      "one * x = x"
    25   group < times
    25   assumes group_left_inverse:  "inverse x * x = one"
    26   group_assoc:         "(x * y) * z = x * (y * z)"
       
    27   group_left_one:      "one * x = x"
       
    28   group_left_inverse:  "inverse x * x = one"
       
    29 
    26 
    30 text {*
    27 text {*
    31  The group axioms only state the properties of left one and inverse,
    28  The group axioms only state the properties of left one and inverse,
    32  the right versions may be derived as follows.
    29  the right versions may be derived as follows.
    33 *}
    30 *}
   142 text {*
   139 text {*
   143  Monoids over signature $({\times} :: \alpha \To \alpha \To \alpha,
   140  Monoids over signature $({\times} :: \alpha \To \alpha \To \alpha,
   144  \idt{one} :: \alpha)$ are defined like this.
   141  \idt{one} :: \alpha)$ are defined like this.
   145 *}
   142 *}
   146 
   143 
   147 axclass monoid < times
   144 class monoid = times + one +
   148   monoid_assoc:       "(x * y) * z = x * (y * z)"
   145   assumes monoid_assoc:       "(x * y) * z = x * (y * z)"
   149   monoid_left_one:   "one * x = x"
   146   assumes monoid_left_one:   "one * x = x"
   150   monoid_right_one:  "x * one = x"
   147   assumes monoid_right_one:  "x * one = x"
   151 
   148 
   152 text {*
   149 text {*
   153  Groups are \emph{not} yet monoids directly from the definition.  For
   150  Groups are \emph{not} yet monoids directly from the definition.  For
   154  monoids, \name{right-one} had to be included as an axiom, but for
   151  monoids, \name{right-one} had to be included as an axiom, but for
   155  groups both \name{right-one} and \name{right-inverse} are derivable
   152  groups both \name{right-one} and \name{right-inverse} are derivable