doc-src/AxClass/generated/Semigroups.tex
author kleing
Mon, 25 Sep 2000 12:08:49 +0200
changeset 10069 c7226e6f9625
parent 9921 7acefd99e748
child 10140 ba9297b71897
permissions -rw-r--r--
untabified for HTML
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
9767
dc2ee9b2e065 updated;
wenzelm
parents: 9672
diff changeset
     1
%
dc2ee9b2e065 updated;
wenzelm
parents: 9672
diff changeset
     2
\begin{isabellebody}%
9921
7acefd99e748 updated;
wenzelm
parents: 9767
diff changeset
     3
\def\isabellecontext{Semigroups}%
8906
wenzelm
parents: 8903
diff changeset
     4
%
wenzelm
parents: 8903
diff changeset
     5
\isamarkupheader{Semigroups}
9672
2c208c98f541 updated;
wenzelm
parents: 9665
diff changeset
     6
\isacommand{theory}\ Semigroups\ {\isacharequal}\ Main{\isacharcolon}%
8906
wenzelm
parents: 8903
diff changeset
     7
\begin{isamarkuptext}%
wenzelm
parents: 8903
diff changeset
     8
\medskip\noindent An axiomatic type class is simply a class of types
8907
wenzelm
parents: 8906
diff changeset
     9
 that all meet certain properties, which are also called \emph{class
wenzelm
parents: 8906
diff changeset
    10
 axioms}. Thus, type classes may be also understood as type predicates
wenzelm
parents: 8906
diff changeset
    11
 --- i.e.\ abstractions over a single type argument $\alpha$.  Class
wenzelm
parents: 8906
diff changeset
    12
 axioms typically contain polymorphic constants that depend on this
wenzelm
parents: 8906
diff changeset
    13
 type $\alpha$.  These \emph{characteristic constants} behave like
wenzelm
parents: 8906
diff changeset
    14
 operations associated with the ``carrier'' type $\alpha$.
8906
wenzelm
parents: 8903
diff changeset
    15
wenzelm
parents: 8903
diff changeset
    16
 We illustrate these basic concepts by the following formulation of
wenzelm
parents: 8903
diff changeset
    17
 semigroups.%
wenzelm
parents: 8903
diff changeset
    18
\end{isamarkuptext}%
8890
9a44d8d98731 snapshot of new Isar'ized version;
wenzelm
parents:
diff changeset
    19
\isacommand{consts}\isanewline
9672
2c208c98f541 updated;
wenzelm
parents: 9665
diff changeset
    20
\ \ times\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequote}{\isacharprime}a\ {\isasymRightarrow}\ {\isacharprime}a\ {\isasymRightarrow}\ {\isacharprime}a{\isachardoublequote}\ \ \ \ {\isacharparenleft}\isakeyword{infixl}\ {\isachardoublequote}{\isasymOtimes}{\isachardoublequote}\ \isadigit{7}\isadigit{0}{\isacharparenright}\isanewline
8906
wenzelm
parents: 8903
diff changeset
    21
\isacommand{axclass}\isanewline
9665
2a6d7f1409f9 updated;
wenzelm
parents: 9519
diff changeset
    22
\ \ semigroup\ {\isacharless}\ {\isachardoublequote}term{\isachardoublequote}\isanewline
9672
2c208c98f541 updated;
wenzelm
parents: 9665
diff changeset
    23
\ \ assoc{\isacharcolon}\ {\isachardoublequote}{\isacharparenleft}x\ {\isasymOtimes}\ y{\isacharparenright}\ {\isasymOtimes}\ z\ {\isacharequal}\ x\ {\isasymOtimes}\ {\isacharparenleft}y\ {\isasymOtimes}\ z{\isacharparenright}{\isachardoublequote}%
8906
wenzelm
parents: 8903
diff changeset
    24
\begin{isamarkuptext}%
wenzelm
parents: 8903
diff changeset
    25
\noindent Above we have first declared a polymorphic constant $\TIMES
wenzelm
parents: 8903
diff changeset
    26
 :: \alpha \To \alpha \To \alpha$ and then defined the class
