# The Cubical Cohomology Ring: An Algorithmic Approach

- 1.1k Downloads
- 2 Citations

## Abstract

A cohomology ring algorithm in a dimension-independent framework of combinatorial cubical complexes is developed with the aim of applying it to the topological analysis of high-dimensional data. This approach is convenient in the cup-product computation and motivated, among others, by interpreting pixels or voxels in digital images as cubes. The *S*-complex theory and so called co-reductions are adopted to build a cohomology ring algorithm speeding up the algebraic computations.

## Keywords

Combinatorial cubical complex*S*-complex Cohomology ring Cup-product formula Coreduction algorithm

## Mathematics Subject Classification

55-04 55N35 55N45 52B99 18G35## 1 Introduction

In the past two decades, homology and cohomology theory have gained vivid attention outside of the mathematics community prompted by modern applications in sciences and engineering. The development of a computational approach to these theories is motivated, among others, by problems in dynamical systems [18], material science [5, 8], electromagnetism [9, 14], geometric modeling [10], image understanding and digital image processing [1, 3, 12, 16, 22]. Conversely, that development is enabled by progress in computer science. Although algebraic topology arose from applications and has been thought of as a computable tool since its early stage, practical implementations had to wait until the modern generation of powerful computers due to the complexity of the operations involved, especially in high-dimensional problems.

Until recently, progress has mainly been achieved in the computation of homology. The software libraries CHomP [4] and RedHom [24] provide systematic approach to computing homology of topological spaces in arbitrary dimension. There are also implementations of homology algorithms for some specialized tasks as, in particular, GAP [11] and Dionysus [19]. The abundance of various homology algorithms and implementations is, at least in part, a consequence of the fact that the optimization techniques depend crucially on the type of input as well as the data structure chosen to represent it. Simplicial complexes constitute a common and historically well justified method to represent topological spaces. However, in many applications, in particular in rigorous numerics of dynamical systems and in all types of raster graphics a union of unit cubes in a cubical lattice provides the most natural way to represent sets. This leads to the concepts of a cubical set, a combinatorial cubical complex and cubical homology as introduced in [15]. These concepts should not be confused neither with the singular cubical homology [17] nor with the notion of cubical set in the homotopy theory or algebra [2]. The cubical set in the sense of [15] may look as a very restrictive one from the point of view of the general theory but it is sufficiently broad in the context of applications and, most importantly, its rigidness allows for bitmap representations which are extremely efficient due to the natural optimization of processors to perform operation on bitmaps. In this paper, we shall work in the framework of [15] but extending the material on cubical homology to the dual cochain groups.

Cohomology theory, not less important than homology from the point of view of applications, but intrinsically more difficult, had to wait longer for computer implementations. Whenever a mathematical model made it possible as, for example, in the case of orientable manifolds, duality has been used to avoid explicitly working with cohomology. However, among features distinguishing cohomology from homology is the cup product, which renders a ring structure on cohomology. The cup product is a difficult concept, which has been more challenging to make explicit enough for computer programs than homology or cohomology groups. Some significant application-oriented work on computing the cohomology ring of simplicial complexes has been done by Real et al. [13].

The notion of the singular cubical homology and cohomology and a cubical cup product formula were first introduced in 1951 by Serre [25, Chap. 2]. However, we wish to emphasize that this pioneering approach is far from the combinatorial and application–driven spirit of our work; for three main reasons: of all, singular cubes are defined as equivalence classes of all continuous functions from the standard cube [0,1]^{ d } to a given topological space. Secondly, because Serre, in his original work, does not directly derive algebraic properties of the singular cubical cohomology ring by arguments within his theory: he only refers to the isomorphism between singular and simplicial (co)homology. Finally, because Serre’s result on this topic is hidden as part of a highly theoretical work addressed to readers with a deep background in pure mathematics and beyond the reach of most of the computer engineering community for instance. This is why authors working on applications of cohomology to 3D digital images e.g. [12, 13] in the framework of 3D cellular cubical complexes tend to derive the needed cubical formulas from the simplicial theory rather than from Serre’s work. Our philosophy is based on the observation that the combinatorial cubical complexes presented in [15] are a more friendly framework than the simplicial or singular setting, to directly derive explicit formulas, such as, for instance, the cup product formula, and to implement them in dimension-independent algorithms.

Let us recall the general definition of the cup product used in the standard literature on homological algebra [23].

### Definition 1.1

*cup product*⌣:

*H*

^{ p }(

*X*)×

*H*

^{ q }(

*X*)→

*H*

^{ p+q }(

*X*) is defined on cohomology classes of cocycles

*z*

^{ p }and

*z*

^{ q }as follows:

*z*

^{ p }]×[

*z*

^{ q }] is the

*cohomology cross product*and \(\operatorname {diag}^{*}\) is the homomorphism induced by the

*diagonal map*\(\operatorname {diag}: X \to X\times X\) given by \(\operatorname {diag}(x):=(x,x)\).

An algorithm for cup product based on formula (1) would require an implementation of cross product and \(\operatorname {diag}^{*}\) homomorphism which is troublesome and would lead to an inefficient algorithm. The main goal of this paper is to provide an explicit formula for computing the cup product in the setting of cubical sets. As we will prove in Theorem 2.24 the computation of the cup product of two generating elementary cubes in dimension *d* reduces coordinate-wise to dimension one and the respective formula in dimension one, given by Theorem 2.20 is straightforward to implement.

