From 325328b511faba0ae79b45db21d5d99323612969 Mon Sep 17 00:00:00 2001 From: Mike Stillman Date: Thu, 5 Sep 2024 15:18:43 -0400 Subject: [PATCH] fixed nullHomotopy by adding a new optional argument FreeToExact, and changed calls in AInfinity to use this simpler algorithm. Also added in doc for associatedGradedRing --- M2/Macaulay2/packages/AInfinity.m2 | 8 ++-- M2/Macaulay2/packages/Complexes.m2 | 1 + .../packages/Complexes/ChainComplexMap.m2 | 39 ++++++++---------- M2/Macaulay2/packages/Depth.m2 | 2 +- M2/Macaulay2/packages/Macaulay2Doc/shared.m2 | 3 ++ M2/Macaulay2/packages/ReesAlgebra.m2 | 41 +++++++------------ 6 files changed, 40 insertions(+), 54 deletions(-) diff --git a/M2/Macaulay2/packages/AInfinity.m2 b/M2/Macaulay2/packages/AInfinity.m2 index 0fe2366f487..9cc12c749f6 100644 --- a/M2/Macaulay2/packages/AInfinity.m2 +++ b/M2/Macaulay2/packages/AInfinity.m2 @@ -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 ( @@ -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 ( @@ -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 @@ -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; diff --git a/M2/Macaulay2/packages/Complexes.m2 b/M2/Macaulay2/packages/Complexes.m2 index 1bdbd033473..f8f6e8bc95b 100644 --- a/M2/Macaulay2/packages/Complexes.m2 +++ b/M2/Macaulay2/packages/Complexes.m2 @@ -63,6 +63,7 @@ export { "yonedaMap'", "yonedaProduct", -- Option names + "FreeToExact", -- used in nullHomotopy "OverField", "OverZZ", "Homogenization", diff --git a/M2/Macaulay2/packages/Complexes/ChainComplexMap.m2 b/M2/Macaulay2/packages/Complexes/ChainComplexMap.m2 index 2329e95257e..478f2457e4e 100644 --- a/M2/Macaulay2/packages/Complexes/ChainComplexMap.m2 +++ b/M2/Macaulay2/packages/Complexes/ChainComplexMap.m2 @@ -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 @@ -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; @@ -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; diff --git a/M2/Macaulay2/packages/Depth.m2 b/M2/Macaulay2/packages/Depth.m2 index a9a0ef251c0..6beb0255d5f 100644 --- a/M2/Macaulay2/packages/Depth.m2 +++ b/M2/Macaulay2/packages/Depth.m2 @@ -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) diff --git a/M2/Macaulay2/packages/Macaulay2Doc/shared.m2 b/M2/Macaulay2/packages/Macaulay2Doc/shared.m2 index a31095f933b..3d777937eac 100644 --- a/M2/Macaulay2/packages/Macaulay2Doc/shared.m2 +++ b/M2/Macaulay2/packages/Macaulay2Doc/shared.m2 @@ -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", diff --git a/M2/Macaulay2/packages/ReesAlgebra.m2 b/M2/Macaulay2/packages/ReesAlgebra.m2 index d6b3b58f61c..79f1cbc2543 100644 --- a/M2/Macaulay2/packages/ReesAlgebra.m2 +++ b/M2/Macaulay2/packages/ReesAlgebra.m2 @@ -57,7 +57,8 @@ check "ReesAlgebra" *- export{ - "analyticSpread", + "analyticSpread", + "associatedGradedRing", "distinguished", "intersectInP", "isLinearType", @@ -78,7 +79,6 @@ export{ "expectedReesIdeal", "PlaneCurveSingularities", --synonyms - "associatedGradedRing", -- => "normalCone", "reesAlgebraIdeal" => "reesIdeal", "Trim" -- option in reesIdeal } @@ -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, @@ -236,7 +216,6 @@ normalConeOptions = { Variable => "w" } - normalCone Ideal := Ring => normalConeOptions >> o -> I -> ( RI := reesAlgebra(I,o); RI/promote(I,RI) @@ -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 => { @@ -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 @@ -2000,7 +1984,8 @@ doc /// [reesAlgebra,Strategy] [isLinearType,Strategy] [isReduction, Strategy] - [multiplicity, Strategy] + [multiplicity, Strategy] + [associatedGradedRing, Strategy] [specialFiberIdeal, Strategy] [specialFiber, Strategy] [analyticSpread, Strategy] @@ -2044,6 +2029,7 @@ doc /// [specialFiber, PairLimit] [specialFiberIdeal, PairLimit] [multiplicity, PairLimit] + [associatedGradedRing, PairLimit] [isReduction, PairLimit] [isLinearType,PairLimit] [reesAlgebra,PairLimit] @@ -2080,6 +2066,7 @@ doc /// [specialFiber, MinimalGenerators] [specialFiberIdeal, MinimalGenerators] [multiplicity, MinimalGenerators] + [associatedGradedRing, MinimalGenerators] [isReduction, MinimalGenerators] [isLinearType,MinimalGenerators] [reesAlgebra,MinimalGenerators] @@ -2116,6 +2103,7 @@ doc /// [analyticSpread, BasisElementLimit] [specialFiber, BasisElementLimit] [multiplicity, BasisElementLimit] + [associatedGradedRing, BasisElementLimit] [isReduction, BasisElementLimit] [isLinearType,BasisElementLimit] [reesAlgebra,BasisElementLimit] @@ -2152,6 +2140,7 @@ doc /// [analyticSpread, DegreeLimit] [specialFiber, DegreeLimit] [multiplicity, DegreeLimit] + [associatedGradedRing, DegreeLimit] [isReduction, DegreeLimit] [isLinearType,DegreeLimit] [reesAlgebra,DegreeLimit]