Let $R$ be a commutative ring and let $E$ be a free $R$-module of finite rank $r$. Given a linear map $f \colon E \to R$, the Koszul complex associated to $f$ is the chain complex of $R$-modules
$\phantom{WWWW} 0 \leftarrow R \leftarrow \bigwedge^1 E \leftarrow \bigwedge^2 E \leftarrow \dotsb \leftarrow \bigwedge^r E \leftarrow 0, $
where the differential is given by
$\phantom{WWWW} dd_k(e_1 \wedge e_2 \wedge \dotsb \wedge e_k) = \sum_{i=1}^k (-1)^{i+1} f(e_i) \, e_1 \wedge e_2 \wedge \dotsb \wedge \widehat{e_i} \wedge \dotsb \wedge e_k, $
and the superscript hat means the term is omitted. For this method, the linear map $f$ is given as either a matrix with one row, or a list of ring elements.
i1 : S = QQ[a..d] o1 = S o1 : PolynomialRing |
i2 : koszulComplex {a}
1 1
o2 = S <-- S
0 1
o2 : Complex
|
i3 : C = koszulComplex {a^2+b^2,c^3}
1 2 1
o3 = S <-- S <-- S
0 1 2
o3 : Complex
|
i4 : dd^C
1 2
o4 = 0 : S <---------------- S : 1
| a2+b2 c3 |
2 1
1 : S <----------------- S : 2
{2} | -c3 |
{3} | a2+b2 |
o4 : ComplexMap
|
i5 : K4 = koszulComplex vars S
1 4 6 4 1
o5 = S <-- S <-- S <-- S <-- S
0 1 2 3 4
o5 : Complex
|
i6 : dd^K4
1 4
o6 = 0 : S <--------------- S : 1
| a b c d |
4 6
1 : S <----------------------------- S : 2
{1} | -b -c 0 -d 0 0 |
{1} | a 0 -c 0 -d 0 |
{1} | 0 a b 0 0 -d |
{1} | 0 0 0 a b c |
6 4
2 : S <----------------------- S : 3
{2} | c d 0 0 |
{2} | -b 0 d 0 |
{2} | a 0 0 d |
{2} | 0 -b -c 0 |
{2} | 0 a 0 -c |
{2} | 0 0 a b |
4 1
3 : S <-------------- S : 4
{3} | -d |
{3} | c |
{3} | -b |
{3} | a |
o6 : ComplexMap
|
i7 : assert isWellDefined K4 |
To obtain natural subcomplexes, use the Concentration option.
i8 : koszulComplex(vars S, Concentration => (2,3))
6 4
o8 = S <-- S
2 3
o8 : Complex
|
i9 : koszulComplex(vars S, Concentration => (-1,5))
1 4 6 4 1
o9 = S <-- S <-- S <-- S <-- S
0 1 2 3 4
o9 : Complex
|
The koszul complex can be constructed as an iterated tensor product. The maps are identical, except that the even indexed differentials have the opposite sign.
i10 : C = koszulComplex {d} ** (koszulComplex {c} ** (koszulComplex {b} ** koszulComplex {a}))
1 4 6 4 1
o10 = S <-- S <-- S <-- S <-- S
0 1 2 3 4
o10 : Complex
|
i11 : K = koszulComplex {a,b,c,d}
1 4 6 4 1
o11 = S <-- S <-- S <-- S <-- S
0 1 2 3 4
o11 : Complex
|
i12 : netList {{dd^C, dd^K}}
+--------------------------------------------+--------------------------------------------+
| 1 4 | 1 4 |
o12 = |0 : S <--------------- S : 1 |0 : S <--------------- S : 1 |
| | a b c d | | | a b c d | |
| | |
| 4 6 | 4 6 |
|1 : S <----------------------------- S : 2|1 : S <----------------------------- S : 2|
| {1} | b c 0 d 0 0 | | {1} | -b -c 0 -d 0 0 | |
| {1} | -a 0 c 0 d 0 | | {1} | a 0 -c 0 -d 0 | |
| {1} | 0 -a -b 0 0 d | | {1} | 0 a b 0 0 -d | |
| {1} | 0 0 0 -a -b -c | | {1} | 0 0 0 a b c | |
| | |
| 6 4 | 6 4 |
|2 : S <----------------------- S : 3 |2 : S <----------------------- S : 3 |
| {2} | c d 0 0 | | {2} | c d 0 0 | |
| {2} | -b 0 d 0 | | {2} | -b 0 d 0 | |
| {2} | a 0 0 d | | {2} | a 0 0 d | |
| {2} | 0 -b -c 0 | | {2} | 0 -b -c 0 | |
| {2} | 0 a 0 -c | | {2} | 0 a 0 -c | |
| {2} | 0 0 a b | | {2} | 0 0 a b | |
| | |
| 4 1 | 4 1 |
|3 : S <-------------- S : 4 |3 : S <-------------- S : 4 |
| {3} | d | | {3} | -d | |
| {3} | -c | | {3} | c | |
| {3} | b | | {3} | -b | |
| {3} | -a | | {3} | a | |
+--------------------------------------------+--------------------------------------------+
|