From 3757f7e30b9469f36c9819f5bbd4f8b26214a9eb Mon Sep 17 00:00:00 2001 From: Mike Stillman Date: Thu, 11 Jul 2024 10:27:11 -0400 Subject: [PATCH 1/9] minor changes to get InvolutiveBases to work with Complexes --- M2/Macaulay2/packages/InvolutiveBases.m2 | 29 ++++++++++++------------ 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/M2/Macaulay2/packages/InvolutiveBases.m2 b/M2/Macaulay2/packages/InvolutiveBases.m2 index fb1950f9b9c..bfb5bddcd7d 100644 --- a/M2/Macaulay2/packages/InvolutiveBases.m2 +++ b/M2/Macaulay2/packages/InvolutiveBases.m2 @@ -13,6 +13,7 @@ newPackage( Email => "daniel@momo.math.rwth-aachen.de", HomePage => "http://wwwb.math.rwth-aachen.de/~daniel/"}}, Headline => "Methods for Janet bases and Pommaret bases in Macaulay 2", + PackageImports => { "Complexes" }, Keywords => {"Groebner Basis Algorithms"}, DebuggingMode => false ) @@ -48,9 +49,9 @@ multVar(InvolutiveBasis) := J -> ( v := generators ring J#0; apply(J#1, i->set(select(v, j -> i#j == 1)))) -multVar(ChainComplex, ZZ) := (C, n) -> ( +multVar(Complex, ZZ) := (C, n) -> ( v := generators C.ring; - apply(C.dd#n.cache.multVars, i->set(select(v, j -> i#j == 1)))) + apply(C.dd_n.cache.multVars, i->set(select(v, j -> i#j == 1)))) ---------------------------------------------------------------------- @@ -420,7 +421,7 @@ janetBasis(Ideal) := I -> janetBasis gb I janetBasis(Module) := M -> janetBasis presentation M -janetBasis(ChainComplex, ZZ) := (C, n) -> new InvolutiveBasis from hashTable {0 => C.dd#n, 1 => C.dd#n.cache.multVars} +janetBasis(Complex, ZZ) := (C, n) -> new InvolutiveBasis from hashTable {0 => C.dd_n, 1 => C.dd_n.cache.multVars} -- given a Janet basis J for a submodule of a free module @@ -567,7 +568,7 @@ invSyzygies(InvolutiveBasis) := J -> ( -- given an ideal of a polynomial ring or a module over a polynomial ring, -- construct a free resolution using Janet bases for this ideal or this module -janetResolution = method(TypicalValue => ChainComplex) +janetResolution = method(TypicalValue => Complex) janetResolution(InvolutiveBasis) := J -> ( R := { sortByClass(J) }; @@ -578,8 +579,8 @@ janetResolution(InvolutiveBasis) := J -> ( S = invSyzygies R#(-1); S = (map(source schreyerOrder leadTerm R#(-1)#0, source S#0, S#0), S#1); ); - C := chainComplex(apply(R, i->i#0) | { map(source R#-1#0, (ring R#0#0)^0, 0) }); - for i from 1 to length(R) do C.dd#i.cache.multVars = R#(i-1)#1; + C := complex(apply(R, i->i#0) | { map(source R#-1#0, (ring R#0#0)^0, 0) }); + for i from 1 to length(R) do C.dd_i.cache.multVars = R#(i-1)#1; C) janetResolution(Matrix) := M -> janetResolution janetBasis M @@ -588,7 +589,7 @@ janetResolution(Ideal) := I -> janetResolution janetBasis I janetResolution(Module) := M -> janetResolution janetBasis presentation M -addHook((resolution, Module), Strategy => Involutive, (opts, M) -> +addHook((freeResolution, Module), Strategy => Involutive, (opts, M) -> if opts.Strategy === Involutive then janetResolution M) @@ -815,12 +816,12 @@ document { } document { - Key => {multVar,(multVar,InvolutiveBasis),(multVar,ChainComplex,ZZ),(multVar,FactorModuleBasis)}, + Key => {multVar,(multVar,InvolutiveBasis),(multVar,Complex,ZZ),(multVar,FactorModuleBasis)}, Headline => "extract the sets of multiplicative variables for each generator (in several contexts)", Usage => "m = multVar(J) or m = multVar(C,n) or m = multVar(F)", Inputs => { "J" => InvolutiveBasis, - "C" => ChainComplex, + "C" => Complex, "n" => ZZ, "F" => FactorModuleBasis }, @@ -831,7 +832,7 @@ document { "If the argument of multVar is ", ofClass InvolutiveBasis, ", then the i-th set in m consists of the multiplicative variables for the i-th generator in J." }, PARA{ - "If the arguments of multVar are ", ofClass ChainComplex, " and ", ofClass ZZ, ", where C is the result of either ", TO "janetResolution", " or ", TO "resolution", " called with the optional argument 'Strategy => Involutive', then the i-th set in m consists of the multiplicative variables for the i-th generator in the n-th differential of C." + "If the arguments of multVar are ", ofClass Complex, " and ", ofClass ZZ, ", where C is the result of either ", TO "janetResolution", " or ", TO "resolution", " called with the optional argument 'Strategy => Involutive', then the i-th set in m consists of the multiplicative variables for the i-th generator in the n-th differential of C." }, PARA{ "If the argument of multVar is ", ofClass FactorModuleBasis, ", then the i-th set in m consists of the multiplicative variables for the i-th monomial cone in F." @@ -860,14 +861,14 @@ document { } document { - Key => {janetBasis,(janetBasis,Matrix),(janetBasis,Ideal),(janetBasis,GroebnerBasis),(janetBasis,ChainComplex,ZZ)}, + Key => {janetBasis,(janetBasis,Matrix),(janetBasis,Ideal),(janetBasis,GroebnerBasis),(janetBasis,Complex,ZZ)}, Headline => "compute Janet basis for an ideal or a submodule of a free module", Usage => "J = janetBasis M or J = janetBasis(C,n)", Inputs => { "M" => InvolutiveBasis, "M" => Ideal, "M" => GroebnerBasis, - "C" => ChainComplex, + "C" => Complex, "n" => ZZ }, Outputs => { @@ -877,7 +878,7 @@ document { "If the argument for janetBasis is ", ofClass Matrix, " or ", ofClass Ideal, " or ", ofClass GroebnerBasis, ", then J is a Janet basis for (the module generated by) M." }, PARA{ - "If the arguments for janetBasis are ", ofClass ChainComplex, " and ", ofClass ZZ, ", where C is the result of either ", TO "janetResolution", " or ", TO "resolution", " called with the optional argument 'Strategy => Involutive', then J is the Janet basis extracted from the n-th differential of C." + "If the arguments for janetBasis are ", ofClass Complex, " and ", ofClass ZZ, ", where C is the result of either ", TO "janetResolution", " or ", TO "resolution", " called with the optional argument 'Strategy => Involutive', then J is the Janet basis extracted from the n-th differential of C." }, EXAMPLE lines /// R = QQ[x,y]; @@ -1178,7 +1179,7 @@ document { Usage => "C = janetResolution M", Inputs => {{ "M, ", ofClass Matrix, " or ", ofClass Ideal, " or ", ofClass Module }}, Outputs => { - "C" => ChainComplex => { "a (non-minimal) free resolution of (the module generated by) M" } + "C" => Complex => { "a (non-minimal) free resolution of (the module generated by) M" } }, PARA{ "The computed Janet basis for each homological degree can be extracted with ", TO "janetBasis", "." From e4746245112d21ccc7a8c487a4298901448c2773 Mon Sep 17 00:00:00 2001 From: Mike Stillman Date: Thu, 11 Jul 2024 10:35:44 -0400 Subject: [PATCH 2/9] Minor changes to Posets to get it working with Complexes --- M2/Macaulay2/packages/Posets.m2 | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/M2/Macaulay2/packages/Posets.m2 b/M2/Macaulay2/packages/Posets.m2 index 5bb901e8572..61f78289eb4 100644 --- a/M2/Macaulay2/packages/Posets.m2 +++ b/M2/Macaulay2/packages/Posets.m2 @@ -30,6 +30,9 @@ newPackage( "Graphs", "FourTiTwo" }, + PackageImports => { + "Complexes" + }, Certification => { "journal name" => "The Journal of Software for Algebra and Geometry", "journal URI" => "https://msp.org/jsag/", @@ -1007,7 +1010,7 @@ randomPoset (List) := Poset => opts -> (G) -> ( randomPoset (ZZ) := Poset => opts -> n -> randomPoset(toList(1..n), opts) resolutionPoset = method() -resolutionPoset ChainComplex := Poset => C -> +resolutionPoset Complex := Poset => C -> poset flatten flatten apply(sort unique (first \ keys betti C), d -> for r to numrows C.dd_d - 1 list for c to numcols C.dd_d - 1 list if C.dd_d_(r,c) != 0 then {{d-1,r}, {d,c}} else continue) resolutionPoset MonomialIdeal := Poset => I -> ( P := resolutionPoset res I; @@ -3828,7 +3831,7 @@ doc /// doc /// Key resolutionPoset - (resolutionPoset,ChainComplex) + (resolutionPoset,Complex) (resolutionPoset,Ideal) (resolutionPoset,MonomialIdeal) Headline @@ -3837,7 +3840,7 @@ doc /// P = resolutionPoset C P = resolutionPoset I Inputs - C:ChainComplex + C:Complex I:MonomialIdeal I:Ideal Outputs From de0b9b6202e6a3a023b532d967de7af8f2bf2e9b Mon Sep 17 00:00:00 2001 From: Mike Stillman Date: Fri, 13 Sep 2024 12:21:42 -0400 Subject: [PATCH 3/9] move Complexes from PackageImports to PackageExports --- M2/Macaulay2/packages/Posets.m2 | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/M2/Macaulay2/packages/Posets.m2 b/M2/Macaulay2/packages/Posets.m2 index 61f78289eb4..42e3225c250 100644 --- a/M2/Macaulay2/packages/Posets.m2 +++ b/M2/Macaulay2/packages/Posets.m2 @@ -28,9 +28,7 @@ newPackage( PackageExports => { "SimplicialComplexes", "Graphs", - "FourTiTwo" - }, - PackageImports => { + "FourTiTwo", "Complexes" }, Certification => { From 4bea9da0e5e30cc96f5aa621569beb1b08a9f73d Mon Sep 17 00:00:00 2001 From: Mike Stillman Date: Thu, 18 Jul 2024 13:30:17 -0400 Subject: [PATCH 4/9] minors changes to SimplicialComplexes package to get working with Complexes --- M2/Macaulay2/packages/SimplicialComplexes.m2 | 2 +- .../packages/SimplicialComplexes/Code.m2 | 72 +++++------ .../SimplicialComplexes/Documentation.m2 | 114 +++++++++--------- .../packages/SimplicialComplexes/Tests.m2 | 48 ++++---- 4 files changed, 118 insertions(+), 118 deletions(-) diff --git a/M2/Macaulay2/packages/SimplicialComplexes.m2 b/M2/Macaulay2/packages/SimplicialComplexes.m2 index dbd4617e638..0d3ccadb528 100644 --- a/M2/Macaulay2/packages/SimplicialComplexes.m2 +++ b/M2/Macaulay2/packages/SimplicialComplexes.m2 @@ -30,7 +30,7 @@ newPackage( }, Headline => "exploring abstract simplicial complexes within commutative algebra", Keywords => {"Combinatorial Commutative Algebra"}, - PackageExports => { "Polyhedra" }, + PackageExports => { "Polyhedra", "Complexes" }, AuxiliaryFiles => true, Certification => { "journal name" => "Journal of Software for Algebra and Geometry", diff --git a/M2/Macaulay2/packages/SimplicialComplexes/Code.m2 b/M2/Macaulay2/packages/SimplicialComplexes/Code.m2 index 1e8d4d3e364..c8f2e0b657c 100644 --- a/M2/Macaulay2/packages/SimplicialComplexes/Code.m2 +++ b/M2/Macaulay2/packages/SimplicialComplexes/Code.m2 @@ -577,41 +577,41 @@ boundaryMap (ZZ, SimplicialComplex) := opts -> (r, D) -> ( ) ) -chainComplex SimplicialComplex := ChainComplex => {Labels => {}} >> opts -> ( - cacheValue(symbol chainComplex => opts)) (D -> ( +complex SimplicialComplex := Complex => {Labels => {}} >> opts -> ( + cacheValue(symbol complex => opts)) (D -> ( d := dim D; - C := if d < -1 then (coefficientRing D)^0[-1] - else if d === -1 then (coefficientRing D)^1 - else chainComplex apply(0..d, r -> boundaryMap(r, D, Labels => opts.Labels)); + C := if d < -1 then (complex(coefficientRing D)^0)[-1] + else if d === -1 then complex (coefficientRing D)^1 + else complex apply(toList(0..d), r -> boundaryMap(r, D, Labels => opts.Labels)); if opts.Labels === {} then C[1] else C ) ) homology(ZZ, SimplicialComplex, Ring) := Module => opts -> (i, Delta, R) -> ( - homology(i, chainComplex Delta ** R) + homology(i, (complex Delta) ** R) ) homology(ZZ, SimplicialComplex) := Module => opts -> (i, Delta) -> ( - homology(i, chainComplex Delta) + homology(i, complex Delta) ) homology(Nothing, SimplicialComplex, Ring) := -homology(SimplicialComplex, Ring) := GradedModule => opts -> (Delta, R) -> ( - homology(chainComplex Delta ** R) +homology(SimplicialComplex, Ring) := Complex => opts -> (Delta, R) -> ( + homology(complex Delta ** R) ) homology(Nothing, SimplicialComplex) := -homology SimplicialComplex := GradedModule => opts -> Delta -> ( - homology(chainComplex Delta) +homology SimplicialComplex := Complex => opts -> Delta -> ( + homology(complex Delta) ) cohomology(ZZ, SimplicialComplex, Ring) := Module => opts -> (i, Delta, R) -> ( - cohomology(i, Hom(chainComplex Delta ** R, module R)) + cohomology(i, Hom(complex Delta ** R, module R)) ) cohomology(ZZ, SimplicialComplex) := Module => opts -> (i,Delta) -> ( - cohomology(i, Hom(chainComplex Delta, module coefficientRing Delta)) + cohomology(i, Hom(complex Delta, module coefficientRing Delta)) ) @@ -735,23 +735,23 @@ buchbergerSimplicialComplex(MonomialIdeal, Ring) := (I,R) -> ( buchbergerSimplicialComplex(flatten entries mingens I, R) ) buchbergerResolution = method() -buchbergerResolution List := ChainComplex => M -> ( +buchbergerResolution List := Complex => M -> ( -- handle degenerate cases first if monomialIdeal M == 0 then return (ring(monomialIdeal M))^1[0]; -- Construct the buchbergerSimplicial Complex and homogenize R := ZZ(monoid[vars(0..#M-1)]); B := buchbergerSimplicialComplex(M,R); - chainComplex(B,Labels=>M) + complex(B,Labels=>M) ) -buchbergerResolution MonomialIdeal := ChainComplex => M -> ( +buchbergerResolution MonomialIdeal := Complex => M -> ( if M == 0 then (ring M)^1[0] else buchbergerResolution(first entries mingens M) ) taylorResolution = method(); -taylorResolution List := ChainComplex => M -> ( +taylorResolution List := Complex => M -> ( -- The Taylor resolution is the homogenization of the -- (numgens M - 1)-simplex. The implementation is -- straightforward once we've dealt with degenerate @@ -764,9 +764,9 @@ taylorResolution List := ChainComplex => M -> ( error "-- expected minimal generators of a monomial ideal"; R := ZZ(monoid[vars(0..#M-1)]); Simplex := simplexComplex(#M-1,R); - chainComplex(Simplex,Labels=>M) + complex(Simplex,Labels=>M) ) -taylorResolution MonomialIdeal := ChainComplex => M -> ( +taylorResolution MonomialIdeal := Complex => M -> ( if M == 0 then (ring M)^1[0] else taylorResolution(first entries mingens M) @@ -826,8 +826,8 @@ lyubeznikResolution List := opts -> L -> ( MO := opts.MonomialOrder; R := QQ(monoid[vars(0..#L-1)]); if opts.MonomialOrder == {} - then chainComplex(lyubeznikSimplicialComplex(L,R),Labels=>L) - else chainComplex(lyubeznikSimplicialComplex(L,R),Labels=>L_MO) + then complex(lyubeznikSimplicialComplex(L,R),Labels=>L) + else complex(lyubeznikSimplicialComplex(L,R),Labels=>L_MO) ) lyubeznikResolution MonomialIdeal := opts -> I -> ( -- if I == monomialIdeal(0), then the set of mingens in empty and M2 @@ -840,10 +840,10 @@ lyubeznikResolution MonomialIdeal := opts -> I -> ( R := QQ(monoid[vars(0..#(mingens I)-1)]); if opts.MonomialOrder == {} then return( - chainComplex(lyubeznikSimplicialComplex(I,R,MonomialOrder=>MO),Labels=>MinGens) + complex(lyubeznikSimplicialComplex(I,R,MonomialOrder=>MO),Labels=>MinGens) ) else return( - chainComplex(lyubeznikSimplicialComplex(I,R,MonomialOrder=>MO),Labels=>MinGens_MO) + complex(lyubeznikSimplicialComplex(I,R,MonomialOrder=>MO),Labels=>MinGens_MO) ) ) @@ -880,13 +880,13 @@ scarfSimplicialComplex (MonomialIdeal,Ring) := (I,A) -> ( scarfChainComplex = method() scarfChainComplex List := L ->( A := QQ(monoid[vars(0..#L-1)]); - chainComplex(scarfSimplicialComplex(L,A), Labels=>L) + complex(scarfSimplicialComplex(L,A), Labels=>L) ) scarfChainComplex MonomialIdeal := I -> ( if numgens I == 0 then return ((ring I)^1)[0]; A := QQ(monoid[vars(0..#(mingens I)-1)]); - chainComplex(scarfSimplicialComplex(I,A), Labels=>(first entries mingens I)) + complex(scarfSimplicialComplex(I,A), Labels=>(first entries mingens I)) ) @@ -1019,11 +1019,11 @@ isWellDefined SimplicialMap := Boolean => f -> ( true ) -chainComplex SimplicialMap := ChainComplexMap => f -> ( +complex SimplicialMap := ComplexMap => {} >> opts -> f -> ( D := source f; E := target f; - CD := chainComplex D; - CE := chainComplex E; + CD := complex D; + CE := complex E; kk := coefficientRing D; EE := kk(monoid[gens ring E, SkewCommutative => true]); ED := kk(monoid[gens ring D, SkewCommutative => true]); @@ -1095,31 +1095,31 @@ image SimplicialMap := SimplicialComplex => f -> ( ) homology(Nothing, SimplicialMap) := -homology SimplicialMap := GradedModuleMap => opts -> f -> ( - homology(chainComplex f) +homology SimplicialMap := ComplexMap => opts -> f -> ( + homology(complex f) ) -homology(ZZ, SimplicialMap) := Matrix => opts -> (i,f) -> homology(i, chainComplex f) +homology(ZZ, SimplicialMap) := Matrix => opts -> (i,f) -> homology(i, complex f) homology(ZZ, SimplicialComplex, SimplicialComplex) := Module => opts -> (i,D,E) -> ( inclusion := map(D, E, gens ring D); - C := coker chainComplex inclusion; + C := coker complex inclusion; homology(i,C) ) homology(Nothing, SimplicialComplex, SimplicialComplex) := -homology(SimplicialComplex, SimplicialComplex) := ChainComplex => opts -> (D,E) -> ( +homology(SimplicialComplex, SimplicialComplex) := Complex => opts -> (D,E) -> ( inclusion := map(D, E, gens ring D); - C := coker chainComplex inclusion; + C := coker complex inclusion; homology C ) cohomology(ZZ, SimplicialMap) := Matrix => opts -> (i,f) -> ( - cohomology(i, Hom(chainComplex f, module coefficientRing source f)) + cohomology(i, Hom(complex f, module coefficientRing source f)) ) cohomology(ZZ, SimplicialComplex, SimplicialComplex) := Module => opts -> (i,D,E) -> ( inclusion := map(D, E, gens ring D); - C := coker chainComplex inclusion; + C := coker complex inclusion; cohomology(i, Hom(C, module coefficientRing D)) ) diff --git a/M2/Macaulay2/packages/SimplicialComplexes/Documentation.m2 b/M2/Macaulay2/packages/SimplicialComplexes/Documentation.m2 index 685e36c4e07..3f884377ccc 100644 --- a/M2/Macaulay2/packages/SimplicialComplexes/Documentation.m2 +++ b/M2/Macaulay2/packages/SimplicialComplexes/Documentation.m2 @@ -497,7 +497,7 @@ doc /// Stanley–Reisner ideal in any polynomial ring with a sufficiently large number of variables, some operations in this package do depend of the choice of the polynomial ring (or its coefficient ring). For example, - the @TO2((chainComplex, SimplicialComplex), "chain complex")@ of an + the @TO2((complex, SimplicialComplex), "chain complex")@ of an abstract simplicial complex is typically constructed over the coefficient ring of this polynomial ring, and the dual of a simplicial complex (or monomial ideal) is dependent on the number @@ -564,20 +564,20 @@ doc /// Stanley–Reisner ideal in any polynomial ring with a sufficiently large number of variables, some operations in this package do depend of the choice of the polynomial ring (or its coefficient ring). - For example, the @TO2((chainComplex, SimplicialComplex), "chain + For example, the @TO2((complex, SimplicialComplex), "chain complex")@ of an abstract simplicial complex is, by default, constructed over the coefficient ring of its polynomial ring, and the dual of a simplicial complex (or monomial ideal) is dependent on the number of variables in the polynomial ideal. Example - C = chainComplex Δ - D = chainComplex Γ - C' = chainComplex Δ' + C = complex Δ + D = complex Γ + C' = complex Δ' assert (D == C ** QQ and C' == C ** (ZZ/101)) SeeAlso "Finding attributes and properties" (ring, SimplicialComplex) - (chainComplex, SimplicialComplex) + (complex, SimplicialComplex) /// doc /// @@ -732,15 +732,15 @@ doc /// Stanley–Reisner ideal in any polynomial ring with a sufficiently large number of variables, some operations in this package do depend of the choice of the polynomial ring (or its coefficient ring). - For example, the @TO2((chainComplex, SimplicialComplex), "chain + For example, the @TO2((complex, SimplicialComplex), "chain complex")@ of an abstract simplicial complex is typically constructed over the coefficient ring of this polynomial ring, and the dual of a simplicial complex (or monomial ideal) is dependent on the number of variables in the polynomial ideal. Example - chainComplex Δ - chainComplex Γ - chainComplex Δ' + complex Δ + complex Γ + complex Δ' SeeAlso "Making an abstract simplicial complex" (simplicialComplex, MonomialIdeal) @@ -833,15 +833,15 @@ doc /// Stanley–Reisner ideal in any polynomial ring with a sufficiently large number of variables, some operations in this package do depend of the choice of the polynomial ring (or its coefficient ring). - For example, the @TO2((chainComplex, SimplicialComplex), "chain + For example, the @TO2((complex, SimplicialComplex), "chain complex")@ of an abstract simplicial complex is typically constructed over the coefficient ring of this polynomial ring, and the dual of a simplicial complex (or monomial ideal) is dependent on the number of variables in the polynomial ideal. Example - chainComplex Δ - chainComplex Γ - chainComplex Δ' + complex Δ + complex Γ + complex Δ' Text The input can be an @TO Ideal@, in which case the constructor verifies that it is a squarefree monomial ideal. @@ -1083,7 +1083,7 @@ doc /// matrix {facets Δ} dim Δ fVector Δ - prune HH chainComplex Δ + prune HH complex Δ assert(dim Δ === 3 and isPure Δ) assert(fVector Δ === {1,16,106,180,90}) Text @@ -1360,7 +1360,7 @@ doc /// fVector Δ assert(dim Δ === 2 and isPure Δ) assert(fVector Δ === {1,6,15,11}) - prune HH chainComplex Δ + prune HH complex Δ Text This abstract simplicial complex is Cohen-Macaulay and shellable. Text @@ -1719,7 +1719,7 @@ doc /// (dual, MonomialIdeal) (pdim, Module) (regularity, Module) - (betti, GradedModule) + (betti, Complex) /// doc /// @@ -2688,7 +2688,7 @@ doc /// @SUBSECTION "Basic operations arising of "@ Text @UL { - TO (chainComplex, SimplicialComplex), + TO (complex, SimplicialComplex), TO (boundaryMap, ZZ, SimplicialComplex), TO (homology, ZZ, SimplicialComplex), TO (cohomology, ZZ, SimplicialComplex) @@ -2716,7 +2716,7 @@ doc /// minimal resolutions of some monomial ideals. Text @UL { - TO [(chainComplex, SimplicialComplex), Labels], + TO [(complex, SimplicialComplex), Labels], TO (buchbergerResolution, MonomialIdeal), TO (lyubeznikResolution, MonomialIdeal), TO (scarfChainComplex, MonomialIdeal), @@ -2773,7 +2773,7 @@ doc /// boundaryMap(2, Δ) boundaryMap(3, Δ) fVector Δ - C = chainComplex Δ + C = complex Δ assert all(4, i -> C.dd_i == - boundaryMap(i, Δ)) Text The boundary maps may depend on the coefficient ring. @@ -2811,27 +2811,27 @@ doc /// assert all(4, i -> T.dd_(i+1) == boundaryMap(i, Δ, Labels => sort M_*)) SeeAlso "Working with associated chain complexes" - (chainComplex, SimplicialComplex) + (complex, SimplicialComplex) (taylorResolution, MonomialIdeal) /// doc /// Key - (chainComplex, SimplicialComplex) - [(chainComplex, SimplicialComplex), Labels] + (complex, SimplicialComplex) + [(complex, SimplicialComplex), Labels] Labels Headline create the chain complex associated to a simplicial complex. Usage - chainComplex Delta - chainComplex(Delta, Labels => L) + complex Delta + complex(Delta, Labels => L) Inputs Delta : SimplicialComplex Labels => List L of monomials in a polynomial ring, one for each vertex of $\Delta$ Outputs - C : ChainComplex + C : Complex of free modules Description Text @@ -2850,7 +2850,7 @@ doc /// Example S = QQ[a..g]; torus = smallManifold(2, 7, 6, S) - C = chainComplex torus + C = complex torus fVector torus prune HH C assert(prune HH_1 C == QQ^2) @@ -2859,7 +2859,7 @@ doc /// Example R = ZZ[a..h]; Δ = kleinBottleComplex R - C' = chainComplex Δ + C' = complex Δ C'.dd fVector Δ prune HH C' @@ -2882,10 +2882,10 @@ doc /// Example S = QQ[a..d]; Γ = simplicialComplex{a*b*c, b*c*d}; - C = chainComplex Γ + C = complex Γ C.dd R = QQ[x_0..x_3]; - hC = chainComplex(Γ, Labels => {x_0*x_1, x_3, x_1*x_2, x_0*x_2}) + hC = complex(Γ, Labels => {x_0*x_1, x_3, x_1*x_2, x_0*x_2}) hC.dd prune homology hC Text @@ -2898,7 +2898,7 @@ doc /// simplicial complex does not always produce a free resolution. Reordering the labels in the previous example demonstrates this. Example - hC' = chainComplex(Γ, Labels => {x_3, x_0*x_1, x_1*x_2, x_0*x_2}) + hC' = complex(Γ, Labels => {x_3, x_0*x_1, x_1*x_2, x_0*x_2}) hC'.dd prune HH hC' SeeAlso @@ -2906,7 +2906,7 @@ doc /// (coefficientRing, SimplicialComplex) (boundaryMap, ZZ, SimplicialComplex) (resolution, Ideal) - (homology, ChainComplex) + (homology, Complex) /// doc /// @@ -2982,7 +2982,7 @@ doc /// SeeAlso "Working with associated chain complexes" (homology, SimplicialComplex, Ring) - (chainComplex, SimplicialComplex) + (complex, SimplicialComplex) (homology, SimplicialComplex, SimplicialComplex) /// @@ -3000,7 +3000,7 @@ doc /// Delta : SimplicialComplex R : Ring Outputs - : GradedModule + : Complex that is reduced homology group of $\Delta$ with coefficients in $R$ Description Text @@ -3026,7 +3026,7 @@ doc /// prune homology(Δ, QQ) prune homology(Δ, ZZ/2) assert(homology Δ == HH Δ) - assert(prune homology Δ == gradedModule ZZ^1[-2]) + assert(prune homology Δ == (complex ZZ^1)[-2]) Text The reduced homology of the @TO2(kleinBottleComplex, "Klein bottle")@ has torsion. @@ -3035,7 +3035,7 @@ doc /// prune homology Γ prune homology(Γ, QQ) prune homology(Γ, ZZ/2) - assert(prune homology(Γ, ZZ/2) == gradedModule((ZZ/2)^2[-1] ++ (ZZ/2)^1[-2])) + assert(prune homology(Γ, ZZ/2) == (complex (ZZ/2)^2)[-1] ++ (complex (ZZ/2)^1)[-2]) Text There are two "trivial" simplicial complexes: the irrelevant complex has the empty set as a facet whereas the void complex has @@ -3044,14 +3044,14 @@ doc /// Example irrelevant = simplicialComplex monomialIdeal gens S homology irrelevant - assert(homology irrelevant == gradedModule ZZ^1[1]) + assert(homology irrelevant == (complex ZZ^1)[1]) void = simplicialComplex monomialIdeal 1_S homology void - assert(homology void == gradedModule ZZ^0[0]) + assert(homology void == complex ZZ^0) SeeAlso "Working with associated chain complexes" (homology, ZZ, SimplicialComplex, Ring) - (chainComplex, SimplicialComplex) + (complex, SimplicialComplex) (homology, SimplicialComplex, SimplicialComplex) /// @@ -3101,7 +3101,7 @@ doc /// "Working with associated chain complexes" (cohomology, ZZ, SimplicialComplex, Ring) boundaryMap - (chainComplex, SimplicialComplex) + (complex, SimplicialComplex) (cohomology, ZZ, SimplicialComplex, SimplicialComplex) /// @@ -3239,7 +3239,7 @@ doc /// The Buchberger complex supports a free resolution of $I$, called the @TO2(buchbergerResolution,"Buchberger resolution")@ of $I$. Example - BRes = chainComplex(B1, Labels => first entries mingens I) + BRes = complex(B1, Labels => first entries mingens I) HH_0(BRes) all(1..dim B1+1, i -> prune HH_i(BRes) == 0) BRes == buchbergerResolution(I) @@ -3272,7 +3272,7 @@ doc /// L : List a minimal set of generators for a monomial ideal $I$ Outputs - : ChainComplex + : Complex the free resolution of the monomial ideal $I$ we get by homogenizing the Buchberger complex of $I$. Description @@ -3284,7 +3284,7 @@ doc /// L = {x_1^2, x_2^2, x_3^2, x_1*x_3, x_2*x_4}; BRes = (buchbergerResolution L); BRes.dd - BRes == chainComplex(buchbergerSimplicialComplex(L,R), Labels => L) + BRes == complex(buchbergerSimplicialComplex(L,R), Labels => L) Text When the Buchberger resolution is a minimal free resolution, it agrees with the Scarf complex. @@ -3315,7 +3315,7 @@ doc /// ideal. M : MonomialIdeal Outputs - : ChainComplex + : Complex Description Text If $M$ is a monomial ideal, minimally generated by $L$, then @@ -3379,11 +3379,11 @@ doc /// D = lyubeznikSimplicialComplex(M,R) Text The lyubeznik resolution of $M$ is the homogenization of - $D$ by $M$ (See @TO([(chainComplex, SimplicialComplex),Labels])@). + $D$ by $M$ (See @TO([(complex, SimplicialComplex),Labels])@). Example L = lyubeznikResolution(M); L.dd - L' = chainComplex(D,Labels=>(first entries mingens M)); + L' = complex(D,Labels=>(first entries mingens M)); L'.dd Text Changing the order of the generators may change the output. @@ -3419,7 +3419,7 @@ doc /// M : MonomialIdeal MonomialOrder => List Outputs - : ChainComplex + : Complex the Lyubeznik resolution of $S/M$. Description Text @@ -3526,7 +3526,7 @@ doc /// a monomial ideal. M : MonomialIdeal Outputs - C : ChainComplex + C : Complex Description Text For a monomial ideal $M$, minimally generated by a list of @@ -4041,15 +4041,15 @@ doc /// doc /// Key - (chainComplex, SimplicialMap) + (complex, SimplicialMap) Headline constructs the associated map between chain complexes Usage - chainComplex f + complex f Inputs f : SimplicialMap Outputs - : ChainComplexMap + : ComplexMap Description Text Given a simplicial map, this constructs the map between the associated @@ -4059,7 +4059,7 @@ doc /// Δ = simplicialComplex monomialIdeal(x_0*x_5, x_1*x_4, x_2*x_3) Γ = simplicialComplex monomialIdeal(x_1*x_2) f = map(Γ, Δ, {x_0,x_0,x_1,x_2,x_3,x_3}) - F = chainComplex f + F = complex f Text The inclusion of a face induces an inclusion of chain complexes. Example @@ -4068,12 +4068,12 @@ doc /// S'' = ZZ[z_0,z_1,z_2]; fishface = simplicialComplex {z_0*z_1*z_2} f = map(fish,fishface,{y_0,y_1,y_2}); - F = chainComplex f + F = complex f kernel F == 0 SeeAlso "Working with simplicial maps" - (chainComplex, SimplicialComplex) - ChainComplexMap + (complex, SimplicialComplex) + ComplexMap /// doc /// @@ -4307,7 +4307,7 @@ doc /// Inputs f : SimplicialMap Outputs - : GradedModuleMap + : ComplexMap which is the map on homology induced by $f$ Description Text @@ -4383,7 +4383,7 @@ doc /// Delta : SimplicialComplex Gamma : SimplicialComplex Outputs - : ChainComplex + : Complex Description Text This method computes the relative homology of a simplicial complex diff --git a/M2/Macaulay2/packages/SimplicialComplexes/Tests.m2 b/M2/Macaulay2/packages/SimplicialComplexes/Tests.m2 index a1fd2417daf..4c6458c4ea2 100644 --- a/M2/Macaulay2/packages/SimplicialComplexes/Tests.m2 +++ b/M2/Macaulay2/packages/SimplicialComplexes/Tests.m2 @@ -166,7 +166,7 @@ assert(dim void == -infinity) assert(faces(0,void) == {}) assert(faces(-1,void) == {}) assert(vertices void == {}) -C = chainComplex void +C = complex void assert(C.dd^2 == 0 ) assert(HH_0(void) == 0) assert(HH_-1(void) == 0) @@ -179,7 +179,7 @@ assert(faces(0,irrelevant) == {}) assert(#faces(-1,irrelevant) === 1) assert(irrelevant === dual irrelevant) assert(fVector irrelevant === {1}) -C = chainComplex irrelevant +C = complex irrelevant assert(C.dd^2 == 0 ) assert(HH_0(irrelevant) == 0) assert(HH_-1(irrelevant) == (coefficientRing R)^1) @@ -215,7 +215,7 @@ D = simplicialComplex monomialIdeal(a*d, a*e, b*c*d, d*e, c*e, b*e) assert not isPure D assert ( ideal dual D == monomialIdeal (a*b*c*d, a*b*e, a*c*e, d*e) ) S = ZZ/32003[u,v,w,x,y]; -C = chainComplex(D, Labels => {u,v,w,x,y}) +C = complex(D, Labels => {u,v,w,x,y}) assert(C.dd^2 == 0 ) H = prune HH(C) assert(H_0 != 0) @@ -233,14 +233,14 @@ D = simplicialComplex{a*b*i, a*e*i, i*b*j, j*c*b, j*c*a, j*a*e, e*i*f, i*h*f, i*h*j, j*e*d, j*g*d, j*h*g, g*h*f, f*e*d, d*f*a, f*b*a, f*g*c, f*b*c, g*c*a, g*d*a} assert isPure D -C = chainComplex D +C = complex D assert( C.dd^2 == 0 ) H = prune HH(C) assert(H_0 == 0) assert(rank H_1 == 2) assert(rank H_2 == 1) D' = dual D -C' = chainComplex D' +C' = complex D' assert(C'.dd^2 == 0 ) H' = prune HH(C') assert (H'_(7-2) === H_2) @@ -256,7 +256,7 @@ D = simplicialComplex {a*b*i, a*e*i, b*i*j, b*c*j, a*c*j, f*g*h, d*e*f, a*d*f, a*b*f, c*f*g, b*c*f, a*c*g, a*e*g} isPure D assert(vertices D == toList(a..j)) -C = chainComplex D +C = complex D assert(C.dd^2 == 0) H = prune HH(C) assert(H_0 == 0) @@ -280,7 +280,7 @@ D = simplicialComplex abelian 8 #faces(1,D) #faces(2,D) #faces(3,D) -C = chainComplex D +C = complex D assert(C.dd^2 == 0) prune HH(C) transpose gens ideal D @@ -297,7 +297,7 @@ assert(vertices D == toList(b..f)) assert(facets dual D == facets D) S = ZZ/32003[u,v,x,y,z]; L = {x^2, x*y, x*z, y^2, y*z} -C = chainComplex(D, Labels => L) +C = complex(D, Labels => L) assert(C.dd^2 == 0) l = length C assert((for i to l list rank C_i) == for i to l list (fVector D)#i) @@ -312,7 +312,7 @@ assert all(1..l, i -> H_i == 0) TEST /// R = ZZ/101[a..e]; D = simplicialComplex monomialIdeal product gens R -C = chainComplex D +C = complex D assert(C.dd^2 == 0) assert(boundaryMap(5,D) == 0) H = prune HH(C) @@ -328,7 +328,7 @@ D = simplicialComplex {x_0 * x_1 * x_2, x_1 * x_2 * x_3} facets D dual D faces(0,D) -chainComplex D +complex D dual D /// @@ -357,14 +357,14 @@ D = buchbergerSimplicialComplex(L1,R) -- peek D.cache.labels boundaryMap(0,D,Labels=>L1) boundaryMap(1,D,Labels=>L1) -C = chainComplex(D,Labels=>L1) +C = complex(D,Labels=>L1) assert(C.dd^2 == 0) prune(HH C) assert all(0..dim D, i -> HH_(i+1)(C) == 0) assert(HH_0(C) == S^1/(ideal L1)) assert isHomogeneous C E = lyubeznikSimplicialComplex(L1,R) -B = chainComplex(E,Labels=>L1) +B = complex(E,Labels=>L1) assert(B.dd^2 == 0) assert all(0..dim E, i -> HH_(i+1)(B) == 0) assert(HH_0(B) == S^1/(ideal L1)) @@ -436,7 +436,7 @@ S=ZZ/32003[x,y,z] L={y*z,x^2*z^2,x^2*y^2} R = ZZ/32003[a..c] D = buchbergerSimplicialComplex(L,R) -C = chainComplex(D,Labels=>L) +C = complex(D,Labels=>L) assert(C.dd^2 == 0) betti C prune(HH C) @@ -449,7 +449,7 @@ TEST /// x = getSymbol "x" S = QQ[x_1..x_5]; Delta = simplicialComplex {x_1*x_2*x_3, x_2*x_4, x_3*x_4, x_5}; -C = chainComplex Delta +C = complex Delta C.dd assert(C.dd_0 * C.dd_1 == 0) assert(C.dd_1 * C.dd_2 == 0) @@ -538,11 +538,11 @@ D = simplicialComplex{A_0*A_2*A_3,A_2*A_3*A_4} vertices D S = QQ[x_0..x_3] -- This complex should be a minimal free resolution of ideal {S_0*S_1,S_3,S_1*S_2,S_0*S_2} -C = chainComplex(D,Labels => {S_0*S_1,S_3,S_1*S_2,S_0*S_2}) +C = complex(D,Labels => {S_0*S_1,S_3,S_1*S_2,S_0*S_2}) assert((for i to length C list rank C_i) === fVector D) assert all(1..length C, i -> ((homology C)_i == 0)) -- This complex is not a minimal free resolution. It is not even exact. -C = chainComplex(D,Labels => {S_3,S_0*S_1,S_1*S_2,S_0*S_2}) +C = complex(D,Labels => {S_3,S_0*S_1,S_1*S_2,S_0*S_2}) assert(not (homology C)_1 == 0) /// @@ -568,17 +568,17 @@ assert (ring image g === ring D) ------------------------------------------------------------------------------ --- Testing chainComplex of a simplicial map +-- Testing complex of a simplicial map TEST /// R = QQ[a,b,c,d,e,f] D = simplicialComplex({a*b*c, b*c*d, d*e*f}) D' = simplicialComplex({a*b*c, c*d, d*e*f}) phi = map(D, D', {a,b,c,d,e,f}) assert isWellDefined phi -Phi = chainComplex phi +Phi = complex phi assert (Phi * (source Phi).dd == (target Phi).dd * Phi) -assert ((source Phi) === (chainComplex D')) -assert ((target Phi) === (chainComplex D)) +assert ((source Phi) === (complex D')) +assert ((target Phi) === (complex D)) /// @@ -601,7 +601,7 @@ assert((prune homology I)_1 == matrix{{1_(coefficientRing D)}}) /// ------------------------------------------------------------------------------ --- Testing more chainComplex maps +-- Testing more complex maps -- These examples come from Munkres' Algebraic Topology -- Example 1 of Ch. 1, Sec. 12, page 63-64. TEST /// @@ -616,16 +616,16 @@ Torus = simplicialComplex{ S = ZZ[y_0..y_5] Circle = simplicialComplex(for i to 5 list S_i*S_((i+1)%6)) f = map(Torus,Circle,matrix{{R_0,R_4,R_3,R_3,R_4,R_6}}) -Cf = chainComplex f +Cf = complex f CCircle = source Cf CTorus = target Cf assert not isInjective f assert all(1, i -> Cf_(i-1)*CCircle.dd_i == CTorus.dd_i*Cf_i ) g = map(Torus,Circle,matrix{{R_0,R_1,R_2,R_0,R_4,R_3}}) -Cg = chainComplex g +Cg = complex g assert all(1, i -> Cg_(i-1)*CCircle.dd_i == CTorus.dd_i*Cg_i) h = map(Torus,Circle,matrix{{R_0,R_7,R_8,R_5,R_5,R_0}}) -Ch = chainComplex h +Ch = complex h assert all(1, i -> Ch_(i-1)*CCircle.dd_i == CTorus.dd_i*Ch_i) /// From 9377a04c58300ccd299aa2a4ee43f6a208ec9984 Mon Sep 17 00:00:00 2001 From: Mike Stillman Date: Mon, 22 Jul 2024 13:29:21 -0400 Subject: [PATCH 5/9] minors changes to CellularResolution package to get working with Complexes --- M2/Macaulay2/packages/CellularResolutions.m2 | 28 ++++----- .../packages/CellularResolutions/doc.m2 | 50 ++++++++-------- .../packages/CellularResolutions/tests.m2 | 58 +++++++++---------- 3 files changed, 67 insertions(+), 69 deletions(-) diff --git a/M2/Macaulay2/packages/CellularResolutions.m2 b/M2/Macaulay2/packages/CellularResolutions.m2 index 6a48ad33b0b..5a93200a5a4 100644 --- a/M2/Macaulay2/packages/CellularResolutions.m2 +++ b/M2/Macaulay2/packages/CellularResolutions.m2 @@ -28,7 +28,7 @@ export {--types "cellLabel", "hullComplex", "isCycle", - "isFree", +-- "isFree", "isMinimal", "isSimplex", "newCell", @@ -42,8 +42,8 @@ export {--types "CellDimension", "InferLabels", "LabelRing", - "Reduced", - "Prune" + "Reduced" + --"Prune" } protect labelRing protect label @@ -418,17 +418,17 @@ boundaryMap(ZZ,CellComplex) := opts -> (r,cellComplex) -> ( sparseBlockMap(codomain,domain,new HashTable from L) ); -chainComplex(CellComplex) := {Reduced=>true, Prune=>true} >> o -> (cellComplex) -> ( - if not cellComplex.cache.?chainComplex then ( - cellComplex.cache.chainComplex = - (chainComplex apply(max((dim cellComplex) + 1,1), r -> boundaryMap(r,cellComplex)))[1] +complex(CellComplex) := {Reduced=>true, Prune=>true} >> o -> (cellComplex) -> ( + if not cellComplex.cache.?complex then ( + cellComplex.cache.complex = + (complex apply(max((dim cellComplex) + 1,1), r -> boundaryMap(r,cellComplex)))[1] ); ret := if not o.Reduced then ( - Ccopy := chainComplex apply(max cellComplex.cache.chainComplex, - i -> cellComplex.cache.chainComplex.dd_(i+1)); + Ccopy := complex apply(max cellComplex.cache.complex, + i -> cellComplex.cache.complex.dd_(i+1)); Ccopy ) - else cellComplex.cache.chainComplex; + else cellComplex.cache.complex; if o.Prune then ( prune ret --how expensive is prune? should it be cached? ) @@ -437,16 +437,16 @@ chainComplex(CellComplex) := {Reduced=>true, Prune=>true} >> o -> (cellComplex) --Get homology directly from cell complex homology(ZZ,CellComplex) := opts -> (i,cellComplex) -> ( - homology_i chainComplex(cellComplex) + homology_i complex(cellComplex) ); homology(CellComplex) := opts -> (cellComplex) -> ( - homology chainComplex(cellComplex) + homology complex(cellComplex) ); --Get cohomology directly from cell complex cohomology(ZZ,CellComplex) := opts -> (i,cellComplex) -> ( - cohomology_i Hom(chainComplex(cellComplex),cellComplex.labelRing^1) + cohomology_i Hom(complex(cellComplex),cellComplex.labelRing^1) ); ---------- @@ -516,7 +516,7 @@ facePoset(CellComplex) := (cellComplex) -> ( -- Minimality ------------- -isFree = method(TypicalValue => Boolean); +--isFree = method(TypicalValue => Boolean); --check if all the labels are free modules isFree(CellComplex) := (cellComplex) -> ( R := cellComplex.labelRing; diff --git a/M2/Macaulay2/packages/CellularResolutions/doc.m2 b/M2/Macaulay2/packages/CellularResolutions/doc.m2 index e6175f77c4d..2185991e55b 100644 --- a/M2/Macaulay2/packages/CellularResolutions/doc.m2 +++ b/M2/Macaulay2/packages/CellularResolutions/doc.m2 @@ -51,7 +51,7 @@ doc /// This class represents a single cell in a cell complex. A cell has a boundary, a dimension, and a label. In most cases, the label should be a monomial. But the cells in this package may be anything. - However for functions such as @TO chainComplex@ to work, the labels + However for functions such as @TO complex@ to work, the labels should be either monomials, ideals, or modules. In the monomial case, we can view the label as a module by taking the submodule generated by the monomial in the ring. There should be @@ -541,21 +541,20 @@ doc /// d2 = boundaryMap_2 C assert(d1*d2==0) SeeAlso - (chainComplex,CellComplex) - (chainComplex,SimplicialComplex) + (complex,CellComplex) + (complex,SimplicialComplex) /// doc /// Key - (chainComplex,CellComplex) + (complex,CellComplex) Reduced - [(chainComplex,CellComplex),Reduced] - Prune - [(chainComplex,CellComplex),Prune] + [(complex,CellComplex),Reduced] + [(complex,CellComplex),Prune] Headline compute the cellular chain complex for a cell complex Usage - chainComplex C + complex C Inputs C : CellComplex the cell complex for which to compute the chain complex @@ -564,7 +563,7 @@ doc /// Prune => Boolean that controls whether the modules in the chain complex are pruned Outputs - : ChainComplex + : Complex the dimension of the complex Description Text @@ -573,15 +572,15 @@ doc /// cell complex will be a complex of modules over the ring associated to the cell complex. By default, the option "Reduced" is set to true, so - the resulting ChainComplex has a rank 1 free module in homological degree -1. + the resulting Complex has a rank 1 free module in homological degree -1. Example R = QQ[x] a = newSimplexCell({},x); b1 = newCell {a,a}; b2 = newCell {a,a}; C = cellComplex(R,{b1,b2}); - chainComplex C - chainComplex(C,Reduced=>false) + complex C + complex(C,Reduced=>false) Text For details see Combinatorial Commutative Algebra Section 4.1. If we restrict to the case of monomial labels, then, subject to @@ -601,8 +600,8 @@ doc /// eyz = newSimplexCell({vy,vz}); f = newSimplexCell({exy,exz,eyz}); C = cellComplex(R,{f}); - betti chainComplex(C)[-1] - assert(betti chainComplex(C)[-1] == betti res I); + betti complex(C)[-1] + assert(betti complex(C)[-1] == betti res I); Text The option "Prune," also defaulted to true, controls whether the modules in the complex are pruned before being returned. With the "Prune" option set to the default of true, @@ -614,11 +613,11 @@ doc /// b = newSimplexCell({},y); e = newCell {a,b}; C = cellComplex(R,{e}); - chainComplex C - chainComplex(C,Prune=>false) + complex C + complex(C,Prune=>false) SeeAlso (boundaryMap,ZZ,CellComplex) - (chainComplex,SimplicialComplex) + (complex,SimplicialComplex) (homology,CellComplex) (homology,ZZ,CellComplex) (cohomology,ZZ,CellComplex) @@ -664,7 +663,7 @@ doc /// prune oo SeeAlso (homology,ZZ,CellComplex) - (chainComplex,CellComplex) + (complex,CellComplex) /// doc /// @@ -712,7 +711,7 @@ doc /// SeeAlso (homology,CellComplex) (cohomology,ZZ,CellComplex) - (chainComplex,CellComplex) + (complex,CellComplex) /// doc /// @@ -756,7 +755,7 @@ doc /// SeeAlso (homology,CellComplex) (homology,ZZ,CellComplex) - (chainComplex,CellComplex) + (complex,CellComplex) /// doc /// @@ -920,7 +919,6 @@ doc /// doc /// Key - isFree (isFree,CellComplex) Headline checks if the labels of a cell complex are free modules @@ -1134,7 +1132,7 @@ doc /// Example S = cellComplexSphere(QQ,3) cells(S) - chainComplex S + complex S prune homology S SeeAlso cellComplexRPn @@ -1238,12 +1236,12 @@ doc /// S = QQ[x,y,z]; I = monomialIdeal (x^2*z, x*y*z, y^2*z, x^3*y^5, x^4*y^4, x^5*y^3); H = hullComplex I - chainComplex H + complex H cells(1,H)/cellLabel cells(2,H)/cellLabel isMinimal H H2 = hullComplex (3/2,I) - prune HH chainComplex H2 + prune HH complex H2 SeeAlso (taylorComplex,MonomialIdeal) /// @@ -1271,7 +1269,7 @@ doc /// S = QQ[x,y,z]; I = monomialIdeal (x^2, y^2, z^2); T = taylorComplex I - C = chainComplex T + C = complex T C.dd SeeAlso (hullComplex,MonomialIdeal) @@ -1300,7 +1298,7 @@ doc /// S = QQ[x,y,z]; I = monomialIdeal (x^2*z, x*y*z, y^2*z, x^3*y^5, x^4*y^4, x^5*y^3); C = scarfComplex I - chainComplex C + complex C cells(1,C)/cellLabel cells(2,C)/cellLabel isMinimal C diff --git a/M2/Macaulay2/packages/CellularResolutions/tests.m2 b/M2/Macaulay2/packages/CellularResolutions/tests.m2 index f72a622ea4c..a41d06fb5c2 100644 --- a/M2/Macaulay2/packages/CellularResolutions/tests.m2 +++ b/M2/Macaulay2/packages/CellularResolutions/tests.m2 @@ -6,7 +6,7 @@ assert(isWellDefined e); assert(dim e === -infinity); assert(#maxCells e == 0); assert(#maxCells skeleton(0,e) == 0); -chainComplex e; +complex e; /// @@ -27,10 +27,10 @@ assert(l1=!=l2); assert(dim l1==1); assert(dim l2==1); C = cellComplex(QQ,{l1,l2}); -CchainComplex = chainComplex C; -assert(HH_0(CchainComplex)==0); -assert(prune HH_1(CchainComplex)==QQ^1); -assert(HH_2(CchainComplex)==0); +Ccomplex = complex C; +assert(HH_0(Ccomplex)==0); +assert(prune HH_1(Ccomplex)==QQ^1); +assert(HH_2(Ccomplex)==0); f1 = newCell {l1,l2}; C = cellComplex(QQ,{f1}); assert(dim C==2); @@ -48,11 +48,11 @@ assert(rank source del2 == 1); assert(rank target del2 == 2); assert(rank del2 == 1); assert(del100 == map(QQ^0,QQ^0,{})); -CchainComplex = chainComplex C; -assert(HH_0(CchainComplex)==0); -assert(HH_1(CchainComplex)==0); -assert(HH_2(CchainComplex)==0); -assert(HH C == HH CchainComplex); +Ccomplex = complex C; +assert(HH_0(Ccomplex)==0); +assert(HH_1(Ccomplex)==0); +assert(HH_2(Ccomplex)==0); +assert(HH C == HH Ccomplex); assert(isFree(C)); /// @@ -63,11 +63,11 @@ l = newCell {v,v}; f = newCell {(l,1),(l,1)}; C = cellComplex(ZZ,{f}); assert(dim C===2); -prune HH chainComplex C +prune HH complex C assert(HH_0 C == 0); -assert(homology(0,chainComplex(C,Reduced=>false))==ZZ^1); -assert(homology(1,chainComplex(C,Reduced=>false))==ZZ^1/(2*ZZ^1)); -assert(HH_1 chainComplex C == cokernel matrix {{2}}) +assert(homology(0,complex(C,Reduced=>false))==ZZ^1); +assert(homology(1,complex(C,Reduced=>false))==ZZ^1/(2*ZZ^1)); +assert(HH_1 complex C == cokernel matrix {{2}}) assert(HH^2 C == cokernel matrix {{2}}); assert(HH^1 C == 0); assert(dim skeleton_1 C == 1); @@ -82,11 +82,11 @@ assert(dim D == 1); assert(isSimplex a); assert(not isSimplex b1); assert(not isSimplex b2); -DchainComplex = chainComplex D; -assert(HH_0(DchainComplex)==0); +Dcomplex = complex D; +assert(HH_0(Dcomplex)==0); R = ring D; -assert(prune HH_1(DchainComplex)==R^2); -assert(HH_2(DchainComplex)==0); +assert(prune HH_1(Dcomplex)==R^2); +assert(HH_2(Dcomplex)==0); /// @@ -133,7 +133,7 @@ lxz = newSimplexCell({vx,vz}); fxyz = newSimplexCell({lxy,lyz,lxz}); assert(cellLabel fxyz === x*y*z); D = cellComplex(R,{fxyz}); -C = (chainComplex D); +C = (complex D); assert(HH_(-1)(C)==cokernel matrix {{x,y,z}}); assert(C.dd^2==0); assert(degrees C_0 == {{1}, {1}, {1}}); @@ -150,7 +150,7 @@ lyz = newSimplexCell({vy,vz}); lxz = newSimplexCell({vx,vz}); fxyz = newSimplexCell({lxy,lyz,lxz}); D = cellComplex(R,{fxyz}); -C = (chainComplex D)[-1]; +C = (complex D)[-1]; assert(HH_0(C)==R^1/module ideal(x,y,z)) assert(HH_1(C)==0) assert(C.dd^2==0); @@ -167,7 +167,7 @@ lyz = newSimplexCell {vy,vz}; lxz = newSimplexCell {vx,vz}; fxyz = newSimplexCell {lxy,lyz,lxz}; D = cellComplex(R,{fxyz}); -C = (chainComplex D)[-1]; +C = (complex D)[-1]; assert(C.dd^2==0); assert(not isFree(D)); /// @@ -210,7 +210,7 @@ assert(# cells(3,C)==1); assert(HH_1(C)==0); assert(HH_2(C)==0); assert(HH_3(C)==0); -assert((chainComplex C).dd^2==0); +assert((complex C).dd^2==0); C1 = skeleton(1,C); assert(dim C1 == 1); assert(rank HH_1 C1 == 5); @@ -353,7 +353,7 @@ C = cellComplex(R,P); S = ZZ[x]; f = map(S,R,{}); D = f**C; -chainD = chainComplex D; +chainD = complex D; assert(ring chainD === S); assert(HH_1(D)==0); assert(HH_2(D)==0); @@ -432,7 +432,7 @@ e23 = newCell({v2,v3}); e14 = newCell({v1,v4}); f123 = newCell({e12,e13,e23}); Delta = cellComplex(S, {f123,e14}); -C = chainComplex Delta; +C = complex Delta; assert (dim Delta == 2); assert (length C == 3); /// @@ -471,7 +471,7 @@ m = product(apply(numgens S, i -> S_i)); G = apply(max X, l -> m//product(apply(l,i -> S_i))); H = hashTable apply(#G, i -> (j := F#i#0#0;((vertices P)_j,G_i))) C = cellComplex(S,P,Labels => H); -Cres = (chainComplex C)[-1]; +Cres = (complex C)[-1]; assert(betti (res B) == betti Cres); assert(HH_0 Cres == S^1/B); assert(HH_1 Cres == 0); @@ -484,12 +484,12 @@ TEST /// R = QQ[x,y,z]; I = monomialIdeal (x^2*z, x*y*z, y^2*z, x^3*y^5, x^4*y^4, x^5*y^3); H = hullComplex I; -chainComplex H; +complex H; assert(isMinimal H); -assert(HH_(-1) chainComplex H == R^1/I); -assert((HH_0 chainComplex H)==0); +assert(HH_(-1) complex H == R^1/I); +assert((HH_0 complex H)==0); H2 = hullComplex (3/2,I) -assert((HH_0 chainComplex H2)!=0); +assert((HH_0 complex H2)!=0); /// --isWellDefined test From 736f5f4a3c42a23d9c623aa523189a047f0cdfb5 Mon Sep 17 00:00:00 2001 From: Mike Stillman Date: Fri, 13 Sep 2024 12:47:08 -0400 Subject: [PATCH 6/9] Minor change to ReactionNetworks to make unused function local, to not conflict with Complexes package --- M2/Macaulay2/packages/ReactionNetworks.m2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/M2/Macaulay2/packages/ReactionNetworks.m2 b/M2/Macaulay2/packages/ReactionNetworks.m2 index 09ae0ff7a50..802ed65a886 100644 --- a/M2/Macaulay2/packages/ReactionNetworks.m2 +++ b/M2/Macaulay2/packages/ReactionNetworks.m2 @@ -442,7 +442,7 @@ assert(stoichSubspaceKer CRN == mingens image transpose matrix{{2,1,-1,1,0},{-2,-1,2,0,1}}) /// -concentration = (species,N,R) -> R_(position(N.Species, s->s==species)) +concentration := (species,N,R) -> R_(position(N.Species, s->s==species)) --I think this is part of the code that is a problem termInp = (a,inp,out,N,R) -> if member(a,inp/first) then ( From 4586c04b777d147a1ca6503bfb3be5bb117ce62f Mon Sep 17 00:00:00 2001 From: Mike Stillman Date: Mon, 16 Sep 2024 16:44:26 -0400 Subject: [PATCH 7/9] Very minor changes to several packages to get their examples to work with Complexes package (InvolutiveBases, Posets, RandomComplexes, SpectralSequences, one Macaulay2Doc doc node) --- M2/Macaulay2/packages/InvolutiveBases.m2 | 8 ++++---- .../Macaulay2Doc/functions/cohomology-doc.m2 | 2 +- M2/Macaulay2/packages/Posets.m2 | 4 ++-- M2/Macaulay2/packages/RandomComplexes.m2 | 2 +- M2/Macaulay2/packages/SpectralSequences.m2 | 16 ++++++++-------- 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/M2/Macaulay2/packages/InvolutiveBases.m2 b/M2/Macaulay2/packages/InvolutiveBases.m2 index bfb5bddcd7d..272bb547cd6 100644 --- a/M2/Macaulay2/packages/InvolutiveBases.m2 +++ b/M2/Macaulay2/packages/InvolutiveBases.m2 @@ -13,7 +13,7 @@ newPackage( Email => "daniel@momo.math.rwth-aachen.de", HomePage => "http://wwwb.math.rwth-aachen.de/~daniel/"}}, Headline => "Methods for Janet bases and Pommaret bases in Macaulay 2", - PackageImports => { "Complexes" }, + PackageExports => { "Complexes" }, Keywords => {"Groebner Basis Algorithms"}, DebuggingMode => false ) @@ -846,7 +846,7 @@ document { EXAMPLE lines /// R = QQ[x,y,z]; I = ideal(x,y,z); - C = res(I, Strategy => Involutive) + C = freeResolution(I, Strategy => Involutive) multVar(C, 2) ///, EXAMPLE lines /// @@ -897,7 +897,7 @@ document { EXAMPLE lines /// R = QQ[x,y,z]; I = ideal(x,y,z); - C = res(I, Strategy => Involutive) + C = freeResolution(I, Strategy => Involutive) janetBasis(C, 2) ///, SeeAlso => {janetMultVar,pommaretMultVar,isPommaretBasis,invReduce,invSyzygies,janetResolution} @@ -1200,7 +1200,7 @@ document { EXAMPLE lines /// R = QQ[x,y,z]; I = ideal(x,y,z); - res(I, Strategy => Involutive) + freeResolution(I, Strategy => Involutive) ///, SeeAlso => {janetBasis,multVar,invSyzygies} } diff --git a/M2/Macaulay2/packages/Macaulay2Doc/functions/cohomology-doc.m2 b/M2/Macaulay2/packages/Macaulay2Doc/functions/cohomology-doc.m2 index baf9106c876..c9fabc061c2 100644 --- a/M2/Macaulay2/packages/Macaulay2Doc/functions/cohomology-doc.m2 +++ b/M2/Macaulay2/packages/Macaulay2Doc/functions/cohomology-doc.m2 @@ -104,7 +104,7 @@ document { "needsPackage \"SimplicialComplexes\"", "R = QQ[a..d]", "D = simplicialComplex {a*b*c,a*b*d,a*c*d,b*c*d}", - "C = chainComplex D", + "C = complex D", "HH_2 C", "prune oo" }, diff --git a/M2/Macaulay2/packages/Posets.m2 b/M2/Macaulay2/packages/Posets.m2 index 42e3225c250..82478fe3256 100644 --- a/M2/Macaulay2/packages/Posets.m2 +++ b/M2/Macaulay2/packages/Posets.m2 @@ -1011,7 +1011,7 @@ resolutionPoset = method() resolutionPoset Complex := Poset => C -> poset flatten flatten apply(sort unique (first \ keys betti C), d -> for r to numrows C.dd_d - 1 list for c to numcols C.dd_d - 1 list if C.dd_d_(r,c) != 0 then {{d-1,r}, {d,c}} else continue) resolutionPoset MonomialIdeal := Poset => I -> ( - P := resolutionPoset res I; + P := resolutionPoset freeResolution I; cvrs := applyValues(partition(last, coveringRelations P), v -> last \ first \ v); lbl := {{{0,0} => {0,0}}, apply(#I_*, i -> {1,i} => I_i)}; for r in drop(rankPoset P, 2) do lbl = append(lbl, for v in r list v => lcm (last \ (last lbl)_(cvrs#v))); @@ -3850,7 +3850,7 @@ doc /// component of the resolution. Example R = QQ[x,y,z]; - C = res ideal(y*z,x*z,x^2*y) + C = freeResolution ideal(y*z,x*z,x^2*y) resolutionPoset C (resolutionPoset C).GroundSet Text diff --git a/M2/Macaulay2/packages/RandomComplexes.m2 b/M2/Macaulay2/packages/RandomComplexes.m2 index 6bd7046b1a4..eb4918ac697 100644 --- a/M2/Macaulay2/packages/RandomComplexes.m2 +++ b/M2/Macaulay2/packages/RandomComplexes.m2 @@ -194,7 +194,7 @@ randomSimplicialComplex(ZZ,ZZ):= (k,n) -> ( N:=#sets-k-2; I:=monomialIdeal apply(apply(n,i->sets_(random(N)+k+2)),s->product(s,i->x_i)); c:=simplicialComplex I; - CQ:=chainComplex c; + CQ:=chainComplex complex c; C:=(chainComplex apply(length CQ-1,i->lift(CQ.dd_(i+1),ZZ))) ) diff --git a/M2/Macaulay2/packages/SpectralSequences.m2 b/M2/Macaulay2/packages/SpectralSequences.m2 index 2a00aca99c6..5da4de6ece1 100644 --- a/M2/Macaulay2/packages/SpectralSequences.m2 +++ b/M2/Macaulay2/packages/SpectralSequences.m2 @@ -296,11 +296,11 @@ filteredComplex(List) := FilteredComplex => opts -> L -> ( if all(#L, p -> class L#p === SimplicialComplex) then ( kk := coefficientRing L#0; if opts.ReducedHomology == true then ( - C = chainComplex L#0; -- By default the ambient simplicial complex is the first element of the list - maps = apply(#L-1, p -> map(C, chainComplex L#(p+1), + C = chainComplex complex L#0; -- By default the ambient simplicial complex is the first element of the list + maps = apply(#L-1, p -> map(C, chainComplex complex L#(p+1), i -> sub(contract(transpose matrix{faces(i,L#0)}, matrix{faces(i,L#(p+1))}), kk)))) - else (C = truncate(chainComplex L#0,1); -- By default the ambient simplicial complex is the first element of the list - maps = apply(#L-1, p -> map(C, truncate(chainComplex L#(p+1),1), + else (C = truncate(chainComplex complex L#0,1); -- By default the ambient simplicial complex is the first element of the list + maps = apply(#L-1, p -> map(C, truncate(chainComplex complex L#(p+1),1), i -> sub(contract(transpose matrix{faces(i,L#0)}, matrix{faces(i,L#(p+1))}), kk)))) ) else ( @@ -1566,7 +1566,7 @@ doc /// Text We can check that the homology of the simplicial complex twoSphere agrees with that of $\mathbb{S}^2$. Example - C = truncate(chainComplex twoSphere,1) + C = truncate(chainComplex complex twoSphere,1) prune HH C Text We now write down our simplicial complex whose topological realization @@ -1578,7 +1578,7 @@ doc /// Again we can check that we've entered a simplicial complex whose homology agrees with that of the real projective plane. Example - B = truncate(chainComplex realProjectivePlane,1) + B = truncate(chainComplex complex realProjectivePlane,1) prune HH B Text We now compute the fibers of the anti-podal quotient map @@ -1633,7 +1633,7 @@ doc/// We can check that the homology of this simplicial complex agrees with that of the Klein Bottle: Example - C = truncate(chainComplex Delta,1) + C = truncate(chainComplex complex Delta,1) prune HH C Text Let $S$ be the simplicial complex with facets $\{A_0 A_1, A_0 A_2, A_1 A_2\}$. Then $S$ is a triangulation of $S^1$. The simplicial map @@ -1684,7 +1684,7 @@ doc /// $\Delta$ agrees with that of the torus $\mathbb{S}^1 \times \mathbb{S}^1 $ Example - C = truncate(chainComplex Delta,1) + C = truncate(chainComplex complex Delta,1) prune HH C Text Let $S$ be the simplicial complex with facets $\{A_0 A_1, A_0 A_2, A_1 A_2\}$. Then $S$ is a triangulation of $S^1$. The simplicial map From 57d80f2882aca3e89170264e3e4a11c11c752a4f Mon Sep 17 00:00:00 2001 From: Mike Stillman Date: Sun, 29 Sep 2024 17:33:40 -0400 Subject: [PATCH 8/9] Fix uses of SimplicialComplexes test in Complexes package to use Complex, not ChainComplex. --- M2/Macaulay2/packages/Complexes/ChainComplexTests.m2 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/M2/Macaulay2/packages/Complexes/ChainComplexTests.m2 b/M2/Macaulay2/packages/Complexes/ChainComplexTests.m2 index 179d6c5d388..e4749c3971b 100644 --- a/M2/Macaulay2/packages/Complexes/ChainComplexTests.m2 +++ b/M2/Macaulay2/packages/Complexes/ChainComplexTests.m2 @@ -2285,8 +2285,8 @@ TEST /// beta = map(E, D, {d,e,f}) assert isWellDefined alpha assert isWellDefined beta - phi = complex chainComplex alpha - psi = complex chainComplex beta + phi = complex alpha + psi = complex beta prune HH phi prune HH psi isNullHomotopic phi From efe049a2d34ccaca27103145aa3f697f3f5263b9 Mon Sep 17 00:00:00 2001 From: Mike Stillman Date: Sun, 29 Sep 2024 21:38:12 -0400 Subject: [PATCH 9/9] missed another test involving SimplicialComplexes: fixed --- M2/Macaulay2/tests/normal/000-core.m2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/M2/Macaulay2/tests/normal/000-core.m2 b/M2/Macaulay2/tests/normal/000-core.m2 index c550abc95d4..5b88121d5fc 100644 --- a/M2/Macaulay2/tests/normal/000-core.m2 +++ b/M2/Macaulay2/tests/normal/000-core.m2 @@ -1033,7 +1033,7 @@ assert try (clean(0.1,A);false) else true -- not yet implemented. needsPackage "SimplicialComplexes" R = QQ[a..d] D = simplicialComplex {a*b*c,a*b*d,a*c*d,b*c*d} -C = chainComplex D +C = complex D assert ( rank HH_2 C == 1 )