Cosheaf representations of relations and Dowker complexes

The Dowker complex is an abstract simplicial complex that is constructed from a binary relation in a straightforward way. Although there are two ways to perform this construction—vertices for the complex are either the rows or the columns of the matrix representing the relation—the two constructions are homotopy equivalent. This article shows that the construction of a Dowker complex from a relation is a non-faithful covariant functor. Furthermore, we show that this functor can be made faithful by enriching the construction into a cosheaf on the Dowker complex. The cosheaf can be summarized by an integer weight function on the Dowker complex that is a complete isomorphism invariant for the relation. The cosheaf representation of a relation actually embodies both Dowker complexes, and we construct a duality functor that exchanges the two complexes.


Introduction
This article studies the structure of an abstract simplicial complex that is built according to a binary relation between two sets, as originally described by Dowker [10]. Dowker complexes, as these simplicial complexes are now known, are simple to both construct and apply, finding use in many areas of mathematics and data science [11]. Dowker's classic result is that there are two ways to build such an abstract simplicial complex, and that both of these complexes have the same homology. This fact is a kind of duality, because it arises from the transpose of the underlying relation's defining matrix. It was later shown by Björner [4] that the two dual Dowker complexes have homotopy equivalent geometric realizations.
This article explains how the Dowker complex can be augmented with an integer weight function, and develops this idea into several functorial representations of the underlying relation. Although the integer weight is not functorial, we show how it is the decategorification of a functorial, faithful cosheaf representation, and explore some of the implications of that fact. In particular, Dowker's famous duality result arises as a functor that exchanges the base space and the space of global cosections of the cosheaf. Considering only the Dowker complex without the weight function yields a non-faithful functor, since many different relations can have the same Dowker complex. The article ends with the non-functorial construction of a cosheaf that captures the amount of redundancy present in a relation -a measure of how un-faithful the Dowker complex is for that particular relation.
Probably because of the topological nature of the duality result in [10], most of the literature discussing Dowker complexes focuses on their topological properties. For instance, [12] links the construction of the Dowker complex from a relation to the order complex of a partial order, and proves a number of homotopy equivalences. Because Dowker complexes respect filtrations [7], they seem ripe for use in topological data analysis, which typically focuses on the persistent homology of a filtered topological space. This line of reasoning recently culminated in a functoriality result [8,Thm. 3], which establishes that Dowker duality applies to the geometric realizations of sub-relations. Specifically, consider a pair of nested subsets R 1 ⊆ R 2 ⊆ (X × Y ) of the product of two sets X and Y . The Dowker complexes D(X, Y, R 1 ) and D(X, Y, R 2 ) for R 1 and R 2 and their duals D(Y, X, R T 1 ) and D(Y, X, R T 2 ) are related through a commutative diagram |D(X, Y, R 1 )| / / ∼ = |D(X, Y, R 2 )| ∼ = |D(Y, X, R T 1 )| / / |D(Y, X, R T 2 )| of continuous maps on their respective geometric realizations, in which the vertical maps are homotopy equivalences.
The paper [8] appears to have set off a flurry of interest in Dowker complexes. For instance, [6] showed how to use Dowker complexes instead ofČech complexes for studying finite metric spaces. Since topological data analysis often takes a finite metric space as an input, constructing a Vietoris-Rips complex is frequently an intermediate step; [16] shows how Dowker complexes and Vietoris-Rips complexes are related. Finally, [15] extended Dowker duality to simplicial sets, pointing the way to much greater generality.
The present paper is also inspired by the functoriality result [8,Thm. 3], but in a somewhat different way. Instead of focusing on sub-relations, we show that the Dowker complex construction is a functor from a category whose objects are relations and whose morphisms are relation-preserving transformations (Definition 6). Furthermore, we show that the isomorphism classes of this category are completely characterized by two different weight functions on the Dowker complex, and that these are derived from a faithful cosheaf representation of the category.
Given a relation between two sets, the main results of this article are as follows: (1) The existence of two integer weighting functions, differential and total weights, on the Dowker complex for the relation that are complete isomorphism invariants (Theorems 1 and 2), . The Dowker complex for Example 1 (left), its total weight (center), and its differential weight (right).
(3) The existence of faithful functors that render the relation into a cosheaf (Theorem 4 and Corollary 4) or sheaf (Theorem 5), whose (co)stalks determine the total weight function, (4) The space of global cosections of the cosheaf is the dual Dowker complex for the relation (Theorem 6), and (5) There is a duality functor that exchanges the cosheaf's base space and space of global cosections (Theorem 7).

