<Chapter><Heading>Simplicial complexes &amp; CW complexes</Heading>
<Section><Heading>The Klein bottle as a simplicial complex</Heading>

<P/>
<Alt Only="HTML">&lt;img src="images/klein.jpg" align="center" width="250" alt="Klein bottle"/>
&lt;img src="images/kleingrid.jpg" align="center" width="250"/ alt="simplicial Klein bottle"/></Alt>

<P/> The following example constructs the Klein bottle as a simplicial complex <M>K</M> on <M>9</M> vertices, and then constructs the cellular chain complex
<M>C_\ast=C_\ast(K)</M> from which the integral homology groups
 <M>H_1(K,\mathbb Z)=\mathbb Z_2\oplus \mathbb Z</M>, <M>H_2(K,\mathbb Z)=0</M> are computed. The  chain complex 
<M>D_\ast=C_\ast \otimes_{\mathbb Z} \mathbb Z_2</M> is also constructed and used to compute the mod-<M>2</M> homology vector spaces
<M>H_1(K,\mathbb Z_2)=\mathbb Z_2\oplus \mathbb Z_2</M>, <M>H_2(K,\mathbb Z)=\mathbb Z_2</M>.
Finally, a presentation  <M>\pi_1(K) = \langle
x,y : yxy^{-1}x\rangle</M> is computed for the fundamental group of <M>K</M>. 

<Example>
<#Include SYSTEM "tutex/1.1.txt">
</Example>

</Section>

<Section><Heading>Other simplicial surfaces</Heading>
The following example constructs the real projective plane <M>P</M>,
the Klein bottle <M>K</M> and the torus <M>T</M> as simplicial complexes, using the surface genus <M>g</M> as input in the oriented case and <M>-g</M> as input in the unoriented cases. It then confirms that the connected sums <M>M=K\#P</M> and <M>N=T\#P</M> have the same integral homology.

<Example>
<#Include SYSTEM "tutex/1.4aa.txt">
</Example>
</Section>

<Section><Heading>The Quillen complex</Heading>
 
<P/> Given a group <M>G </M> one can consider the partially ordered set 
<M>{\cal A}_p(G)</M>
of all non-trivial
elementary abelian <M>p</M>-subgroups of <M>G</M>, the partial order being set inclusion.
The order complex  <M>\Delta{\cal A}_p(G)</M> is a simplicial complex which is
called
 the <E>Quillen complex </E>.

<P/> The following example constructs  the
Quillen complex <M>\Delta{\cal A}_2(S_7)</M>
for the symmetric group of degree <M>7</M> and 
<M>p=2</M>. This  simplicial complex involves  <M>11291</M> simplices, of which
<M>4410</M> are <M>2</M>-simplices..

<Example>
<#Include SYSTEM "tutex/1.2.txt">
</Example>


</Section>
<Section><Heading>The Quillen complex as a reduced CW-complex</Heading>
Any simplicial complex <M>K</M> can be regarded as a regular CW complex.
Different datatypes are used in  <B>HAP</B>  for these two notions.
The following continuation of the above Quillen complex example 
constructs a regular CW complex <M>Y</M>
isomorphic to (i.e. with the same face lattice as) <M>K=\Delta{\cal A}_2(S_7)</M>. An advantage to working in the category of CW complexes is that
it may be possible to find a CW complex <M>X</M> homotopy equivalent to <M>Y</M> but with fewer cells than <M>Y</M>. The cellular chain complex <M>C_\ast(X)</M> of such a CW complex <M>X</M> is computed by the following commands. 
From the number of free generators of <M>C_\ast(X)</M>, which correspond to the cells of <M>X</M>, we see that  there is a single <M>0</M>-cell and <M>160</M> <M>2</M>-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 <M>160</M> <M>2</M>-spheres.
This homotopy equivalence 
is given in <Cite Key="ksontini" Where="(15.1)"/> where it was obtained by purely
theoretical  methods.

<Example>
<#Include SYSTEM "tutex/1.3.txt">
</Example>

</Section>

<Section><Heading>Simple homotopy equivalences</Heading>
<P/>For any regular  CW complex <M>Y</M> one can look for a sequence of 
simple homotopy collapses <M>Y\searrow Y_1 \searrow Y_2 \searrow \ldots \searrow Y_N=X</M>
with <M>X</M> a smaller, and typically non-regular, CW complex. 
Such a sequence of collapses can be recorded using what is now known as a <E>discrete vector field</E> on <M>Y</M>. The sequence can, for example, be used 
 to produce a chain homotopy equivalence <M>f\colon C_\ast Y \rightarrow C_\ast X</M> and its chain homotopy inverse <M>g\colon C_\ast X \rightarrow C_\ast Y</M>.

