# tensorComplex1 -- computes the first map of the tensor complex

## Synopsis

• Usage:
tensorComplex1(f,w)
tensorComplex1 f
• Inputs:
• Outputs:

## Description

Let $X := Proj(Spec S \times \mathbb P^{b_1-1}\times \cdots \times \mathbb P^{b_n-1})$, and let $$\mathbf K := \cdots \wedge^2 \oplus_1^a O_X(-1,\dots, -1) \to O_X \to 0$$ be the Koszul complex of the multilinear forms corresponding to f, on $X$. The output of tensorComplex1(f,w) is the first map of the complex obtained by pushing $\mathbf K \otimes {\mathcal O}_X(w_1,\dots,w_n)$ down to $Spec S$.

This script implements the construction of tensor complexes from the paper Tensor Complexes: Multilinear free resolutions constructed from higher tensors'' of Berkesch, Erman, Kummini and Sam (BEKS).

The program requires that $f$ is a flattened tensor, that is, a map $A \to B_1\otimes\cdots\otimes B_n$. Returns the first map in the tensor complex $F(f,w)$ of BEKS, requiring that $w$ satisfies: $$w_0 = 0, w_1 \geq 0, w_2 \geq w_1+b_1, \ {\rm and }\ w_i>w_{i-1} \ {\rm for }\ i\geq 2.$$

When $rank A=\sum rank B_i$, that is, $L_0 = \sum_{i=1}^n L_i$ then we are in the balanced case'' discussed in Section 3 of BEKS. In this case giving a weight vector is unnecessary, and one can use the format tensorComplex1 f.

The example from section 12 of BEKS appears below.

 i1 : f = flattenedGenericTensor({4,2,2},ZZ/32003) o1 = | x_(0,0,0) x_(1,0,0) x_(2,0,0) x_(3,0,0) | | x_(0,0,1) x_(1,0,1) x_(2,0,1) x_(3,0,1) | | x_(0,1,0) x_(1,1,0) x_(2,1,0) x_(3,1,0) | | x_(0,1,1) x_(1,1,1) x_(2,1,1) x_(3,1,1) | ZZ 4 ZZ 4 o1 : Matrix (-----[x ..x ]) <--- (-----[x ..x ]) 32003 0,0,0 3,1,1 32003 0,0,0 3,1,1 i2 : S = ring f; i3 : g = tensorComplex1(f,{0,0,2}) o3 = | -x_(0,1,0)x_(1,0,0)+x_(0,0,0)x_(1,1,0) -x_(0,1,0)x_(2,0,0)+x_(0,0,0)x_(2,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0,0)x_(3,1,0) -x_(1,1,0)x_(3,0,0)+x_(1,0,0)x_(3,1,0) -x_(2,1,0)x_(3,0,0)+x_(2,0,0)x_(3,1,0) | | -x_(0,1,1)x_(1,0,0)-x_(0,1,0)x_(1,0,1)+x_(0,0,1)x_(1,1,0)+x_(0,0,0)x_(1,1,1) -x_(0,1,1)x_(2,0,0)-x_(0,1,0)x_(2,0,1)+x_(0,0,1)x_(2,1,0)+x_(0,0,0)x_(2,1,1) -x_(1,1,1)x_(2,0,0)-x_(1,1,0)x_(2,0,1)+x_(1,0,1)x_(2,1,0)+x_(1,0,0)x_(2,1,1) -x_(0,1,1)x_(3,0,0)-x_(0,1,0)x_(3,0,1)+x_(0,0,1)x_(3,1,0)+x_(0,0,0)x_(3,1,1) -x_(1,1,1)x_(3,0,0)-x_(1,1,0)x_(3,0,1)+x_(1,0,1)x_(3,1,0)+x_(1,0,0)x_(3,1,1) -x_(2,1,1)x_(3,0,0)-x_(2,1,0)x_(3,0,1)+x_(2,0,1)x_(3,1,0)+x_(2,0,0)x_(3,1,1) | | -x_(0,1,1)x_(1,0,1)+x_(0,0,1)x_(1,1,1) -x_(0,1,1)x_(2,0,1)+x_(0,0,1)x_(2,1,1) -x_(1,1,1)x_(2,0,1)+x_(1,0,1)x_(2,1,1) -x_(0,1,1)x_(3,0,1)+x_(0,0,1)x_(3,1,1) -x_(1,1,1)x_(3,0,1)+x_(1,0,1)x_(3,1,1) -x_(2,1,1)x_(3,0,1)+x_(2,0,1)x_(3,1,1) | 3 6 o4 : Matrix S <--- S i5 : betti matrix g 0 1 o5 = total: 3 6 -1: . 6 0: 3 . o5 : BettiTally i6 : betti matrix g1 0 1 o6 = total: 3 6 -1: . 6 0: 3 . o6 : BettiTally i7 : betti res coker g 0 1 2 o7 = total: 3 6 3 0: 3 . . 1: . 6 . 2: . . 3 o7 : BettiTally

