  
  [1X8 (Co-)Homology of simplicial complexes[0X
  
  Although [5Xsimpcomp[0m makes use of the [5XGAP[0m package ''homology'' [DHSW04] for its
  homology   calculations  whenever  possible  (due  to  efficiency  reasons),
  [5Xsimpcomp[0m  comes  with  an  own  (co-)homology  algorithm  as  well  as  some
  additional  homology  related functionality, which will be explained in this
  chapter.
  
  
  [1X8.1 Homology computation[0X
  
  Apart  from  calculating  boundaries  of simplices, boundary matrices or the
  simplicial  homology  of a given complex, [5Xsimpcomp[0m is also able to compute a
  basis of the homology groups.
  
  [1X8.1-1 SCBoundaryOperatorMatrix[0m
  
  [2X> SCBoundaryOperatorMatrix( [0X[3Xcomplex, k[0X[2X ) _____________________________[0Xmethod
  [6XReturns:[0X  a rectangular matrix upon success, [9Xfail[0m otherwise.
  
  Calculates  the  matrix of the boundary operator partial_[3Xk+1[0m of a simplicial
  complex  [3Xcomplex[0m.  Note  that  each  column  contains  the  boundaries  of a
  [3Xk[0m+1-simplex  as a list of oriented [3Xk[0m-simplices and that the matrix is stored
  as a list of row vectors (as usual in GAP).
  
  [4X---------------------------  Example  ----------------------------[0X
    [4X gap> c:=SCFromFacets([[1,2,3],[1,2,6],[1,3,5],[1,4,5],[1,4,6],\[0X
    [4X                       [2,3,4],[2,4,5],[2,5,6],[3,4,6],[3,5,6]]);;[0X
    [4X gap> mat:=SCBoundaryOperatorMatrix(c,1);[0X
    [4X [ [ 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ], [0X
    [4X   [ -1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0 ], [0X
    [4X   [ 0, -1, 0, 0, 0, -1, 0, 0, 0, 1, 1, 1, 0, 0, 0 ], [0X
    [4X   [ 0, 0, -1, 0, 0, 0, -1, 0, 0, -1, 0, 0, 1, 1, 0 ], [0X
    [4X   [ 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, -1, 0, -1, 0, 1 ], [0X
    [4X   [ 0, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, -1, 0, -1, -1 ] ][0X
    [4X [0X
  [4X------------------------------------------------------------------[0X
  
  [1X8.1-2 SCBoundarySimplex[0m
  
  [2X> SCBoundarySimplex( [0X[3Xsimplex, orientation[0X[2X ) ________________________[0Xfunction
  [6XReturns:[0X  a list upon success, [9Xfail[0m otherwise.
  
  Calculates  the  boundary of a given [3Xsimplex[0m. If the flag [3Xorientation[0m is set
  to  [9Xtrue[0m,  the function returns the boundary as a list of oriented simplices
  of  the  form [ ORIENTATION, SIMPLEX ], where ORIENTATION is either +1 or -1
  and  a  value of +1 means that SIMPLEX is positively oriented and a value of
  -1  that  SIMPLEX is negatively oriented. If [3Xorientation[0m is set to [9Xfalse[0m, an
  unoriented list of simplices is returned.
  
  [4X---------------------------  Example  ----------------------------[0X
    [4X gap> SCBoundarySimplex([1..5],true);[0X
    [4X [ [ -1, [ 2, 3, 4, 5 ] ], [ 1, [ 1, 3, 4, 5 ] ], [ -1, [ 1, 2, 4, 5 ] ], [0X
    [4X   [ 1, [ 1, 2, 3, 5 ] ], [ -1, [ 1, 2, 3, 4 ] ] ][0X
    [4X gap> SCBoundarySimplex([1..5],false);[0X
    [4X [ [ 2, 3, 4, 5 ], [ 1, 3, 4, 5 ], [ 1, 2, 4, 5 ], [ 1, 2, 3, 5 ], [0X
    [4X   [ 1, 2, 3, 4 ] ][0X
    [4X [0X
  [4X------------------------------------------------------------------[0X
  
  [1X8.1-3 SCHomologyBasis[0m
  
  [2X> SCHomologyBasis( [0X[3Xcomplex, k[0X[2X ) ______________________________________[0Xmethod
  [6XReturns:[0X  a list of pairs of the form [10X[ integer, list of linear combinations
            of simplices ][0m upon success, [9Xfail[0m otherwise.
  
  Calculates  a  set  of  basis  elements for the [3Xk[0m-dimensional homology group
  (with  integer coefficients) of a simplicial complex [3Xcomplex[0m. The entries of
  the  returned  list are of the form [ MODULUS, [ BASEELM1, BASEELM2, ...] ],
  where  the value MODULUS is 1 for the basis elements of the free part of the
  [3Xk[0m-th  homology group and q>= 2 for the basis elements of the q-torsion part.
  In  contrast  to  the  function [2XSCHomologyBasisAsSimplices[0m ([14X8.1-4[0m) the basis
  elements  are  stored  as  lists of coefficient-index pairs referring to the
  simplices of the complex, i.e. a basis element of the form [ [ lambda_1, i],
  [lambda_2,  j],  dots  ] dots encodes the linear combination of simplices of
  the           form           lambda_1*Delta_1+lambda_2*Delta_2          with
  Delta_1=[10XSCSkel(complex,k)[i][0m, Delta_2=[10XSCSkel(complex,k)[j][0m and so on.
  
  [4X---------------------------  Example  ----------------------------[0X
    [4X gap> SCLib.SearchByName("(S^2xS^1)#RP^3");[0X
    [4X [ [ 590, "(S^2xS^1)#RP^3" ] ][0X
    [4X gap> c:=SCLib.Load(last[1][1]);;[0X
    [4X gap> SCHomologyBasis(c,1);[0X
    [4X [ [ 1, [ [ 1, 12 ], [ -1, 7 ], [ 1, 1 ] ] ], [0X
    [4X   [ 2, [ [ 1, 68 ], [ -1, 69 ], [ -1, 71 ], [ 2, 72 ], [ -2, 73 ] ] ] ][0X
    [4X [0X
  [4X------------------------------------------------------------------[0X
  
  [1X8.1-4 SCHomologyBasisAsSimplices[0m
  
  [2X> SCHomologyBasisAsSimplices( [0X[3Xcomplex, k[0X[2X ) ___________________________[0Xmethod
  [6XReturns:[0X  a list of pairs of the form [10X[ integer, list of linear combinations
            of simplices ][0m upon success, [9Xfail[0m otherwise.
  
  Calculates  a  set  of  basis  elements for the [3Xk[0m-dimensional homology group
  (with  integer coefficients) of a simplicial complex [3Xcomplex[0m. The entries of
  the  returned  list are of the form [ MODULUS, [ BASEELM1, BASEELM2, ...] ],
  where  the value MODULUS is 1 for the basis elements of the free part of the
  [3Xk[0m-th  homology group and q>= 2 for the basis elements of the q-torsion part.
  In  contrast  to the function [2XSCHomologyBasis[0m ([14X8.1-3[0m) the basis elements are
  stored  as  lists  of coefficient-simplex pairs, i.e. a basis element of the
  form  [ [ lambda_1, Delta_1], [lambda_2, Delta_2], dots ] encodes the linear
  combination  of  simplices  of  the form lambda_1*Delta_1+lambda_2*Delta_2 +
  dots.
  
  [4X---------------------------  Example  ----------------------------[0X
    [4X gap> SCLib.SearchByName("(S^2xS^1)#RP^3");[0X
    [4X [ [ 590, "(S^2xS^1)#RP^3" ] ][0X
    [4X gap> c:=SCLib.Load(last[1][1]);;[0X
    [4X gap> SCHomologyBasisAsSimplices(c,1);[0X
    [4X [ [ 1, [ [ 1, [ 2, 8 ] ], [ -1, [ 1, 8 ] ], [ 1, [ 1, 2 ] ] ] ], [0X
    [4X   [ 2, [ [ 1, [ 11, 12 ] ], [ -1, [ 11, 13 ] ], [ -1, [ 12, 13 ] ], [0X
    [4X           [ 2, [ 12, 14 ] ], [ -2, [ 13, 14 ] ] ] ] ][0X
    [4X [0X
  [4X------------------------------------------------------------------[0X
  
  [1X8.1-5 SCHomologyInternal[0m
  
  [2X> SCHomologyInternal( [0X[3Xcomplex[0X[2X ) ____________________________________[0Xfunction
  [6XReturns:[0X  a  list  of pairs of the form [10X[ integer, list ][0m upon success, [9Xfail[0m
            otherwise.
  
  This   function  computes  the  reduced  simplicial  homology  with  integer
  coefficients   of   a   given   simplicial   complex  [3Xcomplex[0m  with  integer
  coefficients. It uses the algorithm described in [DKT08].
  
  The  output is a list of homology groups of the form [H_0,....,H_d], where d
  is  the dimension of [3Xcomplex[0m. The format of the homology groups H_i is given
  in  terms  of  their maximal cyclic subgroups, i.e. a homology group H_icong
  Z^f  +  Z  /  t_1  Z  x  dots x Z / t_n Z is returned in form of a list [ f,
  [t_1,...,t_n]  ],  where f is the (integer) free part of H_i and t_i denotes
  the  torsion  parts  of  H_i  ordered  in  weakly  incresing  size. See also
  [2XSCHomology[0m ([14X7.3-9[0m).
  
  [4X---------------------------  Example  ----------------------------[0X
    [4X gap> c:=SCFromFacets([[1,2,3],[1,2,6],[1,3,5],[1,4,5],[1,4,6],[0X
    [4X                       [2,3,4],[2,4,5],[2,5,6],[3,4,6],[3,5,6]]);;[0X
    [4X gap> SCHomologyInternal(c);[0X
    [4X [ [ 0, [  ] ], [ 0, [ 2 ] ], [ 0, [  ] ] ][0X
    [4X [0X
  [4X------------------------------------------------------------------[0X
  
  
  [1X8.2 Cohomology computation[0X
  
  [5Xsimpcomp[0m  can  also  compute  the cohomology groups of simplicial complexes,
  bases  of  these  cohomology groups, the cup product of two cocycles and the
  intersection form of (orientable) 4-manifolds.
  
  [1X8.2-1 SCCoboundaryOperatorMatrix[0m
  
  [2X> SCCoboundaryOperatorMatrix( [0X[3Xcomplex, k[0X[2X ) ___________________________[0Xmethod
  [6XReturns:[0X  a rectangular matrix upon success, [9Xfail[0m otherwise.
  
  Calculates  the  matrix  of  the  coboundary operator d^[3Xk+1[0m as a list of row
  vectors.
  
  [4X---------------------------  Example  ----------------------------[0X
    [4X gap> c:=SCFromFacets([[1,2,3],[1,2,6],[1,3,5],[1,4,5],[1,4,6],\[0X
    [4X                       [2,3,4],[2,4,5],[2,5,6],[3,4,6],[3,5,6]]);[0X
    [4X > [SimplicialComplex[0X
    [4X [0X
    [4X  Properties known: Dim, FacetsEx, Name, Vertices.[0X
    [4X [0X
    [4X  Name="unnamed complex 2"[0X
    [4X  Dim=2[0X
    [4X [0X
    [4X /SimplicialComplex][0X
    [4X gap> mat:=SCCoboundaryOperatorMatrix(c,1);[0X
    [4X [ [ -1, 1, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0 ], [0X
    [4X   [ -1, 0, 0, 0, 1, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0 ], [0X
    [4X   [ 0, -1, 0, 1, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0 ], [0X
    [4X   [ 0, 0, -1, 1, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0 ], [0X
    [4X   [ 0, 0, -1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0 ], [0X
    [4X   [ 0, 0, 0, 0, 0, -1, 1, 0, 0, -1, 0, 0, 0, 0, 0 ], [0X
    [4X   [ 0, 0, 0, 0, 0, 0, -1, 1, 0, 0, 0, 0, -1, 0, 0 ], [0X
    [4X   [ 0, 0, 0, 0, 0, 0, 0, -1, 1, 0, 0, 0, 0, 0, -1 ], [0X
    [4X   [ 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 1, 0, -1, 0 ], [0X
    [4X   [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 1, 0, 0, -1 ] ][0X
    [4X [0X
  [4X------------------------------------------------------------------[0X
  
  [1X8.2-2 SCCohomology[0m
  
  [2X> SCCohomology( [0X[3Xcomplex[0X[2X ) ____________________________________________[0Xmethod
  [6XReturns:[0X  a  list  of pairs of the form [10X[ integer, list ][0m upon success, [9Xfail[0m
            otherwise.
  
  This   function  computes  the  simplicial  cohomology  groups  of  a  given
  simplicial  complex [3Xcomplex[0m with integer coefficients. It uses the algorithm
  described in [DKT08].
  
  The  output is a list of cohomology groups of the form [H^0,....,H^d], where
  d  is  the  dimension of [3Xcomplex[0m. The format of the cohomology groups H^i is
  given  in  terms  of their maximal cyclic subgroups, i.e. a cohomology group
  H^icong  Z^f  + Z / t_1 Z x dots x Z / t_n Z is returned in form of a list [
  f,  [t_1,...,t_n]  ],  where  f  is  the  (integer) free part of H^i and t_i
  denotes the torsion parts of H^i ordered in weakly increasing size.
  
  [4X---------------------------  Example  ----------------------------[0X
    [4X gap> c:=SCFromFacets([[1,2,3],[1,2,6],[1,3,5],[1,4,5],[1,4,6],[0X
    [4X                       [2,3,4],[2,4,5],[2,5,6],[3,4,6],[3,5,6]]);[0X
    [4X > [SimplicialComplex[0X
    [4X [0X
    [4X  Properties known: Dim, FacetsEx, Name, Vertices.[0X
    [4X [0X
    [4X  Name="unnamed complex 4"[0X
    [4X  Dim=2[0X
    [4X [0X
    [4X /SimplicialComplex][0X
    [4X gap> SCCohomology(c);[0X
    [4X [ [ 1, [  ] ], [ 0, [  ] ], [ 0, [ 2 ] ] ][0X
    [4X [0X
  [4X------------------------------------------------------------------[0X
  
  [1X8.2-3 SCCohomologyBasis[0m
  
  [2X> SCCohomologyBasis( [0X[3Xcomplex, k[0X[2X ) ____________________________________[0Xmethod
  [6XReturns:[0X  a list of pairs of the form [10X[ integer, list of linear combinations
            of simplices ][0m upon success, [9Xfail[0m otherwise.
  
  Calculates  a  set  of basis elements for the [3Xk[0m-dimensional cohomology group
  (with  integer coefficients) of a simplicial complex [3Xcomplex[0m. The entries of
  the  returned  list are of the form [ MODULUS, [ BASEELM1, BASEELM2, ...] ],
  where  the value MODULUS is 1 for the basis elements of the free part of the
  [3Xk[0m-th  homology group and q>= 2 for the basis elements of the q-torsion part.
  In  contrast  to the function [2XSCCohomologyBasisAsSimplices[0m ([14X8.2-4[0m) the basis
  elements  are  stored  as  lists of coefficient-index pairs referring to the
  linear  forms  dual to the simplices in the k-th cochain complex of [3Xcomplex[0m,
  i.e.  a  basis  element  of the form [ [ lambda_1, i], [lambda_2, j], dots ]
  dots encodes the linear combination of simplices (or their dual linear forms
  in     the     corresponding     cochain     complex)     of     the    form
  lambda_1*Delta_1+lambda_2*Delta_2     with     Delta_1=[10XSCSkel(complex,k)[i][0m,
  Delta_2=[10XSCSkel(complex,k)[j][0m and so on.
  
  [4X---------------------------  Example  ----------------------------[0X
    [4X gap> SCLib.SearchByName("SU(3)/SO(3)");   [0X
    [4X [ [ 563, "SU(3)/SO(3) (VT)" ], [ 7276, "SU(3)/SO(3) (VT)" ], [0X
    [4X   [ 7418, "SU(3)/SO(3) (VT)" ], [ 7419, "SU(3)/SO(3) (VT)" ] ][0X
    [4X gap> c:=SCLib.Load(last[1][1]);;[0X
    [4X gap> SCCohomologyBasis(c,3); [0X
    [4X [ [ 2, [ [ -9, 259 ], [ 9, 262 ], [ 9, 263 ], [ -9, 270 ], [ 9, 271 ], [0X
    [4X           [ -9, 273 ], [ -9, 274 ], [ -18, 275 ], [ -9, 276 ], [ 9, 278 ], [0X
    [4X           [ -9, 279 ], [ -9, 280 ], [ 3, 283 ], [ -3, 285 ], [ 3, 289 ], [0X
    [4X           [ -3, 294 ], [ 3, 310 ], [ -3, 313 ], [ 3, 316 ], [ -1, 317 ], [0X
    [4X           [ -6, 318 ], [ 3, 319 ], [ -6, 320 ], [ 6, 321 ], [ 1, 322 ], [0X
    [4X           [ 3, 325 ], [ -1, 328 ], [ 6, 330 ], [ -2, 331 ], [ 12, 332 ], [0X
    [4X           [ 7, 333 ], [ -5, 334 ], [ 1, 345 ], [ 3, 355 ], [ -9, 357 ], [0X
    [4X           [ 9, 358 ], [ 1, 363 ], [ 12, 365 ], [ -9, 366 ], [ -3, 370 ], [0X
    [4X           [ -1, 371 ], [ -3, 372 ], [ 8, 373 ], [ -1, 374 ], [ 6, 375 ], [0X
    [4X           [ 9, 376 ], [ 3, 377 ], [ 1, 380 ], [ 3, 383 ], [ -8, 385 ], [0X
    [4X           [ -9, 386 ], [ -9, 388 ], [ -18, 404 ], [ 9, 410 ], [ -9, 425 ], [0X
    [4X           [ -18, 426 ], [ -9, 427 ], [ 9, 428 ], [ -9, 429 ], [ 3, 433 ], [0X
    [4X           [ -3, 435 ], [ -9, 437 ], [ 10, 442 ], [ 12, 445 ], [ 1, 447 ], [0X
    [4X           [ -19, 448 ], [ 2, 449 ], [ -1, 450 ], [ -9, 451 ], [ 3, 453 ], [0X
    [4X           [ 1, 455 ], [ 1, 457 ], [ -11, 458 ], [ -9, 459 ], [ 9, 461 ], [0X
    [4X           [ 9, 462 ], [ -9, 468 ], [ 9, 469 ], [ -18, 471 ], [ -9, 472 ], [0X
    [4X           [ 9, 474 ], [ -9, 475 ], [ 9, 488 ], [ 9, 495 ], [ -9, 500 ], [0X
    [4X           [ -3, 504 ], [ 9, 505 ], [ 9, 512 ], [ 9, 515 ], [ 6, 519 ], [0X
    [4X           [ 18, 521 ], [ -15, 523 ], [ 9, 524 ], [ -3, 525 ], [ 18, 527 ], [0X
    [4X           [ -18, 528 ], [ 6, 529 ], [ 6, 531 ], [ 12, 532 ] ] ] ][0X
    [4X [0X
  [4X------------------------------------------------------------------[0X
  
  [1X8.2-4 SCCohomologyBasisAsSimplices[0m
  
  [2X> SCCohomologyBasisAsSimplices( [0X[3Xcomplex, k[0X[2X ) _________________________[0Xmethod
  [6XReturns:[0X  a  list  of  pars  of  the  form  [10X[ integer, linear combination of
            simplices ][0m upon success, [9Xfail[0m otherwise.
  
  Calculates  a  set  of basis elements for the [3Xk[0m-dimensional cohomology group
  (with  integer coefficients) of a simplicial complex [3Xcomplex[0m. The entries of
  the  returned  list are of the form [ MODULUS, [ BASEELM1, BASEELM2, ...] ],
  where  the value MODULUS is 1 for the basis elements of the free part of the
  [3Xk[0m-th  homology group and q>= 2 for the basis elements of the q-torsion part.
  In contrast to the function [2XSCCohomologyBasis[0m ([14X8.2-3[0m) the basis elements are
  stored  as  lists of coefficient-simplex pairs referring to the linear forms
  dual  to  the simplices in the k-th cochain complex of [3Xcomplex[0m, i.e. a basis
  element of the form [ [ lambda_1, Delta_i], [lambda_2, Delta_j], dots ] dots
  encodes  the  linear combination of simplices (or their dual linear forms in
  the      corresponding      cochain      complex)      of      the      form
  lambda_1*Delta_1+lambda_2*Delta_2 + dots.
  
  [4X---------------------------  Example  ----------------------------[0X
    [4X gap> SCLib.SearchByName("SU(3)/SO(3)");   [0X
    [4X [ [ 563, "SU(3)/SO(3) (VT)" ], [ 7276, "SU(3)/SO(3) (VT)" ], [0X
    [4X   [ 7418, "SU(3)/SO(3) (VT)" ], [ 7419, "SU(3)/SO(3) (VT)" ] ][0X
    [4X gap> c:=SCLib.Load(last[1][1]);;[0X
    [4X gap> SCCohomologyBasisAsSimplices(c,3);[0X
    [4X [ [ 2, [0X
    [4X       [ [ -9, [ 2, 7, 8, 9 ] ], [ 9, [ 2, 7, 8, 12 ] ], [ 9, [ 2, 7, 8, 13 ] ][0X
    [4X             , [ -9, [ 2, 7, 11, 12 ] ], [ 9, [ 2, 7, 11, 13 ] ], [0X
    [4X           [ -9, [ 2, 8, 9, 10 ] ], [ -9, [ 2, 8, 9, 11 ] ], [0X
    [4X           [ -18, [ 2, 8, 9, 12 ] ], [ -9, [ 2, 8, 9, 13 ] ], [0X
    [4X           [ 9, [ 2, 8, 10, 12 ] ], [ -9, [ 2, 8, 10, 13 ] ], [0X
    [4X           [ -9, [ 2, 8, 11, 12 ] ], [ 3, [ 2, 9, 10, 12 ] ], [0X
    [4X           [ -3, [ 2, 9, 11, 12 ] ], [ 3, [ 3, 4, 5, 7 ] ], [0X
    [4X           [ -3, [ 3, 4, 5, 12 ] ], [ 3, [ 3, 4, 10, 12 ] ], [0X
    [4X           [ -3, [ 3, 5, 6, 7 ] ], [ 3, [ 3, 5, 6, 11 ] ], [0X
    [4X           [ -1, [ 3, 5, 6, 13 ] ], [ -6, [ 3, 5, 7, 8 ] ], [0X
    [4X           [ 3, [ 3, 5, 7, 10 ] ], [ -6, [ 3, 5, 7, 11 ] ], [0X
    [4X           [ 6, [ 3, 5, 7, 12 ] ], [ 1, [ 3, 5, 7, 13 ] ], [0X
    [4X           [ 3, [ 3, 5, 8, 12 ] ], [ -1, [ 3, 5, 9, 13 ] ], [0X
    [4X           [ 6, [ 3, 5, 10, 12 ] ], [ -2, [ 3, 5, 10, 13 ] ], [0X
    [4X           [ 12, [ 3, 5, 11, 12 ] ], [ 7, [ 3, 5, 11, 13 ] ], [0X
    [4X           [ -5, [ 3, 5, 12, 13 ] ], [ 1, [ 3, 6, 9, 13 ] ], [0X
    [4X           [ 3, [ 3, 7, 10, 12 ] ], [ -9, [ 3, 7, 11, 12 ] ], [0X
    [4X           [ 9, [ 3, 7, 11, 13 ] ], [ 1, [ 3, 8, 9, 13 ] ], [0X
    [4X           [ 12, [ 3, 8, 10, 12 ] ], [ -9, [ 3, 8, 10, 13 ] ], [0X
    [4X           [ -3, [ 3, 9, 10, 12 ] ], [ -1, [ 3, 9, 10, 13 ] ], [0X
    [4X           [ -3, [ 3, 9, 11, 12 ] ], [ 8, [ 3, 9, 11, 13 ] ], [0X
    [4X           [ -1, [ 3, 9, 12, 13 ] ], [ 6, [ 3, 10, 11, 12 ] ], [0X
    [4X           [ 9, [ 3, 10, 11, 13 ] ], [ 3, [ 3, 10, 12, 13 ] ], [0X
    [4X           [ 1, [ 4, 5, 6, 8 ] ], [ 3, [ 4, 5, 6, 11 ] ], [0X
    [4X           [ -8, [ 4, 5, 6, 13 ] ], [ -9, [ 4, 5, 7, 8 ] ], [0X
    [4X           [ -9, [ 4, 5, 7, 11 ] ], [ -18, [ 4, 6, 8, 9 ] ], [0X
    [4X           [ 9, [ 4, 6, 9, 13 ] ], [ -9, [ 4, 8, 9, 10 ] ], [0X
    [4X           [ -18, [ 4, 8, 9, 12 ] ], [ -9, [ 4, 8, 9, 13 ] ], [0X
    [4X           [ 9, [ 4, 8, 10, 12 ] ], [ -9, [ 4, 8, 10, 13 ] ], [0X
    [4X           [ 3, [ 4, 9, 10, 12 ] ], [ -3, [ 4, 9, 11, 12 ] ], [0X
    [4X           [ -9, [ 4, 9, 12, 13 ] ], [ 10, [ 5, 6, 7, 8 ] ], [0X
    [4X           [ 12, [ 5, 6, 7, 11 ] ], [ 1, [ 5, 6, 7, 13 ] ], [0X
    [4X           [ -19, [ 5, 6, 8, 9 ] ], [ 2, [ 5, 6, 8, 11 ] ], [0X
    [4X           [ -1, [ 5, 6, 8, 12 ] ], [ -9, [ 5, 6, 8, 13 ] ], [0X
    [4X           [ 3, [ 5, 6, 9, 11 ] ], [ 1, [ 5, 6, 9, 13 ] ], [0X
    [4X           [ 1, [ 5, 6, 10, 13 ] ], [ -11, [ 5, 6, 11, 13 ] ], [0X
    [4X           [ -9, [ 5, 7, 8, 9 ] ], [ 9, [ 5, 7, 8, 12 ] ], [0X
    [4X           [ 9, [ 5, 7, 8, 13 ] ], [ -9, [ 5, 7, 11, 12 ] ], [0X
    [4X           [ 9, [ 5, 7, 11, 13 ] ], [ -18, [ 5, 8, 9, 12 ] ], [0X
    [4X           [ -9, [ 5, 8, 9, 13 ] ], [ 9, [ 5, 8, 10, 12 ] ], [0X
    [4X           [ -9, [ 5, 8, 11, 12 ] ], [ 9, [ 6, 7, 8, 13 ] ], [0X
    [4X           [ 9, [ 6, 7, 11, 13 ] ], [ -9, [ 6, 8, 10, 13 ] ], [0X
    [4X           [ -3, [ 6, 9, 11, 12 ] ], [ 9, [ 6, 9, 11, 13 ] ], [0X
    [4X           [ 9, [ 7, 8, 9, 13 ] ], [ 9, [ 7, 8, 11, 12 ] ], [0X
    [4X           [ 6, [ 7, 9, 11, 12 ] ], [ 18, [ 7, 11, 12, 13 ] ], [0X
    [4X           [ -15, [ 8, 9, 10, 12 ] ], [ 9, [ 8, 9, 10, 13 ] ], [0X
    [4X           [ -3, [ 8, 9, 11, 12 ] ], [ 18, [ 8, 10, 11, 12 ] ], [0X
    [4X           [ -18, [ 8, 10, 12, 13 ] ], [ 6, [ 9, 10, 11, 12 ] ], [0X
    [4X           [ 6, [ 9, 10, 12, 13 ] ], [ 12, [ 9, 11, 12, 13 ] ] ] ] ][0X
    [4X [0X
  [4X------------------------------------------------------------------[0X
  
  [1X8.2-5 SCCupProduct[0m
  
  [2X> SCCupProduct( [0X[3Xcomplex, cocycle1, cocycle2[0X[2X ) ______________________[0Xfunction
  [6XReturns:[0X  a list of pairs of the form [10X[ ORIENTATION, SIMPLEX ][0m upon success,
            [9Xfail[0m otherwise.
  
  The  cup  product is a method of adjoining two cocycles of degree p and q to
  form a composite cocycle of degree p + q. It endows the cohomology groups of
  a simplicial complex with the structure of a ring.
  
  The  construction  of  the cup product starts with a product of cochains: if
  [3Xcocycle1[0m  is a p-cochain and [3Xcocylce2[0m is a q-cochain of a simplicial complex
  [3Xcomplex[0m (given as list of oriented p- (q-)simplices), then
  
  [3Xcocycle1[0m  smile  [3Xcocycle2[0m(sigma)  =[3Xcocycle1[0m(sigma  circ  iota_0,1,  ... p) *
  [3Xcocycle2[0m(sigma circ iota_p, p+1 ,..., p + q)
  
  where  sigma  is  a p + q-simplex and iota_S, S subset {0,1,...,p+q } is the
  canonical  embedding  of  the simplex spanned by S into the (p + q)-standard
  simplex.
  
  sigma  circ  iota_0,1,  ...,  p is called the p-th front face and sigma circ
  iota_p, p+1, ..., p + q is the q-th back face of sigma, respectively.
  
  Note  that  this  function  only  computes  the cup product in the case that
  [3Xcomplex[0m  is an orientable weak pseudomanifold of dimension 2k and p = q = k.
  Furthermore,  [3Xcomplex[0m  must be given in standard labeling, with sorted facet
  list and [3Xcocylce1[0m and [3Xcocylce2[0m must be given in simplex notation and labeled
  accordingly. Note that the latter condition is usually fulfilled in case the
  cocycles were computed using [2XSCCohomologyBasisAsSimplices[0m ([14X8.2-4[0m).
  
  [4X---------------------------  Example  ----------------------------[0X
    [4X gap> SCLib.SearchByName("K3");[0X
    [4X [ [ 7494, "K3 surface" ] ][0X
    [4X gap> c:=SCLib.Load(last[1][1]);;                                     [0X
    [4X gap> basis:=SCCohomologyBasisAsSimplices(c,2);;[0X
    [4X gap> SCCupProduct(c,basis[1][2],basis[1][2]);[0X
    [4X [ [ 1, [ 1, 2, 4, 7, 11 ] ], [ 1, [ 2, 3, 4, 5, 9 ] ] ][0X
    [4X gap> SCCupProduct(c,basis[1][2],basis[2][2]);[0X
    [4X [ [ -1, [ 1, 2, 4, 7, 11 ] ], [ -1, [ 1, 2, 4, 7, 15 ] ], [0X
    [4X   [ -1, [ 2, 3, 4, 5, 9 ] ] ][0X
    [4X [0X
  [4X------------------------------------------------------------------[0X
  
  [1X8.2-6 SCIntersectionForm[0m
  
  [2X> SCIntersectionForm( [0X[3Xcomplex[0X[2X ) ______________________________________[0Xmethod
  [6XReturns:[0X  a square matrix of integer values upon success, [9Xfail[0m otherwise.
  
  For  2k-dimensional orientable manifolds M the cup product (see [2XSCCupProduct[0m
  ([14X8.2-5[0m)) defines a bilinear form
  
  H^k ( M ) xH^k ( M ) ->H^2k (M), (a,b) -> a cup b
  
  called  the  intersection  form of M. This function returns the intersection
  form  of an orientable combinatorial 2k-manifold [3Xcomplex[0m in form of a matrix
  [10Xmat[0m   with   respect   to   the   basis   of   H^k  ([3Xcomplex[0mM)  computed  by
  [2XSCCohomologyBasisAsSimplices[0m  ([14X8.2-4[0m). The matrix entry [10Xmat[i][j][0m equals the
  intersection  number  of the [10Xi[0m-th base element with the [10Xj[0m-th base element of
  H^k ([3Xcomplex[0mM).
  
  [4X---------------------------  Example  ----------------------------[0X
    [4X gap> SCLib.SearchByName("CP^2");       [0X
    [4X [ [ 16, "CP^2 (VT)" ], [ 99, "CP^2#-CP^2" ], [ 100, "CP^2#CP^2" ], [0X
    [4X   [ 400, "CP^2#(S^2xS^2)" ], [ 2486, "Gaifullin CP^2" ], [0X
    [4X   [ 4401, "(S^3~S^1)#(CP^2)^{#5} (VT)" ] ][0X
    [4X gap> c:=SCLib.Load(last[1][1]);; [0X
    [4X gap> c1:=SCConnectedSum(c,c);;[0X
    [4X gap> c2:=SCConnectedSumMinus(c,c);;[0X
    [4X gap> q1:=SCIntersectionForm(c1);;[0X
    [4X gap> q2:=SCIntersectionForm(c2);;[0X
    [4X gap> PrintArray(q1);[0X
    [4X [ [  1,  0 ],[0X
    [4X   [  0,  1 ] ][0X
    [4X gap> PrintArray(q2);[0X
    [4X [ [   1,   0 ],[0X
    [4X   [   0,  -1 ] ][0X
    [4X [0X
  [4X------------------------------------------------------------------[0X
  
  [1X8.2-7 SCIntersectionFormParity[0m
  
  [2X> SCIntersectionFormParity( [0X[3Xcomplex[0X[2X ) ________________________________[0Xmethod
  [6XReturns:[0X  [10X0[0m or [10X1[0m upon success, [9Xfail[0m otherwise.
  
  Computes  the  parity  of  the intersection form of a combinatorial manifold
  [3Xcomplex[0m  (see  [2XSCIntersectionForm[0m  ([14X8.2-6[0m)). If the intersection for is even
  (i.  e. all diagonal entries are even numbers) [10X0[0m is returned, otherwise [10X1[0m is
  returned.
  
  [4X---------------------------  Example  ----------------------------[0X
    [4X gap> SCLib.SearchByName("S^2xS^2");[0X
    [4X [ [ 59, "S^2xS^2" ], [ 134, "S^2xS^2 (VT)" ], [ 135, "S^2xS^2 (VT)" ], [0X
    [4X   [ 136, "S^2xS^2 (VT)" ], [ 137, "(S^2xS^2)#(S^2xS^2)" ], [0X
    [4X   [ 360, "(S^2xS^2)#(S^2xS^2) (VT)" ], [ 361, "(S^2xS^2)#(S^2xS^2) (VT)" ], [0X
    [4X   [ 400, "CP^2#(S^2xS^2)" ] ][0X
    [4X gap> c:=SCLib.Load(last[1][1]);;    [0X
    [4X gap> SCIntersectionFormParity(c);[0X
    [4X 0[0X
    [4X gap> SCLib.SearchByName("CP^2");       [0X
    [4X [ [ 16, "CP^2 (VT)" ], [ 99, "CP^2#-CP^2" ], [ 100, "CP^2#CP^2" ], [0X
    [4X   [ 400, "CP^2#(S^2xS^2)" ], [ 2486, "Gaifullin CP^2" ], [0X
    [4X   [ 4401, "(S^3~S^1)#(CP^2)^{#5} (VT)" ] ][0X
    [4X gap> c:=SCLib.Load(last[1][1]);; [0X
    [4X gap> SCIntersectionFormParity(c);[0X
    [4X 1[0X
    [4X [0X
  [4X------------------------------------------------------------------[0X
  
  [1X8.2-8 SCIntersectionFormDimensionality[0m
  
  [2X> SCIntersectionFormDimensionality( [0X[3Xcomplex[0X[2X ) ________________________[0Xmethod
  [6XReturns:[0X  an integer upon success, [9Xfail[0m otherwise.
  
  Returns  the  dimensionality  of  the  intersection  form of a combinatorial
  manifold  [3Xcomplex[0m,  i.  e. the length of a minimal generating set of H^k (M)
  (where  2k  is the dimension of [3Xcomplex[0m). See [2XSCIntersectionForm[0m ([14X8.2-6[0m) for
  further details.
  
  [4X---------------------------  Example  ----------------------------[0X
    [4X gap> SCLib.SearchByName("CP^2");       [0X
    [4X [ [ 16, "CP^2 (VT)" ], [ 99, "CP^2#-CP^2" ], [ 100, "CP^2#CP^2" ], [0X
    [4X   [ 400, "CP^2#(S^2xS^2)" ], [ 2486, "Gaifullin CP^2" ], [0X
    [4X   [ 4401, "(S^3~S^1)#(CP^2)^{#5} (VT)" ] ][0X
    [4X gap> c:=SCLib.Load(last[1][1]);; [0X
    [4X gap> SCIntersectionFormParity(c);[0X
    [4X 1[0X
    [4X gap> SCCohomology(c);[0X
    [4X [ [ 1, [  ] ], [ 0, [  ] ], [ 1, [  ] ], [ 0, [  ] ], [ 1, [  ] ] ][0X
    [4X gap> SCIntersectionFormDimensionality(c);[0X
    [4X 1[0X
    [4X gap> d:=SCConnectedProduct(c,10);;[0X
    [4X gap> SCIntersectionFormDimensionality(d);[0X
    [4X 10[0X
    [4X [0X
  [4X------------------------------------------------------------------[0X
  
  [1X8.2-9 SCIntersectionFormSignature[0m
  
  [2X> SCIntersectionFormSignature( [0X[3Xcomplex[0X[2X ) _____________________________[0Xmethod
  [6XReturns:[0X  a triple of integers upon success, [9Xfail[0m otherwise.
  
  Computes  the  dimensionality (see [2XSCIntersectionFormDimensionality[0m ([14X8.2-8[0m))
  and  the  signature  of  the  intersection  form of a combinatorial manifold
  [3Xcomplex[0m as a 3-tuple that contains the dimensionality in the first entry and
  the number of positive / negative eigenvalues in the second and third entry.
  See [2XSCIntersectionForm[0m ([14X8.2-6[0m) for further details.
  
  Internally  calls the [5XGAP[0m-functions [10XMatrix_CharacteristicPolynomialSameField[0m
  and  [10XCoefficientsOfLaurentPolynomial[0m  to  compute  the  number of positive /
  negative eigenvalues of the intersection form.
  
  [4X---------------------------  Example  ----------------------------[0X
    [4X gap> SCLib.SearchByName("CP^2");       [0X
    [4X [ [ 16, "CP^2 (VT)" ], [ 99, "CP^2#-CP^2" ], [ 100, "CP^2#CP^2" ], [0X
    [4X   [ 400, "CP^2#(S^2xS^2)" ], [ 2486, "Gaifullin CP^2" ], [0X
    [4X   [ 4401, "(S^3~S^1)#(CP^2)^{#5} (VT)" ] ][0X
    [4X gap> c:=SCLib.Load(last[1][1]);;[0X
    [4X gap> SCIntersectionFormParity(c);[0X
    [4X 1[0X
    [4X gap> SCCohomology(c);[0X
    [4X [ [ 1, [  ] ], [ 0, [  ] ], [ 1, [  ] ], [ 0, [  ] ], [ 1, [  ] ] ][0X
    [4X gap> SCIntersectionFormSignature(c);[0X
    [4X [ 1, 0, 1 ][0X
    [4X gap> d:=SCConnectedSum(c,c);                           [0X
    [4X [SimplicialComplex[0X
    [4X [0X
    [4X  Properties known: Dim, FacetsEx, Name, Vertices.[0X
    [4X [0X
    [4X  Name="CP^2 (VT)#+-CP^2 (VT)"[0X
    [4X  Dim=4[0X
    [4X [0X
    [4X /SimplicialComplex][0X
    [4X gap> SCIntersectionFormSignature(d);[0X
    [4X [ 2, 1, 1 ][0X
    [4X gap> d:=SCConnectedSumMinus(c,c);;[0X
    [4X gap> SCIntersectionFormSignature(d);[0X
    [4X [ 2, 0, 2 ][0X
    [4X [0X
  [4X------------------------------------------------------------------[0X
  
