Hi all, > So, a coercion from QQ to ZZ would presumably be a morphism from QQ to > ZZ in the category of unital rings - which doesn't exist.
Agreed. > So, I think it is by far better to have a consistent notion than to > have to *guess* whether a user really means the integer 2 if s/he > write 4/2 (which in the first place is a rational, not an integer). > Bugs that are result of guesswork are the most ugly, IMHO. True. But in the case of Q (and more generally in the case of the quotient field of a (principal?) ring), we can be consistent with the ring of integers, without any guess-work. (*) This is a white lie (see below). Every rational number has a unique(*) form Product(p^(a_p), p prime) for some integer powers a_p. The rational is an integer iff all a_p are non-negative. In that case, gcd(Product(p^(a_p)), Product(p^(b_p))) = Product(p^(min(a_p,b_p))) and lcm is defined with max(a_p,b_p). But actually this definition does not rely at all on the fact that the a_p and b_p are positive. So we have a definition of the gcd and lcm for free on the quotient field of any (principal?) ring. Then, gcd(x,y).lcm(x,y)=x.y; the notion reduces to the one for integers, etc. This definition amounts to the definition of lcm(x,y) as the smallest integer multiple of x which is also an integer multiple of y. (*) In fact, there is the issue of the sign, or more generally units (elements that are invertible in the ring (here, ZZ) ). For this, there has to be some arbitrariness on the sign of gcd and lcm of negative numbers. Note that for RDF and its colleagues, this does not apply (since they are not the quotient field of any sensible ring), and we should stick with the definition gcd(x,y)=1, however much x and y look like integers. Regards, Bruno -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org