-- Hilfsfkt. fuer Abb.matrix
Define DecreaseJThEntry(L,J)
TheList:=L;
TheList[J]:=TheList[J]-1;
Return TheList;
EndDefine;
-- Abb.matrix von S^N(O^K)-->S^N(O^(K-1)) fuer Liste L (der Laenge K) von Polynomen
Define SymSyzMatrix(L,N)
K:=Len(L);
IndexSetDomain:=SymIndexRecursive(K,N);
IndexSetRange:=SymIndexRecursive(K,N-1);
DimDomain:=Len(IndexSetDomain);
DimRange:=Len(IndexSetRange);
Matrix:=NewMat(DimRange, DimDomain, 0);
For IDomain:=1 To DimDomain Do
For J:=1 To K Do
For IRange:=1 To DimRange Do
If (DecreaseJThEntry(IndexSetDomain[IDomain], J)=IndexSetRange[IRange]) Then
Matrix[IRange][IDomain]:=L[J]
EndIf;
EndFor;
EndFor;
EndFor;
Return Matrix;
EndDefine;
-- Cokern der globalen Auswertung von 0->S^N(Syz)->S^N(O^K)>S^(N-1)(O^K)->0
-- fuer Liste L von Polynomen in Poly.ring/(F)
-- CurrentRing() muss der richtige Poly.ring sein
Define SymSyzCoker(F,L,N)
K:=Len(L);
IndexSetDomain:=SymIndexRecursive(K,N);
IndexSetRange:=SymIndexRecursive(K,N-1);
DimDomain:=Len(IndexSetDomain);
DimRange:=Len(IndexSetRange);
FList:=[];
For I:=1 To DimRange Do Append(FList, F) EndFor;
FMatrix:=DiagonalMat(FList);
BigMatrix:=Transposed(SymSyzMatrix(L,N));
-- d.h. Liste der Spalten der Abb-Matrix (DimDomain Stueck der Laenge DimRange); = Basis vom Bild im Poly.ring
Gens:=[];
For I:=1 To DimDomain Do Append(Gens, Vector(BigMatrix[I])) EndFor;
For I:=1 To DimRange Do Append(Gens, Vector(FMatrix[I])) EndFor;
DivideBy:=Module(Gens);
CokerBasis:=NormalBasisM(DivideBy);
Return Len(CokerBasis);
EndDefine;