The function
<C>ChainComplex(Y)</C> returns the cellular chain complex <M>C_\ast(X)</M>, wheras the function <C>ChainComplexOfRegularCWComplex(Y)</C> returns the chain complex <M>C_\ast(Y)</M>. 

<P/> For the above Quillen complex <M>Y=\Delta{\cal A}_2(S_7)</M> the following commands produce the chain homotopy equivalence <M>f\colon C_\ast Y \rightarrow C_\ast X</M> and <M>g\colon C_\ast X \rightarrow C_\ast Y</M>. The number of generators  of <M>C_\ast Y</M> equals the number of cells of <M>Y</M> in each degree, and this number is listed for each degree.

<Example>
<#Include SYSTEM "tutex/1.4.txt">
</Example>

</Section>

<Section>
<Heading>Cellular simplifications preserving homeomorphism type</Heading>

<P/>For some purposes one might need to simplify the cell structure on a regular CW-complex <M>Y</M> so as to obtained a homeomorphic CW-complex <M>W</M> with fewer cells. 

<P/>The following commands load a <M>4</M>-dimensional simplicial complex <M>Y</M> representing the  K3 complex surface. Its simplicial structure is taken from <Cite Key="spreerkhuenel"/> and involves <M>1704</M> cells of various dimensions. 
The commands then convert the cell structure into that of a homeomorphic regular CW-complex <M>W</M> involving <M>774</M> cells. 

<Example>
<#Include SYSTEM "tutex/1.4aaa.txt">
</Example>
</Section>

<Section><Heading>Constructing a CW-structure on a knot complement</Heading>

The following commands construct the complement <M>M=S^3\setminus K</M> of the trefoil knot <M>K</M>. This complement is returned as 
 a <M>3</M>-manifold <M>M</M> with regular CW-structure involving four  <M>3</M>-cells.

<Example>
<#Include SYSTEM "tutex/1.4a.txt">
</Example>

The following additional commands then show that <M>M</M> is homotopy 
equivalent to a reduced CW-complex <M>Y</M> of dimension <M>2</M> 
involving one <M>0</M>-cell, two <M>1</M>-cells and one <M>2</M>-cell. The fundamental group of <M>Y</M> is computed and used to calculate the Alexander polynomial of the trefoil
knot. 

<Example>
<#Include SYSTEM "tutex/1.4b.txt">
</Example>

</Section>

<Section><Heading>Constructing a regular CW-complex by attaching cells</Heading>
<P/>
<Alt Only="HTML">&lt;img src="images/cwspace2.jpg" align="center" width="250" alt="CW space"/></Alt>

<P/>The following example  creates the projective plane <M>Y</M> as   
a regular CW-complex, and tests  that it has the correct integral homology
<M>H_0(Y,\mathbb Z)=\mathbb Z</M>, <M>H_1(Y,\mathbb Z)=\mathbb Z_2</M>, <M>H_2(Y,\mathbb Z)=0</M>.

<Example>
<#Include SYSTEM "tutex/1.5a.txt">
</Example>


<P/>The following example  creates a 2-complex <M>K</M>
corresponding to the group presentation <P/><M>G=\langle x,y,z\ :\ xyx^{-1}y^{-1}=1, yzy^{-1}z^{-1}=1, zxz^{-1}x^{-1}=1\rangle</M>.
<P/>The complex is shown to have the correct  fundamental group and homology (since it is the 2-skeleton of the 3-torus <M>S^1\times S^1\times S^1</M>). 


<Example>
<#Include SYSTEM "tutex/1.5b.txt">
</Example>


</Section>

<Section><Heading>Constructing a regular CW-complex from its face lattice</Heading>

<P/>
<Alt Only="HTML">&lt;img src="images/cwspace.jpg" align="center" width="250" alt="CW space"/></Alt>

<P/>The following example  creats a <M>2</M>-dimensional annulus <M>A</M> as 
a regular CW-complex, and testing  that it has the correct integral homology
<M>H_0(A,\mathbb Z)=\mathbb Z</M>, <M>H_1(A,\mathbb Z)=\mathbb Z</M>, <M>H_2(A,\mathbb Z)=0</M>.

