M2
M2 copied to clipboard
isPrime in ZZ/n
isPrime doesn't work for ideals in ZZ/n, and we get different errors depending on whether n is prime or not:
i1 : isPrime ideal 0_(ZZ/2)
stdio:1:7:(3): error: no method found for applying presentation to:
argument : ZZ (of class Ring)
i2 : isPrime ideal 0_(ZZ/4)
stdio:2:7:(3): error: no applicable strategy for (minimalPrimes,Ideal)
Related: Should we check that a ring is an integral domain before creating a fraction field? We'll likely get an error eventually, but it might be good to check up front:
i1 : R = ZZ/4
o1 = R
o1 : QuotientRing
i2 : 1/2_R
-1
o2 = --
2
o2 : frac R
i3 : oo^2
stdio:3:2:(3): error: a non unit was found in a ring declared to be a field
It is already mentioned that the ring should be an integral domain in the "Caveat" section in the documentation for frac, so maybe that's enough to avoid the extra overhead of checking? Maybe we should have an isWellDefined(FractionField) that checks this?