wenzelm
parents: 8903
diff changeset
    27
 $semigroup$ of all types $\tau$ such that $\TIMES :: \tau \To \tau
wenzelm
parents: 8903
diff changeset
    28
 \To \tau$ is indeed an associative operator.  The $assoc$ axiom
wenzelm
parents: 8903
diff changeset
    29
 contains exactly one type variable, which is invisible in the above
wenzelm
parents: 8903
diff changeset
    30
 presentation, though.  Also note that free term variables (like $x$,
wenzelm
parents: 8903
diff changeset
    31
 $y$, $z$) are allowed for user convenience --- conceptually all of
wenzelm
parents: 8903
diff changeset
    32
 these are bound by outermost universal quantifiers.
wenzelm
parents: 8903
diff changeset
    33
wenzelm
parents: 8903
diff changeset
    34
 \medskip In general, type classes may be used to describe
wenzelm
parents: 8903
diff changeset
    35
 \emph{structures} with exactly one carrier $\alpha$ and a fixed
wenzelm
parents: 8903
diff changeset
    36
 \emph{signature}.  Different signatures require different classes.
8907
wenzelm
parents: 8906
diff changeset
    37
 Below, class $plus_semigroup$ represents semigroups of the form
wenzelm
parents: 8906
diff changeset
    38
 $(\tau, \PLUS^\tau)$, while the original $semigroup$ would correspond
8906
wenzelm
parents: 8903
diff changeset
    39
 to semigroups $(\tau, \TIMES^\tau)$.%
wenzelm
parents: 8903
diff changeset
    40
\end{isamarkuptext}%
wenzelm
parents: 8903
diff changeset
    41
\isacommand{consts}\isanewline
9672
2c208c98f541 updated;
wenzelm
parents: 9665
diff changeset
    42
\ \ plus\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequote}{\isacharprime}a\ {\isasymRightarrow}\ {\isacharprime}a\ {\isasymRightarrow}\ {\isacharprime}a{\isachardoublequote}\ \ \ \ {\isacharparenleft}\isakeyword{infixl}\ {\isachardoublequote}{\isasymOplus}{\isachardoublequote}\ \isadigit{7}\isadigit{0}{\isacharparenright}\isanewline
8890
9a44d8d98731 snapshot of new Isar'ized version;
wenzelm
parents:
diff changeset
    43
\isacommand{axclass}\isanewline
9665
2a6d7f1409f9 updated;
wenzelm
parents: 9519
diff changeset
    44
\ \ plus{\isacharunderscore}semigroup\ {\isacharless}\ {\isachardoublequote}term{\isachardoublequote}\isanewline
9672
2c208c98f541 updated;
wenzelm
parents: 9665
diff changeset
    45
\ \ assoc{\isacharcolon}\ {\isachardoublequote}{\isacharparenleft}x\ {\isasymOplus}\ y{\isacharparenright}\ {\isasymOplus}\ z\ {\isacharequal}\ x\ {\isasymOplus}\ {\isacharparenleft}y\ {\isasymOplus}\ z{\isacharparenright}{\isachardoublequote}%
8906
wenzelm
parents: 8903
diff changeset
    46
\begin{isamarkuptext}%
8907
wenzelm
parents: 8906
diff changeset
    47
\noindent Even if classes $plus_semigroup$ and $semigroup$ both
wenzelm
parents: 8906
diff changeset
    48
 represent semigroups in a sense, they are certainly not quite the
wenzelm
parents: 8906
diff changeset
    49
 same.%
8906
wenzelm
parents: 8903
diff changeset
    50
\end{isamarkuptext}%
9767
dc2ee9b2e065 updated;
wenzelm
parents: 9672
diff changeset
    51
\isacommand{end}\end{isabellebody}%
9145
9f7b8de5bfaf updated;
wenzelm
parents: 8907
diff changeset
    52
%%% Local Variables:
9f7b8de5bfaf updated;
wenzelm
parents: 8907
diff changeset
    53
%%% mode: latex
9f7b8de5bfaf updated;
wenzelm
parents: 8907
diff changeset
    54
%%% TeX-master: "root"
9f7b8de5bfaf updated;
wenzelm
parents: 8907
diff changeset
    55
%%% End: