Skip to content

Commit

Permalink
Making the code into a proper package + small changes
Browse files Browse the repository at this point in the history
  • Loading branch information
sashahbc committed Feb 12, 2024
1 parent c3538bb commit d8c77b3
Showing 1 changed file with 52 additions and 73 deletions.
125 changes: 52 additions & 73 deletions Toric-BGG/MultigradedBGG.m2
Original file line number Diff line number Diff line change
@@ -1,45 +1,40 @@
-*
newPackage("MultigradedBGG",
Version => "1.1",
Date => "5 June 2023",
Headline => "the multigraded BGG correspondence and differential modules",
Authors => {
{Name => "Maya Banks", Email => "[email protected]", HomePage => "https://sites.google.com/wisc.edu/mayabanks" }
{Name => "Michael K. Brown", Email => "[email protected]", HomePage => "http://webhome.auburn.edu/~mkb0096/" }
{Name => "Daniel Erman", Email => "[email protected]", HomePage => "https://people.math.wisc.edu/~erman/" }
{Name => "Tara Gomes", Email => "[email protected]", HomePage => "Fill in" }
{Name => "Prashanth Sridhar", Email => "[email protected]", HomePage => "https://sites.google.com/view/prashanthsridhar/home" }
{Name => "Eduardo Torres Davila", Email => "[email protected]", HomePage => "https://etdavila10.github.io/" }
{Name => "Maya Banks", Email => "[email protected]", HomePage => "https://sites.google.com/wisc.edu/mayabanks" },
{Name => "Michael K. Brown", Email => "[email protected]", HomePage => "http://webhome.auburn.edu/~mkb0096/" },
{Name => "Daniel Erman", Email => "[email protected]", HomePage => "https://people.math.wisc.edu/~erman/" },
{Name => "Tara Gomes", Email => "[email protected]", HomePage => "Fill in" },
{Name => "Prashanth Sridhar", Email => "[email protected]", HomePage => "https://sites.google.com/view/prashanthsridhar/home"},
{Name => "Eduardo Torres Davila", Email => "[email protected]", HomePage => "https://etdavila10.github.io/" },
{Name => "Sasha Zotine", Email => "[email protected]", HomePage => "https://sites.google.com/view/szotine/home" }
},
PackageExports => {"NormalToricVarieties", "Complexes"},
DebuggingMode => true
)

