1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374
|
-- Copyright 1999-2002 by Anton Leykin and Harrison Tsai
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
-- Computes deRham cohomology of a smooth affine variety. For more options on localCohom strategy use ICcohom instead.
-- Special algorithm for the de Rham cohomology of K^n - V(f) using the algorithm of Oaku-Takayama.
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
deRham = method( Options => {Strategy => Schreyer})
deRham Ideal := options -> I -> (
R:= ring I;
if class R =!= PolynomialRing
then error "expected an ideal in a polynomial ring";
primes := minimalPrimes I;
if #primes > 1 then error "The variety defined by the ideal must be irreducible";
P := primes#0;
S := ideal (singularLocus P);
if R != S then error "expected an ideal defining a smooth affine variety";
n:= numgens R;
d:= dim I;
c:= n-d;
H:=localCohom(c,I);
M:=minimalPresentation H;
integrateTable := Dintegration(M, apply(n,i->1), options);
new HashTable from (for i from 0 to d list i=>integrateTable#(d-i))
)
deRham (ZZ, Ideal) := options -> (k, I) -> (
R:= ring I;
if class R =!= PolynomialRing
then error "expected an ideal in a polynomial ring";
primes := minimalPrimes I;
if #primes > 1 then error "The variety defined by the ideal must be irreducible";
P := primes#0;
S := ideal (singularLocus P);
if R != S then error "expected an ideal defining a smooth affine variety";
n:= numgens R;
d:= dim I;
if k>d then 0
else (
c:= n-d;
H:=localCohom(c,I);
M:=minimalPresentation H;
Dintegration(d-k, M, apply(n,i->1),options)
)
)
deRham RingElement := options -> f -> (
pInfo(1, "ENTERING deRham ...");
R := ring f;
if class R =!= PolynomialRing
then error "expected element of a polynomial ring";
if R.monoid.Options.WeylAlgebra =!= {}
then error "expected element of a commutative polynomial ring";
outputList := {};
n := numgens R;
x := symbol x;
D := symbol D;
WA := (coefficientRing R)[x_1 .. x_n, D_1 .. D_n,
WeylAlgebra => apply(toList(1..n), i -> x_i => D_i)];
RtoWA := map(WA, R, (vars WA)_(toList(0..n-1)));
M := cokernel matrix{{D_1 .. D_n}};
locMod := Dlocalize(M, RtoWA f, Strategy => Oaku);
w := toList(n:1);
integrateTable := Dintegration(locMod, w, options);
homologyTable := hashTable apply(toList(0..n),
i -> (-i+n) => integrateTable#i);
homologyTable
)
deRham (ZZ, RingElement) := options -> (k, f) -> (
pInfo(1, "ENTERING deRham ...");
R := ring f;
if class R =!= PolynomialRing
then error "expected element of a polynomial ring";
if R.monoid.Options.WeylAlgebra =!= {}
then error "expected element of a commutative polynomial ring";
outputList := {};
n := numgens R;
x := symbol x;
D := symbol D;
WA := (coefficientRing R)[x_1 .. x_n, D_1 .. D_n,
WeylAlgebra => apply(toList(1..n), i -> x_i => D_i)];
RtoWA := map(WA, R, (vars WA)_(toList(0..n-1)));
M := cokernel matrix{{D_1 .. D_n}};
locMod := Dlocalize(M, RtoWA f, Strategy => Oaku);
w := toList(n:1);
homologyModule := Dintegration(n-k, locMod, w, options);
homologyModule
)
deRhamAll = method( Options => {Strategy => Schreyer})
deRhamAll RingElement := options -> f -> (
pInfo(1, "ENTERING deRhamAll ...");
R := ring f;
if class R =!= PolynomialRing
then error "expected element of a polynomial ring";
if R.monoid.Options.WeylAlgebra =!= {}
then error "expected element of a commutative polynomial ring";
n := numgens R;
x := symbol x;
D := symbol D;
WA := (coefficientRing R)[x_1 .. x_n, D_1 .. D_n,
WeylAlgebra => apply(toList(1..n), i -> x_i => D_i)];
RtoWA := map(WA, R, (vars WA)_(toList(0..n-1)));
M := cokernel matrix{{D_1 .. D_n}};
WAf := RtoWA f;
LocMap := DlocalizeMap(M, WAf, Strategy => Oaku);
Mf := target LocMap;
w := toList(n:1);
outputRequest := {GenCycles, HomologyModules,
VResolution, BFunction, Explicit};
MF := cokernel Fourier relations Mf;
outputTable := computeRestriction (MF, w, -1, n+1,
outputRequest, options);
outputList := {BFunction => outputTable#BFunction,
LocalizeMap => LocMap};
if outputTable#VResolution =!= null then
outputList = append(outputList,
VResolution => FourierInverse outputTable#VResolution)
else outputList = append(outputList, VResolution => null);
outputList = outputList | {
PreCycles => hashTable apply(toList(0..n),
i -> (n-i => FourierInverse outputTable#GenCycles#i)),
CohomologyGroups => hashTable apply(toList(0..n),
i -> (n-i => outputTable#HomologyModules#i)) };
intTable := hashTable outputList;
--P := DintegrationDeRham(Mf, w, Strategy => options.Strategy,
-- Info => options.Info, ExplicitHomology => options.ExplicitHomology);
if intTable#VResolution =!= null then (
pInfo(1, "Making the Koszul complex... ");
createDpairs WA;
Omega := Dres ideal WA.dpairVars#1;
pInfo(1, "Transferring cohomology classes to deRham complex... ");
dbl := Omega**(intTable#VResolution);
transfers := {};
i := 0;
while i <= n do (
pull := intTable#PreCycles#i;
j := 0;
pInfo(2, "\t Degree " | i | "...");
tInfo := toString first timing (
while j < n-i do (
vertMap := zeroize dbl#(n-i-1)^[(j,-j+n-i-1)]*
(dbl.dd#(n-i))*(dbl#(n-i)_[(j,-j+n-i)]);
push := vertMap*pull;
horMap := zeroize dbl#(n-i-1)^[(j,-j+n-i-1)]*
(dbl.dd#(n-i))*(dbl#(n-i)_[(j+1,-j+n-i-1)]);
if ((Dtransposition push) % (Dtransposition horMap) != 0)
then error "syzygy should be produced but wasn't!";
pull = (Dtransposition push) // (Dtransposition horMap);
pull = Dtransposition pull;
j = j+1;
);
);
pInfo(2, "\t\t\t time = " | tInfo | " seconds" );
transfers = append(transfers, i => pull);
i = i+1;
);
outputList = outputList | {TransferCycles =>
hashTable transfers, OmegaRes => Omega};
);
hashTable outputList
)
-- iAllt is by Nobuki Takayama, 2007.
-- iAllt(I) computes integration cohomology groups of D/I with transfer's
-- logCohomology(I) computes DR(tilde M).
--
-- Example:
-- M2
-- load "D-modules.m2"
-- load "trans.m2"
-- use S; f=x*y*(x-y); logCohomology(f);
protect Input -- not exported?
iAllt = method( Options => {Strategy => Schreyer})
iAllt Module:= options -> I -> (
pInfo(2, "iAllt (integrationAllWithTransfer) in trans.m2");
WA := ring gens I;
Mf := I;
pInfo(2,Mf);
n := numgens(WA) // 2; -- do not use numgens(WA)/2
w := toList(n:1);
outputRequest := {GenCycles, HomologyModules,
VResolution, BFunction, Explicit};
MF := cokernel Fourier relations Mf;
outputTable := computeRestriction (MF, w, -1, n+1,
outputRequest, options);
outputList := {BFunction => outputTable#BFunction,
LocalizeMap => LocMap};
outputList = outputList | { Input=> I };
if outputTable#VResolution =!= null then
outputList = append(outputList,
VResolution => FourierInverse outputTable#VResolution)
else outputList = append(outputList, VResolution => null);
outputList = outputList | {
PreCycles => hashTable apply(toList(0..n),
i -> (n-i => FourierInverse outputTable#GenCycles#i)),
CohomologyGroups => hashTable apply(toList(0..n),
i -> (n-i => outputTable#HomologyModules#i)) };
intTable := hashTable outputList;
--P := DintegrationDeRham(Mf, w, Strategy => options.Strategy,
-- Info => options.Info, ExplicitHomology => options.ExplicitHomology);
if intTable#VResolution =!= null then (
pInfo(1, "Making the Koszul complex... ");
createDpairs WA;
Omega := Dres ideal WA.dpairVars#1;
pInfo(1, "Transferring cohomology classes to deRham complex... ");
dbl := Omega**(intTable#VResolution);
pInfo(2,dbl); -- print double complex
transfers := {};
i := 0;
while i <= n do (
pull := intTable#PreCycles#i;
j := 0;
pInfo(2,{i,j,pull});
pInfo(2, "\t Degree " | i | "...");
tInfo := toString first timing (
while j < n-i do (
vertMap := zeroize dbl#(n-i-1)^[(j,-j+n-i-1)]*
(dbl.dd#(n-i))*(dbl#(n-i)_[(j,-j+n-i)]);
push := vertMap*pull;
horMap := zeroize dbl#(n-i-1)^[(j,-j+n-i-1)]*
(dbl.dd#(n-i))*(dbl#(n-i)_[(j+1,-j+n-i-1)]);
if ((Dtransposition push) % (Dtransposition horMap) != 0)
then error "syzygy should be produced but wasn't!";
pull = (Dtransposition push) // (Dtransposition horMap);
pull = Dtransposition pull;
pInfo(2,{i,j,push,pull});
j = j+1;
);
);
pInfo(2, "\t\t\t time = " | tInfo | " seconds" );
transfers = append(transfers, i => pull);
i = i+1;
);
outputList = outputList | {TransferCycles =>
hashTable transfers, OmegaRes => Omega};
);
hashTable outputList
)
-- derLogF returns generators for widetilde{Der}(-log f)
-- Example: QQ[x,y]
-- f = x*y*(x-y)
-- iAllt cokernel matrix derLogF(f)
derLogF = method();
derLogF RingElement := f -> (
R := ring f;
if class R =!= PolynomialRing
then error "expected element of a polynomial ring";
if R.monoid.Options.WeylAlgebra =!= {}
then error "expected element of a commutative polynomial ring";
v := generators(R);
n := #v;
d := apply(v, i->diff(i,f));
d = join({f},d);
syzf := kernel matrix{d};
m := numgens syzf;
-- msyz = gens syzf;
msyz := gens syzf;
-- note: msyz^{1} get 1-th row
-- note: msyz_{i} get i-th column
-- note: msyz^{i}_{j} get (i,j)-element
-- note: entries
-- note: #List, length
pInfo(2,msyz);
-- see annFs.m2, oxclient.m2
W := makeWeylAlgebra( R, SetVariables=>false); --note: g=map(R,W,matrix{{x,y,0,0}}); g(x) does not work
phi := map(W,R);
vw := generators(W);
i:=0; j:=0; ell:=0; t:=0;
op:={};
while i<m do (
j = 1;
ell=-phi msyz_(0,i);
while j<=n do (
ell = ell + phi msyz_(j,i) * vw_(n+j-1);
j = j+1;
);
op = join(op,{ell});
i = i+1;
);
{op}
)
logCohomology=method();
logCohomology RingElement := f -> (
ii := derLogF f;
iAllt(cokernel(matrix(ii)))
)
-- use S; logCohomology(x^3-y)
-- Warning: do not input like logCohomology x^3-y
-- Example:
-- use S; f=(x^3+y^4+x*y^3)*(x^2+y^2); logCohomology f;
-- the transfer cycles contains dx and dy.
-- use S; f=(x^3+y^4+x*y^3)*(x^2-y^2); logCohomology f;
-- the transfer cycles contains dx and dy.
getTransfer=method();
getTransfer (HashTable,ZZ) := (cohom,k) -> (
t:=cohom#TransferCycles;
tk:=transpose(t)#k;
entries(tk)
)
-- Example:
-- use S; f=x*y*(x-y); cc=logCohomology f; getReducedTransfer(cc,1);
-- use S; f=(x^3+y^4+x*y^3)*(x^2+y^2); cc=logCohomology f; getReducedTransfer(cc,1);
getReducedTransfer=method();
getReducedTransfer (HashTable,ZZ) := (cohom,k) -> (
tmp:=cohom;
tk:=getTransfer(cohom,k);
-- cf. Dbasic.m2, holonomicRank
W := ring(cohom#VResolution);
createDpairs W;
n := #(W.dpairInds#0);
m := numgens W;
-- get weight vectors for the order filtration refined
-- by lex on the derivatives
weightList := { apply ( toList(0..m-1), i -> if member(i, W.dpairInds#1)
then 1 else 0 ) };
-- ring equipped with the new order
tempW := (coefficientRing W)(monoid [(entries vars W)#0,
WeylAlgebra => W.monoid.Options.WeylAlgebra,
Weights => weightList]);
WtotempW := map (tempW, W, vars tempW);
-- map to the lex ring.
tktemp := apply(tk,i->apply(i,j->WtotempW(j)));
iii := WtotempW( ((cohom#VResolution).dd)#1 );
ggg := gb iii;
tkreduced := apply(tktemp,i->apply(i,j-> (j % ggg)))
)
TEST ///
--Boundary cases
x = symbol x; y = symbol y;
R = QQ[x,y]
default := hashTable {0=>QQ^1, 1=>QQ^0, 2=>QQ^0};
F2 = deRham(1_R); -- affine space
assert all (keys default, i -> (F2#i == default#i));
--Small change doesn't affect deRham groups
F1 = deRham(x^2-30*y^3)
F2 = deRham(x^2-31*y^3)
assert all (keys F1, i -> (F1#i == F2#i));
--These lead to problems in factor at the moment
F1 = deRham(x^2-y^10)
F2 = deRham(2*x^2 - 3*y^10)
assert all (keys F1, i -> (F1#i == F2#i));
///
|