M2 icon indicating copy to clipboard operation
M2 copied to clipboard

pdim is inconsistent

Open AviSteiner opened this issue 1 year ago • 5 comments

In the following example, I give two generating sets for the same module, and pdim gives a different answer for each.

i1 : R = QQ[x,y];
A = matrix {{-2*y+1, x^2+y^2-y, 2*x*y-x}, {2*x, 0, 2*y^2-2*y}};
B = matrix {{2*x*y-x, 4*x^2-1}, {2*y^2-2*y, 4*x*y-2*x}};

             2       3
o2 : Matrix R  <--- R

             2       2
o3 : Matrix R  <--- R

i4 : imA = image A

o4 = image | -2y+1 x2+y2-y 2xy-x  |
           | 2x    0       2y2-2y |

                             2
o4 : R-module, submodule of R

i5 : imB = image B

o5 = image | 2xy-x  4x2-1  |
           | 2y2-2y 4xy-2x |

                             2
o5 : R-module, submodule of R

i6 : imA == imB

o6 = true

i7 : pdim imA

o7 = 1

i8 : pdim imB

o8 = 0

AviSteiner avatar Jul 10 '24 22:07 AviSteiner

The modules are not homogeneous. Try over a local ring and the answer is the same:

i2 : needsPackage "LocalRings"
 -- warning: symbol "LocalRing" in User#"private dictionary" is shadowed by a symbol in LocalRings.Dictionary
 --   use the synonym LocalRing$0

o2 = LocalRings

o2 : Package

i3 : Rp = localRing(QQ[x,y], ideal(x,y))

o3 = Rp

o3 : LocalRing, maximal ideal (x, y)

i4 : A = matrix {{-2*y+1, x^2+y^2-y, 2*x*y-x}, {2*x, 0, 2*y^2-2*y}};

              2       3
o4 : Matrix Rp  <-- Rp

i5 : B = matrix {{2*x*y-x, 4*x^2-1}, {2*y^2-2*y, 4*x*y-2*x}};

              2       2
o5 : Matrix Rp  <-- Rp

i6 : M = image A

o6 = image | -2y+1 x2+y2-y 2xy-x  |
           | 2x    0       2y2-2y |

                               2
o6 : Rp-module, submodule of Rp

i7 : N = image B

o7 = image | 2xy-x  4x2-1  |
           | 2y2-2y 4xy-2x |

                               2
o7 : Rp-module, submodule of Rp

i8 : M == N

o8 = true

i9 : pdim M

o9 = 0

i10 : pdim N

o10 = 0

mahrud avatar Jul 11 '24 16:07 mahrud

I still feel that there should be some indication that in nonhomogeneous cases pdim can give the wrong answer. Maybe a warning or something.

On Thu, Jul 11, 2024 at 6:27 PM Mahrud Sayrafi @.***> wrote:

The modules are not homogeneous. Try over a local ring and the answer is the same:

i2 : needsPackage "LocalRings" -- warning: symbol "LocalRing" in User#"private dictionary" is shadowed by a symbol in LocalRings.Dictionary -- use the synonym LocalRing$0

o2 = LocalRings

o2 : Package

i3 : Rp = localRing(QQ[x,y], ideal(x,y))

o3 = Rp

o3 : LocalRing, maximal ideal (x, y)

i4 : A = matrix {{-2y+1, x^2+y^2-y, 2xy-x}, {2x, 0, 2y^2-2y}};

          2       3

o4 : Matrix Rp <-- Rp

i5 : B = matrix {{2xy-x, 4x^2-1}, {2y^2-2y, 4xy-2x}};

          2       2

o5 : Matrix Rp <-- Rp

i6 : M = image A

o6 = image | -2y+1 x2+y2-y 2xy-x | | 2x 0 2y2-2y |

                           2

o6 : Rp-module, submodule of Rp

i7 : N = image B

o7 = image | 2xy-x 4x2-1 | | 2y2-2y 4xy-2x |

                           2

o7 : Rp-module, submodule of Rp

i8 : M == N

o8 = true

i9 : pdim M

o9 = 0

i10 : pdim N

o10 = 0

— Reply to this email directly, view it on GitHub https://github.com/Macaulay2/M2/issues/3356#issuecomment-2223371177, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKJWCLUVEBPLUKU2D7KLH5TZL2W6BAVCNFSM6AAAAABKVYR2VWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMRTGM3TCMJXG4 . You are receiving this because you authored the thread.Message ID: @.***>

AviSteiner avatar Jul 11 '24 18:07 AviSteiner

I don't necessarily disagree, though I wonder if the definition of "projective dimension" should be clarified first. For instance, if the answer given is the projective dimension of the homogenization (which seems to match at least in this example) then perhaps there's some value? Otherwise probably an error is appropriate.

i1 : R = QQ[x,y,h];

i2 : A = matrix {{-2*y+1, x^2+y^2-y, 2*x*y-x}, {2*x, 0, 2*y^2-2*y}};

             2      3
o2 : Matrix R  <-- R

i3 : B = matrix {{2*x*y-x, 4*x^2-1}, {2*y^2-2*y, 4*x*y-2*x}};

             2      2
o3 : Matrix R  <-- R

i4 : M = image homogenize(A, h)

o4 = image | -2y+h x2+y2-yh 2xy-xh  |
           | 2x    0        2y2-2yh |

                             2
o4 : R-module, submodule of R

i6 : N = image homogenize(B, h)

o6 = image | 2xy-xh  4x2-h2  |
           | 2y2-2yh 4xy-2xh |

                             2
o6 : R-module, submodule of R

i7 : pdim M

o7 = 1

i8 : pdim N

o8 = 0

i9 : prune N

      2
o9 = R

o9 : R-module, free, degrees {2:2}

i10 : prune M

o10 = cokernel {1} | y2-yh |
               {2} | 2y-h  |
               {2} | -x    |

                             3
o10 : R-module, quotient of R

mahrud avatar Jul 12 '24 07:07 mahrud

Hi all,

The projDim function in FastMinors is supposed to do a better job with this (although only probabilistically for big examples since it looks at certain ideals of minors).

However, the projDim function doesn't work on imB right now due to a silly bug I just discovered.

A fixed version is in my fork. https://github.com/kschwede/M2/blob/master/M2/Macaulay2/packages/FastMinors.m2 and I'll try to do a pull request in the coming days.

kschwede avatar Jul 12 '24 22:07 kschwede

Karl, what are your thoughts about changing pdim to accept strategies via hooks, then add projDim as a hook added when FastMinors is loaded for inhomogeneous cases? One difficulty might be that projDim has many options itself, but maybe the defaults are decent enough?

I can make a PR if this seems reasonable to you. (One "downside" is that in the documentation for projDim, the result of pdim will become correct, but it can be easily modified to point out that it is using projDim).

mahrud avatar Aug 10 '24 12:08 mahrud