M2 icon indicating copy to clipboard operation
M2 copied to clipboard

isPrime in ZZ/n

Open d-torrance opened this issue 1 year ago • 0 comments

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?

d-torrance avatar Oct 02 '24 14:10 d-torrance