We can recover the Eagon-Northcott complex as follows.

 i8 : f = flattenedGenericTensor({6,2}, ZZ/32003) o8 = | x_(0,0) x_(1,0) x_(2,0) x_(3,0) x_(4,0) x_(5,0) | | x_(0,1) x_(1,1) x_(2,1) x_(3,1) x_(4,1) x_(5,1) | ZZ 2 ZZ 6 o8 : Matrix (-----[x ..x ]) <--- (-----[x ..x ]) 32003 0,0 5,1 32003 0,0 5,1 i9 : S = ring f; i10 : g = tensorComplex1(f,{0,0}); 1 15 o10 : Matrix S <--- S i11 : transpose g o11 = | -x_(0,1)x_(1,0)+x_(0,0)x_(1,1) | | -x_(0,1)x_(2,0)+x_(0,0)x_(2,1) | | -x_(1,1)x_(2,0)+x_(1,0)x_(2,1) | | -x_(0,1)x_(3,0)+x_(0,0)x_(3,1) | | -x_(1,1)x_(3,0)+x_(1,0)x_(3,1) | | -x_(2,1)x_(3,0)+x_(2,0)x_(3,1) | | -x_(0,1)x_(4,0)+x_(0,0)x_(4,1) | | -x_(1,1)x_(4,0)+x_(1,0)x_(4,1) | | -x_(2,1)x_(4,0)+x_(2,0)x_(4,1) | | -x_(3,1)x_(4,0)+x_(3,0)x_(4,1) | | -x_(0,1)x_(5,0)+x_(0,0)x_(5,1) | | -x_(1,1)x_(5,0)+x_(1,0)x_(5,1) | | -x_(2,1)x_(5,0)+x_(2,0)x_(5,1) | | -x_(3,1)x_(5,0)+x_(3,0)x_(5,1) | | -x_(4,1)x_(5,0)+x_(4,0)x_(5,1) | 15 1 o11 : Matrix S <--- S i12 : betti res coker g 0 1 2 3 4 5 o12 = total: 1 15 40 45 24 5 0: 1 . . . . . 1: . 15 40 45 24 5 o12 : BettiTally i13 : betti eagonNorthcott matrix entries matrix f 0 1 2 3 4 5 o13 = total: 1 15 40 45 24 5 0: 1 . . . . . 1: . 15 40 45 24 5 o13 : BettiTally

The following example is taken from the introduction to BEKS.

 i14 : f = flattenedGenericTensor({7,1,2,1,2,1},ZZ/32003); ZZ 4 ZZ 7 o14 : Matrix (-----[x , x , x , x , x , x , x , x , x , x , x , x , x , x , x , x , x , x , x , x , x , x , x , x , x , x , x , x ]) <--- (-----[x , x , x , x , x , x , x , x , x , x , x , x , x , x , x , x , x , x , x , x , x , x , x , x , x , x , x , x ]) 32003 0,0,0,0,0,0 0,0,0,0,1,0 0,0,1,0,0,0 0,0,1,0,1,0 1,0,0,0,0,0 1,0,0,0,1,0 1,0,1,0,0,0 1,0,1,0,1,0 2,0,0,0,0,0 2,0,0,0,1,0 2,0,1,0,0,0 2,0,1,0,1,0 3,0,0,0,0,0 3,0,0,0,1,0 3,0,1,0,0,0 3,0,1,0,1,0 4,0,0,0,0,0 4,0,0,0,1,0 4,0,1,0,0,0 4,0,1,0,1,0 5,0,0,0,0,0 5,0,0,0,1,0 5,0,1,0,0,0 5,0,1,0,1,0 6,0,0,0,0,0 6,0,0,0,1,0 6,0,1,0,0,0 6,0,1,0,1,0 32003 0,0,0,0,0,0 0,0,0,0,1,0 0,0,1,0,0,0 0,0,1,0,1,0 1,0,0,0,0,0 1,0,0,0,1,0 1,0,1,0,0,0 1,0,1,0,1,0 2,0,0,0,0,0 2,0,0,0,1,0 2,0,1,0,0,0 2,0,1,0,1,0 3,0,0,0,0,0 3,0,0,0,1,0 3,0,1,0,0,0 3,0,1,0,1,0 4,0,0,0,0,0 4,0,0,0,1,0 4,0,1,0,0,0 4,0,1,0,1,0 5,0,0,0,0,0 5,0,0,0,1,0 5,0,1,0,0,0 5,0,1,0,1,0 6,0,0,0,0,0 6,0,0,0,1,0 6,0,1,0,0,0 6,0,1,0,1,0 i15 : S = ring f; i16 : g = tensorComplex1 f; 10 28 o16 : Matrix S <--- S i17 : betti res coker g 0 1 2 3 4 5 o17 = total: 10 28 70 70 28 10 0: 10 28 . . . . 1: . . 70 70 . . 2: . . . . 28 10 o17 : BettiTally

The input map need not be generic.

 i18 : S = QQ[x,y,z]; i19 : F = labeledModule S^5 5 o19 = S o19 : free S-module with labeled basis i20 : G = tensorProduct(labeledModule S^2, labeledModule S^2) 4 o20 = S o20 : free S-module with labeled basis i21 : f = map(G,F, (i,j) -> random(1,S)) o21 = | 9/2x+1/2y+9/4z 1/2x+y+3/4z 3/2x+3/4y+7/4z 7/9x+7/10y+1/2z 7/10x+7/3y+7z | | 3/7x+5/2y+6/7z 2/3x+y+2z 6x+5/4y+2/9z 5x+3/10y+z 3/7x+5y+10/9z | | 1/2x+10y+3z 3x+3/2y+4/3z 7/8x+5/6y+5z 2/5x+5/3y+7/2z 2/5x+6/5y+5/4z | | 5/7x+5/9y+5/3z 4/5x+1/10y+4/3z 3/7x+9/10y+4/7z 5/2x+5/9y+5/9z 6/7x+2y+z | 4 5 o21 : Matrix S <--- S i22 : g = tensorComplex1(f, {0,0,2}); 3 10 o22 : Matrix S <--- S i23 : betti res coker g 0 1 2 3 o23 = total: 3 10 15 8 0: 3 . . . 1: . 10 . . 2: . . 15 8 o23 : BettiTally

## Caveat

Unlike BEKS, this method does not work with arbitrary weight vectors w.