<Example>
<#Include SYSTEM "tutex/1.5.txt">
</Example>

<P/>Next we construct the direct product
<M>Y=A\times A\times A\times A\times A</M> of five copies of the annulus.
This is a <M>10</M>-dimensional CW complex involving <M>248832</M> cells.
It will be homotopy equivalent <M>Y\simeq X</M> to a CW complex <M>X</M>
involving fewer cells. The CW complex <M>X</M> may be non-regular.
We compute the cochain complex <M>D_\ast = {\rm Hom}_{\mathbb Z}(C_\ast(X),\mathbb Z)</M> from which the cohomology groups
<Br/><M>H^0(Y,\mathbb Z)=\mathbb Z</M>,
<Br/><M>H^1(Y,\mathbb Z)=\mathbb Z^5</M>,
<Br/><M>H^2(Y,\mathbb Z)=\mathbb Z^{10}</M>,
<Br/><M>H^3(Y,\mathbb Z)=\mathbb Z^{10}</M>,
<Br/><M>H^4(Y,\mathbb Z)=\mathbb Z^5</M>,
<Br/><M>H^5(Y,\mathbb Z)=\mathbb Z</M>,
<Br/><M>H^6(Y,\mathbb Z)=0</M><Br/>
are obtained.

<Example>
<#Include SYSTEM "tutex/1.6.txt">
</Example>

</Section>
<Section><Heading>Cup products</Heading>

<P/><B>Strategy 1: Use geometric group theory in low dimensions.</B>

<P/>Continuing with the previous example, we consider 
the first and fifth generators <M>g_1^1, g_5^1\in H^1(Y,\mathbb Z) =\mathbb Z^5</M>
and establish that their cup product <M> g_1^1 \cup g_5^1 = - g_7^2 \in H^2(Y,\mathbb Z) =\mathbb Z^{10}</M> is equal to minus the seventh generator of <M>H^2(Y,\mathbb Z)</M>.
We also verify that <M>g_5^1\cup g_1^1 = - g_1^1 \cup g_5^1</M>.

<Example>
<#Include SYSTEM "tutex/1.7.txt">
</Example>

<P/>This computation of low-dimensional cup products is achieved using group-theoretic methods to approximate the diagonal map <M>\Delta \colon Y \rightarrow  Y\times Y</M> in dimensions <M>\le 2</M>. In order to construct cup products in
higher degrees <B>HAP</B> invokes three further strategies.

<P/><B>Strategy 2: implement the Alexander-Whitney map for simplicial complexes.</B>


<P/>For simplicial complexes the cup product is implemented using the standard formula for the Alexander-Whitney chain map, together with homotopy equivalences to improve efficiency.

<P/>As a first example, the following commands construct simplicial complexes 
<M>K=(\mathbb S^1 \times \mathbb S^1) \# (\mathbb S^1 \times \mathbb S^1)</M>
and <M>L=(\mathbb S^1 \times \mathbb S^1) \vee \mathbb S^1 \vee \mathbb S^1</M>
and establish that they have the same cohomology groups. It is then shown that
the cup products <M>\cup_K\colon H^2(K,\mathbb Z)\times H^2(K,\mathbb Z) \rightarrow H^4(K,\mathbb Z)</M> and <M>\cup_L\colon H^2(L,\mathbb Z)\times H^2(L,\mathbb Z) \rightarrow H^4(L,\mathbb Z)</M> are antisymmetric bilinear forms of
 different ranks;  hence <M>K</M> and <M>L</M> have different homotopy types.
<Example>
<#Include SYSTEM "tutex/1.7c.txt">
</Example>

<P/> As a second example of the computation of cups products, the following commands construct the connected sums 
<M>V=M\# M</M> and <M>W=M\# \overline M</M> where <M>M</M> is the <M>K3</M> complex  
 surface which is stored as a pure simplicial complex of dimension 4 and where <M>\overline M</M> denotes the opposite orientation on <M>M</M>. The  simplicial structure
on the <M>K3</M> surface  is taken from <Cite Key="spreerkhuenel"/>.
The commands then show that <M>H^2(V,\mathbb Z)=H^2(W,\mathbb Z)=\mathbb Z^{44}</M> and
<M>H^4(V,\mathbb Z)=H^4(W,\mathbb Z)=\mathbb Z</M>. The final commands compute
	the matrix <M>AV=(x\cup y)</M> as <M>x,y</M> range over a generating set for <M>H^2(V,\mathbb Z)</M> and the corresponding matrix <M>AW</M> for <M>W</M>. These two matrices are seen to have a different number of positive eigenvalues from which we can conclude that <M>V</M> is not homotopy equivalent to <M>W</M>.

