equal
deleted
inserted
replaced
159 Depending on an arbitrary type @{text "\<alpha>"}, class @{text |
159 Depending on an arbitrary type @{text "\<alpha>"}, class @{text |
160 "semigroup"} introduces a binary operation @{text "\<circ>"} that is |
160 "semigroup"} introduces a binary operation @{text "\<circ>"} that is |
161 assumed to be associative: |
161 assumed to be associative: |
162 *} |
162 *} |
163 |
163 |
164 class semigroup = |
164 class semigroup = type + |
165 fixes mult :: "\<alpha> \<Rightarrow> \<alpha> \<Rightarrow> \<alpha>" (infixl "\<^loc>\<otimes>" 70) |
165 fixes mult :: "\<alpha> \<Rightarrow> \<alpha> \<Rightarrow> \<alpha>" (infixl "\<^loc>\<otimes>" 70) |
166 assumes assoc: "(x \<^loc>\<otimes> y) \<^loc>\<otimes> z = x \<^loc>\<otimes> (y \<^loc>\<otimes> z)" |
166 assumes assoc: "(x \<^loc>\<otimes> y) \<^loc>\<otimes> z = x \<^loc>\<otimes> (y \<^loc>\<otimes> z)" |
167 |
167 |
168 text {* |
168 text {* |
169 \noindent This @{text "\<CLASS>"} specification consists of two |
169 \noindent This @{text "\<CLASS>"} specification consists of two |
331 in practice. As stated in the introduction, classes also provide |
331 in practice. As stated in the introduction, classes also provide |
332 a link to Isar's locale system. Indeed, the logical core of a class |
332 a link to Isar's locale system. Indeed, the logical core of a class |
333 is nothing else than a locale: |
333 is nothing else than a locale: |
334 *} |
334 *} |
335 |
335 |
336 class idem = |
336 class idem = type + |
337 fixes f :: "\<alpha> \<Rightarrow> \<alpha>" |
337 fixes f :: "\<alpha> \<Rightarrow> \<alpha>" |
338 assumes idem: "f (f x) = f x" |
338 assumes idem: "f (f x) = f x" |
339 |
339 |
340 text {* |
340 text {* |
341 \noindent essentially introduces the locale |
341 \noindent essentially introduces the locale |