M2 icon indicating copy to clipboard operation
M2 copied to clipboard

Bug in pruning map over ZZ with torsion

Open mahrud opened this issue 3 years ago • 1 comments

Still haven't looked into the root cause, but I think this is a bug:

N = prune coker matrix{{2, -1}, {-1, 2}, {-1, -1}}
-- cokernel | 3 |
--          | 0 |
f = inverse N.cache.pruningMap
-- | 1 2 0 |
-- | 1 1 1 |
g = map(target f, source f, matrix f)
-- | 1 -1 0 |
-- | 1 1  1 |
f == g -- false

The matrices are not the same over the integers, but as morphisms of Z-modules they are identical. In particular, I think one would expect f == map(target f, source f, matrix f) to always be true.

The closest I got to directly defining such matrices is something like this, which returns a non-sense error:

i1 : debug Core;

i2 : R = ZZ/3;

i3 : m = map(R, raw matrix{{2}})

o3 = | 2 |

             1       1
o3 : Matrix R  <--- R

i4 : n = matrix(R, {{2}})

o4 = | -1 |

             1       1
o4 : Matrix R  <--- R

i5 : m == n
stdio:5:3:(3): error: expected same ring

i6 : ring m === ring n

o6 = true

mahrud avatar Aug 15 '22 18:08 mahrud

This is a bug. Perhaps inverse is not reducing the matrix it finds modulo the relations in the target.

DanGrayson avatar Aug 18 '22 11:08 DanGrayson