<Example>
<#Include SYSTEM "tutex/1.7b.txt">
</Example>

A cubical cubical version of the Alexander-Whitney formula, due to J.-P. Serre, could be used for computing the cohomology ring of a regular CW-complex whose cells all have a cubical combinatorial face lattice. This has not been implemented in HAP. However, the following more general approach has been implemented.

<P/><B>Strategy 3: Implement a cellular approximation to the diagonal map on an arbitrary finite regular CW-complex.</B>

<P/>The following example calculates the cup product <M>H^2(W,\mathbb Z)\times H^2(W,\mathbb Z) \rightarrow H^4(W,\mathbb Z)</M> for the <M>4</M>-dimensional orientable manifold
<M>W=M\times M</M> where <M>M</M> is the closed surface of genus <M>2</M>. The manifold <M>W</M>  is stored as a regular CW-complex. 

<Example>
<#Include SYSTEM "tutex/1.7d.txt">
</Example>
	The matrix <M>A</M> representing the cup product <M>H^2(W,\mathbb Z)\times H^2(W,\mathbb Z) \rightarrow H^4(W,\mathbb Z)</M> is shown to have <M>9</M> positive eigenvalues, <M>9</M>  negative eigenvalues, and no zero eigenvalue.

<P/><B>Strategy 4: Guess and verify a cellular approximation to the diagonal map.</B>   

<P/>Many naturally occuring cell structures are neither simplicial nor cubical. For a general regular CW-complex we 
can attempt to construct a cellular inclusion <M>\overline Y \hookrightarrow Y\times Y</M> with <M>\{(y,y)\ :\ y\in Y\}\subset \overline Y</M> and with projection <M>p\colon \overline Y \twoheadrightarrow Y</M> that induces isomorphisms on integral homology.
The function <C>DiagonalApproximation(Y)</C> constructs a candidate inclusion,
but the projection <M>p\colon \overline Y \twoheadrightarrow Y</M> 
needs to be tested for homology equivalence. If the candidate inclusion
 passes this test then the function <C>CupProductOfRegularCWComplex_alt(Y)</C>,  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!)   

<P/>The following example calculates <M>g_1^2 \cup g_2^2 \ne 0</M> where
<M>Y=T\times T</M> is  the 
direct product of two copies of a simplicial torus <M>T</M>, and where    
<M>g_k^n</M> denotes the <M>k</M>-th generator in some basis
of <M>H^n(Y,\mathbb Z)</M>. The direct product <M>Y</M>
is a CW-complex which is not a simplicial complex.

<Example>
<#Include SYSTEM "tutex/1.8.txt">
</Example>
</Section>

Of course, either of Strategies 2 or 3 could also be used for this example. 
To use the Alexander-Whitney formula of Strategy 2 we would need to give the 
direct product <M>Y=T\times T</M> a simplicial structure. This could be obtained
 using the function <Code>DirectProduct(T,T)</Code>. 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.)

<Example>
<#Include SYSTEM "tutex/1.8d.txt">
</Example>



<Section><Heading>Intersection forms of <M>4</M>-manifolds</Heading>
The cup product gives rise to the intersection form of a connected, closed,  orientable <M>4</M>-manifold <M>Y</M> is a symmetric bilinear form
<P/><M>qY\colon H^2(Y,\mathbb Z)/Torsion \times H^2(Y,\mathbb Z)/Torsion \longrightarrow \mathbb Z</M>
<P/>which we represent as a symmetric matrix.

<P/>The following example constructs the direct product <M>L=S^2\times S^2</M> of two <M>2</M>-spheres,  the connected sum 
<M>M=\mathbb CP^2 \# \overline{\mathbb CP^2}</M> of the complex projective plane <M>\mathbb CP^2</M> and its oppositely oriented version <M>\overline{\mathbb CP^2}</M>, and the connected sum
<M>N=\mathbb CP^2 \# \mathbb CP^2</M>. The manifolds <M>L</M>, <M>M</M> and <M>N</M> are each shown to have a CW-structure involving one <M>0</M>-cell, two <M>1</M>-cells and one <M>2</M>-cell. They are thus simply connected and have identical cohomology.


