On the Loop Homology of a Certain Complex of RNA Structures

: In this paper, we establish a topological framework of τ -structures to quantify the evolutionary transitions between two RNA sequence–structure pairs. τ -structures developed here consist of a pair of RNA secondary structures together with a non-crossing partial matching between the two backbones. The loop complex of a τ -structure captures the intersections of loops in both secondary structures. We compute the loop homology of τ -structures. We show that only the zeroth, ﬁrst and second homology groups are free. In particular, we prove that the rank of the second homology group equals the number γ of certain arc-components in a τ -structure and that the rank of the ﬁrst homology is given by γ − χ + 1, where χ is the Euler characteristic of the loop complex.


Introduction
Ribonucleic acid (RNA) is a biomolecule that folds into a helical configuration of its primary sequence by forming hydrogen bonds between pairs of nucleotides. The most prominent class of coarse-grained structures are the RNA secondary structures [1,2]. These are contact structures that can be represented as diagrams where vertices are nucleotides and arcs are base pairs drawn in the upper half-plane. As a secondary structure can be uniquely decomposed into loops, the free energy of a structure is calculated as the sum of the energy of its individual loops [3]. The loop-based energy models for RNA secondary structure prediction have played an important role in unveiling the various regulatory functions of RNA [4].
RNA molecules evolve under selection pressures on both sequence and structure. One prominent example are RNA riboswitches [5], which is a class of RNA molecules that can express two alternative secondary structures, each of which appears in a specific biophysical context. In order to analyze riboswitch sequences, Huang et al. developed a Boltzmann sampler of sequences that are simultaneously compatible with a pair of structures, i.e., a bi-secondary structure, based on the loop energy model [6]. The time complexity of computing such bi-compatible sequences turns out be intimately related to the number of so called exposed nucleotides, i.e., the number of vertices shared by multiple loops appearing in the algorithm. In some sense, finding bi-compatible sequences is easy if the intersection of such loops is small and becomes difficult when the intersection is large. In order to address the complexity problem, Bura et al. studied the simplicial homology of the loop complex (derived from the intersections of loops) of a bi-secondary structure [7,8]. Subsequently, they introduced the weighted homology of bi-structures, in which simplices are endowed with specific weights allowing the expression of the size of the loop intersections [9].
The aforementioned work focuses on the structural transition without changing the underlying sequence. However, selection pressures act on both sequence and structure, resulting in the simultaneous change of genotypes and phenotypes. This motivates the study of the evolutionary transition between two distinct sequence-structure pairs. In what follows, we take the first step by, analogous to [7,8], computing the simplicial homology of their loop complex.
In this paper we study triples, (S, T, φ), consisting of an ordered pair of RNA secondary structures, (S, T), [1,2,[10][11][12][13] together with a non-crossing partial matching, φ, between the two backbones. We shall denote such a triple a transition structure or τ-structure and note that the mapping φ relates homologous bases between two underlying RNA sequences.
The topological framework of τ-structures developed here is designed to quantify the probability of evolutionary transitions between RNA sequence-structure pairs subject to specific sequence constraints. In an algorithmic guise, τ-structures play a central role in solving the following computational problem: Given two arbitrary RNA secondary structures, determine a pair of specifically related sequences that minimizes the total free energies of the two sequence-structure pairs. Our main objective is to compute the simplicial homology of the loop complex of a τ-structure. In order to state our main theorem, we next introduce the notions of φ-crossing and arc-component.
Two arcs (i 1 , i 2 ) and (j 1 , j 2 ) are φ-crossing, i.e., if either one of the following is the case: (1) Both i 1 and i 2 are incident to φ-arcs such that φ(i 1 ) < j 1 < φ(i 2 ) < j 2 or j 1 < φ(i 1 ) < j 2 < φ(i 2 ), or; (2) Both j 1 and j 2 are incident to φ-arcs such that φ-crossing induces an equivalence relation for which nontrivial equivalence classes are called arc-components. An arc-component is of type 1 if both endpoints of any arc are incident to φ-arcs.
We shall prove the following main result.
Main Theorem. Let I = (S, T, φ) be a τ-structure and H n (I) the n-th homology group of its loop complex, K(I). Then, the following is the case: where γ denotes the number of arc-components of type 1 and χ the Euler characteristic of K(I).
Our framework generalizes the work of [7,8] on bi-structures. Bi-structures can be viewed as particular τ-structures, namely those over two identical sequences. The loop complex of a bi-structure exhibits only a nontrivial zeroth and second homology, the latter being freely generated by crossing components [7,8]. On the algorithmic side, τ-structures play a similar role as bi-structures in [6] where a Boltzmann sampler of sequences that are simultaneously compatible with two structures is presented.
The loop complex of τ-structures exhibits a variety of new features. First it has in general a nontrivial first homology group. Secondly, it features two types of arc-components: Those of type 1, which correspond to spheres, and arc-components of type 2, which correspond to surfaces with a nontrivial boundary (see Section 7).
In order to prove the main theorem, we first establish basic properties of the loop complex X = K(I). Secondly, we manipulate X by means of simplicial collapses and then dissect K 1 , which is a certain sub-complex of dimension one. As a result, we deriveX 2 , which is a specific X-sub-complex, and we organize it into its crossing components. We note thatX 2 is not unique, as its construction depends on certain choices. We then proceed with a combinatorial analysis ofX 2 -crossing components, which lays the foundation for proving that their geometric realizations are either spheres or surfaces with boundary.
The combinatorics of crossing components, specifically Lemma 6, further controls the manner crossing components are glued and this observation facilitates to prove the main result in two stages. First, by computing the homology of components in isolation and, secondly, by computing the homology of the loop complex by Mayer-Vietoris sequences. Several of our arguments are reminiscent of ideas of classical facts, for instance the Jordan curve theorem in the proof of Lemma 7.
The paper is organized as follows: In Section 2, we recall the definitions of RNA secondary structures, bi-structures and their loop complexes. In Section 3, we introduce τ-structures and present some basic facts of their loop complexes. In Section 4, we simplify the loop complex in multiple rounds via simplicial collapses and topological stratification. In Section 5, we investigate the combinatorics of crossing components in the simplified complex. We then compute the homology of components in Section 6 and integrate this information in order to obtain the homology of τ-structures in Section 7. Finally we discuss our results in Section 8.

Secondary Structures, Bi-Structures and the Loop Complex
An RNA secondary structure encapsulates the nucleotide interactions within a single RNA sequence. It can be represented as a diagram, which consists of a labeled graph over the vertex set [n] := {1, . . . , n} for which the vertices are arranged in a horizontal line and arcs are drawn in the upper half-plane. Each vertex corresponds to a nucleotide in the primary sequence and each arc, which is denoted by (i, j), represents the base pairing between the i-th and j-th nucleotides in the RNA structure. Two arcs (i 1 , j 1 ) and (i 2 , j 2 ) are crossing if i 1 < i 2 < j 1 < j 2 . An RNA secondary structure is defined as a diagram satisfying the following three conditions [1,2]: (1) if (i, j) is an arc, then j − i ≥ 2; (2) any two arcs do not have a common vertex; (3) any two arcs are non-crossing.
Given a secondary structure S, the set [1, n] := {1, . . . , n} is called the backbone and an interval [i, j] ⊂ [1, n] denotes the set of consecutive vertices {i, i + 1, . . . , j − 1, j}. A vertex k is covered by an arc (i, j) if i ≤ k ≤ j and there exists no other arc (p, q) such that i < p < k < q < j. The set of vertices covered by an arc (i, j) is called a loop, s, and we refer to (i, j) as the covering arc of s. We shall equip each diagram with two "formal" vertices at positions 0 and n + 1 together with the arc (0, n + 1), which we call the rainbow. Its associated distinguished loop is called the exterior loop. Each loop, s, can be represented as a disjoint union of intervals on the backbone of S, s = l k=1 [i k , j k ], such that (i 1 , j l ) and (j k , i k+1 ) for 1 ≤ k ≤ l − 1 form arcs and any other vertices in s are unpaired. By construction, a diagram S is in one-to-one correspondence with its set of arcs as well as its set of loops {s i } i . Let X be a collection of finite sets. A subset {X 0 , X 1 , . . . , The nerve formed by the collection {s i } i of S-loops is referred to as the loop complex K(S) of a secondary structure S. The fact that secondary structures correspond to noncrossing diagrams immediately implies that the loop complex of a secondary structure is a tree.
Let S and T be two secondary structures. The pair of secondary structures S and T over [n], R = (S, T), is called a bi-structure. We represent a bi-structure as a diagram on a horizontal backbone with the S-arcs drawn in the upper and the T-arcs drawn in the lower half plane. The nerve formed by S-loops and T-loops of a bi-structure, R, is called the loop complex, K(R).
In bi-structures [7], two arcs α, α are equivalent if there exists a sequence of arcs α 1 = α, α 2 , . . . , α l = α such that two consecutive arcs α k and α k+1 are crossing for 1 ≤ k ≤ l − 1. A crossing component of R = (S, T) is an equivalence class that contains at least two crossing arcs.
The loop complex of a bi-structure has a nontrivial zeroth and second homology group. In particular, the first homology H 1 (R) is zero and the second homology H 2 (R) is free and its rank equals the number of crossing components of the bi-structure R [8].

Some Basic Facts
Let S and T be two secondary structures over [n] and [m], respectively. We shall refer to their backbones as [n] S = {1 S , 2 S , . . . , n S } and [m] T = {1 T , 2 T , . . . , m T }. We refer to the pair (i, φ(i)) as a φ-arc between i ∈ [n] S and φ(i) ∈ [m] T . Two φ-arcs (i 1 , φ(i 1 )) and (i 2 , φ(i 2 )) are crossing if i 1 < i 2 and φ(i 1 ) > φ(i 2 ). Definition 1. A τ-structure I is a triple (S, T, φ) consisting of an ordered pair of secondary structures, (S, T), together with a partial matching φ between their vertex sets [n] S and [m] T such that any two φ-arcs are non-crossing.
In analogy to the case of bi-structures, we shall represent the diagram of a τ-structure as a labeled graph over two horizontal backbones in which S-arcs are drawn in the upper halfplane and T-arcs are drawn in the lower halfplane with the edges drawn in between the two backbones representing φ (see Figure 1).
A bi-structure corresponds to a particular τ-structure having two backbones of the same length and φ being the identity map. The partial matching φ induces an equivalence relation ∼ on the set of vertices of the two backbones by identifying for each pair (i, φ(i)) the vertices i and φ(i). The φ-arcs then correspond one-to-one to nontrivial equivalence classes of size two. This equivalence relation gives rise to the definition of a loop in a τ-structure. Proposition 1. Let I = (S, T, φ) be a τ-structure and v 1 , v 2 be two distinct S-vertices. Then v 1 =v 2 . In particular there exists a bijection between vertices in an S-loop s and vertices in the correspondingS-loops.
By abuse of notation, we refer toS-loops andT-loopss,t simply as S-loops and T-loops s, t, respectively. Proposition 3. Let I be a τ-structure with loop complex K(I). Then, any 2-simplex σ ∈ K 2 (I) has the form {s 1 , s 2 , t 1 } or {t 1 , t 2 , s 1 }, where s 1 , s 2 are S-loops and t 1 , t 2 are T-loops.
Proof. By construction, the three loops in a 2-simplex σ have a non-empty intersection. In view of Proposition 2, not all three loops are from the same secondary structure. Therefore, σ is of the form {s 1 , s 2 , t 1 } or {t 1 , t 2 , s 1 }.
A 1-simplex σ = {r 1 , r 2 } ∈ K(I) is called pure if both r 1 and r 2 belong to the same secondary structure and mixed. Proposition 3 shows that any 2-simplex contains exactly one pure edge and two mixed edges.
Proof. By Proposition 5, σ contains at least one σ-free mixed edge ω. Let ∆ 1 and ∆ 2 denote the 2-faces of σ containing ω. Suppose that there exists a simplex σ 1 satisfying ∆ 1 ⊂ σ 1 and σ 1 ⊂ σ. Then σ 1 also contains ω, which contradicts ω being σ-free. Therefore, ∆ 1 is σ-free and, analogously, we derive that ∆ 2 is σ-free. Proof. By assumption, φ induces at least one φ-arc, which in turn gives rise to at least a 1-simplex connecting an S-loop and a T-loop. Therefore, K(I) is path-connected and H 0 (I) ∼ = Z. By the pigeonhole principle, for any set of d + 1 I-loops with d ≥ 4, at least three belong to the same secondary structure. By Proposition 2, these three loops intersect trivially. Thus, for d ≥ 4, the intersection of any d + 1 loops is trivial. As a result, K(I) does not contain simplices of dimension four or higher. Therefore, K d (I) = ∅ and H d (I) = 0 for d ≥ 4.

From X toX 2
We now begin computing the homology of the loop complex of a τ-structure. Directly constructing its discrete Morse function [14,15] or gradient vector field seems rather involved. We shall take a slightly different approach along the lines of discrete Morse theory. We shall simplify the loop complex in multiple rounds and render it amendable to its homological analysis. One of these simplifications is obtained via elementary collapses, which is a reduction introduced by J.H.C. Whitehead [16]. These collapses can be understood in terms of non-critical points of the Morse function.

Simplicial Collapses
The notion of elementary collapse is closely related to the freeness of a simplex. Given a complex K, let σ be a maximal simplex and ∆ be a σ-free face with codimension 1. The removal of σ and ∆ constitutes elementary collapse [16,17] and gives rise to a new complex K \ {σ, ∆}. We say that K simplicial collapses to a sub-complex K , which is denoted by K K if there is a sequence of complexes K 0 = K, K 1 , . . . , K q = K such that K i is obtained from K i−1 via an elementary collapse. Clearly, K and K are homotopy equivalent.
In the following, we shall employ simplicial collapses in order to reduce the loop complex in two steps: first, eliminating all tetrahedra and then removing triangles possessing a free edge.
Step 1: Given a 3-simplex σ 1 = {s 1 , s 2 , t 1 , t 2 }, Proposition 5 guarantees that σ 1 always has a free mixed edge ω and two free triangles ∆ 1 , ∆ 1 containing ω. The triple (ω, ∆ 1 , ∆ 1 ) is called a σ 1 -butterfly. In analogy to the analysis in case of bi-structures [7], we perform the butterfly removal on the loop complex. Specifically, the simplicial collapse consists of two elementary collapses with respect to (σ 1 , ∆ 1 ) and (∆ 1 , ω) and provides us a sub-complex We observe that K 1 is again the loop complex of a τ-structure I 1 = (S 1 , T 1 , φ 1 ) obtained by splicing vertices in I as follows: For any I-vertex q ∈ s 1 ∩ s 2 ∩ t 1 ∩ t 2 , suppose that q is the equivalence class of an S-vertex i and a T-vertex j. Then, there is a φ-arc connecting i and j, i.e., φ(i) = j. We now splice i into two consecutive vertices i 1 , i 2 and splice j into two consecutive vertices j 1 , j 2 . The φ-arc φ(i) = j is replaced with two new φ-arcs φ 1 (i 1 ) = j 1 and φ 1 (i 2 ) = j 2 . The arcs are connected in a manner such that the mixed edge ω is not formed in K 1 . In the case of ω = {s 1 , t 2 }, we depict the resulting τ-structure I 1 in Figure 3 and note that all other cases are treated similarly. Furthermore, we remove any other φ-arcs that give rise to ∆ 1 , ∆ 1 or ω. It is straightforward to verify that the loop complex of I 1 is exactly Figure 3. The σ 1 -butterfly removal. The simplicial collapse of the butterfly (ω, ∆ 1 , ∆ 1 ) corresponds to splicing vertices in the τ-structure. Here, The vertex i is split into two consecutive vertices i 1 , i 2 and j is split into two consecutive vertices j 1 , j 2 . The φ-arc φ(i) = j is replaced with two new φ-arcs φ 1 (i 1 ) = j 1 and φ 1 (i 2 ) = j 2 . Depending on the situation, the arcs are connected in a manner such that the loop s 1 and the loop t 2 do not intersect.
By iteratively eliminating all 3-simplices, σ and the associated σ-butterflies, we derive a sequence of sub-complexes K 0 = K(I), K 1 , . . . , K q = X such that X does not contain any 3-simplices. Accordingly, we obtain a sequence of τ-structures I 0 = I, I 1 , . . . , I q = I by splicing the corresponding vertices of σ such that the loop complex of I j is given by K j . It is clear that the sub-complex X satisfies the following property. Lemma 1. Let K(I) be the loop complex of a τ-structure I and X be the complex obtained by removing from K(I) all 3-simplices σ and the associated σ-butterflies. Then the following is the case: (1) X is the complex of a τ-structure I such that each φ-arc is incident to at most one arc; (2) X is a sub-complex of K(I) such that the 0-th skeleton X (0) = K(I) (0) and X does not contain any 3-simplices; A complex possessing the properties of Lemma 1 is called lean. As an immediate consequence we obtain the following.
Proof. In view of Proposition 1, as a sub-complex of K(I), X does not contain any 3simplices. For X holds ker Step 2: Suppose that ∆ 1 is a 2-simplex in X having a free 1-face ω 1 . By collapsing (∆ 1 , ω 1 ), we obtain a sub-complex X 1 = X \ {∆ 1 , ω 1 }. By successively deleting 2-simplices ω together with τ-free edges, we derive a sequence of sub-complexes X 0 = X, X 1 , . . . , X m = X such that each 2-simplex ofX does not contain any free 1-face.

Proposition 8.
LetX be a complex obtained from X by iteratively removing all 2-simplices ω together with τ-free 1-face. Then, the following is the case: (1)X is a sub-complex of X such that the 0-th skeletonX (0) = X (0) and each 2-simplex ofX does not have a free 1-face; (2) For n ≥ 0, we have H n (X) ∼ = H n (X).

Remark 1.
The sub-complexX is not unique. By construction,X depends on the particular sequence of the simplicial collapses, as well as which free face of a simplex is being removed (see Figure 5) Lemma 1 guarantees thatX is derived from a lean complex.

Lemma 2.
LetX be the sub-complex derived from a lean complex, then the following is the case: (2) Any pure 1-simplex ω ofX is either maximal or contained in exactly two 2-simplices ∆, ∆ .
In the latter case, ω is associated with an arc (i, i ) in I, such that vertices i, i are incident to φ-arcs (i, j) and (i , j ), respectively.

Proof. For any
Lemma 1 guarantees thatX does not contain any 3-simplices, i.e., we have the following.
Therefore, sets s 1 ∩ s 2 ∩ t 1 and s 1 ∩ s 2 ∩ t 1 are disjoint and both have cardinality 1, whence assertion (1) follows. Let s 1 ∩ s 2 ∩ t 1 = {ī}, then ∆ is in one-to-one correspondence with the vertex i as well as its induced φ-arc (i, φ(i)) in I.
Suppose the pure 1-simplex ω is not maximal, then there exists at least one 2-simplex ∆ having ω as a face. Since we work in the complexX, ω cannot be ∆-free, whence there exists another 2-simplex ∆ containing ω. Assertion (1) then implies that ∆ and ∆ are the only such 2-simplices, which completes the proof.

Topological Stratification
We shall next show that the complexX is topologically stratified and decomposes into two sub-complexesX 2 and K 1 , whereX 2 is induced by allX-2-simplices and K 1 by all 1-simplices ofX \X 2 (see Figure 6)  Figure 6. Topological stratification.X stratifies into a sub-complexX 2 induced by all 2-simplices and K 1 induced by the remaining 1-simplices.
Proof. By construction,X 2 is a sub-complex ofX. We have the short exact sequence of By construction,X does not have any 3-simplices, which implies that C 3 (X,X 2 ) = 0. SinceX 2 contains all 2-simplices inX, we have C 2 (X,X 2 ) = 0. Then we derive H 3 (X,X 2 ) = H 2 (X,X 2 ) = 0. In view of the long exact sequence, we have the following: . For n = 1, the long exact sequence reads as follows: which induces the following exact sequence.
The relative homology C 1 (X,X 2 ) is freely generated by the 1-simplices inX \X 2 .
By definition, we have H 1 (X, . In view of Im(∂ 2 ) = 0, H 1 (X,X 2 ) ∼ = ker(∂ 1 ) and H 1 (X,X 2 ) is free. As a subgroup of the free group H 1 (X,X 2 ), Im j * is free and thus projective. Then, the short exact sequence is split exact and the following is the case: where the non-negative integer k = rnk(Im j * ) depends on K 1 andX 2 ∩ K 1 .
Proposition 9 shows that the sub-complex K 1 gives rise to only free generators in the first homology ofX.

Some Combinatorics of Crossing Components
In order to compute the homology ofX, we introduce an equivalence relation partitioning the set of 2-simplices. To this end, we observe that 2-simplices ofX appear in pairs: Given a 2-simplex ∆ with pure edge, ω, Lemma 2 guarantees that there exists a unique 2-simplex ∆ such that ∆ ∩ ∆ = ω. Each pair (∆, ∆ ) is associated with a unique arc (i 1 , i 2 ) and i 1 and i 2 are incident to the φ-arcs, (i 1 , φ(i 1 )) and (i 2 , φ(i 2 )). We refer to (∆, ∆ ) together with their pure and φ-arcs as a couple.
Claim: Given a C 1 -couple (∆, ∆ ) with φ-arcs (i, j) and (i , j ), then there exists a block β k that contains both (i, j) and (i , j ).
Firstly, both endpoints i, j are contained in the same C-block otherwise (i, j) would cross a C-φ-arc. Suppose (i, j) and (i , j ) are contained in different C-blocks. Since C and C 1 are distinct components, C-couples and C 1 -couples are mutually non-crossing. As a result, C 1 partitions the C-couples into to two non-empty subsets, one contained in (i, i ) S ∪ (j, j ) T and the other in [1, i) S ∪ (i , n] S ∪ [1, j) T ∪ (j , m] T . By construction, any couple contained in the former subset and any pair in the latter are non-crossing, which is impossible since C is a component. It follows that there exists a C-block β k that contains both (i, j) and (i , j ). Any C 1 -couple (∆ 1 , ∆ 1 ) that crosses (∆, ∆ ) has at least one φ-arc contained in β k . By the above argument, both of its φ-arcs are then contained in β k , i.e., β k contains (∆ 1 , ∆ 1 ). Since C 1 is a component this implies that any C 1 -couple is contained in β k . Lemma 3 gives rise to a relation over the set ofX-components as follows: C 1 ≺ C 2 if all C 1 -φ-arcs are contained in an inner block of C 2 . In view of Lemma 3, we can verify that the relation ≺ is a well-defined partial order. In Figure 7, C 2 ≺ C 5 , C 3 ≺ C 5 and C 1 , C 4 , C 5 are maximal.
We next identify how two 2-simplices that share a mixed edge affect the location of couples along the two backbones. This reflects the planarity of τ-structures and has important consequences for how components are glued in the loop complex.
Let C be a component and ω a C-1-face. Lemma 5 implies that ω is contained in either one or two C-2-simplices. We call a 1-face ω that is contained in a unique C-2-simplex C-free. Furthermore we call a component C complete if, for any of its 1-faces ω, there exist exactly two 2-simplices ∆, ∆ ∈ C such that ∆ ∩ ∆ = ω and incomplete, otherwise.
The next lemma constitutes a key observation which facilitates the computation of the homology of τ-structures via the Mayer-Vietoris sequence, see Theorem 2.

Lemma 6.
Let C be anX-component having boundary ω 1 and ω l , and let C 1 be anX-component with the property C 1 ≺ C. Suppose that ω is a 1-simplex shared by C and C 1 , then ω = ω 1 or ω = ω l .
Proof. Let ∆ 1 , ∆ 2 , . . . , ∆ l denote the 2-simplices of C associated with the φ-arcs (i 1 , j 1 ), (i 2 , j 2 ), . . . , (i l , j l ), ordered from left to right. Suppose that ∆ 0 ∈ C 1 and ∆ k ∈ C share a common mixed edge ω and have the φ-arcs (i 0 , j 0 ) and (i k , j k ), respectively. In view of C 1 ≺ C, C 1 is contained in the outer C-block and we may by w.l.o.g. assume that i 0 < i 1 .
The fact ∆ 0 ∩ ∆ k = ω, now organizes C relative to ∆ k in a particular fashion, see Figure 9. Employing Lemma 4 we obtain that, except of (∆ k , ∆ k ), all C-couples partition into the following.
Now we use the fact that that C is a component: Firstly, any A 1 -couple and any A 2 -couple are by construction non-crossing. Secondly, by construction, (∆ k , ∆ k ) is crossing into either only one A 1 or A 2 , which implies that either one, A 1 or A 2 , is trivial.
m] T , marked by dashed parallelograms.

The Homology of Components
In order to compute the homology of τ-structures, we shall first compute the homology of components separately and then integrate this information via the Mayer-Vietoris sequence [18,19]. To this end we adopt a topological perspective of crossing components, taking a closer look at the manifold formed by 2-simplices of a component obtained via gluing along their edges.
Given a component C, two couples (∆ 1 , Clearly, ∼ 1 is an equivalence relation and partitions all pairs in C into equivalence classes D 1 , D 2 , . . . , D k , which we refer to as C-ribbons.

Lemma 7. The geometric realization of a completeX-component, C is a sphere.
Proof. Suppose that ∼ 1 partitions all C-pairs into the ribbons D 1 , D 2 , . . . , D k . Claim 1: The geometric realization of a ribbon, D i , is a surface without boundary. Since C is complete, for each 2-simplex ∆ ∈ D i and its 1-face ω, there exists a unique 2-simplex ∆ 1 ∈ C such that ∆ ∩ ∆ 1 = ω. By construction, ∆ 1 is further contained in D i . This implies that the geometric realization of D i is a compact and connected 2-manifold, i.e., a surface without boundary.
Let T D i denote the D i -sub-complex consisting of all pure edges for which its loops are T-loops. We shall employ T D i in order to relate the crossing relation with ∼ 1 .
Claim 2: T D i is connected, i.e., T D i is a subtree of T. Suppose that T D i contains at least two connected components T 1 and T 2 . Let D denote the subset of 2-simplices of D i containing at least one T 1 -vertex. Since all 2-simplices of D are incident to the connected component T 1 , the complex formed by D is connected. D does not contain any T 2 -vertices, since otherwise there would, by construction of D , exist a pure edge connecting a T 1 -vertex and a T 2 -vertex, which contradicts the assumption that T D i is disconnected. Thus, D is a connected, which is a proper subset of D i , and its geometric realization is a surface having boundary B, see Figure 10. The set of 2-simplices containing a fixed T 1 -vertex, t, forms a neighborhood of t in the D i -induced surface, whence any T 1 -vertex is contained in the interior of D . Consequently, the boundary does not contain any T 1 -vertex. From this, we conclude that the boundary, being a cycle, consists of only S-loops. This, however, is impossible since the complex of a secondary structure S is a tree.
Claim 3: C consists of a unique ribbon. Suppose that C contains at least two ribbons D 1 and D 2 . Since C is a component, there exists a couple (∆, ∆ ) in D 1 and (∆ 0 , ∆ 0 ) not contained in D 1 , such that (∆, ∆ ) and (∆ 0 , ∆ 0 ) are crossing.
Therefore C is organized as a single ribbon, for which its geometric realization is a surface without boundary. We shall proceed by computing its Euler characteristic χ.
Suppose that C contains n pairs (∆, ∆ ). Then the complex C features 2n 2-simplices and 3n 1-simplices. Claim 2 stipulates the connectivity of S C and T C , whence both S C and T C are connected subsets of trees and as such trees themselves. We shall use this in order to count 0-simplices as follows: each pair (∆, ∆ ) corresponds to one pure 1-simplex in S C or T C . Thus S C and T C contain n 1-simplices, which implies that C contains n + (1 + 1) 0-simplices. From this, it follows χ = 2 and C is homeomorphic to a sphere.

Remark 2.
The key in the proof is to show that the projection of D i onto each secondary structure, T D i , is connected. If T D i is disconnected, then we can construct a cycle separating different connected components and consisting of only S-loops, resulting in a contradiction. The proof is reminiscent of the Jordan curve theorem in the plane [20,21].
While any complete component is organized as a distinguished ribbon, an incomplete component can consist of multiple ribbons. In Figure 12  Proof. Suppose there exists a ribbon D i , in which each 1-face ω ∈ D i is not D i -free. Lemma 5 guarantees that there exist exactly two 2-simplices ∆, ∆ ∈ D i such that ∆ ∩ ∆ = ω. Using the argument of Claim 2 of Lemma 7, we can conclude that T D i is connected. C consists of at least two distinct ribbons since otherwise C = D i contains no C-free 1-face, which contradicts the assumption that C is incomplete. Thus there exist a couple (∆, ∆ ) ∈ D i and (∆ 0 , ∆ 0 ) ∈ D i , such that (∆, ∆ ) and (∆ 0 , ∆ 0 ) are crossing. In analogy to Claim 3 of Lemma 7, we can conclude that both ∆ 0 and ∆ 0 are contained in D i , which is impossible.
Therefore there exists a 1-face ω ∈ D i that is D i -free.
Theorem 1. Let C be a component ofX. Then the following is the case: and the following is also the case: where the non-negative integer r depends on C. Furthermore, a complete component, H 2 (C) is freely generated by the sum of all C-2-simplices.

Proof.
In case C is complete, by Lemma 7, C is homeomorphic to a sphere, whence H 2 (C) ∼ = Z and H 1 (C) ∼ = 0. Clearly, H 2 (C) is freely generated by the sum of 2-simplices of C.
In case C is incomplete, suppose that D 1 , D 2 , . . . , D k are the C-ribbons. In the following, we prove Equations (1) and (2) by induction on the number k of ribbons.
For k = 1, C is a ribbon and, as such, is connected. Since C is incomplete, it contains by Lemma 8 at least one C-free 1-face. This implies that the geometric realization of C is a surface with boundary. Therefore H 2 (C) ∼ = 0 and H 1 (C) is free.
For the induction step, we shall combine ribbons in order to compute the homology of an incomplete component. In view of the fact that C is the union of the sub-complexes D k and D = ∪ j<k D j , we have the following inclusion maps: Each inclusion map induces a chain map on the corresponding simplicial chain groups and a homomorphism between the corresponding homology groups.
By Lemma 8, D k contains at least one D k -free 1-face, whence its geometric realization of D k is a surface with boundary. As a result, H 2 (D k ) ∼ = 0 and H 1 (D k ) is free.
From the definition of ribbon follows, that the intersection D k ∩ D j of any two ribbons cannot contain any 2-simplices. Furthermore, D k ∩ D j does not contain any 1-simplices, whence D k ∩ D j contains only 0-simplices.
In view of D k ∩ (∪ j<k D j ) = ∪ j<k (D k ∩ D j ), we conclude that D k ∩ D consists of only 0-simplices. Therefore, In case of n = 2, the Mayer-Vietoris sequence reads as follows.
Thus, Ψ is an isomorphism.
By induction hypothesis, we have H 2 (D ) ∼ = 0 and due to the fact that D k contains a free D k -1-face, H 2 (D k ) ∼ = 0. Accordingly, we obtain H 2 (C) ∼ = 0.
In case of n = 1, we observe the following: which gives rise to the following exact sequence.
As a subgroup of the free group H 0 (D k ∩ D ), Im ∂ is free and thus projective. As a result, the short exact sequence is split exact and the following: Since both H 1 (D k ) and H 1 (D ) are free, we conclude that H 1 (C) is free, which completes the proof.
Theorem 1 shows that, while the complete components contribute only to the second homology, the incomplete components provide generators of the first homology. In terms of discrete Morse theory, each complete component contains a critical point of dimension 2 and each incomplete component can feature multiple critical points of dimension 1.

The Main Theorem
In this section, we compute the homology of a τ-structure. The key tool here is the Mayer-Vietoris sequence, which allows us to connect and compose the homology data of the sub-complexes.
A certain ordering by which the components are glued in combination with Lemma 6 are critical for the application of the Mayer-Vietoris sequence, since they constitute the determinants of how components intersect.

Theorem 2.
LetX be the complex obtained from the loop complex of a τ-structure I. Then, H 1 (X) is free and the following is the case: where M denotes the number of completeX-components. Furthermore, H 2 (X) is freely generated by {c i } M i , where c i denotes the sum of 2-simplices contained in a complete component, C i .
Proof. LetX 2 be theX-sub-complex induced by theX-2-simplices. Suppose thatX 2 is partitioned into j components C 1 , . . . , C j . The set {C i } and any of its subsets are partially ordered and, by recursively removing maximal components, we can obtain a "descending" sequence (C i 1 , . . . , C i j ) such that the following obtains.
This sequence gives rise to a sequence of sub-complexes, (Y 0 , Y 1 , . . . , Y j ) obtained by recursively adding a component as follows: We next prove by induction on the number of components, k, that H 1 (Y k ) is free and where M k denotes the number of complete components in C i 1 , . . . , C i k . For the induction basis k = 1, Y 1 = C i 1 itself is a component and its homology has been computed in Theorem 1. Clearly, when C i 1 is complete, H 2 (Y 1 ) is freely generated by the sum of 2-simplices of C i 1 .
For the induction step we consider Y k as the union of two sub-complexes C i k and Y k−1 and shall combine C i k and Y k−1 by means of the Mayer-Vietoris sequence as follows.
Therefore it follows by induction that H 1 ( where M denotes the number of complete components in C 1 , . . . , C j . In view of Proposition 9, we have the following: Z is free, which completes the proof. The transitive closure with respect to φ-crossing produces an equivalence relation, i.e., (i 1 , i 2 ) ∼ φ (j 1 , j 2 ), if there exists a sequence of arcs such as the following: such that two consecutive arcs α k and α k+1 are φ-crossing for 1 ≤ k ≤ l − 1.
An arc-component, A, is an ∼ φ -equivalence class of arcs such that A contains at least two arcs. A is of type 1 if both endpoints of any of its arcs are incident to φ-arcs and of type 2, otherwise.

Lemma 9.
In I , let A be an arc-component of type 1 with blocks β 1 , β 2 , . . . , β l . Then, for any arc (i, i ) ∈ A, there exists a unique block, β k , that contains i and i .
Proof. Without loss of generality, we may assume that (i, i ) is an S-arc. Since each φ-arc is incident to at most one arc due to Lemma 1, (i, i ) is not incident to any φ-arc associated with A and thus its endpoints are contained in A-blocks.
By construction, any T-arc of A, (j p , j q ) and (i, i ) are non-crossing, since otherwise (i, i ) would belong to the arc-component A. Accordingly, φ −1 (j p ) and φ −1 (j q ) are either contained in the interval (i, i ) S or [1, i) S ∪ (i , n] S and we can conclude that A-arcs contained in either Suppose that i and i are contained in different blocks, then Y 0 and Y 1 are nontrivial. By construction, any Y 0 -arc and any Y 1 -arc are non-crossing, which is impossible since A is an arc-component. As a result i and i are contained in a single A-block. Remark 3. Lemma 9 is the "arc"-analogue of Lemma 3 for arc-components of type 1. Note that the statement does not hold for arc-components of type 2. Given an arc-component A of type 1 in the interaction structure I , each φ-arc is associated with exactly one 2-simplex, as Lemma 1 guarantees that each φ-arc is incident to at most one arc. Let ∆ 1 , ∆ 2 , . . . , ∆ l denote the 2-simplices associated with the φ-arcs (i 1 , j 1 ), (i 2 , j 2 ), . . . , (i l , j l ), respectively. Let ω k and ω k denote the mixed 1-faces of ∆ k that are associated with β k and β k+1 , respectively. Lemma 10. Let A be an I -arc-component of type 1 with blocks β 1 , β 2 , . . . , β l . Let ∆ 1 , ∆ 2 , . . . , ∆ l denote the 2-simplices associated with A and ω k and ω k be the mixed 1-faces of ∆ k that are associated with β k and β k+1 , respectively. Then ω k = ω k+1 for 1 ≤ k ≤ l − 1 and ω l = ω 1 .
By Lemma 9, any I -arc is either contained in β 2 or its complement. This guarantees that i 1 and i 2 belong to the same S-loop s and, furthermore, that j 1 and j 2 belong to the same T-loop t.
As a result the 2-simplex ∆ 2 associated with (i 2 , j 2 ) contains {s, t} as a mixed face, i.e., ω 1 = ω 2 . Now we are in position to prove the Main Theorem.
Proof of the Main Theorem. The triviality of the third homology group, H 3 (I), follows from Corollary 1. In view of Lemma 1, Proposition 8 and Theorem 2, we have the following: where M denotes the number of completeX-components. First we observe that any σ-butterfly removal does not change the crossing status of any two arcs. Thus, there is a natural bijection between the set of I-arc-components and that of I -arc-components. Moreover, each I-arc-component of type 1 corresponds to an I -arc-component of type 1.
It suffices to show that when passing from the complex X = K(I ) toX, the number of I -arc-components of type 1 equals the number M of completeX-components.
Claim: there exists a bijection between the set of I -arc-components of type 1 and that of complete components ofX.
Given an I -arc-component of type 1, A, let C denote the set of couples (∆, ∆ ) associated with arcs of A. In view of Lemma 10, any 1-simplex that appears as a face in C-couples is shared by at least two 2-simplices. As a result, C does not contain any free 1-simplex and passing from X toX, simplicial collapses do not affect C-2-simplices.
Consequently, all C-couples in I simply persist when passing toX, where C itself becomes aX-component. Lemma 10 further guarantees that C does not contain any free 1-face, whence Lemma 8 implies that C is complete.
Accordingly, the Ansatz Φ(A) = C produces a well-defined mapping between I arc-components of type 1 and completeX-components.
Φ is, by construction, injective since the mapping constitutes a mere reinterpretation of an arc-component of type 1.
In order to establish surjectivity, let C 1 be a completeX-component. C 1 induces a distinguished, unique set of I -arcs, A 1 . By construction, any two A 1 -arcs α 1 , α 2 ∈ A 1 satisfy α 1 ∼ φ α 2 , whence A 1 is contained in a nontrivial and distinguished arc-component A .
We proceed by proving that A 1 = A is an arc-component of type 1. Suppose A 1 A , then there exist an arc (i, i ) ∈ A \ A 1 and (j, j ) ∈ A 1 such that (i, i ) and (j, j ) are φcrossing. Note that (j, j ) is associated to a C 1 -couple (∆ j , ∆ j ). Let {s, s } be the pure edge associated with (i, i ). We showed in the proof of Lemma 7, that S C 1 is connected.
Since (i, i ) and (j, j ) are φ-crossing, the S-loops s 1 , s 2 are vertices of ∆ j , ∆ j from which follows that both s and s are on a path of two S-loops in C 1 . Accordingly {s, s } is contained in S C 1 . Lemma 7 guarantees that C 1 is a sphere, whence there exists a C 1 -couple (∆ 0 , ∆ 0 ) for which {s, s } is a pure face. As a result we obtain (i, i ) ∈ A 1 , which is a contradiction from which A = A 1 follows.
By Lemma 2, both endpoints of an A 1 -arc are incident to φ-arcs, whence A 1 is an arc-component of type 1 and Φ(A 1 ) = C 1 , whence Φ is surjective and, thus, bijective.

Discussion
In this paper we computed the simplicial homology of τ-structures. τ-structures represent a meaningful generalization of bi-structures [7,8] as they allow us to study transitions between sequence-structure pairs where the underlying sequences differ in specific manners. Bi-structures would only facilitate the analysis of such pairs, where the underlying sequences are equal. Intuitively, the free energy of such sequence-structure pairs, which is a quantity that is straightforward to compute, characterizes the probability of finding such a pair of sequences in the course of evolution.
We are currently extending the results of this paper by computing the weighted homology of τ-structures over a discrete valuation ring, R. This entails the study of weighted complexes in which simplices are endowed with weights [9,24,25]. These weighted complexes feature a new boundary map, ∂ v n : C n,R (X) → C n−1,R (X), where C n,R (X) denotes the free R-module generated by all n-simplices contained in X. ∂ v n is given by the following.
As it is the case for bi-structures [9], the weighted homology plays a crucial role in the Boltzmann sampling of sequence-structure pairs that minimize the free energy of the τ-structure.
Our approach differs from the purely algebraic proofs for the simplicial loop homology of bi-structures [8]. In the case of bi-structures, the computation for the second homology employs the fact that their first homology group is trivial. This allows us to understand the second homology group via a long exact sequence of relative homology groups. However, for τ-structures, the first homology is, in general, nontrivial and therefore requires a different approach.
We first reduce the loop complex K(I) to the sub-complexX via simplicial collapses, retaining the homology of the original space. We then dissect a certain 1-dimensional subcomplex in Proposition 9 and then decomposeX into components based on the φ-crossing of couples. This decomposition allows us to identify different generators of the homology, with incomplete and complete components contributing to the first and second homologies, respectively. Finally, we compute the homology ofX by gluing components in a particular manner. This makes use of the planarity of τ-structures in Lemma 6 and assures that we encounter particularly simple intersections, when applying the Mayer-Vietoris sequence. It is worth pointing out that in the proof of Theorem 2 the particular ordering in which the components are glued is crucial.
In view of Proposition 9, Theorems 1 and 2, the generators of the first homology of the loop complex originate from the combining of the sub-complex K 1 , incomplete components and the gluing of different components. The detailed descriptions of all these generators are a work in progress and here we restrict ourselves to using the Euler characteristic to express the rank of the first homology group. Only complete crossing components contribute to the second homology and their geometric realizations are spheres. We provide a combinatorial characterization of the generators in I in terms of arc-components of type 1.
As for applications of this framework, we currently employ τ-structures to investigate the evolutionary trajectories of viruses, such as flus and the Coronavirus. Specifically, we compute the loop homology of evolutionary transitions to gain deeper insight into sequence-structure-function relationships of the virus.