Cohomology with local coefficients and knotted manifolds

We show how the classical notions of cohomology with local coefficients, CW-complex, covering space, homeomorphism equivalence, simple homotopy equivalence, tubular neighbourhood, and spinning can be encoded on a computer and used to calculate ambient isotopy invariants of continuous embeddings $N\hookrightarrow M$ of one topological manifold into another. More specifically, we describe an algorithm for computing the homology $H_n(X,A)$ and cohomology $H^n(X,A)$ of a finite connected CW-complex X with local coefficients in a $\mathbb Z\pi_1X$-module $A$ when $A$ is finitely generated over $\mathbb Z$. It can be used, in particular, to compute the integral cohomology $H^n(\widetilde X_H,\mathbb Z)$ and induced homomorphism $H^n(X,\mathbb Z) \rightarrow H^n(\widetilde X_H,\mathbb Z)$ for the covering map $p\colon \widetilde X_H \rightarrow X$ associated to a finite index subgroup $H<\pi_1X$, as well as the corresponding homology homomorphism. We illustrate an open-source implementation of the algorithm by using it to show that: (i) the degree $2$ homology group $H_2(\widetilde X_H,\mathbb Z)$ distinguishes between the homotopy types of the complements $X\subset \mathbb R^4$ of the spun Hopf link and Satoh's tube map of the welded Hopf link (these two complements having isomorphic fundamental groups and integral homology); (ii) the degree $1$ homology homomorphism $H_1(p^{-1}(B),\mathbb Z) \rightarrow H_1(\widetilde X_H,\mathbb Z)$ distinguishes between the homeomorphism types of the complements $X\subset \mathbb R^3$ of the granny knot and the reef knot, where $B\subset X$ is the knot boundary (these two complements again having isomorphic fundamental groups and integral homology).