<Example>
<#Include SYSTEM "tutex/1.8a.txt">
</Example>

John 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 <E>type I  (properly primitive)</E> if some diagonal entry of its matrix is odd. If every diagonal entry is even, then the form is of <E>type II (improperly primitive)</E>.
The <E>index</E> 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.

<P/><B>Theorem.</B> (Milnor <Cite Key="milnor"/>)
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. 

<P/>
The following commands compute matrices representing the intersection forms <M>qL</M>, <M>qM</M>, <M>qN</M>.   


<Example>
<#Include SYSTEM "tutex/1.8b.txt">
</Example>

Since <M>qL</M> is of type II, whereas <M>qM</M> and <M>qN</M> are  of type I 
we see that the oriented homotopy type of <M>L</M> is distinct to that of 
<M>M</M> and that of <M>N</M>. Since <M>qM</M> has index <M>2</M> and  <M>qN</M> has index <M>0</M> we see that that <M>M</M> and <M>N</M> also have distinct oriented homotopy types.

</Section>

<Section><Heading>Cohomology Rings</Heading>
The cup product gives the cohomology <M>H^\ast(X,R)</M> of a space <M>X</M> with coefficients in a ring <M>R</M> the structure of a graded commutitive ring. The function <Code>CohomologyRing(Y,p)</Code>
 returns the cohomology as an algebra 
for <M>Y</M> a simplicial complex and <M>R=\mathbb Z_p</M> the field of <M>p</M> elements. For more general regular
CW-complexes or <M>R=\mathbb Z</M> the cohomology ring structure can be determined using the function <Code>CupProduct(Y)</Code>.

<P/>The folowing commands compute the mod <M>2</M> cohomology ring <M>H^\ast(W,\mathbb Z_2)</M> of the above wedge sum
<M>W=M\vee N</M> of a <M>2</M>-dimensional orientable
simplicial surface  of genus 2 and the <M>K3</M> complex simplicial surface (of real dimension 4).
<Example>
<#Include SYSTEM "tutex/1.80.txt">
</Example>

<P/>The functions <Code>CupProduct</Code> and <Code>IntersectionForm</Code> 
can be used to determine integral cohomology rings. For example,
the  integral cohomology ring of an arbitrary closed surface was calculated in <Cite Key="goncalves" Where="Theorem 3.5"/>. For any given surface <M>M</M>
this result can be recalculated using the intersection form. For instance, for an orientable surface of genus <M>g</M> it is well-known that
 <M>H^1(M,\mathbb Z)=\mathbb Z^{2g}</M>, <M>H^2(M,\mathbb Z)=\mathbb Z</M>. The ring structure multiplication is thus given by the matrix of the intersection form. For say <M>g=3</M> the ring multiplication is given, with respect to some cohomology basis, in the following.
<Example>
<#Include SYSTEM "tutex/1.80a.txt">
</Example>
By changing the basis <M>B</M> for <M>H^1(M,\mathbb Z)</M> we obtain the following simpler matrix representing multiplication in <M>H^\ast(M,\mathbb Z)</M>.
<Example>
<#Include SYSTEM "tutex/1.80b.txt">
</Example> 

</Section>

<Section><Heading>Bockstein homomorphism</Heading>
	The following example evaluates the Bockstein homomorphism
	<M>\beta_2\colon H^\ast(X,\mathbb Z_2) \rightarrow H^{\ast +1}(X,\mathbb Z_2)</M>
		on an additive basis for <M>X=\Sigma(\mathbb RP^2 \times \mathbb RP^2)</M>  the suspension of the direct product of two projective planes.
<Example>
<#Include SYSTEM "tutex/1.17.txt">
</Example>

	If only the Bockstein homomorphism is required, and not the cohomology rings structure, then it is better to compute the Bockstein directly from a chain complex. The following computes
	the Bockstein <M>\beta_2\colon H^2(Y,\mathbb Z_2) \rightarrow H^{3}(Y,\mathbb Z_2)</M> for the direct product <M>Y=K \times 
		K  \times K \times K</M>  of four copies of the Klein bottle
			represented as a regular CW-complex with <M>331776</M> cells. The order of the kernel and image of <M>\beta_2</M> are computed.

<Example>
<#Include SYSTEM "tutex/1.18.txt">
</Example>


</Section>


<Section><Heading>CW maps and induced homomorphisms</Heading>