Recovery of a relation from a weight function on the Dowker complex
Definition 1. An abstract simplicial complex X on a set V X consists of a set X of subsets of V X such that if σ ∈ X and τ ⊆ σ, then τ ∈ X. Each σ ∈ X is called a simplex of X, and each element of V X is a vertex of X. Every subset τ of a simplex σ is called face of σ.
It is usually tiresome to specify all of the simplices in a simplicial complex. Instead, it is much more convenient to supply a generating set S of subsets of the vertex set. The unique smallest simplicial complex containing the generating set is called the abstract simplicial complex generated by S.
Let R ⊆ X × Y be a relation between finite sets X and Y , which can be represented as a Boolean matrix (r x,y ). Definition 2. The Dowker complex D(X, Y, R) is the abstract simplicial complex given by The total weight is a function t : D(X, Y, R) → N given by t(σ) = #{y ∈ Y : (x, y) ∈ R for all x ∈ σ}.
The differential weight [2] is a function d : D(X, Y, R) → N given by It is immediate by the definition that the Dowker complex is an abstract simplicial complex. whose rows correspond to elements of X 1 and columns correspond to elements of Y 1 . The Dowker complex for this relation is generated by the simplices [a, c, d], [a, b], and [b, c], a fact witnessed by the columns marked with bold type. The Dowker complex D(X 1 , Y 1 , R 1 ) and its weighting functions are shown in Figure 1. Notice in particular that the differential weighting function counts the number of columns of r 1 of each simplex. The total weighting accumulates all of the counts of columns for its faces as well.
Example 2. If we keep the same set X 2 = X 1 as in Example 1, but change the Y 2 set, with a different relation R 2 given by the matrix we obtain the same Dowker complex, D(X 2 , Y 2 , R 2 ) = D(X 1 , Y 1 , R 1 ). However, as Figure 2 shows, the weight functions are different.
Proposition 1. The sum of the differential weight d on the Dowker complex D(X, Y, R) is the number of elements of Y .
(Do not forget to count the differential weight of the empty simplex!) Proof. Observe that sets of the form {y ∈ Y : ((x, y) ∈ R if x ∈ σ) and ((x, y) / ∈ R if x / ∈ σ)} are disjoint for different σ in D(X, Y, R). The sum of the differential weight is therefore the cardinality of which completes the argument.
Proposition 2. The total weight t is a filtration on the Dowker complex D(X, Y, R).
Proof. This follows from showing that t is order-reversing in the following way: if σ ⊆ τ , then t(σ) ≥ t(τ ). Suppose σ ⊆ τ , and that y ∈ Y satisfies (x, y) ∈ R for all x ∈ τ . Since σ ⊆ τ , then (x, y) ∈ R for all x ∈ σ also. Thus Theorem 1. Given the Dowker complex D(X, Y, R) and differential weight d, one can reconstruct R up to a bijection on Y .
Proof. The differential weight d(σ) simply specifies the number of columns of the matrix r for R that can be realized as an indicator function for each σ ∈ D(X, Y, R). Thus, we can construct r up to a column permutation.
Theorem 2. Given the Dowker complex D(X, Y, R) and the total weight t, one can reconstruct R up to a bijection on Y .
Proof. We construct the relation matrix r of R iteratively. Let t 0 = t.
(1) Set r 0 to the zero matrix with no columns and as many rows as vertices of D(X, Y, R). That is, each row of r 0 corresponds to an element of X, so let us index rows of r 0 by elements of X. (2) If t n (σ) = 0 for all simplices σ ∈ D(X, Y, R), declare r = r n and exit.
(3) Select a simplex σ with t n (σ) = 0 such that either there is no simplex τ containing σ as a face, or if such a τ exists, then t n (τ ) = 0. (4) Define r n+1 to be the horizontal concatenation of r n with t n (σ) columns, each an indicator function for σ. That is, each new column is a Boolean vector v given by (6) Increment n (7) Go to step (3).
Since t n+1 < t n on at least one simplex, and the relation R is finite, the algorithm will always terminate.
Secondly, the update step for r n+1 by adding columns, establishes that r relates the elements of X contained in a given simplex by the appended σ columns.
Thirdly, notice that the apparent ambiguity in step (3) about selecting a simplex σ merely results in a column permutation, since two maximal simplices do not interact with the update to t n+1 in step (5), since another maximal simplex is not a face of σ.   which differs from the original matrix r 2 by a cyclic permutation of the last three columns. Figure 3 shows the progression of the steps of the algorithm.

