# Free resolutions#

Let $$R$$ be a commutative ring. A finite free resolution of an $$R$$-module $$M$$ is a chain complex of free $$R$$-modules

$0 \xleftarrow{d_0} R^{n_1} \xleftarrow{d_1} R^{n_1} \xleftarrow{d_2} \cdots \xleftarrow{d_k} R^{n_k} \xleftarrow{d_{k+1}} 0$

terminating with a zero module at the end that is exact (all homology groups are zero) such that the image of $$d_1$$ is $$M$$.

EXAMPLES:

sage: from sage.homology.free_resolution import FreeResolution
sage: S.<x,y,z,w> = PolynomialRing(QQ)
sage: m = matrix(S, 1, [z^2 - y*w, y*z - x*w, y^2 - x*z]).transpose()
sage: r = FreeResolution(m, name='S')
sage: r
S^1 <-- S^3 <-- S^2 <-- 0

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

sage: from sage.homology.graded_resolution import GradedFreeResolution
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 = GradedFreeResolution(I)
sage: r
S(0) <-- S(-2)⊕S(-2)⊕S(-2) <-- S(-3)⊕S(-3) <-- 0


An example of a minimal free resolution from [CLO2005]:

sage: R.<x,y,z,w> = QQ[]
sage: I = R.ideal([y*z - x*w, y^3 - x^2*z, x*z^2 - y^2*w, z^3 - y*w^2])
sage: r = FreeResolution(I)
sage: r
S^1 <-- S^4 <-- S^4 <-- S^1 <-- 0
sage: len(r)
3
sage: r.matrix(2)
[-z^2 -x*z  y*w -y^2]
[   y    0   -x    0]
[  -w    y    z    x]
[   0    w    0    z]


AUTHORS:

• Kwankyu Lee (2022-05-13): initial version

class sage.homology.free_resolution.FreeResolution(module, name='S', algorithm='heuristic')#

Minimal free resolutions of ideals or submodules of free modules of multivariate polynomial rings.

INPUT:

• module – a submodule of a free module $$M$$ of rank $$n$$ over $$S$$ or an ideal of a multi-variate polynomial ring

• name – a string; name of the base ring

• algorithm – Singular algorithm to compute a resolution of ideal

OUTPUT: a minimal free resolution of the ideal

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

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: from sage.homology.free_resolution import FreeResolution
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 = FreeResolution(I)
sage: r
S^1 <-- S^3 <-- S^2 <-- 0
sage: len(r)
2

sage: FreeResolution(I, algorithm='minimal')
S^1 <-- S^3 <-- S^2 <-- 0
sage: FreeResolution(I, algorithm='shreyer')
S^1 <-- S^3 <-- S^2 <-- 0
sage: FreeResolution(I, algorithm='standard')
S^1 <-- S^3 <-- S^2 <-- 0
sage: FreeResolution(I, algorithm='heuristic')
S^1 <-- S^3 <-- S^2 <-- 0


We can also construct a resolution by passing in a matrix defining the initial differential:

sage: m = matrix(S, 1, [z^2 - y*w, y*z - x*w, y^2 - x*z]).transpose()
sage: r = FreeResolution(m, name='S')
sage: r
S^1 <-- S^3 <-- S^2 <-- 0
sage: r.matrix(1)
[z^2 - y*w y*z - x*w y^2 - x*z]


An additional construction is using a submodule of a free module:

sage: M = m.image()
sage: r = FreeResolution(M, name='S')
sage: r
S^1 <-- S^3 <-- S^2 <-- 0


A nonhomogeneous ideal:

sage: I = S.ideal([z^2 - y*w, y*z - x*w, y^2 - x])
sage: R = FreeResolution(I)
sage: R
S^1 <-- S^3 <-- S^3 <-- S^1 <-- 0
sage: R.matrix(2)
[ y*z - x*w    y^2 - x          0]
[-z^2 + y*w          0    y^2 - x]
[         0 -z^2 + y*w -y*z + x*w]
sage: R.matrix(3)
[   y^2 - x]
[-y*z + x*w]
[ z^2 - y*w]

class sage.homology.free_resolution.FreeResolution_generic(base_ring, name='F')#

Generic base class of finite free resolutions.

A subclass must provide a _maps attribute that contains a list of the maps defining the resolution.

