M2 icon indicating copy to clipboard operation
M2 copied to clipboard

bug in (quotient, Module, Ideal)

Open eisenbud opened this issue 3 years ago • 2 comments
trafficstars

The following code produces an error because the ambient free module of M has a Schreyer order, whereas the ambient free module of 0*M does not (the free modules mentioned in the error message are the same except for this.)

S = ZZ/101[x]
I = ideal "x2"
R=S/I
F = res coker vars R
M = image F.dd_2
(0*M):(ideal gens R)
stdio:6:6:(3): error: expected matrices with the same target

eisenbud avatar Jan 18 '22 19:01 eisenbud

Yes, @jchen419 and I traced this to using =!= instead of != for checking equality of modules in remainder(Matrix,Matrix). I made an issue in https://github.com/Macaulay2/M2/issues/1726 with a list of all uses of =!= but didn't hear back about whether there's a reason =!= has been used in so many places instead of !=.

mahrud avatar Jan 18 '22 20:01 mahrud

It's probably fine to change those occurrences of =!=. Perhaps simultaneously review the method for Module == Module for speed -- if the two modules have identical generators and relations, it seems that it could return true more quickly.

DanGrayson avatar Jan 18 '22 22:01 DanGrayson

Actually, I don't think my comment above is the root of this problem anymore:

i1 : R = kk[x]/x^2;

i2 : C = res ideal gens R

      1      1      1
o2 = R  <-- R  <-- R
                    
     0      1      2

o2 : ChainComplex

i8 : target C.dd_2

      1
o8 = R

o8 : R-module, free, degrees {1}

i3 : target C.dd_2 == R^{-1}

o3 = true

i4 : target C.dd_2 === R^{-1}

o4 = false

Shouldn't free modules with the same degree be essentially unique?! It seems like the raw module coming from the engine is different:

i6 : raw target C.dd_2

o6 = free(rank 1 degrees = {T}x.0)

o6 : RawFreeModule

i7 : raw R^{-1}

o7 = free(rank 1 degrees = {T})

o7 : RawFreeModule

@mikestillman do you know what {T}x.0 means?

mahrud avatar Jan 07 '23 02:01 mahrud