Skip to content

Commit 0fc397b

Browse files
authored
Update algorithm for "poincare Module" (Macaulay2#4099)
* Update algorithm for "poincare Module" * Revised update to poincare Module * Update algorithm for "poincare Module" * Tests for updated "poincare Module" * Updated algorithm for "poincare Module", avoiding an infinite loop revealed by the previous test
1 parent 039c52b commit 0fc397b

File tree

2 files changed

+31
-1
lines changed

2 files changed

+31
-1
lines changed

M2/Macaulay2/m2/hilbert.m2

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,21 @@ poincare Module := M -> (
8484
if (P := computation M) =!= null then return P;
8585
error("no applicable strategy for computing poincare over ", toString ring M))
8686

87+
-- Use that the Poincare polynomial of a subquotient module M is the difference of the Poincare polynomials of two quotients.
88+
-- This avoids having to find a presentation of M (unless that has already been done).
8789
addHook((poincare, Module), Strategy => Default, M -> (
88-
new degreesRing ring M from rawHilbert raw leadTerm gb presentation M))
90+
hf := if any(select(keys M.cache, Option), o -> o#0 === symbol minimalPresentation) then
91+
rawHilbert raw leadTerm gb relations minimalPresentation M
92+
-- We cannot just call "poincare minimalPresentation M", because there are cases (such as M free)
93+
-- where both M and minimalPresentation M are cached as having a minimal presentation;
94+
-- so that would lead to an infinite loop.
95+
else if not M.?generators then
96+
rawHilbert raw leadTerm gb relations M
97+
else if M.cache.?presentation then
98+
rawHilbert raw leadTerm gb M.cache.presentation
99+
else (rawHilbert raw leadTerm gb relations M) - (rawHilbert raw leadTerm gb M);
100+
new degreesRing ring M from hf
101+
))
89102

90103
-- manually installs the numerator of the reduced Hilbert series for the module
91104
storefuns#poincare = method()
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
R = QQ[x,y,z]
2+
M1 = module(ideal(x,y,z))
3+
hf = poincare M1
4+
T = (ring hf)_0
5+
assert(hf == poly"3T-3T2+T3")
6+
assert(hf == poincare res M1)
7+
8+
M2 = minimalPresentation M1
9+
assert(hf == poincare M1)
10+
assert(hf == poincare M2)
11+
12+
R2 = ZZ/101[x0,x1,x2,Degrees=>{1,3,5}]
13+
M3 = module(ideal(x0,x1))
14+
pres3 = presentation M3
15+
hf3 = poincare M3
16+
U = (ring hf3)_0
17+
assert(hf3 == poly"U+U3-U4")

0 commit comments

Comments
 (0)