exports {
export {
--methods
"dualRingToric",
"toricRR"
"toricLL"
"stronglyLinearStrand"
"unfold"
"toricRR",
"toricLL",
"stronglyLinearStrand",
"unfold",
"DifferentialModule",
"differentialModule",
"unfold",
"foldComplex",
"resDM",
"minimizeDM",
"differential"
"differential",
--symbols
"SkewVariable"
}

*-
--todo: make this officially a package, so we'd remove this line.
loadPackage "Complexes"

--------------------------------------------------
--- Differential Modules
--------------------------------------------------

DifferentialModule = new Type of Complex
DifferentialModule.synonym = "differential module"

Expand All @@ -50,8 +45,6 @@ differentialModule Complex := C -> (
--are the same matrix (say of degree d, if there
--is a grading), this matrix squares to 0, C_1 = C_0(-d), and C_{-1} = C_0(d).
new DifferentialModule from C);


differentialModule Matrix := phi -> (
--check if the source and target are the same up to a twist
if phi^2 != 0 then error "The differential does not square to zero.";
Expand Down Expand Up @@ -83,7 +76,6 @@ isFreeModule(DifferentialModule) := D ->(
isFreeModule module D
)


unfold = method();
--Input: a differential module and a pair of integers low and high
--Output: the unfolded chain complex of the differential module, in homological degrees
Expand Down Expand Up @@ -244,22 +236,6 @@ foldComplex(Complex,ZZ) := DifferentialModule => (F,d)->(
--- Toric BGG
--------------------------------------------------

-- Non-exported method for contracting matrices.
-- Input: A pair of matrices (M,N)
-- Output: The effect of contracting M by N.
matrixContract = method()
matrixContract (Matrix,Matrix) := (M,N) -> (
S := ring M;
if M==0 or N==0 then return map(S^(-degrees source N),S^(degrees source M),0);
if rank source M != rank target N then error("--rank of source M and target N differ");
mapmatrix := transpose matrix apply(rank target M, i -> apply(rank source N, j ->
sum(rank source M, k -> contract(M_(i,k),N_(k,j)))
)
);
-- sasha: what the heck? why is there a null input? this doesn't cause errors but i feel like it might
transpose map(S^(-degrees source N), , mapmatrix)
)

-- Exported method for dualizing an algebra.
-- Input: a polynomial ring OR an exterior algebra
-- Output: the Koszul dual exterior algebra, but with an additional
Expand Down Expand Up @@ -294,11 +270,10 @@ dualRingToric PolynomialRing := opts -> S ->(
-- and with the same differential in both spots.
toricRR = method();
toricRR(Module,List) := (N,L) ->(
M = coker presentation N;
M := coker presentation N;
S := ring M;
if not isCommutative S then error "--base ring is not commutative";
if not S.?exterior then S.exterior = dualRingToric(S);
E := S.exterior;
E := dualRingToric S;
-- pick out the generators in the selected degree range.
f0 := matrix {for d in unique L list gens image basis(d,M)};
-- this is the degree of the anti-canonical bundle, which
Expand All @@ -313,7 +288,9 @@ toricRR(Module,List) := (N,L) ->(
newf0 := sub(f0,SE)*tr;
relationsMinSE := sub(relationsM,SE);
newf0 = newf0 % relationsMinSE;
newg := matrixContract(transpose sub(f0,SE),newf0);
newg := contract(transpose sub(f0,SE), newf0);
-- null input is to make the map have the correct degrees to be homogeneous.
newg = transpose map(source newg, , transpose newg);
g' := sub(newg,E);
del := map(E^f0degs,E^f0degs, -g', Degree => degree 1_S | {-1});
differentialModule(complex({del, del})[1])
Expand All @@ -328,15 +305,15 @@ toricRR Module := M -> (
)

-- Exported method for computing the multigraded BGG functor of a module over the exterior algebra.
--Input: N a (multi)-graded E-module.
--Caveat: Assumes N is finitely generated.
--Caveat 2: arrows of toricLL(N) correspond to exterior multiplication (not contraction)
-- Input: N a (multi)-graded E-module.
-- Output: a complex of modules over the polynomial ring.
-- Caveat: Assumes N is finitely generated.
-- Caveat 2: arrows of toricLL(N) correspond to exterior multiplication (not contraction)
toricLL = method();
toricLL Module := N -> (
E := ring N;
if not isSkewCommutative E then error "ring N is not skew commutative";
if not E.?symmetric then E.symmetric = dualRingToric E;
S := E.symmetric;
S := dualRingToric E;
N = coker presentation N;
bb := basis N;
b := degrees source bb;
Expand All @@ -356,7 +333,8 @@ toricLL Module := N -> (
)
)

--todo
-- Exported method for computing a strongly linear strand for a module over a polynomial ring.
-- Inp
stronglyLinearStrand = method();
stronglyLinearStrand Module := M -> (
S := ring M;
Expand All @@ -373,10 +351,7 @@ stronglyLinearStrand Module := M -> (
toricLL N
)

end;


-*
beginDocumentation()

--------------------------------------------------
Expand All @@ -385,25 +360,26 @@ beginDocumentation()

doc ///
Key
DifferentialModules
MultigradedBGG
Headline
Package for Computing Free Resolutions of Differential Modules
Package for working with Multigraded BGG and Differential Modules
Description
Text
Blah blah blah
todo
///


doc ///
Key
differentialModule
(differentialModule, map)
(differentialModule, Matrix)
Headline
converts a square zero matrix into a differential module
Usage
differentialModule(f)
Inputs
f: module map with the same source and target
f : Matrix
representing a module map with the same source and target
Outputs
: DifferentialModule
Description
Expand Down Expand Up @@ -464,12 +440,12 @@ doc ///
(flag) differential module of degree d.
Example
R = QQ[x,y];
C = res ideal(x,y)
C = complex res ideal(x,y)
D = foldComplex(C,0);
D.dd_1
///

-*
doc ///
Key
resDM
Expand Down Expand Up @@ -507,18 +483,20 @@ doc ///
r = resDM(D,LengthLimit => 6)
r.dd_1
///
*-

--todo: since resKC has been combined with resDM, which of these doc nodes is needed? can we cut
-- some of the above into this node?
doc ///
Key
resKC
(resKC,DifferentialModule)
(resKC,DifferentialModule,ZZ)
resDM
(resDM,DifferentialModule)
(resDM,DifferentialModule,ZZ)
Headline
uses a killing cycles style construction to find a free resolution of a differential module
Usage
resKC(D)
resKC(D,k)
resDM(D)
resDM(D,k)
Inputs
D: DifferentialModule
k: ZZ
Expand All @@ -527,15 +505,15 @@ doc ///
Description
Text
Given a differential module D it creates a free flag resolution of D, using a killing cycles
construction. Because of issues with adding options, there are two chocies. The defualt
resKC(D) runs the algorithm for the number of steps determined by the dimension of the ambient ring.
resKC(D,k) for k steps.
construction. Because of issues with adding options, there are two chocies. The default
resDM(D) runs the algorithm for the number of steps determined by the dimension of the ambient ring.
resDM(D,k) for k steps.
Example
R = QQ[x,y];
M = R^1/ideal(x^2,y^2);
phi = map(M,M,x*y, Degree=>2);
D = differentialModule phi;
r = resKC(D)
r = resDM(D)
r.dd_1
Text
The default algorithm runs for dim R + 1 steps, again because I couldn't figure out the options.
Expand All @@ -544,9 +522,9 @@ doc ///
R = QQ[x]/(x^3);
phi = map(R^1,R^1,x^2, Degree=>2);
D = differentialModule phi;
r = resKC(D)
r = resDM(D)
r.dd_1
r = resKC(D,6)
r = resDM(D,6)
r.dd_1
///

Expand Down Expand Up @@ -586,7 +564,7 @@ doc ///
M = R^1/ideal(x^2,y^2);
phi = map(M,M,x*y, Degree=>2);
D = differentialModule phi;
r = resKC(D)
r = resDM(D)
r.dd_1
mr = minimizeDM(r)
mr.dd_1
Expand Down Expand Up @@ -636,7 +614,7 @@ doc ///
Example
S = ZZ/101[x,y,z, Degrees => {1,1,2}]
E' = dualRingToric S
coefficientRing E' == coefficientRing S
coefficientRing E' === coefficientRing S
///

doc ///
Expand Down Expand Up @@ -922,3 +900,4 @@ M = coker matrix{{x_1, x_2^2}}
L = stronglyLinearStrand(M)
assert(L == koszulComplex {x_1})
///

0 comments on commit d8c77b3

Please sign in to comment.