Let $$R$$ be a commutative ring. A graded free resolution of a graded $$R$$-module $$M$$ is a free resolution such that all maps are homogeneous module homomorphisms.

EXAMPLES:

sage: S.<x,y,z,w> = PolynomialRing(QQ)
sage: I = S.ideal([y*w - z^2, -x*w + y*z, x*z - y^2])
sage: r
S(0) <-- S(-2)⊕S(-2)⊕S(-2) <-- S(-3)⊕S(-3) <-- 0
S(0) <-- S(-2)⊕S(-2)⊕S(-2) <-- S(-3)⊕S(-3) <-- 0
S(0) <-- S(-2)⊕S(-2)⊕S(-2) <-- S(-3)⊕S(-3) <-- 0
S(0) <-- S(-2)⊕S(-2)⊕S(-2) <-- S(-3)⊕S(-3) <-- 0

>>> from sage.all import *
>>> S = PolynomialRing(QQ, names=('x', 'y', 'z', 'w',)); (x, y, z, w,) = S._first_ngens(4)
>>> I = S.ideal([y*w - z**Integer(2), -x*w + y*z, x*z - y**Integer(2)])
>>> r
S(0) <-- S(-2)⊕S(-2)⊕S(-2) <-- S(-3)⊕S(-3) <-- 0
S(0) <-- S(-2)⊕S(-2)⊕S(-2) <-- S(-3)⊕S(-3) <-- 0
S(0) <-- S(-2)⊕S(-2)⊕S(-2) <-- S(-3)⊕S(-3) <-- 0
S(0) <-- S(-2)⊕S(-2)⊕S(-2) <-- S(-3)⊕S(-3) <-- 0

sage: d = r.differential(2)
sage: d
Free module morphism defined as left-multiplication by the matrix
[ y  x]
[-z -y]
[ w  z]
Domain:   Ambient free module of rank 2 over the integral domain
Multivariate Polynomial Ring in x, y, z, w over Rational Field
Codomain: Ambient free module of rank 3 over the integral domain
Multivariate Polynomial Ring in x, y, z, w over Rational Field
sage: d.image()
Submodule of Ambient free module of rank 3 over the integral domain
Multivariate Polynomial Ring in x, y, z, w over Rational Field
Generated by the rows of the matrix:
[ y -z  w]
[ x -y  z]
sage: m = d.image()
S(-2)⊕S(-2)⊕S(-2) <-- S(-3)⊕S(-3) <-- 0

>>> from sage.all import *
>>> d = r.differential(Integer(2))
>>> d
Free module morphism defined as left-multiplication by the matrix
[ y  x]
[-z -y]
[ w  z]
Domain:   Ambient free module of rank 2 over the integral domain
Multivariate Polynomial Ring in x, y, z, w over Rational Field
Codomain: Ambient free module of rank 3 over the integral domain
Multivariate Polynomial Ring in x, y, z, w over Rational Field
>>> d.image()
Submodule of Ambient free module of rank 3 over the integral domain
Multivariate Polynomial Ring in x, y, z, w over Rational Field
Generated by the rows of the matrix:
[ y -z  w]
[ x -y  z]
>>> m = d.image()
S(-2)⊕S(-2)⊕S(-2) <-- S(-3)⊕S(-3) <-- 0


An example of multigraded resolution from Example 9.1 of [MilStu2005]:

sage: R.<s,t> = QQ[]
sage: S.<a,b,c,d> = QQ[]
sage: phi = S.hom([s, s*t, s*t^2, s*t^3])
sage: I = phi.kernel(); I                                                           # needs sage.rings.function_field
Ideal (c^2 - b*d, b*c - a*d, b^2 - a*c) of
Multivariate Polynomial Ring in a, b, c, d over Rational Field
sage: P3 = ProjectiveSpace(S)
sage: C = P3.subscheme(I)  # twisted cubic curve
sage: r = I.graded_free_resolution(degrees=[(1,0), (1,1), (1,2), (1,3)])
sage: r
S((0, 0)) <-- S((-2, -4))⊕S((-2, -3))⊕S((-2, -2)) <-- S((-3, -5))⊕S((-3, -4)) <-- 0
sage: r.K_polynomial(names='s,t')
s^3*t^5 + s^3*t^4 - s^2*t^4 - s^2*t^3 - s^2*t^2 + 1

