  
  [1X11 Complexes[0X
  
  
  [1X11.1 Complexes: Category and Representations[0X
  
  [1X11.1-1 IsHomalgComplex[0m
  
  [2X> IsHomalgComplex( [0X[3XC[0X[2X ) _____________________________________________[0XCategory
  [6XReturns:[0X  [10Xtrue[0m or [10Xfalse[0m
  
  The [5XGAP[0m category of [5Xhomalg[0m (co)complexes.
  
  (It is a subcategory of the [5XGAP[0m category [10XIsHomalgObject[0m.)
  
  [1X11.1-2 IsComplexOfFinitelyPresentedObjectsRep[0m
  
  [2X> IsComplexOfFinitelyPresentedObjectsRep( [0X[3XC[0X[2X ) ________________[0XRepresentation
  [6XReturns:[0X  [10Xtrue[0m or [10Xfalse[0m
  
  The [5XGAP[0m representation of complexes of finitley generated [5Xhomalg[0m modules.
  
  (It  is a representation of the [5XGAP[0m category [2XIsHomalgComplex[0m ([14X11.1-1[0m), which
  is      a      subrepresentation      of      the     [5XGAP[0m     representation
  [10XIsFinitelyPresentedObjectRep[0m.)
  
  [1X11.1-3 IsCocomplexOfFinitelyPresentedObjectsRep[0m
  
  [2X> IsCocomplexOfFinitelyPresentedObjectsRep( [0X[3XC[0X[2X ) ______________[0XRepresentation
  [6XReturns:[0X  [10Xtrue[0m or [10Xfalse[0m
  
  The [5XGAP[0m representation of cocomplexes of finitley generated [5Xhomalg[0m modules.
  
  (It  is a representation of the [5XGAP[0m category [2XIsHomalgComplex[0m ([14X11.1-1[0m), which
  is      a      subrepresentation      of      the     [5XGAP[0m     representation
  [10XIsFinitelyPresentedObjectRep[0m.)
  
  
  [1X11.2 Complexes: Constructors[0X
  
  [1X11.2-1 HomalgComplex[0m
  
  [2X> HomalgComplex( [0X[3XM[, d][0X[2X ) __________________________________________[0Xfunction
  [2X> HomalgComplex( [0X[3Xphi[, d][0X[2X ) ________________________________________[0Xfunction
  [2X> HomalgComplex( [0X[3XC[, d][0X[2X ) __________________________________________[0Xfunction
  [2X> HomalgComplex( [0X[3Xcm[, d][0X[2X ) _________________________________________[0Xfunction
  [6XReturns:[0X  a [5Xhomalg[0m complex
  
  The  first  syntax  creates  a  complex (i.e. chain complex) with the single
  [5Xhomalg[0m module [3XM[0m (--> [14X9.2[0m) at (homological) degree [3Xd[0m.
  
  The  second  syntax  creates  a  complex with the single [5Xhomalg[0m map [3Xphi[0m (-->
  [2XHomalgMap[0m  ([14X10.2-1[0m)),  its  source placed at (homological) degree [3Xd[0m (and its
  target at [3Xd[0m-1).
  
  The  third  syntax  creates  a  complex (i.e. chain complex) with the single
  [5Xhomalg[0m (co)complex [3XC[0m at (homological) degree [3Xd[0m.
  
  The  fourth syntax creates a complex with the single [5Xhomalg[0m (co)chain map [3Xcm[0m
  (-->  [2XHomalgChainMap[0m  ([14X12.2-1[0m)), its source placed at (homological) degree [3Xd[0m
  (and its target at [3Xd[0m-1).
  
  If [3Xd[0m is not provided it defaults to zero in all cases.
  To add a map (resp. (co)chain map) to a complex use [2XAdd[0m ([14X11.5-1[0m).
  
  [4X---------------------------  Example  ----------------------------[0X
    [4Xgap> ZZ := HomalgRingOfIntegers( );;[0X
    [4Xgap> M := HomalgMatrix( "[ 2, 3, 4,   5, 6, 7 ]", 2, 3, ZZ );[0X
    [4X<A homalg internal 2 by 3 matrix>[0X
    [4Xgap> M := LeftPresentation( M );[0X
    [4X<A non-torsion left module presented by 2 relations for 3 generators>[0X
    [4Xgap> N := HomalgMatrix( "[ 2, 3, 4, 5,   6, 7, 8, 9 ]", 2, 4, ZZ );[0X
    [4X<A homalg internal 2 by 4 matrix>[0X
    [4Xgap> N := LeftPresentation( N );[0X
    [4X<A non-torsion left module presented by 2 relations for 4 generators>[0X
    [4Xgap> mat := HomalgMatrix( "[ \[0X
    [4X> 0, 3, 6, 9, \[0X
    [4X> 0, 2, 4, 6, \[0X
    [4X> 0, 3, 6, 9  \[0X
    [4X> ]", 3, 4, ZZ );[0X
    [4X<A homalg internal 3 by 4 matrix>[0X
    [4Xgap> phi := HomalgMap( mat, M, N );[0X
    [4X<A "homomorphism" of left modules>[0X
    [4Xgap> IsMorphism( phi );[0X
    [4Xtrue[0X
    [4Xgap> phi;[0X
    [4X<A homomorphism of left modules>[0X
  [4X------------------------------------------------------------------[0X
  
  The first possibility:
  
  [4X---------------------------  Example  ----------------------------[0X
    [4X<A homomorphism of left modules>[0X
    [4Xgap> C := HomalgComplex( N );[0X
    [4X<A non-zero graded homology object consisting of a single left module at degre\[0X
    [4Xe 0>[0X
    [4Xgap> Add( C, phi );[0X
    [4Xgap> C;[0X
    [4X<A complex containing a single morphism of left modules at degrees [ 0 .. 1 ]>[0X
  [4X------------------------------------------------------------------[0X
  
  The second possibility:
  
  [4X---------------------------  Example  ----------------------------[0X
    [4Xgap> C := HomalgComplex( phi );[0X
    [4X<A non-zero acyclic complex containing a single morphism of left modules at de\[0X
    [4Xgrees [ 0 .. 1 ]>[0X
  [4X------------------------------------------------------------------[0X
  
  [1X11.2-2 HomalgCocomplex[0m
  
  [2X> HomalgCocomplex( [0X[3XM[, d][0X[2X ) ________________________________________[0Xfunction
  [2X> HomalgCocomplex( [0X[3Xphi[, d][0X[2X ) ______________________________________[0Xfunction
  [2X> HomalgCocomplex( [0X[3XC[, d][0X[2X ) ________________________________________[0Xfunction
  [2X> HomalgCocomplex( [0X[3Xcm[, d][0X[2X ) _______________________________________[0Xfunction
  [6XReturns:[0X  a [5Xhomalg[0m complex
  
  The  first syntax creates a cocomplex (i.e. cochain complex) with the single
  [5Xhomalg[0m module [3XM[0m at (cohomological) degree [3Xd[0m.
  
  The  second  syntax  creates a cocomplex with the single [5Xhomalg[0m map [3Xphi[0m (-->
  [2XHomalgMap[0m  ([14X10.2-1[0m)), its source placed at (cohomological) degree [3Xd[0m (and its
  target at [3Xd[0m+1).
  
  The  third syntax creates a cocomplex (i.e. cochain complex) with the single
  [5Xhomalg[0m cocomplex [3XC[0m at (cohomological) degree [3Xd[0m.
  
  The  fourth  syntax creates a cocomplex with the single [5Xhomalg[0m (co)chain map
  [3Xcm[0m  (-->  [2XHomalgChainMap[0m  ([14X12.2-1[0m)),  its  source  placed at (cohomological)
  degree [3Xd[0m (and its target at [3Xd[0m+1).
  
  If [3Xd[0m is not provided it defaults to zero in all cases.
  To add a map (resp. (co)chain map) to a cocomplex use [2XAdd[0m ([14X11.5-1[0m).
  
  [4X---------------------------  Example  ----------------------------[0X
    [4Xgap> ZZ := HomalgRingOfIntegers( );;[0X
    [4Xgap> M := HomalgMatrix( "[ 2, 3, 4,   5, 6, 7 ]", 2, 3, ZZ );[0X
    [4X<A homalg internal 2 by 3 matrix>[0X
    [4Xgap> M := RightPresentation( Involution( M ) );[0X
    [4X<A non-torsion right module on 3 generators satisfying 2 relations>[0X
    [4Xgap> N := HomalgMatrix( "[ 2, 3, 4, 5,   6, 7, 8, 9 ]", 2, 4, ZZ );[0X
    [4X<A homalg internal 2 by 4 matrix>[0X
    [4Xgap> N := RightPresentation( Involution( N ) );[0X
    [4X<A non-torsion right module on 4 generators satisfying 2 relations>[0X
    [4Xgap> mat := HomalgMatrix( "[ \[0X
    [4X> 0, 3, 6, 9, \[0X
    [4X> 0, 2, 4, 6, \[0X
    [4X> 0, 3, 6, 9  \[0X
    [4X> ]", 3, 4, ZZ );[0X
    [4X<A homalg internal 3 by 4 matrix>[0X
    [4Xgap> phi := HomalgMap( Involution( mat ), M, N );[0X
    [4X<A "homomorphism" of right modules>[0X
    [4Xgap> IsMorphism( phi );[0X
    [4Xtrue[0X
    [4Xgap> phi;[0X
    [4X<A homomorphism of right modules>[0X
  [4X------------------------------------------------------------------[0X
  
  The first possibility:
  
  [4X---------------------------  Example  ----------------------------[0X
    [4X<A homomorphism of right modules>[0X
    [4Xgap> C := HomalgCocomplex( M );[0X
    [4X<A non-zero graded cohomology object consisting of a single right module at de\[0X
    [4Xgree 0>[0X
    [4Xgap> Add( C, phi );[0X
    [4Xgap> C;[0X
    [4X<A cocomplex containing a single morphism of right modules at degrees[0X
    [4X[ 0 .. 1 ]>[0X
  [4X------------------------------------------------------------------[0X
  
  The second possibility:
  
  [4X---------------------------  Example  ----------------------------[0X
    [4Xgap> C := HomalgCocomplex( phi );[0X
    [4X<A non-zero acyclic cocomplex containing a single morphism of right modules at\[0X
    [4X degrees [ 0 .. 1 ]>[0X
  [4X------------------------------------------------------------------[0X
  
  
  [1X11.3 Complexes: Properties[0X
  
  [1X11.3-1 IsSequence[0m
  
  [2X> IsSequence( [0X[3XC[0X[2X ) __________________________________________________[0Xproperty
  [6XReturns:[0X  [10Xtrue[0m or [10Xfalse[0m
  
  Check if all maps in [3XC[0m are well-defined.
  
  [1X11.3-2 IsComplex[0m
  
  [2X> IsComplex( [0X[3XC[0X[2X ) ___________________________________________________[0Xproperty
  [6XReturns:[0X  [10Xtrue[0m or [10Xfalse[0m
  
  Check if [3XC[0m is complex.
  
  [1X11.3-3 IsAcyclic[0m
  
  [2X> IsAcyclic( [0X[3XC[0X[2X ) ___________________________________________________[0Xproperty
  [6XReturns:[0X  [10Xtrue[0m or [10Xfalse[0m
  
  Check  if  the  [5Xhomalg[0m  complex  [3XC[0m  is  acyclic,  i.e.  exact  except at its
  boundaries.
  
  [1X11.3-4 IsRightAcyclic[0m
  
  [2X> IsRightAcyclic( [0X[3XC[0X[2X ) ______________________________________________[0Xproperty
  [6XReturns:[0X  [10Xtrue[0m or [10Xfalse[0m
  
  Check  if  the  [5Xhomalg[0m  complex  [3XC[0m is acyclic, i.e. exact except at its left
  boundary.
  
  [1X11.3-5 IsLeftAcyclic[0m
  
  [2X> IsLeftAcyclic( [0X[3XC[0X[2X ) _______________________________________________[0Xproperty
  [6XReturns:[0X  [10Xtrue[0m or [10Xfalse[0m
  
  Check  if  the  [5Xhomalg[0m  complex [3XC[0m is acyclic, i.e. exact except at its right
  boundary.
  
  [1X11.3-6 IsGradedObject[0m
  
  [2X> IsGradedObject( [0X[3XC[0X[2X ) ______________________________________________[0Xproperty
  [6XReturns:[0X  [10Xtrue[0m or [10Xfalse[0m
  
  Check  if  the [5Xhomalg[0m complex [3XC[0m is a graded object, i.e. if all maps between
  the objects in [3XC[0m vanish.
  
  [1X11.3-7 IsExactSequence[0m
  
  [2X> IsExactSequence( [0X[3XC[0X[2X ) _____________________________________________[0Xproperty
  [6XReturns:[0X  [10Xtrue[0m or [10Xfalse[0m
  
  Check if the [5Xhomalg[0m complex [3XC[0m is exact.
  
  [1X11.3-8 IsShortExactSequence[0m
  
  [2X> IsShortExactSequence( [0X[3XC[0X[2X ) ________________________________________[0Xproperty
  [6XReturns:[0X  [10Xtrue[0m or [10Xfalse[0m
  
  Check if the [5Xhomalg[0m complex [3XC[0m is a short exact sequence.
  
  [1X11.3-9 IsSplitShortExactSequence[0m
  
  [2X> IsSplitShortExactSequence( [0X[3XC[0X[2X ) ___________________________________[0Xproperty
  [6XReturns:[0X  [10Xtrue[0m or [10Xfalse[0m
  
  Check if the [5Xhomalg[0m complex [3XC[0m is a split short exact sequence.
  
  [1X11.3-10 IsTriangle[0m
  
  [2X> IsTriangle( [0X[3XC[0X[2X ) __________________________________________________[0Xproperty
  [6XReturns:[0X  [10Xtrue[0m or [10Xfalse[0m
  
  Set to true if the [5Xhomalg[0m complex [3XC[0m is a triangle.
  
  [1X11.3-11 IsExactTriangle[0m
  
  [2X> IsExactTriangle( [0X[3XC[0X[2X ) _____________________________________________[0Xproperty
  [6XReturns:[0X  [10Xtrue[0m or [10Xfalse[0m
  
  Check if the [5Xhomalg[0m complex [3XC[0m is an exact triangle.
  
  
  [1X11.4 Complexes: Attributes[0X
  
  [1X11.4-1 BettiDiagram[0m
  
  [2X> BettiDiagram( [0X[3XC[0X[2X ) _______________________________________________[0Xattribute
  [6XReturns:[0X  a [5Xhomalg[0m diagram
  
  The Betti diagram of the [5Xhomalg[0m complex [3XC[0m of graded modules.
  
  
  [1X11.5 Complexes: Operations and Functions[0X
  
  [1X11.5-1 Add[0m
  
  [2X> Add( [0X[3XC, phi[0X[2X ) ___________________________________________________[0Xoperation
  [2X> Add( [0X[3XC, mat[0X[2X ) ___________________________________________________[0Xoperation
  [6XReturns:[0X  a [5Xhomalg[0m complex
  
  In  the  first  syntax  the map [3Xphi[0m is added to the (co)chain complex [3XC[0m (-->
  [14X11.2[0m)  as  the  new  [13Xhighest[0m  degree  morphism and the altered argument [3XC[0m is
  returned.  In  case [3XC[0m is a chain complex, the highest degree module in [3XC[0m and
  the  target  of  [3Xphi[0m  must be [13Xidentical[0m. In case [3XC[0m is a [13Xco[0mchain complex, the
  highest degree module in [3XC[0m and the source of [3Xphi[0m must be [13Xidentical[0m.
  
  In  the second syntax the matrix [3Xmat[0m is interpreted as the matrix of the new
  [13Xhighest[0m  degree  morphism  psi, created according to the following rules: In
  case  [3XC[0m is a chain complex, the highest degree left (resp. right) module C_d
  in  [3XC[0m  is  declared  as the target of psi, while its source is taken to be a
  free  left  (resp.  right)  module  of  rank  equal  to  [10XNrRows[0m([3Xmat[0m)  (resp.
  [10XNrColumns[0m([3Xmat[0m)).  For  this [10XNrColumns[0m([3Xmat[0m) (resp. [10XNrRows[0m([3Xmat[0m)) must coincide
  with  the  [10XNrGenerators[0m(C_d).  In  case  [3XC[0m is a [13Xco[0mchain complex, the highest
  degree  left (resp. right) module C^d in [3XC[0m is declared as the source of psi,
  while  its  target  is  taken to be a free left (resp. right) module of rank
  equal  to  [10XNrColumns[0m([3Xmat[0m)  (resp.  [10XNrRows[0m([3Xmat[0m)). For this [10XNrRows[0m([3Xmat[0m) (resp.
  [10XColumns[0m([3Xmat[0m)) must coincide with the [10XNrGenerators[0m(C^d).
  
  [4X---------------------------  Example  ----------------------------[0X
    [4Xgap> ZZ := HomalgRingOfIntegers( );;[0X
    [4Xgap> mat := HomalgMatrix( "[ 0, 1,   0, 0 ]", 2, 2, ZZ );[0X
    [4X<A homalg internal 2 by 2 matrix>[0X
    [4Xgap> phi := HomalgMap( mat );[0X
    [4X<A homomorphism of left modules>[0X
    [4Xgap> C := HomalgComplex( phi );[0X
    [4X<A non-zero acyclic complex containing a single morphism of left modules at de\[0X
    [4Xgrees [ 0 .. 1 ]>[0X
    [4Xgap> Add( C, mat );[0X
    [4Xgap> C;[0X
    [4X<A sequence containing 2 morphisms of left modules at degrees [ 0 .. 2 ]>[0X
    [4Xgap> Display( C );[0X
    [4X-------------------------[0X
    [4Xat homology degree: 2[0X
    [4XZ^(1 x 2)[0X
    [4X-------------------------[0X
    [4X[ [  0,  1 ],[0X
    [4X  [  0,  0 ] ][0X
    [4X[0X
    [4Xthe map is currently represented by the above 2 x 2 matrix[0X
    [4X------------v------------[0X
    [4Xat homology degree: 1[0X
    [4XZ^(1 x 2)[0X
    [4X-------------------------[0X
    [4X[ [  0,  1 ],[0X
    [4X  [  0,  0 ] ][0X
    [4X[0X
    [4Xthe map is currently represented by the above 2 x 2 matrix[0X
    [4X------------v------------[0X
    [4Xat homology degree: 0[0X
    [4XZ^(1 x 2)[0X
    [4X-------------------------[0X
    [4Xgap> IsComplex( C );[0X
    [4Xtrue[0X
    [4Xgap> IsAcyclic( C );[0X
    [4Xtrue[0X
    [4Xgap> IsExactSequence( C );[0X
    [4Xfalse[0X
    [4Xgap> C;[0X
    [4X<A non-zero acyclic complex containing 2 morphisms of left modules at degrees[0X
    [4X[ 0 .. 2 ]>[0X
  [4X------------------------------------------------------------------[0X
  
  [1X11.5-2 ByASmallerPresentation[0m
  
  [2X> ByASmallerPresentation( [0X[3XC[0X[2X ) ________________________________________[0Xmethod
  [6XReturns:[0X  a [5Xhomalg[0m complex
  
  See [2XByASmallerPresentation[0m ([14X9.5-2[0m) on modules.
  
  [4X-----------------------------  Code  -----------------------------[0X
    [4XInstallMethod( ByASmallerPresentation,[0X
    [4X        "for homalg complexes",[0X
    [4X        [ IsHomalgComplex ],[0X
    [4X        [0X
    [4X  function( C )[0X
    [4X    [0X
    [4X    List( ObjectsOfComplex( C ), ByASmallerPresentation );[0X
    [4X    [0X
    [4X    if Length( ObjectDegreesOfComplex( C ) ) > 1 then[0X
    [4X        List( MorphismsOfComplex( C ), DecideZero );[0X
    [4X    fi;[0X
    [4X    [0X
    [4X    IsZero( C );[0X
    [4X    [0X
    [4X    return C;[0X
    [4X    [0X
    [4Xend );[0X
  [4X------------------------------------------------------------------[0X
  
  This method performs side effects on its argument [3XC[0m and returns it.
  
  [4X---------------------------  Example  ----------------------------[0X
    [4Xgap> ZZ := HomalgRingOfIntegers( );;[0X
    [4Xgap> M := HomalgMatrix( "[ 2, 3, 4,   5, 6, 7 ]", 2, 3, ZZ );[0X
    [4X<A homalg internal 2 by 3 matrix>[0X
    [4Xgap> M := LeftPresentation( M );[0X
    [4X<A non-torsion left module presented by 2 relations for 3 generators>[0X
    [4Xgap> N := HomalgMatrix( "[ 2, 3, 4, 5,   6, 7, 8, 9 ]", 2, 4, ZZ );[0X
    [4X<A homalg internal 2 by 4 matrix>[0X
    [4Xgap> N := LeftPresentation( N );[0X
    [4X<A non-torsion left module presented by 2 relations for 4 generators>[0X
    [4Xgap> mat := HomalgMatrix( "[ \[0X
    [4X> 0, 3, 6, 9, \[0X
    [4X> 0, 2, 4, 6, \[0X
    [4X> 0, 3, 6, 9  \[0X
    [4X> ]", 3, 4, ZZ );[0X
    [4X<A homalg internal 3 by 4 matrix>[0X
    [4Xgap> phi := HomalgMap( mat, M, N );[0X
    [4X<A "homomorphism" of left modules>[0X
    [4Xgap> IsMorphism( phi );[0X
    [4Xtrue[0X
    [4Xgap> phi;[0X
    [4X<A homomorphism of left modules>[0X
    [4Xgap> C := HomalgComplex( phi );[0X
    [4X<A non-zero acyclic complex containing a single morphism of left modules at de\[0X
    [4Xgrees [ 0 .. 1 ]>[0X
    [4Xgap> Display( C );[0X
    [4X-------------------------[0X
    [4Xat homology degree: 1[0X
    [4X[ [  2,  3,  4 ],[0X
    [4X  [  5,  6,  7 ] ][0X
    [4X[0X
    [4XCokernel of the map[0X
    [4X[0X
    [4XZ^(1x2) --> Z^(1x3),[0X
    [4X[0X
    [4Xcurrently represented by the above matrix[0X
    [4X-------------------------[0X
    [4X[ [  0,  3,  6,  9 ],[0X
    [4X  [  0,  2,  4,  6 ],[0X
    [4X  [  0,  3,  6,  9 ] ][0X
    [4X[0X
    [4Xthe map is currently represented by the above 3 x 4 matrix[0X
    [4X------------v------------[0X
    [4Xat homology degree: 0[0X
    [4X[ [  2,  3,  4,  5 ],[0X
    [4X  [  6,  7,  8,  9 ] ][0X
    [4X[0X
    [4XCokernel of the map[0X
    [4X[0X
    [4XZ^(1x2) --> Z^(1x4),[0X
    [4X[0X
    [4Xcurrently represented by the above matrix[0X
    [4X-------------------------[0X
  [4X------------------------------------------------------------------[0X
  
  And now:
  
  [4X---------------------------  Example  ----------------------------[0X
    [4Xgap> ByASmallerPresentation( C );[0X
    [4X<A non-zero acyclic complex containing a single morphism of left modules at de\[0X
    [4Xgrees [ 0 .. 1 ]>[0X
    [4Xgap> Display( C );[0X
    [4X-------------------------[0X
    [4Xat homology degree: 1[0X
    [4XZ/< 3 > + Z^(1 x 1)[0X
    [4X-------------------------[0X
    [4X[ [  0,  0,  0 ],[0X
    [4X  [  2,  0,  0 ] ][0X
    [4X[0X
    [4Xthe map is currently represented by the above 2 x 3 matrix[0X
    [4X------------v------------[0X
    [4Xat homology degree: 0[0X
    [4XZ/< 4 > + Z^(1 x 2)[0X
    [4X-------------------------[0X
  [4X------------------------------------------------------------------[0X
  