In order to obtain Theorem 2.24, we need to derive an explicit formula for a chain map \(\operatorname {diag}_{\#}:\mathcal {C}(X)\to \mathcal {C}(X\times X)\) induced by the diagonal map. Actually, this task is more complex than it may seem at the first glance and Sect. 2.2 is devoted mainly to the related constructions.

Note that the choice of a chain map is not unique, thus the correctness of the definition and the properties of the cup product are achieved at the cohomology level. These properties are discussed in Sect. 2.3. We end the section with an example illustrating the use of the explicit, coordinate-wise formula.

Cubical sets arising from large data sets which are present in applications are built of a huge number of generating elementary cubes. In order to benefit from the established formula in this context, one needs reduction algorithms which render the computation efficient. Thus the second goal of this paper, reached in Sect. 3, is to show that the techniques of *S*-reductions of *S*-complexes successfully developed in [20, 21] with the purpose of computing homology of large cubical complexes may be adapted to computing the cohomology ring of a cubical set. The terminology of *S*-complexes, *S*-reduction pairs, the coreduction algorithm and the concept of homology models are reviewed and adapted for cohomology. We finish the paper with Sect. 3.5, where computations via *S*-reductions are carried out and compared on two explicit examples of a still quite simple nature.

The implementation of the methods presented in this paper as well as numerical experiments are in progress. In particular, the method of *S*-reductions for cohomology groups has been implemented in the Ph.D. thesis of P. Dłotko [6] and numerical experiments indicate the same efficiency of the implementation for cohomology groups as in the case of homology groups.

## 2 Cubical Cohomology

### 2.1 Cubical Cohomology Groups

*X*⊂ℝ

^{ d }is a

*cubical set*if it is a finite union of

*elementary cubes*

*I*

_{ i }is an interval of the form

*I*=[

*k*,

*k*+1] (non-degenerate) or

*I*=[

*k*,

*k*] (degenerate) for some

*k*∈ℤ. For short, [

*k*]:=[

*k*,

*k*]. The

*dimension*dim

*Q*of

*Q*is the number of non-degenerate intervals in its product expression and the

*embedding number*\(\operatorname {emb}\ Q\) is

*d*. The set of all elementary cubes in ℝ

^{ d }is denoted by \(\mathcal {K}({\mathbb{R}}^{d})\) and those of dimension

*k*by \(\mathcal {K}_{k}({\mathbb{R}}^{d})\). Those which are contained in

*X*are denoted by \(\mathcal {K}(X)\), respectively, \(\mathcal {K}_{k}(X)\).

*C*

_{ k }(ℝ

^{ d }) of

*cubical*

*k-chains*is the free abelian group generated by \(\mathcal {K}_{k}({\mathbb{R}}^{d})\), its

*canonical basis*. For

*k*<0 and

*k*>

*d*, we set

*C*

_{ k }(ℝ

^{ d }):=0. In the sequel, we identify the geometric elementary cube

*Q*with the elementary cubical chain defined by

*cubical cross product*

*P*×

*Q*and extended on all pairs of chains (

*c*,

*c*′) by bilinearity. In [15], this operation is called

*cubical product*and denoted by

*c*⋄

*c*′ in order to distinguish it from the cartesian product but we abandon this notation here to emphasize its equivalence to the cross product in homological algebra.

Given any *k*∈ℤ, the *cubical boundary map* \({\bf \partial }_{k}:C_{k}({\mathbb{R}}^{d})\to C_{k-1}({\mathbb{R}}^{d})\) is a homomorphism defined as follows. If *k*≤0 or *k*>*d*, we have *C* _{ k }(ℝ^{ d })=0, hence \({\bf \partial }_{k}=0\). If 0≤*k*≤*d*, \({\bf \partial }_{k}\) is defined on the elements *Q* of the basis \(\mathcal {K}_{k}({\mathbb{R}}^{d})\) by induction on *d*.

For *d*=1, either \(Q=[a]\in \mathcal {K}_{0}({\mathbb{R}}^{d})\) or \(Q=[a,a+1]\in \mathcal {K}_{1}({\mathbb{R}}^{d})\), for some *a*∈ℤ. In the first case, \({\bf \partial }_{0} Q=0\). In the second case, we put \({\bf \partial }_{1} Q:=[a+1]-[a]\).

*d*>1 decompose

*Q*as

*Q*=

*I*×

*P*, where \(\operatorname {emb}\ I=1\) and \(\operatorname {emb}\ P=d-1\), and put

*p*=dim

*I*and

*q*=dim

*P*. The pair \((\mathcal {C}({\mathbb{R}}^{d}),{\bf \partial }):=\{ (C_{k}({\mathbb{R}}^{d}),{\bf \partial }_{k} )\}_{k\in {\mathbb{Z}}}\) is called the

*cubical chain complex of*ℝ

^{ d }. We refer to [15, Chap. 2] for the properties of the cubical cross product and cubical boundary maps, in particular for this one:

### Proposition 2.1

*For any*

*c*∈

*C*

_{ p }(ℝ

^{ n }),

*and*

*c*′∈

*C*

_{ q }(ℝ

^{ m })

*c*,

*d*∈

*C*

_{ p }(ℝ

^{ d }), the notation 〈

*c*,

*d*〉 is used for the scalar product defined on the elements

*P*,

*Q*of the canonical basis \(\mathcal {K}_{p}\) by

*support*|

*c*| of

*c*is the union of all \(Q\in \mathcal {K}_{p}\) such that 〈

*c*,

*Q*〉≠0. Given a cubical set

*X*⊂ℝ

^{ d }, the

*cubical chain complex of*

*X*denoted by \(\mathcal {C}(X)\) is the restriction of \(\mathcal {C}({\mathbb{R}}^{d})\) to the chains

*c*whose

*support*is contained in

*X*. We refer to [15] for the properties of cubical chain complexes and for the computation of their homology.

### Definition 2.2

*X*⊂ℝ

^{ d }be a cubical set. The

*cubical cochain complex*\((\mathcal {C}^{*}(X),\delta )\) is defined as follows. For any

*k*∈ℤ, the

*k*-dimensional cochain group

*G*the group of all homomorphisms from

*G*to ℤ, called the

*dual*of

*G*. Elements of

*C*

^{ k }(

*X*) are called

*cochains*and denoted either by

*c*

^{ k },

*d*

^{ k }or by

*c*

^{⋆},

*d*

^{⋆}, if we do not need to specify their dimension

*k*. The value of a cochain

*c*

^{ k }on a chain

*d*

_{ k }is denoted by 〈

*c*

^{ k },

*d*

_{ k }〉. Note that this notation is also used for the scalar product in chain complexes introduced in (3) and in

*S*-complexes in Sect. 3 but it is easy to figure out from the context which product we mean.

*k*th coboundary map

*δ*

^{ k }:

*C*

^{ k }(

*X*)→

*C*

^{ k+1}(

*X*) is the dual homomorphism of \({\bf \partial }_{k+1}\) defined by

*C*

^{ k }(

*X*) is the free abelian group generated by the dual canonical basis \(\{{Q}^{\star}|Q\in \mathcal {K}_{k}(X)\}\) where

*Q*

^{⋆}, for the dual of

*Q*, is aimed to be distinct from

*H*

^{∗}for the cohomology functor.

### Definition 2.3

*X*⊂ℝ

^{ d }, the group of

*k*-dimensional

*cocycles*of

*X*is

*Z*

^{ k }(

*X*):=ker

*δ*

^{ k }, and the group of

*k*-dimensional

*coboundaries*of

*X*is

*B*

^{ k }:=im

*δ*

^{ k−1}. The

*k*th

*cohomology group*of

*X*is the quotient group

### Definition 2.4

*cubical cross product*of cochains

*c*

^{ p }∈

*C*

^{ p }(

*X*) and

*c*

^{ q }∈

*C*

^{ q }(

*Y*) is a cochain in

*C*

^{ p+q }(

*X*×

*Y*) defined on any elementary cube \(R\times S \in{ \mathcal {K}}_{p+q}(X\times Y)\), where \(R\in \mathcal {K}(X)\) and \(S\in \mathcal {K}(Y)\), as follows:

We easily check the following.

### Proposition 2.5

*The cross product of cochains is a bilinear map*.

*Moreover*,

*for*\(P\in \mathcal {K}_{p}(X)\), \(Q\in \mathcal {K}_{q}(Y)\),

Algebraic properties of the cubical product on cubical chains derived in [15, Sect. 2.2] readily extend to the cross product on cochains, in particular the following.

### Proposition 2.6

*If*

*c*

^{ p }×

*c*

^{ q }∈

*C*

^{ p+q }(

*X*),

*then*

### 2.2 Constructing Chain Maps

The most important step towards an explicit formula for the cup product is the construction of a homology chain map \(\operatorname {diag}_{\#}:\mathcal {C}(X)\to \mathcal {C}(X\times X)\) induced by the diagonal map \(\operatorname {diag}: X \to X\times X\) given by \(\operatorname {diag}(x):=(x,x)\). This is done using the construction presented in [15, Chap. 6]. We briefly outline that construction.

*Q*=

*I*

_{1}×

*I*

_{2}×⋯×

*I*

_{ d }, the corresponding

*elementary cell*\(\stackrel{\circ}{Q}\) is

*Q*with all its proper faces removed. Given cubical sets

*X*and

*Y*, a

*multivalued cubical map*\(F :X{\,\overrightarrow {\to }\,}Y\) is a map from

*X*to the set of subsets of

*Y*such that

- (i)
for every

*x*∈*X*,*F*(*x*) is a cubical set; - (ii)
for every \(Q\in \mathcal {K}(X)\), \(F\mid_{\stackrel{\circ}{Q}}\) is constant.

*acyclic*values (that is, \(\tilde{H}_{*}(F(x))=0\) for all

*x*∈

*X*), then it admits a

*chain selector*, that is, a chain map \(\varphi:\mathcal {C}(X)\to \mathcal {C}(Y)\) with the properties

- 1.
\(|{\varphi(Q)}| \subset F(\stackrel{\circ}{Q})\) for all \(Q \in \mathcal {K}(X)\);

- 2.
*φ*(*Q*) is a vertex of*F*(*Q*) for any vertex \(Q \in \mathcal {K}_{0}(X)\).

*f*:

*X*→

*Y*admits an acyclic-valued

*representation*, that is, a lower semicontinuous cubical map

*F*with the property

*f*(

*x*)∈

*F*(

*x*), the homology map of any chain selector

*φ*of

*F*is the map

*H*

_{∗}(

*f*) induced in homology by

*f*[15, Proposition 6.56]. The idea behind this construction is illustrated in Fig. 1.

*rescaling*[15, Sect. 6.4.2]. However, for the purpose of this paper, we do not need rescaling, because all considered maps admit the acyclic-valued minimal representations. Recall from [15, Proposition 6.33 and Definition 6.34] that the

*minimal representation*of a continuous map

*f*:

*X*→

*Y*is a lower semicontinuous cubical map \(F:X{\,\overrightarrow {\to }\,}Y\) defined by

*A*⊂

*X*, the

*closed hull*ch(

*A*) is the smallest cubical set containing

*A*. In the case

*A*={

*x*}, the set ch({

*x*}) is an elementary cube denoted, for short, by ch(

*x*). In the case of our diagonal map \(\operatorname {diag}: X \to X\times X\), its minimal representation \(\operatorname {\mathit {Diag}}:X {\,\overrightarrow {\to }\,}(X\times X)\) is given by

*Q*×

*Q*is acyclic.

Given any maps *f*:*X* _{1}→*Y* _{1} and *g*:*X* _{2}→*Y* _{2} on cubical sets, we define *f*×*g*:*X* _{1}×*X* _{2}→*Y* _{1}×*Y* _{2} by (*f*×*g*)(*x* _{1},*x* _{2}):=(*f*(*x* _{1}),*g*(*x* _{2})). Given \(F_{i}: X_{i} {\,\overrightarrow {\to }\,}Y_{i}\) for *i*=1,2, we define \(F_{1} \times F_{2}: X_{1}\times X_{2} {\,\overrightarrow {\to }\,}Y_{1}\times Y_{2}\) by (*F* _{1}×*F* _{2})(*x*,*y*):=*F* _{1}(*x*)×*F* _{2}(*y*).

*cubical tensor product*\(\varphi \otimes \psi:\mathcal {C}(X_{1}\times X_{2})\to \mathcal {C}(Y_{1}\times Y_{2})\) is defined on generators \({Q}={Q}_{1}{\times }{Q}_{2}\in {\mathcal {K}}_{k}(X_{1}\times X_{2})\) as follows. Set

*p*:=dim

*Q*

_{1}and

*q*:=dim

*Q*

_{2}. Note that

*p*+

*q*=

*k*. Put

### Lemma 2.7

*Let*

*X*

_{1},

*X*

_{2},

*Y*

_{1},

*Y*

_{2}

*be cubical sets and let*

*f*:

*X*

_{1}→

*Y*

_{1},

*g*:

*X*

_{2}→

*Y*

_{2}

*be continuous maps which admit acyclic*-

*valued representations*

*F*,

*G*.

*Let*

*φ*

*and*

*ψ*

*be the chain selectors of*

*F*

*and*,

*respectively*,

*G*.

- (a)
*The set*-*valued map**F*×*G**is an acyclic*-*valued cubical representation of**f*×*g*. - (b)
*The chain map**φ*⊗*ψ**is a chain selector of**F*×*G*.

### Proof

*φ*⊗

*ψ*is a chain map. Given any \(Q=Q_{1}\times Q_{2}\in \mathcal {K}_{k}(X_{1}\times X_{2})\), we have, for

*p*=dim

*Q*

_{1},

*q*=dim

*Q*

_{2}, It remains to check the chain selector conditions (6.12), (6.13) in [15, Theorem 6.22]. First, we have

*W*

_{1}:=

*φ*(

*V*

_{1}) and

*W*

_{2}:=

*ψ*(

*V*

_{2}) are vertices, hence

The following statement easily follows from the definitions.

### Proposition 2.8

*Let*

*X*

_{1}⊂

*R*

^{ n }

*and*

*X*

_{2}⊂ℝ

^{ d−n }

*be the images of a cubical set*

*X*⊂ℝ

^{ d }

*under its projections onto*,

*respectively*,

*the first*

*n*

*and the complementary*

*d*−

*n*

*coordinates in*ℝ

^{ d }.

*Consider the inclusion map*

*j*:

*X*↪

*X*

_{1}×

*X*

_{2}.

*Then*

- (a)
*The map*\(J: X {\,\overrightarrow {\to }\,}X_{1} \times X_{2}\)*given by**J*(*x*):=ch(*x*)*is an acyclic*-*valued cubical representation of**j*; - (b)
*The inclusion of chain complexes*\(\iota: \mathcal {C}(X)\hookrightarrow \mathcal {C}(X_{1} \times X_{2})\)*is a chain selector of J*.

### Theorem 2.9

*Let*

*X*,

*Y*

*be cubical sets and let*

*λ*:

*X*×

*Y*→

*Y*×

*X*

*be the transpose given by*

*λ*(

*x*,

*y*):=(

*y*,

*x*).

- (a)
*The map*\(\varLambda: X\times Y {\,\overrightarrow {\to }\,}Y\times X\)*given by**Λ*(*x*,*y*):=*Q*_{2}×*Q*_{1},*where**Q*_{1}:=ch(*x*)*and**Q*_{2}:=ch(*y*),*is an acyclic*-*valued cubical representation of**λ*. - (b)
*Let*\(\lambda_{\#}: \mathcal {C}(X \times Y)\to C(Y \times X)\)*be the map defined on generators*\({Q}={Q}_{1}{\times }{Q}_{2}\in {\mathcal {K}}_{k}(X \times Y)\)*by*$$\lambda_k (Q):=(-1)^{\dim Q_1 \dim Q_2} {Q}_2 {\times }{Q}_1. $$*Then**λ*_{#}*is a chain selector of**Λ*.

### Proof

*λ*

_{#}is a chain map, that is, it commutes with the boundary map. Let \(Q=Q_{1}{\times }Q_{2}\in {\mathcal {K}}_{k}(X \times Y)\). On the one hand, we have On the other hand, we have Hence \({\bf \partial }\lambda_{k}(Q)=\lambda_{k-1} ({\bf \partial }{Q})\). □

From Proposition 2.8 and Theorem 2.9 we derive the following corollary.

### Corollary 2.10

*Let*

*X*

_{1},

*X*

_{2},

*Y*

_{1},

*Y*

_{2}

*be cubical sets and consider the permutation*

*given by*

*τ*(

*x*

_{1},

*y*

_{1},

*x*

_{2},

*y*

_{2})=(

*x*

_{1},

*x*

_{2},

*y*

_{1},

*y*

_{2}).

*Then the map given by*

*T*(

*x*):=

*τ*(ch(

*x*))

*is an acyclic*-

*valued representation of*

*τ*.

*It has the map*

*defined on products of*\(P_{1}\in \mathcal {K}(X_{1})\), \(P_{2}\in \mathcal {K}(Y_{1})\), \(Q_{1}\in \mathcal {K}(X_{2})\),

*and*\(Q_{2}\in \mathcal {K}(Y_{1})\)

*by*

*as a chain selector*.

Here are dual statements of Theorem 2.9 and Corollary 2.10 for cochains.

### Corollary 2.11

*Let*

*λ*:

*X*×

*Y*→

*Y*×

*X*

*be the transpose defined in Theorem*2.9.

*Then the induced cochain map*\(\lambda^{\#}:=\mathrm{Hom}(\lambda_{\#}):\mathcal {C}^{*}(Y\times X)\to \mathcal {C}^{*}(X\times Y)\)

*satisfies*

### Proof

*P*=

*p*and dim

*Q*=

*q*, then If dim

*P*≠

*p*or dim

*Q*≠

*q*, then both sides vanish. □

### Corollary 2.12

*Let*

*τ*:(

*X*

_{1}×

*Y*

_{1})×(

*X*

_{2}×

*Y*

_{2})→(

*X*

_{1}×

*X*

_{2})×(

*Y*

_{1}×

*Y*

_{2})

*be the permutation discussed in Corollary*2.10.

*The map*

*induced by*

*τ*

_{#}

*is given on products of duals of*\(P_{1}\in \mathcal {K}(X_{1})\), \(P_{2}\in \mathcal {K}(Y_{1})\), \(Q_{1}\in \mathcal {K}(X_{2})\),

*and*\(Q_{2}\in \mathcal {K}(Y_{1})\)

*by the formula*

Let *X*⊂ℝ^{ d } be a cubical set. We proceed to the construction of a homology-representative chain map \(\operatorname {diag}_{\#}:\mathcal {C}(X)\to \mathcal {C}(X\times X)\) induced by the diagonal map. It is straightforward to see that the diagonal map admits an acyclic-valued representation \(\operatorname {\mathit {Diag}}:X {\,\overrightarrow {\to }\,}(X\times X)\) given by \(\operatorname {\mathit {Diag}}(x):=Q\times Q\) where \(Q=\mathrm{ch}(x)\in \mathcal {K}(X)\). The construction of a chain selector proceeds by induction on \(d=\operatorname {emb}X\).

*Case*

*d*=1: If \(Q=[v]\in \mathcal {K}_{0}(X)\), we put

*k*∉{0,1}, we must have \(\operatorname {diag}_{k}=0\).

### Lemma 2.13

*Let* emb *X*=1. *The map* \(\operatorname {diag}_{\#}\) *defined by* (6) *and* (7) *is a chain selector for* \(\operatorname {\mathit {Diag}}\).

### Proof

*d*=1, it is enough to check that \({\bf \partial }_{1}\operatorname {diag}_{1}=\operatorname {diag}_{0}{\bf \partial }_{1}\). Let \(Q=[v_{0},v_{1}]\in \mathcal {K}_{1}(X)\). On the one hand, On the other hand, hence the conclusion follows. □

### Remark 2.14

### Induction Step

Suppose that \(\operatorname {diag}_{\#}\) is defined for cubical sets of embedding numbers *n*=1,…,*d*−1 and let us construct it for a cubical set *X* of the embedding number *d*.

*τ*:ℝ

^{2d }→ℝ

^{2d }is the permutation of coordinates which transposes the (

*d*+1)st coordinate with the preceding

*d*−1 coordinates. The formula for the chain maps induced by

*τ*is provided by Corollary 2.10.

*X*

_{1}⊂ℝ and

*X*

_{2}⊂ℝ

^{ d−1}of

*X*under its projections of, respectively, the first and the complementary

*d*−1 coordinates in ℝ

^{ d }. Let \(\operatorname {diag}^{X_{1}}\) and \(\operatorname {diag}^{X_{2}}\) be the diagonal maps defined, respectively, on

*X*

_{1}and

*X*

_{2}. Then the diagonal map on

*X*is the composition

*j*is the inclusion map discussed in Proposition 2.8. Note that

*τ*takes values in

*X*

_{1}×

*X*

_{2}×

*X*

_{1}×

*X*

_{2}⊃

*X*×

*X*but the composition of maps on the right-hand side of (9) takes values in

*X*×

*X*.

### Lemma 2.15

*Let*

*d*=emb

*X*>1.

*Assume that the chain selector*\(\operatorname {diag}_{\#}\)

*of*\(\operatorname {\mathit {Diag}}\)

*is defined for cubical sets of embedding numbers less than*

*d*.

*Consider the chain map*\(\varphi:\mathcal {C}(X)\to \mathcal {C}(X_{1}\times X_{2}\times X_{1}\times X_{2})\)

*defined by the formula*

*where*

- 1.
\(\iota: \mathcal {C}(X)\to \mathcal {C}(X_{1}\times X_{2})\)

*is the inclusion of chain complexes*, - 2.
\(\operatorname {diag}^{X_{1}}_{\#}:\mathcal {C}(X_{1})\to \mathcal {C}(X_{1}\times X_{1})\)

*and*\(\operatorname {diag}^{X_{2}}_{\#}:\mathcal {C}(X_{2})\to \mathcal {C}(X_{2}\times X_{2})\)*are defined by the induction hypothesis*, - 3.
\(\operatorname {diag}^{X_{1}}_{\#}\otimes \operatorname {diag}^{X_{2}}_{\#}:\mathcal {C}(X_{1}\times X_{2})\to \mathcal {C}(X_{1}\times X_{1}\times X_{2}\times X_{2})\)

*is defined by formula*(5),*and* - 4.
\(\tau_{\#}:\mathcal {C}(X_{1}\times X_{1}\times X_{2}\times X_{2})\to \mathcal {C}(X_{1}\times X_{2}\times X_{1}\times X_{2})\)

*is defined in Corollary*2.10.

*Then*

*φ*

*takes values in*\(\mathcal {C}(X \times X)\subset \mathcal {C}(X_{1}\times X_{2}\times X_{1}\times X_{2})\).

*Moreover*,

*the map*\(\operatorname {diag}_{\#}:\mathcal {C}(X)\to \mathcal {C}(X \times X)\), \(\operatorname {diag}_{k}(c):=\varphi_{k}(c)\),

*for*

*c*∈

*C*

_{ k }(

*X*),

*k*∈ℤ,

*is a chain selector of*\(\operatorname {\mathit {Diag}}\).

### Proof

*Diag*. This implies, in particular, that the composition has acyclic values contained in

*X*×

*X*. Let

*x*=(

*x*

_{1},

*x*

_{2})∈

*X*, with

*x*

_{ i }∈

*X*

_{ i }, and \(Q=Q_{1}\times Q_{2}=\mathrm{ch}(x)\in \mathcal {K}(X)\), with \(Q_{i}\in \mathcal {K}(X_{i})\),

*i*=1,2. It is easy to check that ch(

*x*

_{1})=

*Q*

_{1}and ch(

*x*

_{2})=

*Q*

_{2}. By Proposition 2.8(a),

*J*(

*x*)=

*Q*

_{1}×

*Q*

_{2}=

*Q*. Given any

*y*∈

*Q*, we have ch(

*y*)⊂

*Q*and the equality holds when \(y\in \stackrel{\circ}{Q}\). Let

*y*=(

*y*

_{1},

*y*

_{2})∈

*Q*

_{1}×

*Q*

_{2}. We have

*Diag*is equal to \(T\circ \mathit{Diag}^{X_{1}}\times \mathit{Diag}^{X_{2}}\circ J\) with the range restricted to the image

*X*×

*X*. It follows that the composition of the corresponding chain selectors has the image in \(\mathcal {C}(X\times X)\). Finally, it follows from [15, Corollary 6.31] that this composition is a chain selector for

*Diag*. □

### 2.3 The Cubical Cup Product

### Definition 2.16

*X*be a cubical set. The

*cubical cup product*

*c*

^{ p }and

*c*

^{ q }is defined by the formula

*distributive law*for the cup product on cochains

### Theorem 2.17

(Boundary Properties of the Cup Product)

- (a)
*δ*(*c*^{ p }⌣*c*^{ q })=*δc*^{ p }⌣*c*^{ q }+(−1)^{ p }*c*^{ p }⌣*δc*^{ q }. - (b)
*If**z*^{ p }∈*Z*^{ p }(*X*)*and**z*^{ q }∈*Z*^{ q }(*X*),*then**z*^{ p }⌣*z*^{ q }∈*Z*^{ p+q }(*X*). - (c)
*If**x*^{ p },*y*^{ p }∈*Z*^{ p }(*X*),*x*^{ p }−*y*^{ p }∈*B*^{ p }(*X*),*and**z*^{ q }∈*Z*^{ q }(*X*),*then*$$\bigl(x^p\smile z^q\bigr) - \bigl(y^p\smile z^q\bigr) \in B^{p+q}(X) \quad \mbox{and}\quad \bigl(z^q \smile x^p\bigr)-\bigl(z^q \smile y^p\bigr) \in B^{p+q}(X). $$

### Proof

*k*=

*p*+

*q*+1. (b) is an immediate consequence of (a).

*x*

^{ p }−

*y*

^{ p }=

*δw*. It follows from (a) that

*δz*

^{ q }=0. Hence

*x*

^{ p }⌣

*z*

^{ q }−

*y*

^{ p }⌣

*z*

^{ q }∈

*B*

^{ p+q }(

*X*). The second equation follows by the same argument. □

The property (a) in Theorem 2.17 is the analogy of the boundary property of the cubical cross product defined in [15, Sect. 2.2]. The property (b) asserts that the cup product sends cocycles to cocycles, and by (c) that it does not depend on a representative of a cohomology class. Thus, we get the definition:

### Definition 2.18

*cup product*⌣:

*H*

^{ p }(

*X*)×

*H*

^{ q }(

*X*)→

*H*

^{ p+q }(

*X*) is defined on cohomology classes of cocycles as follows:

The distributive law (12) extends easily to cohomology classes. The following property holds only for cohomology classes.

### Theorem 2.19

(Graded Commutative Law)

*If*

*z*

^{ p }

*and*

*z*

^{ q }

*are cocycles*,

*then*

### Proof

*λ*be the transpose defined in Theorem 2.9, applied for

*X*=

*Y*. Let \(Q\in \mathcal {K}(X)\). On the one hand, we have

*X*. The corresponding chain maps \(\psi_{\#}=\lambda_{\#}\circ \operatorname {diag}_{\#}\) and \(\varphi_{\#}=\operatorname {diag}_{\#}\) are both chain selectors for

*Diag*. By [15, Theorem 6.25], they are chain homotopic. This implies that the associated cochain maps

*ψ*

^{#}and

*φ*

^{#}are cochain homotopic (see the definition preceding Theorem 44.1 in [23]), hence they induce the same homomorphism in cohomology. Thus, we get

We can now derive an explicit formula, suitable for computations, for the cubical cup product on cochains. By the distributive law (12), it is sufficient to present a formula for generators \({P}^{\star}\in {\mathcal {K}}^{p}(X)\) and \({Q}^{\star}\in {\mathcal {K}}^{q}(X)\). The formula is developed recursively with respect to *d*=emb *X* and presented in three stages, the first one for the case *d*=1, the second one for the recursion step, and the last one is the final recursion-free coordinate-wise formula. □

### Theorem 2.20

*Let*

*X*

*be a cubical set in*ℝ

*and let*\(P,Q \in \mathcal {K}(X)\),

*P*=[

*a*,

*b*],

*Q*=[

*c*,

*d*]

*be elementary intervals*,

*possibly degenerate*.

*Then*

*In particular*,

*P*

^{⋆}⌣

*Q*

^{⋆}

*is either zero*,

*or a dual of an elementary interval*.

### Proof

*p*=dim

*P*and

*q*=dim

*Q*. Then

*p*,

*q*∈{0,1}. Let

*k*:=

*p*+

*q*. Consider first the case

*k*=0. Let \(R=[v]\in \mathcal {K}_{0}(X)\). Then When

*k*=

*p*+

*q*=1, let \(R=[v_{0},v_{1}]\in \mathcal {K}_{1}(X)\). Then Finally, when

*k*=

*p*+

*q*=2, we have

*P*

^{⋆}⌣

*Q*

^{⋆}=0, because emb(

*X*)=1 and

*C*

_{2}(

*X*)=0.

We reach the conclusion by expressing the values in terms of elementary intervals [*a*,*b*], [*c*,*d*]. □

### Example 2.21

Since [*a*]^{⋆}⌣[*a*,*a*+1]^{⋆}=[*a*,*a*+1]^{⋆} and [*a*,*a*+1]^{⋆}⌣[*a*]^{⋆}=0, we see that the graded commutative law in Theorem 2.19 does not hold for the cup product on the level of chain complexes.

### Theorem 2.22

*Let*\(\operatorname {emb}X=d>1\),

*and suppose that the formula for*⌣

*is given for cochains on cubical sets of embedding numbers*

*n*=1,…,

*d*−1.

*Consider the decomposition of elementary cubes*\(P=P_{1}\times P_{2}\in \mathcal {K}_{p}(X)\)

*and*\(Q=Q_{1}\times Q_{2} \in \mathcal {K}_{q}(X)\)

*with*emb

*P*

_{1}=emb

*Q*

_{1}=1

*and*emb

*P*

_{2}=emb

*Q*

_{2}=

*d*−1.

*Let*\(x={P}^{\star}_{1}\smile {Q}^{\star}_{1}\)

*and*\(y={P}^{\star}_{2}\smile {Q}^{\star}_{2}\)

*be computed using the induction hypothesis*.

*Then*

### Proof

*p*=dim

*R*

_{1}and

*q*=dim

*R*

_{2}. Note that

*p*+

*q*=

*k*. By Lemma 2.15 we get Since

*π*

_{ k }is a projection, its dual map

*π*

^{ k }is an injection which extends any element of \({ \mathcal {C}}^{\star}(X\times X)\) as zero on elementary cubes in \(\mathcal {K}(X_{1}\times X_{2} \times X_{1}\times X_{2})\setminus \mathcal {K}(X\times X)\). Set \(\sigma=(-1)^{\dim P_{2}\dim Q_{1}}\). By Proposition 2.8, Corollary 2.12 and Lemma 2.7, we get with a non-trivial value assumed if and only if |

*x*|=

*R*

_{1}and |

*y*|=

*R*

_{2}. However, \(R\in \mathcal {K}(X)\) and the conclusion follows. □

The following example illustrates the need for considering the alternative \(|x {\times }y| \notin \mathcal {K}(X)\) in the formula for *P* ^{⋆}⌣*Q* ^{⋆} in Theorem 2.22.

### Example 2.23

*X*=[0,1]

^{2},

*P*=[0]×[0,1], and

*Q*=[0,1]×[0]. We get

*X*=

*P*∪

*Q*, we get

*P*

^{⋆}⌣

*Q*

^{⋆}=0.

*P*and

*Q*be as in Theorem 2.22. Consider their decompositions to products of intervals in ℝ:

### Theorem 2.24

*Let*

*d*=emb(

*X*)>1.

*With the above notation for elementary cubes*\(P,Q\in \mathcal {K}(X)\),

*provided the right*-

*hand side is supported in*

*X*,

*and*

*P*

^{⋆}⌣

*Q*

^{⋆}=0

*otherwise*.

### Proof

We derive the formula from Theorem 2.22 by induction on the embedding number *d*>1.

When *d*=2, we have \(\operatorname {sgn}(P,Q)= (-1)^{\dim P_{1}' \dim J_{1}}\), so the formula is exactly the one in Theorem 2.22 with *P* _{1}=*I* _{1}, \(P_{2}=P_{1}'=I_{2}\), and *Q* _{ j }=*J* _{ j }, *j*=1,2.

*d*>2. We apply Theorem 2.22 with

*P*

_{1}=

*I*

_{1}, \(P_{2}=P_{1}'\),

*Q*

_{1}=

*J*

_{1}, and \(Q_{2}=Q_{1}'\). Note that the support of the cross product on the right-hand side of (14) is the cartesian product of the supports of the terms:

*X*if and only if one of

*x*×

*y*in Theorem 2.22 is non-empty and contained in

*X*. If this is not the case, both formulas give the cochain 0. Assume the non-trivial case. Then the support of \({P_{1}'}^{\star}\smile {Q_{1}'}^{\star}\) is non-empty and contained in

*X*

_{2}. By induction hypothesis,

*X*be a cubical set embedded in ℝ

^{ d }. We define the

*weight*of a cochain

*c*

^{ p }in

*X*by

*c*

^{ p }⌣

*c*

^{ q }for two cochains

*c*

^{ p },

*c*

^{ q }in

*X*reduces to finding

*w*(

*c*

^{ p })

*w*(

*c*

^{ q }) cup products of generating elementary cubes. Since it follows easily from Theorem 2.24 that the cost of finding the cup product of two generating elementary cubes is

*O*(

*d*

^{2}), we obtain the following.

### Corollary 2.25

*The computational complexity of evaluating* *c* ^{ p }⌣*c* ^{ q } *is* *O*(*d* ^{2} *mn*) *where* *m* *is the weight of* *c* ^{ p } *and* *n* *is the weight of* *c* ^{ q }.

### Example 2.26

*T*:=

*Γ*

^{1}×

*Γ*

^{1}⊂ℝ

^{4}, where \(\varGamma^{1}={\bf \partial }[0,1]^{2}\) is the boundary of the square. Since it is hard to draw pictures in ℝ

^{4}, we parameterize

*Γ*

^{1}by the interval [0,4] with identified endpoints 0∼4, which permits visualizing

*T*as the square [0,4]

^{2}with pairs of identified boundary edges, as shown in Fig. 3.

*x*

^{1}generated by the sum of four solid line vertical edges with [2,3] at the second coordinate, and

*y*

^{1}by the sum of solid line horizontal edges with [1,2] at the first coordinate. Only the edges of the parametric square [1,2]×[2,3] may contribute to non-zero terms of

*x*

^{1}⌣

*y*

^{1}. Thus, using Theorem 2.20 and Theorem 2.24, The cohomology classes of cochains

*x*

^{1}and

*y*

^{1}generate

*H*

^{1}(

*T*), and [

*Q*

^{∗}], where

*Q*:=([1,2]×[2,3]), generates

*H*

^{2}(

*T*).

We are now ready to prove the remaining ring properties for the cubical cup product.

### Theorem 2.27

*Let*

*X*

*be a cubical set*.

*The cup product on cubical cochains is associative*,

*that is*,

*The cochain given by*\(1_{C_{0}(X)}:=\sum_{V\in \mathcal {K}_{0}(X)}{V}^{\star}\)

*is the unit element*,

*that is*,

*A fortiori*,

*these formulas are valid for cohomology classes*.

### Proof

By the distributive law (12), it is sufficient to work with generators \({P}^{\star}\in {\mathcal {K}}^{p}(X)\), \({Q}^{\star}\in {\mathcal {K}}^{q}(X)\), and \({R}^{\star}\in {\mathcal {K}}^{r}(X)\). Let \(d=\operatorname {emb}(X)\).

The unit element property easily follows from Theorem 2.20 in the case *d*=1 and from Theorem 2.24 in the case *d*>1.

*d*. When

*d*=1, a routine verification of the formula in Theorem 2.20 shows that (

*P*

^{⋆}⌣

*Q*

^{⋆})⌣

*R*

^{⋆}≠0 if and only if there exists

*a*∈ℤ such that the triple (

*P*,

*Q*,

*R*) takes one of the forms In the first case (

*P*

^{⋆}⌣

*Q*

^{⋆})⌣

*R*

^{⋆}=[

*a*] and in the remaining cases it is [

*a*,

*a*+1]. The same is verified for

*P*

^{⋆}⌣(

*Q*

^{⋆}⌣

*R*

^{⋆}).

*d*>1 and suppose the conclusion is true for the embedding numbers smaller than

*d*. Write

*P*=

*P*

_{1}×

*P*

_{2},

*Q*=

*Q*

_{1}×

*Q*

_{2}, and

*R*=

*R*

_{1}×

*R*

_{2}, where the first component of each elementary cube is in ℝ and the second one in ℝ

^{ d−1}. Using Theorem 2.20 and Theorem 2.22, we prove that

*X*, and it is 0 otherwise.

*P*

_{1}

^{⋆}⌣

*Q*

_{1}

^{⋆}=

*S*

_{1}

^{⋆}, where \(S_{1}\in \mathcal {K}(X_{1})\) is equal either to

*P*

_{1}or to

*Q*

_{1}. By Theorem 2.22,

*P*

_{2}

^{⋆}⌣

*Q*

_{2}

^{⋆}=(−1)

^{ γ }

*S*

_{2}

^{⋆}, for some

*γ*∈ℤ and \(S_{2}\in \mathcal {K}(X_{2})\). Let

*S*=

*S*

_{1}×

*S*

_{2}. By hypothesis, \(S\in \mathcal {K}(X)\). Hence (17) can be written as

^{ γ }inside the cross product term containing

*S*

_{2}

^{⋆}. Analogously,

*X*. It remains to show that (−1)

^{ α }=(−1)

^{ β }. By Definition 2.16,

By Definition 2.18, the last statement on extension to the cohomology classes is obvious. □

The algebraic properties listed in (12), Theorem 2.27 and in Theorem 2.19 are referred to as the graded ring properties. Thus we arrived at the key definition:

### Definition 2.28

Let *X* be a cubical set. The *cubical cohomology ring* of *X* is the graded abelian group *H* ^{⋆}(*X*) with the graded multiplication given by the cup product.

It is known that the ring structure introduced in Definition 2.28 may be used to distinguish non homeomorphic spaces even if their homology and cohomology groups are isomorphic. This is shown in the example presented in Sect. 3.5.

### Remark 2.29

All what we have done until now can be extended to chain complexes \(\mathcal {C}(X;R):=\mathcal {C}(X)\otimes R\) with coefficients in a ring with unity *R*, which are graded modules over *R*. This gives rise to the cohomology ring *H* ^{∗}(*X*;*R*). We have initially chosen coefficients in ℤ for the sake of clarity and, in particular, to avoid confusion between two rings, *R* and the graded cohomology ring. However, we introduce ring coefficients in the next section because, for computational purposes, it is often convenient to choose coefficients in the finite field *R*=ℤ_{ p }, *p* a prime number. Field coefficients are sufficient in many practical applications.

## 3 Computing Cohomology

The aim of this section is to show that the techniques of *S*-reductions of *S*-complexes developed in [20, 21] in order to construct efficient algorithms computing homology of cubical complexes may be easily adapted to provide algorithms computing the cohomology ring of a cubical set.

### 3.1 *S*-Complexes

*R*be a ring with unity and let

*S*be a finite set. Denote by

*R*(

*S*) the free module over

*R*generated by

*S*. Let (

*S*

_{ q })

_{ q∈ℤ}be a gradation of

*S*such that

*S*

_{ q }=∅ for all

*q*<0. Then (

*R*(

*S*

_{ q }))

_{ q∈ℤ}is a gradation of the module

*R*(

*S*) in the category of modules over the ring

*R*. For every element

*s*∈

*S*, the unique number

*q*such that

*s*∈

*S*

_{ q }is called the

*dimension*of

*s*and denoted by dim

*s*. We use the notation 〈⋅,⋅〉:

*R*(

*S*)×

*R*(

*S*)→

*R*for the inner product which is defined on generators by

*R*(

*S*)×

*R*(

*S*).

*S*,

*κ*), where

*κ*:

*S*×

*S*→

*R*is a map such that

*κ*(

*s*,

*t*)=0 unless dim

*s*=dim

*t*+1, is called an

*S-complex*, if the pair \((R(S),{\bf \partial }^{\kappa})\) is a free chain complex with base

*S*and the

*boundary map*\({\bf \partial }^{\kappa}:R(S)\to R(S)\) is defined on generators

*s*∈

*S*by

*homology of an*

*S-complex*(

*S*,

*κ*) is the homology of the associated chain complex \((R(S),{\bf \partial }^{\kappa})\), denoted

*H*(

*S*,

*κ*) or simply

*H*(

*S*). The elements of

*R*(

*S*) are called

*chains*.

Any cubical set *X*⊂ℝ^{ d } discussed in Sect. 2 defines an *S*-complex (*S*,*κ*), where \(S=\mathcal {K}(X)\) is the set of all elementary cubes of *X* and \(\kappa(Q,P):=\langle {\bf \partial }Q , P \rangle \), \({\bf \partial }\) the cubical boundary map. Its chain complex \((R(S),{\bf \partial }^{\kappa})\) is equal to \(\mathcal {C}(X;R)=\mathcal {C}(X)\otimes R\), the cubical chain complex of *X* with coefficients in *R*.

*R*

^{⋆}(

*S*):=Hom(

*R*(

*S*),

*R*) be the group of cochains. The

*coboundary map*defined as the dual \(\delta^{\kappa}:={ ({\bf \partial }^{\kappa})}^{\star}\) satisfies

*t*∈

*S*. Moreover, for any pair of a chain

*c*∈

*R*(

*S*

_{ q }) and a cochain

*d*∈

*R*

^{⋆}(

*S*

_{ q−1}) we have

*R*(

*S*),

*R*),

*δ*

^{ κ }) is called the

*cohomology of the*

*S-complex*and denoted

*H*

^{∗}(

*S*).

In the following, we will drop the superscript *κ* in \({\bf \partial }^{\kappa}\) and *δ* ^{ κ } whenever *κ* is clear from the context.

The technique of *S*-reductions consists of replacing the original set of generators *S* by a subset *S*′⊂*S*, and the original coincidence index *κ* by the restriction *κ*′:=*κ*|_{ S′×S′}. This has to be done in such a way that (*S*′,*κ*′) is still an *S*-complex, and the (co)homology does not change. A subset \(\mathcal {K}'\subset \mathcal {K}\) is an *S*-*subcomplex* of the *S*-complex \(\mathcal {K}\) if \((\mathcal {K}',\kappa')\), with \(\kappa':=\kappa|_{\mathcal {K}'\times \mathcal {K}'}\), the restriction of *κ* to \(\mathcal {K}'\times \mathcal {K}'\), is itself an *S*-complex, i.e. if \((R[\mathcal {K}'],\partial^{\kappa'})\) is a chain complex. Note that the concept of an *S*-subcomplex is not the same as the chain subcomplex (see [7, Example 1]).

*S*-subcomplexes are the closed and open subset of an

*S*-complex. In order to define these concepts we introduce the following notation for any subset

*A*⊂

*S*: We say that \(\mathcal {K}' \subset \mathcal {K}\) is

*closed*in \(\mathcal {K}\) if \(\mbox {bd\,}_{\mathcal {K}} \mathcal {K}' \subset \mathcal {K}'\). We say that \(\mathcal {K}' \subset \mathcal {K}\) is

*open*in \(\mathcal {K}\) if the complement \(\mathcal {K}\setminus \mathcal {K}'\) is closed. Note that if \(\mathcal {K}'\) is closed in \(\mathcal {K}\), then \(\partial^{\kappa}(R[\mathcal {K}'])\subset R[\mathcal {K}']\). Therefore, there is a well defined restriction

Similarly, if \(\mathcal {K}'\) is open in \(\mathcal {K}\), then there is a well defined quotient complex \((R[\mathcal {K}]/R[\mathcal {K}\setminus \mathcal {K}'],\partial')\) with the boundary map *∂*′ taken as the respective quotient map of *∂* ^{ κ }. From the computational point of view it is worth to observe that the quotient complex is isomorphic to the *S*-complex \((\mathcal {K}'',\delta^{\kappa''})\) where \(\mathcal {K}''=\mathcal {K}\setminus \mathcal {K}'\) and \(\kappa''=\kappa_{|\mathcal {K}''\times \mathcal {K}''}\) (cf. [20]).

The following theorem is a straightforward extension of Theorem 3.4 in [20] to cohomology.

### Theorem 3.1

*Let*(

*S*,

*κ*)

*be an*

*S*-

*complex over the ring R*,

*S*′⊂

*S*

*a closed subset and*

*S*″:=

*S*∖

*S*′

*the associated open subset*.

*Then we have the following long exact sequence of homology modules*:

*and the following long exact sequence of cohomology modules*:

*in which*

*ι*

_{∗}:

*H*

_{ q }(

*S*′)→

*H*

_{ q }(

*S*)

*and*

*ι*

^{∗}:

*H*

^{ q }(

*S*)→

*H*

^{ q }(

*S*′)

*are induced by the inclusion*

*ι*:

*R*(

*S*′)→

*R*(

*S*),

*whereas*

*π*

_{∗}:

*H*

_{ q }(

*S*)→

*H*

_{ q }(

*S*″)

*and*

*π*

^{∗}:

*H*

^{ q }(

*S*″)→

*H*

^{ q }(

*S*)

*are induced by the projection*

*π*:

*R*(

*S*)→

*R*(

*S*″).

### 3.2 *S*-Reduction Pairs and the Coreduction Algorithm

Let (*S*,*κ*) be an *S*-complex. A pair (*a*,*b*) of elements of *S* is called an *S-reduction pair* if *κ*(*b*,*a*) is invertible and either cbd_{ S }
*a*={*b*} or bd_{ S }
*b*={*a*}. In the first case the *S*-reduction pair is referred to as an *elementary reduction pair* and in the other case as an *elementary coreduction pair* .

Arguing as in the proof of [20, Theorem 4.1] we obtain the following theorem.

### Theorem 3.2

*Assume* *S* *is an* *S*-*complex and* (*a*,*b*) *is an* *S*-*reduction pair in S*. *If* (*a*,*b*) *is an elementary reduction pair then* {*a*,*b*} *is open in* *S*. *If* (*a*,*b*) *is an elementary coreduction pair then* {*a*,*b*} *is closed in* *S*. *Moreover*, *in both cases* {*a*,*b*} *is an* *S*-*subcomplex of* *S* *and* *H* _{∗}({*a*,*b*})=*H* ^{∗}({*a*,*b*})=0.

Theorems 3.1 and 3.2 result in the following corollary.

### Corollary 3.3

*If* (*a*,*b*) *is an* *S*-*reduction pair in an* *S*-*complex* *S*, *then the homology modules* *H*(*S*) *and* *H*(*S*∖{*a*,*b*}) *as well as the cohomology modules* *H* ^{∗}(*S*) *and* *H* ^{∗}(*S*∖{*a*,*b*}) *are isomorphic*.

Corollary 3.3 lies at the heart of the coreduction homology algorithm presented in [20, Algorithm 6.1]. The same algorithm without any changes may be used to speed up computation of cohomology modules. The algorithm consists of performing as many *S*-reductions as possible before applying the general Smith diagonalization algorithm to the reduced *S*-complex in order to compute the homology or cohomology module. To make it useful, one needs to find as many *S*-reduction pairs as feasible. In the case of simplicial complexes and cubical complexes it is straightforward to provide examples which admit elementary reduction pairs, but elementary coreduction pairs are not possible right away. However, it is easy to observe that by removing a vertex one obtains an open subcomplex which admits elementary coreduction pairs. Moreover, the homology of this subcomplex coincides with the reduced homology of the original complex and the cohomology of this complex coincides with the reduced cohomology of the original complex. Therefore, not only elementary reduction pairs, but also elementary coreduction pairs are useful when computing the homology or cohomology of simplicial or cubical complexes.

If the reduced *S*-complex is small when compared to the original *S*-complex then the coreduction algorithm is fast, because the reduction process is linear whereas the Smith diagonalization algorithm is supercubical. In fact, numerical experiments indicate that elementary coreduction pairs provide essentially deeper reductions than the elementary reduction pairs, and the speed up is essential. For details we refer the reader to [20, Sect. 5].

### 3.3 Homology Models

The Smith diagonalization algorithm applied to the reduced *S*-complex enables computing the cohomology module of the original *S*-complex up to isomorphism. In order to compute the cohomology ring of a cubical set it is not sufficient to have the cohomology generators in a reduced *S*-complex. It is necessary to construct the cohomology generators in the original cubical set.

In order to achieve this we need the following theorem which is an immediate consequence of [21, Theorems 2.8 and 2.9]:

### Theorem 3.4

*Assume*(

*S*,

*κ*)

*is an*

*S*-

*complex*, (

*a*,

*b*)

*is an*

*S*-

*reduction pair in*

*S*

*and*\(\bar{S}:=S\setminus\{a,b\}\).

*Then*\((\bar{S},\bar{\kappa})\)

*with*\(\bar{\kappa}:=\kappa_{|\bar{S}\times \bar{S}}\)

*is an*

*S*-

*subcomplex of*(

*S*,

*κ*)

*and the maps*\(\psi=\psi^{(a,b)}: R(S)\to R(\bar{S})\),

*respectively*, \(\iota=\iota^{(a,b)}: R(\bar{S}) \to R(S)\)

*given by*

*are mutually inverse chain equivalences*.

*In particular*,

*the chain complexes*\((R(S),{\bf \partial }^{\kappa})\)

*and*\((R(\bar{S}),{\bf \partial }^{\bar{\kappa}})\)

*are chain homotopic*.

Since mutually inverse chain equivalences induce isomorphisms in cohomology, we get the following corollary.

### Corollary 3.5

*If* (*S*,*κ*), *is an* *S*-*complex over the ring R* *and* (*a*,*b*) *is an* *S*-*reduction pair in* *S*, *then the isomorphisms pointed out in Corollary *3.3 *are induced by the chain maps defined in *(22) *and* (23) *for homology and their duals for cohomology*.

*reduction sequence*of an

*S*-complex (

*S*,

*κ*) is a sequence of pairs

*ω*={(

*a*

_{ i },

*b*

_{ i })}

_{ i=1,2,…,n }in

*S*such that (

*a*

_{ i },

*b*

_{ i }) is a reduction pair in (

*S*

^{ i−1},

*κ*

^{ i−1}), where the

*S*-complexes (

*S*

^{ i },

*κ*

^{ i }) are defined recursively by taking We then use the notation

*S*

^{ ω }for the last chain complex in the sequence of

*S*-complexes {

*S*

^{ i }}

_{ i=1,2,…,n }and call this

*S*-complex the

*ω-reduction*of

*S*. A

*homology model of*

*S*is an

*ω*reduction

*S*

^{ ω }together with the chain equivalences.

*S*-complex

*S*let us define first the

*weight of*

*S*by

The construction of a homology model of an *S*-complex *S* may be performed in time \(O(w(S)\operatorname {card}S)\) (see [20, Theorem 6.2]). In particular, in the case of cubical sets of fixed embedding dimension the homology model construction takes linear time. When the *ω*-*reduction* of *S* is small relative to *S*, one can profit from the homology model whenever homology generators and/or a decomposition of a homology class on the generators are needed. To construct the generators of *H*(*S*) one constructs the generators of *H*(*S* ^{ ω }) and transports them to *H*(*S*) via the map *ι* ^{ ω }, i.e. computes their image in *ι* ^{ ω }. The computational complexity of this computation is \(O(w(S)\operatorname {card}S)\) (see [21, Theorem 3.1]). To decompose a homology class in *H*(*S*) one transports the class via the map *ψ* ^{ ω } to *H*(*S* ^{ ω }) and finds the decomposition there. See [21, Sect. 3.1] for details.

### 3.4 Homology Models for Cohomology

Precisely the same method may be used to speed up the construction of the cohomology generators in *H* ^{∗}(*S*) and the same complexity analysis applies to this case. One only uses the dual (*ι* ^{ ω })^{⋆} of *ι* ^{ ω } to transport the cochains in the *S*-complex to its *ω* reduction and the dual (*ψ* ^{ ω })^{⋆} of *ψ* ^{ ω } to transport the cochains in the *ω*-reduction back to the original *S*-complex. However, the transport requires an analogue of Theorem 3.4 for the duals *ψ* ^{⋆} and *ι* ^{⋆}. For this it is convenient to make the following convention. If *T* is an *S*-subcomplex of the *S*-complex *S* and *t* is a generator in *T* then dual of *t* in *T* is the restriction to *T* of the dual of *t* in *S*. Since the dual of *t* in *S* is always zero on *S*∖*T*, it is convenient to identify both duals and denote them by the same symbol *t* ^{⋆}. Using this convention and the setting of Theorem 3.4 we have the following theorem.

### Theorem 3.6

*The duals of the chain maps*

*ψ*

*and*

*ι*

*are given by*

### Proof

*c*∈

*R*(

*S*). Then by (22) However, since \(t\in\bar{S}=S\setminus\{a,b\}\), we have

*t*

^{⋆}(

*b*)=0. Thus, we get

*s*∈

*S*and \(c\in R(\bar{S})\). Then by (23) we have which proves (25). □

Surprisingly, there are even more benefits from the homology model for cohomology computations than for homology computations. This is because of the following theorem.

### Theorem 3.7

*Assume*

*ω*

*is a reduction sequence of an*

*S*-

*complex consisting only of elementary coreduction pairs*.

*Then*(

*ψ*

^{ ω })

^{⋆}

*is an inclusion*

*that is*, (

*ψ*

^{ ω })

^{⋆}(

*c*)=

*c*

*for any*

*c*∈

*R*

^{⋆}(

*S*

^{ ω }).

### Proof

If (*a*,*b*) is an elementary coreduction pair, then bd *b*={*a*}. Since \(a\not\in \bar{S}=S\setminus\{a,b\}\), we have 〈*b* ^{⋆},*δc*〉=〈*∂b*,*c*〉=0 for any \(c\in R(\bar{S})\). Therefore, (*ψ* ^{(a,b)})^{⋆}(*c*)=*c* for any \(c\in {R}^{\star}(\bar{S})\). Since the reduction sequence *ω* consists only of elementary coreduction pairs, the conclusion follows. □

Note the following consequence. In the case of a reduction sequence *ω* consisting only of elementary coreduction pairs there is no need to transport the cohomology generators from the *ω*-reduction back to the original *S*-complex. The cohomology generators constructed in the *ω*-reduction are the cohomology generators in the original *S*-complex. This is particularly useful for computing the ring structure of a cubical set *X*, because we can apply formula (14) directly to the cohomology generators in the *ω*-reduction.

### 3.5 Computational Example

^{3}homeomorphic to

*S*

^{2}∨

*S*

^{1}∨

*S*

^{1}(see Fig. 4 top left).

*X*outputs a model

*X*

^{ ω }with respect to a reduction sequence

*ω*. The model consists of the following cells:

*X*

^{ ω }, and the cohomology class of the cocycle

*X*

^{ ω }. By Theorem 3.7 and Theorem 3.4 [

*α*], [

*β*] form the basis of

*H*

^{1}(

*X*) and [

*γ*] generates

*H*

^{2}(

*X*).

^{3}homeomorphic to a torus (see Fig. 4 bottom left).

*T*outputs a model

*T*

^{ ω }with respect to a reduction sequence

*ω*. The model consists of the following cells:

*T*

^{ ω }and the cohomology class of the cocycle

*T*

^{ ω }. By Theorem 3.7 and Theorem 3.4 [

*α*], [

*β*] form the basis of

*H*

^{1}(

*T*) and [

*γ*] generates

*H*

^{2}(

*T*).

*X*and

*T*are different. In this simple case, it is possible to make the necessary computations by hand. However, one may have two cubical sets homeomorphic respectively to

*X*and

*T*whose representations consist of millions of cubes. Such cubical sets often result from rigorous numerics of dynamical systems, data or image analysis. The benefits from computing the ring structure via the cohomology model is evident. This is visible even in the case of a simple rescaling (for the definition of rescaling see [15, Sect. 6.4.2]) of the cubical sets in our two examples (see Fig. 5).

## Notes

### Acknowledgements

The authors wish to express their gratitude to the referees for their valuable comments which helped to improve the quality of this paper.

T. Kaczynski is supported by the NSERC of Canada discovery grant and by the MNiSW grant N N201 419639. M. Mrozek is supported by the MNiSW grant N N201 419639.

### Open Access

This article is distributed under the terms of the Creative Commons Attribution License which permits any use, distribution, and reproduction in any medium, provided the original author(s) and the source are credited.

## References

- 1.M. Allili, D. Corriveau, Topological analysis of shapes using Morse theory,
*Comput. Vis. Image Underst.***105**, 188–199 (2007). CrossRefGoogle Scholar - 2.R. Brown, P.J. Higgins, The algebra of cubes,
*J. Pure Appl. Algebra***21**, 233–260 (1981). MathSciNetCrossRefzbMATHGoogle Scholar - 3.G. Carlsson, T. Ishkhanov, V. de Silva, A. Zomorodian, On the local behavior of spaces of natural images,
*Int. J. Comput. Vis.***76**(1), 1–12 (2008). CrossRefGoogle Scholar - 4.CHomP,
*Computational homology project*, http://chomp.rutgers.edu. - 5.S. Day, W.D. Kalies, T. Wanner, Verified homology computations for nodal domains,
*SIAM Multiscale Model. Simul.***7**(4), 1695–1726 (2009). MathSciNetCrossRefzbMATHGoogle Scholar - 6.P. Dłotko,
*Algorytmy redukcji w obliczeniowej teorii homologii i kohomologii z zastosowaniami*, Ph.D. thesis, Jagiellonian University, Kraków (2012). Google Scholar - 7.P. Dłotko, R. Ghrist, M. Juda, M. Mrozek, Distributed computation of coverage in sensor networks by homological methods,
*Appl. Algebra Eng. Commun. Comput.***23**, 29–58 (2012). doi: 10.1007/s00200-012-0167-7. CrossRefzbMATHGoogle Scholar - 8.P. Dłotko, T. Kaczynski, M. Mrozek, T. Wanner, Coreduction homology algorithm for regular CW-complexes,
*Discrete Comput. Geom.***46**, 361–388 (2011). doi: 10.1007/s00454-010-9303-y. MathSciNetCrossRefzbMATHGoogle Scholar - 9.P. Dłotko, R. Specogna, Efficient cohomology computation for electromagnetic modeling,
*Comput. Model. Eng. Sci.***60**(3), 247–278 (2010). Google Scholar - 10.H. Edelsbrunner, J. Harer,
*Computational Topology. An Introduction*(Am. Math. Soc., Providence, 2010). zbMATHGoogle Scholar - 11.G. Ellis, GAP-HAP homological algebra programming, http://www.gap-system.org/Packages/hap.html.
- 12.R. González-Diáz, M.J. Jimenez, B. Medrano, Cubical cohomology ring of 3D photographs,
*Imaging Syst. Technol.***21**(1), 76–85 (2011). CrossRefGoogle Scholar - 13.R. González-Diáz, P. Real, Computation of cohomology operations on finite simplicial complexes,
*Homology Homotopy Appl.***5**(2), 83–93 (2003). MathSciNetzbMATHGoogle Scholar - 14.P.W. Gross, P.R. Kotiuga,
*Electromagnetic Theory and Computation*(Cambridge University Press, Cambridge, 2004). CrossRefzbMATHGoogle Scholar - 15.T. Kaczynski, K. Mischaikow, M. Mrozek,
*Computational Homology*. Appl. Math. Sci. Series, vol. 157 (Springer, New York, 2004). zbMATHGoogle Scholar - 16.C. Landi, Persistent homology and partial matching of shapes, in
*Proc. CTIC 2010*, ed. by R. González-Diáz, P. Real (2010), pp. 137–142. Image–A**1**(1). Google Scholar - 17.W.S. Massey,
*A Basic Course in Algebraic Topology*(Springer, New York, 1991). zbMATHGoogle Scholar - 18.K. Mischaikow, M. Mrozek, The Conley index theory, in
*Handbook of Dynamical Systems III: Towards Applications*, ed. by B. Fiedler, G. Iooss, N. Kopell (Elsevier, Singapore, 2002), pp. 393–460. Google Scholar - 19.D. Morozov, Dionysus, http://www.mrzv.org/software/dionysus/.
- 20.M. Mrozek, B. Batko, Coreduction homology algorithm,
*Discrete Comput. Geom.***41**, 96–118 (2009). MathSciNetCrossRefzbMATHGoogle Scholar - 21.M. Mrozek, Th. Wanner, Coreduction homology algorithm for inclusions and persistent homology,
*Comput. Math. Appl.***60**(10), 2812–2833 (2010). doi: 10.1016/j.camwa.2010.09.036. MathSciNetCrossRefzbMATHGoogle Scholar - 22.M. Mrozek, M. Żelawski, A. Gryglewski, S. Han, A. Krajniak, Homological methods for extraction and analysis of linear features in multidimensional images,
*Pattern Recognit.***45**, 285–298 (2012). doi: 10.1016/j.patcog.2011.04.020. CrossRefGoogle Scholar - 23.J.R. Munkres,
*Elements of Algebraic Topology*(Addison-Wesley, Reading, 1984). zbMATHGoogle Scholar - 24.RedHom,
*Reduction algorithms for homology computation*, http://redhom.ii.uj.edu.pl/. - 25.J.P. Serre, Homologie singulière des espaces fibrés,
*Appl. Ann. Math.***54**(3), 425–505 (1951). zbMATHGoogle Scholar