Polishing the English
authorpaulson
Wed, 17 Jun 2009 17:07:17 +0100
changeset 316847d50527dc008
parent 31683 cc37bf07f9bb
child 31694 9a04846cac9c
Polishing the English
doc-src/Classes/Thy/Classes.thy
doc-src/Classes/Thy/document/Classes.tex
doc-src/Classes/classes.tex
     1.1 --- a/doc-src/Classes/Thy/Classes.thy	Wed Jun 17 15:41:49 2009 +0200
     1.2 +++ b/doc-src/Classes/Thy/Classes.thy	Wed Jun 17 17:07:17 2009 +0100
     1.3 @@ -5,8 +5,8 @@
     1.4  section {* Introduction *}
     1.5  
     1.6  text {*
     1.7 -  Type classes were introduces by Wadler and Blott \cite{wadler89how}
     1.8 -  into the Haskell language, to allow for a reasonable implementation
     1.9 +  Type classes were introduced by Wadler and Blott \cite{wadler89how}
    1.10 +  into the Haskell language to allow for a reasonable implementation
    1.11    of overloading\footnote{throughout this tutorial, we are referring
    1.12    to classical Haskell 1.0 type classes, not considering
    1.13    later additions in expressiveness}.
    1.14 @@ -43,9 +43,9 @@
    1.15  
    1.16    Indeed, type classes not only allow for simple overloading
    1.17    but form a generic calculus, an instance of order-sorted
    1.18 -  algebra \cite{Nipkow-Prehofer:1993,nipkow-sorts93,Wenzel:1997:TPHOL}.
    1.19 +  algebra \cite{nipkow-sorts93,Nipkow-Prehofer:1993,Wenzel:1997:TPHOL}.
    1.20  
    1.21 -  From a software engeneering point of view, type classes
    1.22 +  From a software engineering point of view, type classes
    1.23    roughly correspond to interfaces in object-oriented languages like Java;
    1.24    so, it is naturally desirable that type classes do not only
    1.25    provide functions (class parameters) but also state specifications
    1.26 @@ -65,7 +65,7 @@
    1.27  
    1.28    \end{quote}
    1.29  
    1.30 -  \noindent From a theoretic point of view, type classes are lightweight
    1.31 +  \noindent From a theoretical point of view, type classes are lightweight
    1.32    modules; Haskell type classes may be emulated by
    1.33    SML functors \cite{classes_modules}. 
    1.34    Isabelle/Isar offers a discipline of type classes which brings
    1.35 @@ -77,22 +77,19 @@
    1.36      \item instantiating those abstract parameters by a particular
    1.37         type
    1.38      \item in connection with a ``less ad-hoc'' approach to overloading,
    1.39 -    \item with a direct link to the Isabelle module system
    1.40 -      (aka locales \cite{kammueller-locales}).
    1.41 +    \item with a direct link to the Isabelle module system:
    1.42 +      locales \cite{kammueller-locales}.
    1.43    \end{enumerate}
    1.44  
    1.45    \noindent Isar type classes also directly support code generation
    1.46 -  in a Haskell like fashion.
    1.47 +  in a Haskell like fashion. Internally, they are mapped to more primitive 
    1.48 +  Isabelle concepts \cite{Haftmann-Wenzel:2006:classes}.
    1.49  
    1.50    This tutorial demonstrates common elements of structured specifications
    1.51    and abstract reasoning with type classes by the algebraic hierarchy of
    1.52    semigroups, monoids and groups.  Our background theory is that of
    1.53    Isabelle/HOL \cite{isa-tutorial}, for which some
    1.54    familiarity is assumed.
    1.55 -
    1.56 -  Here we merely present the look-and-feel for end users.
    1.57 -  Internally, those are mapped to more primitive Isabelle concepts.
    1.58 -  See \cite{Haftmann-Wenzel:2006:classes} for more detail.
    1.59  *}
    1.60  
    1.61  section {* A simple algebra example \label{sec:example} *}
    1.62 @@ -146,22 +143,22 @@
    1.63  end %quote
    1.64  
    1.65  text {*
    1.66 -  \noindent @{command instantiation} allows to define class parameters
    1.67 +  \noindent @{command instantiation} defines class parameters
    1.68    at a particular instance using common specification tools (here,
    1.69    @{command definition}).  The concluding @{command instance}
    1.70    opens a proof that the given parameters actually conform
    1.71    to the class specification.  Note that the first proof step
    1.72    is the @{method default} method,
    1.73    which for such instance proofs maps to the @{method intro_classes} method.
    1.74 -  This boils down an instance judgement to the relevant primitive
    1.75 -  proof goals and should conveniently always be the first method applied
    1.76 +  This reduces an instance judgement to the relevant primitive
    1.77 +  proof goals; typically it is the first method applied
    1.78    in an instantiation proof.
    1.79  
    1.80    From now on, the type-checker will consider @{typ int}
    1.81    as a @{class semigroup} automatically, i.e.\ any general results
    1.82    are immediately available on concrete instances.
    1.83  
    1.84 -  \medskip Another instance of @{class semigroup} are the natural numbers:
    1.85 +  \medskip Another instance of @{class semigroup} yields the natural numbers:
    1.86  *}
    1.87  
    1.88  instantiation %quote nat :: semigroup
    1.89 @@ -191,7 +188,7 @@
    1.90  subsection {* Lifting and parametric types *}
    1.91  
    1.92  text {*
    1.93 -  Overloaded definitions given on class instantiation
    1.94 +  Overloaded definitions given at a class instantiation
    1.95    may include recursion over the syntactic structure of types.
    1.96    As a canonical example, we model product semigroups
    1.97    using our simple algebra:
    1.98 @@ -201,11 +198,11 @@
    1.99  begin
   1.100  
   1.101  definition %quote
   1.102 -  mult_prod_def: "p\<^isub>1 \<otimes> p\<^isub>2 = (fst p\<^isub>1 \<otimes> fst p\<^isub>2, snd p\<^isub>1 \<otimes> snd p\<^isub>2)"
   1.103 +  mult_prod_def: "p1 \<otimes> p2 = (fst p1 \<otimes> fst p2, snd p1 \<otimes> snd p2)"
   1.104  
   1.105  instance %quote proof
   1.106 -  fix p\<^isub>1 p\<^isub>2 p\<^isub>3 :: "\<alpha>\<Colon>semigroup \<times> \<beta>\<Colon>semigroup"
   1.107 -  show "p\<^isub>1 \<otimes> p\<^isub>2 \<otimes> p\<^isub>3 = p\<^isub>1 \<otimes> (p\<^isub>2 \<otimes> p\<^isub>3)"
   1.108 +  fix p1 p2 p3 :: "\<alpha>\<Colon>semigroup \<times> \<beta>\<Colon>semigroup"
   1.109 +  show "p1 \<otimes> p2 \<otimes> p3 = p1 \<otimes> (p2 \<otimes> p3)"
   1.110      unfolding mult_prod_def by (simp add: assoc)
   1.111  qed      
   1.112  
   1.113 @@ -215,7 +212,7 @@
   1.114    \noindent Associativity of product semigroups is established using
   1.115    the definition of @{text "(\<otimes>)"} on products and the hypothetical
   1.116    associativity of the type components;  these hypotheses
   1.117 -  are facts due to the @{class semigroup} constraints imposed
   1.118 +  are legitimate due to the @{class semigroup} constraints imposed
   1.119    on the type components by the @{command instance} proposition.
   1.120    Indeed, this pattern often occurs with parametric types
   1.121    and type classes.
   1.122 @@ -228,7 +225,7 @@
   1.123    We define a subclass @{text monoidl} (a semigroup with a left-hand neutral)
   1.124    by extending @{class semigroup}
   1.125    with one additional parameter @{text neutral} together
   1.126 -  with its property:
   1.127 +  with its characteristic property:
   1.128  *}
   1.129  
   1.130  class %quote monoidl = semigroup +
   1.131 @@ -278,7 +275,7 @@
   1.132  end %quote
   1.133  
   1.134  text {*
   1.135 -  \noindent Fully-fledged monoids are modelled by another subclass
   1.136 +  \noindent Fully-fledged monoids are modelled by another subclass,
   1.137    which does not add new parameters but tightens the specification:
   1.138  *}
   1.139  
   1.140 @@ -338,13 +335,13 @@
   1.141  
   1.142  section {* Type classes as locales *}
   1.143  
   1.144 -subsection {* A look behind the scene *}
   1.145 +subsection {* A look behind the scenes *}
   1.146  
   1.147  text {*
   1.148    The example above gives an impression how Isar type classes work
   1.149    in practice.  As stated in the introduction, classes also provide
   1.150    a link to Isar's locale system.  Indeed, the logical core of a class
   1.151 -  is nothing else than a locale:
   1.152 +  is nothing other than a locale:
   1.153  *}
   1.154  
   1.155  class %quote idem =
   1.156 @@ -378,7 +375,7 @@
   1.157  proof qed (rule idem)
   1.158  
   1.159  text {*
   1.160 -  \noindent This gives you at hand the full power of the Isabelle module system;
   1.161 +  \noindent This gives you the full power of the Isabelle module system;
   1.162    conclusions in locale @{text idem} are implicitly propagated
   1.163    to class @{text idem}.
   1.164  *} (*<*)setup %invisible {* Sign.parent_path *}
   1.165 @@ -435,25 +432,26 @@
   1.166  
   1.167    \noindent As you can see from this example, for local
   1.168    definitions you may use any specification tool
   1.169 -  which works together with locales (e.g. \cite{krauss2006}).
   1.170 +  which works together with locales, such as Krauss's recursive function package
   1.171 +  \cite{krauss2006}.
   1.172  *}
   1.173  
   1.174  
   1.175  subsection {* A functor analogy *}
   1.176  
   1.177  text {*
   1.178 -  We introduced Isar classes by analogy to type classes
   1.179 +  We introduced Isar classes by analogy to type classes in
   1.180    functional programming;  if we reconsider this in the
   1.181    context of what has been said about type classes and locales,
   1.182    we can drive this analogy further by stating that type
   1.183 -  classes essentially correspond to functors which have
   1.184 +  classes essentially correspond to functors that have
   1.185    a canonical interpretation as type classes.
   1.186 -  Anyway, there is also the possibility of other interpretations.
   1.187 -  For example, also @{text list}s form a monoid with
   1.188 +  There is also the possibility of other interpretations.
   1.189 +  For example, @{text list}s also form a monoid with
   1.190    @{text append} and @{term "[]"} as operations, but it
   1.191    seems inappropriate to apply to lists
   1.192    the same operations as for genuinely algebraic types.
   1.193 -  In such a case, we simply can do a particular interpretation
   1.194 +  In such a case, we can simply make a particular interpretation
   1.195    of monoids for lists:
   1.196  *}
   1.197  
   1.198 @@ -517,7 +515,7 @@
   1.199    to the type system, making @{text group} an instance of
   1.200    @{text monoid} by adding an additional edge
   1.201    to the graph of subclass relations
   1.202 -  (cf.\ \figref{fig:subclass}).
   1.203 +  (\figref{fig:subclass}).
   1.204  
   1.205    \begin{figure}[htbp]
   1.206     \begin{center}
   1.207 @@ -550,7 +548,7 @@
   1.208    \end{figure}
   1.209  
   1.210    For illustration, a derived definition
   1.211 -  in @{text group} which uses @{text pow_nat}:
   1.212 +  in @{text group} using @{text pow_nat}
   1.213  *}
   1.214  
   1.215  definition %quote (in group) pow_int :: "int \<Rightarrow> \<alpha> \<Rightarrow> \<alpha>" where
   1.216 @@ -567,7 +565,7 @@
   1.217  subsection {* A note on syntax *}
   1.218  
   1.219  text {*
   1.220 -  As a convenience, class context syntax allows to refer
   1.221 +  As a convenience, class context syntax allows references
   1.222    to local class operations and their global counterparts
   1.223    uniformly;  type inference resolves ambiguities.  For example:
   1.224  *}
   1.225 @@ -601,9 +599,9 @@
   1.226    @{command instantiation}
   1.227    targets naturally maps to Haskell type classes.
   1.228    The code generator framework \cite{isabelle-codegen} 
   1.229 -  takes this into account.  Concerning target languages
   1.230 -  lacking type classes (e.g.~SML), type classes
   1.231 -  are implemented by explicit dictionary construction.
   1.232 +  takes this into account.  If the target language (e.g.~SML)
   1.233 +  lacks type classes, then they
   1.234 +  are implemented by an explicit dictionary construction.
   1.235    As example, let's go back to the power function:
   1.236  *}
   1.237  
   1.238 @@ -611,13 +609,13 @@
   1.239    "example = pow_int 10 (-2)"
   1.240  
   1.241  text {*
   1.242 -  \noindent This maps to Haskell as:
   1.243 +  \noindent This maps to Haskell as follows:
   1.244  *}
   1.245  
   1.246  text %quote {*@{code_stmts example (Haskell)}*}
   1.247  
   1.248  text {*
   1.249 -  \noindent The whole code in SML with explicit dictionary passing:
   1.250 +  \noindent The code in SML has explicit dictionary passing:
   1.251  *}
   1.252  
   1.253  text %quote {*@{code_stmts example (SML)}*}
     2.1 --- a/doc-src/Classes/Thy/document/Classes.tex	Wed Jun 17 15:41:49 2009 +0200
     2.2 +++ b/doc-src/Classes/Thy/document/Classes.tex	Wed Jun 17 17:07:17 2009 +0100
     2.3 @@ -23,8 +23,8 @@
     2.4  \isamarkuptrue%
     2.5  %
     2.6  \begin{isamarkuptext}%
     2.7 -Type classes were introduces by Wadler and Blott \cite{wadler89how}
     2.8 -  into the Haskell language, to allow for a reasonable implementation
     2.9 +Type classes were introduced by Wadler and Blott \cite{wadler89how}
    2.10 +  into the Haskell language to allow for a reasonable implementation
    2.11    of overloading\footnote{throughout this tutorial, we are referring
    2.12    to classical Haskell 1.0 type classes, not considering
    2.13    later additions in expressiveness}.
    2.14 @@ -61,9 +61,9 @@
    2.15  
    2.16    Indeed, type classes not only allow for simple overloading
    2.17    but form a generic calculus, an instance of order-sorted
    2.18 -  algebra \cite{Nipkow-Prehofer:1993,nipkow-sorts93,Wenzel:1997:TPHOL}.
    2.19 +  algebra \cite{nipkow-sorts93,Nipkow-Prehofer:1993,Wenzel:1997:TPHOL}.
    2.20  
    2.21 -  From a software engeneering point of view, type classes
    2.22 +  From a software engineering point of view, type classes
    2.23    roughly correspond to interfaces in object-oriented languages like Java;
    2.24    so, it is naturally desirable that type classes do not only
    2.25    provide functions (class parameters) but also state specifications
    2.26 @@ -83,7 +83,7 @@
    2.27  
    2.28    \end{quote}
    2.29  
    2.30 -  \noindent From a theoretic point of view, type classes are lightweight
    2.31 +  \noindent From a theoretical point of view, type classes are lightweight
    2.32    modules; Haskell type classes may be emulated by
    2.33    SML functors \cite{classes_modules}. 
    2.34    Isabelle/Isar offers a discipline of type classes which brings
    2.35 @@ -95,22 +95,19 @@
    2.36      \item instantiating those abstract parameters by a particular
    2.37         type
    2.38      \item in connection with a ``less ad-hoc'' approach to overloading,
    2.39 -    \item with a direct link to the Isabelle module system
    2.40 -      (aka locales \cite{kammueller-locales}).
    2.41 +    \item with a direct link to the Isabelle module system:
    2.42 +      locales \cite{kammueller-locales}.
    2.43    \end{enumerate}
    2.44  
    2.45    \noindent Isar type classes also directly support code generation
    2.46 -  in a Haskell like fashion.
    2.47 +  in a Haskell like fashion. Internally, they are mapped to more primitive 
    2.48 +  Isabelle concepts \cite{Haftmann-Wenzel:2006:classes}.
    2.49  
    2.50    This tutorial demonstrates common elements of structured specifications
    2.51    and abstract reasoning with type classes by the algebraic hierarchy of
    2.52    semigroups, monoids and groups.  Our background theory is that of
    2.53    Isabelle/HOL \cite{isa-tutorial}, for which some
    2.54 -  familiarity is assumed.
    2.55 -
    2.56 -  Here we merely present the look-and-feel for end users.
    2.57 -  Internally, those are mapped to more primitive Isabelle concepts.
    2.58 -  See \cite{Haftmann-Wenzel:2006:classes} for more detail.%
    2.59 +  familiarity is assumed.%
    2.60  \end{isamarkuptext}%
    2.61  \isamarkuptrue%
    2.62  %
    2.63 @@ -207,22 +204,22 @@
    2.64  \endisadelimquote
    2.65  %
    2.66  \begin{isamarkuptext}%
    2.67 -\noindent \hyperlink{command.instantiation}{\mbox{\isa{\isacommand{instantiation}}}} allows to define class parameters
    2.68 +\noindent \hyperlink{command.instantiation}{\mbox{\isa{\isacommand{instantiation}}}} defines class parameters
    2.69    at a particular instance using common specification tools (here,
    2.70    \hyperlink{command.definition}{\mbox{\isa{\isacommand{definition}}}}).  The concluding \hyperlink{command.instance}{\mbox{\isa{\isacommand{instance}}}}
    2.71    opens a proof that the given parameters actually conform
    2.72    to the class specification.  Note that the first proof step
    2.73    is the \hyperlink{method.default}{\mbox{\isa{default}}} method,
    2.74    which for such instance proofs maps to the \hyperlink{method.intro-classes}{\mbox{\isa{intro{\isacharunderscore}classes}}} method.
    2.75 -  This boils down an instance judgement to the relevant primitive
    2.76 -  proof goals and should conveniently always be the first method applied
    2.77 +  This reduces an instance judgement to the relevant primitive
    2.78 +  proof goals; typically it is the first method applied
    2.79    in an instantiation proof.
    2.80  
    2.81    From now on, the type-checker will consider \isa{int}
    2.82    as a \isa{semigroup} automatically, i.e.\ any general results
    2.83    are immediately available on concrete instances.
    2.84  
    2.85 -  \medskip Another instance of \isa{semigroup} are the natural numbers:%
    2.86 +  \medskip Another instance of \isa{semigroup} yields the natural numbers:%
    2.87  \end{isamarkuptext}%
    2.88  \isamarkuptrue%
    2.89  %
    2.90 @@ -264,8 +261,8 @@
    2.91  \begin{isamarkuptext}%
    2.92  \noindent Note the occurence of the name \isa{mult{\isacharunderscore}nat}
    2.93    in the primrec declaration;  by default, the local name of
    2.94 -  a class operation \isa{f} to instantiate on type constructor
    2.95 -  \isa{{\isasymkappa}} are mangled as \isa{f{\isacharunderscore}{\isasymkappa}}.  In case of uncertainty,
    2.96 +  a class operation \isa{f} to be instantiated on type constructor
    2.97 +  \isa{{\isasymkappa}} is mangled as \isa{f{\isacharunderscore}{\isasymkappa}}.  In case of uncertainty,
    2.98    these names may be inspected using the \hyperlink{command.print-context}{\mbox{\isa{\isacommand{print{\isacharunderscore}context}}}} command
    2.99    or the corresponding ProofGeneral button.%
   2.100  \end{isamarkuptext}%
   2.101 @@ -276,7 +273,7 @@
   2.102  \isamarkuptrue%
   2.103  %
   2.104  \begin{isamarkuptext}%
   2.105 -Overloaded definitions giving on class instantiation
   2.106 +Overloaded definitions given at a class instantiation
   2.107    may include recursion over the syntactic structure of types.
   2.108    As a canonical example, we model product semigroups
   2.109    using our simple algebra:%
   2.110 @@ -294,15 +291,15 @@
   2.111  \isanewline
   2.112  \isacommand{definition}\isamarkupfalse%
   2.113  \isanewline
   2.114 -\ \ mult{\isacharunderscore}prod{\isacharunderscore}def{\isacharcolon}\ {\isachardoublequoteopen}p\isactrlisub {\isadigit{1}}\ {\isasymotimes}\ p\isactrlisub {\isadigit{2}}\ {\isacharequal}\ {\isacharparenleft}fst\ p\isactrlisub {\isadigit{1}}\ {\isasymotimes}\ fst\ p\isactrlisub {\isadigit{2}}{\isacharcomma}\ snd\ p\isactrlisub {\isadigit{1}}\ {\isasymotimes}\ snd\ p\isactrlisub {\isadigit{2}}{\isacharparenright}{\isachardoublequoteclose}\isanewline
   2.115 +\ \ mult{\isacharunderscore}prod{\isacharunderscore}def{\isacharcolon}\ {\isachardoublequoteopen}p{\isadigit{1}}\ {\isasymotimes}\ p{\isadigit{2}}\ {\isacharequal}\ {\isacharparenleft}fst\ p{\isadigit{1}}\ {\isasymotimes}\ fst\ p{\isadigit{2}}{\isacharcomma}\ snd\ p{\isadigit{1}}\ {\isasymotimes}\ snd\ p{\isadigit{2}}{\isacharparenright}{\isachardoublequoteclose}\isanewline
   2.116  \isanewline
   2.117  \isacommand{instance}\isamarkupfalse%
   2.118  \ \isacommand{proof}\isamarkupfalse%
   2.119  \isanewline
   2.120  \ \ \isacommand{fix}\isamarkupfalse%
   2.121 -\ p\isactrlisub {\isadigit{1}}\ p\isactrlisub {\isadigit{2}}\ p\isactrlisub {\isadigit{3}}\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequoteopen}{\isasymalpha}{\isasymColon}semigroup\ {\isasymtimes}\ {\isasymbeta}{\isasymColon}semigroup{\isachardoublequoteclose}\isanewline
   2.122 +\ p{\isadigit{1}}\ p{\isadigit{2}}\ p{\isadigit{3}}\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequoteopen}{\isasymalpha}{\isasymColon}semigroup\ {\isasymtimes}\ {\isasymbeta}{\isasymColon}semigroup{\isachardoublequoteclose}\isanewline
   2.123  \ \ \isacommand{show}\isamarkupfalse%
   2.124 -\ {\isachardoublequoteopen}p\isactrlisub {\isadigit{1}}\ {\isasymotimes}\ p\isactrlisub {\isadigit{2}}\ {\isasymotimes}\ p\isactrlisub {\isadigit{3}}\ {\isacharequal}\ p\isactrlisub {\isadigit{1}}\ {\isasymotimes}\ {\isacharparenleft}p\isactrlisub {\isadigit{2}}\ {\isasymotimes}\ p\isactrlisub {\isadigit{3}}{\isacharparenright}{\isachardoublequoteclose}\isanewline
   2.125 +\ {\isachardoublequoteopen}p{\isadigit{1}}\ {\isasymotimes}\ p{\isadigit{2}}\ {\isasymotimes}\ p{\isadigit{3}}\ {\isacharequal}\ p{\isadigit{1}}\ {\isasymotimes}\ {\isacharparenleft}p{\isadigit{2}}\ {\isasymotimes}\ p{\isadigit{3}}{\isacharparenright}{\isachardoublequoteclose}\isanewline
   2.126  \ \ \ \ \isacommand{unfolding}\isamarkupfalse%
   2.127  \ mult{\isacharunderscore}prod{\isacharunderscore}def\ \isacommand{by}\isamarkupfalse%
   2.128  \ {\isacharparenleft}simp\ add{\isacharcolon}\ assoc{\isacharparenright}\isanewline
   2.129 @@ -319,11 +316,10 @@
   2.130  \endisadelimquote
   2.131  %
   2.132  \begin{isamarkuptext}%
   2.133 -\noindent Associativity from product semigroups is
   2.134 -  established using
   2.135 +\noindent Associativity of product semigroups is established using
   2.136    the definition of \isa{{\isacharparenleft}{\isasymotimes}{\isacharparenright}} on products and the hypothetical
   2.137    associativity of the type components;  these hypotheses
   2.138 -  are facts due to the \isa{semigroup} constraints imposed
   2.139 +  are legitimate due to the \isa{semigroup} constraints imposed
   2.140    on the type components by the \hyperlink{command.instance}{\mbox{\isa{\isacommand{instance}}}} proposition.
   2.141    Indeed, this pattern often occurs with parametric types
   2.142    and type classes.%
   2.143 @@ -338,7 +334,7 @@
   2.144  We define a subclass \isa{monoidl} (a semigroup with a left-hand neutral)
   2.145    by extending \isa{semigroup}
   2.146    with one additional parameter \isa{neutral} together
   2.147 -  with its property:%
   2.148 +  with its characteristic property:%
   2.149  \end{isamarkuptext}%
   2.150  \isamarkuptrue%
   2.151  %
   2.152 @@ -439,7 +435,7 @@
   2.153  \endisadelimquote
   2.154  %
   2.155  \begin{isamarkuptext}%
   2.156 -\noindent Fully-fledged monoids are modelled by another subclass
   2.157 +\noindent Fully-fledged monoids are modelled by another subclass,
   2.158    which does not add new parameters but tightens the specification:%
   2.159  \end{isamarkuptext}%
   2.160  \isamarkuptrue%
   2.161 @@ -562,7 +558,7 @@
   2.162  }
   2.163  \isamarkuptrue%
   2.164  %
   2.165 -\isamarkupsubsection{A look behind the scene%
   2.166 +\isamarkupsubsection{A look behind the scenes%
   2.167  }
   2.168  \isamarkuptrue%
   2.169  %
   2.170 @@ -570,7 +566,7 @@
   2.171  The example above gives an impression how Isar type classes work
   2.172    in practice.  As stated in the introduction, classes also provide
   2.173    a link to Isar's locale system.  Indeed, the logical core of a class
   2.174 -  is nothing else than a locale:%
   2.175 +  is nothing other than a locale:%
   2.176  \end{isamarkuptext}%
   2.177  \isamarkuptrue%
   2.178  %
   2.179 @@ -714,7 +710,7 @@
   2.180  \endisadelimquote
   2.181  %
   2.182  \begin{isamarkuptext}%
   2.183 -\noindent This gives you at hand the full power of the Isabelle module system;
   2.184 +\noindent This gives you the full power of the Isabelle module system;
   2.185    conclusions in locale \isa{idem} are implicitly propagated
   2.186    to class \isa{idem}.%
   2.187  \end{isamarkuptext}%
   2.188 @@ -832,7 +828,8 @@
   2.189  
   2.190    \noindent As you can see from this example, for local
   2.191    definitions you may use any specification tool
   2.192 -  which works together with locales (e.g. \cite{krauss2006}).%
   2.193 +  which works together with locales, such as Krauss's recursive function package
   2.194 +  \cite{krauss2006}.%
   2.195  \end{isamarkuptext}%
   2.196  \isamarkuptrue%
   2.197  %
   2.198 @@ -841,18 +838,18 @@
   2.199  \isamarkuptrue%
   2.200  %
   2.201  \begin{isamarkuptext}%
   2.202 -We introduced Isar classes by analogy to type classes
   2.203 +We introduced Isar classes by analogy to type classes in
   2.204    functional programming;  if we reconsider this in the
   2.205    context of what has been said about type classes and locales,
   2.206    we can drive this analogy further by stating that type
   2.207 -  classes essentially correspond to functors which have
   2.208 +  classes essentially correspond to functors that have
   2.209    a canonical interpretation as type classes.
   2.210 -  Anyway, there is also the possibility of other interpretations.
   2.211 -  For example, also \isa{list}s form a monoid with
   2.212 +  There is also the possibility of other interpretations.
   2.213 +  For example, \isa{list}s also form a monoid with
   2.214    \isa{append} and \isa{{\isacharbrackleft}{\isacharbrackright}} as operations, but it
   2.215    seems inappropriate to apply to lists
   2.216    the same operations as for genuinely algebraic types.
   2.217 -  In such a case, we simply can do a particular interpretation
   2.218 +  In such a case, we can simply make a particular interpretation
   2.219    of monoids for lists:%
   2.220  \end{isamarkuptext}%
   2.221  \isamarkuptrue%
   2.222 @@ -982,7 +979,7 @@
   2.223    to the type system, making \isa{group} an instance of
   2.224    \isa{monoid} by adding an additional edge
   2.225    to the graph of subclass relations
   2.226 -  (cf.\ \figref{fig:subclass}).
   2.227 +  (\figref{fig:subclass}).
   2.228  
   2.229    \begin{figure}[htbp]
   2.230     \begin{center}
   2.231 @@ -1015,7 +1012,7 @@
   2.232    \end{figure}
   2.233  
   2.234    For illustration, a derived definition
   2.235 -  in \isa{group} which uses \isa{pow{\isacharunderscore}nat}:%
   2.236 +  in \isa{group} using \isa{pow{\isacharunderscore}nat}%
   2.237  \end{isamarkuptext}%
   2.238  \isamarkuptrue%
   2.239  %
   2.240 @@ -1048,7 +1045,7 @@
   2.241  \isamarkuptrue%
   2.242  %
   2.243  \begin{isamarkuptext}%
   2.244 -As a convenience, class context syntax allows to refer
   2.245 +As a convenience, class context syntax allows references
   2.246    to local class operations and their global counterparts
   2.247    uniformly;  type inference resolves ambiguities.  For example:%
   2.248  \end{isamarkuptext}%
   2.249 @@ -1113,9 +1110,9 @@
   2.250    \hyperlink{command.instantiation}{\mbox{\isa{\isacommand{instantiation}}}}
   2.251    targets naturally maps to Haskell type classes.
   2.252    The code generator framework \cite{isabelle-codegen} 
   2.253 -  takes this into account.  Concerning target languages
   2.254 -  lacking type classes (e.g.~SML), type classes
   2.255 -  are implemented by explicit dictionary construction.
   2.256 +  takes this into account.  If the target language (e.g.~SML)
   2.257 +  lacks type classes, then they
   2.258 +  are implemented by an explicit dictionary construction.
   2.259    As example, let's go back to the power function:%
   2.260  \end{isamarkuptext}%
   2.261  \isamarkuptrue%
   2.262 @@ -1136,7 +1133,7 @@
   2.263  \endisadelimquote
   2.264  %
   2.265  \begin{isamarkuptext}%
   2.266 -\noindent This maps to Haskell as:%
   2.267 +\noindent This maps to Haskell as follows:%
   2.268  \end{isamarkuptext}%
   2.269  \isamarkuptrue%
   2.270  %
   2.271 @@ -1223,7 +1220,7 @@
   2.272  \endisadelimquote
   2.273  %
   2.274  \begin{isamarkuptext}%
   2.275 -\noindent The whole code in SML with explicit dictionary passing:%
   2.276 +\noindent The code in SML has explicit dictionary passing:%
   2.277  \end{isamarkuptext}%
   2.278  \isamarkuptrue%
   2.279  %
   2.280 @@ -1250,16 +1247,15 @@
   2.281  \hspace*{0pt}type 'a semigroup = {\char123}mult :~'a -> 'a -> 'a{\char125};\\
   2.282  \hspace*{0pt}fun mult (A{\char95}:'a semigroup) = {\char35}mult A{\char95};\\
   2.283  \hspace*{0pt}\\
   2.284 -\hspace*{0pt}type 'a monoidl =\\
   2.285 -\hspace*{0pt} ~{\char123}Classes{\char95}{\char95}semigroup{\char95}monoidl :~'a semigroup,~neutral :~'a{\char125};\\
   2.286 -\hspace*{0pt}fun semigroup{\char95}monoidl (A{\char95}:'a monoidl) = {\char35}Classes{\char95}{\char95}semigroup{\char95}monoidl A{\char95};\\
   2.287 +\hspace*{0pt}type 'a monoidl = {\char123}semigroup{\char95}monoidl :~'a semigroup,~neutral :~'a{\char125};\\
   2.288 +\hspace*{0pt}fun semigroup{\char95}monoidl (A{\char95}:'a monoidl) = {\char35}semigroup{\char95}monoidl A{\char95};\\
   2.289  \hspace*{0pt}fun neutral (A{\char95}:'a monoidl) = {\char35}neutral A{\char95};\\
   2.290  \hspace*{0pt}\\
   2.291 -\hspace*{0pt}type 'a monoid = {\char123}Classes{\char95}{\char95}monoidl{\char95}monoid :~'a monoidl{\char125};\\
   2.292 -\hspace*{0pt}fun monoidl{\char95}monoid (A{\char95}:'a monoid) = {\char35}Classes{\char95}{\char95}monoidl{\char95}monoid A{\char95};\\
   2.293 +\hspace*{0pt}type 'a monoid = {\char123}monoidl{\char95}monoid :~'a monoidl{\char125};\\
   2.294 +\hspace*{0pt}fun monoidl{\char95}monoid (A{\char95}:'a monoid) = {\char35}monoidl{\char95}monoid A{\char95};\\
   2.295  \hspace*{0pt}\\
   2.296 -\hspace*{0pt}type 'a group = {\char123}Classes{\char95}{\char95}monoid{\char95}group :~'a monoid,~inverse :~'a -> 'a{\char125};\\
   2.297 -\hspace*{0pt}fun monoid{\char95}group (A{\char95}:'a group) = {\char35}Classes{\char95}{\char95}monoid{\char95}group A{\char95};\\
   2.298 +\hspace*{0pt}type 'a group = {\char123}monoid{\char95}group :~'a monoid,~inverse :~'a -> 'a{\char125};\\
   2.299 +\hspace*{0pt}fun monoid{\char95}group (A{\char95}:'a group) = {\char35}monoid{\char95}group A{\char95};\\
   2.300  \hspace*{0pt}fun inverse (A{\char95}:'a group) = {\char35}inverse A{\char95};\\
   2.301  \hspace*{0pt}\\
   2.302  \hspace*{0pt}fun inverse{\char95}int i = IntInf.{\char126}~i;\\
   2.303 @@ -1271,14 +1267,12 @@
   2.304  \hspace*{0pt}val semigroup{\char95}int = {\char123}mult = mult{\char95}int{\char125}~:~IntInf.int semigroup;\\
   2.305  \hspace*{0pt}\\
   2.306  \hspace*{0pt}val monoidl{\char95}int =\\
   2.307 -\hspace*{0pt} ~{\char123}Classes{\char95}{\char95}semigroup{\char95}monoidl = semigroup{\char95}int,~neutral = neutral{\char95}int{\char125}~:\\
   2.308 +\hspace*{0pt} ~{\char123}semigroup{\char95}monoidl = semigroup{\char95}int,~neutral = neutral{\char95}int{\char125}~:\\
   2.309  \hspace*{0pt} ~IntInf.int monoidl;\\
   2.310  \hspace*{0pt}\\
   2.311 -\hspace*{0pt}val monoid{\char95}int = {\char123}Classes{\char95}{\char95}monoidl{\char95}monoid = monoidl{\char95}int{\char125}~:\\
   2.312 -\hspace*{0pt} ~IntInf.int monoid;\\
   2.313 +\hspace*{0pt}val monoid{\char95}int = {\char123}monoidl{\char95}monoid = monoidl{\char95}int{\char125}~:~IntInf.int monoid;\\
   2.314  \hspace*{0pt}\\
   2.315 -\hspace*{0pt}val group{\char95}int =\\
   2.316 -\hspace*{0pt} ~{\char123}Classes{\char95}{\char95}monoid{\char95}group = monoid{\char95}int,~inverse = inverse{\char95}int{\char125}~:\\
   2.317 +\hspace*{0pt}val group{\char95}int = {\char123}monoid{\char95}group = monoid{\char95}int,~inverse = inverse{\char95}int{\char125}~:\\
   2.318  \hspace*{0pt} ~IntInf.int group;\\
   2.319  \hspace*{0pt}\\
   2.320  \hspace*{0pt}fun pow{\char95}nat A{\char95}~Zero{\char95}nat x = neutral (monoidl{\char95}monoid A{\char95})\\
     3.1 --- a/doc-src/Classes/classes.tex	Wed Jun 17 15:41:49 2009 +0200
     3.2 +++ b/doc-src/Classes/classes.tex	Wed Jun 17 17:07:17 2009 +0100
     3.3 @@ -21,8 +21,7 @@
     3.4  \maketitle
     3.5  
     3.6  \begin{abstract}
     3.7 -  \noindent This tutorial introduces the look-and-feel of
     3.8 -  Isar type classes to the end-user.  Isar type classes
     3.9 +  \noindent This tutorial introduces Isar type classes, which 
    3.10    are a convenient mechanism for organizing specifications.
    3.11    Essentially, they combine an operational aspect (in the
    3.12    manner of Haskell) with a logical aspect, both managed uniformly.