<P/>A <E>strictly cellular</E> map <M>f\colon X\rightarrow Y</M> 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 <B>HAP</B>, and their induced homomorphisms on (co)homology and on fundamental groups can be computed. 

<P/>
The following example begins by visualizing the trefoil knot
<M>\kappa \in \mathbb R^3</M>. It then constructs a regular 
CW structure on the complement <M>Y= D^3\setminus {\rm Nbhd}(\kappa) </M> 
of a small tubular open neighbourhood of
the knot lying inside a large closed ball <M>D^3</M>. The boundary of this
tubular neighbourhood is a <M>2</M>-dimensional CW-complex <M>B</M> homeomorphic to a torus <M>\mathbb S^1\times \mathbb S^1</M> with 
fundamental group <M>\pi_1(B)=&lt;a,b\, :\, aba^{-1}b^{-1}=1></M>.  The inclusion map
<M>f\colon B\hookrightarrow Y</M> is constructed. Then a presentation
<M>\pi_1(Y)= &lt;x,y\, |\, xy^{-1}x^{-1}yx^{-1}y^{-1}></M> 
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 <E>peripheral system</E> and is known to contain sufficient information to characterize the knot up to ambient isotopy.

<P/> Finally, it is verified that the induced homology homomorphism <M>H_2(B,\mathbb Z) \rightarrow H_2(Y,\mathbb Z)</M> is an isomomorphism.

<Example>
<#Include SYSTEM "tutex/1.9.txt">
</Example>
<Alt Only="HTML">&lt;img src="images/trefoil.png" align="center" width="150" alt="trefoil knot"/></Alt>
<Example>
<#Include SYSTEM "tutex/1.10.txt">
</Example>

</Section>

<Section><Heading>Constructing a simplicial complex from a regular CW-complex</Heading>

The following example constructs a <M>3</M>-dimensional pure regular CW-complex <M>K</M> whose <M>3</M>-cells are  permutahedra. It then constructs the simplicial complex <M>B</M> by taking barycentric subdivision. It then constructes a smaller, homotopy equivalent, simplicial complex <M>N</M> by taking the nerve of the cover of <M>K</M> by the closures of its <M>3</M>-cells.  
<Example>
<#Include SYSTEM "tutex/1.101.txt">
</Example>

</Section>

<Section><Heading>Equivariant CW complexes</Heading>
The 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 <M>7</M> vertices, <M>21</M> edges and <M>14</M> triangles. A minimal regular CW-complex structure for the torus has <M>4</M> vertices, <M>8</M> edges and <M>4</M> cells of dimension <M>2</M>. 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 <M>1</M> vertex, <M>3</M> edges and <M>2</M> cells of dimension <M>2</M>. By using non-regular CW-complexes one obtains a minimal cell structure involving <M>1</M> vertex, <M>2</M> edges and <M>1</M> cell of dimension <M>2</M>.
Minimal cell structures (in the four different categories) for the torus are illustrated as follows.  

<P/><Alt Only="HTML">&lt;img src="images/mstorus.png" align="center" width="300" alt="minimal simplicial torus"/></Alt>
<Alt Only="HTML">&lt;img src="images/mrtorus.png" align="center" width="300" alt="minimal regular CW torus"/></Alt>
<P/><Alt Only="HTML">&lt;img src="images/mdtorus.png" align="center" width="300" alt="minimal delta complex torus"/></Alt>
<Alt Only="HTML">&lt;img src="images/mctorus.png" align="center" width="300" alt="minimal delta complex torus"/></Alt>

<P/>A 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 <M>\mathbb R</M> in which each each integer <M>n</M>
is a vertex and each interval <M>[n,n+1]</M> is an edge.

<P/> Simplicial 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 <M>n</M>-cube rather than an <M>n</M>-simplex). Neither of these two approaches has been implemented in <B>HAP</B>.

<P/> Simplicial sets endowed with the action of a (possibly infinite)
 group <M>G</M> 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 <E>simplicial group</E>.  Some functionality for simplicial groups is implemented in  <B>HAP</B> and described in  
Chapter <Ref Chap="chapSimplicialGroups"/>.

<P/>A regular CW-complex endowed with the action of a (possibly infinite) group <M>G</M> is an alternative approach to the efficient combinatorial
 representation of (possibly infinite) cell structures on spaces. Much of <B>HAP</B> is focused on this approach.
