Skip to content

Commit

Permalink
Merge branch 'Varieties' of https://github.com/Macaulay2/Workshop-202…
Browse files Browse the repository at this point in the history
…4-Utah into Varieties
  • Loading branch information
johndcobb committed Jun 4, 2024
2 parents 57defc6 + 6d1d5d5 commit 730ee50
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 137 deletions.
11 changes: 6 additions & 5 deletions packages/Complexes/ChainComplex.m2
Original file line number Diff line number Diff line change
Expand Up @@ -721,8 +721,8 @@ importFrom_Truncations { "inducedTruncationMap" }
truncateModuleOpts := options(truncate, List, Module)
truncate(ZZ, Complex) :=
truncate(List, Complex) := Complex => truncateModuleOpts >> opts -> (degs, C) -> (
(lo, hi) := concentration C;
if lo === hi then return complex truncate(degs, C_lo, opts);
(lo, hi) := C.concentration;
if lo == hi then return complex(truncate(degs, C_lo, opts), Base => lo);
f := truncate(degs, dd^C_lo, opts);
complex hashTable for i from lo+1 to hi list i => (
f = inducedTruncationMap(source f, truncate(degs, C_i, opts), dd^C_i))
Expand All @@ -733,9 +733,10 @@ truncate(List, Complex) := Complex => truncateModuleOpts >> opts -> (degs, C) ->
--------------------------------------------------------------------
basis(ZZ, Complex) :=
basis(List, Complex) := Complex => opts -> (deg, C) -> (
(a,b) := concentration C;
L := for i from a+1 to b list basis(deg, C.dd_i, opts);
complex(L, Base => a))
(lo, hi) := C.concentration;
if lo == hi
then complex(basis(deg, C_lo, opts), Base => lo)
else complex applyValues(C.dd.map, f -> basis(deg, C.dd_i, opts)))

--------------------------------------------------------------------
-- homology --------------------------------------------------------
Expand Down
7 changes: 4 additions & 3 deletions packages/Varieties.m2
Original file line number Diff line number Diff line change
Expand Up @@ -509,9 +509,10 @@ flattenMorphism = f -> (
-- TODO: why doesn't lift(f, ring g) do this automatically?
map(target f ** S, source f ** S, lift(cover f, S)) ** cokernel g)
flattenComplex = C -> (
(lo,hi) := concentration C;
complex(for i from lo+1 to hi list flattenMorphism(C.dd_i), Base => lo)
)
(lo, hi) := C.concentration;
if lo === hi
then complex(flattenModule C_lo, Base => lo)
else complex applyValues(C.dd.map, flattenMorphism))