The matrix at index $$i$$ in the list defines the differential map from $$(i + 1)$$-th free module to the $$i$$-th free module over the base ring by multiplication on the left. The number of matrices in the list is the length of the resolution. The number of rows and columns of the matrices define the ranks of the free modules in the resolution.

Note that the first matrix in the list defines the differential map at homological index $$1$$.

A subclass can define _initial_differential attribute that contains the $$0$$-th differential map whose codomain is the target of the free resolution.

EXAMPLES:

sage: from sage.homology.free_resolution import FreeResolution
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 = FreeResolution(I)
sage: r.differential(0)
Coercion map:
From: Ambient free module of rank 1 over the integral domain
Multivariate Polynomial Ring in x, y, z, w over Rational Field
To:   Quotient module by Submodule of Ambient free module of rank 1
over the integral domain Multivariate Polynomial Ring in x, y, z, w over Rational Field
Generated by the rows of the matrix:
[-z^2 + y*w]
[ y*z - x*w]
[-y^2 + x*z]

chain_complex()#

Return this resolution as a chain complex.

A chain complex in Sage has its own useful methods.

EXAMPLES:

sage: from sage.homology.graded_resolution import GradedFreeResolution
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 = GradedFreeResolution(I)
sage: unicode_art(r.chain_complex())
⎛-y  x⎞
⎜ z -y⎟
(z^2 - y*w y*z - x*w y^2 - x*z)     ⎝-w  z⎠
0 <── C_0 <────────────────────────────── C_1 <────── C_2 <── 0

differential(i)#

Return the matrix representing the i-th differential map.

INPUT:

• i – a positive integer

EXAMPLES:

sage: from sage.homology.graded_resolution import GradedFreeResolution
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 = GradedFreeResolution(I)
sage: r
S(0) <-- S(-2)⊕S(-2)⊕S(-2) <-- S(-3)⊕S(-3) <-- 0
sage: r.differential(3)
Free module morphism defined by the matrix
[]
Domain: Ambient free module of rank 0 over the integral domain
Multivariate Polynomial Ring in x, y, z, w over Rational Field
Codomain: Ambient free module of rank 2 over the integral domain
Multivariate Polynomial Ring in x, y, z, w over Rational Field
sage: r.differential(2)
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: r.differential(1)
Free module morphism defined as left-multiplication by the matrix
[z^2 - y*w y*z - x*w y^2 - x*z]
Domain: Ambient free module of rank 3 over the integral domain
Multivariate Polynomial Ring in x, y, z, w over Rational Field
Codomain: Ambient free module of rank 1 over the integral domain
Multivariate Polynomial Ring in x, y, z, w over Rational Field
sage: r.differential(0)
Coercion map:
From: Ambient free module of rank 1 over the integral domain
Multivariate Polynomial Ring in x, y, z, w over Rational Field
To:   Quotient module by Submodule of Ambient free module of rank 1 over the integral domain
Multivariate Polynomial Ring in x, y, z, w over Rational Field
Generated by the rows of the matrix:
[-z^2 + y*w]
[ y*z - x*w]
[-y^2 + x*z]

matrix(i)#

Return the matrix representing the i-th differential map.

INPUT:

• i – a positive integer

EXAMPLES:

sage: from sage.homology.graded_resolution import GradedFreeResolution
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 = GradedFreeResolution(I)
sage: r
S(0) <-- S(-2)⊕S(-2)⊕S(-2) <-- S(-3)⊕S(-3) <-- 0
sage: r.matrix(3)
[]
sage: r.matrix(2)
[-y  x]
[ z -y]
[-w  z]
sage: r.matrix(1)
[z^2 - y*w y*z - x*w y^2 - x*z]

target()#

Return the codomain of the 0-th differential map.

EXAMPLES:

sage: from sage.homology.graded_resolution import GradedFreeResolution
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 = GradedFreeResolution(I)
sage: r
S(0) <-- S(-2)⊕S(-2)⊕S(-2) <-- S(-3)⊕S(-3) <-- 0
sage: r.target()
Quotient module by Submodule of Ambient free module of rank 1 over the integral domain
Multivariate Polynomial Ring in x, y, z, w over Rational Field
Generated by the rows of the matrix:
[-z^2 + y*w]
[ y*z - x*w]
[-y^2 + x*z]