Introduction
Let f, g : N → M be two continuous cellular embeddings of a finite CW-complex N into a finite CW-complex M. A continuous cellular map H : M × [0, 1] → M, x → H t (x) is said to be an ambient isotopy between f and g if H 0 is the identity map on M, each H t is a homeomorphism from M to itself, and H 1 • f = g. We are interested in computing invariants of embeddings with a view to distinguishing between their isotopy classes. The invariants are of most interest when M and N are manifolds. For embeddings of spheres S n → S n+k interest is on the case k = 2 thanks to a result of Zeeman (1961) which states that any two embeddings are ambient isotopic (in the piece-wise linear setting) for k ≥ 3, and a result of Mazur (1959) which implies that there is again just one isotopy class of embeddings for k = 1. However, Zeeman also shows for instance that there is more than one embedding S n → S 1 × S 2n , up to ambient isotopy, for n ≥ 1 (again in the piece-wise linear setting).
The invariants we wish to calculate are the integral homology groups H k ( X H , Z) of finite covers of the complement X = M \ N, where H denotes the finite index subgroup of π 1 X arising as the image of the induced homomorphism of fundamental groups p H : π 1 X H → π 1 X. By considering a small open tubular neighbourhood N ⊂ N with boundary ∂N we can consider the inclusion map ∂N → X. Letting B = p −1 H (∂N ) denote the preimage in X H of the boundary, we also wish to calculate the induced homology homomorphism H k (B, Z) → H k ( X H , Z) as a means of distinguishing between embeddings of manifolds.
The use of homology of finite covers as an isotopy invariant is well documented in the literature. Indeed, the first integral homology, H 1 ( (S 3 \ S 1 ) H , Z), of finite coverings of knot complements was one of the earliest invariants used in the study of knot embeddings S 1 → S 3 . Accounts of methods for computing these first homology groups directly from planar knot diagrams can be found, for instance, in Fox (1954), Trotter (1962), Hempel (1984), Ocken (1990). The utility of first homology of finite coverings in knot theory suggests an analogous role for higher homology of coverings in the study of higher dimensional embeddings, especially those of codimension 2. Our aim is to describe various computer procedures for investigating the potential of this analogous role.
Our procedures involve the cellular chain complex C * X of the universal cover of a connected CW-complex X. This is a chain complex of free ZG-modules and ZG-equivariant module homomorphisms with G = π 1 X the fundamental group of X. Given a ZG-module A, the homology and cohomology of X with local coefficients in A is defined as H n (X, A) = H n ( C * X ⊗ ZG A ) and H n (X, A) = H n ( Hom ZG (C * X, A) ). (1) Note that H n ( X H , Z) = H n (X, A) when A = ZG ⊗ ZH Z. We present an algorithm for computing (1) in the case where A is a finitely generated ZG-module. The algorithm requires a CW-complex X and details of A as input. Thus, in order to apply the algorithm to questions concerning embeddings of manifolds we need to provide algorithms for converting various classical mathematical descriptions of such embeddings to embeddings of CW-complexes. We provide algorithms for this conversion for the case of embeddings N → S n+2 of an n-dimensional manifold N into an (n + 2)-sphere with n = 1 and n = 2, namely for the cases of links and surface links. The paper is organized as follows. In Section 2 we discuss the computer representation of CW-complexes. In Section 3 we demonstrate some limitations of a naive approach to computing with (regular) CW-complexes and illustrate the need for implementations of homeomorphism equivalence and homotopy equivalence. The data types, algorithms, and mathematical theory 2 underlying the computations in this section are explained in Sections 4 and 6. In Section 5 we consider the general principles involved in converting planar link diagrams to CW-structures on the complements of links in S 3 , and in converting surface link diagrams to CW-structures on the complements of surface links in S 4 . In Section 7 we provide an illustrative computation concerning complements of two surfaces K 1 , K 2 ⊂ R 4 embedded in R 4 . The surface K 1 is obtained by spinning the Hopf link in R 3 about a plane that does not intersect the link. The surface K 2 is obtained by applying the tube map of Satoh (2000) to the welded Hopf link. The complements X i = R 4 \ K i have isomorphic fundamental groups and isomorphic integral homology groups. It was shown by Kauffman and Faria Martins (2008) that the spaces X 1 , X 2 are homotopy inequivalent; their technique involves the fundamental crossed module derived from the lower dimensions of the universal cover of a space, and counts the representations of this fundamental crossed module into a given finite crossed module. We recover their homotopy inequivalence by using our algorithm to compute H 2 (X i , A) for A = Zπ 1 X i ⊗ ZH Z with H < π 1 X i a certain finite index subgroup. We intentionally use an inefficient cubical complex representation of the spaces X 1 , X 2 to demonstrate that algorithms are practical even for CW-complexes involving a large number of cells. In Section 8 we describe an algorithm that returns a regular CW-structure on the complement of the surface S (L) in R 4 obtained by spinning a link L about a plane which does not intersect L. In Section 9 we consider the granny knot κ 1 and reef knot κ 2 . The complements X i = R 3 \ κ i are well known to have isomorphic fundamental groups and different homeomorphism types. One way to distinguish between their homeomorphism types is to use the theory of quandles (see for instance Ellis and Fragnaud (2018)). We show that the homeomorphism types of these two complements can also be distinguished by the cokernels of the homology homo- where p i : X i,H → X i ranges over 6-fold covering maps, and B i ⊂ X i is the boundary of κ i . As mentioned above, the use of the pair (X, B) and of the homology of finite covers are standard tools in knot theory. Nevertheless, it seems that this method of distinguishing between the granny and reef knots is new. In Section 10 we describe an algorithm that returns a regular CW-structure on the complement of an open tubular neighbourhood of a CW-subcomplex.
The computation of cohomology with local coefficients has applications other than as an isotopy invariant. In Section 11 we establish the following Theorem 1 which was the original motivation for this work. The theorem is a fairly immediate consequence of an old result of J.H.C. Whitehead and concerns the set [W, X] φ of based homotopy classes of maps f : W → X between connected CW-complexes W and X that induce a given homomorphism φ : π 1 W → π 1 X of fundamental groups. We assume that the spaces W, X have preferred base points, that the maps f preserve base points, and that base points are preserved at each stage of a homotopy between maps. The homotopy groups of X are denoted by π n X, n ≥ 0.
Theorem 1. Let W and X be connected CW-complexes and let φ : π 1 W → π 1 X be a homomorphism between their fundamental groups. Suppose that dim W = n and that π i X = 0 for 2 ≤ i ≤ n − 1. Then there is a non-canonical bijection where the right hand side denotes cohomology with local coefficients in which π 1 W acts on H n ( X) via the homomorphism φ and the canonical action of π 1 X on H n ( X).
We say that a CW-complex is finite if it contains only finitely many cells. Let us add to the hypothesis of Theorem 1 that W, X are regular, that W, X and π 1 X are finite, that φ : π 1 W → π 1 X 3 is specified in terms of the free presentations of π 1 W, π 1 X afforded by our computer implementation, and that some faithful permutation representation π 1 X → S k is at hand. Then H n ( X) is finitely generated over Z, and our HAP implementation can in principle compute the cohomology group H n (W, H n ( X)). The complexity of the computation is polynomial in the number of cells in W and X. (This easy observation reduces to complexity bounds for Krushkal's spanning tree algorthm and for the Smith Normal Form algorithm.) Hence one can compute the set [W, X] φ in polynomial time (ignoring practical constraints such as availability of memory). This is a modest addition to deeper results inČadek et al. (2014a), Krȃźál et al. (2013Krȃźál et al. ( ),Čadek et al. (2014b which establish the existence of a polynomial-time algorithm for computing the set [W, X] of homotopy classes of maps W → X under the hypothesis that W, X are simplicial sets, that π i X = 0 for 0 ≤ i ≤ n − 1, and that dim W ≤ 2n − 2.
Section 12 provides details on how to reproduce the computations of the paper.

Representation of CW-complexes
A first issue to address in any machine computation of (1) is the machine representation of the CW-complex X. Let us briefly consider three possible representations, and then opt for a fourth which seems better suited to our needs. Consider the torus T = S 1 × S 1 with CW-structure involving a single 0-cell, two 1-cells, and a single 2-cell obtained by taking the product of two copies of the CW-complex S shown in Figure 2 (right). One possibility is to represent T as a free presentation of its fundamental group, involving 2 generators and 1 relator. This representation is readily adapted to 2-dimensional CW-complexes with more than one 0-cell, and is used by Rees and Soicher (2000) in their algorithm for computing fundamental groups and finite covers of 2dimensional cell complexes. However, the notion of a group presentation does not readily adapt to higher dimensional CW-complexes such as the product S 1 × S 1 × S 1 × S 1 of four copies of the CW-complex S . A second possibility is to subdivide the CW-structure on T = S 1 × S 1 in a way that produces a simplicial complex. It is possible to triangulate T using 7 vertices, 21 edges and 14 triangular faces; the resulting simplicial complex can be stored as a collection of subsets of the vertex set. The approach readily generalizes to CW-complexes of arbitrary dimension, but the number of simplices can become prohibitively large. For instance, the n-sphere S n admits a CWstructure with just 2 cells, whereas any homotopy equivalent simplicial complex requires at least 2 n+2 −2 simplices. A third possibility is to obtain smaller simplicial cell structures by relaxing the requirements of a simplicial complex to those of a simplicial set. The n-sphere can be represented as a simplicial set with just two non-degenerate cells. Simplicial sets, their fundamental groups, and their (co)homology with trivial coefficients have been implemented by John Palmieri in SAGE The Sage Developers (2019). We opt against using simplicial sets as the setting for our algorithms because it seems to be a non-trivial task to find small simplicial set representations of some of the CW-complexes of interest to us, such as CW-complexes arising as the complements of knotted surfaces in S 4 . In this paper we opt to represent a CW-complex X as a regular CWcomplex Y (i.e. ones whose attaching maps retrict to homeomorphisms on cell boundaries) together with a homotopy equivalence Y X. More specifically, we work with a regular CWcomplex Y, rather than a simplicial complex, and endow it with an admissible discrete vector field whose critical cells are in one-one correspondence with the cells of X. Definitions of italicized terms are recalled in Section 4 below. The arrows in a discrete vector field represent elementary simple homotopies, and can be viewed as analogues of the degeneracy maps of a simplicial set.

Limitations of naive computations
Having settled on a machine representation for CW-complexes, a second issue to consider is the size of the computations involved in a naive implementation of the cellular chain complex of spaces. Consider the CW-complex S in Figure 1 involving 16 vertices, 24 edges, and 8 square 2-cells. We may be interested in studying the direct product Y = S × S × S × S which is naturally a regular CW-complex, homotopy equivalent to the 4-torus, involving a total of 5308416 = 48 4 cells. The fundamental group π 1 Y is free abelian on four generators a, b, c, d and has a subgroup H = a 5 , b 5 , c 5 , d of index 125 = 5 3 . There is a corresponding 125-fold covering map p : Y H → Y. We may be interested in the integral homology groups H n ( Y H , Z). General theory tells us that Y H is homeomorphic to Y, but if we were ignorant of this general fact then we might consider computing the homology H n ( Y H , Z) = H n (C * Y H ) directly from the cellular chain complex of Y H . The chain complex C * Y H of the 125-fold cover can we expressed in terms of the cellular chain complex C * Y of the universal cover: with G = π 1 Y, A = ZG ⊗ ZH Z. The desired homology H n ( Y H , Z) can be viewed as the homology H n (Y, A) of Y with local coefficients in the module A. The chain complex C * Y H is a complex of free abelian groups of the following form.
It is not practical to compute H n ( Y H , Z) by applying the Smith Normal Form algorithm directly to (3). An aim of this paper is to explain how simple homotopy equivalences, represented as discrete vector fields, can be used to produce a smaller homotopy equivalent chain complex from which the homology can be computed. An implementation of the techniques is available in the HAP package Ellis (November 2019) for the GAP system for computational algebra GAP (2013), and is illustrated in the computer code of in Table 1 This computation involves a non-regular CW-complex X H which is homotopy equivalent to Y H . More precisely, X H is a finite cover of X = S × S × S × S with S the non-regular CW-complex of Figure 2   For some situations one may wish to work with a smaller regular CW-complex that is homeomorphic, and not just homotopy equivalent, to Y H . In the above example the number of cells in Y H places its direct construction out of reach of computers with modest CPU and memory. But one could try to simplify the cell structure on Y H so that it involves fewer cells. The obvious approach is to first simplify the cell structure on Y. In the above example we have Y = S × S × S × S with S the CW-complex of Figure 1. We could replace S by the homeomorphic regular CW-complex S of Figure 2 (left) and then work with the space Y = S × S × S × S which is homeomorphic to Y. Using an algorithm for simplifying the CW-structure on a regular CW-complex, the computer code in Table 2 illustrates the construction of the covering map p : Y H → Y which maps each cell of Y H homeomorphically to a cell of Y .
The data types, algorithms, and mathematical theory underlying the above example computations are explained in Sections 4 and 6.

Computing chains on the universal cover
Let Y be a connected regular CW-complex with only finitely many cells. One algorithm for constructing a finite presentation for the fundamental group G = π 1 Y was described in Brendel et al. (2015), , details of which are recalled below. It is well-known that, in general, 6  there is no algorithm for solving the word problem in the finitely presented group G. But this unsolvability of the word problem is not relevant to our goals. Let Y be the universal cover of Y with canonical CW-structure inherited from Y. The cellular chain group C n Y is a free ZGmodule whose free generators correspond to the n-cells of Y. The module C n Y can be represented on a computer by specifying the number rank ZG (C n Y) of free generators and specifying the free presentation for G. We denote by e n i an n-cell of Y, and we denote byẽ n i some preferred lift of e n i in Y. For g ∈ G we denote by gẽ n i the n-cell obtained by applying the action of g toẽ n i . We also useẽ n i to denote a free generator of the ZG-module C n Y. The boundary homomorphism ∂ n : C n Y → C n−1 Y is G-equivariant and can be represented by specifying ∂ n (ẽ n i ) for each free generator of C n Y. We now describe how an explicit expression for ∂ n (ẽ n i ) can be computed using induction on n.
We view the 1-skeleton Y 1 as a graph. Let T denote some fixed choice of maximal tree in Y 1 . The tree T has the same vertices as Y 1 but, typically, fewer edges. Each edge e in Y 1 admits two possible orientations; let us arbitrarily fix one choice of orientation for each edge. An oriented edge e in Y 1 \ T determines an oriented circuit in Y 1 whose image consists of the oriented edge e and some oriented edges from T . We denote this oriented circuit by ω(e). The association e → ω(e) induces a function ω : {edges in Y 1 \ T } −→ G. This function extends to a function ω : {edges in Y 1 } −→ G which sends oriented edges in T to the trivial element of the fundamental group.
Let F denote the free group on the symbols ω(e) where e runs over the edges in Y 1 \ T . Each 2-cell e 2 in Y 2 admits two possible orientations; let us arbitrarily fix one choice of orientation for each 2-cell. The boundary of an oriented 2-cell then spells a word in F that represents the trivial word in the fundamental group G. It is well-known Hatcher (2002), Spanier (1981) that G admits a free presentation with one generator ω(e) for each edge e ⊂ Y 1 \ T , and one relator for each 2-cell in Y.
Let us now consider how to compute an expression for the boundary ∂ n (ẽ n i ) of each free generator of the ZG-module C n ( Y). We first consider the case n = 1. The 1-cellẽ 1 i in Y maps to the 1-cell e 1 i in Y. Suppose that e 0 j , e 0 k are the two boundary vertices of e 1 i , and that the orientation of e 1 i corresponds to a direction which starts at e 0 j and ends at e 0 k . Suppose also that in the cellular chain complex, which involves choices of orientation, the boundary homomorphism satisfies Then we set with i = ±1. Having computed (6) it remains to determine representatives of group elements g i 1 , . . . , g i m in the finitely presented group G such that the element satisfies ∂ n (∂ n+1ẽ n+1 i ) = 0. We set g i 1 = 1 ∈ G. Suppose ∂(g i 1ẽ n i 1 ) contains ±hẽ n−1 j as a summand, some h ∈ G. Then for some i j i 1 the boundary ∂(ẽ n i j ) must contain ∓h ẽ n−1 j as a summand for some h ∈ G. In (7) we set g i j = hh −1 . We continue with this method of matching summands in the boundaries ∂ẽ n i k in order to determine all the g i k in (7). Note that the method does not require a solution to the word problem in the finitely generated group G.
Suppose given a finitely generated abelian group A and group homomorphism φ : G → Aut(A) specified on generators of G. This data constitutes a ZG-module A. Starting from our computer representation of the chain complex C * Y, it is routine to implement the cochain complex Hom ZG (C * Y, A) of finitely generated abelian groups, and also the chain complex C * Y ⊗ ZG A. In particular, given a finite set of elements in G that generates a finite index subgroup H < G, we can use coset enumeration to construct the ZG-module A = ZG ⊗ ZH Z; in this case the chain complex C * Y ⊗ ZG A can be viewed as the chain complex C * Y H of the finite covering space p : Y H Y with p inducing an isomorphism π 1 Y H H. Since Y H is a regular CW-complex, its CW-structure (i.e. its face lattice) is completely determined by the chain complex C * Y H . Thus, in principle, we have an algorithm for computing the finite cover Y H . Furthermore, in principle, the Smith Normal Form algorithm can be used to compute the local cohomology H n (Y, A) and homology H n (Y, A) for any ZG-module A which is finitely generated over Z.
However, for practical computations, such as those in Tables 1 and 2, there are two issues with the above theoretical algorithm. Firstly, if the above method is applied directly then the finitely presented fundamental group G = π 1 Y will typically involve excessive numbers of generators and relators. These numbers need to be reduced in a way that retains the relationship between the finite presentation and the cellular structure of Y if, for instance, one wants to apply coset enumeration and the Reidemeister-Schreier algorithm to list free presentations of subgroups H ≤ G of given index k in order to enumerate all k-fold covers of Y. Table 3 provides a computation in which such an enumeration is needed. Secondly, the number of cells in Y will typically be large, and consequently the number of generators of the chain groups C n Y ⊗ ZG A will typically make it impractical to apply the Smith Normal Form algorithm directly to the chain complex C * Y ⊗ ZG A or cochain complex Hom ZG (C * Y, A). We need a method for reducing the number of cells in Y and Y in a way that retains the homotopy types of Y and Y or even, for some purposes, their homeomorphism types. The code in Table 1 reduces the number of cells while retaining only the homotopy type of Y. The code in Table 2 retains the homeomorphism type of Y. We now describe our approach to addressing these practical issues.
Let us first recall from Ellis (2019) a simple method aimed at reducing the number of cells in a regular CW-complex Y while retaining the homeomorphism type of Y. The simplification procedure invoked in the computer code of Table 2 is based on the observation that if a regular CW-complex Y contains a k-cell e k lying in the boundary of precisely two (k + 1)-cells e k+1 1 , e k+1 2 with identical coboundaries then these three cells can be removed and replaced by a single cell of dimension k + 1. The topological space Y is unchanged; only its CW-structure changes. The resulting CW-structure will not in general be regular. However, it will be regular if the sets V 0 , V 1 , V 2 of cells lying in the boundaries of e k , e k+1 1 , e k+1 2 respectively are such that V 1 ∩ V 2 = V 0 ∪ {e k }. The result of this kind of simplification procedure is illustrated in Figure 3. The procedure is formalized as Algorithm 4.1. It can be useful, for instance, in the study of the homeomorphism type of CW-complexes Y arising as knot complements in R 3 , especially when Y is constructed from experimental data, such as knotted proteins, with natural CW-structure involving a vast number of cells (see Brendel et al. (2015)).
We now turn to a method for reducing the number of cells in Y in a way that retains only the homotopy type of Y. For this we first recall the following notion.
Algorithm 4.1 Simplification of a regular CW-structure. Require: A regular CW-complex Y. Ensure: A regular CW-complex X with S ize(X) ≤ S ize(Y) and with |X| homeomorphic to |Y|.
1: procedure 2: Let X be a copy of Y.

3:
while there exists a cell e k in X with precisely two cells e k+1 1 , e k+1 2 in its coboundary and these two cells have identical coboundaries do 4: Compute the sets V 0 , V 1 , V 2 of cells in the boundaries of e k , e k+1 1 , e k+1 2 .

5:
if Remove the cells e k , e k+1 1 , e k+1 2 from X and add a new (k + 1)-cell f k+1 to X whose boundary is the union of the boundaries of e k+1 1 and e k+1 2 minus the cell e k . Adjust coboundaries accordingly. Return X. 10: end procedure Definition 4.1. A discrete vector field on a regular CW-complex Y is a collection of pairs (s, t), which we call arrows and denote by s → t, satisfying 1. s, t are cells of X with dim(t) = dim(s) + 1 and with s lying in the boundary of t. We say that s and t are involved in the arrow, that s is the source of the arrow, and that t is the target of the arrow. 2. any cell is involved in at most one arrow.
The term discrete vector field is due to Forman (1998). In an earlier work Jones (1988) Jones calls this concept a marking.
A discrete vector field is said to be finite if it consists of just finitely many arrows. By a chain in a discrete vector field we mean a sequence of arrows where s i+1 lies in the boundary of t i for each i. A chain is a circuit if it is of finite length with source s 1 of the initial arrow s 1 → t 1 lying in the boundary of the target t n of the final arrow s n → t n . A discrete vector field is said to be admissible if it contains no circuits and no chains that extend infinitely to the right. When the CW-complex Y is finite a discrete vector field is admissible if it contains no circuits. We say that an admissible discrete vector field is maximal if it is not possible to add an arrow while retaining admissibility. A cell in X is said to be critical if it is not involved in any arrow.
Theorem 2. Forman (2002Forman ( , 1998 If Y is a regular CW-complex with admissible discrete vector field then there is a homotopy equivalence Y X where X is a CW-complex whose cells are in one-one correspondence with the critical cells of X. An arrow on Y can be viewed as representing a simple homotopy, as introduced in Whitehead (1950). The theorem just says that an admissible discrete vector field represents some sequence of (in some sense 'composable') simple homotopies starting at Y and ending at X.
There are various algorithms for constructing an admissible discrete vector field on a finite regular CW-complex Y. The algorithm implemented in the HAP package is Algorithm 4.2, which we recall from Ellis and Hegarty (2014), . In line 2 of the algorithm the cells could Algorithm 4.2 Discrete vector field on a regular CW-complex. Require: A finite regular CW-complex Y Ensure: A maximal admissible discrete vector field on Y.
1: procedure 2: Partially order the cells of Y in any fashion.

3:
At any stage of the algorithm each cell will have precisely one of the following three states: (i) critical, (ii) potentially critical, (iii) non-critical.

4:
Initially deem all cells of Y to be potentially critical. Choose such a pair (s, t) with s minimal in the given partial ordering.

8:
Add the arrow s → t and deem s and t to be non-critical. end while 14: end procedure be partially ordered in some way that ensures any cell of dimension k is less than all cells of dimension k + 1. This partial ordering guarantees that the resulting discrete vector field on a path-connected regular CW-complex Y will have a unique critical 0-cell.
A CW-complex X is said to be reduced if it has only one cell in dimension 0. There is a standard correspondence between the 2-skeleton of such a space and a presentation of its fundamental group G = π 1 X. This correspondence together with Theorem 2 and Algorithm 4.2 constitute our algorithm for finding a presentation for the fundamental group of any connected CW-complex Y. The presentation has one generator for each critical 1-cell of Y and one relator for each critical 2-cell. Each oriented critical 2-cell e ⊂ Y determines an oriented circuit ω(e) in Y 1 ; the discrete vector field provides a deformation of this circuit ω(e) into a circuit ω (e) each of whose oriented edges t is either critical or else the target of some arrow s → t with s a 0-cell. The subsequence of ω (e) consisting of the oriented critical edges spell a word in the free group on the generators of the presentation. For illustrations and further details of this algorithm see Brendel et al. (2015), .
Let us now address the question of how to reduce the number of cells in the universal cover Y of a connected regular CW-complex in a way that retains its homotopy type. It suffices to note that any discrete vector field on Y induces a discrete vector field on Y: there is an arrows →t on Y if and only if if s → t is an arrow on Y wheres,t are cells in the universal cover that map to s, t , and wheres lies in the boundary oft. Furthermore, if the discrete vector field on Y is admissible then so too is the induced vector field. Let X Y be the homotopy equivalence of Theorem 2. This equivalence induces a homotopy equivalence of universal covers X Y and a chain homotopy equivalence of cellular chain complexes C * X C * Y. The cells in X are in one-one correspondence with the critical cells in the induced discrete vector field on Y. The cellular chain complex C * X on the (typically non-regular) CW-complex X is readily constructed directly from the cell structure and admissible discrete vector field of Y. This construction is implemented in HAP as the function ChainComplexOfUniversalCover(Y) which inputs Y, constructs a maximal discrete vector field on Y, uses this vector field to compute a presentation for π 1 Y π 1 X, and finally returns the π 1 Y-equivariant chain complex C * ( X).

From diagrams to CW-complexes
Suppose that N is a compact topological submanifold of R n+2 with n = 1 or 2, and that p : R n+2 R n+1 is a projection onto a hyperplane. Let M ⊂ R n+2 denote a submanifold homeomorphic to the closed unit disk, whose interiorM contains N. Set D n+1 = p(M). We say that the pair p(N) ⊂ D n+1 is a diagram for N. Under fairly general conditions it is possible to embellish the diagram with information on the preimage p −1 (y) of certain points y ∈ N so that the ambient isotopy type of the embedding N → R n+1 can be recovered from the embellishment. We are then interested in using the embellished diagram to construct a regular CW-structure on M containing a CW-subspace ambient isotopic to N. We illustrate the idea with several examples.

A closed
As an illustration let us consider the trefoil knot whose embedding κ : S 1 → R 3 is illustrated in Figure 4 (left). We set N equal to the image of κ. A diagram (D 2 , p(N)) for the trefoil is shown in Figure 4 (middle). A CW-structure on D 2 is shown in Figure 4 (right). The CW-structure is designed to reflect the under crossing/over crossing structure of the knot projection. Let the unit interval [0, 1] be given a CW-structure involving two 0-cells and one 1-cell. The CW-complex  formed by adjoining a 2-cell and 3-cell to each end of the cylinder D 2 × [0, 1] is homeomorphic to a 3-ball M and contains, in its interior, a CW-subcomplex N ambient isotopic to the trefoil knot (see Figure 5). The construction of this CW-structure on the trefoil embedding readily extends to an algorithm which inputs a symbolic representation of a knot or link and returns a CW-decomposition of a 3-ball M containing the knot or link as a subcomplex of the 1-skeleton.
We are interested in studying the complement M \ N. However, the difference of CWcomplexes is not a CW-complex. This technicality can be overcome by constructing a small open tubular neighbourhood N of N and extending the cell structure on M \ N to a CW-structure on M \ N . Details of the construction are given in Section 10.

A 3-manifold N in R 3 , and the complement of its interior.
There are a number of succinct symbolic representations of links in R 3 . One representation is based on arc diagrams of links such as the arc diagram for the trefoil shown in Figure  An arc diagram leads to a very natural, though somewhat inefficient, representation of the corresponding link as a 3-dimensional CW-manifold N with boundary. To explain how, we endow R n with the regular CW-structure in which each n-cell has closure equal to a unit cube with standard CW-structure and with centre an integer vector c ∈ Z n . A finite CW-subcomplex of R n is said to be an n-dimensional cubical complex. Such a complex is said to be pure if each cell lies in the closure of some n-cell. An arc presentation for N gives rise in a fairly obvious fashion to a diagram (D 2 , p(N)) with D 2 a 2-dimensional pure cubical complex homeomorphic to a disk. Now let the real interval [0, 5] be given a CW-structure with integers the 0-cells. The desired 3-dimensional pure cubical complex N is realized as a CW-subcomplex of the direct product D 2 × [0, 5]. 13 The 3-dimensional pure cubical complex N corresponding to the example list for the trefoil is shown in Figure 6 (right). Let M denote a contractible pure cubical complex in R 3 whose interior contains N . Then the complement X = M \N is a pure cubical complex homotopy equivalent to the complement R 3 \ N . The construction of the CW-complex X is implemented in HAP, with M chosen to be a minimal solid rectangular pure cubical complex whose interior contains N . For the trefoil knot of Figure 6 (right) the implemented CW-complex X contains 13291 cells.

A more efficient complement of the interior of a 3-manifold
Pure cubical complexes are particularly useful as a tool for converting a range of experimental data into regular CW-complexes in order to analyse underlying topological features (see for instance Ellis (2019)). However, the resulting CW-complexes tend to be large and cumbersome to work with on a computer. From the viewpoint of theoretical knot theory, one would like algorithms for converting a symbolic description of a link or knotted surface complement into a regular CW-complex with relatively few cells so that computations of fundamental groups and local cohomology run efficiently. We now explain, in four steps, how to construct a smaller CW-structure on the complement Y = M \N of a link N arising from an arc presentation .
Step 1. Let us suppose that the arc diagram for the list involves precisely h horizontal lines and precisely k crossings. Let D 2 denote the unit 2-disk with 2h non-overlapping subdisks removed. The arc diagram for then determines a (nearly) canonical CW structure on D 2 . This is illustrated in Figure 7 for the trefoil. (The CW structure could be made canonical by, for instance, insisting that the two 0-cells on the boundary of the disk be connected to the bottom left-most and top right-most vertices of the inner diagram.) In general the CW structure has V = 4h+4k +2 vertices, E = 8h + 8k + 4 edges, and E − V − 2h + 1 cells of dimension 2. The formula for the number of 2-cells is derived from the Euler characteristic χ(D 2 ) = 1 − 2h. The space D 2 has a total of 14h + 16k + 9 cells.
Step 2. Let I denote the unit interval with CW-structure involving two vertices and one edge. Now form the direct product D 2 × I. This is a CW-complex which we view as a solid cylinder from which 2h vertical tubes, running from bottom to top, have been removed. It involves a total of 3(14h + 16k + 9) cells. Step 3. Corresponding to each horizontal line in the arc diagram glue one 2-cell to the bottom of D 2 × I, and corresponding to each vertical line in the arc diagram glue one 2-cell to the top of D 2 × I. More precisely, these 2h 2-cells are glued so that the resulting CW-complex W = D 2 × I ∪ 2h i−1 e 2 is homotopy equivalent to the link complement R 3 \ M .
Step 4. Glue one 3-cell and one 2-cell to the bottom of W , and glue one 3-cell and one 2-cell to the top of W in a way that the resulting CW-complex Y = W ∪ 2 i=1 e 2 ∪ 2 i=1 e 3 is homeomorphic to M \N . The CW-complex Y involves a total of 3(14h + 16k + 9) + 2h + 4 cells.

A closed 2-manifold N in R 4 .
In order to specify an embedding N → R 4 of a closed surface N we can start by specifying a diagram (D 3 , p(N)) with D 3 a regular CW-complex homeomorphic to a closed 3-ball, and with p(N) ⊂ D 3 a CW-subcomplex lying in the interior of D 3 . The CW-subcomplex p(N) need not be a surface; we allow it to have singular points y ∈ p(N) for which there exists no open set of p(N) containing y and homeomorphic to an open 2-disk. But we do require the collection of singular points to be either empty or to form a closed 1-manifold. For instance, in the usual projection of the Klein bottle into R 3 the singular points form a circle (see Figure 8). We say that the CW-complex p(N) is a self-intersecting surface. To complete the specification of the embedding of the surface N we set M = D 3 × [0, k] where k is a positive integer and the interval is given a CW-structure with 0-cells the integers. Let p : M D 3 be the projection. To specify a CW-manifold N ⊂ M we just need to specify, in some fashion, the cells in the preimage p −1 (e) for each cell e ⊂ p(N).
The discussion in Subsection 5.3 can be interpreted as a method for representing an embedding of one or more tori into R 3 by means of an arc presentation. This representation is readily extended to one for self-intersecting tori whose singular points form a 1-manifold.
Given an embedding of a closed surface N into R 4 , we can then construct a small open tubular neighbourhood N of N and extend the cell structure on M \ N to a CW-structure on M \ N . Details of the neighbourhood construction are given in Section 10.

Some data types
For completeness, we recall from Ellis (2019) the main data types used in implementing the above discussion.
Data type 6.1. A regular CW-complex X is represented as a component object X with the following components: a list of integers [t, a 1 , ..., a t ] recording that the a i th cell of dimension n − 1 lies in the boundary of the kth cell of dimension n.
• X!.coboundaries [n][k] is a list of integers [t, a 1 , ..., a t ] recording that the kth cell of dimension n lies in the boundary of the a i th cell of dimension n + 1.
• X!.nrCells(n) is a function returning the number of cells in dimension n.
• X!.properties is a list of properties of the complex, each property stored as a pair such as ["dimension", 4].
Data type 6.2. A discrete vector field on a regular CW-complex is represented as a regular CWcomplex X with the following additional components, each of which is a 2-dimensional array: Data type 6.3. A G-CW-complex Y with regular CW-structure is represented by a component object Y which consists of the following components: • Y!.group is a group G. (This can be stored in one of several possible formats including: finitely presented group; matrix group; power-commutator presented group; finite permutation group ... .) • Y!.elts is a list of some of the elements of G.
• Y!.dimension(n) is a function that returns a non-negative integer equal to the number of distinct G-orbits of n-dimensional cells in the G-equivariant CW-complex |Y| modelled by the data type. We let e n k denote a fixed representative of the kth orbit of n-dimensional cells.
• Y!.stabilizer(n,k) returns the subgroup of G consisting of those elements φ ∈ G that map e n k homeomorphically to itself. • Y!.boundary(n,k) returns a list [[i 1 , g 1 ], . . . , [i m , g m ]] where each term [i, g] is a pair of nonzero integers with g positive. A pair [i, g] records that φ g (e n−1 |i| ) lies in the boundary of e n k , where φ g is the gth term of the list Y!.elts. (The sign of i plays a role when we consider homology.) • Y!.properties is a list of properties of the space, each property stored as a pair such as ["dimension", 4].
Data type 6.4. A chain complex C * of finitely generated free modules over Z is represented as a component object C with the following components: • C!.dimension(k) is a function which returns the rank of the module C k .
• C!.boundary(k,j) is a function which returns the image in C k−1 of the jth free generator of C k . Elements in C k−1 are represented as vectors (i.e. lists) over Z of length equal to the rank of C k−1 . 16 Figure 9: Union of two 3-dimensional pure cubical complexes, each homotopy equivalent to a torus.
• C!.properties is a list of properties of the complex, each property stored as a pair such as ["length", 4].

The spun Hopf link and the tube of the welded Hopf link
We now give a computer proof of a variant on Theorem 10 in Kauffman and Faria Martins (2008). We opt to work in the inefficient category of pure cubical complexes as a means of demonstrating that computations are practical even when CW-complexes involve large numbers of cells. Figure 9 shows a 3-dimensional pure cubical complex Y formed from the union of two intersecting pure cubical subcomplexes each of which is homotopy equivalent to a torus. The space Y is a union of 1632 cubical 3-cubes. The four horizontal rectangular tubes of Y have a 3 × 3 cross section. The four vertical rectangular tubes of Y have a 7 × 7 cross section. The central axes of the horizontal tubes and vertical tubes lie in a common plane. We use Y to construct two 4-dimensional pure cubical complexes S and T as follows.
To construct S we first assign integers t, called temperature, to each 3-cube of Y. To most 3cubes we assign a single temperature t, but a few 3-cubes are assigned three temperatures. All 3cubes in the top and bottom horizontal rectangular tubes are assigned one temperature t = 0. All 3-cubes in the four vertical rectangular tubes are again assigned the one temperature t = 0. The middle two horizontal rectangular tubes each have length 25. In these two tubes the x-coordinate of a cube's centre determines its temperature(s) according to the profiles shown in Figure 10. Profile 1 is the cross sectional temperature profile of the upper-middle horizontal tube of Y; the lower-middle horizontal tube of Y is assigned Profile 2. The space S is the 4-dimensional pure cubical complex whose 4-cubes are centred on the integer vectors (x, y, z, t) where (x, y, z) is the centre of a 3-cube of Y with temperature t. The space S is homotopy equivalent to a disjoint union of two tori.
Profile 1: LetS andT denote the interiors of S and T . The complements R 4 \S and R 4 \T are subcomplexes of the CW-complex R 4 , both involving infinitely many cells. It is straightforward to construct finite deformation retracts X S ⊂ R 4 \S and X T ⊂ R 4 \T where X S and X T are 4-dimensional pure cubical complexes. The computer code of Table 3 computes a CW-complex X T involving 4508573 cells, together with a sorted list Inv(X T ) of all possible abelian invariants of the second homology groups H 2 ( X H , Z) of 5-fold covering spaces X H for X T . The list Inv(X T ) is an invariant of the homotopy type of X T , and establishes that there are 5-fold covers with H 2 ( X H , Z) = Z 12 and 5-fold covers with H 2 ( X H , Z) = Z 16 . Similar commands can be applied to X S to find that for all 5-fold covers X H we have H 2 ( X H , Z) = Z 12 . Alternatively, this information on X S can be computed more efficiently using lines 3-7 in the code of Table 4 which is based on techniques explained in Section 8. Hence X T is not homotopy equivalent to X S .
Further GAP commands establish that H 0 (X T , Z) = Z, H 1 (X T , Z) = Z 2 , H 2 (X T , Z) = Z 4 , H 3 (X T , Z) = Z 2 , H n (X T , Z) = 0 for n ≥ 4, and that π 1 X T π 1 X S C ∞ × C ∞ , H n (X S , Z) = H n (X T , Z) for n ≥ 0. These further commands are contained in the file jsc2021-5 detailed in Section 12. So this is an example where the fundamental group and homology with trivial integral coefficients fail to distinguish between two homotopy inequivalent spaces, but where the second homology with twisted coefficients does succeed. Figure 12 shows an example of a classical planar diagram of a link (the Hopf link) and an example of a welded diagram (the welded Hopf link). Such a classical or welded link diagram L Classical Hopf link L 1 Welded Hopf link L 2 Figure 12: Classical and welded link diagrams gives rise to an embedding of a closed surface tube(L) into R 4 via the tube map of Satoh (2000). The surface tube(L) contains one knotted torus tube(K) for each component K of L. A good explanation of the tube map is given on Youtube in Davit (2017). It is shown in Satoh (2000) that for a classical link diagram L the knotted surface tube(L) ⊂ R 4 is the same as the surface obtained by spinning (i.e. rotating) the link about a plane that does not intersect the link. See Section 8 for further details on spun links. An algebraic invariant of the homotopy type of the complement X L = R 4 \ tube(L) is introduced in Martins (2007), Martins (2009) and used in Kauffman and Faria Martins (2008) to show, for instance, that the classical Hopf link diagram L 1 and the welded Hopf link diagram L 2 (see Figure 12) yield spaces X L 1 and X L 2 with different homotopy types. Consequently the knotted surface tube(L 1 ) is not ambient isotopic to the knotted surface tube(L 2 ). Their algebraic invariant is based on J.H.C. Whitehead's concept of a crossed module.
The above space T can be viewed as a thickening of two knotted tori in R 4 . The complement R 4 \ T is readily seen to be homeomorphic to the space X L 2 associated to the welded Hopf link diagram. The complement R 4 \ S is homeomorphic to the space X L 1 associated to the classical Hopf link diagram. Hence the above computation illustrates how the homotopy inequivalence of X L 1 and X L 2 can be recovered using a GAP computation of second homology with local coefficients. The computation also yields the following analogue of Theorem 10 of Kauffman and Faria Martins (2008). For its statement we define the invariant I c (Σ) of a knotted surface Σ ⊂ R 4 to be ;; gap> C:=ChainComplexOfUniversalCover(SY);; gap> L:=Filtered(LowIndexSubgroupsFpGroup(C!.group,5),g->Index(C!.group,g)=5);; gap> SSortedList(List(L,g->Homology(TensorWithIntegersOverSubgroup(C,g),2))); [ [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ] ] gap> YY:=SimplifiedComplex(Y); Regular CW-complex of dimension 3 gap> Size(YY); 103 Theorem 3. The invariant I c (Σ) of knotted surfaces is powerful enough to distinguish between knotted surfaces Σ, Σ ⊂ R 4 , with Σ diffeomorphic to Σ and whose complements have isomorphic fundamental groups and isomorphic integral homology, at least in one particular case.

Spinning
As in Subsection 5.3, let Y denote a regular CW-complex arising from the complement of a link specified by an arc presentation . The CW-complex Y is implemented in HAP. The first two computer commands in Table 4 construct the complement of the classical Hopf link and display that it involves 303 cells. To explain the remaining commands in Table 4 we recall details on a spinning construction for links, the origins of which go back to Artin (1925). He used spinning to construct 4-dimensional knots from classical knots, but we shall give a more general topological description.
Let X be a topological space with subspace B. We define the space obtained by spinning X about B to be An alternative spaceŜ B (X) can be formed from X using the closed 2-disk D 2 and its boundary circle S 1 . We setŜ The spaceŜ B (X) is homotopy equivalent to S B (X). The spaceŜ B (X) rather than S B (X) is implemented in HAP. More precisely, suppose that X is a regular CW-complex with subcomplex B ⊂ X. Let D 2 be given a regular CW structure involving two 0-cells, two 1-cells and one 2-cell. Then the direct product X × D 2 is naturally a regular CW-complex, andŜ B (X) is a subcomplex. It is this subcomplex that is implemented.
Artin was interested in the case where X = {(x, y, z) ∈ R 3 : z ≥ 0} and B = {(x, y, z) ∈ R 3 : z = 0}. In this case S B (X) is homeomorphic to R 4 , and any knot κ embedded in the interior of 20 Figure 13: The granny knot (left) and reef knot (right).
X gives rise to a knotted torus S ∅ (κ) in R 4 . More generally, a link κ gives rise to an embedded surface S ∅ (κ) ⊂ R 4 . The complement R 4 \ S ∅ (κ) is homeomorphic to S B (X \ κ).
The middle four lines of computer code in Table 4 show that for the Hopf link κ, for Y = R 4 \ S ∅ (κ), and for any 5-fold covering space Y H → Y we have H 2 ( Y, Z) = Z 12 . By a result of Satoh (2000) the complement Y of the spun link is homeomorphic to the tube construction for the classical Hopf diagram.
The final two computer commands in Table 4 show that Algorithm 4.1 can be used to simplify the CW-structure on the complement of the classical Hopf link to a CW-structure involving just 103 cells.

The granny and reef knots
Arc diagrams for the granny knot κ 1 and reef knot κ 2 are shown in Figure 13. Regarding a knot as a 1-dimensional subspace of R 3 we define X 1 = R 3 \κ 1 and X 2 = R 3 \κ 2 . Using the method of Subsection 5.3 we can construct a finite CW-complex Y i whose interior is homeomorphic to X i , i = 1, 2. The FundamentalGroup(Y) function in HAP can be used to compute presentations for π 1 Y i , i = 1, 2. Tietze moves can be used to establish an isomorphism π 1 Y 1 π 1 Y 2 . Therefore knot invariants, such as the Alexander polynomial, which are based entirely on the knot group are unable to distinguish between the granny and the reef knots. More precisely, they are unable to distinguish between the homeomorphism types of Y 1 and Y 2 .
The integral homology of Y 1 and Y 2 is readily computed and the spaces turn out to have the same integral homology.
Let us view X i as the interior of Y i . Let B i denote the boundary of a 3-dimensional small open tubular neighbourhood of the knot κ i . Then B i is a 2-dimensional CW-subspace of Y i . The subspace B i is homeomorphic to a torus. The BoundaryMap(Y) function in HAP can be used to construct an inclusion f i : B i → Y i of CW-subspaces where B i is the smallest CWsubspace containing those 2-cells of Y i that lie in the boundary of exactly one 3-cell. Thus B i is a disjoint union of B i with a 2-sphere S 2 . We are interested only in first integral homology H 1 (B i , Z) = H 1 (B i , Z) and so there is no difference if we work with B i or with B i , except that B i is a little easier to constuct.
For any finite index subgroup H ≤ π 1 Y i the HAP functions U:=UniversalCover(Y) and p:=EquivariantCWComplexToRegularCWMap(U,H) can be used to construct the covering map p i : Y i,H → Y i which sends π 1 Y i,H isomorphically onto the subgroup H. We can then use the function LiftedRegularCWMap(f,p) to constuct the subspace p −1 i (B i ) ⊂ Y i,H that maps onto 21 The collection of all abelian groups coker( f i, j ) arising as the cokernel of f i, j is a homeomorphism invariant of Y i .
For the reef knot κ 2 and some choice of subgroup H < π 1 Y 2 of index 6 and some choice of path component P 2, j , we find that coker( f 2, j ) = Z ⊕ Z 2 ⊕ Z 2 ⊕ Z 8 . However, for the granny knot κ 1 we find coker( f 1, j ) Z ⊕ Z 2 ⊕ Z 2 ⊕ Z 8 for all subgroups H < π 1 Y 1 of index 6 and all path components P 1, j . We conclude that Y 1 is not homeomorpic to Y 2 .
These computations motivate the definition of the ambient isotopy invariant J c (κ) of a link κ ⊂ R 3 as J c (κ) = Set of isomorphism types of abelian groups arising as coker(h j : H 1 (B j , Z) → H 2 ( X H , Z)) for some c-fold cover p : X H → X of X = R 3 \ κ, and for B j some path component of p −1 (B), where B is the boundary of a small tubular neigbourhood of κ.
We have proved the following.
Theorem 4. The invariant J c (κ) is powerful enough to distinguish between knots κ, κ ⊂ R 3 whose complements have isomorphic fundamental groups and isomorphic integral homology, at least in one particular case.
The computations underlying this section can be reproduced by running the example jsc2021-6 of Section 12 in GAP.

Tubular neighbourhoods and their complements
In this section we consider a finite regular CW-complex X containing a CW-subspace Y ⊂ X, and describe the construction of a finite CW-complex W that models the complement X \ N (Y) of a small open tubular neighbourhood of Y. We avoid giving a precise definition of the open subspace N (Y) ⊂ X (which is routinely formulated under the additional assumption that X is piece-wise Euclidean), and focus instead just on a precise description of W. The examples we have in mind are where X is a contractible compact region of R n for n = 3, 4 and Y is an embedded circle in the case n = 3 or an embedded surface in the case n = 4. The second author plans to describe applications of a computer implementation of this construction in a subsequent paper.
To describe a procedure for constructing the space W we first introduce some terminology and notation for enumerating the cells of W and for describing their homological boundaries.
The CW-complex W will consist of all of the cells in X \ Y together with extra cells. We say that a cell of W is internal if it lies in X \ Y, and that it is external otherwise. The complement 22 X \ Y is a cell complex -a union of open cells -but it is not in general a CW-complex. The external cells ensure that W is a CW-complex. Figure 14 (left) shows a contractible compact region X in the plane R 2 endowed with a CWstructure involving 8 2-cells and various cells of dimension 1 and 0. A 1-dimensional subcomplex Y ⊂ X, involving two 1-cells and three 0-cells, is shown in bold. An open tubular neighbourhood N (Y) ⊂ X is shown in dark grey. Figure 14 (right) shows the CW-complex W corresponding to this particular choice of X and Y.
The closure e n of any n-cell e n ⊂ X is a finite CW-subcomplex of X. For an internal n-cell e n ⊂ X \ Y the intersection e n ∩ Y is also a CW-subcomplex of X, which we can express as a union e n ∩ Y = A e n 1 ∪ A e n 2 ∪ · · · A e n k of its path-components A e n i . Each A e n i is a CW-subcomplex of Y. Let us make the following simplifying assumption. When a space fails to meet the assumption it is sometimes possible to apply barycentric subdivision to offending top-dimensional cells (or possibly some less costly subdivision) in order to modify the CW structure so that it does satisfy the assumption.
Simplifying assumption: Let us suppose that each A e n i is contractible. Under this assumption the CW-complex W has precisely one internal n-cell e n for each cell e n ⊂ X \ Y, and precisely one external (n − 1)-cell f e n A i for each path-component A i of e n ∩ Y.
The cellular chain complex C * W is generated in degree n by the n-cells e n of W. By the homological boundary of e n we mean its image de n under the boundary homomorphism d : C n W → C n−1 W. The homological boundary de n is a sum of finitely many distinct (n − 1)cells each occuring with coefficient ±1. We'll abuse terminology and say that de n is a sum of these distinct (n − 1) cells (without mentioning that coefficients are ±1 in the sum).
The homological boundary of an internal cell e n in W is a sum of all the internal (n − 1)-cells lying in e n together with all external (n − 1)-cells f e n A i with A i a path-components of e n ∩ Y. The homological boundary of an external (n − 1)-cell f e n A i is a sum of all those external (n − 1)-cells f e n−1 B with e n−1 an (n − 1)-cell of e n and path-component B of e n ∩ Y with B ⊆ A i .
Algorithm 10.1 Excise an open tubular neighbourhood from a regular CW-complex. Require: A finite regular CW-complex X and subcomplex Y ⊂ X satisfying the above simplifying assumption. Ensure: A finite regular CW-complex W.
1: procedure 2: For each internal cell e n ⊂ X \ Y compute the CW-complex e n ∩ Y and express it as a union e n ∩ Y = A e n 1 ∪ A e n 2 ∪ · · · A e n k of its path-components A e n i . This determines the number of cells of each dimension in W. For 0 ≤ n ≤ dim X set B[n + 1] = [b 1 , b 2 , · · · , b α n ] where α n denotes the number of n-cells in W and b i is a list of integers determining the (n − 1)-cells with non-zero coefficient in the homological boundary of the i-th n-cell of W. In the ordering of n-cells it is convenient to order all internal cells before any external cell.

5:
Represent the data in B as a regular CW-complex W and return W. 6: end procedure

A homotopy classification of maps
Our original motivation for attempting computations of local cohomology is a classical result of Whitehead concerning the set [W, X] φ of based homotopy classes of maps f : W → X between connected CW-complexes W and X that induce a given homomorphism φ : π 1 W → π 1 X of fundamental groups. As mentioned in the Introduction, we assume that the spaces W, X have preferred base points, that the maps f preserve base points, and that base points are preserved at each stage of a homotopy between maps. The homotopy groups of a space X are denoted by π n X, n ≥ 0. A chain map χ * : C * W → C * X between cellular chain complexes of universal covers is said to be φ-equivariant if χ n (gw) = φ(g)χ n (w) for all g ∈ π 1 W, w ∈ C n W, n ≥ 0. Two such φ-equivariant chain maps χ * , ψ * : C * W → C * X are said to be based chain homotopic if there exist φ-equivariant homomorphisms h i : C i W → C i+1 X for i ≥ 0, such that for w ∈ C i W and h −1 = 0. Based chain homotopy is an equivalence relation and we denote by [C * W, C * X] φ the set of based chain homotopy classes of φ-equivariant chain maps C * W → C * X.
The following theorem is proved in Whitehead (1949).
Theorem 5 (Whitehead). Let W, X be connected CW-complexes, and let φ : π 1 W → π 1 X be a group homomorphism. Suppose that W is of dimension n and that π i X = 0 for 2 ≤ i ≤ n − 1.
To derive Theorem 1 from Theorem 5 we need to establish a bijection [C * W, C * X] φ H n (W, H n ( X)). Let W, X and φ satisfy the hypothesis of Theorem 1. Without loss of generality, we impose the additional hypothesis that both W and X have precisely one 0-cell, say e 0 ∈ W, e 0 ∈ X, and that these 0-cells are taken to be the base points. Furthermore, we identify cells of W, X with free Zπ 1 -generators of C * X, C * W. Let f : W → X be a cellular map inducing φ.
Such a map f exists because, by the theory of group presentations, the 2-skeleta W 2 , X 2 correspond to group presentations of π 1 W, π 1 X; the homomorphism φ is induced by at least one 24 cellular map f : W 2 → X 2 . This map of 2-skeleta extends to a cellular map f : W → X since π i X = 0 for 2 ≤ i ≤ n − 1. Let χ * : C * W → C * X be the chain map induced by f . Note that χ * is pointed in the sense that χ 0 (e 0 ) = e 0 . Let [χ * ] denote the based homotopy class of χ * . Then [χ * ] ∈ [C * W, C * X] φ . We choose (one such) χ * as the preferred φ-equivariant chain map. Suppose that ψ * : C * W → C * X is some other φ-equivariant pointed chain map. Then χ 0 = ψ 0 . Suppose that for some 0 ≤ k ≤ n − 2 we have φ i = ψ i for 0 ≤ i ≤ k. Then for each free Zπ 1 Wgenerator e k j ∈ C k W we have χ k (e k j ) − ψ k (e k j ) ∈ ker(d k : C k X → C k−1 X). Since H k (C * X) = π k (X) = 0 we can choose some element h(e k j ) ∈ C k+1 X satisfying χ k (e k j ) − ψ k (e k j ) = d k+1 h(e k j ). Here h(e k j ) is just our label for the chosen element. This defines a φ-equivariant homomorphism h : C k W → C k+1 X.

Reproducibility of computations
All computations in the paper were obtained using GAP v4.11.0 and HAP v1.29 and Debian GNU/Linux 10 (buster) on a laptop with an i7-6500U CPU and 4GB of RAM. The code in Tables 1-4 has been stored as examples in HAP which can be run using the command gap> HapExample("jsc2021-n"); for n = 1, 2, 3, 4. Two further examples relating to computations in the paper have also been stored in HAP. Timings for the examples, in hour:min:sec format, are as follows.

Acknowledgments
The second author is grateful to the Irish Research Council for a postgraduate scholarship under project GOIPG/2018/2152. The authors thank the referee for helpful comments and for suggesting the inclusion of Section 12.