From b708b8b9960b6d52788e65c4dc5a8a543dda48d1 Mon Sep 17 00:00:00 2001 From: Mahrud Sayrafi Date: Wed, 6 Dec 2023 18:18:05 -0600 Subject: [PATCH 1/9] fixed support ideal () --- M2/Macaulay2/m2/matrix2.m2 | 7 +++---- M2/Macaulay2/tests/normal/support.m2 | 5 +++++ 2 files changed, 8 insertions(+), 4 deletions(-) create mode 100644 M2/Macaulay2/tests/normal/support.m2 diff --git a/M2/Macaulay2/m2/matrix2.m2 b/M2/Macaulay2/m2/matrix2.m2 index 8bd42f69535..c6fa492c6e2 100644 --- a/M2/Macaulay2/m2/matrix2.m2 +++ b/M2/Macaulay2/m2/matrix2.m2 @@ -438,10 +438,9 @@ indices RingElement := (f) -> rawIndices raw f indices Matrix := (f) -> rawIndices raw f support = method() -support RingElement := support Matrix := (f) -> ( - x := rawIndices raw f; - apply(x, i -> (ring f)_i)) -support Ideal := (I) -> rsort toList sum apply(flatten entries generators I, f -> set support f) +support RingElement := +support Matrix := f -> apply(try rawIndices raw f else {}, i -> (ring f)_i) +support Ideal := I -> support generators I -------------------- -- homogenization -- -------------------- diff --git a/M2/Macaulay2/tests/normal/support.m2 b/M2/Macaulay2/tests/normal/support.m2 new file mode 100644 index 00000000000..ab731a4abaa --- /dev/null +++ b/M2/Macaulay2/tests/normal/support.m2 @@ -0,0 +1,5 @@ +R = QQ[x,y,z,w] +assert(support ideal"x,xy,xy-zw" == R_*) +assert(support ideal() == {}) +assert(support id_(ZZ^3) == {}) + From 131a2d9f8aaa092d02a7eb6b560becc9540a9c44 Mon Sep 17 00:00:00 2001 From: Mahrud Sayrafi Date: Mon, 4 Dec 2023 17:56:23 -0600 Subject: [PATCH 2/9] forbid two-sided ideals over Weyl algebras --- M2/Macaulay2/m2/matrix1.m2 | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/M2/Macaulay2/m2/matrix1.m2 b/M2/Macaulay2/m2/matrix1.m2 index 105a23e5cc6..832d7b4c449 100644 --- a/M2/Macaulay2/m2/matrix1.m2 +++ b/M2/Macaulay2/m2/matrix1.m2 @@ -418,17 +418,22 @@ cokernel Matrix := Module => m -> ( cokernel RingElement := Module => f -> cokernel matrix {{f}} image RingElement := Module => f -> image matrix {{f}} +----------------------------------------------------------------------------- +-- Ideal type declaration +----------------------------------------------------------------------------- +-- Note: all ideals will be two-sided + Ideal = new Type of HashTable Ideal.synonym = "ideal" -ideal = method(Dispatch => Thing, TypicalValue => Ideal) - +-- printing expression Ideal := (I) -> (expression ideal) unsequence apply(toSequence first entries generators I, expression) net Ideal := (I) -> net expression I toString Ideal := (I) -> toString expression I toExternalString Ideal := (I) -> "ideal " | toExternalString generators I texMath Ideal := (I) -> texMath expression I +-- basic methods isIdeal Ideal := I -> true isHomogeneous Ideal := (I) -> isHomogeneous generators I @@ -534,8 +539,14 @@ Ideal == Ideal := (I,J) -> ( Ideal == Module := (I,M) -> module I == M Module == Ideal := (M,I) -> M == module I +----------------------------------------------------------------------------- +-- Primary constructor +----------------------------------------------------------------------------- + +ideal = method(Dispatch => Thing, TypicalValue => Ideal) ideal Matrix := Ideal => (f) -> ( R := ring f; + if isWeylAlgebra R then error "two-sided ideals over Weyl algebras are not implemented"; if not isFreeModule target f or not isFreeModule source f then error "expected map between free modules"; f = flatten f; -- in case there is more than one row @@ -550,20 +561,25 @@ ideal Matrix := Ideal => (f) -> ( new Ideal from { symbol generators => f, symbol ring => R, symbol cache => new CacheTable } ) ideal Module := Ideal => (M) -> ( + if isWeylAlgebra ring M then error "two-sided ideals over Weyl algebras are not implemented"; F := ambient M; if isSubmodule M and rank F === 1 then ideal generators M else error "expected a submodule of a free module of rank 1" ) + idealPrepare = method() idealPrepare RingElement := idealPrepare Number := identity idealPrepare Matrix := m -> flatten entries m idealPrepare Ideal := I -> I_* idealPrepare Thing := x -> error "expected a list of numbers, matrices, ring elements or ideals" + ideal List := ideal Sequence := Ideal => v -> ideal matrix {flatten apply(toList splice v,idealPrepare)} ideal RingElement := ideal Number := Ideal => v -> ideal {v} ideal Ring := R -> ideal map(R^1,R^0,0) +----------------------------------------------------------------------------- + Ideal ^ Array := (I, e) -> ( R := ring I; n := numgens R; @@ -579,6 +595,8 @@ Ideal ^ Array := (I, e) -> ( ideal phi generators I ) +----------------------------------------------------------------------------- + homology(Matrix,Matrix) := Module => opts -> (g,f) -> ( if g == 0 then cokernel f else if f == 0 then kernel g From e5b294647adaa88145ccb5ee367523236cda39d6 Mon Sep 17 00:00:00 2001 From: Mahrud Sayrafi Date: Wed, 6 Dec 2023 01:52:18 -0600 Subject: [PATCH 3/9] added direct method for PolynomialRing ** PolynomialRing - still need to be able to find a common field ancestor --- M2/Macaulay2/m2/newring.m2 | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/M2/Macaulay2/m2/newring.m2 b/M2/Macaulay2/m2/newring.m2 index 9a499802a15..8fb152301fa 100644 --- a/M2/Macaulay2/m2/newring.m2 +++ b/M2/Macaulay2/m2/newring.m2 @@ -62,7 +62,11 @@ QuotientRing ** PolynomialRing := PolynomialRing ** QuotientRing := QuotientRing ** QuotientRing := (R,S) -> tensor(R,S) -tensor(PolynomialRing, PolynomialRing) := +tensor(PolynomialRing, PolynomialRing) := monoidTensorDefaults >> optns -> (R, S) -> ( + if (kk := coefficientRing R) === coefficientRing S + then kk tensor(monoid R, monoid S, optns) + else error "expected rings to have the same coefficient ring") + tensor(QuotientRing, PolynomialRing) := tensor(PolynomialRing, QuotientRing) := tensor(QuotientRing, QuotientRing) := monoidTensorDefaults >> optns -> (R, S) -> ( From f3a922c4f8cb0910b8cdf0c6f845ed19108b7e18 Mon Sep 17 00:00:00 2001 From: Mahrud Sayrafi Date: Wed, 6 Dec 2023 01:55:16 -0600 Subject: [PATCH 4/9] added hook strategy for quotients of left ideals --- M2/Macaulay2/packages/Saturation.m2 | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/M2/Macaulay2/packages/Saturation.m2 b/M2/Macaulay2/packages/Saturation.m2 index 1e2504ff073..a5a394fd486 100644 --- a/M2/Macaulay2/packages/Saturation.m2 +++ b/M2/Macaulay2/packages/Saturation.m2 @@ -48,6 +48,7 @@ override' := (def, opts) -> nonnull apply(keys def, key -> if opts#?key and opts ambient' = method() ambient' Module := Module => ambient ambient' Ideal := Ideal => I -> (if instance(I, MonomialIdeal) then monomialIdeal else ideal) 1_(ring I) +ambient' LeftIdeal := LeftIdeal => I -> ideal 1_(ring I) -- TODO: remove this once the Ideal vs. MonomialIdeal dichotomy is resolved uniform' := L -> all(L, l -> instance(l, Ideal)) or uniform L @@ -173,6 +174,7 @@ Module : Module := Ideal => (M, N) -> quotient(M, N) quotientHelper = (A, B, key, opts) -> ( R := ring A; if ring B === ZZ then B = sub(B, R); + B' := if instance(B, RingElement) then ideal B else B; strategy := opts.Strategy; doTrim := if opts.MinimalGenerators then trim else identity; @@ -182,19 +184,18 @@ quotientHelper = (A, B, key, opts) -> ( -- this logic runs the strategies in order, or the specified strategy computation := (opts, container) -> ( if R =!= ring B then error "expected objects in the same ring"; - if instance(B, RingElement) then B = ideal B; - if uniform' {A, B} and ambient' A != ambient' B + if uniform' {A, B'} and ambient' A != ambient' B' then error "expected objects to be contained in the same ambient object"; -- note: if B \subset A then A:B should be "everything", but computing -- a gb for A can be slow, so isSubset' doesn't compute a gb - if isSubset'(B, A) then return if uniform' {A, B} then cast 1_R else ambient' A; + if isSubset'(B', A) then return if uniform' {A, B'} then cast 1_R else ambient' A; -- note: ideal(..A..) : f = A <==> f is nzd / A -- note: ideal(..A..) : ideal(..B..) = A <==> -- note: module(.A.) : ideal(..B..) = A <==> B is not contained in any associated primes of A -- TODO: can either of the above be efficiently checked? -- TODO: module(.A.) : module(.B.) = ? <==> A \subset B - if instance(B, Ideal) then -- see the above TODO item - if isSubset'(ambient' A, B) then return A; + if instance(B', Ideal) then -- see the above TODO item + if isSubset'(ambient' A, B') then return A; -- TODO: add speedup for when isSubset'(A, B), being cautious of (a3):(a3,bc) in kk[abc]/ac -- TODO: what would adding {SyzygyLimit => opts.BasisElementLimit, BasisElementLimit => null} do? @@ -203,7 +204,7 @@ quotientHelper = (A, B, key, opts) -> ( -- this is the logic for caching partial quotient computations. A.cache contains an option: -- QuotientContext{ mingens B } => QuotientComputation{ Result } - container := fetchComputation(QuotientComputation, A, (A, B, opts), new QuotientContext from (A, B)); + container := fetchComputation(QuotientComputation, A, (A, B, opts), new QuotientContext from (A, B')); -- the actual computation of quotient occurs here C := (cacheComputation(opts, container)) computation; @@ -262,6 +263,17 @@ algorithms#(quotient, Ideal, Ideal) = new MutableHashTable from { scan({Quotient, Iterate-*, Linear*-, Monomial}, strategy -> addHook(key := (quotient, Ideal, Ideal), algorithms#key#strategy, Strategy => strategy)) +-------------------------------------------------------------------- +-- LeftIdeal +quotient(LeftIdeal, RingElement) := LeftIdeal => opts -> (I, f) -> quotientHelper(I, f, (quotient, LeftIdeal, RingElement), opts) + +-- Installing a hook for LeftIdeal : RingElement +addHook((quotient, LeftIdeal, RingElement), Strategy => Quotient, + (opts, I, f) -> ideal syz gb(matrix{{f}} | gens I, opts, + Strategy => LongPolynomial, + Syzygies => true, + SyzygyRows => 1)) + -------------------------------------------------------------------- -- Algorithms for Module : Ideal algorithms#(quotient, Module, Ideal) = new MutableHashTable from { From 46ebe18e22dc7fa9d2a6739ead51d0be756abfd2 Mon Sep 17 00:00:00 2001 From: Mahrud Sayrafi Date: Wed, 6 Dec 2023 01:55:40 -0600 Subject: [PATCH 5/9] added LeftIdeal class --- M2/Macaulay2/m2/exports.m2 | 1 + M2/Macaulay2/m2/intersect.m2 | 5 +++ M2/Macaulay2/m2/matrix1.m2 | 66 +++++++++++++++++++++++++++++++++--- M2/Macaulay2/m2/matrix2.m2 | 1 + M2/Macaulay2/m2/newring.m2 | 2 ++ M2/Macaulay2/m2/ringmap.m2 | 1 + 6 files changed, 71 insertions(+), 5 deletions(-) diff --git a/M2/Macaulay2/m2/exports.m2 b/M2/Macaulay2/m2/exports.m2 index 70f84103403..04590f46366 100644 --- a/M2/Macaulay2/m2/exports.m2 +++ b/M2/Macaulay2/m2/exports.m2 @@ -237,6 +237,7 @@ export { "LUdecomposition", "Layout", "Left", + "LeftIdeal", "LengthLimit", "Lex", "Limit", diff --git a/M2/Macaulay2/m2/intersect.m2 b/M2/Macaulay2/m2/intersect.m2 index 197adf05efc..6aaf599883b 100644 --- a/M2/Macaulay2/m2/intersect.m2 +++ b/M2/Macaulay2/m2/intersect.m2 @@ -85,6 +85,11 @@ intersect(Module, Module) := Module => moduleIntersectOpts >> opts -> L -> inter Ideal.intersect = idealIntersectOpts >> opts -> L -> intersectHelper(L, (intersect, Ideal, Ideal), opts) Module.intersect = moduleIntersectOpts >> opts -> L -> intersectHelper(L, (intersect, Module, Module), opts) +-- Left ideals +intersect LeftIdeal := LeftIdeal => moduleIntersectOpts >> o -> I -> ideal intersect(module I, o) +intersect(LeftIdeal, LeftIdeal) := LeftIdeal => moduleIntersectOpts >> o -> (I, J) -> ideal intersect(module I, module J, o) +LeftIdeal.intersect = moduleIntersectOpts >> o -> L -> ideal intersect(module \ L, o) + ----------------------------------------------------------------------------- -- The algorithm below is optimized for intersecting all modules at once. diff --git a/M2/Macaulay2/m2/matrix1.m2 b/M2/Macaulay2/m2/matrix1.m2 index 832d7b4c449..17c0604ffe0 100644 --- a/M2/Macaulay2/m2/matrix1.m2 +++ b/M2/Macaulay2/m2/matrix1.m2 @@ -433,6 +433,8 @@ toString Ideal := (I) -> toString expression I toExternalString Ideal := (I) -> "ideal " | toExternalString generators I texMath Ideal := (I) -> texMath expression I +Ideal#AfterPrint = Ideal#AfterNoPrint = I -> (class I, " of ", ring I) + -- basic methods isIdeal Ideal := I -> true isHomogeneous Ideal := (I) -> isHomogeneous generators I @@ -448,7 +450,7 @@ promote(Ideal,RingElement) := (I,R) -> ideal promote(generators I, R) comodule Module := Module => M -> cokernel super map(M,M,1) quotient Module := Module => opts -> M -> comodule M comodule Ideal := Module => I -> cokernel generators I -quotient Ideal := Module => opts -> I -> (ring I) / I +quotient Ideal := o -> I -> (ring I) / I module Ideal := Module => (cacheValue symbol module) (I -> image generators I) genera Ideal := (I) -> genera ((ring I)^1/I) @@ -493,8 +495,6 @@ generator Module := RingElement => (M) -> ( Ideal / Ideal := Module => (I,J) -> module I / module J Module / Ideal := Module => (M,J) -> M / (J * M) -Ideal#AfterPrint = Ideal#AfterNoPrint = (I) -> (Ideal," of ",ring I) - Ideal ^ ZZ := Ideal => (I,n) -> ideal symmetricPower(n,generators I) Ideal * Ideal := Ideal => ((I,J) -> ideal flatten (generators I ** generators J)) @@ samering Ideal * Module := Module => ((I,M) -> subquotient (generators I ** generators M, relations M)) @@ samering @@ -539,6 +539,62 @@ Ideal == Ideal := (I,J) -> ( Ideal == Module := (I,M) -> module I == M Module == Ideal := (M,I) -> M == module I +----------------------------------------------------------------------------- +-- Left ideals +----------------------------------------------------------------------------- + +LeftIdeal = new Type of Module -- or LeftModule, or ImmutableType? +LeftIdeal.synonym = "left-ideal" + +expression LeftIdeal := lookup(expression, Ideal) +LeftIdeal#AfterPrint = Ideal#AfterPrint +LeftIdeal#AfterNoPrint = Ideal#AfterNoPrint + +isTwoSidedIdeal = I -> isIdeal I and ( + -- variables appearing in I + sup := index \ support I; + -- differential variables in ring of I + dxs := last \ (ring I).WeylAlgebra; + -- check that they don't have any intersection + #sup + #dxs == #unique join(sup, dxs)) + +comodule LeftIdeal := Module => I -> cokernel generators I +quotient LeftIdeal := o -> I -> (ring I) / I +Ring / LeftIdeal := (R, I) -> ( + if isTwoSidedIdeal I then R / new Ideal from I else + error "Ring / LeftIdeal is not implemented for left ideals") + +LeftIdeal * RingElement := LeftIdeal => (I, f) -> ( + if isTwoSidedIdeal I then (new Ideal from I) * f else + error "LeftIdeal * RingElement is not implemented for left ideals") +LeftIdeal * Module := Module => ((I, M) -> subquotient(generators I ** generators M, relations M)) @@ samering + +LeftIdeal + LeftIdeal := LeftIdeal => ((I, J) -> ideal(generators I | generators J)) @@ tosamering +LeftIdeal + RingElement := LeftIdeal + Number := LeftIdeal => ((I, r) -> I + ideal r) @@ tosamering +RingElement + LeftIdeal := Number + LeftIdeal := LeftIdeal => ((r, I) -> ideal r + I) @@ tosamering + +LeftIdeal == Ring := Boolean => (I, R) -> ( + if ring I === R then 1_R % I == 0 else error "expected ideal in the given ring") + +Number % LeftIdeal := (r, I) -> promote(r, ring I) % I +RingElement % LeftIdeal := (r, I) -> ( + if (R := ring I) =!= ring r then error "expected ring element and ideal for the same ring"; + if r == 0 then r else if isHomogeneous I and heft R =!= null + then r % gb(I, DegreeLimit => degree r) else r % gb I) + +Matrix % LeftIdeal := Matrix => ((f,I) -> map(target f, source f, apply(entries f, row -> matrix row % gb I))) @@ samering +Vector % LeftIdeal := Vector => ((v,I) -> new class v from {v#0%I}) @@ samering + +dim LeftIdeal := I -> dim comodule I +module LeftIdeal := I -> new Module from I +numgens LeftIdeal := I -> numgens source generators I + +LeftIdeal_* := List => I -> first entries generators I +LeftIdeal_ZZ := RingElement => (I, n) -> (generators I)_(0,n) + +leadTerm LeftIdeal := Matrix => I -> leadTerm generators gb I +leadTerm(ZZ, LeftIdeal) := Matrix => (n, I) -> leadTerm(n, generators gb I) + ----------------------------------------------------------------------------- -- Primary constructor ----------------------------------------------------------------------------- @@ -546,7 +602,6 @@ Module == Ideal := (M,I) -> M == module I ideal = method(Dispatch => Thing, TypicalValue => Ideal) ideal Matrix := Ideal => (f) -> ( R := ring f; - if isWeylAlgebra R then error "two-sided ideals over Weyl algebras are not implemented"; if not isFreeModule target f or not isFreeModule source f then error "expected map between free modules"; f = flatten f; -- in case there is more than one row @@ -558,10 +613,11 @@ ideal Matrix := Ideal => (f) -> ( g := map(R^1,,f); -- in case the degrees are wrong if isHomogeneous g then f = g; ); + if isWeylAlgebra R then + new LeftIdeal from subquotient(f, null) else new Ideal from { symbol generators => f, symbol ring => R, symbol cache => new CacheTable } ) ideal Module := Ideal => (M) -> ( - if isWeylAlgebra ring M then error "two-sided ideals over Weyl algebras are not implemented"; F := ambient M; if isSubmodule M and rank F === 1 then ideal generators M else error "expected a submodule of a free module of rank 1" diff --git a/M2/Macaulay2/m2/matrix2.m2 b/M2/Macaulay2/m2/matrix2.m2 index c6fa492c6e2..61151c9ae83 100644 --- a/M2/Macaulay2/m2/matrix2.m2 +++ b/M2/Macaulay2/m2/matrix2.m2 @@ -440,6 +440,7 @@ indices Matrix := (f) -> rawIndices raw f support = method() support RingElement := support Matrix := f -> apply(try rawIndices raw f else {}, i -> (ring f)_i) +support LeftIdeal := support Ideal := I -> support generators I -------------------- -- homogenization -- diff --git a/M2/Macaulay2/m2/newring.m2 b/M2/Macaulay2/m2/newring.m2 index 8fb152301fa..abe44b35a7d 100644 --- a/M2/Macaulay2/m2/newring.m2 +++ b/M2/Macaulay2/m2/newring.m2 @@ -129,6 +129,8 @@ coerce(Thing,Thing) := (x,Y) -> if instance(x,Y) then x else error("no method fo coerce(Ideal,Ring) := quotient @@ first coerce(Thing,Nothing) := (x,Nothing) -> null -- avoid using this one, to save time earlier coerce(Ring,Ideal) := (R,Ideal) -> ideal R -- avoid using this one, to save time earlier +coerce(LeftIdeal,Ring) := quotient @@ first +coerce(LeftIdeal,Ideal) := first preprocessResultTemplate = (narrowers,r) -> ( if instance(r,ZZ) then r = r:null; r = apply(sequence r,x -> if x === null then Thing else x); diff --git a/M2/Macaulay2/m2/ringmap.m2 b/M2/Macaulay2/m2/ringmap.m2 index b26c8a18462..fb32d6835b8 100644 --- a/M2/Macaulay2/m2/ringmap.m2 +++ b/M2/Macaulay2/m2/ringmap.m2 @@ -209,6 +209,7 @@ RingMap Module := Module => (f, M) -> ( -- use the same module if we can if R === S and d === e then M else S^-e) ) +RingMap LeftIdeal := LeftIdeal => (f, I) -> ideal f module I -- misc tensor(RingMap, Module) := Module => {} >> opts -> (f, M) -> ( From d5386acdeee27990b446bf9dc05b6566fc0f0eca Mon Sep 17 00:00:00 2001 From: Mahrud Sayrafi Date: Wed, 6 Dec 2023 15:54:51 -0600 Subject: [PATCH 6/9] updated Dmodule packages to use LeftIdeal --- M2/Macaulay2/packages/BernsteinSato/DHom.m2 | 166 ++++++++---------- .../packages/BernsteinSato/DOC/DHom.m2 | 50 +++--- .../packages/BernsteinSato/DOC/Dlocalize.m2 | 6 +- .../BernsteinSato/DOC/Drestriction.m2 | 58 +++--- .../packages/BernsteinSato/DOC/WeylClosure.m2 | 8 +- .../packages/BernsteinSato/DOC/annFs.m2 | 4 +- .../packages/BernsteinSato/DOC/bFunctions.m2 | 8 +- .../packages/BernsteinSato/DOC/localCohom.m2 | 24 ++- .../packages/BernsteinSato/Dlocalize.m2 | 8 +- .../packages/BernsteinSato/Dresolution.m2 | 8 +- .../packages/BernsteinSato/Drestriction.m2 | 48 ++--- .../packages/BernsteinSato/TST/tests.m2 | 2 +- .../packages/BernsteinSato/WeylClosure.m2 | 6 +- M2/Macaulay2/packages/BernsteinSato/annFs.m2 | 6 +- .../packages/BernsteinSato/bFunction.ideal.m2 | 6 +- .../packages/BernsteinSato/globalBFunction.m2 | 10 +- .../BernsteinSato/intersectionCohom.m2 | 2 +- .../packages/BernsteinSato/localBFunction.m2 | 2 +- .../packages/BernsteinSato/localCohom.m2 | 68 ++++--- .../BernsteinSato/multiplierIdeals.m2 | 16 +- .../packages/BernsteinSato/paramBpoly.m2 | 8 +- .../HolonomicSystems/DOC/canonicalSeries.m2 | 24 +-- .../HolonomicSystems/canonicalSeries.m2 | 22 +-- .../packages/WeylAlgebras/DOC/basics.m2 | 52 +++--- M2/Macaulay2/packages/WeylAlgebras/Dbasic.m2 | 24 +-- M2/Macaulay2/packages/WeylAlgebras/Gbw.m2 | 8 +- .../packages/WeylAlgebras/TST/Dbasic.m2 | 5 +- .../packages/WeylAlgebras/stafford.m2 | 6 +- 28 files changed, 326 insertions(+), 329 deletions(-) diff --git a/M2/Macaulay2/packages/BernsteinSato/DHom.m2 b/M2/Macaulay2/packages/BernsteinSato/DHom.m2 index 38edc51a51e..825ef822d91 100644 --- a/M2/Macaulay2/packages/BernsteinSato/DHom.m2 +++ b/M2/Macaulay2/packages/BernsteinSato/DHom.m2 @@ -7,6 +7,7 @@ -------------------------------------------------------------------------------- -- This routine computes a monomial from a list of variables -- and an exponent vector +-- Note: when possible, use R_Exps instead List ^ List := (Vars, Exps) -> ( product (Vars, Exps, (i,j) -> (i^j)) ) @@ -40,7 +41,7 @@ divideOutGCD RingElement := L -> ( if member(j, W.dpairInds#1) then 0 else min apply(exponents L, i -> i#j)) ); newlistForm := apply(listForm L, i -> (i#0 - LCMexps, i#1)); - sum(newlistForm, i -> (i#1)*( ((entries vars W)#0)^(i#0) ) ) + sum(newlistForm, i -> i#1 * W_(i#0)) ) divideOutGCD Matrix := m -> ( @@ -56,7 +57,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; @@ -86,24 +87,20 @@ Ddual Module := M -> ( -------------------------------------------------------------------------------- polynomialSolutions = method(Options => {Alg => GD} ) -polynomialSolutions Ideal := options -> I -> ( - polynomialSolutions((ring I)^1/I, options) ) +polynomialSolutions LeftIdeal := opts -> I -> polynomialSolutions(comodule I, opts) +polynomialSolutions(LeftIdeal, List) := opts -> (I, w) -> polynomialSolutions(comodule I, w, opts) -polynomialSolutions(Ideal,List) := options -> (I,w) -> ( - polynomialSolutions((ring I)^1/I, w, options) ) - -polynomialSolutions Module := options -> M -> ( +polynomialSolutions Module := opts -> M -> ( W := ring M; if W.monoid.Options.WeylAlgebra === {} then error "expected an element of a Weyl algebra"; createDpairs W; n := #W.dpairVars#0; w := toList(n:1); - polynomialSolutions(M, w, options) + polynomialSolutions(M, w, opts) ) -polynomialSolutions(Module, List) := options -> (M, w) -> ( - +polynomialSolutions(Module, List) := opts -> (M, w) -> ( pInfo (1, "ENTERING polynomialSolutions ..."); W := ring M; K := coefficientRing W; @@ -113,7 +110,7 @@ polynomialSolutions(Module, List) := options -> (M, w) -> ( createDpairs W; n := #W.dpairVars#0; - if options#Alg == GD then ( + if opts#Alg == GD then ( -- error checking if not isQuotientModule M then error "expected input to be a quotient module"; @@ -126,7 +123,7 @@ polynomialSolutions(Module, List) := options -> (M, w) -> ( I := ideal relations M; inI := inw(I, join(w,-w)); if not W.?ThetaRing then createThetaRing W; - if all(flatten entries gens inI, W.isGeneric) then ( + if all(inI_*, W.isGeneric) then ( genI := gens inI; inI = ideal divideOutGCD gens inI; ) @@ -168,7 +165,7 @@ polynomialSolutions(Module, List) := options -> (M, w) -> ( ); pInfo(1, "Need to solve " | rank source linEqns | " equations"); - dummyEqn := sum((entries vars S)#0); + dummyEqn := sum gens S; linEqns = (gens gb (linEqns, DegreeLimit => 1)) | matrix{{dummyEqn}}; --MES coeffs := substitute( @@ -181,7 +178,7 @@ polynomialSolutions(Module, List) := options -> (M, w) -> ( ); ) - else if options.Alg == Duality then ( + else if opts.Alg == Duality then ( diffSub := apply(W.dpairVars#1, i -> i => 0); if #w != n then error "expected weight vector of length n"; if any(w, i->i<=0) then error "expected strictly positive weight vector"; @@ -255,11 +252,8 @@ polynomialSolutions(Module, List) := options -> (M, w) -> ( -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- polynomialExt = method(Options => {Strategy => Schreyer}) -polynomialExt Ideal := options -> I -> ( - polynomialExt ((ring I)^1/I, options) - ) - -polynomialExt Module := options -> (M) -> ( +polynomialExt LeftIdeal := opts -> I -> polynomialExt(comodule I, opts) +polynomialExt Module := opts -> M -> ( pInfo (1, "ENTERING polynomialExt ..."); W := ring M; createDpairs W; @@ -267,27 +261,24 @@ polynomialExt Module := options -> (M) -> ( w := toList(n:1); outputList := {}; N := Ddual M; - integrateTable := Dintegration(zeroize N, w, options); + integrateTable := Dintegration(zeroize N, w, opts); homologyTable := hashTable apply(toList(0..n), - i -> (n-i) => integrateTable#i); - homologyTable + i -> (n-i) => integrateTable#i) ) -polynomialExt(ZZ, Ideal) := options -> (k, I) -> ( - if not I.?quotient then I.quotient = (ring I)^1/I; - polynomialExt (k, I.quotient, options) - ) +polynomialExt(ZZ, LeftIdeal) := opts -> (k, I) -> ( + if not I.?quotient then I.quotient = comodule I; + polynomialExt(k, I.quotient, opts)) -polynomialExt(ZZ, Module) := options -> (k, M) -> ( +polynomialExt(ZZ, Module) := opts -> (k, M) -> ( pInfo (1, "ENTERING polynomialExt ..."); W := ring M; createDpairs W; n := #W.dpairVars#0; w := toList(n:1); outputList := {}; - N := Ddual M; - integrateModule := Dintegration(n-k, zeroize N, w, options); - integrateModule + N := Ddual M; + Dintegration(n-k, zeroize N, w, opts) ) -------------------------------------------------------------------------------- @@ -297,7 +288,7 @@ 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); @@ -305,19 +296,19 @@ rationalFunctionSolutions(Ideal) := (I) -> ( 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; @@ -326,13 +317,11 @@ rationalFunctionSolutions(Ideal, RingElement, List) := (I, f, w) -> ( numerators := polynomialSolutions (twistI, w); R := (coefficientRing W)(monoid [W.dpairVars#0]); F := substitute(f^k, R); - solsList := apply (numerators, i -> ( substitute(i,R)/F ) ); + apply(numerators, i -> substitute(i,R) / F ) ) - else solsList = polynomialSolutions(I, w); - solsList - ) + else polynomialSolutions(I, w)) -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); @@ -345,19 +334,17 @@ rationalFunctionSolutions(Ideal, List, List) := (I, f, w) -> ( numerators := polynomialSolutions (twistI, w); R := (coefficientRing W)(monoid [W.dpairVars#0]); F := substitute(newf^newk, R); - solsList := apply (numerators, i -> (substitute(i,R) / F) ); + apply(numerators, i -> (substitute(i,R) / F)) ) - else solsList = polynomialSolutions(I, w); - solsList - ) + else polynomialSolutions(I, w)) -- internal TwistOperator = method() -TwistOperator(Ideal, RingElement, ZZ) := (I, f, k) -> ( - ideal apply((entries gens I)#0, L -> TwistOperator(L, f, k)) +TwistOperator(LeftIdeal, RingElement, ZZ) := (I, f, k) -> ( + ideal apply(I_*, L -> TwistOperator(L, f, k)) ) -TwistOperator(Ideal, List, List) := (I, f, k) -> ( - ideal apply((entries gens I)#0, L -> TwistOperator(L, f, k)) +TwistOperator(LeftIdeal, List, List) := (I, f, k) -> ( + ideal apply(I_*, L -> TwistOperator(L, f, k)) ) TwistOperator(RingElement, RingElement, ZZ) := (L, f, k) -> ( @@ -450,12 +437,12 @@ TwistOperator(RingElement, List, List) := (L, f, k) -> ( -------------------------------------------------------------------------------- rationalFunctionExt = method(Options => {Strategy => Schreyer} ) -rationalFunctionExt Ideal := options -> I -> ( +rationalFunctionExt LeftIdeal := opts -> I -> ( f := (singLocus(I))_0; rationalFunctionExt (I, f) ) -rationalFunctionExt Module := options -> M -> ( +rationalFunctionExt Module := opts -> M -> ( r := numgens target gens M; -- case 1: M is a proper submodule of (D_n)^r/N if gens M != map (ring M)^r @@ -468,11 +455,11 @@ rationalFunctionExt Module := options -> M -> ( ) -rationalFunctionExt(Ideal, RingElement) := options -> (I, f) -> ( - rationalFunctionExt ((ring I)^1/I, f, options) +rationalFunctionExt(LeftIdeal, RingElement) := opts -> (I, f) -> ( + rationalFunctionExt (comodule I, f, opts) ) -rationalFunctionExt(Module, RingElement) := options -> (M, f) -> ( +rationalFunctionExt(Module, RingElement) := opts -> (M, f) -> ( pInfo (1, "ENTERING RatlExt ..."); W := ring M; createDpairs W; @@ -481,13 +468,13 @@ rationalFunctionExt(Module, RingElement) := options -> (M, f) -> ( outputList := {}; N := zeroize Ddual M; N2 := Dlocalize(N, f); - integrateTable := Dintegration(zeroize N2, w, options); + integrateTable := Dintegration(zeroize N2, w, opts); homologyTable := hashTable apply(toList(0..n), i -> (n-i) => integrateTable#i); homologyTable ) -rationalFunctionExt(ZZ, Module) := options -> (k, M) -> ( +rationalFunctionExt(ZZ, Module) := opts -> (k, M) -> ( r := numgens target gens M; -- case 1: M is a proper submodule of (D_n)^r/N if gens M != map (ring M)^r @@ -499,16 +486,16 @@ rationalFunctionExt(ZZ, Module) := options -> (k, M) -> ( rationalFunctionExt (k, M, f) ) -rationalFunctionExt(ZZ, Ideal) := options -> (k, I) -> ( +rationalFunctionExt(ZZ, LeftIdeal) := opts -> (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) := opts -> (k, I, f) -> ( + rationalFunctionExt (k, comodule I, f, opts) ) -rationalFunctionExt(ZZ, Module, RingElement) := options -> (k, M, f) -> ( +rationalFunctionExt(ZZ, Module, RingElement) := opts -> (k, M, f) -> ( pInfo (1, "ENTERING RatlExt ..."); W := ring M; createDpairs W; @@ -517,7 +504,7 @@ rationalFunctionExt(ZZ, Module, RingElement) := options -> (k, M, f) -> ( outputList := {}; N := zeroize Ddual M; N2 := Dlocalize(N, f); - integrateModule := Dintegration(n-k, zeroize N2, w, options); + integrateModule := Dintegration(n-k, zeroize N2, w, opts); integrateModule ) @@ -531,25 +518,25 @@ rationalFunctionExt(ZZ, Module, RingElement) := options -> (k, M, f) -> ( DHom = method(Options => {Strategy => Schreyer}) -DHom(Ideal, Ideal) := options -> (I, J) -> ( +DHom(LeftIdeal, LeftIdeal) := opts -> (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(comodule I, comodule J, w, opts) ) -DHom(Module, Module) := options -> (M, N) -> ( +DHom(Module, Module) := opts -> (M, N) -> ( W := ring M; createDpairs W; n := #W.dpairVars#0; w := toList(2*n:1); - DHom(M, N, w, options) + DHom(M, N, w, opts) ) protect diagonal -DHom(Module, Module, List) := options -> (M, N, w) -> ( +DHom(Module, Module, List) := opts -> (M, N, w) -> ( pInfo (1, "ENTERING DHom ..."); W := ring M; nW := numgens W; @@ -661,15 +648,15 @@ DHom(Module, Module, List) := options -> (M, N, w) -> ( DExt = method(Options => {Strategy => Schreyer, Info => 1, Output => HomologyModules, Special => None}) -DExt(Module, Module) := options -> (M, N) -> ( +DExt(Module, Module) := opts -> (M, N) -> ( W := ring M; createDpairs W; n := #W.dpairVars#0; w := toList(2*n:1); - DExt(M, N, w, options) + DExt(M, N, w, opts) ) -DExt(Module, Module, List) := options -> (M, N, w) -> ( +DExt(Module, Module, List) := opts -> (M, N, w) -> ( pInfo (1, "ENTERING DExt ..."); W := ring M; nW := numgens W; @@ -699,7 +686,7 @@ DExt(Module, Module, List) := options -> (M, N, w) -> ( MdualN := ExternalProduct(Mdual,N, TwistMap => true); restrictTable := computeRestriction((ring MdualN).twistMap ** MdualN, - w, -1, n+1, {HomologyModules}, options); + w, -1, n+1, {HomologyModules}, opts); ExtTable := hashTable apply(toList(0..n), i -> i => restrictTable#HomologyModules#(n-i)); ExtTable @@ -711,7 +698,7 @@ DExt(Module, Module, List) := options -> (M, N, w) -> ( -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- ExternalProduct = method(Options => {TwistMap => false}) -ExternalProduct(Module, Module) := options -> (M, N) -> ( +ExternalProduct(Module, Module) := opts -> (M, N) -> ( pInfo(1, "ENTERING ExternalProduct ..."); @@ -761,7 +748,7 @@ ExternalProduct(Module, Module) := options -> (M, N) -> ( WW.projMap2 = map(W2, WW, join(toList(nW1:0), projList2)); -- MAKE TWISTMAP TO DIAGONAL - if W1 === W2 and options.TwistMap then ( + if W1 === W2 and opts.TwistMap then ( n := n1; nW := nW1; naux := m1; @@ -793,7 +780,7 @@ ExternalProduct(Module, Module) := options -> (M, N) -> ( incM**incN ) -ExternalProduct(ChainComplex, ChainComplex) := options -> (F, G) -> ( +ExternalProduct(ChainComplex, ChainComplex) := opts -> (F, G) -> ( pInfo(1, "ENTERING ExternalProduct ..."); @@ -840,7 +827,7 @@ ExternalProduct(ChainComplex, ChainComplex) := options -> (F, G) -> ( -- MAKE TWISTMAP TO DIAGONAL - if W1 === W2 and options.TwistMap then ( + if W1 === W2 and opts.TwistMap then ( n := n1; nW := nW1; naux := m1; @@ -903,20 +890,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) @@ -934,12 +920,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]; @@ -962,14 +950,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; @@ -998,11 +986,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; @@ -1025,8 +1014,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; diff --git a/M2/Macaulay2/packages/BernsteinSato/DOC/DHom.m2 b/M2/Macaulay2/packages/BernsteinSato/DOC/DHom.m2 index 1bd8c12ed5d..6d82f867441 100644 --- a/M2/Macaulay2/packages/BernsteinSato/DOC/DHom.m2 +++ b/M2/Macaulay2/packages/BernsteinSato/DOC/DHom.m2 @@ -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 => { @@ -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", ", ", @@ -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 =>{ @@ -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"} @@ -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 => { @@ -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 @@ -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" }, @@ -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."}, @@ -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 @@ -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 @@ -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 @@ -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 diff --git a/M2/Macaulay2/packages/BernsteinSato/DOC/Dlocalize.m2 b/M2/Macaulay2/packages/BernsteinSato/DOC/Dlocalize.m2 index ed46c86b7a6..4f1d76cd581 100644 --- a/M2/Macaulay2/packages/BernsteinSato/DOC/Dlocalize.m2 +++ b/M2/Macaulay2/packages/BernsteinSato/DOC/Dlocalize.m2 @@ -38,7 +38,7 @@ document { EXAMPLE lines /// W = QQ[x,y,Dx,Dy, WeylAlgebra => {x=>Dx,y=>Dy}] - M = W^1/(ideal(x*Dx+1, Dy)) + M = coker gens ideal(x*Dx+1, Dy) f = x^2-y^3 Mf = Dlocalize(M, f) ///, @@ -61,7 +61,7 @@ document { " that computes the localization map.", EXAMPLE lines /// W = QQ[x,y,Dx,Dy, WeylAlgebra => {x=>Dx,y=>Dy}] - M = W^1/(ideal(x*Dx+1, Dy)) + M = coker gens ideal(x*Dx+1, Dy) f = x^2-y^3 DlocalizeMap(M, f) ///, @@ -105,7 +105,7 @@ doc /// $s$ such that (the images of) the generators of $M$ are $f^{-s}$ times the generators of $M_f$. Example W = makeWeylAlgebra(QQ[x,y]) - M = W^1/ideal(x*dx + 1, dy) + M = coker gens ideal(x*dx + 1, dy) f = x^2 - y^3 Mfall = DlocalizeAll(M, f) gens image Mfall.LocMap == f^(-Mfall.GeneratorPower) * gens Mfall.LocModule diff --git a/M2/Macaulay2/packages/BernsteinSato/DOC/Drestriction.m2 b/M2/Macaulay2/packages/BernsteinSato/DOC/Drestriction.m2 index e06b9943426..87cb56db404 100644 --- a/M2/Macaulay2/packages/BernsteinSato/DOC/Drestriction.m2 +++ b/M2/Macaulay2/packages/BernsteinSato/DOC/Drestriction.m2 @@ -24,13 +24,13 @@ document { } document { - Key => {Dresolution, (Dresolution,Module), (Dresolution,Ideal,List), - (Dresolution,Module,List), (Dresolution,Ideal)}, + Key => {Dresolution, (Dresolution,Module), (Dresolution,LeftIdeal,List), + (Dresolution,Module,List), (Dresolution,LeftIdeal)}, Headline => "resolution of a D-module", Usage => "Dresolution M, Dresolution I, Dresolution(M,w), Dresolution(I,w)", 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"}, "w" => List => "a weight vector" }, Outputs => { @@ -81,14 +81,14 @@ document { } document { - Key => {Drestriction, (Drestriction,ZZ,Module,List), (Drestriction,Ideal,List), - (Drestriction,Module,List), (Drestriction,ZZ,Ideal,List)}, + Key => {Drestriction, (Drestriction,ZZ,Module,List), (Drestriction,LeftIdeal,List), + (Drestriction,Module,List), (Drestriction,ZZ,LeftIdeal,List)}, Headline => "restriction modules of a D-module", Usage => "N = Drestriction(M,w), NI = Drestriction(I,w), Ni = Drestriction(i,M,w), NIi = Drestriction(i,I,w)", 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"}, "w" => List => "a weight vector", "i" => ZZ => "nonnegative" }, @@ -131,15 +131,15 @@ document { } document { - Key => {DrestrictionIdeal, (DrestrictionIdeal, Ideal, List)}, + Key => {DrestrictionIdeal, (DrestrictionIdeal, LeftIdeal, List)}, Headline => "restriction ideal of a D-module", Usage => "DrestrictionIdeal(I,w)", Inputs => { - "I" => Ideal => {"which represents the module ", EM "M = D/I"}, + "I" => LeftIdeal => {"which represents the module ", EM "M = D/I"}, "w" => List => "a weight vector" }, Outputs => { - Ideal => {"the restriction ideal of ", EM "M", " w.r.t. the weight vector ", EM "w"} + LeftIdeal => {"the restriction ideal of ", EM "M", " w.r.t. the weight vector ", EM "w"} }, "A supplementary function for ", TO "Drestriction", " that computes the restriction ideal.", @@ -156,12 +156,12 @@ document { } document { - Key => {DrestrictionAll, (DrestrictionAll, Module, List), (DrestrictionAll, Ideal, List)}, + Key => {DrestrictionAll, (DrestrictionAll, Module, List), (DrestrictionAll, LeftIdeal, List)}, Headline => "restriction modules of a D-module (extended version)", Usage => "N = DrestrictionAll(M,w), NI = DrestrictionAll(I,w)", 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"}, "w" => List => "a weight vector" }, Outputs => { @@ -184,12 +184,12 @@ document { } document { - Key => {DrestrictionComplex, (DrestrictionComplex, Module, List), (DrestrictionComplex, Ideal, List)}, + Key => {DrestrictionComplex, (DrestrictionComplex, Module, List), (DrestrictionComplex, LeftIdeal, List)}, Headline => "derived restriction complex of a D-module", Usage => "N = DrestrictionComplex(M,w), NI = DrestrictionComplex(I,w)", 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"}, "w" => List => "a weight vector" }, Outputs => { @@ -212,14 +212,14 @@ document { document { - Key => {DrestrictionClasses, (DrestrictionClasses,ZZ,Module,List), (DrestrictionClasses,Ideal,List), (DrestrictionClasses,Module,List), - (DrestrictionClasses,ZZ,Ideal,List)}, + Key => {DrestrictionClasses, (DrestrictionClasses,ZZ,Module,List), (DrestrictionClasses,LeftIdeal,List), (DrestrictionClasses,Module,List), + (DrestrictionClasses,ZZ,LeftIdeal,List)}, Headline => "restriction classes of a D-module", Usage => "N = DrestrictionClasses(M,w), NI = DrestrictionClasses(I,w), Ni = DrestrictionClasses(i,M,w), NIi = DrestrictionClasses(i,I,w), ", 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"}, "w" => List => "a weight vector", "i" => ZZ => "nonnegative" }, @@ -297,14 +297,14 @@ document { } document { - Key => { Dintegration, (Dintegration,ZZ,Module,List), (Dintegration,Ideal,List), - (Dintegration,Module,List), (Dintegration,ZZ,Ideal,List) }, + Key => { Dintegration, (Dintegration,ZZ,Module,List), (Dintegration,LeftIdeal,List), + (Dintegration,Module,List), (Dintegration,ZZ,LeftIdeal,List) }, Headline => "integration modules of a D-module", Usage => "N = Dintegration(M,w), NI = Dintegration(I,w), Ni = Dintegration(i,M,w), NIi = Dintegration(i,I,w), ", 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"}, "w" => List => "a weight vector", "i" => ZZ => "nonnegative" }, @@ -344,15 +344,15 @@ document { } document { - Key => {DintegrationIdeal, (DintegrationIdeal, Ideal, List)}, + Key => {DintegrationIdeal, (DintegrationIdeal, LeftIdeal, List)}, Headline => "integration ideal of a D-module", Usage => "DintegrationIdeal(I,w)", Inputs => { - "I" => Ideal => {"which represents the module ", EM "M = D/I"}, + "I" => LeftIdeal => {"which represents the module ", EM "M = D/I"}, "w" => List => "a weight vector" }, Outputs => { - Ideal => {"the integration ideal of ", EM "M", " w.r.t. the weight vector ", EM "w"} + LeftIdeal => {"the integration ideal of ", EM "M", " w.r.t. the weight vector ", EM "w"} }, "A supplementary function for ", TO "Dintegration", " that computes the integration ideal.", @@ -369,12 +369,12 @@ document { } document { - Key => {DintegrationAll, (DintegrationAll, Module, List), (DintegrationAll, Ideal, List)}, + Key => {DintegrationAll, (DintegrationAll, Module, List), (DintegrationAll, LeftIdeal, List)}, Headline => "integration modules of a D-module (extended version)", Usage => "N = DintegrationAll(M,w), NI = DintegrationAll(I,w)", 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"}, "w" => List => "a weight vector" }, Outputs => { @@ -397,12 +397,12 @@ document { } document { - Key => {DintegrationComplex, (DintegrationComplex, Module, List), (DintegrationComplex, Ideal, List)}, + Key => {DintegrationComplex, (DintegrationComplex, Module, List), (DintegrationComplex, LeftIdeal, List)}, Headline => "derived integration complex of a D-module", Usage => "N = DintegrationComplex(M,w), NI = DintegrationComplex(I,w)", 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"}, "w" => List => "a weight vector" }, Outputs => { @@ -425,14 +425,14 @@ document { document { - Key => {DintegrationClasses, (DintegrationClasses,ZZ,Module,List), (DintegrationClasses,Ideal,List), (DintegrationClasses,Module,List), - (DintegrationClasses,ZZ,Ideal,List)}, + Key => {DintegrationClasses, (DintegrationClasses,ZZ,Module,List), (DintegrationClasses,LeftIdeal,List), (DintegrationClasses,Module,List), + (DintegrationClasses,ZZ,LeftIdeal,List)}, Headline => "integration classes of a D-module", Usage => "N = DintegrationClasses(M,w), NI = DintegrationClasses(I,w), Ni = DintegrationClasses(i,M,w), NIi = DintegrationClasses(i,I,w), ", 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"}, "w" => List => "a weight vector", "i" => ZZ => "nonnegative" }, diff --git a/M2/Macaulay2/packages/BernsteinSato/DOC/WeylClosure.m2 b/M2/Macaulay2/packages/BernsteinSato/DOC/WeylClosure.m2 index 06bf8056cd1..a8d877e4495 100644 --- a/M2/Macaulay2/packages/BernsteinSato/DOC/WeylClosure.m2 +++ b/M2/Macaulay2/packages/BernsteinSato/DOC/WeylClosure.m2 @@ -1,20 +1,20 @@ doc /// Key WeylClosure - (WeylClosure, Ideal) - (WeylClosure, Ideal, RingElement) + (WeylClosure, LeftIdeal) + (WeylClosure, LeftIdeal, RingElement) Headline Weyl closure of an ideal Usage WeylClosure I WeylClosure(I,f) Inputs - I:Ideal + I:LeftIdeal a left ideal of the Weyl Algebra f:RingElement a polynomial Outputs - :Ideal + :LeftIdeal the Weyl closure (w.r.t. $f$) of $I$ Description Text diff --git a/M2/Macaulay2/packages/BernsteinSato/DOC/annFs.m2 b/M2/Macaulay2/packages/BernsteinSato/DOC/annFs.m2 index dd9cd987851..9b3ebe5d322 100644 --- a/M2/Macaulay2/packages/BernsteinSato/DOC/annFs.m2 +++ b/M2/Macaulay2/packages/BernsteinSato/DOC/annFs.m2 @@ -27,7 +27,7 @@ doc /// /// document { - Key => {(AnnIFs, Ideal,RingElement), AnnIFs}, + Key => {(AnnIFs, LeftIdeal,RingElement), AnnIFs}, Headline => "the annihilating ideal of f^s for an arbitrary D-module", Usage => "AnnIFs(I,f)", Inputs => { @@ -40,7 +40,7 @@ document { " (should contain no differential variables)"} }, Outputs => { - Ideal => {"the annihilating ideal of ", TEX "A_n[f^{-1},s] f^s", " tensored with ", + LeftIdeal => {"the annihilating ideal of ", TEX "A_n[f^{-1},s] f^s", " tensored with ", TEX "A_n/I", " over the ring of polynomials" } }, EXAMPLE lines /// diff --git a/M2/Macaulay2/packages/BernsteinSato/DOC/bFunctions.m2 b/M2/Macaulay2/packages/BernsteinSato/DOC/bFunctions.m2 index a96e2d72440..65f1ca9af68 100644 --- a/M2/Macaulay2/packages/BernsteinSato/DOC/bFunctions.m2 +++ b/M2/Macaulay2/packages/BernsteinSato/DOC/bFunctions.m2 @@ -2,7 +2,7 @@ document { Key => bFunction, Headline => "b-function", UL { - {TO (bFunction, Ideal,List), " - for an ideal"}, + {TO (bFunction, LeftIdeal,List), " - for an ideal"}, {TO (bFunction, Module,List,List), " - for a module"} } } @@ -40,7 +40,7 @@ document { } document { - Key => (bFunction, Ideal, List), + Key => (bFunction, LeftIdeal, List), Headline => "b-function of an ideal", Usage => "b = bFunction(I,w)", Inputs => { @@ -310,7 +310,7 @@ document { } document { - Key => {(globalB, Ideal, RingElement), globalB}, + Key => {(globalB, LeftIdeal, RingElement), globalB}, Headline => "compute global b-function and b-operator for a D-module and a polynomial", Usage => "H = globalB(I,f)", @@ -349,7 +349,7 @@ document { SeeAlso => {"globalB"} } -document { +document { Key => {(localBFunction,RingElement,Ideal), localBFunction}, Headline => "local b-function (a.k.a. the local Bernstein-Sato polynomial)", Usage => "b = localBFunction(f,P)", diff --git a/M2/Macaulay2/packages/BernsteinSato/DOC/localCohom.m2 b/M2/Macaulay2/packages/BernsteinSato/DOC/localCohom.m2 index a6c57992b3a..27efc7dbee0 100644 --- a/M2/Macaulay2/packages/BernsteinSato/DOC/localCohom.m2 +++ b/M2/Macaulay2/packages/BernsteinSato/DOC/localCohom.m2 @@ -98,8 +98,9 @@ document { } }, EXAMPLE { - "W = QQ[X, dX, Y, dY, Z, dZ, WeylAlgebra=>{X=>dX, Y=>dY, Z=>dZ}]", + "R = QQ[X, Y, Z]", "I = ideal (X*(Y-Z), X*Y*Z)", + "W = makeWeylAlgebra R", "h = localCohom I", "pruneLocalCohom h" }, @@ -116,8 +117,9 @@ document { Outputs => { { "the local cohomology of ", TT "I", " in the degrees specified by ", EM "l" } }, "See ", TO (localCohom, Ideal), " for the full description.", EXAMPLE { - "W = QQ[X, dX, Y, dY, Z, dZ, WeylAlgebra=>{X=>dX, Y=>dY, Z=>dZ}]", + "R = QQ[X, Y, Z]", "I = ideal (X*(Y-Z), X*Y*Z)", + "W = makeWeylAlgebra R", "h = localCohom({1,2}, I)", "pruneLocalCohom h" }, @@ -132,8 +134,9 @@ document { Outputs => {{ "the local cohomology of ", TT "I", " in degree ", EM "d" }}, "See ", TO (localCohom, Ideal), " for the full description.", EXAMPLE { - "W = QQ[X, dX, Y, dY, Z, dZ, WeylAlgebra=>{X=>dX, Y=>dY, Z=>dZ}]", + "R = QQ[X, Y, Z]", "I = ideal (X*(Y-Z), X*Y*Z)", + "W = makeWeylAlgebra R", "h = localCohom (2,I)", "Dprune h" }, @@ -161,9 +164,10 @@ document { } }, EXAMPLE { - "W = QQ[X, dX, Y, dY, Z, dZ, WeylAlgebra=>{X=>dX, Y=>dY, Z=>dZ}]", + "R = QQ[X, Y, Z]", "I = ideal (X*(Y-Z), X*Y*Z)", - "h = localCohom(I, W^1 / ideal{dX,dY,dZ})", + "W = makeWeylAlgebra R", + "h = localCohom(I, coker gens ideal{dX,dY,dZ})", "pruneLocalCohom h" }, Caveat => {"The modules returned are not simplified, @@ -183,9 +187,10 @@ document { }}, "See ", TO "localCohom(Ideal,Module)", " for the full description.", EXAMPLE { - "W = QQ[X, dX, Y, dY, Z, dZ, WeylAlgebra=>{X=>dX, Y=>dY, Z=>dZ}]", + "R = QQ[X, Y, Z]", "I = ideal (X*(Y-Z), X*Y*Z)", - "h = localCohom(2, I, W^1 / ideal{dX,dY,dZ})", + "W = makeWeylAlgebra R", + "h = localCohom(2, I, coker gens ideal{dX,dY,dZ})", "pruneLocalCohom h" }, SeeAlso => {"pruneLocalCohom"} @@ -204,9 +209,10 @@ document { }}, "See ", TO "localCohom(Ideal,Module)", " for the full description.", EXAMPLE { - "W = QQ[X, dX, Y, dY, Z, dZ, WeylAlgebra=>{X=>dX, Y=>dY, Z=>dZ}]", + "R = QQ[X, Y, Z]", "I = ideal (X*(Y-Z), X*Y*Z)", - "h = localCohom({1,2}, I, W^1 / ideal{dX,dY,dZ})", + "W = makeWeylAlgebra R", + "h = localCohom({1,2}, I, coker gens ideal{dX,dY,dZ})", "pruneLocalCohom h" }, SeeAlso => {"pruneLocalCohom"} diff --git a/M2/Macaulay2/packages/BernsteinSato/Dlocalize.m2 b/M2/Macaulay2/packages/BernsteinSato/Dlocalize.m2 index 1d4947e91a0..a3a15c93b19 100644 --- a/M2/Macaulay2/packages/BernsteinSato/Dlocalize.m2 +++ b/M2/Macaulay2/packages/BernsteinSato/Dlocalize.m2 @@ -110,7 +110,7 @@ computeLocalization = (M, f, output, options) -> ( bestPower := min (getIntRoots (bpoly)); if bestPower == infinity then bestPower = 0; locIdeal := substitute(substitute(AnnI, {Ws_(ns-1) => bestPower}), W); - locModule := W^1/locIdeal; + locModule := coker gens locIdeal; local locMap; if member (LocMap, output) then ( @@ -122,7 +122,7 @@ computeLocalization = (M, f, output, options) -> ( bestPower = 0; locIdeal = substitute(substitute(AnnI, {Ws_(ns-1) => bestPower}), W); - locModule = W^1/locIdeal; + locModule = coker gens locIdeal; locMap = map(locModule, M, matrix{{f^(-bestPower)}}) ) else locMap = map(locModule, M, matrix{{f^(-bestPower)}}); @@ -315,7 +315,7 @@ computeLocalization = (M, f, output, options) -> ( ) AnnIFs2 = method() -AnnIFs2(Ideal, RingElement) := (I, f) -> ( +AnnIFs2(LeftIdeal, RingElement) := (I, f) -> ( pInfo(1, "computing AnnIFs... "); W := ring I; n := numgens W; @@ -402,7 +402,7 @@ u = symbol u; Du = symbol Du; n = 4; W = QQ[u_1..u_n, Du_1..Du_n, WeylAlgebra => apply(toList(1..n), i -> u_i => Du_i)]; -M = W^1/ideal(Du_1..Du_n); +M = coker gens ideal(Du_1..Du_n); f = sum(toList(1..n), i -> u_i^2); assert(Dlocalize(M, f) == Dlocalize(M, f, Strategy => Oaku)); assert(DlocalizeMap(M, f) == DlocalizeMap(M, f, Strategy => Oaku)); diff --git a/M2/Macaulay2/packages/BernsteinSato/Dresolution.m2 b/M2/Macaulay2/packages/BernsteinSato/Dresolution.m2 index b5f38ac6ac4..a24b3d54488 100644 --- a/M2/Macaulay2/packages/BernsteinSato/Dresolution.m2 +++ b/M2/Macaulay2/packages/BernsteinSato/Dresolution.m2 @@ -63,7 +63,7 @@ kerGB := m -> ( -------------------------------------------------------------------------------- Dresolution = method( Options => {Strategy => Schreyer, LengthLimit => infinity} ) -Dresolution Ideal := options -> I -> Dresolution(comodule I, options) +Dresolution LeftIdeal := options -> I -> Dresolution(comodule I, options) Dresolution Module := options -> M -> ( pInfo (1, "ENTERING Dresolution ... "); @@ -100,9 +100,7 @@ Dresolution Module := options -> M -> ( M.cache.resolution ) -Dresolution (Ideal, List) := options -> (I, w) -> ( - Dresolution ((ring I)^1/I, w, options) - ) +Dresolution (LeftIdeal, List) := options -> (I, w) -> Dresolution (coker gens I, w, options) Dresolution (Module, List) := options -> (M, w) -> ( @@ -252,10 +250,8 @@ I = ideal 0_W; J = ideal 1_W; w = {-1,1} assert( Dres(I) == Dres(I, w) ); -assert( Dres(W^1/I) == Dres(W^1/I, w) ); assert( Dres(module I) == Dres(module I, w) ); assert( Dres(J) == Dres(J, w) ); -assert( Dres(W^1/J) == Dres(W^1/J, w) ); assert( Dres (module J) == Dres(module J, w) ); -- Resolutions in the same res Grobner cone diff --git a/M2/Macaulay2/packages/BernsteinSato/Drestriction.m2 b/M2/Macaulay2/packages/BernsteinSato/Drestriction.m2 index 9b5b3be75e4..b2405dcf39a 100644 --- a/M2/Macaulay2/packages/BernsteinSato/Drestriction.m2 +++ b/M2/Macaulay2/packages/BernsteinSato/Drestriction.m2 @@ -72,7 +72,7 @@ ensureQuotientModule(Module, String) := (M,errorString) -> ( -------------------------------------------------------------------------------- Drestriction = method( Options => {Strategy => Schreyer} ) -Drestriction(Ideal, List) := options -> (I,w) -> Drestriction(comodule I, w, options) +Drestriction(LeftIdeal, List) := options -> (I,w) -> Drestriction(comodule I, w, options) Drestriction(Module, List) := options -> (M,w) -> ( ensureQuotientModule(M, "Drestriction currently only handles quotient modules"); @@ -83,7 +83,7 @@ Drestriction(Module, List) := options -> (M,w) -> ( outputTable#HomologyModules ) -Drestriction(ZZ, Ideal, List) := options -> (k,I,w) -> Drestriction (k, comodule I, w, options) +Drestriction(ZZ, LeftIdeal, List) := options -> (k,I,w) -> Drestriction (k, comodule I, w, options) Drestriction(ZZ,Module,List) := options -> (k,M,w) -> ( ensureQuotientModule(M, "Drestriction currently only handles quotient modules"); @@ -101,7 +101,7 @@ Drestriction(ZZ,Module,List) := options -> (k,M,w) -> ( -------------------------------------------------------------------------------- DrestrictionClasses = method( Options => {Strategy => Schreyer} ) -DrestrictionClasses(Ideal, List) := options -> (I,w) -> DrestrictionClasses(comodule I, w, options) +DrestrictionClasses(LeftIdeal, List) := options -> (I,w) -> DrestrictionClasses(comodule I, w, options) DrestrictionClasses(Module, List) := options -> (M,w) -> ( ensureQuotientModule(M, "Drestriction currently only handles quotient modules"); @@ -116,7 +116,7 @@ DrestrictionClasses(Module, List) := options -> (M,w) -> ( outputTable ) -DrestrictionClasses(ZZ, Ideal, List) := options -> (k,I,w) -> DrestrictionClasses (k, comodule I, w, options) +DrestrictionClasses(ZZ, LeftIdeal, List) := options -> (k,I,w) -> DrestrictionClasses (k, comodule I, w, options) DrestrictionClasses(ZZ,Module,List) := options -> (k,M,w) -> ( ensureQuotientModule(M, "Drestriction currently only handles quotient modules"); @@ -147,8 +147,8 @@ DrestrictionClasses(ZZ,Module,List) := options -> (k,M,w) -> ( -------------------------------------------------------------------------------- DrestrictionComplex = method( Options => {Strategy => Schreyer} ) -DrestrictionComplex(Ideal,List) := options -> (I,w) -> ( - DrestrictionComplex ((ring I)^1/I, w, options) ) +DrestrictionComplex(LeftIdeal,List) := options -> (I,w) -> ( + DrestrictionComplex (coker gens I, w, options) ) protect RestrictComplex @@ -165,10 +165,10 @@ DrestrictionComplex(Module, List) := options -> (M,w) -> ( -------------------------------------------------------------------------------- DrestrictionIdeal = method( Options => {Strategy => Schreyer} ) -DrestrictionIdeal(Ideal,List) := options -> (I,w) -> ( +DrestrictionIdeal(LeftIdeal,List) := options -> (I,w) -> ( d := #positions(w, i -> (i>0)); outputRequest := {RestrictComplex, Explicit}; - outputTable := computeRestriction ((ring I)^1/I, w, -1, 1, + outputTable := computeRestriction (coker gens I, w, -1, 1, outputRequest, options); M := cokernel (outputTable#RestrictComplex).dd#1; R := ring M; @@ -184,8 +184,8 @@ DrestrictionIdeal(Ideal,List) := options -> (I,w) -> ( -------------------------------------------------------------------------------- DrestrictionAll = method( Options => {Strategy => Schreyer} ) -DrestrictionAll(Ideal,List) := options -> (I,w) -> ( - DrestrictionAll ((ring I)^1/I, w, options) ) +DrestrictionAll(LeftIdeal,List) := options -> (I,w) -> ( + DrestrictionAll (coker gens I, w, options) ) DrestrictionAll(Module, List) := options -> (M,w) -> ( ensureQuotientModule(M, @@ -212,8 +212,8 @@ DrestrictionAll(Module, List) := options -> (M,w) -> ( -------------------------------------------------------------------------------- Dintegration = method( Options => {Strategy => Schreyer} ) -Dintegration(Ideal,List) := options -> (I,w) -> ( - Dintegration ((ring I)^1/I, w, options) ) +Dintegration(LeftIdeal,List) := options -> (I,w) -> ( + Dintegration (coker gens I, w, options) ) Dintegration(Module, List) := options -> (M,w) -> ( W := ring M; @@ -235,8 +235,8 @@ Dintegration(Module, List) := options -> (M,w) -> ( Mout ) -Dintegration(ZZ, Ideal, List) := options -> (k,I,w) -> ( - Dintegration (k, (ring I)^1/I, w, options) ) +Dintegration(ZZ, LeftIdeal, List) := options -> (k,I,w) -> ( + Dintegration (k, coker gens I, w, options) ) Dintegration(ZZ, Module, List) := options -> (k,M,w) -> ( W := ring M; @@ -261,8 +261,8 @@ Dintegration(ZZ, Module, List) := options -> (k,M,w) -> ( -------------------------------------------------------------------------------- DintegrationClasses = method( Options => {Strategy => Schreyer} ) -DintegrationClasses(Ideal,List) := options -> (I,w) -> ( - DintegrationClasses ((ring I)^1/I, w, options) ) +DintegrationClasses(LeftIdeal,List) := options -> (I,w) -> ( + DintegrationClasses (coker gens I, w, options) ) DintegrationClasses(Module, List) := options -> (M,w) -> ( W := ring M; @@ -294,8 +294,8 @@ DintegrationClasses(Module, List) := options -> (M,w) -> ( hashTable outputList ) -DintegrationClasses(ZZ,Ideal,List) := options -> (k,I,w) -> ( - DintegrationClasses (k, (ring I)^1/I, w, options) ) +DintegrationClasses(ZZ,LeftIdeal,List) := options -> (k,I,w) -> ( + DintegrationClasses (k, coker gens I, w, options) ) DintegrationClasses(ZZ,Module,List) := options -> (k,M,w) -> ( W := ring M; @@ -343,8 +343,8 @@ DintegrationClasses(ZZ,Module,List) := options -> (k,M,w) -> ( -------------------------------------------------------------------------------- DintegrationComplex = method( Options => {Strategy => Schreyer} ) -DintegrationComplex(Ideal, List) := options -> (I,w) -> ( - DintegrationComplex ((ring I)^1/I, w, options) ) +DintegrationComplex(LeftIdeal, List) := options -> (I,w) -> ( + DintegrationComplex (coker gens I, w, options) ) DintegrationComplex(Module, List) := options -> (M,w) -> ( W := ring M; @@ -365,13 +365,13 @@ DintegrationComplex(Module, List) := options -> (M,w) -> ( -------------------------------------------------------------------------------- DintegrationIdeal = method( Options => {Strategy => Schreyer} ) -DintegrationIdeal(Ideal,List) := options -> (I,w) -> ( +DintegrationIdeal(LeftIdeal,List) := options -> (I,w) -> ( W := ring I; d := #positions(w, i -> (i>0)); n := numgens W; IF := Fourier I; outputRequest := {RestrictComplex, Explicit}; - outputTable := computeRestriction (W^1/IF, w, -1, 1, + outputTable := computeRestriction (coker gens IF, w, -1, 1, outputRequest, options); M := cokernel (outputTable#RestrictComplex).dd#1; resW := ring M; @@ -390,8 +390,8 @@ DintegrationIdeal(Ideal,List) := options -> (I,w) -> ( -------------------------------------------------------------------------------- DintegrationAll = method( Options => {Strategy => Schreyer} ) -DintegrationAll(Ideal,List) := options -> (I,w) -> ( - DintegrationAll ((ring I)^1/I, w, options) ) +DintegrationAll(LeftIdeal,List) := options -> (I,w) -> ( + DintegrationAll (coker gens I, w, options) ) DintegrationAll(Module, List) := options -> (M,w) -> ( W := ring M; diff --git a/M2/Macaulay2/packages/BernsteinSato/TST/tests.m2 b/M2/Macaulay2/packages/BernsteinSato/TST/tests.m2 index b4c3e2a96fb..a878c52db5d 100644 --- a/M2/Macaulay2/packages/BernsteinSato/TST/tests.m2 +++ b/M2/Macaulay2/packages/BernsteinSato/TST/tests.m2 @@ -7,7 +7,7 @@ TEST /// I = PolyAnn f; J = RatAnn f; K = RatAnn (u-v^2, f); - L = directSum (W^1/I, W^1/J); + L = directSum (coker gens I, coker gens J); assert ( isHolonomic I ); assert ( isHolonomic J ); assert ( isHolonomic K ); diff --git a/M2/Macaulay2/packages/BernsteinSato/WeylClosure.m2 b/M2/Macaulay2/packages/BernsteinSato/WeylClosure.m2 index 77ec81aaded..6d01bd4b4ba 100644 --- a/M2/Macaulay2/packages/BernsteinSato/WeylClosure.m2 +++ b/M2/Macaulay2/packages/BernsteinSato/WeylClosure.m2 @@ -8,7 +8,7 @@ -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- WeylClosure = method() -WeylClosure(Ideal, RingElement) := (I, f) -> ( +WeylClosure(LeftIdeal, RingElement) := (I, f) -> ( W := ring I; if W.monoid.Options.WeylAlgebra === {} then error "Expected a Weyl algebra" ; @@ -22,7 +22,7 @@ WeylClosure(Ideal, RingElement) := (I, f) -> ( ideal gens gb J ) -WeylClosure Ideal := I -> ( +WeylClosure LeftIdeal := I -> ( W := ring I; outputList :={}; if W.monoid.Options.WeylAlgebra === {} then @@ -66,4 +66,4 @@ f = (x^3-y^2*z^2); I = ideal(f^2*Dx+3*x^2, f^2*Dy-2*y*z^2, f^2*Dz-2*y^2*z); assert ( WeylClosure(I) == I + ideal(y*Dy-z*Dz, y^2*z^3*Dz-(2/3)*x^4*Dx-2*x^3*z*Dz-2)); -/// \ No newline at end of file +/// diff --git a/M2/Macaulay2/packages/BernsteinSato/annFs.m2 b/M2/Macaulay2/packages/BernsteinSato/annFs.m2 index 397dfe2886f..0f86247872c 100644 --- a/M2/Macaulay2/packages/BernsteinSato/annFs.m2 +++ b/M2/Macaulay2/packages/BernsteinSato/annFs.m2 @@ -4,7 +4,7 @@ --------------------------------------------------------------------------------- AnnFs = method() -AnnFs RingElement := Ideal => f -> ( +AnnFs RingElement := LeftIdeal => f -> ( -- Input: f, a polynomial in n variables -- (has to be an element of A_n, the Weyl algebra). -- Output: Ann f^s, an ideal in A_n[s]. @@ -67,7 +67,7 @@ MalgrangeIdeal List := Ideal => F -> ( ------------------------------------------------------------------------------ --This needs documentation. AnnIFs = method() -AnnIFs(Ideal, RingElement) := Ideal => (I, f) -> ( +AnnIFs(LeftIdeal, RingElement) := LeftIdeal => (I, f) -> ( pInfo(1, "AnnIFs: Warning! The method expects an f-saturated module"); W := ring I; createDpairs W; @@ -354,7 +354,7 @@ rationalFunctionAnnihilator(RingElement, RingElement) := (g,f) -> ( if a == -1 and g == 1_W then Ia else ( compensate := -1 - a; - F := map(W^1/Ia, W^1, matrix{{g*f^compensate}}); + F := map(comodule Ia, W^1, matrix{{g*f^compensate}}); ideal mingens kernel F) ) diff --git a/M2/Macaulay2/packages/BernsteinSato/bFunction.ideal.m2 b/M2/Macaulay2/packages/BernsteinSato/bFunction.ideal.m2 index 09a8d60f1fb..bc38f61ad1f 100644 --- a/M2/Macaulay2/packages/BernsteinSato/bFunction.ideal.m2 +++ b/M2/Macaulay2/packages/BernsteinSato/bFunction.ideal.m2 @@ -40,7 +40,7 @@ makeQQ := f -> ( -- trivial intersection strategy (internal) bfIntRing := method() -bfIntRing(Ideal, List) := (I, w) -> ( +bfIntRing(LeftIdeal, List) := (I, w) -> ( local tInfo; -- prep work if not (ring I).?IntRing then @@ -91,7 +91,7 @@ bfIntRing(Ideal, List) := (I, w) -> ( -- TryGeneric or NonGeneric strategy (internal) bfGenericOrNonGeneric := method(Options => {Strategy => TryGeneric}) -bfGenericOrNonGeneric(Ideal, List) := o -> (I, w) -> ( +bfGenericOrNonGeneric(LeftIdeal, List) := o -> (I, w) -> ( local tInfo; -- prep work if not (ring I).?ThetaRing then @@ -195,7 +195,7 @@ bfGenericOrNonGeneric(Ideal, List) := o -> (I, w) -> ( makeQQ bfcn ); -bFunction(Ideal, List) := RingElement => o -> (I, w) -> ( +bFunction(LeftIdeal, List) := RingElement => o -> (I, w) -> ( result := ( if o.Strategy == IntRing then bfIntRing(I, w) else if o.Strategy == TryGeneric or o.Strategy == NonGeneric diff --git a/M2/Macaulay2/packages/BernsteinSato/globalBFunction.m2 b/M2/Macaulay2/packages/BernsteinSato/globalBFunction.m2 index 35096086649..a7909363b17 100644 --- a/M2/Macaulay2/packages/BernsteinSato/globalBFunction.m2 +++ b/M2/Macaulay2/packages/BernsteinSato/globalBFunction.m2 @@ -20,7 +20,7 @@ makeMonic := f -> ( if coefficientRing ring f === QQ -- also used in multiplierIdeals.m2 star = method() -star (Ideal,List) := (I,vw) -> ( +star (LeftIdeal,List) := (I,vw) -> ( W := ring I; n := numgens W; u := symbol u; @@ -79,7 +79,7 @@ globalRB (RingElement,Boolean) := RingElement => (f,isRed) -> ( globalRBAnnFs(f, AnnI, isRed); ) -globalRBAnnFs (RingElement,Ideal,Boolean) := RingElement => (f,AnnI,isRed) -> ( +globalRBAnnFs (RingElement,LeftIdeal,Boolean) := RingElement => (f,AnnI,isRed) -> ( W := ring f; Ws := ring AnnI; ns := numgens Ws; @@ -116,7 +116,7 @@ globalRBAnnFs (RingElement,Ideal,Boolean) := RingElement => (f,AnnI,isRed) -> ( -------------------------------------------------------------------------------- globalB = method() -globalB(Ideal, RingElement) := HashTable => (I, f) -> ( +globalB(LeftIdeal, RingElement) := HashTable => (I, f) -> ( W := ring I; AnnI := AnnIFs (I,f); Ws := ring AnnI; @@ -210,10 +210,10 @@ generalB (List, RingElement) := RingElement => o->(F,g) -> ( inw(intersect(AnnI, ideal sub(g, DY)), -w|w) ) else if m===null and o.Strategy===StarIdeal then ( - star(AnnI,-w|w) + sub(g*ideal F,DY) + star(AnnI,-w|w) + sub(ideal(g*F),DY) ) else if m=!=null then ( - star(AnnI,-w|w) + (sub(ideal F, DY))^m + star(AnnI,-w|w) + ideal symmetricPower(m, gens sub(ideal F, DY)) ) else error "uknwnown Strategy"; diff --git a/M2/Macaulay2/packages/BernsteinSato/intersectionCohom.m2 b/M2/Macaulay2/packages/BernsteinSato/intersectionCohom.m2 index fd3defcae04..7b4a235aef5 100644 --- a/M2/Macaulay2/packages/BernsteinSato/intersectionCohom.m2 +++ b/M2/Macaulay2/packages/BernsteinSato/intersectionCohom.m2 @@ -27,7 +27,7 @@ IHmodule(Ideal) := options -> I -> ( for i from 0 to c-1 do J=J+ideal(sub(g#i,W)); -- submodule of H^c_I(R) generated by F^-1 m := minors (c,jacobian(I)); l := (flatten entries (mingens m))#0; - image map(W^1/J, W^1, matrix{{sub(l,W)}}) -- D-mod generated by fundamental class + image map(coker gens J, W^1, matrix{{sub(l,W)}}) -- D-mod generated by fundamental class ) else ( S := flatten entries mingens(ideal singularLocus P); diff --git a/M2/Macaulay2/packages/BernsteinSato/localBFunction.m2 b/M2/Macaulay2/packages/BernsteinSato/localBFunction.m2 index e4d904468a1..07f0abd73c4 100644 --- a/M2/Macaulay2/packages/BernsteinSato/localBFunction.m2 +++ b/M2/Macaulay2/packages/BernsteinSato/localBFunction.m2 @@ -1,7 +1,7 @@ -- internal, also used in multiplierIdeals.m2 -- TODO: move to Dbasic? eliminateWA = method() -eliminateWA(Ideal, List) := Ideal => (I, v) -> ( +eliminateWA(LeftIdeal, List) := LeftIdeal => (I, v) -> ( R := ring I; if not isSubset(v, gens R) then error "expected generators of the ring"; w := apply(gens R, g -> if member(g, v) then 1 else 0); diff --git a/M2/Macaulay2/packages/BernsteinSato/localCohom.m2 b/M2/Macaulay2/packages/BernsteinSato/localCohom.m2 index 7bafd7f12b7..559b90dc9d7 100644 --- a/M2/Macaulay2/packages/BernsteinSato/localCohom.m2 +++ b/M2/Macaulay2/packages/BernsteinSato/localCohom.m2 @@ -21,16 +21,12 @@ localCohom = method(Options => {Strategy => Walther, LocStrategy => null}) localCohom( Ideal) := HashTable => o -> I -> localCohom(toList (0..numgens I), I, o) localCohom(ZZ, Ideal) := HashTable => o -> (n,I) -> (localCohom({n}, I, o))#n localCohom(List, Ideal) := HashTable => o -> (l,I) -> ( - -- Promote I to the Weyl algebra if it is not already there - if #(ring I).monoid.Options.WeylAlgebra == 0 - then I = sub(I, makeWA ring I); -- TODO: what degrees are best for the differentials? - + W := makeWA ring I; -- TODO: what degrees are best for the differentials? if (o.Strategy == Walther and o.LocStrategy === null) - then localCohomUli (l,I) + then localCohomUli(l, sub(I, W)) else ( - R := ring I; - createDpairs R; - localCohom(l, I, R^1 / ideal R.dpairVars#1, o) + createDpairs W; + localCohom(l, I, comodule ideal W.dpairVars#1, o) ) ); @@ -71,7 +67,7 @@ localCohomUli = (l, I) -> ( -- Step 3. -- Compute the Cech complex - C := applyValues(subISets, S -> directSum apply(S, theta -> (theta => W^1 / J#theta))); + C := applyValues(subISets, S -> directSum apply(S, theta -> (theta => comodule J#theta))); M := new HashTable from apply(Lmaps, k -> k => map (C#(k+1), C#k, (i,j) -> ( i0 := (indices C#k)_j; j0 := (indices C#(k+1))_i; @@ -108,12 +104,9 @@ localCohom( Ideal, Module) := HashTable => o -> (I,M) -> localCohom(toLis localCohom(ZZ, Ideal, Module) := HashTable => o -> (n,I,M) -> localCohom({n}, I, M, o) localCohom(List, Ideal, Module) := HashTable => o -> (l,I,M) -> ( -- Promote I to the Weyl algebra if it is not already there - if #(ring I).monoid.Options.WeylAlgebra == 0 - then ( - D := makeWA ring I; -- TODO: what degrees are best for the differentials? - I = sub(I, D); - M = M ** D; - ); + D := makeWA ring I; -- TODO: what degrees are best for the differentials? + I = sub(I, D); + M = M ** D; pInfo (1, "localCohom: holonomicity check ..."); if not isHolonomic M then error "expected a holonomic module"; @@ -130,7 +123,7 @@ localCohom(List, Ideal, Module) := HashTable => o -> (l,I,M) -> ( -- iterated localizations + localize by Oaku ---------------------------------------------------------- localCohomILOaku = method() -localCohomILOaku(List, Ideal, Module) := (l, I, M) -> ( +localCohomILOaku(List, LeftIdeal, Module) := (l, I, M) -> ( -- error checking to be added -- I is assumed to be an ideal in WA generated by polynomials f := first entries gens I; @@ -169,7 +162,7 @@ localCohomILOaku(List, Ideal, Module) := (l, I, M) -> ( subMap := map(W, ring I, vars W | matrix {{(FPower#i)_W}}); locIdeal := ideal subMap gens I; L#theta = new HashTable from { - LocModule => W^1/locIdeal, + LocModule => comodule locIdeal, Generator => L#theta'#Generator * (f_i)^(-FPower#i) }; theta => L#theta#LocModule @@ -220,7 +213,7 @@ localCohomILOaku(List, Ideal, Module) := (l, I, M) -> ( -- iterated localizations + localize by OTW ---------------------------------------------------------- localCohomILOTW = method() -localCohomILOTW(List, Ideal, Module) := (l, I, M) -> ( +localCohomILOTW(List, LeftIdeal, Module) := (l, I, M) -> ( -- error checking to be added -- I is assumed to be an ideal in WA generated by polynomials f := first entries gens I; @@ -298,7 +291,7 @@ localCohomILOTW(List, Ideal, Module) := (l, I, M) -> ( -- caveat: not smart, does not iterate localizations. ---------------------------------------------------------------------------------------- localCohomRegular = method() -localCohomRegular(List,Ideal,Module) := (l, I, M) -> ( +localCohomRegular(List,LeftIdeal,Module) := (l, I, M) -> ( -- error checking to be added -- I is assumed to be an ideal in WA generated by polynomials f := first entries gens I; @@ -383,13 +376,13 @@ pruneLocalCohom(HashTable) := HashTable => h -> ( -------------------------------------------------------------------------------- localCohomOT = method() -localCohomOT(Ideal, Ideal) := (I, J) -> ( - if not J.?quotient then J.quotient = (ring J)^1/J; - localCohomOT(I, J.quotient) +localCohomOT(Ideal, LeftIdeal) := (I, J) -> ( + if not J.?quotient then J.quotient = comodule J; + localCohomOT(sub(I, ring J), J.quotient) ) -localCohomOT(Ideal, Module) := (I, M) -> computeLocalCohomOT(I, M, 0, min(numgens I, (dim ring I)//2)) +localCohomOT(LeftIdeal, Module) := (I, M) -> computeLocalCohomOT(I, M, 0, min(numgens I, (dim ring I)//2)) -localCohomOT(List, Ideal, Module) := (l, I, M) -> ( +localCohomOT(List, LeftIdeal, Module) := (l, I, M) -> ( locOut := computeLocalCohomOT(I, M, min l, max l); locOut = hashTable apply(keys locOut, i -> if member(i, l) then i => locOut#i); @@ -456,46 +449,51 @@ computeLocalCohomOT = (I, M, n0, n1) -> ( TEST/// -W = QQ[x, dx, y, dy, z, dz, WeylAlgebra=>{x=>dx, y=>dy, z=>dz}] +R = QQ[x, y, z] I = ideal (x*(y-z), x*y*z) +W = makeWA R J = ideal (dx, dy, dz) time h = localCohom I -time h = localCohom (I, W^1/J, Strategy=>Walther) +time h = localCohom (I, comodule J, Strategy=>Walther) time h = localCohom (I, Strategy=>Walther, LocStrategy=>OaTaWa) time h = localCohom (I, Strategy=>Walther, LocStrategy=>Oaku) time h = localCohom (I, Strategy=>OaTa) pruneLocalCohom h --------------------------------------------------------------- -W = QQ[x, dx, y, dy, WeylAlgebra=>{x=>dx, y=>dy}]; +R = QQ[x, y] I = ideal (x^2+y^2, x*y); +W = makeWA R J = ideal (dx, dy); -K = ideal(x^3,y^3); time h = localCohom I -time h = localCohom (I, W^1/J, Strategy=>Walther) +time h = localCohom (I, comodule J, Strategy=>Walther) time h = localCohom (I, Strategy=>Walther, LocStrategy=>OTW) time h = localCohom (I, Strategy=>Walther, LocStrategy=>Oaku) time h = localCohom (I, Strategy=>OaTa) pruneLocalCohom h +use R m = ideal(x,y); L = pruneLocalCohom localCohom(m); assert (rank L#0 == 0); assert (rank L#1 == 0); assert (rank L#2 == 1); Mat = Dprune localCohom(2,I); -assert (sub((minimalPrimes charIdeal Mat)_0,W)==ideal(x,y)); -L' = localCohom (m, W^1/K, Strategy=>OaTa); -assert (L'#0==W^1/ideal(x^3,y^3)); +assert (sub((minimalPrimes charIdeal Mat)_0,W)==sub(m, W)); + +K = ideal(x^3,y^3); +L' = localCohom (m, comodule K, Strategy=>OaTa); +assert (L'#0 == comodule sub(K, W)); --------------------------------------------------------------- x = symbol x; dx = symbol dx; -W = QQ[x, dx, WeylAlgebra=>{x=>dx}] +R = QQ[x] I = ideal {x, x^2, x^2+x, x^3, x^4+2*x} -M = W^1 / ideal dx +W = makeWA R +M = comodule ideal dx time h = localCohom (I, M, Strategy=>Walther, LocStrategy=>Oaku) -time h' = localCohom (ideal x) +time h' = localCohom (ideal R_0) h = pruneLocalCohom h h' = pruneLocalCohom h' assert all(keys h, i-> not h'#?i or h'#i == h#i) diff --git a/M2/Macaulay2/packages/BernsteinSato/multiplierIdeals.m2 b/M2/Macaulay2/packages/BernsteinSato/multiplierIdeals.m2 index 25c4062500d..10ebc21182c 100644 --- a/M2/Macaulay2/packages/BernsteinSato/multiplierIdeals.m2 +++ b/M2/Macaulay2/packages/BernsteinSato/multiplierIdeals.m2 @@ -18,6 +18,16 @@ isInMultiplierIdeal(RingElement, Ideal, QQ) := o -> (g,I,c) -> ( -c > max roots ) +-- power of a (left) ideal and +-- quotient -- LeftIdeal:RingElement +-- product -- RingElement:LeftIdeal +-- are _not_ well defined in general in the Weyl algebra, +-- ... but are used by some methods below in a limited context (for commuting elements) +powerIdealZZ = method() +powerIdealZZ(LeftIdeal,ZZ) := (I,n) -> ideal symmetricPower(n,generators I) +quotientInWeylAlgebra = method() +quotientInWeylAlgebra(LeftIdeal,RingElement) := (I,f) -> ideal quotient(I, f) + multiplierIdeal = method(Options => {Strategy=>ViaElimination, DegreeLimit=>null}) multiplierIdeal (Ideal, ZZ) := o -> (a,c) -> multiplierIdeal(a, promote(c,QQ), Strategy=>o.Strategy, DegreeLimit=>o.DegreeLimit) multiplierIdeal (Ideal, QQ) := o -> (a,c) -> first multiplierIdeal(a, {c}, Strategy=>o.Strategy, DegreeLimit=>o.DegreeLimit) @@ -51,7 +61,7 @@ multiplierIdeal (Ideal, List) := o -> (a,cs) -> ( SXring := K(monoid [SX,MonomialOrder=>Eliminate 1]); SDYtoSX := map(SXring,SDY, gens SXring | toList(n+2*r:0) ); -- - I2' := sub(Istar,SDY) + (sub(a, SDY))^m + ideal (SDY_0 + sum(r,i->dT#i*T#i)); -- Istar + a^m + (s-\sigma) + I2' := sub(Istar,SDY) + powerIdealZZ(sub(a, SDY),m) + ideal (SDY_0 + sum(r,i->dT#i*T#i)); -- Istar + a^m + (s-\sigma) if o.Strategy == ViaElimination then I2 := SDYtoSX eliminateWA(I2', notSX); pInfo(1, "J_I("|toString m|") = "|toString I2); -- b-function part @@ -97,7 +107,7 @@ multiplierIdeal (Ideal, List) := o -> (a,cs) -> ( while d <= o.DegreeLimit do ( -- add reductions of all monomials of degree d times b(s) new'monoms = false; - for f in ((ideal X)^d)_* do ( + for f in (powerIdealZZ(ideal X,d))_* do ( -- taking monomials not in the initial ideal of ret -- could be optimized more: delete the initial terms discovered on the previous step from monoms and f'b'sigma (MutableList? MutableHashTable?) if ret === null or sub(f,R) % ideal( (flatten entries gens gb ret)/ leadMonomial ) != 0 @@ -122,7 +132,7 @@ multiplierIdeal (Ideal, List) := o -> (a,cs) -> ( else if o.Strategy == ViaElimination then exceptionalLocusB(R,I2,b) -- ring I2 has to eliminate s else if o.Strategy == ViaColonIdeal then ( - I2'' := I2' : ( (map(SDY, ring b, {sigma})) b ); + I2'' := quotientInWeylAlgebra(I2',(map(SDY, ring b, {sigma})) b); notX := {SDY_0}|notSX; SDYtoSX eliminateWA(I2'', notX) ) diff --git a/M2/Macaulay2/packages/BernsteinSato/paramBpoly.m2 b/M2/Macaulay2/packages/BernsteinSato/paramBpoly.m2 index 68d4b7bd4c6..a43ae5c82df 100644 --- a/M2/Macaulay2/packages/BernsteinSato/paramBpoly.m2 +++ b/M2/Macaulay2/packages/BernsteinSato/paramBpoly.m2 @@ -535,7 +535,7 @@ gbWparam(Ideal, List) := (I, w) -> ( -- computes in_w(I). The result is a WA ideal (as opposed to -- an ideal in the associated commutative ring) inWparam = method() -inWparam(Ideal,List) := (I, w) -> ( +inWparam(LeftIdeal,List) := (I, w) -> ( I2 := homGBparam(I, w); GB := paramGB (I2); I3 := leadTerm(1, gensGB GB); @@ -923,8 +923,10 @@ isdivisible := (f,g) -> ( -- ChangeMatrix=>false: option -- output: { Groebner basis generators for I [, changematrix] } -paramGB = I -> ( - if class I === Ideal then I = gens I; +paramGB = method() +paramGB Ideal := +paramGB LeftIdeal := I -> paramGB gens I +paramGB Matrix := I -> ( R := ring I; WAflag := R.monoid.Options.WeylAlgebra =!= {}; if WAflag then ( diff --git a/M2/Macaulay2/packages/HolonomicSystems/DOC/canonicalSeries.m2 b/M2/Macaulay2/packages/HolonomicSystems/DOC/canonicalSeries.m2 index b9008b46fe1..29c4284e020 100644 --- a/M2/Macaulay2/packages/HolonomicSystems/DOC/canonicalSeries.m2 +++ b/M2/Macaulay2/packages/HolonomicSystems/DOC/canonicalSeries.m2 @@ -87,7 +87,7 @@ doc /// doc /// Key distraction - (distraction, Ideal, Ring) + (distraction, LeftIdeal, Ring) (distraction, RingElement, Ring) Headline the image in the thetaRing of a torus-fixed element or ideal in a Weyl algebra @@ -95,7 +95,7 @@ doc /// distraction(I,thetaRing) distraction(f,thetaRing) Inputs - I:Ideal + I:LeftIdeal f:RingElement thetaRing:PolynomialRing a stand in for the subring $k[\theta]$ generated by @TT "theta = x*dx"@ @@ -128,13 +128,13 @@ doc /// doc /// Key indicialIdeal - (indicialIdeal, Ideal, List) + (indicialIdeal, LeftIdeal, List) Headline the image in the thetaRing of an indicial ideal in a Weyl algebra Usage indicialIdeal(I,w) Inputs - I:Ideal + I:LeftIdeal in a WeylAlgebra that is torus-fixed w:List (generic) weights for $I$, of length half the number of variables in the Weyl algebra @@ -167,13 +167,13 @@ doc /// doc /// Key cssExpts - (cssExpts, Ideal, List) + (cssExpts, LeftIdeal, List) Headline the exponents of the canonical series solutions of I in the direction of a weight vector Usage cssExpts(I,w) Inputs - I:Ideal + I:LeftIdeal (regular) holonomic ideal in the Weyl algebra w:List (generic) weights for $I$, of length half the number of variables in the Weyl algebra @@ -200,13 +200,13 @@ doc /// doc /// Key cssExptsMult - (cssExptsMult, Ideal, List) + (cssExptsMult, LeftIdeal, List) Headline the exponents and multiplicities of the canonical series solutions Usage cssExptsMult(I,w) Inputs - I:Ideal + I:LeftIdeal (regular) holonomic ideal in the Weyl algebra w:List (generic) weights for $I$, of length half the number of variables in the Weyl algebra @@ -236,13 +236,13 @@ doc /// doc /// Key isTorusFixed - (isTorusFixed, Ideal) + (isTorusFixed, LeftIdeal) Headline checks if an ideal in a Weyl algebra is torus-fixed Usage isTorusFixed I Inputs - I:Ideal + I:LeftIdeal in a WeylAlgebra Outputs :Boolean @@ -298,13 +298,13 @@ doc /// doc /// Key cssLeadTerm - (cssLeadTerm, Ideal, List) + (cssLeadTerm, LeftIdeal, List) Headline lead term of the canonical series solutions of I Usage cssLeadTerm(I, w) Inputs - I:Ideal + I:LeftIdeal (regular) holonomic ideal in the Weyl algebra w:List (generic) weights for $I$, of length half the number of variables in the Weyl algebra diff --git a/M2/Macaulay2/packages/HolonomicSystems/canonicalSeries.m2 b/M2/Macaulay2/packages/HolonomicSystems/canonicalSeries.m2 index 0b8d1825fe3..b4db57a0d50 100644 --- a/M2/Macaulay2/packages/HolonomicSystems/canonicalSeries.m2 +++ b/M2/Macaulay2/packages/HolonomicSystems/canonicalSeries.m2 @@ -12,7 +12,7 @@ --Input: J an ideal in a Weyl algebra --Output: True if ideal is torus fixed, as in SST Lem. 2.3.1. False if not. isTorusFixed = method(); -isTorusFixed(Ideal) := Boolean => (J)->( +isTorusFixed LeftIdeal := Boolean => J->( n := numgens ring J//2; J' := ideal flatten apply(J_*,f->( apply(apbFactor(f @@ -66,7 +66,7 @@ distraction = method() --Input: torus-fixed left D-ideal J --Output: the distraction of J, viewed in ThetaRing --Note: this was called thetaIdeal in the past -distraction(Ideal, Ring) := Ideal => (J, ThetaRing) -> sum(J_*, j -> ideal distraction(j, ThetaRing)) +distraction(LeftIdeal, Ring) := Ideal => (J, ThetaRing) -> sum(J_*, j -> ideal distraction(j, ThetaRing)) --Input: element in a torus-fixed left D-ideal --Output: list of corresponding gens from homogeneous pieces in the distraction, viewed in ThetaRing distraction(RingElement, Ring) := List => (f, ThetaRing) -> ( @@ -81,7 +81,7 @@ distraction(RingElement, Ring) := List => (f, ThetaRing) -> ( --Input: holonomic ideal I, weight w in the form of a List --Output: the indicial ideal of I with respect to w indicialIdeal = method(); -indicialIdeal(Ideal, List) := Ideal => (I, w) -> distraction(inw(I, -w|w), first createThetaRing ring I) +indicialIdeal(LeftIdeal, List) := Ideal => (I, w) -> distraction(inw(I, -w|w), first createThetaRing ring I) --Input: 0-dimensional primary ideal I --Output: corresponding point, as a vector @@ -94,7 +94,7 @@ solveMax Ideal := List => I -> first entries lift(vars ring I % radical I, coeff --Output: list of 0-dimensional ideals encoding css exponents and their multiplicities -- internal beginExptComp = method(); -beginExptComp(Ideal,List,ZZ,Ring) := List => (H,w,n,S)->( +beginExptComp(LeftIdeal,List,ZZ,Ring) := List => (H,w,n,S)->( if not isHolonomic(H) then error "ideal is not holonomic"; if #w != n then error "weight vector has wrong length"; J := inw(H,(-w)|w); @@ -105,7 +105,7 @@ beginExptComp(Ideal,List,ZZ,Ring) := List => (H,w,n,S)->( --Input: holonomic D-ideal H, weight vector w as List --Output: list of starting monomial exponents for H wrt w cssExpts = method(); -cssExpts(Ideal,List) := List => (H,w)->( +cssExpts(LeftIdeal,List) := List => (H,w)->( n:= (numgens ring H)//2; t := symbol t; S := QQ(monoid [t_1..t_n]); @@ -116,7 +116,7 @@ cssExpts(Ideal,List) := List => (H,w)->( --Input: holonomic D-ideal H, weight vector w as List, --Output: list of starting monomial exponents for H wrt w, with multiplicities cssExptsMult = method(); -cssExptsMult(Ideal,List) := List => (H,w)->( +cssExptsMult(LeftIdeal,List) := List => (H,w)->( n:= (numgens ring H)//2; t := symbol t; S := QQ(monoid [t_1..t_n]); @@ -246,7 +246,7 @@ solveFrobeniusIdeal(Ideal, Ring) := List => (I, W) -> ( --Input: I regular holonomic ideal in a Weyl algebra on n vars, weight vector w in \ZZ^n as a List --Output: starting monomials for the css for I for weight w, as a List of ring elements in vars for I and their logs cssLeadTerm = method() -cssLeadTerm(Ideal, List) := List => (I, w) -> solveFrobeniusIdeal(indicialIdeal(I, w), ring I) +cssLeadTerm(LeftIdeal, List) := List => (I, w) -> solveFrobeniusIdeal(indicialIdeal(I, w), ring I) --TODO: where should this go? --Input: cone C, weight vector k @@ -261,7 +261,7 @@ truncate(Cone, List, ZZ) := List => {} >> o -> (C, w, k) -> polyhedronFromHData( --NOTE: We are assuming that the ideal I is provided with LT of weight 0. --We will adjust to this case using nonpositiveWeightGens nilssonSupport = method() -nilssonSupport(Ideal, List) := Cone => (I, w) -> ( +nilssonSupport(LeftIdeal, List) := Cone => (I, w) -> ( -- See description before SST Thm 2.5.14 n := length w; G := gbw(I, fw := -w|w); @@ -275,12 +275,12 @@ nilssonSupport(Ideal, List) := Cone => (I, w) -> ( tailCone polar polyhedronFromHData(concatRows first L, concatRows last L)) --Input: I regular holonomic ideal in a Weyl algebra on n vars, weight vector w in \ZZ^n as a List, weight k --Output: lattice points in cone of weight \leq k, as a List of Lists -nilssonSupport(Ideal, List, ZZ) := List => (I, w, k) -> entries transpose concatCols latticePoints truncate(nilssonSupport(I, w), w, k) +nilssonSupport(LeftIdeal, List, ZZ) := List => (I, w, k) -> entries transpose concatCols latticePoints truncate(nilssonSupport(I, w), w, k) --Input: I regular holonomic ideal in a Weyl algebra on n vars, weight vector w in \ZZ^n as a List --Output: list of generators of gbw(I) times monomial in variables, so that all inw terms have w-weight zero nonpositiveWeightGens = method() -nonpositiveWeightGens(Ideal, List) := List => (I, w) -> ( +nonpositiveWeightGens(LeftIdeal, List) := List => (I, w) -> ( W := ring I; n := length w; G := gbw(I, fw := -w|w); @@ -293,7 +293,7 @@ nonpositiveWeightGens(Ideal, List) := List => (I, w) -> ( ) truncatedCanonicalSeries = method() -truncatedCanonicalSeries(Ideal, List, ZZ) := List => (I, w, k) -> ( +truncatedCanonicalSeries(LeftIdeal, List, ZZ) := List => (I, w, k) -> ( W := ring I; n := numgens W // 2; r := holonomicRank I; diff --git a/M2/Macaulay2/packages/WeylAlgebras/DOC/basics.m2 b/M2/Macaulay2/packages/WeylAlgebras/DOC/basics.m2 index 7eb776a0262..d9c1ceaec43 100644 --- a/M2/Macaulay2/packages/WeylAlgebras/DOC/basics.m2 +++ b/M2/Macaulay2/packages/WeylAlgebras/DOC/basics.m2 @@ -1,7 +1,7 @@ doc /// Key gbw - (gbw, Ideal, List) + (gbw, LeftIdeal, List) (gbw, Matrix, List) [gbw, Strategy] Headline @@ -10,7 +10,7 @@ doc /// gbI = gbw(I, w) gbM = gbw(M, w) Inputs - I:Ideal + I:LeftIdeal in the Weyl algebra M:Matrix with entries in the Weyl algebra @@ -19,7 +19,7 @@ doc /// Strategy=>Thing if set to @TT "homogenize"@ the input is homogenized in the homogeneous Weyl algebra Outputs - gbI:Ideal + gbI:LeftIdeal with the generators forming a Gröbner basis of the ideal with respect to the weight vector gbM:Matrix with the columns forming a Gröbner basis of the submodule generated by the columns of the @@ -54,7 +54,7 @@ doc /// inw (inw, Matrix, List) (inw, RingElement, List) - (inw, Ideal, List) + (inw, LeftIdeal, List) Headline get the initial term or ideal with respect to a weight vector Usage @@ -63,14 +63,14 @@ doc /// inM = inw(M, w) Inputs F:RingElement - I:Ideal + I:LeftIdeal M:Matrix w:List of weights Outputs inF:RingElement the initial form of @EM "F"@ with respect to the weight vector - inI:Ideal + inI:LeftIdeal the initial ideal of @EM "I"@ with respect to the weight vector inM:Matrix with the columns generating the initial module of the image of @EM "M"@ with respect to the weight vector @@ -113,12 +113,12 @@ doc /// Fourier (Fourier,Matrix) (Fourier,RingElement) - (Fourier,Ideal) + (Fourier,LeftIdeal) (Fourier,Module) (Fourier,ChainComplex) FourierInverse (FourierInverse, ChainComplex) - (FourierInverse, Ideal) + (FourierInverse, LeftIdeal) (FourierInverse, Matrix) (FourierInverse, Module) (FourierInverse, RingElement) @@ -128,10 +128,10 @@ doc /// Fourier A FourierInverse A Inputs - A:{Matrix, RingElement, Ideal, ChainComplex} + A:{Matrix, RingElement, LeftIdeal, ChainComplex} over the Weyl algebra Outputs - :{Matrix, RingElement, Ideal, ChainComplex} + :{Matrix, RingElement, LeftIdeal, ChainComplex} the Fourier transform of @TT "A"@ as a matrix, function, ideal, or chain complex over the Weyl algebra Description Text @@ -184,7 +184,7 @@ doc /// Key Dtransposition (Dtransposition,Matrix) - (Dtransposition,Ideal) + (Dtransposition,LeftIdeal) (Dtransposition,ChainComplex) (Dtransposition,RingElement) Headline @@ -247,16 +247,16 @@ doc /// doc /// Key stafford - (stafford, Ideal) + (stafford, LeftIdeal) Headline computes 2 generators for a given ideal in the Weyl algebra Usage stafford I Inputs - I:Ideal + I:LeftIdeal of the Weyl algebra Outputs - :Ideal + :LeftIdeal with 2 generators (that has the same extension as I in k(x)) Description Text @@ -282,7 +282,7 @@ doc /// Key isHolonomic (isHolonomic, Module) - (isHolonomic, Ideal) + (isHolonomic, LeftIdeal) Headline determines whether a D-module (or ideal in Weyl algebra) is holonomic Usage @@ -291,7 +291,7 @@ doc /// Inputs M:Module over the Weyl algebra @EM "D"@ - I:Ideal + I:LeftIdeal which represents the module @EM "M = D/I"@ Outputs :Boolean @@ -319,7 +319,7 @@ doc /// Key DsingularLocus (DsingularLocus,Module) - (DsingularLocus,Ideal) + (DsingularLocus,LeftIdeal) Headline singular locus of a D-module Usage @@ -328,10 +328,10 @@ doc /// Inputs M:Module over the Weyl algebra @EM "D"@ - I:Ideal + I:LeftIdeal which represents the module @EM "M = D/I"@ Outputs - :Ideal + :LeftIdeal the singular locus of @EM "M"@ Description Text @@ -357,7 +357,7 @@ doc /// doc /// Key characteristicIdeal - (characteristicIdeal,Ideal) + (characteristicIdeal,LeftIdeal) (characteristicIdeal,Module) Headline characteristic ideal of a D-module @@ -366,10 +366,10 @@ doc /// Inputs M:Module over the Weyl algebra @EM "D"@ - I:Ideal + I:LeftIdeal which represents the module @EM "M = D/I"@ Outputs - :Ideal + :LeftIdeal the characteristic ideal of @EM "M"@ Description Text @@ -408,7 +408,7 @@ doc /// Key holonomicRank (holonomicRank,Module) - (holonomicRank,Ideal) + (holonomicRank,LeftIdeal) Headline holonomic rank of a D-module Usage @@ -417,7 +417,7 @@ doc /// Inputs M:Module over the Weyl algebra @EM "D"@ - I:Ideal + I:LeftIdeal which represents the module @EM "M = D/I"@ Outputs :ZZ @@ -461,7 +461,7 @@ doc /// doc /// Key Ddim - (Ddim,Ideal) + (Ddim,LeftIdeal) (Ddim,Module) Headline dimension of a D-module @@ -471,7 +471,7 @@ doc /// Inputs M:Module over the Weyl algebra $D$ - I:Ideal + I:LeftIdeal which represents the module $M=D/I$ Outputs :ZZ diff --git a/M2/Macaulay2/packages/WeylAlgebras/Dbasic.m2 b/M2/Macaulay2/packages/WeylAlgebras/Dbasic.m2 index c297a8599be..5c6f1b9e0d6 100644 --- a/M2/Macaulay2/packages/WeylAlgebras/Dbasic.m2 +++ b/M2/Macaulay2/packages/WeylAlgebras/Dbasic.m2 @@ -7,14 +7,14 @@ -- ring. ---------------------------------------------------------------- makeWeylAlgebra = method(Options => {SetVariables => true}) -makeWeylAlgebra PolynomialRing := opts -> R -> ( +makeWeylAlgebra PolynomialRing := opts -> (cacheValue WeylAlgebra) (R -> ( coordVars := gens R; diffVars := apply(coordVars, i -> value("symbol d" | toString(i)) ); allVars := join(coordVars, diffVars); W := (coefficientRing R)(monoid [allVars, WeylAlgebra => apply(coordVars, diffVars, (x,dx) -> x => dx)]); if opts.SetVariables then use W; - W) + W)) -- this function associates to a Weyl algebra W -- the key "dpairVars", which consists of the following 3 lists @@ -121,7 +121,7 @@ createCommAlgebra PolynomialRing := W -> ( -- These routines compute the Fourier transform which is the automorphism -- of the Weyl algebra sending x -> -dx, dx -> x. --- Input: RingElement f, Matrix m, Ideal I, ChainComplex C, or Module M +-- Input: RingElement f, Matrix m, LeftIdeal I, ChainComplex C, or Module M -- Output: Fourier transform of f, m, I, C, or M Fourier = method() FourierLocal := M -> ( @@ -145,7 +145,7 @@ FourierLocal := M -> ( FMap M ) Fourier RingElement := M -> (FourierLocal M) -Fourier Ideal := M -> (FourierLocal M) +Fourier LeftIdeal := Fourier Matrix := M -> (FourierLocal M) Fourier ChainComplex := M -> (FourierLocal M) Fourier Module := M -> (cokernel FourierLocal relations prune M) @@ -172,7 +172,7 @@ FourierInverseLocal := M -> ( FInvMap M ) FourierInverse RingElement := M -> (FourierInverseLocal M) -FourierInverse Ideal := M -> (FourierInverseLocal M) +FourierInverse LeftIdeal := FourierInverse Matrix := M -> (FourierInverseLocal M) FourierInverse ChainComplex := M -> (FourierInverseLocal M) FourierInverse Module := M -> (cokernel FourierInverseLocal relations prune M) @@ -199,6 +199,7 @@ Dtransposition RingElement := L -> ( transL ) +Dtransposition LeftIdeal := I -> ideal Dtransposition gens I Dtransposition Matrix := m -> ( W := ring m; if W.monoid.Options.WeylAlgebra === {} then @@ -214,10 +215,6 @@ Dtransposition Matrix := m -> ( mtrans ) -Dtransposition Ideal := I -> ( - ideal Dtransposition gens I - ) - Dtransposition ChainComplex := C -> ( W := ring C; if W.monoid.Options.WeylAlgebra === {} then @@ -236,7 +233,7 @@ Dtransposition ChainComplex := C -> ( -- This routine computes the dimension of a D-module Ddim = method() -Ddim Ideal := (cacheValue Ddim) (I -> ( +Ddim LeftIdeal := (cacheValue Ddim) (I -> ( -- preprocessing W := ring I; -- error checking @@ -269,7 +266,7 @@ addHook((codim, Module), Strategy => WeylAlgebra, -- This routine determines whether a D-module is holonomic isHolonomic = method() -isHolonomic Ideal := I -> ( +isHolonomic LeftIdeal := I -> ( -- preprocessing W := ring I; -- error checking @@ -296,10 +293,7 @@ isHolonomic Module := M -> ( -- This routine computes the rank of a D-module -- QUESTION: this changes the current ring? holonomicRank = method() -holonomicRank Ideal := I -> ( - holonomicRank ((ring I)^1/I) - ) - +holonomicRank LeftIdeal := I -> holonomicRank comodule I holonomicRank Module := M -> ( W := ring M; createDpairs W; diff --git a/M2/Macaulay2/packages/WeylAlgebras/Gbw.m2 b/M2/Macaulay2/packages/WeylAlgebras/Gbw.m2 index 80010b6b3db..b97cdcfbff3 100644 --- a/M2/Macaulay2/packages/WeylAlgebras/Gbw.m2 +++ b/M2/Macaulay2/packages/WeylAlgebras/Gbw.m2 @@ -22,7 +22,7 @@ inw (RingElement, List) := (L, w) -> ( mw := max apply(lf,t->sum(#w,i->t#0#i*w#i)); part(mw,w,L) ) -inw(Ideal, List) := (I, w) -> ideal inw(gens I, w) +inw(LeftIdeal, List) := (I, w) -> ideal inw(gens I, w) inw(Matrix, List) := (m, w) -> ( -- preprocessing W := ring m; @@ -120,7 +120,7 @@ inw(Matrix, List) := (m, w) -> ( -- this routine computes a grobner basis of an ideal or matrix with respect -- a weight vector w. gbw = method(Options => { Strategy => null }) -gbw(Ideal, List) := opts -> (I, w) -> ideal gbw(gens I, w, opts) +gbw(LeftIdeal, List) := opts -> (I, w) -> ideal gbw(gens I, w, opts) gbw(Matrix, List) := opts -> (m, w) -> ( -- preprocessing W := ring m; @@ -187,7 +187,7 @@ gbw(Matrix, List) := opts -> (m, w) -> ( -- This routine computes the characteristic ideal of a D-module characteristicIdeal = method() -characteristicIdeal Ideal := I -> ( +characteristicIdeal LeftIdeal := I -> ( if not isWeylAlgebra(W := ring I) then error "expected an ideal in a Weyl algebra"; createDpairs W; w := apply( toList(0..numgens W - 1), @@ -209,7 +209,7 @@ characteristicIdeal Module := M -> ( -- This routine computes the singular locus of a D-ideal -- SHOULD IT BE CHANGED SO THAT OUTPUT IS IN POLY SUBRING? DsingularLocus = method() -DsingularLocus Ideal := I -> DsingularLocus comodule I +DsingularLocus LeftIdeal := I -> DsingularLocus comodule I DsingularLocus Module := M -> ( if not isWeylAlgebra(W := ring M) then error "expected a module over a Weyl algebra"; createDpairs W; diff --git a/M2/Macaulay2/packages/WeylAlgebras/TST/Dbasic.m2 b/M2/Macaulay2/packages/WeylAlgebras/TST/Dbasic.m2 index b7c95995c7f..5578a2ecf2e 100644 --- a/M2/Macaulay2/packages/WeylAlgebras/TST/Dbasic.m2 +++ b/M2/Macaulay2/packages/WeylAlgebras/TST/Dbasic.m2 @@ -56,8 +56,9 @@ TEST/// assert (Dtransposition (u*Du) ==-Du*u); assert (Dtransposition ideal (u*Dv^2+Du^2*Dv) == ideal (u*Dv^2-Du^2*Dv)); assert (entries Dtransposition matrix {{u*Du, v}, {v*Dv^2, u^2}} == entries matrix {{-Du*u, v}, {Dv^2*v, u^2}}); - C1 = Dtransposition res ideal(u*Du); - C2 = res ideal(-Du*u); + needsPackage "BernsteinSato" + C1 = Dtransposition Dres ideal(u*Du); + C2 = Dres ideal(-Du*u); assert (C1_1==C2_1); /// diff --git a/M2/Macaulay2/packages/WeylAlgebras/stafford.m2 b/M2/Macaulay2/packages/WeylAlgebras/stafford.m2 index 24dd2903cc9..078d7bf488d 100644 --- a/M2/Macaulay2/packages/WeylAlgebras/stafford.m2 +++ b/M2/Macaulay2/packages/WeylAlgebras/stafford.m2 @@ -326,7 +326,7 @@ mainStep = (a,b,c) -> ( ) stafford = method(); -stafford Ideal := I -> ( +stafford LeftIdeal := I -> ( g := first entries gens I; while #g>2 do g = mainStep(g#0,g#1,g#2) | drop(g,3); ideal g @@ -607,7 +607,7 @@ isAll (ZZ,Matrix) := (k,M) -> ( t := target M; all(toList(0..numgens t - 1), i->reduceInCalR(k,t_{i},M)==0) ) -isAll (ZZ, Ideal) := (k,I) -> ( +isAll (ZZ, LeftIdeal) := (k,I) -> ( return isAll(k, gens gb I); R := ring I; n := numgens R // 2; @@ -645,4 +645,4 @@ R = QQ[x_1..x_n,D_1..D_n, WeylAlgebra=>(apply(n,i->x_(i+1)=>D_(i+1)))] a = D_1; b = D_2; c = D_3; d = D_4; stafford ideal (a,b,c,d) assert(ideal(a,b,c,d)==oo) -/// \ No newline at end of file +/// From 268df796e1f2f7a6b8022d9469a0896b9ab6bde2 Mon Sep 17 00:00:00 2001 From: Mahrud Sayrafi Date: Thu, 7 Dec 2023 01:32:09 -0600 Subject: [PATCH 7/9] added elimination methods for LeftIdeals --- M2/Macaulay2/packages/Elimination.m2 | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/M2/Macaulay2/packages/Elimination.m2 b/M2/Macaulay2/packages/Elimination.m2 index 69c09b8c842..9fdb64d2253 100644 --- a/M2/Macaulay2/packages/Elimination.m2 +++ b/M2/Macaulay2/packages/Elimination.m2 @@ -81,6 +81,7 @@ eliminate1 = (elimindices,I) -> ( ideal mingens ideal toR selectInSubring(1,generators gb J) ) +eliminate(List, LeftIdeal) := eliminate (List, Ideal) := (v,I) -> ( R := ring I; -- if R is a quotient ring, then give error @@ -92,8 +93,11 @@ eliminate (List, Ideal) := (v,I) -> ( eliminate1(varlist, I) ) +eliminate(LeftIdeal, RingElement) := eliminate (Ideal, RingElement) := (I,v) -> eliminate({v},I) +eliminate(LeftIdeal, List) := eliminate (Ideal, List) := (I,v) -> eliminate(v,I) +eliminate(RingElement, LeftIdeal) := eliminate(RingElement, Ideal) := (v,I) -> eliminate({v},I) ----------------------------------------------- @@ -175,6 +179,10 @@ document { undocumented { + (eliminate, RingElement, LeftIdeal), + (eliminate, LeftIdeal, RingElement), + (eliminate, List, LeftIdeal), + (eliminate, LeftIdeal, List), (eliminate, Ideal, RingElement), (eliminate, Ideal, List) } From ded8b986a5f443886b76bed0612e360d57060031 Mon Sep 17 00:00:00 2001 From: Mahrud Sayrafi Date: Thu, 7 Dec 2023 12:46:26 -0600 Subject: [PATCH 8/9] silenced the banner when running ComputationsBook tests with CMake --- M2/Macaulay2/tests/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/M2/Macaulay2/tests/CMakeLists.txt b/M2/Macaulay2/tests/CMakeLists.txt index 508f8b50c53..c387b929de9 100644 --- a/M2/Macaulay2/tests/CMakeLists.txt +++ b/M2/Macaulay2/tests/CMakeLists.txt @@ -103,7 +103,7 @@ add_custom_target(M2-tests-ComputationsBook) set(CHAPTERS completeIntersections constructions d-modules exterior-algebra geometry monomialIdeals preface programming schemes solving toricHilbertScheme varieties) -set(M2_ARGS -q --stop --print-width 0) +set(M2_ARGS -q --stop --silent --print-width 0) foreach(_chapter IN LISTS CHAPTERS) From 9d76fa5bf111c65b82f8a058b11ccb4c75c9a135 Mon Sep 17 00:00:00 2001 From: Mahrud Sayrafi Date: Thu, 7 Dec 2023 12:47:57 -0600 Subject: [PATCH 9/9] fixed a ComputationsBook/d-modules test --- .../tests/ComputationsBook/d-modules/test.m2 | 6 ++-- .../d-modules/test.out.expected | 32 +++++++++---------- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/M2/Macaulay2/tests/ComputationsBook/d-modules/test.m2 b/M2/Macaulay2/tests/ComputationsBook/d-modules/test.m2 index d6f610477ec..5513aac32e6 100644 --- a/M2/Macaulay2/tests/ComputationsBook/d-modules/test.m2 +++ b/M2/Macaulay2/tests/ComputationsBook/d-modules/test.m2 @@ -46,7 +46,7 @@ Jfgh=ideal relations Rfgh.LocModule; JH3=Jfgh+ideal(f^2,g,h); JH3gb=gens gb JH3 testmTorsion = method(); -testmTorsion Ideal := (L) -> ( +testmTorsion LeftIdeal := (L) -> ( LL = ideal generators gb L; n = numgens (ring (LL)) // 2; LLLL = ideal select(first entries gens LL, f->( @@ -71,7 +71,7 @@ Ifgh=ideal relations Rfgh.LocModule; IH3=Ifgh+ideal(f,g,h); IH3gb=gens gb IH3 findSocle = method(); -findSocle(Ideal, RingElement):= (L,P) -> ( +findSocle(LeftIdeal, RingElement):= (L,P) -> ( createDpairs(ring(L)); v=(ring L).dpairVars#0; myflag = true; @@ -86,7 +86,7 @@ findSocle(Ideal, RingElement):= (L,P) -> ( D = ring JH3 findSocle(JH3,1_D) findLength = method(); -findLength Ideal := (I) -> ( +findLength LeftIdeal := (I) -> ( l = 0; while I != ideal 1_(ring I) do ( l = l + 1; diff --git a/M2/Macaulay2/tests/ComputationsBook/d-modules/test.out.expected b/M2/Macaulay2/tests/ComputationsBook/d-modules/test.out.expected index 966f2a7d395..587c6748ef8 100644 --- a/M2/Macaulay2/tests/ComputationsBook/d-modules/test.out.expected +++ b/M2/Macaulay2/tests/ComputationsBook/d-modules/test.out.expected @@ -11,7 +11,7 @@ i3 : Delta = ideal(Dx,Dy,Dz) o3 = ideal (Dx, Dy, Dz) -o3 : Ideal of D +o3 : LeftIdeal of D i4 : (Dx * x)^2 @@ -67,19 +67,19 @@ i10 : AnnFs(f) o10 = ideal (w*Dz - z*Dw, w*Dy - y*Dw, z*Dy - y*Dz, w*Dx - x*Dw, z*Dx - x*Dz, y*Dx - x*Dy, x*Dx + y*Dy + z*Dz + w*Dw - 2s) -o10 : Ideal of QQ[x..z, w, Dx, Dy, Dz, Dw, s] +o10 : LeftIdeal of QQ[x..z, w, Dx, Dy, Dz, Dw, s] i11 : L=ideal(x,y,Dz,Dw) o11 = ideal (x, y, Dz, Dw) -o11 : Ideal of D +o11 : LeftIdeal of D i12 : AnnIFs(L,f) o12 = ideal (y, x, w*Dz - z*Dw, z*Dz + w*Dw - 2s) -o12 : Ideal of QQ[x..z, w, Dx, Dy, Dz, Dw, s] +o12 : LeftIdeal of QQ[x..z, w, Dx, Dy, Dz, Dw, s] i13 : f @@ -117,7 +117,7 @@ i18 : I1 = ideal((x*Dx)^2+1) 2 2 o18 = ideal(x Dx + x*Dx + 1) -o18 : Ideal of D1 +o18 : LeftIdeal of D1 i19 : f1 = x; @@ -175,7 +175,7 @@ i27 : D = QQ[x,y,z,Dx,Dy,Dz, WeylAlgebra => {x=>Dx, y=>Dy, z=>Dz}]; i28 : Delta = ideal(Dx,Dy,Dz); -o28 : Ideal of D +o28 : LeftIdeal of D i29 : f=x^3+y^3+z^3; @@ -217,7 +217,7 @@ i33 : D= QQ[x,y,z,u,v,w,Dx,Dy,Dz,Du,Dv,Dw, WeylAlgebra => i34 : Delta=ideal(Dx,Dy,Dz,Du,Dv,Dw); -o34 : Ideal of D +o34 : LeftIdeal of D i35 : R=D^1/Delta; @@ -268,11 +268,11 @@ o42 = -2 i43 : Jfgh=ideal relations Rfgh.LocModule; -o43 : Ideal of D +o43 : LeftIdeal of D i44 : JH3=Jfgh+ideal(f^2,g,h); -o44 : Ideal of D +o44 : LeftIdeal of D i45 : JH3gb=gens gb JH3 @@ -283,7 +283,7 @@ o45 : Matrix D <--- D i46 : testmTorsion = method(); -i47 : testmTorsion Ideal := (L) -> ( +i47 : testmTorsion LeftIdeal := (L) -> ( LL = ideal generators gb L; n = numgens (ring (LL)) // 2; LLLL = ideal select(first entries gens LL, f->( @@ -309,7 +309,7 @@ i52 : h=x*w-y*z; i53 : Delta=ideal(Dx,Dy,Dz,Dw); -o53 : Ideal of D +o53 : LeftIdeal of D i54 : R=D^1/Delta; @@ -333,11 +333,11 @@ i57 : Rfgh=DlocalizeAll(Rfg.LocModule,h, Strategy => Oaku); i58 : Ifgh=ideal relations Rfgh.LocModule; -o58 : Ideal of D +o58 : LeftIdeal of D i59 : IH3=Ifgh+ideal(f,g,h); -o59 : Ideal of D +o59 : LeftIdeal of D i60 : IH3gb=gens gb IH3 @@ -348,7 +348,7 @@ o60 : Matrix D <--- D i61 : findSocle = method(); -i62 : findSocle(Ideal, RingElement):= (L,P) -> ( +i62 : findSocle(LeftIdeal, RingElement):= (L,P) -> ( createDpairs(ring(L)); v=(ring L).dpairVars#0; myflag = true; @@ -375,7 +375,7 @@ o64 : D i65 : findLength = method(); -i66 : findLength Ideal := (I) -> ( +i66 : findLength LeftIdeal := (I) -> ( l = 0; while I != ideal 1_(ring I) do ( l = l + 1; @@ -480,7 +480,7 @@ i89 : I = gkz(matrix{{1,2}}, {5}) o89 = ideal (x D + 2x D - 5, D - D ) 1 1 2 2 1 2 -o89 : Ideal of QQ[x ..x , D ..D ] +o89 : LeftIdeal of QQ[x ..x , D ..D ] 1 2 1 2 i90 : PolySols I