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 230 forks source link

pdim is inconsistent #3356

Open AviSteiner opened 2 months ago

AviSteiner commented 2 months ago

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
mahrud commented 2 months ago

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
AviSteiner commented 2 months ago

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: @.***>

mahrud commented 2 months ago

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
kschwede commented 2 months ago

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.

mahrud commented 1 month ago

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).