>>> from sage.all import *
>>> R = QQ['s, t']; (s, t,) = R._first_ngens(2)
>>> S = QQ['a, b, c, d']; (a, b, c, d,) = S._first_ngens(4)
>>> phi = S.hom([s, s*t, s*t**Integer(2), s*t**Integer(3)])
>>> I = phi.kernel(); I                                                           # needs sage.rings.function_field
Ideal (c^2 - b*d, b*c - a*d, b^2 - a*c) of
Multivariate Polynomial Ring in a, b, c, d over Rational Field
>>> P3 = ProjectiveSpace(S)
>>> C = P3.subscheme(I)  # twisted cubic curve
>>> r = I.graded_free_resolution(degrees=[(Integer(1),Integer(0)), (Integer(1),Integer(1)), (Integer(1),Integer(2)), (Integer(1),Integer(3))])
>>> r
S((0, 0)) <-- S((-2, -4))⊕S((-2, -3))⊕S((-2, -2)) <-- S((-3, -5))⊕S((-3, -4)) <-- 0
>>> r.K_polynomial(names='s,t')
s^3*t^5 + s^3*t^4 - s^2*t^4 - s^2*t^3 - s^2*t^2 + 1


AUTHORS:

• Kwankyu Lee (2022-05): initial version

INPUT:

• module – a homogeneous submodule of a free module $$M$$ of rank $$n$$ over $$S$$ or a homogeneous ideal of a multivariate polynomial ring $$S$$

• degrees – (default: a list with all entries $$1$$) a list of integers or integer vectors giving degrees of variables of $$S$$

• shifts – a list of integers or integer vectors giving shifts of degrees of $$n$$ summands of the free module $$M$$; this is a list of zero degrees of length $$n$$ by default

• name – a string; name of the base ring

K_polynomial(names=None)[source]#

Return the K-polynomial of this resolution.

INPUT:

• names – (optional) a string of names of the variables of the K-polynomial

EXAMPLES:

sage: S.<x,y,z,w> = PolynomialRing(QQ)
sage: I = S.ideal([y*w - z^2, -x*w + y*z, x*z - y^2])
sage: r.K_polynomial()
2*t^3 - 3*t^2 + 1

>>> from sage.all import *
>>> S = PolynomialRing(QQ, names=('x', 'y', 'z', 'w',)); (x, y, z, w,) = S._first_ngens(4)
>>> I = S.ideal([y*w - z**Integer(2), -x*w + y*z, x*z - y**Integer(2)])
>>> r.K_polynomial()
2*t^3 - 3*t^2 + 1

betti(i, a=None)[source]#

Return the $$i$$-th Betti number in degree $$a$$.

INPUT:

• i – nonnegative integer

• a – a degree; if None, return Betti numbers in all degrees

EXAMPLES:

sage: S.<x,y,z,w> = PolynomialRing(QQ)
sage: I = S.ideal([y*w - z^2, -x*w + y*z, x*z - y^2])
sage: r.betti(0)
{0: 1}
sage: r.betti(1)
{2: 3}
sage: r.betti(2)
{3: 2}
sage: r.betti(1, 0)
0
sage: r.betti(1, 1)
0
sage: r.betti(1, 2)
3

>>> from sage.all import *
>>> S = PolynomialRing(QQ, names=('x', 'y', 'z', 'w',)); (x, y, z, w,) = S._first_ngens(4)
>>> I = S.ideal([y*w - z**Integer(2), -x*w + y*z, x*z - y**Integer(2)])
>>> r.betti(Integer(0))
{0: 1}
>>> r.betti(Integer(1))
{2: 3}
>>> r.betti(Integer(2))
{3: 2}
>>> r.betti(Integer(1), Integer(0))
0
>>> r.betti(Integer(1), Integer(1))
0
>>> r.betti(Integer(1), Integer(2))
3

shifts(i)[source]#

Return the shifts of self.

EXAMPLES:

