Skip to content

Add minimalPrimes strategy for ideals in ZZ and ZZ/n#4249

Merged
d-torrance merged 5 commits intoMacaulay2:developmentfrom
d-torrance:is-prime
May 7, 2026
Merged

Add minimalPrimes strategy for ideals in ZZ and ZZ/n#4249
d-torrance merged 5 commits intoMacaulay2:developmentfrom
d-torrance:is-prime

Conversation

@d-torrance
Copy link
Copy Markdown
Member

This closes #3505:

i1 : isPrime ideal 0_(ZZ/2)

o1 = true

i2 : isPrime ideal 0_(ZZ/4)

o2 = false

We also add a few related updates I encountered along the way:

  • We add module(RingFamily) so module RR and module CC work.
  • We add presentation(Ring) (and presentation(RingFamily) so presentation ZZ works. It calls presentation(Module), so the result gets cached.
  • We add RingElement^Ring as syntactic sugar for lift (matching Number^Ring)
  • We can now find the characterisic of tower rings over ZZ.

Comment thread M2/Macaulay2/m2/quotring.m2 Outdated

presentation PolynomialRing := Matrix => R -> map(R^1, R^0, 0)
presentation Ring :=
presentation RingFamily := Matrix => presentation @@ module
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ is unnecessarily opaque, as it makes it hard to see the code.
Also, I'm worried about someone defining some other type of non-polynomial ring, forgetting to define presentation for it, and because of this line always getting that the presentation of their ring is trivial.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, this seems to be a problem with at least SheafOfRings:

i40 : (showStructure())#Thing#HashTable#MutableHashTable#Type#Ring

o40 = EngineRing : FractionField
                   FreeAlgebra
                   GaloisField
                   InexactField : ComplexField
                                  RealField
                   LocalRing
                   PolynomialRing
                   QuotientRing : FreeAlgebraQuotient
                   SchurRing
      NCRing : NCPolynomialRing
               NCQuotientRing
      SheafOfRings

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. I've updated it so that (presentation, Ring) first looks for the presence of a presentation key in the ring object (which is only installed for ZZ and QQ and w/o using @@), runs it if it's there, and raises an error otherwise:

i1 : presentation ZZ

o1 = 0

              1
o1 : Matrix ZZ  <-- 0

i2 : presentation QQ

o2 = 0

              1
o2 : Matrix QQ  <-- 0

i3 : presentation new Ring
stdio:3:12:(3):[1]: error: presentation for this ring not implemented yet

d-torrance added 4 commits May 3, 2026 07:18
Generalize it for all rings (not just polynomial rings) and ring
families, so "presentation ZZ" and "presentation RR" work.

Also call (presentation, Module) so caching happens out of the box and
update (presentation, QuotientRing) so that it caches in the cache
table like the other presentation methods.
Also drop Constant ^ RingFamily; redundant since Constant is a
subclass of Number.
@d-torrance
Copy link
Copy Markdown
Member Author

Discussed with Anton and Mike

@d-torrance d-torrance merged commit 5b73fdb into Macaulay2:development May 7, 2026
11 of 17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants