Skip to content

Commit

Permalink
Fix 2 bugs in Complexes: specialized routine for null homotopy with f…
Browse files Browse the repository at this point in the history
…ree source was incorrect. freeResolution(Strategy => Syzygies) incorrectly handled resolutions of length 0. Tests and doc were updated for these.
  • Loading branch information
mikestillman committed Aug 26, 2024
1 parent 87975bc commit 1d99126
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 26 deletions.
7 changes: 4 additions & 3 deletions M2/Macaulay2/packages/Complexes/ChainComplexMap.m2
Original file line number Diff line number Diff line change
Expand Up @@ -1141,8 +1141,10 @@ isNullHomotopic ComplexMap := Boolean => f -> (
nullHomotopy ComplexMap := ComplexMap => f -> (
-- we check that the source is free, as that can be much faster
-- TODO: nullHomotopy should perhaps be hook-ified.
result := if isFree source f then nullHomotopyFreeSource f;
if result =!= null then return result;
-- The following code might require that the source is free
-- and the target is exact?
--result := if isFree source f then nullHomotopyFreeSource f;
--if result =!= null then return result;
g := homomorphism' f;
H := target g;
d := degree f;
Expand Down Expand Up @@ -1332,7 +1334,6 @@ connectingMap(ComplexMap, ComplexMap) := ComplexMap => opts -> (g, f) -> (
assert isWellDefined p;
assert isWellDefined q;
);
<< "we are returning the negative of previous result" << endl;
- HH(q) * (HH(p))^-1 -- sign is negative because of the def of cylinder.
)

Expand Down
4 changes: 0 additions & 4 deletions M2/Macaulay2/packages/Complexes/ChainComplexMapDoc.m2
Original file line number Diff line number Diff line change
Expand Up @@ -3408,10 +3408,6 @@ doc ///
assert isWellDefined h'
assert(degree h' === degree g + 1)
assert not isNullHomotopyOf(h', g)
Text
For developers: when the source of $f$ is a free complex,
a procedure, that is often faster, is attempted. In the
general case this method uses the Hom complex.
Caveat
The output is only a null homotopy when one exists.
SeeAlso
Expand Down
36 changes: 20 additions & 16 deletions M2/Macaulay2/packages/Complexes/ChainComplexTests.m2
Original file line number Diff line number Diff line change
Expand Up @@ -1344,31 +1344,34 @@ TEST ///
g1 = randomComplexMap(CJ, CI, Cycle=>true)
g2 = randomComplexMap(CK, CJ, Cycle=>true)
assert isWellDefined g1
assert isCommutative g1
assert isComplexMorphism g1
assert isWellDefined g2
assert isCommutative g2
assert isComplexMorphism g2
fCI = resolutionMap CI
fCJ = resolutionMap CJ
fCK = resolutionMap CK
g = g2 * g1;
assert isWellDefined g
assert isCommutative g
assert isComplexMorphism g
g1' = liftMapAlongQuasiIsomorphism(g1 * fCI, fCJ);
g2' = liftMapAlongQuasiIsomorphism(g2 * fCJ, fCK);
assert isWellDefined g1'
assert isCommutative g1'
assert isComplexMorphism g1'
assert isWellDefined g2'
assert isCommutative g2'
assert isComplexMorphism g2'
g' = liftMapAlongQuasiIsomorphism(g * fCI, fCK);
assert isWellDefined g'
assert isComplexMorphism g'
diffg' = g2' * g1' - g';
assert isNullHomotopic diffg'
h = nullHomotopy diffg';
h = nullHomotopy diffg'
assert isWellDefined h
assert isNullHomotopyOf(h, diffg')
assert(degree h == 1)
debugLevel = 1
assert isNullHomotopyOf(h, diffg') -- MES FAILURE #38
diffg'_-1 -- just to see the nontrivial-ness of the differentials
///


TEST ///
-*
restart
Expand Down Expand Up @@ -2256,10 +2259,12 @@ TEST ///
assert isWellDefined(3*id_C)

C = koszulComplex{1_RR,3,5}
assert isWellDefined(3*id_C) -- FAILS
assert isWellDefined C
--assert isWellDefined(3*id_C) -- FAILS: TODO: get isCommutative RR_53, etc to work

C = koszulComplex{1_(RR_100),3,5}
assert isWellDefined(3*id_C) -- FAILS
assert isWellDefined C
-- assert isWellDefined(3*id_C) -- FAILS

S = ZZ/11
C = koszulComplex{1_S,3,5}
Expand All @@ -2278,10 +2283,10 @@ TEST ///
use T
alpha = map(E, D, {a,b,c})
beta = map(E, D, {d,e,f})
isWellDefined alpha
isWellDefined beta
phi = complex alpha
psi = complex beta
assert isWellDefined alpha
assert isWellDefined beta
phi = complex chainComplex alpha
psi = complex chainComplex beta
prune HH phi
prune HH psi
isNullHomotopic phi
Expand Down Expand Up @@ -2350,8 +2355,7 @@ TEST ///
assert isShortExactSequence(g',f')
LES' = longExactSequence(Hom(f', S^1), Hom(g', S^1));
assert(HH LES' == 0)
assert all(3, i -> dd^LES'_(3*(i+1)) == delta_(i+1))
assert all(3, i -> dd^LES'_(-3*(i+1)) == delta_(-i-1))
assert all(-6..6, i -> dd^LES'_(3*(i+1)) == delta_i)

F = freeResolution(S^1/I, LengthLimit => 5)
g' = Hom(F, g)
Expand Down
6 changes: 5 additions & 1 deletion M2/Macaulay2/packages/Complexes/FreeResolutionTests.m2
Original file line number Diff line number Diff line change
Expand Up @@ -890,6 +890,10 @@ needsPackage "Complexes"
TEST ///
R = QQ[x, Degrees => {{}}]
M = image x
F = freeResolution M -- gives: "error: map with index 0 has inconsistent source"
F = freeResolution M
assert(isWellDefined F)
epsilon = augmentationMap F
assert isWellDefined epsilon
assert(M === (target epsilon)_0)
///

4 changes: 2 additions & 2 deletions M2/Macaulay2/packages/Complexes/FreeResolutions.m2
Original file line number Diff line number Diff line change
Expand Up @@ -454,12 +454,12 @@ resolutionBySyzygies = (opts, M) -> (

RO.complex = (lengthlimit) -> (
syzmats := toList RO.SyzygyList;
C := if numcols first syzmats === 0 then complex M
C := if numcols first syzmats === 0 then complex target first syzmats
else (
if numcols last syzmats === 0 then syzmats = drop(syzmats, -1);
complex syzmats
);
C.cache.augmentationMap = map(complex M, C, i -> map(M, target presentation M, 1));
C.cache.augmentationMap = map(complex M, C, i -> map(M, C_0, 1));
C);

RO.compute(opts.LengthLimit, opts.DegreeLimit);
Expand Down

0 comments on commit 1d99126

Please sign in to comment.