sage: S.<x,y,z,w> = PolynomialRing(QQ)
sage: I = S.ideal([y*w - z^2, -x*w + y*z, x*z - y^2])
sage: r.shifts(0)
[0]
sage: r.shifts(1)
[2, 2, 2]
sage: r.shifts(2)
[3, 3]
sage: r.shifts(3)
[]

>>> from sage.all import *
>>> S = PolynomialRing(QQ, names=('x', 'y', 'z', 'w',)); (x, y, z, w,) = S._first_ngens(4)
>>> I = S.ideal([y*w - z**Integer(2), -x*w + y*z, x*z - y**Integer(2)])
>>> r.shifts(Integer(0))
[0]
>>> r.shifts(Integer(1))
[2, 2, 2]
>>> r.shifts(Integer(2))
[3, 3]
>>> r.shifts(Integer(3))
[]


Graded free resolution of free modules.

EXAMPLES:

sage: from sage.homology.free_resolution import FreeResolution
sage: R.<x> = QQ[]
sage: M = matrix([[x^3, 3*x^3, 5*x^3],
....:             [0, x, 2*x]])
sage: res = FreeResolution(M, graded=True); res
S(0)⊕S(0)⊕S(0) <-- S(-3)⊕S(-1) <-- 0

>>> from sage.all import *
>>> from sage.homology.free_resolution import FreeResolution
>>> R = QQ['x']; (x,) = R._first_ngens(1)
>>> M = matrix([[x**Integer(3), Integer(3)*x**Integer(3), Integer(5)*x**Integer(3)],
...             [Integer(0), x, Integer(2)*x]])
>>> res = FreeResolution(M, graded=True); res
S(0)⊕S(0)⊕S(0) <-- S(-3)⊕S(-1) <-- 0


Graded free resolutions of submodules and ideals of multivariate polynomial rings implemented using Singular.

INPUT:

• module – a homogeneous submodule of a free module $$M$$ of rank $$n$$ over $$S$$ or a homogeneous ideal of a multivariate polynomial ring $$S$$

• degrees – (default: a list with all entries $$1$$) a list of integers or integer vectors giving degrees of variables of $$S$$

• shifts – a list of integers or integer vectors giving shifts of degrees of $$n$$ summands of the free module $$M$$; this is a list of zero degrees of length $$n$$ by default

• name – a string; name of the base ring

• algorithm – Singular algorithm to compute a resolution of ideal

OUTPUT: a graded minimal free resolution of ideal

If module is an ideal of $$S$$, it is considered as a submodule of a free module of rank $$1$$ over $$S$$.

The degrees given to the variables of $$S$$ are integers or integer vectors of the same length. In the latter case, $$S$$ is said to be multigraded, and the resolution is a multigraded free resolution. The standard grading where all variables have degree $$1$$ is used if the degrees are not specified.

A summand of the graded free module $$M$$ is a shifted (or twisted) module of rank one over $$S$$, denoted $$S(-d)$$ with shift $$d$$.

The computation of the resolution is done by using libSingular. Different Singular algorithms can be chosen for best performance. The available algorithms and the corresponding Singular commands are shown below:

algorithm

Singular commands

minimal

mres(ideal)

shreyer

minres(sres(std(ideal)))

standard

minres(nres(std(ideal)))

heuristic

minres(res(std(ideal)))

EXAMPLES:

sage: S.<x,y,z,w> = PolynomialRing(QQ)
sage: I = S.ideal([y*w - z^2, -x*w + y*z, x*z - y^2])
S(0) <-- S(-2)⊕S(-2)⊕S(-2) <-- S(-3)⊕S(-3) <-- 0
sage: len(r)
2

sage: I = S.ideal([z^2 - y*w, y*z - x*w, y - x])
sage: I.is_homogeneous()
True
S(0) <-- S(-1)⊕S(-2)⊕S(-2) <-- S(-3)⊕S(-3)⊕S(-4) <-- S(-5) <-- 0

>>> from sage.all import *
>>> S = PolynomialRing(QQ, names=('x', 'y', 'z', 'w',)); (x, y, z, w,) = S._first_ngens(4)
>>> I = S.ideal([y*w - z**Integer(2), -x*w + y*z, x*z - y**Integer(2)])