  
  [1X1 [33X[0;0YSimplicial complexes & CW complexes[133X[101X
  
  
  [1X1.1 [33X[0;0YThe Klein bottle as a simplicial complex[133X[101X
  
  [33X[0;0YThe  following example constructs the Klein bottle as a simplicial complex [22XK[122X
  on  [22X9[122X  vertices,  and  then constructs the cellular chain complex [22XC_∗=C_∗(K)[122X
  from  which  the integral homology groups [22XH_1(K, Z)= Z_2⊕ Z[122X, [22XH_2(K, Z)=0[122X are
  computed. The chain complex [22XD_∗=C_∗ ⊗_ Z Z_2[122X is also constructed and used to
  compute  the  mod-[22X2[122X homology vector spaces [22XH_1(K, Z_2)= Z_2⊕ Z_2[122X, [22XH_2(K, Z)=
  Z_2[122X.  Finally,  a presentation [22Xπ_1(K) = ⟨ x,y : yxy^-1x⟩[122X is computed for the
  fundamental group of [22XK[122X.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27X2simplices:=[127X[104X
    [4X[25X>[125X [27X[[1,2,5], [2,5,8], [2,3,8], [3,8,9], [1,3,9], [1,4,9],[127X[104X
    [4X[25X>[125X [27X [4,5,8], [4,6,8], [6,8,9], [6,7,9], [4,7,9], [4,5,7],[127X[104X
    [4X[25X>[125X [27X [1,4,6], [1,2,6], [2,6,7], [2,3,7], [3,5,7], [1,3,5]];;[127X[104X
    [4X[25Xgap>[125X [27XK:=SimplicialComplex(2simplices);[127X[104X
    [4X[28XSimplicial complex of dimension 2.[128X[104X
    [4X[28X[128X[104X
    [4X[25Xgap>[125X [27XC:=ChainComplex(K);[127X[104X
    [4X[28XChain complex of length 2 in characteristic 0 .[128X[104X
    [4X[28X[128X[104X
    [4X[25Xgap>[125X [27XHomology(C,1);[127X[104X
    [4X[28X[ 2, 0 ][128X[104X
    [4X[25Xgap>[125X [27XHomology(C,2);[127X[104X
    [4X[28X[  ][128X[104X
    [4X[28X[128X[104X
    [4X[25Xgap>[125X [27XD:=TensorWithIntegersModP(C,2);[127X[104X
    [4X[28XChain complex of length 2 in characteristic 2 .[128X[104X
    [4X[28X[128X[104X
    [4X[25Xgap>[125X [27XHomology(D,1);[127X[104X
    [4X[28X2[128X[104X
    [4X[25Xgap>[125X [27XHomology(D,2);[127X[104X
    [4X[28X1[128X[104X
    [4X[28X[128X[104X
    [4X[25Xgap>[125X [27XG:=FundamentalGroup(K);[127X[104X
    [4X[28X<fp group of size infinity on the generators [ f1, f2 ]>[128X[104X
    [4X[25Xgap>[125X [27XRelatorsOfFpGroup(G);[127X[104X
    [4X[28X[ f2*f1*f2^-1*f1 ][128X[104X
    [4X[28X[128X[104X
  [4X[32X[104X
  
  
  [1X1.2 [33X[0;0YOther simplicial surfaces[133X[101X
  
  [33X[0;0YThe  following  example  constructs  the  real projective plane [22XP[122X, the Klein
  bottle  [22XK[122X and the torus [22XT[122X as simplicial complexes, using the surface genus [22Xg[122X
  as  input  in  the oriented case and [22X-g[122X as input in the unoriented cases. It
  then confirms that the connected sums [22XM=K#P[122X and [22XN=T#P[122X have the same integral
  homology.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XP:=ClosedSurface(-1);[127X[104X
    [4X[28XSimplicial complex of dimension 2.[128X[104X
    [4X[28X[128X[104X
    [4X[25Xgap>[125X [27XK:=ClosedSurface(-2);[127X[104X
    [4X[28XSimplicial complex of dimension 2.[128X[104X
    [4X[28X[128X[104X
    [4X[25Xgap>[125X [27XT:=ClosedSurface(1);[127X[104X
    [4X[28XSimplicial complex of dimension 2.[128X[104X
    [4X[28X[128X[104X
    [4X[25Xgap>[125X [27XM:=ConnectedSum(K,P);[127X[104X
    [4X[28XSimplicial complex of dimension 2.[128X[104X
    [4X[28X[128X[104X
    [4X[25Xgap>[125X [27XN:=ConnectedSum(T,P);[127X[104X
    [4X[28XSimplicial complex of dimension 2.[128X[104X
    [4X[28X[128X[104X
    [4X[25Xgap>[125X [27XHomology(M,0);[127X[104X
    [4X[28X[ 0 ][128X[104X
    [4X[25Xgap>[125X [27XHomology(N,0);[127X[104X
    [4X[28X[ 0 ][128X[104X
    [4X[25Xgap>[125X [27XHomology(M,1);[127X[104X
    [4X[28X[ 2, 0, 0 ][128X[104X
    [4X[25Xgap>[125X [27XHomology(N,1);[127X[104X
    [4X[28X[ 2, 0, 0 ][128X[104X
    [4X[25Xgap>[125X [27XHomology(M,2);[127X[104X
    [4X[28X[  ][128X[104X
    [4X[25Xgap>[125X [27XHomology(N,2);[127X[104X
    [4X[28X[  ][128X[104X
    [4X[28X[128X[104X
  [4X[32X[104X
  
  
  [1X1.3 [33X[0;0YThe Quillen complex[133X[101X
  
  [33X[0;0YGiven a group [22XG[122X one can consider the partially ordered set [22Xcal A_p(G)[122X of all
  non-trivial elementary abelian [22Xp[122X-subgroups of [22XG[122X, the partial order being set
  inclusion.  The  order  complex [22X∆cal A_p(G)[122X is a simplicial complex which is
  called the [13XQuillen complex [113X.[133X
  
  [33X[0;0YThe  following  example constructs the Quillen complex [22X∆cal A_2(S_7)[122X for the
  symmetric  group of degree [22X7[122X and [22Xp=2[122X. This simplicial complex involves [22X11291[122X
  simplices, of which [22X4410[122X are [22X2[122X-simplices..[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XK:=QuillenComplex(SymmetricGroup(7),2);[127X[104X
    [4X[28XSimplicial complex of dimension 2.[128X[104X
    [4X[28X[128X[104X
    [4X[25Xgap>[125X [27XSize(K);[127X[104X
    [4X[28X11291[128X[104X
    [4X[28X[128X[104X
    [4X[25Xgap>[125X [27XK!.nrSimplices(2);[127X[104X
    [4X[28X4410[128X[104X
    [4X[28X[128X[104X
  [4X[32X[104X
  
  
  [1X1.4 [33X[0;0YThe Quillen complex as a reduced CW-complex[133X[101X
  
  [33X[0;0YAny  simplicial complex [22XK[122X can be regarded as a regular CW complex. Different
  datatypes  are used in [12XHAP[112X for these two notions. The following continuation
  of  the  above  Quillen  complex  example  constructs a regular CW complex [22XY[122X
  isomorphic  to  (i.e.  with  the  same  face lattice as) [22XK=∆cal A_2(S_7)[122X. An
  advantage  to  working  in  the  category  of CW complexes is that it may be
  possible  to  find  a  CW  complex [22XX[122X homotopy equivalent to [22XY[122X but with fewer
  cells  than  [22XY[122X.  The cellular chain complex [22XC_∗(X)[122X of such a CW complex [22XX[122X is
  computed  by  the  following commands. From the number of free generators of
  [22XC_∗(X)[122X,  which  correspond  to the cells of [22XX[122X, we see that there is a single
  [22X0[122X-cell  and  [22X160[122X  [22X2[122X-cells.  Thus the Quillen complex $$\Delta{\cal A}_2(S_7)
  \simeq \bigvee_{1\le i\le 160} S^2$$ has the homotopy type of a wedge of [22X160[122X
  [22X2[122X-spheres.  This  homotopy  equivalence is given in [Kso00, (15.1)] where it
  was obtained by purely theoretical methods.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XY:=RegularCWComplex(K);[127X[104X
    [4X[28XRegular CW-complex of dimension 2[128X[104X
    [4X[28X[128X[104X
    [4X[25Xgap>[125X [27XC:=ChainComplex(Y);[127X[104X
    [4X[28XChain complex of length 2 in characteristic 0 . [128X[104X
    [4X[28X[128X[104X
    [4X[25Xgap>[125X [27XC!.dimension(0);[127X[104X
    [4X[28X1[128X[104X
    [4X[25Xgap>[125X [27XC!.dimension(1);[127X[104X
    [4X[28X0[128X[104X
    [4X[25Xgap>[125X [27XC!.dimension(2);[127X[104X
    [4X[28X160[128X[104X
    [4X[28X[128X[104X
  [4X[32X[104X
  
  
  [1X1.5 [33X[0;0YSimple homotopy equivalences[133X[101X
  
  [33X[0;0YFor  any regular CW complex [22XY[122X one can look for a sequence of simple homotopy
  collapses  [22XY↘  Y_1  ↘  Y_2  ↘  ...  ↘  Y_N=X[122X with [22XX[122X a smaller, and typically
  non-regular,  CW complex. Such a sequence of collapses can be recorded using
  what  is  now  known  as a [13Xdiscrete vector field[113X on [22XY[122X. The sequence can, for
  example,  be  used  to produce a chain homotopy equivalence [22Xf: C_∗ Y → C_∗ X[122X
  and   its   chain   homotopy  inverse  [22Xg:  C_∗  X  →  C_∗  Y[122X.  The  function
  [10XChainComplex(Y)[110X  returns  the  cellular  chain  complex  [22XC_∗(X)[122X,  wheras the
  function [10XChainComplexOfRegularCWComplex(Y)[110X returns the chain complex [22XC_∗(Y)[122X.[133X
  
  [33X[0;0YFor the above Quillen complex [22XY=∆cal A_2(S_7)[122X the following commands produce
  the  chain  homotopy  equivalence [22Xf: C_∗ Y → C_∗ X[122X and [22Xg: C_∗ X → C_∗ Y[122X. The
  number  of  generators  of  [22XC_∗  Y[122X  equals  the number of cells of [22XY[122X in each
  degree, and this number is listed for each degree.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XK:=QuillenComplex(SymmetricGroup(7),2);;[127X[104X
    [4X[25Xgap>[125X [27XY:=RegularCWComplex(K);;[127X[104X
    [4X[25Xgap>[125X [27XCY:=ChainComplexOfRegularCWComplex(Y);[127X[104X
    [4X[28XChain complex of length 2 in characteristic 0 . [128X[104X
    [4X[28X[128X[104X
    [4X[25Xgap>[125X [27XCX:=ChainComplex(Y);[127X[104X
    [4X[28XChain complex of length 2 in characteristic 0 . [128X[104X
    [4X[28X[128X[104X
    [4X[25Xgap>[125X [27Xequiv:=ChainComplexEquivalenceOfRegularCWComplex(Y);;[127X[104X
    [4X[25Xgap>[125X [27Xf:=equiv[1];[127X[104X
    [4X[28XChain Map between complexes of length 2 . [128X[104X
    [4X[28X[128X[104X
    [4X[25Xgap>[125X [27Xg:=equiv[2];[127X[104X
    [4X[28XChain Map between complexes of length 2 .[128X[104X
    [4X[28X[128X[104X
    [4X[28X[128X[104X
    [4X[25Xgap>[125X [27XCY!.dimension(0);[127X[104X
    [4X[28X1316[128X[104X
    [4X[25Xgap>[125X [27XCY!.dimension(1);[127X[104X
    [4X[28X5565[128X[104X
    [4X[25Xgap>[125X [27XCY!.dimension(2);[127X[104X
    [4X[28X4410[128X[104X
    [4X[28X[128X[104X
  [4X[32X[104X
  
  
  [1X1.6 [33X[0;0YCellular simplifications preserving homeomorphism type[133X[101X
  
  [33X[0;0YFor some purposes one might need to simplify the cell structure on a regular
  CW-complex [22XY[122X so as to obtained a homeomorphic CW-complex [22XW[122X with fewer cells.[133X
  
  [33X[0;0YThe   following   commands   load   a  [22X4[122X-dimensional  simplicial  complex  [22XY[122X
  representing  the K3 complex surface. Its simplicial structure is taken from
  [SK11]  and  involves  [22X1704[122X  cells  of various dimensions. The commands then
  convert  the cell structure into that of a homeomorphic regular CW-complex [22XW[122X
  involving [22X774[122X cells.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XY:=RegularCWComplex(SimplicialK3Surface());[127X[104X
    [4X[28XRegular CW-complex of dimension 4[128X[104X
    [4X[28X[128X[104X
    [4X[25Xgap>[125X [27XSize(Y);[127X[104X
    [4X[28X1704[128X[104X
    [4X[25Xgap>[125X [27XW:=SimplifiedComplex(Y);[127X[104X
    [4X[28XRegular CW-complex of dimension 4[128X[104X
    [4X[28X[128X[104X
    [4X[25Xgap>[125X [27XSize(W);[127X[104X
    [4X[28X774[128X[104X
    [4X[28X[128X[104X
  [4X[32X[104X
  
  
  [1X1.7 [33X[0;0YConstructing a CW-structure on a knot complement[133X[101X
  
  [33X[0;0YThe following commands construct the complement [22XM=S^3∖ K[122X of the trefoil knot
  [22XK[122X.  This  complement is returned as a [22X3[122X-manifold [22XM[122X with regular CW-structure
  involving four [22X3[122X-cells.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27Xarc:=ArcPresentation(PureCubicalKnot(3,1));[127X[104X
    [4X[28X[ [ 2, 5 ], [ 1, 3 ], [ 2, 4 ], [ 3, 5 ], [ 1, 4 ] ][128X[104X
    [4X[25Xgap>[125X [27XS:=SphericalKnotComplement(arc);[127X[104X
    [4X[28XRegular CW-complex of dimension 3[128X[104X
    [4X[28X[128X[104X
    [4X[25Xgap>[125X [27XS!.nrCells(3);[127X[104X
    [4X[28X4[128X[104X
    [4X[28X[128X[104X
  [4X[32X[104X
  
  [33X[0;0YThe following additional commands then show that [22XM[122X is homotopy equivalent to
  a  reduced CW-complex [22XY[122X of dimension [22X2[122X involving one [22X0[122X-cell, two [22X1[122X-cells and
  one [22X2[122X-cell. The fundamental group of [22XY[122X is computed and used to calculate the
  Alexander polynomial of the trefoil knot.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XY:=ContractedComplex(S);[127X[104X
    [4X[28XRegular CW-complex of dimension 2[128X[104X
    [4X[28X[128X[104X
    [4X[25Xgap>[125X [27XCriticalCells(Y);[127X[104X
    [4X[28X[ [ 2, 1 ], [ 1, 9 ], [ 1, 11 ], [ 0, 22 ] ][128X[104X
    [4X[25Xgap>[125X [27XG:=FundamentalGroup(Y);;[127X[104X
    [4X[25Xgap>[125X [27XAlexanderPolynomial(G);[127X[104X
    [4X[28Xx_1^2-x_1+1[128X[104X
    [4X[28X[128X[104X
  [4X[32X[104X
  
  
  [1X1.8 [33X[0;0YConstructing a regular CW-complex from its face lattice[133X[101X
  
  [33X[0;0YThe  following  example  begins  by  creating a [22X2[122X-dimensional annulus [22XA[122X as a
  regular  CW-complex,  and  testing that it has the correct integral homology
  [22XH_0(A, Z)= Z[122X, [22XH_1(A, Z)= Z[122X, [22XH_2(A, Z)=0[122X.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XFL:=[];; #The face lattice[127X[104X
    [4X[25Xgap>[125X [27XFL[1]:=[[1,0],[1,0],[1,0],[1,0]];;[127X[104X
    [4X[25Xgap>[125X [27XFL[2]:=[[2,1,2],[2,3,4],[2,1,4],[2,2,3],[2,1,4],[2,2,3]];;[127X[104X
    [4X[25Xgap>[125X [27XFL[3]:=[[4,1,2,3,4],[4,1,2,5,6]];;[127X[104X
    [4X[25Xgap>[125X [27XFL[4]:=[];;[127X[104X
    [4X[25Xgap>[125X [27XA:=RegularCWComplex(FL);[127X[104X
    [4X[28XRegular CW-complex of dimension 2[128X[104X
    [4X[28X[128X[104X
    [4X[25Xgap>[125X [27XHomology(A,0);[127X[104X
    [4X[28X[ 0 ][128X[104X
    [4X[25Xgap>[125X [27XHomology(A,1);[127X[104X
    [4X[28X[ 0 ][128X[104X
    [4X[25Xgap>[125X [27XHomology(A,2);[127X[104X
    [4X[28X[  ][128X[104X
    [4X[28X[128X[104X
    [4X[28X[128X[104X
  [4X[32X[104X
  
  [33X[0;0YNext  we  construct the direct product [22XY=A× A× A× A× A[122X of five copies of the
  annulus. This is a [22X10[122X-dimensional CW complex involving [22X248832[122X cells. It will
  be  homotopy equivalent [22XY≃ X[122X to a CW complex [22XX[122X involving fewer cells. The CW
  complex  [22XX[122X  may  be  non-regular.  We compute the cochain complex [22XD_∗ = Hom_
  Z(C_∗(X), Z)[122X from which the cohomology groups[133X
  [33X[0;0Y[22XH^0(Y, Z)= Z[122X,[133X
  [33X[0;0Y[22XH^1(Y, Z)= Z^5[122X,[133X
  [33X[0;0Y[22XH^2(Y, Z)= Z^10[122X,[133X
  [33X[0;0Y[22XH^3(Y, Z)= Z^10[122X,[133X
  [33X[0;0Y[22XH^4(Y, Z)= Z^5[122X,[133X
  [33X[0;0Y[22XH^5(Y, Z)= Z[122X,[133X
  [33X[0;0Y[22XH^6(Y, Z)=0[122X[133X
  [33X[0;0Yare obtained.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XY:=DirectProduct(A,A,A,A,A);[127X[104X
    [4X[28XRegular CW-complex of dimension 10[128X[104X
    [4X[28X[128X[104X
    [4X[25Xgap>[125X [27XSize(Y);[127X[104X
    [4X[28X248832[128X[104X
    [4X[25Xgap>[125X [27XC:=ChainComplex(Y);[127X[104X
    [4X[28XChain complex of length 10 in characteristic 0 . [128X[104X
    [4X[28X[128X[104X
    [4X[25Xgap>[125X [27XD:=HomToIntegers(C);[127X[104X
    [4X[28XCochain complex of length 10 in characteristic 0 . [128X[104X
    [4X[28X[128X[104X
    [4X[25Xgap>[125X [27XCohomology(D,0);[127X[104X
    [4X[28X[ 0 ][128X[104X
    [4X[25Xgap>[125X [27XCohomology(D,1);[127X[104X
    [4X[28X[ 0, 0, 0, 0, 0 ][128X[104X
    [4X[25Xgap>[125X [27XCohomology(D,2);[127X[104X
    [4X[28X[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ][128X[104X
    [4X[25Xgap>[125X [27XCohomology(D,3);[127X[104X
    [4X[28X[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ][128X[104X
    [4X[25Xgap>[125X [27XCohomology(D,4);[127X[104X
    [4X[28X[ 0, 0, 0, 0, 0 ][128X[104X
    [4X[25Xgap>[125X [27XCohomology(D,5);[127X[104X
    [4X[28X[ 0 ][128X[104X
    [4X[25Xgap>[125X [27XCohomology(D,6);[127X[104X
    [4X[28X[  ][128X[104X
    [4X[28X[128X[104X
    [4X[28X[128X[104X
  [4X[32X[104X
  
  
  [1X1.9 [33X[0;0YCup products[133X[101X
  
  [33X[0;0Y[12XStrategy 1: Use geometric group theory in low dimensions.[112X[133X
  
  [33X[0;0YContinuing  with  the  previous  example,  we  consider  the first and fifth
  generators  [22Xg_1^1,  g_5^1∈  H^1(Y,  Z)  =  Z^5[122X  and establish that their cup
  product  [22Xg_1^1  ∪  g_5^1  = - g_7^2 ∈ H^2(Y, Z) = Z^10[122X is equal to minus the
  seventh generator of [22XH^2(Y, Z)[122X. We also verify that [22Xg_5^1∪ g_1^1 = - g_1^1 ∪
  g_5^1[122X.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27Xcup11:=CupProduct(FundamentalGroup(Y));[127X[104X
    [4X[28Xfunction( a, b ) ... end[128X[104X
    [4X[28X[128X[104X
    [4X[25Xgap>[125X [27Xcup11([1,0,0,0,0],[0,0,0,0,1]);[127X[104X
    [4X[28X[ 0, 0, 0, 0, 0, 0, -1, 0, 0, 0 ][128X[104X
    [4X[28X[128X[104X
    [4X[25Xgap>[125X [27Xcup11([0,0,0,0,1],[1,0,0,0,0]);[127X[104X
    [4X[28X[ 0, 0, 0, 0, 0, 0, 1, 0, 0, 0 ][128X[104X
    [4X[28X[128X[104X
    [4X[28X[128X[104X
  [4X[32X[104X
  
  [33X[0;0YThis   computation   of  low-dimensional  cup  products  is  achieved  using
  group-theoretic  methods  to  approximate  the  diagonal map [22X∆ : Y → Y× Y[122X in
  dimensions  [22Xle  2[122X.  In order to construct cup products in higher degrees [12XHAP[112X
  invokes two further strategies.[133X
  
  [33X[0;0Y[12XStrategy 2: implement the Alexander-Whitney map for a fixed class of spaces.[112X[133X
  
  [33X[0;0YFor  simplicial  complexes the cup product is implemented using the standard
  formula   for  the  Alexander-Whitney  chain  map,  together  with  homotopy
  equivalences to improve efficiency.[133X
  
  [33X[0;0YAs a first example, the following commands construct simplicial surfaces [22XK=(
  S^1  × S^1) # ( S^1 × S^1)[122X and [22XL=( S^1 × S^1) ∨ S^1 ∨ S^1[122X and establish that
  they have the same cohomology groups. It is then shown that the cup products
  [22X∪_K: H^1(K, Z)× H^1(K, Z) → H^2(K, Z)[122X and [22X∪_L: H^1(L, Z)× H^1(L, Z) → H^2(L,
  Z)[122X  are  antisymmetric bilinear forms of different ranks; hence [22XK[122X and [22XL[122X have
  different homotopy types.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XK:=ClosedSurface(2);[127X[104X
    [4X[28XSimplicial complex of dimension 2.[128X[104X
    [4X[28X[128X[104X
    [4X[25Xgap>[125X [27XL:=WedgeSum(WedgeSum(ClosedSurface(1),Sphere(1)),Sphere(1));[127X[104X
    [4X[28XSimplicial complex of dimension 2.[128X[104X
    [4X[28X[128X[104X
    [4X[25Xgap>[125X [27XCohomology(K,0);Cohomology(L,0);[127X[104X
    [4X[28X[ 0 ][128X[104X
    [4X[28X[ 0 ][128X[104X
    [4X[25Xgap>[125X [27XCohomology(K,1);Cohomology(L,1);[127X[104X
    [4X[28X[ 0, 0, 0, 0 ][128X[104X
    [4X[28X[ 0, 0, 0, 0 ][128X[104X
    [4X[25Xgap>[125X [27XCohomology(K,2);Cohomology(L,2);[127X[104X
    [4X[28X[ 0 ][128X[104X
    [4X[28X[ 0 ][128X[104X
    [4X[25Xgap>[125X [27Xgens:=[[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]];;[127X[104X
    [4X[25Xgap>[125X [27XcupK:=CupProduct(K);;[127X[104X
    [4X[25Xgap>[125X [27XcupL:=CupProduct(L);;[127X[104X
    [4X[25Xgap>[125X [27XA:=NullMat(4,4);;B:=NullMat(4,4);;[127X[104X
    [4X[25Xgap>[125X [27Xfor i in [1..4] do[127X[104X
    [4X[25X>[125X [27Xfor j in [1..4] do[127X[104X
    [4X[25X>[125X [27XA[i][j]:=cupK(1,1,gens[i],gens[j])[1];[127X[104X
    [4X[25X>[125X [27XB[i][j]:=cupL(1,1,gens[i],gens[j])[1];[127X[104X
    [4X[25X>[125X [27Xod;od;[127X[104X
    [4X[25Xgap>[125X [27XDisplay(A);[127X[104X
    [4X[28X[ [   0,   0,   0,   1 ],[128X[104X
    [4X[28X  [   0,   0,   1,   0 ],[128X[104X
    [4X[28X  [   0,  -1,   0,   0 ],[128X[104X
    [4X[28X  [  -1,   0,   0,   0 ] ][128X[104X
    [4X[25Xgap>[125X [27XDisplay(B);[127X[104X
    [4X[28X[ [   0,   1,   0,   0 ],[128X[104X
    [4X[28X  [  -1,   0,   0,   0 ],[128X[104X
    [4X[28X  [   0,   0,   0,   0 ],[128X[104X
    [4X[28X  [   0,   0,   0,   0 ] ][128X[104X
    [4X[25Xgap>[125X [27XRank(A);[127X[104X
    [4X[28X4[128X[104X
    [4X[25Xgap>[125X [27XRank(B);[127X[104X
    [4X[28X2[128X[104X
    [4X[28X[128X[104X
  [4X[32X[104X
  
  [33X[0;0YAs  a  second  example  of  the  computation of cups products, the following
  commands  construct  the  wedge  sum  [22XW=M∨  N[122X  of a [22X2[122X-dimensional orientable
  simplicial  surface of genus 2 and the [22XK3[122X complex surface which is stored as
  a pure simplicial complex of dimension 4. The simplicial structure on the [22XK3[122X
  surface  is  taken  from [SK11]. The commands then show that [22XH^2(W, Z)= Z^22[122X
  and  [22XH^4(W,  Z)= Z[122X. The final commands comput the matrix [22X(x∪ y)[122X as [22Xx,y[122X range
  over a generating set for [22XH^2(W, Z)[122X.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XM:=ClosedSurface(2);;[127X[104X
    [4X[25Xgap>[125X [27XN:=SimplicialK3Surface();;[127X[104X
    [4X[25Xgap>[125X [27XW:=WedgeSum(M,N);[127X[104X
    [4X[28XSimplicial complex of dimension 4.[128X[104X
    [4X[28X[128X[104X
    [4X[25Xgap>[125X [27XCohomology(W,0);[127X[104X
    [4X[28X[ 0 ][128X[104X
    [4X[25Xgap>[125X [27XCohomology(W,1);[127X[104X
    [4X[28X[ 0, 0, 0, 0 ][128X[104X
    [4X[25Xgap>[125X [27XCohomology(W,2);[127X[104X
    [4X[28X[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ][128X[104X
    [4X[25Xgap>[125X [27XCohomology(W,3);[127X[104X
    [4X[28X[  ][128X[104X
    [4X[25Xgap>[125X [27XCohomology(W,4);[127X[104X
    [4X[28X[ 0 ][128X[104X
    [4X[25Xgap>[125X [27Xcup:=CupProduct(W);;[127X[104X
    [4X[25Xgap>[125X [27XSecondCohomologyGens:=IdentityMat(23);;[127X[104X
    [4X[25Xgap>[125X [27XA:=NullMat(23,23);;[127X[104X
    [4X[25Xgap>[125X [27Xfor i in [1..23] do[127X[104X
    [4X[25X>[125X [27Xfor j in [1..23] do[127X[104X
    [4X[25X>[125X [27XA[i][j]:=cup(2,2,SecondCohomologyGens[i],SecondCohomologyGens[j])[1];[127X[104X
    [4X[25X>[125X [27Xod;od;[127X[104X
    [4X[25Xgap>[125X [27XDisplay(A);[127X[104X
    [4X[28X[ [   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0 ],[128X[104X
    [4X[28X  [   0,  -2,   2,  -1,   0,  -1,   1,  -1,   0,   0,   1,  -1,   0,   0,   1,   1,   2,  -1,  -1,   1,  -1,   0,  -1 ],[128X[104X
    [4X[28X  [   0,   2,  -4,   2,  -1,   1,  -1,   1,   0,  -1,  -1,   0,   1,  -1,   1,  -1,  -2,   1,   2,  -2,   1,   0,   3 ],[128X[104X
    [4X[28X  [   0,  -1,   2,  -2,   2,  -1,   0,  -1,   1,   1,   1,   0,   0,   0,  -2,   0,   0,   0,   0,   1,   0,   1,  -1 ],[128X[104X
    [4X[28X  [   0,   0,  -1,   2,  -4,   1,   1,   1,  -2,  -1,  -1,   0,  -1,  -1,   4,   0,   1,  -1,  -1,  -1,  -1,  -1,   1 ],[128X[104X
    [4X[28X  [   0,  -1,   1,  -1,   1,  -2,   0,  -1,   1,   0,   1,  -1,   1,   0,   0,   1,   1,   0,   0,   1,   0,   1,   0 ],[128X[104X
    [4X[28X  [   0,   1,  -1,   0,   1,   0,  -2,   1,   0,   0,  -1,   0,   1,   1,  -1,   0,  -1,   0,   0,   0,   1,   0,   0 ],[128X[104X
    [4X[28X  [   0,  -1,   1,  -1,   1,  -1,   1,  -2,   1,   0,   1,  -1,   1,   0,   0,   1,   1,   0,   0,   1,   0,   0,   0 ],[128X[104X
    [4X[28X  [   0,   0,   0,   1,  -2,   1,   0,   1,  -2,  -1,   0,   0,  -1,  -1,   2,   0,   0,  -1,   0,  -1,  -1,  -1,   0 ],[128X[104X
    [4X[28X  [   0,   0,  -1,   1,  -1,   0,   0,   0,  -1,  -2,   0,  -1,   0,   0,   2,   1,   0,   0,   0,   0,   0,  -1,   1 ],[128X[104X
    [4X[28X  [   0,   1,  -1,   1,  -1,   1,  -1,   1,   0,   0,  -2,   0,   1,   1,  -1,   0,  -1,   0,   0,   0,   1,  -1,   0 ],[128X[104X
    [4X[28X  [   0,  -1,   0,   0,   0,  -1,   0,  -1,   0,  -1,   0,  -2,   1,   0,   2,   1,   1,  -1,   0,   0,   0,   0,   1 ],[128X[104X
    [4X[28X  [   0,   0,   1,   0,  -1,   1,   1,   1,  -1,   0,   1,   1,  -2,   0,   0,   0,   0,   1,  -1,   1,  -1,  -1,  -2 ],[128X[104X
    [4X[28X  [   0,   0,  -1,   0,  -1,   0,   1,   0,  -1,   0,   1,   0,   0,  -2,   3,   0,   1,  -1,   0,  -1,  -1,   0,   1 ],[128X[104X
    [4X[28X  [   0,   1,   1,  -2,   4,   0,  -1,   0,   2,   2,  -1,   2,   0,   3,  -8,  -1,  -2,   1,   1,   1,   2,   0,  -2 ],[128X[104X
    [4X[28X  [   0,   1,  -1,   0,   0,   1,   0,   1,   0,   1,   0,   1,   0,   0,  -1,  -2,  -1,   1,   1,  -1,   0,   0,   0 ],[128X[104X
    [4X[28X  [   0,   2,  -2,   0,   1,   1,  -1,   1,   0,   0,  -1,   1,   0,   1,  -2,  -1,  -2,   0,   2,  -1,   1,   0,   0 ],[128X[104X
    [4X[28X  [   0,  -1,   1,   0,  -1,   0,   0,   0,  -1,   0,   0,  -1,   1,  -1,   1,   1,   0,  -2,  -1,   0,   0,  -1,   1 ],[128X[104X
    [4X[28X  [   0,  -1,   2,   0,  -1,   0,   0,   0,   0,   0,   0,   0,  -1,   0,   1,   1,   2,  -1,  -2,   1,  -1,   0,  -2 ],[128X[104X
    [4X[28X  [   0,   1,  -2,   1,  -1,   1,   0,   1,  -1,   0,   0,   0,   1,  -1,   1,  -1,  -1,   0,   1,  -2,   0,  -1,   2 ],[128X[104X
    [4X[28X  [   0,  -1,   1,   0,  -1,   0,   1,   0,  -1,   0,   1,   0,  -1,  -1,   2,   0,   1,   0,  -1,   0,  -2,   0,   0 ],[128X[104X
    [4X[28X  [   0,   0,   0,   1,  -1,   1,   0,   0,  -1,  -1,  -1,   0,  -1,   0,   0,   0,   0,  -1,   0,  -1,   0,  -2,   1 ],[128X[104X
    [4X[28X  [   0,  -1,   3,  -1,   1,   0,   0,   0,   0,   1,   0,   1,  -2,   1,  -2,   0,   0,   1,  -2,   2,   0,   1,  -4 ] ][128X[104X
    [4X[28X[128X[104X
  [4X[32X[104X
  
  [33X[0;0YA  cubical Alexander-Whitney formula can be used similarly for computing the
  cohomology  ring  of  a  regular  CW-complex  whose cells all have a cubical
  combinatorial face lattice.[133X
  
  [33X[0;0Y[12XStrategy 3: Guess and verify a cellular approximation to the diagonal map.[112X[133X
  
  [33X[0;0YMany  naturally occuring cell structures are neither simplicial nor cubical.
  For a general regular CW-complex we (currently) require a cellular inclusion
  [22Xoverline  Y  ↪  Y×  Y[122X with [22X{(y,y) : y∈ Y}⊂ overline Y[122X and with projection [22Xp:
  overline  Y ↠ Y[122X that induces isomorphisms on integral homology. The function
  [10XDiagonalApproximation(Y)[110X   constructs   a   candidate   inclusion,  but  the
  projection [22Xp: overline Y ↠ Y[122X needs to be tested for homology equivalence. If
  the  candidate  inclusion  passes this test then the function [10XCupProduct(Y)[110X,
  involving  the  candidate  space, can be used for cup products. (I think the
  test  is  passed  for all regular CW-complexes that are subcomplexes of some
  Euclidean  space  with all cells convex polytopes -- but a proof needs to be
  written down!)[133X
  
  [33X[0;0YThe  following  example  calculates  [22Xg_1^2  ∪ g_2^2 ne 0[122X where [22XY=T× T[122X is the
  direct  product  of  two  copies  of  a  simplicial torus [22XT[122X, and where [22Xg_k^n[122X
  denotes  the [22Xk[122X-th generator in some basis of [22XH^n(Y, Z)[122X. The direct product [22XY[122X
  is a CW-complex which is not a simplicial complex.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XK:=RegularCWComplex(ClosedSurface(1));;[127X[104X
    [4X[25Xgap>[125X [27XY:=DirectProduct(K,K);;[127X[104X
    [4X[25Xgap>[125X [27Xcup:=CupProduct(Y);;[127X[104X
    [4X[25Xgap>[125X [27Xcup(2,2,[1,0,0,0,0,0],[0,1,0,0,0,0]);[127X[104X
    [4X[28X[ 5 ][128X[104X
    [4X[28X[128X[104X
    [4X[25Xgap>[125X [27XD:=DiagonalApproximation(Y);;[127X[104X
    [4X[25Xgap>[125X [27Xp:=D!.projection;[127X[104X
    [4X[28XMap of regular CW-complexes[128X[104X
    [4X[28X[128X[104X
    [4X[25Xgap>[125X [27XP:=ChainMap(p);[127X[104X
    [4X[28XChain Map between complexes of length 4 . [128X[104X
    [4X[28X[128X[104X
    [4X[25Xgap>[125X [27XIsIsomorphismOfAbelianFpGroups(Homology(P,0));[127X[104X
    [4X[28Xtrue[128X[104X
    [4X[25Xgap>[125X [27XIsIsomorphismOfAbelianFpGroups(Homology(P,2));[127X[104X
    [4X[28Xtrue[128X[104X
    [4X[25Xgap>[125X [27XIsIsomorphismOfAbelianFpGroups(Homology(P,3));[127X[104X
    [4X[28Xtrue[128X[104X
    [4X[25Xgap>[125X [27XIsIsomorphismOfAbelianFpGroups(Homology(P,4));[127X[104X
    [4X[28Xtrue[128X[104X
    [4X[28X[128X[104X
  [4X[32X[104X
  
  [33X[0;0YOf  course,  an  alternative approach to this particular example would be to
  first  give  the direct product [22XY=T× T[122X the structure of a simplicial complex
  and then use the Alexander-Whitney map of Strategy 2. A simplicial structure
  for [22XT× T[122X can be obtained using the function [22XSCCartesianProduct(T,T)[122X from the
  [12XSimpComp[112X package. The details are as follows. (The result is consistent with
  the  preceding computation since the choice of a basis for cohomology groups
  is far from unique.)[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XK:=ClosedSurface(1);;[127X[104X
    [4X[25Xgap>[125X [27Xfacets:=MaximalSimplicesOfSimplicialComplex(K);;[127X[104X
    [4X[25Xgap>[125X [27XLoadPackage("simpcomp");;[127X[104X
    [4X[25Xgap>[125X [27XscK:=SCFromFacets(S);;[127X[104X
    [4X[25Xgap>[125X [27XscY:=SCCartesianProduct(scK,scK);;[127X[104X
    [4X[25Xgap>[125X [27XY:=MaximalSimplicesToSimplicialComplex(SCFacetsEx(scY));[127X[104X
    [4X[28XSimplicial complex of dimension 4.[128X[104X
    [4X[28X[128X[104X
    [4X[25Xgap>[125X [27Xcup:=CupProduct(Y);;[127X[104X
    [4X[25Xgap>[125X [27Xcup(2,2,[1,0,0,0,0,0],[0,1,0,0,0,0]);[127X[104X
    [4X[28X[ 0 ][128X[104X
    [4X[28X[128X[104X
  [4X[32X[104X
  
  
  [1X1.10 [33X[0;0YCohomology Rings[133X[101X
  
  [33X[0;0YThe cup product gives the cohomology [22XH^∗(X,R)[122X of a space [22XX[122X with coefficients
  in  a  ring  [22XR[122X the structure of a graded commutitive ring. This is currently
  implemented  only  for  [22XY[122X  a  simplicial  complex  and [22XR= Z_p[122X the field of [22Xp[122X
  elements.[133X
  
  [33X[0;0YThe  folowing  commands compute the mod [22X2[122X cohomology ring [22XH^∗(W, Z_2)[122X of the
  above  wedge  sum [22XW=M∨ N[122X of a [22X2[122X-dimensional orientable simplicial surface of
  genus 2 and the [22XK3[122X complex simplicial surface (of real dimension 4).[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XM:=ClosedSurface(2);;[127X[104X
    [4X[25Xgap>[125X [27XN:=SimplicialK3Surface();;[127X[104X
    [4X[25Xgap>[125X [27XW:=WedgeSum(M,N);;[127X[104X
    [4X[25Xgap>[125X [27XA:=CohomologyRing(W,2);[127X[104X
    [4X[28X<algebra of dimension 29 over GF(2)>[128X[104X
    [4X[25Xgap>[125X [27Xx:=Basis(A)[25];[127X[104X
    [4X[28Xv.25[128X[104X
    [4X[25Xgap>[125X [27Xy:=Basis(A)[27];[127X[104X
    [4X[28Xv.27[128X[104X
    [4X[25Xgap>[125X [27Xx*y;[127X[104X
    [4X[28Xv.29[128X[104X
    [4X[28X[128X[104X
  [4X[32X[104X
  
  
  [1X1.11 [33X[0;0YIntersection forms of [22X4[122X[101X[1X-manifolds[133X[101X
  
  [33X[0;0YThe  cup product gives rise to the intersection form of a connected, closed,
  orientable [22X4[122X-manifold [22XY[122X is a symmetric bilinear form[133X
  
  [33X[0;0Y[22XqY: H^2(Y, Z)/Torsion × H^2(Y, Z)/Torsion ⟶ Z[122X[133X
  
  [33X[0;0Ywhich we represent as a symmetric matrix.[133X
  
  [33X[0;0YThe  following  example  constructs  the  direct  product  [22XL=S^2× S^2[122X of two
  [22X2[122X-spheres,  the  connected  sum  [22XM=  CP^2  #  overline  CP^2[122X  of the complex
  projective plane [22XCP^2[122X and its oppositely oriented version [22Xoverline CP^2[122X, and
  the connected sum [22XM= CP^2 # CP^2[122X. The manifolds [22XL[122X, [22XM[122X and [22XN[122X are each shown to
  have  a  CW-structure involving one [22X0[122X-cell, two [22X1[122X-cells and one [22X2[122X-cell. They
  are thus simply connected and have identical cohomology.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XS:=Sphere(2);;[127X[104X
    [4X[25Xgap>[125X [27XS:=RegularCWComplex(S);;[127X[104X
    [4X[25Xgap>[125X [27XL:=DirectProduct(S,S);[127X[104X
    [4X[28XRegular CW-complex of dimension 4[128X[104X
    [4X[28X[128X[104X
    [4X[25Xgap>[125X [27XM:=ConnectedSum(ComplexProjectiveSpace(2),ComplexProjectiveSpace(2),-1);[127X[104X
    [4X[28XSimplicial complex of dimension 4.[128X[104X
    [4X[28X[128X[104X
    [4X[25Xgap>[125X [27XN:=ConnectedSum(ComplexProjectiveSpace(2),ComplexProjectiveSpace(2),+1);[127X[104X
    [4X[28XSimplicial complex of dimension 4.[128X[104X
    [4X[28X[128X[104X
    [4X[25Xgap>[125X [27XCriticalCells(L);[127X[104X
    [4X[28X[ [ 4, 1 ], [ 2, 13 ], [ 2, 56 ], [ 0, 16 ] ][128X[104X
    [4X[25Xgap>[125X [27XCriticalCells(RegularCWComplex(M));[127X[104X
    [4X[28X[ [ 4, 1 ], [ 2, 109 ], [ 2, 119 ], [ 0, 8 ] ][128X[104X
    [4X[25Xgap>[125X [27XCriticalCells(RegularCWComplex(N));[127X[104X
    [4X[28X[ [ 4, 1 ], [ 2, 119 ], [ 2, 149 ], [ 0, 12 ] ][128X[104X
    [4X[28X[128X[104X
  [4X[32X[104X
  
  [33X[0;0YJohn  Milnor showed (as a corollary to a theorem of J. H. C. Whitehead) that
  the  homotopy  type  of  a  simply connected 4-manifold is determined by its
  quadratic  form.  More  precisely,  a form is said to be of [13Xtype I (properly
  primitive)[113X  if  some  diagonal entry of its matrix is odd. If every diagonal
  entry is even, then the form is of [13Xtype II (improperly primitive)[113X. The [13Xindex[113X
  of  a  form  is defined as the number of positive diagonal entries minus the
  number  of  negative  ones,  after the matrix has been diagonalized over the
  real numbers.[133X
  
  [33X[0;0Y[12XTheorem.[112X  (Milnor [Mil58]) The oriented homotopy type of a simply connected,
  closed,  orientable  4-manifold is determined by its second Betti number and
  the index and type of its intersetion form; except possibly in the case of a
  manifold with definite quadratic form of rank r > 9.[133X
  
  [33X[0;0YThe  following commands compute matrices representing the intersection forms
  [22XqL[122X, [22XqM[122X, [22XqN[122X.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XqL:=IntersectionForm(L);;[127X[104X
    [4X[25Xgap>[125X [27XqM:=IntersectionForm(M);;[127X[104X
    [4X[25Xgap>[125X [27XqN:=IntersectionForm(N);;[127X[104X
    [4X[25Xgap>[125X [27XDisplay(qL);[127X[104X
    [4X[28X[ [  -2,   1 ],[128X[104X
    [4X[28X  [   1,   0 ] ][128X[104X
    [4X[25Xgap>[125X [27XDisplay(qM);[127X[104X
    [4X[28X[ [  5,  2 ],[128X[104X
    [4X[28X  [  2,  1 ] ][128X[104X
    [4X[25Xgap>[125X [27XDisplay(qN);[127X[104X
    [4X[28X[ [  -3,  -2 ],[128X[104X
    [4X[28X  [  -2,  -1 ] ][128X[104X
    [4X[28X[128X[104X
  [4X[32X[104X
  
  [33X[0;0YSince  [22XqL[122X  is  of  type  I, whereas [22XqM[122X and [22XqN[122X are of type II we see that the
  oriented homotopy type of [22XL[122X is distinct to that of [22XM[122X and that of [22XN[122X. Since [22XqM[122X
  has  index  [22X2[122X and [22XqN[122X has index [22X0[122X we see that that [22XM[122X and [22XN[122X also have distinct
  oriented homotopy types.[133X
  
  
  [1X1.12 [33X[0;0YCW maps and induced homomorphisms[133X[101X
  
  [33X[0;0YA  [13Xstrictly  cellular[113X  map [22Xf: X→ Y[122X of regular CW-complexes is a cellular map
  for  which  the  image  of any cell is a cell (of possibly lower dimension).
  Inclusions  of  CW-subcomplexes,  and projections from a direct product to a
  factor, are examples of such maps. Strictly cellular maps can be represented
  in  [12XHAP[112X,  and their induced homomorphisms on (co)homology and on fundamental
  groups can be computed.[133X
  
  [33X[0;0YThe  following  example  begins  by visualizing the trefoil knot [22Xκ ∈ R^3[122X. It
  then  constructs a regular CW structure on the complement [22XY= D^3∖ Nbhd(κ)[122X of
  a  small  tubular open neighbourhood of the knot lying inside a large closed
  ball  [22XD^3[122X.  The  boundary  of  this tubular neighbourhood is a [22X2[122X-dimensional
  CW-complex  [22XB[122X  homeomorphic  to  a  torus  [22XS^1×  S^1[122X  with fundamental group
  [22Xπ_1(B)=<a,b  : aba^-1b^-1=1>[122X. The inclusion map [22Xf: B↪ Y[122X is constructed. Then
  a   presentation   [22Xπ_1(Y)=   <x,y  |  xy^-1x^-1yx^-1y^-1>[122X  and  the  induced
  homomorphism  $$\pi_1(B)\rightarrow  \pi_1(Y),  a\mapsto  y^{-1}xy^2xy^{-1},
  b\mapsto  y  $$  are  computed. This induced homomorphism is an example of a
  [13Xperipheral  system[113X  and  is  known  to  contain  sufficient  information  to
  characterize the knot up to ambient isotopy.[133X
  
  [33X[0;0YFinally,  it  is verified that the induced homology homomorphism [22XH_2(B, Z) →
  H_2(Y, Z)[122X is an isomomorphism.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XK:=PureCubicalKnot(3,1);;[127X[104X
    [4X[25Xgap>[125X [27XViewPureCubicalKnot(K);;[127X[104X
    [4X[28X[128X[104X
  [4X[32X[104X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XK:=PureCubicalKnot(3,1);;[127X[104X
    [4X[25Xgap>[125X [27Xf:=KnotComplementWithBoundary(ArcPresentation(K));[127X[104X
    [4X[28XMap of regular CW-complexes[128X[104X
    [4X[28X[128X[104X
    [4X[25Xgap>[125X [27XG:=FundamentalGroup(Target(f));[127X[104X
    [4X[28X<fp group of size infinity on the generators [ f1, f2 ]>[128X[104X
    [4X[25Xgap>[125X [27XRelatorsOfFpGroup(G);[127X[104X
    [4X[28X[ f1*f2^-1*f1^-1*f2*f1^-1*f2^-1 ][128X[104X
    [4X[28X[128X[104X
    [4X[25Xgap>[125X [27XF:=FundamentalGroup(f);[127X[104X
    [4X[28X[ f1, f2 ] -> [ f2^-1*f1*f2^2*f1*f2^-1, f1 ][128X[104X
    [4X[28X[128X[104X
    [4X[28X[128X[104X
    [4X[25Xgap>[125X [27Xphi:=ChainMap(f);[127X[104X
    [4X[28XChain Map between complexes of length 2 . [128X[104X
    [4X[28X[128X[104X
    [4X[25Xgap>[125X [27XH:=Homology(phi,2);[127X[104X
    [4X[28X[ g1 ] -> [ g1 ][128X[104X
    [4X[28X[128X[104X
    [4X[28X[128X[104X
  [4X[32X[104X
  
  
  [1X1.13 [33X[0;0YConstructing a simplicial complex from a regular CW-complex[133X[101X
  
  [33X[0;0YThe  following  example constructs a [22X3[122X-dimensional pure regular CW-complex [22XK[122X
  whose  [22X3[122X-cells are permutahedra. It then constructs the simplicial complex [22XB[122X
  by  taking  barycentric subdivision. It then constructes a smaller, homotopy
  equivalent,  simplicial  complex  [22XN[122X by taking the nerve of the cover of [22XK[122X by
  the closures of its [22X3[122X-cells.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XK:=RegularCWComplex(PureComplexComplement(PurePermutahedralKnot(3,1)));[127X[104X
    [4X[28XRegular CW-complex of dimension 3[128X[104X
    [4X[28X[128X[104X
    [4X[25Xgap>[125X [27XSize(K);[127X[104X
    [4X[28X77923[128X[104X
    [4X[25Xgap>[125X [27XB:=BarycentricSubdivision(K);[127X[104X
    [4X[28XSimplicial complex of dimension 3.[128X[104X
    [4X[28X[128X[104X
    [4X[25Xgap>[125X [27XSize(B);[127X[104X
    [4X[28X1622517[128X[104X
    [4X[25Xgap>[125X [27XN:=Nerve(K);[127X[104X
    [4X[28XSimplicial complex of dimension 3.[128X[104X
    [4X[28X[128X[104X
    [4X[25Xgap>[125X [27XSize(N);[127X[104X
    [4X[28X48745[128X[104X
    [4X[28X[128X[104X
  [4X[32X[104X
  
  
  [1X1.14 [33X[0;0YEquivariant CW complexes[133X[101X
  
  [33X[0;0YThe  above  representations of spaces as simplicial complexes and regular CW
  complexes have their limitations. One limitation is that the number of cells
  needed  to describe a space can be unnecessarily large. A minimal simplicial
  complex structure for the torus has [22X7[122X vertices, [22X21[122X edges and [22X14[122X triangles. A
  minimal  regular  CW-complex structure for the torus has [22X4[122X vertices, [22X8[122X edges
  and  [22X4[122X  cells  of  dimension  [22X2[122X.  By  using  simplicial sets (which are like
  simplicial complexes except that they allow the freedom to attach simplicial
  cells  by  gluing their boundary non-homeomorphically) one obtains a minimal
  triangulation  of  the  torus  involving  [22X1[122X  vertex,  [22X3[122X edges and [22X2[122X cells of
  dimension  [22X2[122X.  By  using non-regular CW-complexes one obtains a minimal cell
  structure  involving  [22X1[122X  vertex,  [22X2[122X edges and [22X1[122X cell of dimension [22X2[122X. Minimal
  cell  structures  (in  the  four  different  categories)  for  the torus are
  illustrated as follows.[133X
  
  [33X[0;0YA  second  limitation  to  our  representations  of  simplicial  and regular
  CW-complexes is that they apply only to structures with finitely many cells.
  They  do  no apply, for instance, to the simplicial complex structure on the
  real  line  [22XR[122X  in  which  each  each integer [22Xn[122X is a vertex and each interval
  [22X[n,n+1][122X is an edge.[133X
  
  [33X[0;0YSimplicial   sets  provide  one  approach  to  the  efficient  combinatorial
  representation  of  certain spaces. So too do cubical sets (the analogues of
  simplicial sets in which each cell has the combinatorics of an [22Xn[122X-cube rather
  than  an [22Xn[122X-simplex). Neither of these two approaches has been implemented in
  [12XHAP[112X.[133X
  
  [33X[0;0YSimplicial  sets  endowed  with  the action of a (possibly infinite) group [22XG[122X
  provide   for  an  efficient  representation  of  (possibly  infinite)  cell
  structures  on a wider class of spaces. Such a structure can be made precise
  and is known as a [13Xsimplicial group[113X. Some functionality for simplicial groups
  is implemented in [12XHAP[112X and described in Chapter [14X9[114X.[133X
  
  [33X[0;0YA  regular CW-complex endowed with the action of a (possibly infinite) group
  [22XG[122X  is  an alternative approach to the efficient combinatorial representation
  of  (possibly infinite) cell structures on spaces. Much of [12XHAP[112X is focused on
  this  approach.  As  a  first  example  of  the idea, the following commands
  construct  the  infinite  regular  CW-complex  [22XY=widetilde  T[122X arising as the
  universal  cover of the torus [22XT= S^1× S^1[122X where [22XT[122X is given the above minimal
  non-regular  CW  structure  involving  [22X1[122X  vertex,  [22X2[122X  edges,  and  [22X1[122X cell of
  dimension [22X2[122X. The homology [22XH_n(T, Z)[122X is computed and the fundamental group of
  the torus [22XT[122X is recovered.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XF:=FreeGroup(2);;x:=F.1;;y:=F.2;;[127X[104X
    [4X[25Xgap>[125X [27XG:=F/[ x*y*x^-1*y^-1 ];;[127X[104X
    [4X[25Xgap>[125X [27XY:=EquivariantTwoComplex(G);[127X[104X
    [4X[28XEquivariant CW-complex of dimension 2[128X[104X
    [4X[28X[128X[104X
    [4X[25Xgap>[125X [27XC:=ChainComplexOfQuotient(Y);[127X[104X
    [4X[28XChain complex of length 2 in characteristic 0 . [128X[104X
    [4X[28X[128X[104X
    [4X[25Xgap>[125X [27XHomology(C,0);[127X[104X
    [4X[28X[ 0 ][128X[104X
    [4X[25Xgap>[125X [27XHomology(C,1);[127X[104X
    [4X[28X[ 0, 0 ][128X[104X
    [4X[25Xgap>[125X [27XHomology(C,2);[127X[104X
    [4X[28X[ 0 ][128X[104X
    [4X[25Xgap>[125X [27XFundamentalGroupOfQuotient(Y);[127X[104X
    [4X[28X<fp group of size infinity on the generators [ f1, f2 ]>[128X[104X
    [4X[28X[128X[104X
  [4X[32X[104X
  
  [33X[0;0YAs  a  second  example,  the  following  comands  load group number [22X9[122X in the
  library  of  [22X3[122X-dimensional  crystallographic groups. They verify that [22XG[122X acts
  freely  on  [22XR^3[122X  (i.e.  [22XG[122X  is  a  [13XBieberbach  group[113X)  and  then  construct a
  [22XG[122X-equivariant  CW-complex [22XY= R^3[122X corresponding to the tessellation of [22XR^3[122X by
  a  fundamental  domain  for  [22XG[122X.  Finally,  the  cohomology  [22XH_n(M, Z)[122X of the
  [22X3[122X-dimensional  closed  manifold [22XM= R^3/G[122X is computed. The manifold [22XM[122X is seen
  to  be  non-orientable  (since it's top-dimensional homology is trivial) and
  has  a non-regular CW structure with [22X1[122X vertex, [22X3[122X edges, [22X3[122X cells of dimension
  [22X2[122X, and [22X1[122X cell of dimension [22X3[122X. (This example uses Polymake software.)[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XG:=SpaceGroup(3,9);;[127X[104X
    [4X[25Xgap>[125X [27XIsAlmostBieberbachGroup(Image(IsomorphismPcpGroup(G)));[127X[104X
    [4X[28Xtrue[128X[104X
    [4X[25Xgap>[125X [27XY:=EquivariantEuclideanSpace(G,[0,0,0]);[127X[104X
    [4X[28XEquivariant CW-complex of dimension 3[128X[104X
    [4X[28X[128X[104X
    [4X[25Xgap>[125X [27XY!.dimension(0);[127X[104X
    [4X[28X1[128X[104X
    [4X[25Xgap>[125X [27XY!.dimension(1);[127X[104X
    [4X[28X3[128X[104X
    [4X[25Xgap>[125X [27XY!.dimension(2);[127X[104X
    [4X[28X3[128X[104X
    [4X[25Xgap>[125X [27XY!.dimension(3);[127X[104X
    [4X[28X1[128X[104X
    [4X[25Xgap>[125X [27XC:=ChainComplexOfQuotient(Y);[127X[104X
    [4X[28XChain complex of length 3 in characteristic 0 . [128X[104X
    [4X[28X[128X[104X
    [4X[25Xgap>[125X [27XHomology(C,0);[127X[104X
    [4X[28X[ 0 ][128X[104X
    [4X[25Xgap>[125X [27XHomology(C,1);[127X[104X
    [4X[28X[ 0, 0 ][128X[104X
    [4X[25Xgap>[125X [27XHomology(C,2);[127X[104X
    [4X[28X[ 2, 0 ][128X[104X
    [4X[25Xgap>[125X [27XHomology(C,3);[127X[104X
    [4X[28X[  ][128X[104X
    [4X[28X[128X[104X
  [4X[32X[104X
  
  
  [1X1.15 [33X[0;0YOrbifolds and classifying spaces[133X[101X
  
  [33X[0;0YIf  a  discrete  group  [22XG[122X  acts  on Euclidean space or hyperbolic space with
  finite  stabilizer  groups  then  we say that the quotient space obtained by
  killing  the  action  of  [22XG[122X an an [13Xorbifold[113X. If the stabilizer groups are all
  trivial then the quotient is of course a manifold.[133X
  
  [33X[0;0YAn  orbifold  is  represented as a [22XG[122X-equivariant regular CW-complex together
  with  the  stabilizer  group for a representative of each orbit of cells and
  its  subgroup  consisting  of  those  group  elements that preserve the cell
  orientation. [12XHAP[112X stores orbifolds using the data type of [13Xnon-free resolution[113X
  and  uses them mainly as a first step in constructing free [22XZG[122X-resolutions of
  [22XZ[122X.[133X
  
  [33X[0;0YThe  following commands use an [22X8[122X-dimensional equivariant deformation retract
  of  a  [22XGL_3(  Z[  i])[122X-orbifold  structure  on  hyperbolic  space  to compute
  [22XH_5(GL_3(  Z[ i], Z) = Z_2^5⊕ Z_4^2[122X. (The deformation retract is stored in a
  library and was supplied by Mathieu Dutour Sikiric.)[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XOrbifold:=ContractibleGcomplex("PGL(3,Z[i])");[127X[104X
    [4X[28XNon-free resolution in characteristic 0 for matrix group . [128X[104X
    [4X[28XNo contracting homotopy available. [128X[104X
    [4X[28X[128X[104X
    [4X[25Xgap>[125X [27XR:=FreeGResolution(Orbifold,6);[127X[104X
    [4X[28XResolution of length 5 in characteristic 0 for matrix group . [128X[104X
    [4X[28XNo contracting homotopy available. [128X[104X
    [4X[28X[128X[104X
    [4X[25Xgap>[125X [27XHomology(TensorWithIntegers(R),5);[127X[104X
    [4X[28X[ 2, 2, 2, 2, 2, 4, 4 ][128X[104X
    [4X[28X[128X[104X
  [4X[32X[104X
  
  [33X[0;0YThe  next  example computes an orbifold structure on [22XR^4[122X, and then the first
  [22X20[122X   degrees   of  a  free  resolution/classifying  space,  for  the  second
  [22X4[122X-dimensional  crystallographic  group  [22XG[122X in the library of crystallographic
  groups. The cohomology is seen to have [22X11[122X ring generators in degree [22X2[122X and no
  further  ring  generators  in  degrees  [22X<  12[122X.  The  cohomology  groups are:
  $$H^n(G,\mathbb  Z)  =\left(  \begin{array}[ll]  0,  &  {\rm odd~} n\le 20\\
  \mathbb  Z_2^5 \oplus \mathbb Z^6, & n=2\\ \mathbb Z_2^{15}\oplus \mathbb Z,
  & n=4\\ \mathbb Z_2^{16}, & 5 \le n \le 19 .\\ \end{array}\right.$$[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XG:=SpaceGroup(4,2);;[127X[104X
    [4X[25Xgap>[125X [27XR:=ResolutionCubicalCrystGroup(G,20);[127X[104X
    [4X[28XResolution of length 20 in characteristic 0 for <matrix group with [128X[104X
    [4X[28X5 generators> . [128X[104X
    [4X[28X[128X[104X
    [4X[25Xgap>[125X [27XC:=HomToIntegers(R);[127X[104X
    [4X[28XCochain complex of length 20 in characteristic 0 . [128X[104X
    [4X[28X[128X[104X
    [4X[25Xgap>[125X [27XCohomology(C,0);[127X[104X
    [4X[28X[ 0 ][128X[104X
    [4X[25Xgap>[125X [27XCohomology(C,1);[127X[104X
    [4X[28X[  ][128X[104X
    [4X[25Xgap>[125X [27XCohomology(C,2);[127X[104X
    [4X[28X[ 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0 ][128X[104X
    [4X[25Xgap>[125X [27XCohomology(C,3);[127X[104X
    [4X[28X[  ][128X[104X
    [4X[25Xgap>[125X [27XCohomology(C,4);[127X[104X
    [4X[28X[ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0 ][128X[104X
    [4X[25Xgap>[125X [27XCohomology(C,5);[127X[104X
    [4X[28X[  ][128X[104X
    [4X[25Xgap>[125X [27XCohomology(C,6);[127X[104X
    [4X[28X[ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ][128X[104X
    [4X[25Xgap>[125X [27XCohomology(C,7);[127X[104X
    [4X[28X[  ][128X[104X
    [4X[25Xgap>[125X [27XCohomology(C,8);[127X[104X
    [4X[28X[ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ][128X[104X
    [4X[25Xgap>[125X [27XCohomology(C,9);[127X[104X
    [4X[28X[  ][128X[104X
    [4X[25Xgap>[125X [27XCohomology(C,10);[127X[104X
    [4X[28X[ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ][128X[104X
    [4X[25Xgap>[125X [27X## etcetera for n up to 19[127X[104X
    [4X[28X[128X[104X
    [4X[25Xgap>[125X [27XIntegralRingGenerators(R,1);[127X[104X
    [4X[28X[  ][128X[104X
    [4X[25Xgap>[125X [27XIntegralRingGenerators(R,2);[127X[104X
    [4X[28X[ [ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ], [ 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 ], [128X[104X
    [4X[28X  [ 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0 ], [ 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0 ], [128X[104X
    [4X[28X  [ 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0 ], [128X[104X
    [4X[28X  [ 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0 ], [ 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0 ], [128X[104X
    [4X[28X  [ 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0 ], [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0 ], [128X[104X
    [4X[28X  [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 ] ][128X[104X
    [4X[25Xgap>[125X [27XIntegralRingGenerators(R,3);[127X[104X
    [4X[28X[  ][128X[104X
    [4X[25Xgap>[125X [27XIntegralRingGenerators(R,4);[127X[104X
    [4X[28X[  ][128X[104X
    [4X[25Xgap>[125X [27XIntegralRingGenerators(R,5);[127X[104X
    [4X[28X[  ][128X[104X
    [4X[25Xgap>[125X [27XIntegralRingGenerators(R,6);[127X[104X
    [4X[28X[  ][128X[104X
    [4X[25Xgap>[125X [27XIntegralRingGenerators(R,7);[127X[104X
    [4X[28X[  ][128X[104X
    [4X[25Xgap>[125X [27XIntegralRingGenerators(R,8);[127X[104X
    [4X[28X[  ][128X[104X
    [4X[25Xgap>[125X [27XIntegralRingGenerators(R,9);[127X[104X
    [4X[28X[  ][128X[104X
    [4X[25Xgap>[125X [27XIntegralRingGenerators(R,10);[127X[104X
    [4X[28X[  ][128X[104X
    [4X[28X[128X[104X
    [4X[28X[128X[104X
  [4X[32X[104X
  
