Maximum and Minimum monoids
strake888 at gmail.com
Sat Dec 29 14:29:05 CET 2012
On 28/12/2012, Herbert Valerio Riedel <hvr at gnu.org> wrote:
> I just realized what confuses me about this bounded maximum/minimum
> definitions: In the math literature I've been exposed to so far (see
> also ), to satisify the definition of a maximal/minimal element of
> a set that said element has to be actually contained in that set.
> So it seems very confusing to me to call the element resulting from
> (Ord a, Bounded a) => Monoid (Max a)
> with 'Max a' isomorphic to 'a' a proper "maximum" (as it violates the
> definition for 'mempty'); on the other hand, the term "supremum"
> seems to match the semantics of the Monoid above better.
> : http://en.wikipedia.org/wiki/Maximal_element#Definition
> : http://mathworld.wolfram.com/Maximum.html
> : http://en.wikipedia.org/wiki/Supremum
Ah. Yes, thanks for the clarification, to me at least.
So it seems that our type of "maximum" and "minimum" is wrong; rather,
it ought to be this:
maximum, minimum :: (Ord a, Foldable v) => v a -> Maybe a
and (Max a) and (Min a) are not properly monoids.
We could define these:
Supr, Infi :: * -> *
instance (Ord a, Bounded a) => Monoid (Supr a)
instance (Ord a, Bounded a) => Monoid (Infi a)
but I'm not sure whether we ought to.
More information about the Libraries