doc-src/AxClass/generated/Semigroups.tex
author wenzelm
Sun, 15 Oct 2000 19:51:56 +0200
changeset 10223 31346d22bb54
parent 10207 c7c64cd26fc9
child 10395 7ef380745743
permissions -rw-r--r--
tuned;
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
10140
ba9297b71897 major cleanup -- improved typesetting;
wenzelm
parents: 9921
diff changeset
    11
 --- i.e.\ abstractions over a single type argument \isa{{\isacharprime}a}.  Class
8907
wenzelm
parents: 8906
diff changeset
    12
 axioms typically contain polymorphic constants that depend on this
10140
ba9297b71897 major cleanup -- improved typesetting;
wenzelm
parents: 9921
diff changeset
    13
 type \isa{{\isacharprime}a}.  These \emph{characteristic constants} behave like
ba9297b71897 major cleanup -- improved typesetting;
wenzelm
parents: 9921
diff changeset
    14
 operations associated with the ``carrier'' type \isa{{\isacharprime}a}.
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
10207
c7c64cd26fc9 updated;
wenzelm
parents: 10140
diff changeset
    20
\ \ times\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequote}{\isacharprime}a\ {\isasymRightarrow}\ {\isacharprime}a\ {\isasymRightarrow}\ {\isacharprime}a{\isachardoublequote}\ \ \ \ {\isacharparenleft}\isakeyword{infixl}\ {\isachardoublequote}{\isasymodot}{\isachardoublequote}\ {\isadigit{7}}{\isadigit{0}}{\isacharparenright}\isanewline
10140
ba9297b71897 major cleanup -- improved typesetting;
wenzelm
parents: 9921
diff changeset
    21
\isacommand{axclass}\ semigroup\ {\isacharless}\ {\isachardoublequote}term{\isachardoublequote}\isanewline
ba9297b71897 major cleanup -- improved typesetting;
wenzelm
parents: 9921
diff changeset
    22
\ \ assoc{\isacharcolon}\ {\isachardoublequote}{\isacharparenleft}x\ {\isasymodot}\ y{\isacharparenright}\ {\isasymodot}\ z\ {\isacharequal}\ x\ {\isasymodot}\ {\isacharparenleft}y\ {\isasymodot}\ z{\isacharparenright}{\isachardoublequote}%
8906
wenzelm
parents: 8903
diff changeset
    23
\begin{isamarkuptext}%
10140
ba9297b71897 major cleanup -- improved typesetting;
wenzelm
parents: 9921
diff changeset
    24
\noindent Above we have first declared a polymorphic constant \isa{{\isasymodot}\ {\isasymColon}\ {\isacharprime}a\ {\isasymRightarrow}\ {\isacharprime}a\ {\isasymRightarrow}\ {\isacharprime}a} and then defined the class \isa{semigroup} of
ba9297b71897 major cleanup -- improved typesetting;
wenzelm
parents: 9921
diff changeset
    25
 all types \isa{{\isasymtau}} such that \isa{{\isasymodot}\ {\isasymColon}\ {\isasymtau}\ {\isasymRightarrow}\ {\isasymtau}\ {\isasymRightarrow}\ {\isasymtau}} is indeed an
ba9297b71897 major cleanup -- improved typesetting;
wenzelm
parents: 9921
diff changeset
    26
 associative operator.  The \isa{assoc} axiom contains exactly one
ba9297b71897 major cleanup -- improved typesetting;
wenzelm
parents: 9921
diff changeset
    27
 type variable, which is invisible in the above presentation, though.
ba9297b71897 major cleanup -- improved typesetting;
wenzelm
parents: 9921
diff changeset
    28
 Also note that free term variables (like \isa{x}, \isa{y}, \isa{z}) are allowed for user convenience --- conceptually all of these
ba9297b71897 major cleanup -- improved typesetting;
wenzelm
parents: 9921
diff changeset
    29
 are bound by outermost universal quantifiers.
8906
wenzelm
parents: 8903
diff changeset
    30
wenzelm
parents: 8903
diff changeset
    31
 \medskip In general, type classes may be used to describe
10140
ba9297b71897 major cleanup -- improved typesetting;
wenzelm
parents: 9921
diff changeset
    32
 \emph{structures} with exactly one carrier \isa{{\isacharprime}a} and a fixed
8906
wenzelm
parents: 8903
diff changeset
    33
 \emph{signature}.  Different signatures require different classes.
10223
wenzelm
parents: 10207
diff changeset
    34
 Below, class \isa{plus{\isacharunderscore}semigroup} represents semigroups 
wenzelm
parents: 10207
diff changeset
    35
 \isa{{\isacharparenleft}{\isasymtau}{\isacharcomma}\ {\isasymoplus}\isactrlsup {\isasymtau}{\isacharparenright}}, while the original \isa{semigroup} would
wenzelm
parents: 10207
diff changeset
    36
 correspond to semigroups of the form \isa{{\isacharparenleft}{\isasymtau}{\isacharcomma}\ {\isasymodot}\isactrlsup {\isasymtau}{\isacharparenright}}.%
8906
wenzelm
parents: 8903
diff changeset
    37
\end{isamarkuptext}%
wenzelm
parents: 8903
diff changeset
    38
\isacommand{consts}\isanewline
10207
c7c64cd26fc9 updated;
wenzelm
parents: 10140
diff changeset
    39
\ \ 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
10140
ba9297b71897 major cleanup -- improved typesetting;
wenzelm
parents: 9921
diff changeset
    40
\isacommand{axclass}\ plus{\isacharunderscore}semigroup\ {\isacharless}\ {\isachardoublequote}term{\isachardoublequote}\isanewline
ba9297b71897 major cleanup -- improved typesetting;
wenzelm
parents: 9921
diff changeset
    41
\ \ 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
    42
\begin{isamarkuptext}%
10140
ba9297b71897 major cleanup -- improved typesetting;
wenzelm
parents: 9921
diff changeset
    43
\noindent Even if classes \isa{plus{\isacharunderscore}semigroup} and \isa{semigroup} both represent semigroups in a sense, they are certainly
ba9297b71897 major cleanup -- improved typesetting;
wenzelm
parents: 9921
diff changeset
    44
 not quite the same.%
8906
wenzelm
parents: 8903
diff changeset
    45
\end{isamarkuptext}%
9767
dc2ee9b2e065 updated;
wenzelm
parents: 9672
diff changeset
    46
\isacommand{end}\end{isabellebody}%
9145
9f7b8de5bfaf updated;
wenzelm
parents: 8907
diff changeset
    47
%%% Local Variables:
9f7b8de5bfaf updated;
wenzelm
parents: 8907
diff changeset
    48
%%% mode: latex
9f7b8de5bfaf updated;
wenzelm
parents: 8907
diff changeset
    49
%%% TeX-master: "root"
9f7b8de5bfaf updated;
wenzelm
parents: 8907
diff changeset
    50
%%% End: