Skip to content

Commit

Permalink
BernsteinSato; added quotientHelper quotient(LeftIdeal,RingElement)
Browse files Browse the repository at this point in the history
  • Loading branch information
Anton Leykin committed Nov 23, 2023
1 parent f14c2c6 commit 679d34c
Show file tree
Hide file tree
Showing 18 changed files with 212 additions and 190 deletions.
81 changes: 42 additions & 39 deletions M2/Macaulay2/packages/BernsteinSato/DHom.m2
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ divideOutGCD Matrix := m -> (
--------------------------------------------------------------------------------

Ddual = method()
Ddual Ideal := I -> Ddual comodule I
Ddual LeftIdeal := I -> Ddual comodule I
Ddual Module := M -> (
pInfo(1, "ENTERING Ddual ... ");
W := ring M;
Expand Down Expand Up @@ -86,11 +86,11 @@ Ddual Module := M -> (
--------------------------------------------------------------------------------
polynomialSolutions = method(Options => {Alg => GD} )

polynomialSolutions Ideal := options -> I -> (
polynomialSolutions((ring I)^1/I, options) )
polynomialSolutions LeftIdeal := options -> I -> (
polynomialSolutions(coker gens I, options) )

polynomialSolutions(Ideal,List) := options -> (I,w) -> (
polynomialSolutions((ring I)^1/I, w, options) )
polynomialSolutions(LeftIdeal,List) := options -> (I,w) -> (
polynomialSolutions(coker gens I, w, options) )

polynomialSolutions Module := options -> M -> (
W := ring M;
Expand Down Expand Up @@ -255,8 +255,8 @@ polynomialSolutions(Module, List) := options -> (M, w) -> (
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
polynomialExt = method(Options => {Strategy => Schreyer})
polynomialExt Ideal := options -> I -> (
polynomialExt ((ring I)^1/I, options)
polynomialExt LeftIdeal := options -> I -> (
polynomialExt (coker gens I, options)
)

polynomialExt Module := options -> (M) -> (
Expand All @@ -273,8 +273,8 @@ polynomialExt Module := options -> (M) -> (
homologyTable
)

polynomialExt(ZZ, Ideal) := options -> (k, I) -> (
if not I.?quotient then I.quotient = (ring I)^1/I;
polynomialExt(ZZ, LeftIdeal) := options -> (k, I) -> (
if not I.?quotient then I.quotient = coker gens I;
polynomialExt (k, I.quotient, options)
)

Expand All @@ -297,27 +297,27 @@ polynomialExt(ZZ, Module) := options -> (k, M) -> (
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
rationalFunctionSolutions = method()
rationalFunctionSolutions(Ideal) := (I) -> (
rationalFunctionSolutions(LeftIdeal) := (I) -> (
W := ring I;
createDpairs W;
w := toList(#W.dpairVars#0: 1);
f := (singLocus I)_0;
rationalFunctionSolutions(I, f, w)
)

rationalFunctionSolutions(Ideal, List) := (I, w) -> (
rationalFunctionSolutions(LeftIdeal, List) := (I, w) -> (
f := (singLocus I)_0;
rationalFunctionSolutions(I, f, w)
)

rationalFunctionSolutions(Ideal, RingElement) := (I, f) -> (
rationalFunctionSolutions(LeftIdeal, RingElement) := (I, f) -> (
W := ring I;
createDpairs W;
w := toList(#W.dpairVars#0: 1);
rationalFunctionSolutions(I, f, w)
)

rationalFunctionSolutions(Ideal, RingElement, List) := (I, f, w) -> (
rationalFunctionSolutions(LeftIdeal, RingElement, List) := (I, f, w) -> (
W := ring I;
bfunc := (globalB(I, f))#Bpolynomial;
k := (max getIntRoots bfunc) + 1;
Expand All @@ -332,7 +332,7 @@ rationalFunctionSolutions(Ideal, RingElement, List) := (I, f, w) -> (
solsList
)

rationalFunctionSolutions(Ideal, List, List) := (I, f, w) -> (
rationalFunctionSolutions(LeftIdeal, List, List) := (I, f, w) -> (
W := ring I;
createDpairs W;
bfuncs := apply(f, i -> (globalB(I, i))#Bpolynomial);
Expand All @@ -353,10 +353,10 @@ rationalFunctionSolutions(Ideal, List, List) := (I, f, w) -> (

-- internal
TwistOperator = method()
TwistOperator(Ideal, RingElement, ZZ) := (I, f, k) -> (
TwistOperator(LeftIdeal, RingElement, ZZ) := (I, f, k) -> (
ideal apply((entries gens I)#0, L -> TwistOperator(L, f, k))
)
TwistOperator(Ideal, List, List) := (I, f, k) -> (
TwistOperator(LeftIdeal, List, List) := (I, f, k) -> (
ideal apply((entries gens I)#0, L -> TwistOperator(L, f, k))
)

Expand Down Expand Up @@ -450,7 +450,7 @@ TwistOperator(RingElement, List, List) := (L, f, k) -> (
--------------------------------------------------------------------------------
rationalFunctionExt = method(Options => {Strategy => Schreyer} )

rationalFunctionExt Ideal := options -> I -> (
rationalFunctionExt LeftIdeal := options -> I -> (
f := (singLocus(I))_0;
rationalFunctionExt (I, f)
)
Expand All @@ -468,8 +468,8 @@ rationalFunctionExt Module := options -> M -> (
)


rationalFunctionExt(Ideal, RingElement) := options -> (I, f) -> (
rationalFunctionExt ((ring I)^1/I, f, options)
rationalFunctionExt(LeftIdeal, RingElement) := options -> (I, f) -> (
rationalFunctionExt (coker gens I, f, options)
)

rationalFunctionExt(Module, RingElement) := options -> (M, f) -> (
Expand Down Expand Up @@ -499,13 +499,13 @@ rationalFunctionExt(ZZ, Module) := options -> (k, M) -> (
rationalFunctionExt (k, M, f)
)

rationalFunctionExt(ZZ, Ideal) := options -> (k, I) -> (
rationalFunctionExt(ZZ, LeftIdeal) := options -> (k, I) -> (
f := (singLocus(I))_0;
rationalFunctionExt (k, I, f)
)

rationalFunctionExt(ZZ, Ideal, RingElement) := options -> (k, I, f) -> (
rationalFunctionExt (k, (ring I)^1/I, f, options)
rationalFunctionExt(ZZ, LeftIdeal, RingElement) := options -> (k, I, f) -> (
rationalFunctionExt (k, coker gens I, f, options)
)

rationalFunctionExt(ZZ, Module, RingElement) := options -> (k, M, f) -> (
Expand All @@ -531,12 +531,12 @@ rationalFunctionExt(ZZ, Module, RingElement) := options -> (k, M, f) -> (

DHom = method(Options => {Strategy => Schreyer})

DHom(Ideal, Ideal) := options -> (I, J) -> (
DHom(LeftIdeal, LeftIdeal) := options -> (I, J) -> (
W := ring I;
createDpairs W;
n := #W.dpairVars#0;
w := toList(2*n:1);
DHom(W^1/I, W^1/J, w, options)
DHom(coker gens I, coker gens J, w, options)
)

DHom(Module, Module) := options -> (M, N) -> (
Expand Down Expand Up @@ -903,20 +903,19 @@ compareSpans (List, List) := (list1, list2) -> (



TEST ///
-- TESTS TO WRITE (exported symbols);
-- polynomialExt Ideal
-- polynomialExt LeftIdeal
-- polynomialExt Module
-- polynomialExt (ZZ, Ideal)
-- polynomialExt (ZZ, LeftIdeal)
-- polynomialExt (ZZ, Module)

-- rationalFunctionExt Ideal
-- rationalFunctionExt LeftIdeal
-- rationalFunctionExt Module
-- rationalFunctionExt (Ideal, RingElement)
-- rationalFunctionExt (LeftIdeal, RingElement)
-- rationalFunctionExt (Module, rationalFunctionExt)
-- rationalFunctionExt (ZZ, Module)
-- rationalFunctionExt (ZZ, Ideal)
-- rationalFunctionExt (ZZ, Ideal, RingElement)
-- rationalFunctionExt (ZZ, LeftIdeal)
-- rationalFunctionExt (ZZ, LeftIdeal, RingElement)
-- rationalFunctionExt (ZZ, Module, RingElement)

-- DHom (Module, Module, List)
Expand All @@ -934,12 +933,14 @@ TEST ///
-- divideOutGCD RingElement
-- divideOutGCD Matrix

-- TwistOperator (Ideal, RingElement, ZZ)
-- TwistOperator (Ideal, List, List)
-- TwistOperator (LeftIdeal, RingElement, ZZ)
-- TwistOperator (LeftIdeal, List, List)
-- TwistOperator (RingElement, RingElement, ZZ)
-- TwistOperator (RingElement, List, List)

TEST ///
importFrom_"BernsteinSato" {"compareSpans"}

---------------- TESTS for compareSpan -----------------------
-- Test 1:
S = QQ[x,y,z];
Expand All @@ -962,14 +963,14 @@ mylist1 = {1, x, y};
mylist2 = {x + y, x-y};
assert(not compareSpans(mylist1, mylist2));


----------------------- TESTS for ^ -----------------------
x = symbol x; y = symbol y; z = symbol z;
R = QQ[x,y,z];
assert({x,y,z}^{2,3,4} == x^2*y^3*z^4);
///



TEST///
importFrom_"BernsteinSato" {"compareSpans"}
----------------------- TESTS for polynomialSolutions -------------------------
-- Test 1: Simple example
x = symbol x; Dx = symbol Dx;
Expand Down Expand Up @@ -998,11 +999,12 @@ ansGD = polynomialSolutions(I, weight);
R = ring ansGD#0;
ansDuality = polynomialSolutions(I, Alg => Duality) / (f -> sub(f, R));
assert(compareSpans(ansGD, ansDuality));

///

--------------------- TESTS for polynomialExt -----------------------


TEST///
importFrom_"BernsteinSato" {"compareSpans"}
--------------------- TESTS for rationalFunctionSolutions -----------------------
-- Test 1:
x = symbol x; Dx = symbol Dx;
Expand All @@ -1025,8 +1027,9 @@ ans = {(-x+y)/(-y^4 + 3*y^3 - 3*y^2 + y), (-x*y^3 + 3*x*y^2 - 3*x*y + 4*x - 3*y)

thelcd = lcm((allSols | ans) / denominator);
assert compareSpans( thelcd*allSols / (f -> lift(f, R)), thelcd*ans / (f -> lift(f, R)));
///


TEST///
---------------------- TESTS forDHom and DExt ------------------------
-- Test 1: Simple ODE examples
x = symbol x; dx = symbol dx;
Expand Down
50 changes: 25 additions & 25 deletions M2/Macaulay2/packages/BernsteinSato/DOC/DHom.m2
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ document {
TO [Dresolution,Strategy]
}
document {
Key => {DHom, (DHom,Module,Module), (DHom,Module,Module,List), (DHom,Ideal,Ideal)},
Key => {DHom, (DHom,Module,Module), (DHom,Module,Module,List), (DHom,LeftIdeal,LeftIdeal)},
Headline=>"D-homomorphisms between holonomic D-modules",
Usage => "DHom(M,N), DHom(M,N,w), DHom(I,J)",
Inputs => {
"M" => Module => {"over the Weyl algebra ", EM "D"},
"N" => Module => {"over the Weyl algebra ", EM "D"},
"I" => Ideal => {"which represents the module ", EM "M = D/I"},
"J" => Ideal => {"which represents the module ", EM "N = D/J"},
"I" => LeftIdeal => {"which represents the module ", EM "M = D/I"},
"J" => LeftIdeal => {"which represents the module ", EM "N = D/J"},
"w" => List => "a positive weight vector"
},
Outputs => {
Expand All @@ -37,8 +37,8 @@ document {
the restriction algorithm."},
EXAMPLE lines ///
W = QQ[x, D, WeylAlgebra=>{x=>D}]
M = W^1/ideal(D-1)
N = W^1/ideal((D-1)^2)
M = coker gens ideal(D-1)
N = coker gens ideal((D-1)^2)
DHom(M,N)
///,
Caveat => {"Input modules ", EM "M", ", ", EM "N", ", ",
Expand Down Expand Up @@ -102,8 +102,8 @@ document {
the restriction algorithm."},
EXAMPLE lines ///
W = QQ[x, D, WeylAlgebra=>{x=>D}]
M = W^1/ideal(x*(D-1))
N = W^1/ideal((D-1)^2)
M = coker gens ideal(x*(D-1))
N = coker gens ideal((D-1)^2)
DExt(M,N)
///,
Caveat =>{
Expand All @@ -115,12 +115,12 @@ document {
}

document {
Key => {Ddual, (Ddual,Module), (Ddual,Ideal)},
Key => {Ddual, (Ddual,Module), (Ddual,LeftIdeal)},
Headline => "holonomic dual of a D-module",
Usage => "Ddual M, Ddual I",
Inputs => {
"M" => Module => {"over the Weyl algebra ", EM "D"},
"I" => Ideal => {"which represents the module ", EM "M = D/I"}
"I" => LeftIdeal => {"which represents the module ", EM "M = D/I"}
},
Outputs => {
Module => {"the holonomic dual of ", EM "M"}
Expand Down Expand Up @@ -148,12 +148,12 @@ document {
TO [Dresolution,Strategy]
}
document {
Key => {polynomialExt, (polynomialExt,Module), (polynomialExt,ZZ,Ideal), (polynomialExt,ZZ,Module), (polynomialExt,Ideal)},
Key => {polynomialExt, (polynomialExt,Module), (polynomialExt,ZZ,LeftIdeal), (polynomialExt,ZZ,Module), (polynomialExt,LeftIdeal)},
Headline => "Ext groups between a holonomic module and a polynomial ring",
Usage => "polynomialExt M, polynomialExt I; rationalFunctionExt(i,M), rationalFunctionExt(i,I)",
Inputs => {
"M" => Module => {"over the Weyl algebra ", EM "D"},
"I" => Ideal => {"which represents the module ", EM "M = D/I"},
"I" => LeftIdeal => {"which represents the module ", EM "M = D/I"},
"i" => ZZ => "nonnegative"
},
Outputs => {
Expand All @@ -172,7 +172,7 @@ document {
the restriction algorithm."},
EXAMPLE lines ///
W = QQ[x, D, WeylAlgebra=>{x=>D}]
M = W^1/ideal(x^2*D^2)
M = coker gens ideal(x^2*D^2)
polynomialExt(M)
///,
Caveat =>{"Does not yet compute explicit representations of
Expand All @@ -187,15 +187,15 @@ document {
}

document {
Key => {rationalFunctionExt, (rationalFunctionExt,Module), (rationalFunctionExt,ZZ,Ideal,RingElement), (rationalFunctionExt,ZZ,Ideal),
(rationalFunctionExt,Ideal,RingElement), (rationalFunctionExt,Ideal),(rationalFunctionExt,ZZ,Module,RingElement),
Key => {rationalFunctionExt, (rationalFunctionExt,Module), (rationalFunctionExt,ZZ,LeftIdeal,RingElement), (rationalFunctionExt,ZZ,LeftIdeal),
(rationalFunctionExt,LeftIdeal,RingElement), (rationalFunctionExt,LeftIdeal),(rationalFunctionExt,ZZ,Module,RingElement),
(rationalFunctionExt,ZZ,Module), (rationalFunctionExt,Module,RingElement)},
Headline => "Ext(holonomic D-module, polynomial ring localized at the singular locus)",
Usage => "rationalFunctionExt M, rationalFunctionExt I; rationalFunctionExt(M,f), rationalFunctionExt(I,f);
rationalFunctionExt(i,M), rationalFunctionExt(i,I); rationalFunctionExt(i,M,f), rationalFunctionExt(i,I,f)",
Inputs => {
"M" => Module => {"over the Weyl algebra ", EM "D"},
"I" => Ideal => {"which represents the module ", EM "M = D/I"},
"I" => LeftIdeal => {"which represents the module ", EM "M = D/I"},
"f" => RingElement => "a polynomial",
"i" => ZZ => "nonnegative"
},
Expand All @@ -215,7 +215,7 @@ document {
the restriction algorithm."},
EXAMPLE lines ///
W = QQ[x, D, WeylAlgebra=>{x=>D}]
M = W^1/ideal(x*D+5)
M = coker gens ideal(x*D+5)
rationalFunctionExt M
///,
Caveat =>{"Input modules M or D/I should be holonomic."},
Expand All @@ -226,9 +226,9 @@ doc ///
Key
polynomialSolutions
(polynomialSolutions,Module)
(polynomialSolutions,Ideal,List)
(polynomialSolutions,LeftIdeal,List)
(polynomialSolutions,Module,List)
(polynomialSolutions,Ideal)
(polynomialSolutions,LeftIdeal)
Headline
polynomial solutions of a holonomic system
Usage
Expand All @@ -239,7 +239,7 @@ doc ///
Inputs
M:Module
over the Weyl algebra $D$
I:Ideal
I:LeftIdeal
holonomic ideal in the Weyl algebra $D$
w:List
a weight vector
Expand Down Expand Up @@ -292,11 +292,11 @@ document {
doc ///
Key
rationalFunctionSolutions
(rationalFunctionSolutions,Ideal,List,List)
(rationalFunctionSolutions,Ideal,RingElement,List)
(rationalFunctionSolutions,Ideal,List)
(rationalFunctionSolutions,Ideal,RingElement)
(rationalFunctionSolutions,Ideal)
(rationalFunctionSolutions,LeftIdeal,List,List)
(rationalFunctionSolutions,LeftIdeal,RingElement,List)
(rationalFunctionSolutions,LeftIdeal,List)
(rationalFunctionSolutions,LeftIdeal,RingElement)
(rationalFunctionSolutions,LeftIdeal)
Headline
rational solutions of a holonomic system
Usage
Expand All @@ -306,7 +306,7 @@ doc ///
rationalFunctionSolutions(I,ff)
rationalFunctionSolutions(I,ff,w)
Inputs
I:Ideal
I:LeftIdeal
holonomic ideal in the Weyl algebra @EM "D"@
f:RingElement
a polynomial
Expand Down
Loading

0 comments on commit 679d34c

Please sign in to comment.