Macaulay2 / M2

The primary source code repository for Macaulay2, a system for computing in commutative algebra, algebraic geometry and related fields.
https://macaulay2.com
343 stars 231 forks source link

strange behavior in kernel (identified in PushForward) #3284

Open kschwede opened 4 months ago

kschwede commented 4 months ago

I've discovered this in the PushForward package, but I believe the issue is with kernel. Notably, sometimes pushFwd gives the wrong answer and other times it has an error. This is an issue on both 1.24.05 and 1.22.

For instance, using a multi-graded setup,

Macaulay2, version 1.24.05
with packages: ConwayPolynomials, Elimination, IntegralClosure, InverseSystems,
               Isomorphism, LLLBases, MinimalPrimes, OnlineLookup,
               PrimaryDecomposition, ReesAlgebra, Saturation, TangentCone,
               Truncations, Varieties
loadPackage("PushForward", DebuggingMode=>true);

i1 :
i2 : R = QQ[x,y, Degrees=>{{1,0},{0,1}}]/ideal(x^3-2, y^2+y+1);

i3 : psi = map(R, QQ[]);

o3 : RingMap R <-- QQ[]                                                         

i4 : pushFwd(psi)
/usr/share/Macaulay2/PushForward.m2:193:10:(3):[4]: error: not implemented yet:$
/usr/share/Macaulay2/PushForward.m2:193:10:(3):[4]: --entering debugger (type h$
/usr/share/Macaulay2/PushForward.m2:193:9-193:16: --source code:                
     ke:=kernel mp;

In a singly graded setup, I get the right answer.

Macaulay2, version 1.24.05
with packages: ConwayPolynomials, Elimination, IntegralClosure, InverseSystems,
               Isomorphism, LLLBases, MinimalPrimes, OnlineLookup,
               PrimaryDecomposition, ReesAlgebra, Saturation, TangentCone,
               Truncations, Varieties

i1 : loadPackage("PushForward", DebuggingMode=>true);

i2 : S = QQ[x,y]/ideal(x^3-2, y^2+y+1);

i3 : psi = map(S, QQ[]);

o3 : RingMap S <-- QQ[]                                                         

i4 : pushFwd(psi)

            6
o4 = ((QQ[]) , | 1 x x2 x2y xy y |,
     --------------------------------------------------------------------------
     FunctionClosure[/usr/share/Macaulay2/PushForward.m2:101:17-101:31])

o4 : Sequence

What's worse though, in the multi-graded setup, sometimes I get no error but instead the wrong answer if the source is QQ (instead of QQ[]). In the singly graded setup I don't have this issue.

Macaulay2, version 1.24.05
with packages: ConwayPolynomials, Elimination, IntegralClosure, InverseSystems,
               Isomorphism, LLLBases, MinimalPrimes, OnlineLookup,
               PrimaryDecomposition, ReesAlgebra, Saturation, TangentCone,
               Truncations, Varieties

i1 : loadPackage("PushForward", DebuggingMode=>true);

i2 : R = QQ[x]/ideal(x^3-2);

i3 : S = R[y]/ideal(y^2+y+1);

i4 : U = (flattenRing S)#0;

i5 : pushFwd(map(U, QQ))

o5 = (cokernel | 0 0 0 0 |, | 1 y yx yx2 x x2 |,
               | 0 0 0 0 |
               | 1 0 0 0 |
               | 0 1 0 0 |
               | 0 0 1 0 |
               | 0 0 0 1 |
     --------------------------------------------------------------------------
     FunctionClosure[/usr/share/Macaulay2/PushForward.m2:101:17-101:31])

o5 : Sequence

i6 : degrees U

o6 = {{1, 0}, {0, 1}}

o6 : List

i7 : describe U

           QQ[y, x]
o7 = --------------------                                                       
       3       2
     (x  - 2, y  + y + 1)

You can see in the above I am getting the wrong module out of pushFwd

mahrud commented 4 months ago

I wonder if this is related to https://github.com/Macaulay2/M2/issues/3165#issue-2206886314, since kernel also calls the pushForward from Core.

Is there a homogeneous version of this issue you've observed, or does it happen only in the inhomogeneous case?

cc: @Devlin-Mallory

kschwede commented 4 months ago

I had a conversation with Claudiu Raicu about especially the third example.

He provided the following minimal code showing the kernel giving an incorrect answer that didn't need pushFwd.

i2 :  R = QQ[x]/ideal(x^3-2);

i3 :       S = R[y]/ideal(y^2+y+1);

i4 :       U = (flattenRing S)#0;

i5 :       A = QQ;

i6 :       f = map(U, A)

o6 = map (U, QQ, {})

o6 : RingMap U <-- QQ                                                            

i7 :       g = map(U^1,A^6,f,matrix{{1,y,y*x,y*x^2,x,x^2}})

o7 = | 1 y yx yx2 x x2 |

             1       6
o7 : Matrix U  <-- QQ                                                            

i8 :       ker g

o8 = image | 0 0 0 0 |
           | 0 0 0 0 |
           | 1 0 0 0 |
           | 0 1 0 0 |
           | 0 0 1 0 |
           | 0 0 0 1 |

                               6
o8 : QQ-module, submodule of QQ
pzinn commented 4 months ago

could it be related to #2004 ?