As a first example of the idea, the following commands construct the infinite regular CW-complex <M>Y=\widetilde T</M> arising as the universal cover of the torus
<M>T=\mathbb S^1\times \mathbb S^1</M> where <M>T</M> is given the above 
minimal non-regular CW structure involving <M>1</M> vertex, <M>2</M> edges, and <M>1</M> cell of dimension <M>2</M>.
The homology <M>H_n(T,\mathbb Z)</M> is computed and the fundamental group of the torus <M>T</M> is recovered.

<Example>
<#Include SYSTEM "tutex/1.12.txt">
</Example>

<P/>As a second example, the following comands load group number <M>9</M> in 
the library of <M>3</M>-dimensional crystallographic groups. They verify that 
<M>G</M> acts freely on <M>\mathbb R^3</M> (i.e. <M>G</M> is a
 <E>Bieberbach group</E>) and then construct a <M>G</M>-equivariant CW-complex <M>Y=\mathbb R^3</M>
corresponding to the tessellation of <M>\mathbb R^3</M> by a fundamental domain for <M>G</M>. Finally, the cohomology <M>H_n(M,\mathbb Z)</M> of the <M>3</M>-dimensional closed manifold <M>M=\mathbb R^3/G</M> is computed.
 The manifold <M>M</M> is seen to be non-orientable (since it's top-dimensional homology is trivial) and has a non-regular CW structure with <M>1</M> vertex, <M>3</M> edges, <M>3</M> cells of dimension <M>2</M>, and <M>1</M> cell of dimension <M>3</M>.
(This example uses Polymake software.)
<Example>
<#Include SYSTEM "tutex/1.13.txt">
</Example>

</Section>

<Section><Heading>Orbifolds and classifying spaces</Heading>
If a discrete group <M>G</M> acts on Euclidean space or hyperbolic space with 
finite stabilizer groups then we say that the quotient space obtained by killing the action of <M>G</M> an an <E>orbifold</E>. If the stabilizer groups are all trivial then the quotient is of course a manifold.

<P/>An orbifold is represented as a <M>G</M>-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. <B>HAP</B> stores orbifolds using the data type of <E>non-free resolution</E> and uses them mainly as a first step in constructing free <M>\mathbb ZG</M>-resolutions of <M>\mathbb Z</M>. 

<P/> The following commands use an <M>8</M>-dimensional equivariant 
deformation retract
of a
 <M>GL_3(\mathbb Z[{\bf i}])</M>-orbifold structure on hyperbolic space to compute <M>H_5(GL_3({\mathbb Z}[{\bf i}],\mathbb Z) = \mathbb Z_2^5\oplus \mathbb Z_4^2</M>.
 (The deformation retract is stored in a library and was supplied by Mathieu Dutour Sikiric.)

<Example>
<#Include SYSTEM "tutex/1.14.txt">
</Example>

The next example computes an orbifold structure on <M>\mathbb R^4</M>, 
and then the first <M>12</M> degrees of a free resolution/classifying space, for the second <M>4</M>-dimensional crystallographic group <M>G</M> in the library of crystallographic groups. 
The resolution is shown to be periodic of period <M>2</M> in degrees <M>\ge 5</M>.
 The cohomology is seen to have <M>11</M> ring generators in degree <M>2</M> and no further ring generators.  The cohomology groups are:
$$H^n(G,\mathbb Z) =\left( \begin{array}{ll} 0, &amp; {\rm odd~} n\ge 1\\
\mathbb Z_2^5 \oplus \mathbb Z^6, &amp; n=2\\
\mathbb Z_2^{15}\oplus \mathbb Z, &amp; n=4\\
\mathbb Z_2^{16}, &amp; {\rm even~} n \ge 6  .\\
\end{array}\right.$$
<Example>
<#Include SYSTEM "tutex/1.15.txt">
</Example>

<P/> A group <M>G</M> with a finite index torsion free nilpotent subgroup admits a resolution which is periodic in sufficiently high degrees if and only if all of its finite index subgroups admit  periodic resolutions. The following commands identify the <M>99</M> <M>3</M>-dimensional space groups (respectively, the <M>1191</M> 
 <M>4</M>-dimensional space groups) that admit a resolution which is periodic in  degrees <M>&gt; 3</M> (respectively, in degrees <M>&gt; 4</M>).

<Example>
<#Include SYSTEM "tutex/1.16.txt">
</Example>
 
</Section>
</Chapter>
