Skip to content

Commit

Permalink
fixed nullHomotopy by adding a new optional argument FreeToExact, and…
Browse files Browse the repository at this point in the history
… changed calls in AInfinity to use this simpler algorithm. Also added in doc for associatedGradedRing
  • Loading branch information
mikestillman committed Sep 5, 2024
1 parent 1d99126 commit 325328b
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 54 deletions.
8 changes: 4 additions & 4 deletions M2/Macaulay2/packages/AInfinity.m2
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ d1d1 := hashTable for i from min B to max B2 -2 list

D := map(labeledTensorComplex{A0,B},B2,d1d1, Degree => -2);
assert (isComplexMap D);
m0 := nullHomotopy D;
m0 := nullHomotopy(D, FreeToExact => true);
for i from 4 to limit do(
(C,K) := componentsAndIndices B2_i;
for k in K do (
Expand Down Expand Up @@ -212,7 +212,7 @@ for i from lo+1 to hi list
(A0**G).dd_(i-2)*D_i - D_(i-1)*BG.dd_i
);

m0 := nullHomotopy D;
m0 := nullHomotopy(D, FreeToExact => true);
for i from 2 to min(limit, 1+(concentration G)_1) do( --was just 1+(concentration G)_1
(C,K) := componentsAndIndices BG_i;
for k in K do (
Expand Down Expand Up @@ -386,7 +386,7 @@ p = new MutableHashTable from
for i from 2 to length G list i=>(presentation R ** G_(i-2))*(BG_i)^[{2,i-2}]
p#2
p#3
nullHomotopy map(G[-2],BG,p)
nullHomotopy(map(G[-2],BG,p), FreeToExact => true)
G[-2]
BG

Expand Down Expand Up @@ -646,7 +646,7 @@ if n >= 2 then (
d1d1 := hashTable for i from min B to max B list
i+2 => (d1**id_(B_i))*(B2_(i+2))^[{2,i}] - (id_(B_i)**d1)*(B2_(i+2))^[{i,2}];
D := map(A0**B,B2,d1d1, Degree => -2);
m0 := nullHomotopy D;
m0 := nullHomotopy(D, FreeToExact => true);

tlist := flatten for i from 4 to 1+(concentration B)_1 list(
(C,K) := componentsAndIndices B2_i;
Expand Down
1 change: 1 addition & 0 deletions M2/Macaulay2/packages/Complexes.m2
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ export {
"yonedaMap'",
"yonedaProduct",
-- Option names
"FreeToExact", -- used in nullHomotopy
"OverField",
"OverZZ",
"Homogenization",
Expand Down
39 changes: 16 additions & 23 deletions M2/Macaulay2/packages/Complexes/ChainComplexMap.m2
Original file line number Diff line number Diff line change
Expand Up @@ -1068,9 +1068,6 @@ coimage ComplexMap := Complex => f -> (
-- homotopy --------------------------------------------------------
--------------------------------------------------------------------
isNullHomotopyOf = method()
isNullHomotopic = method()
nullHomotopy = method() -- this function attempts to construct one, might fail

isNullHomotopyOf(ComplexMap, ComplexMap) := (h, f) -> (
-- returns true if h is a null homotopy for f : C --> D.
-- if debugLevel > 0, then more info as to where it is not, is given
Expand Down Expand Up @@ -1104,12 +1101,20 @@ isNullHomotopyOf(ComplexMap, ComplexMap) := (h, f) -> (
)
)

-- TODO: we are keeping this version so that we may compare the
-- more general version with this version, at a later date.
nullHomotopyFreeSource = f -> (
-- f:ComplexMap
-- key assumption: 'source f' is a complex of free modules
isNullHomotopic = method()
isNullHomotopic ComplexMap := Boolean => f -> (
g := homomorphism' f;
H := target g;
d := degree f;
g1 := g_0 // dd^H_(d+1);
g_0 == dd^H_(d+1) * g1
)

nullHomotopyFreeToExact = f -> (
-- key assumption: 'source f' is a complex of free modules AND the target is exact
-- result is a ComplexMap h : C --> D, of degree degree(f)+1
if not isFree source f then error "expected source of complex map to be free";
-- Note: we do not check that the target is exact!
C := source f;
D := target f;
deg := degree f + 1;
Expand All @@ -1130,21 +1135,9 @@ nullHomotopyFreeSource = f -> (
map(D, C, new HashTable from hs, Degree => deg)
)

isNullHomotopic ComplexMap := Boolean => f -> (
g := homomorphism' f;
H := target g;
d := degree f;
g1 := g_0 // dd^H_(d+1);
g_0 == dd^H_(d+1) * g1
)

nullHomotopy ComplexMap := ComplexMap => f -> (
-- we check that the source is free, as that can be much faster
-- TODO: nullHomotopy should perhaps be hook-ified.
-- 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;
nullHomotopy = method(Options => true) -- this function attempts to construct one, might fail
nullHomotopy ComplexMap := ComplexMap => {FreeToExact => false} >> opts -> f -> (
if opts.FreeToExact then return nullHomotopyFreeToExact f;
g := homomorphism' f;
H := target g;
d := degree f;
Expand Down
2 changes: 1 addition & 1 deletion M2/Macaulay2/packages/Depth.m2
Original file line number Diff line number Diff line change
Expand Up @@ -648,7 +648,7 @@ doc///
(depth, Ideal, Module)
(depth, Module)
(depth, Ideal, Ideal)
Headline
Headline
computes the depth of a ring
Usage
d = depth(I,M)
Expand Down
3 changes: 3 additions & 0 deletions M2/Macaulay2/packages/Macaulay2Doc/shared.m2
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ document { Key => isVeryAmple, methodstr, SeeAlso => {
"Divisor::isVeryAmple(WeilDivisor)", "Polyhedra::isVeryAmple(Polyhedron)",
"PositivityToricBundles::isVeryAmple(ToricVectorBundleKlyachko)",
"NormalToricVarieties::isVeryAmple(ToricDivisor)" } }
document { Key => isNormal, methodstr, SeeAlso => { "Polyhedra::isNormal(Polyhedron)","IntegralClosure::isNormal(Ring)"} }
document { Key => normalCone, methodstr, SeeAlso => { "Polyhedra::normalCone(Polyhedron,Polyhedron)","ReesAlgebra::normalCone(Ideal)"} }


document { Key => cone,
Headline => "mapping cone or polyhedral cone",
Expand Down
41 changes: 15 additions & 26 deletions M2/Macaulay2/packages/ReesAlgebra.m2
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ check "ReesAlgebra"
*-

export{
"analyticSpread",
"analyticSpread",
"associatedGradedRing",
"distinguished",
"intersectInP",
"isLinearType",
Expand All @@ -78,7 +79,6 @@ export{
"expectedReesIdeal",
"PlaneCurveSingularities",
--synonyms
"associatedGradedRing", -- => "normalCone",
"reesAlgebraIdeal" => "reesIdeal",
"Trim" -- option in reesIdeal
}
Expand Down Expand Up @@ -207,26 +207,6 @@ isLinearType(Module, RingElement):= o-> (N,a)->(
J := ideal((vars S) * P);
((gens I) % J) == 0)

-- normalCone = method(TypicalValue => Ring,
-- Options => {
-- DegreeLimit => {},
-- BasisElementLimit => infinity,
-- PairLimit => infinity,
-- MinimalGenerators => true,
-- Strategy => null,
-- Variable => "w"
-- }
-- )
-- normalCone(Ideal) := o -> I -> (
-- RI := reesAlgebra(I,o);
-- RI/promote(I,RI)
-- )

-- normalCone(Ideal, RingElement) := o -> (I,a) -> (
-- RI := reesAlgebra(I,a,o);
-- RI/promote(I,RI)
-- )

normalConeOptions = {
DegreeLimit => {},
BasisElementLimit => infinity,
Expand All @@ -236,7 +216,6 @@ normalConeOptions = {
Variable => "w"
}


normalCone Ideal := Ring => normalConeOptions >> o -> I -> (
RI := reesAlgebra(I,o);
RI/promote(I,RI)
Expand All @@ -248,8 +227,8 @@ normalCone(Ideal, RingElement) := Ring => normalConeOptions >> o -> (I,a) -> (
)

associatedGradedRing = method(Options => normalConeOptions)
associatedGradedRing Ideal := o -> I -> normalCone(I, o)
associatedGradedRing(Ideal, RingElement) := o -> (I,a) -> normalCone(I, a, o)
associatedGradedRing Ideal := Ring => o -> I -> normalCone(I, o)
associatedGradedRing(Ideal, RingElement) := Ring => o -> (I,a) -> normalCone(I, a, o)

multiplicity = method(
Options => {
Expand Down Expand Up @@ -1280,11 +1259,16 @@ doc ///
Key
(normalCone, Ideal, RingElement)
(normalCone, Ideal)
associatedGradedRing
(associatedGradedRing, Ideal)
(associatedGradedRing, Ideal, RingElement)
Headline
The normal cone of a subscheme
Usage
normalCone I
normalCone(I,f)
associatedGradedRing I
associatedGradedRing(I,f)
Inputs
I:Ideal
f:RingElement
Expand Down Expand Up @@ -2000,7 +1984,8 @@ doc ///
[reesAlgebra,Strategy]
[isLinearType,Strategy]
[isReduction, Strategy]
[multiplicity, Strategy]
[multiplicity, Strategy]
[associatedGradedRing, Strategy]
[specialFiberIdeal, Strategy]
[specialFiber, Strategy]
[analyticSpread, Strategy]
Expand Down Expand Up @@ -2044,6 +2029,7 @@ doc ///
[specialFiber, PairLimit]
[specialFiberIdeal, PairLimit]
[multiplicity, PairLimit]
[associatedGradedRing, PairLimit]
[isReduction, PairLimit]
[isLinearType,PairLimit]
[reesAlgebra,PairLimit]
Expand Down Expand Up @@ -2080,6 +2066,7 @@ doc ///
[specialFiber, MinimalGenerators]
[specialFiberIdeal, MinimalGenerators]
[multiplicity, MinimalGenerators]
[associatedGradedRing, MinimalGenerators]
[isReduction, MinimalGenerators]
[isLinearType,MinimalGenerators]
[reesAlgebra,MinimalGenerators]
Expand Down Expand Up @@ -2116,6 +2103,7 @@ doc ///
[analyticSpread, BasisElementLimit]
[specialFiber, BasisElementLimit]
[multiplicity, BasisElementLimit]
[associatedGradedRing, BasisElementLimit]
[isReduction, BasisElementLimit]
[isLinearType,BasisElementLimit]
[reesAlgebra,BasisElementLimit]
Expand Down Expand Up @@ -2152,6 +2140,7 @@ doc ///
[analyticSpread, DegreeLimit]
[specialFiber, DegreeLimit]
[multiplicity, DegreeLimit]
[associatedGradedRing, DegreeLimit]
[isReduction, DegreeLimit]
[isLinearType,DegreeLimit]
[reesAlgebra,DegreeLimit]
Expand Down

0 comments on commit 325328b

Please sign in to comment.