Coercion between quotients of $\mathbb{Z}$
Hello,
It is said here that "in general there is no coercion between two different finite fields". When testing equality between elements of $\mathbb{Z}/(n)$ and $\mathbb{Z}/(m)$, why is there coercion to $\mathbb{Z}/(\gcd(m,n))$ only if $\gcd(m,n) \neq 1$ ?
zz3, zz5, zz6, zz10 = (ZZ.quotient(n) for n in [3,5,6,10])
zz6(0) == zz10(0) # True
zz3(0) == zz5(0) # False
I understand that testing equality in the null ring is not "useful", but why is it so inhomogeneous ? If some automated procedure depends on that feature, it would surely need to consider zz3(0) == zz5(0)
to be true.
I agree that this design decision looks rather ill-conceived, If coercion between $\mathbb{Z}/(n)$ and $\mathbb{Z}/(m)$ should be defined at all, I'd say it should only be if one of $n,m$ divides the other. If you start allowing constructions of pushouts, it follows naturally the null ring should also be allowed.
One reason to disallow it is that it helps catching errors. However, by that argument one should probably not allow coercion between different quotients at all.
Automatic coercion to quotients is the most important source of nontransitivity of equality in sage, so that's another reason to limit it.