YAP (was Re: Proposal: Remove Show and Eq superclasses of Num)
Tyson Whitehead
twhitehead at gmail.com
Wed Nov 2 22:28:39 CET 2011
On October 17, 2011 19:19:18 Paterson, Ross wrote:
> Balazs Komuves writes:
> > Rings with unity have a canonical map, actually a ring homomorphism (but
> > not necessarily injection) from the integers, namely for the natural
> > integer N, you add together the unit element with itself N times. For
> > negative N, you take the additive inverse.
> >
> > For fields, you would try to extend this to rationals; however, it seems
> > that because of the non-injectivity of the above, this won't always
> > work. Example: finite fields. In a finite field of order P, we would
> > have f(N/P) = f(N)/f(P) = f(N)/0 which is not defined.
>
> Good point. Mind you we already have this with Ratio Int and friends.
I was also wondering about the EuclidanDomain "associate" and "unit"
functions. YAP requires, for all x
x = associated x * unit x (where unit x has an multiplicative inverse)
associate (unit x) = unit (associate x) = 1
http://hackage.haskell.org/packages/archive/yap/0.1/doc/html/Data-YAP-
Algebra.html#t:EuclideanDomain
This seem very much like generalized absolute and signum functions.
The wikipedia page on Euclidean Domains, however, doesn't mention such
functions. Rather it works with the concept of a "euclidian" function which
gives a mapping onto the non-negative integers such that
euclidean (mod a b) < euclidean b whenever mod a b /= 0
http://en.wikipedia.org/wiki/Euclidean_domain#Definition
Are these two viewpoints connected? Does a Euclidian domain's euclidian
function somehow give rise to the "associate" and "unit" functions?
Thanks! -Tyson
More information about the Libraries
mailing list