-- TODO: this is called twice
-- TODO: implement for multigraded ring
Expand Down
148 changes: 19 additions & 129 deletions packages/Varieties/SheafComplexes.m2
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ export {
-- Local utilities
-----------------------------------------------------------------------------

freeResolution' = X -> freeResolution(X, LengthLimit => 5)
clearHom = (M, N) -> (
H := youngest(M.cache.cache, N.cache.cache);
apply(keys H, k -> remove(H, k)))

freeResolution' = X -> freeResolution(X, LengthLimit => 3)

-----------------------------------------------------------------------------
-- Basic constructors for complexes of sheaves
Expand Down Expand Up @@ -46,6 +50,8 @@ isSheafComplex = C -> instance(C_(C.concentration#0), CoherentSheaf)

sheaf Complex := Complex => C -> C.cache.sheaf ??= (
if isSheafComplex C then return C;
(lo, hi) := C.concentration;
if lo === hi then return complex(sheaf C_lo, Base => lo);
D := complex applyValues(C.dd.map, sheaf);
D.cache.module = C;
D)
Expand All @@ -60,6 +66,8 @@ sheaf ComplexMap := ComplexMap => phi -> phi.cache.sheaf ??= (

module Complex := Complex => D -> D.cache.module ??= (
if not isSheafComplex D then return D;
(lo, hi) := D.concentration;
if lo === hi then return complex(module D_lo, Base => lo);
maxTruncDeg := max apply(values D.dd.map, f -> f.degree);
C := complex applyValues(D.dd.map, f -> truncate(maxTruncDeg, f.map));
C.cache.sheaf = D;
Expand All @@ -76,6 +84,7 @@ module ComplexMap := ComplexMap => phi -> phi.cache.module ??= (

-- TODO: move to Complexes
freeResolution Complex := Complex => opts -> C -> resolution(C, opts)
complex Complex := Complex => opts -> identity

sheafRes = method(Options => options freeResolution)
sheafRes Complex :=
Expand Down Expand Up @@ -137,7 +146,10 @@ sheafDual = method();
sheafDual Complex := Complex => (C) -> sheafHom(C, sheaf (ring C)^1)

RHom = method()
RHom(Complex, Complex) := Complex => (C, D) -> (
RHom(CoherentSheaf, CoherentSheaf) :=
RHom(CoherentSheaf, Complex) :=
RHom(Complex, CoherentSheaf) := Complex => (C, D) -> RHom(complex C, complex D)
RHom(Complex, Complex) := Complex => (C, D) -> (
(loC, hiC) := C.concentration;
if not instance(variety C_loC, ProjectiveVariety)
then error "expected sheaves on a projective variety";
Expand All @@ -158,73 +170,14 @@ RHom(Complex, Complex) := Complex => (C, D) -> (
a := max for i from 0 to length(Resns)-1 list max apply(n - L_i .. P_i, j-> (max degrees (Resns_i)_j)#0 - j);
r := a - l + 1;
M = truncate(r, M));
cxToField basis(0, Hom(res M, N))
)

RHom(CoherentSheaf, Complex) := Complex => (C, D) -> (
if not instance(variety C, ProjectiveVariety)
then error "expected sheaves on a projective variety";
M := flattenModule module C;
N := flattenComplex module D;
R := ring M;
if not isAffineRing R
then error "expected sheaves on a variety over a field";
H := prune HH N;
(loH, hiH) := concentration H;
L := for i from loH to hiH list dim H_i;
l := max L;
Resns := for i from loH to hiH list resolution flattenModule H_i;
P := for i in Resns list length i;
p := max P;
n := dim ring (H_loH) - 1;
if p >= n - l then (
a := max for i from 0 to length(Resns)-1 list max apply(n - L_i .. P_i, j-> (max degrees (Resns_i)_j)#0 - j);
r := a - l + 1;
M = truncate(r, M));
cxToField basis(0, Hom(freeResolution' M, N))
)

RHom(Complex, CoherentSheaf) := Complex => (C,D) -> (
(loC, hiC) := C.concentration;
if not instance(variety C_loC, ProjectiveVariety)
then error "expected sheaves on a projective variety";
M := flattenComplex module C;
N := flattenModule module D;
R := ring M;
if not isAffineRing R
then error "expected sheaves on a variety over a field";
l := dim N;
Resns := res N;
p := length Resns;
n := dim ring N - 1;
if p >= n - l then (
a := max apply(max(n - l,0) .. p, j-> ((max degrees (Resns_j))#0 - j));
r := a - l + 1;
M = truncate(r, M));
cxToField basis(0, Hom(res M, N))
)

RHom(CoherentSheaf, CoherentSheaf) := Complex => (C,D) -> (
if not instance(variety C, ProjectiveVariety)
then error "expected sheaves on a projective variety";
M := flattenModule module C;
N := flattenModule module D;
R := ring M;
if not isAffineRing R
then error "expected sheaves on a variety over a field";
l := dim N;
Resns := res N;
p := length Resns;
n := dim ring N - 1;
if p >= n - l then (
a := max apply(max(n - l,0) .. p, j-> ((max degrees (Resns_j))#0 - j));
r := a - l + 1;
M = truncate(r, M));
cxToField basis(0, Hom(freeResolution' M, N))
cxToField basis(0, Hom(res M, N, DegreeLimit => 0))
)

--this version of RHom computes the complex for all twists above a certain point
RHom(Complex, Complex, ZZ) := Complex => (C, D, d) -> (
RHom(CoherentSheaf, CoherentSheaf, ZZ) :=
RHom(CoherentSheaf, Complex, ZZ) :=
RHom(Complex, CoherentSheaf, ZZ) := Complex => (C, D, d) -> RHom(complex C, complex D, d)
RHom(Complex, Complex, ZZ) := Complex => (C, D, d) -> (
(loC, hiC) := C.concentration;
if not instance(variety C_loC, ProjectiveVariety)
then error "expected sheaves on a projective variety";
Expand All @@ -248,69 +201,6 @@ RHom(Complex, Complex, ZZ) := Complex => (C, D, d) -> (
truncate(d, Hom(res M, N))
)

RHom(CoherentSheaf, Complex, ZZ) := Complex => (C, D, d) -> (
if not instance(variety C, ProjectiveVariety)
then error "expected sheaves on a projective variety";
M := flattenModule module C;
N := flattenComplex module D;
R := ring M;
if not isAffineRing R
then error "expected sheaves on a variety over a field";
H := prune HH N;
(loH, hiH) := concentration H;
L := for i from loH to hiH list dim H_i;
l := max L;
Resns := for i from loH to hiH list resolution flattenModule H_i;
P := for i in Resns list length i;
p := max P;
n := dim ring (H_loH) - 1;
if p >= n - l then (
a := max for i from 0 to length(Resns)-1 list max apply(n - L_i .. P_i, j-> (max degrees (Resns_i)_j)#0 - j);
r := a - l - d + 1;
M = truncate(r, M));
truncate(d, Hom(freeResolution' M, N))
)

RHom(Complex, CoherentSheaf, ZZ) := Complex => (C,D,d) -> (
(loC, hiC) := C.concentration;
if not instance(variety C_loC, ProjectiveVariety)
then error "expected sheaves on a projective variety";
M := flattenComplex module C;
N := flattenModule module D;
R := ring M;
if not isAffineRing R
then error "expected sheaves on a variety over a field";
l := dim N;
Resns := res N;
p := length Resns;
n := dim ring N - 1;
if p >= n - l then (
a := max apply(max(n - l,0) .. p, j-> ((max degrees (Resns_j))#0 - j));
r := a - l - d + 1;
M = truncate(r, M));
truncate(d, Hom(res M, N))
)

RHom(CoherentSheaf, CoherentSheaf, ZZ) := Complex => (C,D,d) -> (
if not instance(variety C, ProjectiveVariety)
then error "expected sheaves on a projective variety";
M := flattenModule module C;
N := flattenModule module D;
R := ring M;
if not isAffineRing R
then error "expected sheaves on a variety over a field";
l := dim N;
Resns := res N;
p := length Resns;
n := dim ring N - 1;
if p >= n - l then (
a := max apply(max(n - l,0) .. p, j-> ((max degrees (Resns_j))#0 - j));
r := a - l - d + 1;
M = truncate(r, M));
truncate(d, Hom(freeResolution' M, N))
)


Ext(ZZ, CoherentSheaf, Complex) := Complex => opts -> (m, C, D) -> (
if not instance(variety C, ProjectiveVariety)
then error "expected sheaves on a projective variety";
Expand Down

0 comments on commit 730ee50

Please sign in to comment.