Functoriality of the Dowker complex
The Dowker complex D(X, Y, R) is a functor between an appropriately constructed category of relations and the category of abstract simplicial complexes. We prove this fact in Theorem 3 along with a few other observations. Definition 3. Consider an arbitrary set P and a partial order ≤ on P . A partial order is a relation between elements in P such that the following hold: (1) (Reflexivity) x ≤ x for all x ∈ P , (2) (Transitivity) if x ≤ y and y ≤ z, then x ≤ z, and (3) (Antisymmetry) if x ≤ y and y ≤ x, then x = y.
The category of partial orders Pos has every partially ordered set (P, ≤) as an object. Each morphism g : (P, ≤ P ) → (Q, ≤ Q ) consists of an order preserving function g : P → Q such that if x and y are two elements of P satisfying x ≤ P y, then g(x) ≤ Q g(y) in Q. Morphisms compose as functions on their respective sets.
To see that Pos is a category, notice that the identity function is always order preserving and that the composition of two order preserving functions is another order preserving function. Associativity follows from the associativity of function composition.
Definition 4. The face partial order for an abstract simplicial complex X has the simplices of X as its elements, and σ ≤ τ whenever σ ⊆ τ .  ; ; Definition 5. Suppose X and Y are abstract simplicial complexes with vertex sets V X and V Y , respectively. A function f : of Y , after removing duplicate vertices. The category Asc has abstract simplicial complexes as its objects and simplicial maps as its morphisms.
Lemma 1. Let f : X → Y be a simplicial map. For every pair of simplices σ, τ of X satisfying σ ⊆ τ , their images in Y satisfy f (σ) ⊆ f (τ ).
Proof. Since f is a simplicial map, then f (σ) is a simplex of Y and so is f (τ ). If σ ⊆ τ , then every vertex v of σ is also a vertex of τ . By the definition of simplicial maps, f (v) is a vertex of both f (σ) and f (τ ). Conversely, every vertex of f (σ) is the image of some vertex w of σ.
Proposition 3. The face partial order is a covariant functor F ace : Asc → Pos.
Proof. The construction of the face partial order from a simplicial complex establishes how the functor transforms objects. Let us denote the face partial order for X by F ace(X). Lemma 1 establishes that every simplicial map f : X → Y induces an order preserving function F ace(f ) : F ace(X) → F ace(Y ) on the face partial orders for X and Y . To verify that the functor is covariant, suppose that we have another simplicial map g : Y → Z. The composition of these is a simplicial map g • f : X → Z that induces an order preserving map F ace(g • f ) : F ace(X) → F ace(Z) on the face partial orders for X and Z. On the other hand, is also an order preserving map. Any simplex σ in X can be reinterpreted as an element of F ace(X), which means that the simplex (g • f )(σ) of Z corresponds to the same element of F ace(Z) as does g(f (σ)), thought of as the image of an element of F ace(Y ).  [6]) The category of relations Rel has triples (X, Y, R) for objects, in which X, Y are sets and R ⊆ X × Y is a relation. A morphism (X, Y, R) → (X , Y , R ) in Rel is defined by a pair of functions f : Composition of morphisms is simply the composition of the corresponding pairs of functions, which means that Rel satisfies the axioms for a category. It will be useful to consider the full subcategory Rel + of Rel in which each object (X, Y, R) has the property that for each x ∈ X, there is a y ∈ Y such that (x, y) ∈ R, and conversely for each y ∈ Y , there is an x ∈ X such that (x, y) ∈ R.
Example 6. Consider the relation R 1 between the sets X 1 = {a, b, c, d, e} and Y 1 = {1, 2, 3, 4, 5}, given by the matrix = C, f (e) = C, and that g : Y 1 → Y 2 is given by the identity function, namely g(1) = 1, g(2) = 2, g(3) = 3, g(4) = 4, g(5) = 5. Proof. Given the construction of the Dowker complex D(X, Y, R) from R ⊆ X × Y , we must show that (1) Each morphism in Rel translates into a simplicial map, and (2) Composition of morphisms in Rel translates into composition of simplicial maps. To that end, suppose that ( The first claim to be proven is that f 1 is the vertex function for a simplicial map D( Under the vertex map f 1 , the set of vertices of σ get transformed into the set But the defining characteristic of σ is that there is a y ∈ Y such that (x, y) ∈ R 1 for each x ∈ σ. Using the function g 1 and the fact that the pair (f 1 , g 1 ) is a Rel morphism, we have that (f 1 (x), g 1 (y)) ∈ R 2 for every x ∈ σ. This means that the set f 1 (σ) is actually a simplex of D(X 2 , Y 2 , R 2 ). Since σ was arbitrary, this establishes that f 1 is a simplicial map.
Since the composition of the Rel morphisms ( , this means that D is a covariant functor, since this composition of Rel morphisms becomes a composition of simplicial maps. Observe that Pos can be realized as a (non-full) subcategory of Rel: each object in this subcategory is a partially ordered set (X, ≤ X ) realized as (X, X, ≤ X ), and each order preserving function f : since the axioms coincide. Beyond this relationship between Pos and Rel, there is a different, functorial relationship.

Proposition 4.
There is a covariant functor P osRep : Rel → Pos, called the poset representation of a relation, that takes each (X, Y, R) to a collection P osRep(X, Y, R) of subsets of 2 X , for which A ∈ P osRep(X, Y, R) if there is a y ∈ Y such that (x, y) ∈ R for every x ∈ A. The elements of P osRep(X, Y, R) are ordered by subset inclusion.
Proof. P osRep translates morphisms in Rel into order preserving maps among partially ordered sets. Specifically, the morphism (X, Y, R) → (X , Y , R ) implemented by f : X → X and g : Y → Y is transformed into the function that takes A ∈ P osRep(X, Y, R) to f (A). By definition there is a y ∈ Y such that (x, y) ∈ R for every x ∈ A. Therefore, (f (x), g(y)) ∈ R by construction. Since each x ∈ f (A) is given by x = f (x) for some x, this means that (x , g(y)) ∈ R for all x ∈ f (A). Thus, f (A) ∈ P osRep(X , Y , R ). Furthermore, the order relation among subsets is evidently preserved.
The same argument from the proof of Theorem 3 can be used mutatis mutandis to show that P osRep is a covariant functor, namely that composition of morphisms is preserved in order.
Proposition 5. The composition of the Dowker functor D : Rel → Asc with the face partial order functor F ace : Asc → Pos yields the P osRep functor.
In brief, the diagram Proof. To establish this result, we merely need to observe that the set of elements of (F ace • D)(X, Y, R) is the same set as P osRep(X, Y, R), with the same order relation (subset inclusion). Under that identification, the morphisms are the same, too.
Example 8. Continuing Examples 6 and 7, the order preserving map induced by the Rel morphism (f, g) is a bit tedious to construct from the data in Example 6. It is much more convenient to work from the simplicial map shown in Figure 5.

Functoriality of (co)sheaves on Dowker complexes
The Dowker functor D : Rel → Asc is not faithful: non-isomorphic relations can have the same Dowker complex. The weighting functions distinguish between Rel isomorphism classes. Rel morphisms sometimes induce transformations between weighting functions, for instance if the morphism transforms only the rows, or if the morphism permutes columns. However, this does not always occur. For instance, if the columns of one relation are included into another while simultaneously the rows are combined, the resulting transformation on the weighting functions is not described in a convenient way. We really need a richer category for weighted Dowker complexes; this is found in the categories of cosheaves or of sheaves. Specifically, each relation can be rendered as a cosheaf of sets, whose costalk cardinality is the total weight function on the Dowker complex. Alternatively, a relation can be transformed into a sheaf of vector spaces, whose stalk dimensions specify a total weight function on the Dowker complex.
For convenience, let us begin by defining for a simplex σ of D(X, Y, R). The total weight function is simply the cardinality of this set: t(σ) = #Y σ .

Corollary 1. As a result of Lemmas 2 and 3, the diagram
commutes when (f, g) is a Rel morphism.
Although the total and differential weight functions are complete isomorphism invariants for Rel, they are not functorial. To remedy this deficiency, these weights can be thought of as summaries of a somewhat more sophisticated object: a cosheaf or a sheaf.

Definition 7. [3]
A cosheaf of sets C on a partial order (X, ≤) consists of the following specification: • For each x ∈ X, a set C(x), called the costalk at x, and • For each x ≤ y ∈ X, a function (C(x ≤ y)) : Briefly, a cosheaf is a contravariant functor to the category Set from the category generated by (X, ≤), whose objects are elements of X and whose morphisms x → y correspond to ordered pairs x ≤ y.
Dually, a sheaf of sets S on a partial order (X, ≤) consists of the following specification: • For each x ∈ X, a set S(x), called the stalk at x, and • For each x ≤ y ∈ X, a function (S(x ≤ y)) : S(x) → S(y), called the restriction along x ≤ y, such that • Whenever x ≤ y ≤ z ∈ X, S(x ≤ z) = (S(y ≤ z)) • (S(x ≤ y)). In this way, a sheaf is covariant functor to Set from the category generated by the partially ordered set (X, ≤).
Given that every abstract simplicial complex X corresponds to a partially ordered set (X, ⊆) via the face partial order F ace : Asc → Pos, we will often use (co)sheaves on an abstract simplicial complex as a shorthand for (co)sheaves on the face partial order of an abstract simplicial complex.
This definition of a (co)sheaf is traditionally that of a pre(co)sheaf on a topological space. The connection is that a (co)sheaf of sets of a partially ordered set is a minimal specification for a (co)sheaf on the partial order with the Alexandrov topology, via the process of (co)sheafification [9]. Definition 7 is unambiguous in the context of this article, since we only consider (co)sheaves on partially ordered sets.
Definition 8. We can use the information in a relation (X, Y, R) to define a cosheaf R 0 on the face partial order 1 of D(X, Y, R) by Costalks: Each costalk is given by R 0 (σ) = Y σ , and In a dual way, we can also define a sheaf R 0 by: Stalks: Each stalk is given by R 0 (σ) = span Y σ , and Notice that the basis for each stalk of R 0 is the corresponding costalk of R 0 .
Corollary 2. For the cosheaf R 0 or sheaf R 0 constructed from a relation R as above, t(σ) = #R 0 (σ) = dim R 0 (σ), and The interpretation is that the total weight t computes how many columns of r start at σ, while the differential weight d counts columns of r that are related to the elements of σ and no others.
The main use of (co)sheaf theory is to formalize the notion of local and global consistency over some space, by way of identifying the data that are consistent with respect to the (co)sheaf. These data are captured within global (co)sections. Let ∼ be the equivalence relation on this disjoint union generated by c x ∼ c y whenever there exists an x ≤ y in X that satisfies (1) c x ∈ C(x) and (2) c y ∈ C(y), such that The set of global cosections C(X) of the cosheaf C is given by the set of equivalence classes Dually, the set of global sections of a sheaf S a on partially ordered set (X, ≤) is denoted by S(X) and is given by the subset Each element of S(X) is called a (global) section of S. Using the partial order constructed for this relation in Example 5, the cosheaf R 0 for the relation has the diagram where the numbers specify elements of Y (also column indices of r 2 ). The set of global cosections of this cosheaf is precisely The costalk cardinalities in the above diagram agree exactly with the total weight t shown in Figure 2. Furthermore, the nonzero differential weights are By contrast, the sheaf is given by the diagram To render cosheaves and sheaves into their own categories CoShv and Shv, respectively, we need to define morphisms. Typical definitions (for instance, [9, Def. 4.1.10]) require the construction of morphisms between cosheaves or sheaves on the same partial order, but it is important to be a bit more general in our situation.
Definition 10. ( [13] or [5,Sec. I.4]) Suppose that R is a cosheaf on a partially ordered set (X, ≤ X ) and that S is a cosheaf on a partially ordered set (Y, ≤ Y ). A cosheaf morphism m : R → S along an order preserving base map consists of a set of component functions m x : R(x) → S(f (x)) for each x ∈ X such that the following diagram commutes Dually, suppose that R is a sheaf on a partially ordered set (X, ≤ X ) and that S is a sheaf on a partially ordered set (Y, ≤ Y ). A sheaf morphism m : S → R along an order preserving base map f : (X, ≤ X ) → (Y, ≤ Y ) (careful: m and f go in opposite directions! ) consists of a set of component functions m x : S(f (x)) → R(x) for each x ∈ X such that the following diagram commutes for each x ≤ X y.
The category of cosheaves CoShv (or category of sheaves Shv) consists of all cosheaves (or sheaves) on partially ordered sets as the class of objects, with cosheaf morphisms (or sheaf morphisms) as the class of morphisms. Composition of morphisms in both cases is accomplished by simply composing the base map and component functions.
Lemma 4. The transformation of a cosheaf to its underlying partial order is a covariant functor Base : CoShv → Pos. Likewise, the transformation of a sheaf to its underlying partial order is a contravariant functor Base .
Proof. Both of these statements follow immediately from the definition. To verify that this is well-defined, suppose that c x ∈ R(x ) for some other x ∈ X. Under the equivalence relation ∼, the only way c Since p is a cosheaf morphism, this means that Since p is a cosheaf morphism, this means that which also implies that p x (c x ) ∼ p x (c x ) in S(X). Thus, p * (c) is a well-defined global cosection of S.
Repeating this construction with q, notice that which establishes covariance. Proof. Suppose that (f 1 , g 1 ) : are two Rel morphisms. Suppose that R 0 1 is the cosheaf associated to (X 1 , Y 1 , R 1 ) according to the recipe given in Definition 8, and likewise R 0 2 and R 0 3 are the cosheaves associated to (X 2 , Y 2 , R 2 ) and (X 3 , Y 3 , R 3 ), respectively. We first show how to construct a cosheaf morphism m 1 : R 0 1 → R 0 2 . Recognizing that the cosheaves R 0 1 and R 0 2 are written on the simplices of D(X 1 , Y 1 , R 1 ) and D(X 2 , Y 2 , R 2 ), recall that Theorem 3 implies that D(f 1 ) is a simplicial map D(X 1 , Y 1 , R 1 ) → D(X 2 , Y 2 , R 2 ), and that Propositions 4 and 5 imply that this can be interpreted as an order preserving function. This is the order preserving base map along which m 1 is defined.
Suppose that σ ⊆ τ in D(X 1 , Y 1 , R 1 ). As far as vertices are concerned, the diagram commutes. Corollary 1 therefore states that commutes. We therefore merely need to realize that according to Definition 8, this is equal to the diagram which establishes that m 1 is a cosheaf morphism, with m σ = g| (Y1)σ as components. Given that m 2 : R 0 2 → R 0 3 can be constructed in the same way, the composition (f 2 , g 2 )•(f 1 , g 1 ) of Rel morphisms induces the composition of component functions, which is precisely the composition m 2 • m 1 of cosheaf morphisms.
To show that this functor is faithful when restricted to objects in Rel + , a rather direct argument suffices. Suppose that (f, g) and (f , g ) are two Rel morphisms (X 1 , Y 1 , R 1 ) → (X 2 , Y 2 , R 2 ) in which (X 1 , Y 1 , R 1 ) is an object of Rel + . Recall that the latter constraint means that for every x ∈ X 1 , there is a y ∈ Y 1 such that (x, y) ∈ R 1 , and conversely for every y ∈ Y 1 , there is an x ∈ X 1 such that (x, y) ∈ R 1 . To establish faithfulness, let us suppose additionally that (f, g) and (f , g ) induce the same cosheaf morphism m : R 0 1 → R 0 2 . Let y ∈ Y 1 be given. By assumption, there is an x ∈ X 1 such that (x, y) ∈ R 1 , so there is also a simplex σ (usually several simplices, actually) for which y ∈ Y σ . But, since both (f, g) and (f , g ) both induce the same cosheaf morphism m, this means that g(y) = g| (Y1)σ (y) = m σ (y) = g | (Y1)σ (y) = g (y).
Hence g = g .
Now let x ∈ X 1 be given. By assumption, there is a y ∈ Y 1 such that (x, y) ∈ R 1 , so this means that [x] is a simplex of D(X 1 , Y 1 , R 1 ). Since both (f, g) and (f , g ) induce the same cosheaf morphism m, this means that both (f, g) and (f , g ) induce the same order preserving map on simplices of D(X 1 , Y 1 , R 1 ) → D(X 2 , Y 2 , R 2 ). When restricted to vertices, this map is simply f or f , respectively, so they must also be equal.
This relation morphism clearly maps each column of r 1 to a column of r 4 , so it also acts on the costalks of the cosheaf representations. If we define A = CoShvRep 0 (X 1 , Y 1 , R 1 ) and B = CoShvRep 0 (X 4 , Y 4 , R 4 ), the resulting cosheaf morphism A → B is given by the diagram shown in Figure 7. Notice that each dashed arrow represents a component map of the cosheaf morphism, and is given by restricting the domain of g to each costalk, since this is how the columns are transformed.
Theorem 5. The transformation R → R 0 given in Definition 8 is a contravariant functor ShvRep 0 : Rel → Shv. When restricted to Rel + → Shv, the functor becomes faithful.
The proof of this Theorem starts out exactly dual to that of the proof of Theorem 4, but then diverges due to differences in the algebraic structure of the stalks. The argument from that point looks different, but is actually the same (modulo a transpose, which is the duality) when restricted to basis elements of the stalk.
1 is the sheaf associated to (X 1 , Y 1 , R 1 ) according to the recipe from Definition 8, and likewise R 0 2 and R 0 3 are the sheaves associated to (X 2 , Y 2 , R 2 ) and (X 3 , Y 3 , R 3 ), respectively. We first show how to construct a sheaf morphism m 1 : R 0 2 → R 0 1 . Given that m 2 : R 0 3 → R 0 2 can be constructed in the same way, we show that the composition (f 2 , g 2 ) • (f 1 , g 1 ) of Rel morphisms induces the composition m 1 • m 2 of sheaf morphisms.
Recognizing that the sheaves R 0 1 and R 0 2 are written on the simplices of D(X 1 , Y 1 , R 1 ) and D(X 2 , Y 2 , R 2 ), recall that Theorem 3 implies that D(f 1 ) is a simplicial map D(X 1 , Y 1 , R 1 ) → D(X 2 , Y 2 , R 2 ), and that Propositions 4 and 5 imply that this can be interpreted as an order preserving function. This is the order preserving map along which m 1 is defined.
The component maps go the other way, and are expansions of the preimage of g. For a simplex σ of D(X 1 , Y 1 , R 1 ), the m 1,σ : R 0 2 (f (σ)) → R 0 1 (σ) is given by the formula To show that this is indeed a sheaf morphism requires showing that it commutes with the restriction maps. This follows from the diagram of Corollary 1, since that diagram explains how the basis vectors transform; the sheaf uses the dual of each map. To show this explicitly, it suffices to show this for a pair of simplices σ ⊆ τ in D(X 1 , Y 1 , R 1 ) and for a basis element z ∈ (Y 2 ) f (σ) , because we can extend by linearity, According to Lemma 3, y ∈ (Y 1 ) τ implies that z ∈ (Y 2 ) f (τ ) . Thus we may continue the calculation along the other path y∈g −1 (z) and y∈(Y1)τ y, establishing commutativity of the diagram As for composition (f 2 , g 2 ) • (f 1 , g 1 ) of Rel morphisms, suppose that σ is a simplex of D(X 1 , Y 1 , R 1 ). We compute for z ∈ (Y 3 ) f2(f1(σ)) : which is precisely what is induced by (f 2 • f 1 , g 2 • g 1 ).
To show that this a faithful functor when restricted to Rel + , it suffices to recount the same argument for the cosheaf given in the proof of Theorem 4, making the observation that the components of the cosheaf morphism are simply the functions on the basis elements of the stalks of the sheaf, after a transpose.
Actually, the cosheaf R 0 seems a bit more natural than the sheaf R 0 ! At least, R 0 doesn't entrain any linear algebraic machinery, which may be ancillary to the main point. On the other hand, the sheaf has cohomology, which may be worth exploring.
Example 11. Notice that if we tried to define R 0 as a sheaf of sets instead of a cosheaf -using only the basis Y σ rather than its span -then the proof of Theorem 5 fails to work correctly, even if we reverse the partial order on D(X, Y, R). This is not an accident, since any functor Rel → Shv should compose with the global sections functor Γ : Shv → Set to ensure that Rel morphisms induce functions on the space of global sections. This fails outright for a small example in which where R 1 and R 2 are given by the matrices r 1 = 1 0 0 0 1 1 and r 2 = 1 1 1 .
Noting that there is only one option to define f : X 1 → X 2 , we define g = id Y1 . This is clearly a relation morphism as every pair (x, y) ∈ R 1 ⊆ X 1 × Y 1 maps to a pair that are related by R 2 .
Using the reverse partial order, the sheaf diagram of basis elements for (X 1 , while the sheaf diagram for basis elements of (X 2 , Y 2 , R 2 ) has only one element {a, b, c}. (Both of these are identical to the cosheaf diagrams, since the unions in the Alexandrov topology are not shown.) There is only one global section of the first sheaf, which consists of choosing a for the leftmost simplex, and b for the three elements on the right. However, this cannot obviously be mapped to a global section of the second sheaf, since that needs to be a single element of {a, b, c}. Conversely, if we consider a global section of the second sheaf as being any one of its elements, this cannot correspond to a global section of the first sheaf. Notice that in the case of sheaves on partial orders, both functors are contravariant!

Duality of cosheaf representations of relations
The most striking fact proven in Dowker's original paper [10] is that the homology of the Dowker complex is the same whether it is produced by the relation or by its transpose. Dowker provides a direct, if elaborate, construction of a map inducing isomorphisms on homology. This construction was later enhanced to a homotopy equivalence by [4]. More recently, [8] showed that the homotopy equivalence between these two complexes is functorial in a particular way. This section shows that the duality is also visible in a somewhat different way: one Dowker complex is the base space of a particular cosheaf, while the other is its space of global cosections.
Let us begin by connecting the relation to its transpose. Evidently, the matrix for the transpose of a relation is simply the transpose of the original matrix. Lemma 6. The transformation (X, Y, R) → (Y, X, R T ) defines a fully faithful covariant functor T ransp : Rel → Rel.
Composition is still composition of functions and is preserved in order. The transpose of this relation has the matrix Their Dowker complexes are shown in Figure 8. Clearly these complexes have the same homotopy type! Definition 12. The category CoShvAsc consists of the full subcategory of CoShv whose objects are cosheaves on abstract simplicial complexes of abstract simplicial complexes, and whose extensions are simplicial inclusions. Briefly, an object of CoShvAsc is a contravariant functor C from the face partial order of an abstract simplicial complex to Asc, with the additional condition that each extension C(σ ⊆ τ ) : C(τ ) → C(σ) is a simplicial map whose vertex function is an inclusion.  The cosheaf R 0 = CoShvRep 0 (X 2 , Y 2 , R 2 ) was described in Example 9. The diagram for R = CoShvRep(X 2 , Y 2 , R 2 ) is shown in Figure 9, which incorporates all of the data from the previous examples into a single figure. Notice that each costalk shown in the diagram is a complete simplex. The space of cosections over the set is an abstract simplicial complex on the vertex set that is the union Proof. Every subset {y 0 , y 1 , . . . , y n } consisting of elements y i of Y τ is a simplex of D Y τ , τ, (R| τ,Yτ ) T , since that merely requires there to be at least one x ∈ τ to exist such that (x, y i ) ∈ R for all i. Proof. Suppose that σ ⊆ τ are two simplices of D(X, Y, R). Lemma 7 establishes that both R(σ) and R(τ ) are complete simplices. Accordingly, consider the subset {y 0 , y 1 , . . . , y n } consisting of elements y i of Y τ . Notice that by the definition of Y τ , for every x ∈ τ and every i, it follows that (x, y i ) ∈ R. Therefore, since σ ⊆ τ , this condition also holds for every x ∈ σ. Thus, every simplex of D Y τ , τ, (R| τ,Yτ ) T is also a simplex of D Y σ , σ, (R| σ,Yσ ) T whenever σ ⊆ τ .
These two Lemmas together imply that Theorem 4 extends immediately to a functoriality result for R. Proof. Before we begin, notice that the vertices of D(Y, X, R T ) are elements of Y that are related to at least one element of X. These are also elements of the costalks of R, and since the extensions of R are inclusions, we need not worry about conflicting names for elements of Y . Therefore, to establish this result, we simply need to show that every simplex σ ∈ D(Y, X, R T ) appears in at least one costalk of R, and conversely that every simplex in every costalk of R is also a simplex of D(Y, X, R T ).
Suppose that σ = [y 0 , y 1 , . . . , y n ] is a simplex of D(Y, X, R T ). This means that there is an x ∈ X such that (x, y i ) ∈ R for all i = 0, . . . , n. Put another way, every y i ∈ σ is also an element of Y [x] . Therefore, the costalk R([x]) contains σ.
Suppose that σ = [y 0 , y 1 , . . . , y n ] is a simplex of R(τ ) for some simplex τ of D(X, Y, R). This means that σ is a simplex of D Y τ , τ, (R| τ,Yτ ) T , by definition. That means that if we select any x ∈ τ , it follows that (y i , x) ∈ (R| τ,Yτ ) T ⊆ R T . Therefore, σ is a simplex of D(Y, X, R T ). What this means is that we have the following functorial diagram where CW is the category of CW complexes and homotopy classes of continuous maps, G is the geometric realization of an abstract simplicial complex, Base is the functor that forgets the costalks of a cosheaf (Corollary 4), and Γ is the functor that constructs the space of global cosections from a cosheaf (Lemma 5). Dowker duality asserts that the top and bottom paths in this diagram are equivalent up to homotopy.
For a cosheaf C on an abstract simplicial complex X of abstract simplicial complexes whose extensions are inclusions, let us define a new cosheaf Dual(C) on the space of global cosections of C. Noting that the space of global cosections C(X) is also an abstract simplicial complex, suppose σ is a simplex of C(X). Define the costalk (Dual(C)) (σ) to be the simplicial complex formed by the union of every simplex α in X whose costalk C(α) contains σ. Abstractly, this is equivalent to a union (Dual(C)) (σ) = {α ∈ X : σ ∈ C(α)}, which implies that Dual(C) is a well-defined cosheaf when the extensions are all chosen to be inclusions. Example 14. Figure 11 shows a cosheaf B of abstract simplicial complexes on an abstract simplicial complex. Since each extension map is an inclusion, this cosheaf is an object in CoShvAsc. The space of global cosections of this cosheaf is an abstract simplicial complex, which is shown at right in Figure 11. The cosheaf Dual(B) can therefore be constructed on this new abstract simplicial complex using the definition above. The resulting cosheaf is shown in Figure 12, where it is clear that each extension of this new cosheaf is an inclusion. It is also easily seen that the space of global cosections of Dual(B) is the base space of B. (Dual(R))(σ) A cosheaf morphism m : R → S along a simplicial map f : X → Y induces a map m * : R(X) → S(Y ) on each space of cosections (Lemma 5). We use these data to define a morphism w : Dual(R) → Dual(S). As such, the induced map m * on the space of global cosections becomes the new base space map, along which the new cosheaf morphism w is written. The individual simplices map by way of restricting to the components of the old morphism, since m * is a simplicial map. Conversely, the old base space map f defines the new component maps w σ by restriction.

Theorem 7. (Cosheaf version of Dowker duality)
Dual is a functor that makes the diagram of functors commute: Proof. The way that Dual(R) has been defined, we might end up with a simplicial complex as a costalk that is not a complete simplex -which is a problem according to Lemma 7 -but this does not happen in the image of CoShvRep. Suppose that R = CoShvRep(X, Y, R). We claim that for every simplex σ in R(X) = D(Y, X, R T ), the set of simplices {α ∈ X : σ ∈ R(α)} has a unique maximal simplex in the inclusion order, so that the union in the definition of (Dual(R)) (σ) really is just that one simplex. To see that, suppose that α and β are simplices of X for which σ ∈ R(α) and σ ∈ R(β). Suppose that any other simplex γ that contains α has σ / ∈ R(γ), so α is maximal in the sense of inclusion. We want to show that β ⊆ α. Going back to the definition of R, we have that Both contain σ. What about the simplex δ whose vertices are the union of the vertices of α and β? Suppose that y ∈ Y is a vertex of σ. This means that y ∈ Y α ∩ Y β , which means that (x, y) ∈ R for every x ∈ α ∪ β = δ. Thus σ ⊆ Y δ , or in other words σ ∈ R(δ) according to Lemma 7. On the other hand, if α δ, we assumed that σ / ∈ R(δ). So the only way this can happen is if α = δ, which implies β ⊆ α.
With this fact in hand, we can observe that {α ∈ X : for all y ∈ σ and all x ∈ α, (x, y) ∈ R} = {x ∈ X : (x, y) for all y ∈ σ}    Let is define A = CoShvRep(X 1 , Y 1 , R 1 ) and B = CoShvRep(X 4 , Y 4 , R 4 ). The cosheaf morphism induced by CoShvRep 0 was shown in Figure 7, but what interests us now is the cosheaf morphism A → B induced by CoShvRep and Dual(A) → Dual(B) induced by Dual • CoShvRep (or equally well, induced by CoShvRep • T ransp). These two morphisms are shown in Figures 13 and 14, respectively. Notice in particular that each component map (in both morphisms) is a simplicial map, so that whenever two vertices are collapsed (for instance g(3) = g(4) = g (5)) the associated simplices are collapsed as well.

Redundancy of relations
As has been explained earlier, the functor D : Rel → Asc is not faithful; many distinct relations have the same Dowker complex. One way this can happen is if columns (or rows) in the matrix for the relation are redundant, which means that a column (or row) has 1s in all the same places as another column (or row), since this simply adds additional copies of the same simplex to the Dowker complex or its dual. We can construct a (non-functorial) cosheaf to detect this redundancy directly using a similar construction to our earlier ones.
Since Lemma 7 establishes that D Y σ , σ, (R| σ,Yσ ) T is always a complete simplex for a relation (X, Y, R) -equivalently, the matrix for R| σ,Yσ is a block of all 1sit does not have any useful information beyond the vertex set Y σ . In a sense, R 0 = CoShvRep 0 (X, Y, R) and R = CoShvRep(X, Y, R) are basically very similar; the only difference being the topology on their costalks.
Taking a different perspective, the matrix for R| X\σ,Yσ contains all the information about the elements of Y σ that is not a result of their relation to elements in σ. This observation means that we can also define a rather different cosheaf by its costalks S(σ) = D Y σ , X\σ, (R| X\σ,Yσ ) T , on each simplex σ of D(X, Y, R). As in the previous constructions, we may take the extensions S(σ ⊆ τ ) to be simplicial maps induced by inclusions. The extensions are well defined because of Lemma 2. If [y 0 , y 1 , . . . , y n ] is a simplex of D Y τ , X\τ, (R| X\τ,Yτ ) T , then this means that there is an x / ∈ τ such that (x, y i ) ∈ R for all i = 0, 1, . . . , n. Evidently, x / ∈ σ as well, so [y 0 , y 1 , . . . , y n ] is a simplex of D Y σ , X\σ, (R| X\σ,Yσ ) T as well.
Elements of Y σ may not be related to any elements of X besides those already in σ. This means that R 0 = CoShvRep 0 (X, Y, R) may not be a sub-cosheaf of S, because a costalk of S may have fewer vertices than in the corresponding costalk of R 0 . Moreover, the transformation (X, Y, R) → S is not functorial. which cannot exist unless the domain is empty. Finally, notice that restricting the domain to Rel + does not improve matters, since (X , Y , R ) is already an object of Rel + .
Even in the face of situations like Example 16, sometimes a cosheaf morphism can be induced by a Rel morphism.
Example 17. Consider the Rel morphism (f, g) : (X 1 , Y 1 , R 1 ) → (X 4 , Y 4 , R 4 ) given in Example 10. If we construct S from (X 1 , Y 1 , R 1 ) and T from (X 4 , Y 4 , R 4 ) using the recipe above, this happens to induce a cosheaf morphism S → T, which is shown in Figure 15. It is immediately apparent that the costalks on all of the maximal simplices are empty. This is a consequence of the definition: if σ is a maximal simplex of D(X, Y, R), then this means that for any y ∈ Y σ , y / ∈ Y τ for any strictly larger τ that contains σ. The presence of ∅ in various costalks is not a problem for the morphism, since there always exists a unique function ∅ → A for any set A. Furthermore, even though in Example 16 the presence of empty sets in the codomain caused a problem, they are benign in this case because the domain costalks are also empty. A little inspection reveals that the costalks identify redundant simplices in D(Y, X, R T ). Such a redundant simplex is generated by a row of the matrix for R that is a proper subset of some other row. This means that we can interpret the space of global cosections of S (or T) as being the collection of all redundant simplices -those whose corresponding elements of X can be removed without changing the Dowker complex.