MerLean-example

7 Def 1: Boundary and Coboundary Maps

Let \(G = (V, E)\) be a graph with a chosen collection \(\mathcal{C}\) of cycles. We define the boundary and coboundary maps as \(\mathbb {Z}_2\)-linear maps using binary vector representations.

Definition 171 Graph with Cycles
#

A graph with cycles is a structure \((G, V, E, C)\) where:

  • \(V\), \(E\), \(C\) are finite types with decidable equality,

  • \(G\) is a simple graph on \(V\) with decidable adjacency,

  • \(\mathrm{edgeEndpoints} : E \to V \times V\) assigns to each edge its two endpoints,

  • for each edge \(e\), the endpoints are adjacent: \(G.\mathrm{Adj}(\mathrm{edgeEndpoints}(e)_1, \mathrm{edgeEndpoints}(e)_2)\),

  • edges are symmetric: adjacency holds in both directions,

  • \(\mathrm{cycles} : C \to \mathrm{Finset}(E)\) assigns to each cycle index its set of edges.

Definition 172 Incidence Relation
#

An edge \(e\) is incident to a vertex \(v\) if \(v\) is one of its endpoints:

\[ \mathrm{isIncident}(e, v) \iff (\mathrm{edgeEndpoints}(e)_1 = v) \lor (\mathrm{edgeEndpoints}(e)_2 = v). \]
Definition 173 Incident Edges

The set of edges incident to a vertex \(v\) is:

\[ \mathrm{incidentEdges}(v) = \{ e \in E \mid \mathrm{isIncident}(e, v) \} . \]
Definition 174 Edge Vertices
#

The set of vertices incident to an edge \(e\) (its two endpoints) is:

\[ \mathrm{edgeVertices}(e) = \{ \mathrm{edgeEndpoints}(e)_1,\; \mathrm{edgeEndpoints}(e)_2\} . \]
Lemma 175 Membership in Edge Vertices

For any edge \(e\) and vertex \(v\),

\[ v \in \mathrm{edgeVertices}(e) \iff \mathrm{isIncident}(e, v). \]
Proof

By simplification using the definitions of \(\mathrm{edgeVertices}\) and \(\mathrm{isIncident}\), membership in \(\{ v_1, v_2\} \) is equivalent to \(v = v_1 \lor v = v_2\), which is precisely the definition of incidence. The result follows by propositional logic (tauto).

Definition 176 Cycle Contains Edge
#

A cycle \(c\) contains an edge \(e\) if \(e \in \mathrm{cycles}(c)\).

Definition 177 Cycles Containing an Edge

The set of cycles containing a given edge \(e\) is:

\[ \mathrm{cyclesContaining}(e) = \{ c \in C \mid \mathrm{cycleContainsEdge}(c, e) \} . \]
Definition 178 Binary Vector Spaces
#

We define the binary vector spaces:

  • \(\mathbb {Z}_2^V := V \to \mathbb {Z}_2\) (binary vectors over vertices),

  • \(\mathbb {Z}_2^E := E \to \mathbb {Z}_2\) (binary vectors over edges),

  • \(\mathbb {Z}_2^C := C \to \mathbb {Z}_2\) (binary vectors over cycles).

Each carries a natural \(\mathbb {Z}_2\)-module structure.

Definition 179 Standard Basis Vectors
#

The standard basis vectors are defined as:

  • \(\mathrm{basisV}(v) = \mathbf{e}_v \in \mathbb {Z}_2^V\): the vector with \(1\) at position \(v\) and \(0\) elsewhere,

  • \(\mathrm{basisE}(e) = \mathbf{e}_e \in \mathbb {Z}_2^E\): the vector with \(1\) at position \(e\) and \(0\) elsewhere,

  • \(\mathrm{basisC}(c) = \mathbf{e}_c \in \mathbb {Z}_2^C\): the vector with \(1\) at position \(c\) and \(0\) elsewhere.

Formally, \(\mathrm{basisV}(v) = \pi _{\mathrm{single}}(v, 1)\) (and similarly for edges and cycles).

Definition 180 Boundary of a Single Edge

The boundary of a single edge \(e\) with endpoints \((v, v')\) is:

\[ \partial e = \mathbf{e}_v + \mathbf{e}_{v'} \in \mathbb {Z}_2^V, \]

the binary vector with \(1\)s at positions \(v\) and \(v'\).

Definition 181 Boundary Map \(\partial \)

The boundary map \(\partial : \mathbb {Z}_2^E \to \mathbb {Z}_2^V\) is the \(\mathbb {Z}_2\)-linear map defined by:

\[ \partial (f) = \sum _{e \in E} f(e) \cdot \partial e, \]

where \(\partial e = \mathbf{e}_v + \mathbf{e}_{v'}\) for edge \(e = \{ v, v'\} \).

Lemma 182 Boundary of Basis Edge

For any edge \(e\),

\[ \partial (\mathbf{e}_e) = \partial e. \]
Proof

By the definition of the boundary map, \(\partial (\mathbf{e}_e) = \sum _{e' \in E} \mathbf{e}_e(e') \cdot \partial e'\). We isolate the term \(e' = e\) using Finset.sum_eq_single. For the term \(e' = e\), we have \(\mathbf{e}_e(e) = 1\), so the contribution is \(1 \cdot \partial e = \partial e\). For any other \(e' \neq e\), we have \(\mathbf{e}_e(e') = 0\) by the definition of the standard basis vector (Pi.single), so the contribution is \(0 \cdot \partial e' = 0\). The remaining case \(e \notin \mathrm{univ}\) is absurd since \(e \in \mathrm{Finset.univ}\).

Lemma 183 Endpoints are Distinct

For any edge \(e\), the two endpoints are distinct:

\[ \mathrm{edgeEndpoints}(e)_1 \neq \mathrm{edgeEndpoints}(e)_2. \]
Proof

This follows from the fact that simple graphs have no self-loops: since the endpoints are adjacent, they must be distinct (by \(\mathrm{SimpleGraph.ne\_ of\_ adj}\)).

Lemma 184 Boundary of Edge Characterization

The boundary of an edge \(e\) evaluated at vertex \(v\) is:

\[ (\partial e)(v) = \begin{cases} 1 & \text{if } \mathrm{isIncident}(e, v), \\ 0 & \text{otherwise.} \end{cases} \]
Proof

Unfolding the definition, \((\partial e)(v) = \mathbf{e}_{v_1}(v) + \mathbf{e}_{v_2}(v)\) where \((v_1, v_2) = \mathrm{edgeEndpoints}(e)\). We consider three cases:

  1. If \(v_1 = v\): then \(\mathbf{e}_{v_1}(v) = 1\). Since \(v_1 \neq v_2\) (by distinctness of endpoints), \(\mathbf{e}_{v_2}(v) = 0\). Thus \((\partial e)(v) = 1 + 0 = 1\), and \(\mathrm{isIncident}(e, v)\) holds.

  2. If \(v_1 \neq v\) and \(v_2 = v\): then \(\mathbf{e}_{v_1}(v) = 0\) and \(\mathbf{e}_{v_2}(v) = 1\). Thus \((\partial e)(v) = 0 + 1 = 1\), and \(\mathrm{isIncident}(e, v)\) holds.

  3. If \(v_1 \neq v\) and \(v_2 \neq v\): then both basis evaluations are \(0\), giving \((\partial e)(v) = 0\), and \(\mathrm{isIncident}(e, v)\) does not hold.

Lemma 185 Boundary Map at a Vertex

For any edge-vector \(f \in \mathbb {Z}_2^E\) and vertex \(v\),

\[ \partial (f)(v) = \sum _{e \in \mathrm{incidentEdges}(v)} f(e). \]
Proof

By definition, \(\partial (f)(v) = \sum _{e \in E} f(e) \cdot (\partial e)(v)\). Evaluating the pointwise sum, we split \(E\) into edges incident to \(v\) and those not incident to \(v\). For non-incident edges \(e\), we have \((\partial e)(v) = 0\) by the characterization of boundary evaluation, so \(f(e) \cdot 0 = 0\). Thus the sum over non-incident edges vanishes and we add zero. The incident filter equals \(\mathrm{incidentEdges}(v)\) by definition. For incident edges, \((\partial e)(v) = 1\), so \(f(e) \cdot 1 = f(e)\). The result follows by congruence of the sums.

Definition 186 Coboundary of a Single Vertex

The coboundary of a single vertex \(v\) is the characteristic vector of edges incident to \(v\):

\[ (\delta v)(e) = \begin{cases} 1 & \text{if } \mathrm{isIncident}(e, v), \\ 0 & \text{otherwise.} \end{cases} \]
Definition 187 Coboundary Map \(\delta \)

The coboundary map \(\delta : \mathbb {Z}_2^V \to \mathbb {Z}_2^E\) is the \(\mathbb {Z}_2\)-linear map defined by:

\[ \delta (f) = \sum _{v \in V} f(v) \cdot \delta v, \]

where \(\delta v\) is the characteristic vector of edges incident to \(v\).

Lemma 188 Coboundary of Basis Vertex

For any vertex \(v\),

\[ \delta (\mathbf{e}_v) = \delta v. \]
Proof

By the definition of the coboundary map, \(\delta (\mathbf{e}_v) = \sum _{w \in V} \mathbf{e}_v(w) \cdot \delta w\). We isolate the term \(w = v\) using Finset.sum_eq_single. For \(w = v\), we have \(\mathbf{e}_v(v) = 1\), giving \(1 \cdot \delta v = \delta v\). For \(w \neq v\), we have \(\mathbf{e}_v(w) = 0\), giving \(0 \cdot \delta w = 0\). The case \(v \notin \mathrm{univ}\) is absurd.

For any vertex-vector \(f \in \mathbb {Z}_2^V\) and edge \(e\),

\[ \delta (f)(e) = \sum _{v \in \mathrm{edgeVertices}(e)} f(v). \]
Proof

By definition, \(\delta (f)(e) = \sum _{v \in V} f(v) \cdot (\delta v)(e)\). Evaluating the pointwise sum, we split \(V\) into vertices incident to \(e\) and those not incident. The incident filter equals \(\mathrm{edgeVertices}(e)\) by the characterization of edge vertices via incidence (using the equivalence from the membership lemma and tautological reasoning). For non-incident vertices \(v\), \((\delta v)(e) = 0\), so \(f(v) \cdot 0 = 0\), and the sum vanishes. For incident vertices, \((\delta v)(e) = 1\), so \(f(v) \cdot 1 = f(v)\). The result follows by congruence.

Theorem 190 Coboundary is Transpose of Boundary

For any \(f \in \mathbb {Z}_2^E\) and \(g \in \mathbb {Z}_2^V\),

\[ \sum _{v \in V} \partial (f)(v) \cdot g(v) = \sum _{e \in E} f(e) \cdot \delta (g)(e). \]

That is, \(\langle \partial f, g \rangle = \langle f, \delta g \rangle \), so \(\delta = \partial ^T\).

Proof

We proceed by a chain of equalities:

\begin{align*} \sum _{v \in V} \partial (f)(v) \cdot g(v) & = \sum _{v \in V} \Bigl(\sum _{e \in \mathrm{incidentEdges}(v)} f(e)\Bigr) \cdot g(v) & \text{(by boundary at vertex)}\\ & = \sum _{v \in V} \sum _{e \in \mathrm{incidentEdges}(v)} f(e) \cdot g(v) & \text{(distributing multiplication)}\\ & = \sum _{e \in E} \sum _{v \in \mathrm{edgeVertices}(e)} f(e) \cdot g(v) & \text{(exchanging order of summation)}\\ & = \sum _{e \in E} f(e) \cdot \sum _{v \in \mathrm{edgeVertices}(e)} g(v) & \text{(factoring out $f(e)$)}\\ & = \sum _{e \in E} f(e) \cdot \delta (g)(e) & \text{(by coboundary at edge).} \end{align*}

The exchange of summation order is justified by the equivalence: \(e \in \mathrm{incidentEdges}(v) \iff v \in \mathrm{edgeVertices}(e)\), which follows from the membership characterization via incidence.

Definition 191 Boundary of a Single Cycle
#

The boundary of a single cycle \(c\) is the characteristic vector of its edges:

\[ (\partial _2 c)(e) = \begin{cases} 1 & \text{if } e \in \mathrm{cycles}(c), \\ 0 & \text{otherwise.} \end{cases} \]
Definition 192 Second Boundary Map \(\partial _2\)

The second boundary map \(\partial _2 : \mathbb {Z}_2^C \to \mathbb {Z}_2^E\) is the \(\mathbb {Z}_2\)-linear map defined by:

\[ \partial _2(f) = \sum _{c \in C} f(c) \cdot \partial _2 c, \]

where \(\partial _2 c\) is the characteristic vector of edges in cycle \(c\).

Lemma 193 Second Boundary of Basis Cycle

For any cycle \(c\),

\[ \partial _2(\mathbf{e}_c) = \partial _2 c. \]
Proof

By the definition of the second boundary map, \(\partial _2(\mathbf{e}_c) = \sum _{d \in C} \mathbf{e}_c(d) \cdot \partial _2 d\). We isolate the term \(d = c\) using Finset.sum_eq_single. For \(d = c\), \(\mathbf{e}_c(c) = 1\), giving \(1 \cdot \partial _2 c = \partial _2 c\). For \(d \neq c\), \(\mathbf{e}_c(d) = 0\), giving \(0 \cdot \partial _2 d = 0\). The case \(c \notin \mathrm{univ}\) is absurd.

For any cycle-vector \(f \in \mathbb {Z}_2^C\) and edge \(e\),

\[ \partial _2(f)(e) = \sum _{c \in \mathrm{cyclesContaining}(e)} f(c). \]
Proof

By definition, \(\partial _2(f)(e) = \sum _{c \in C} f(c) \cdot (\partial _2 c)(e)\). Evaluating the pointwise sum, we split \(C\) into cycles containing \(e\) and those not containing \(e\). The containing filter equals \(\mathrm{cyclesContaining}(e)\) by definition. For cycles \(c\) not containing \(e\), \((\partial _2 c)(e) = 0\), so \(f(c) \cdot 0 = 0\), and the sum vanishes. For cycles containing \(e\), \((\partial _2 c)(e) = 1\), so \(f(c) \cdot 1 = f(c)\). The result follows by congruence.

Definition 195 Coboundary of a Single Edge (Second)
#

The second coboundary of a single edge \(e\) is the characteristic vector of cycles containing \(e\):

\[ (\delta _2 e)(c) = \begin{cases} 1 & \text{if } e \in \mathrm{cycles}(c), \\ 0 & \text{otherwise.} \end{cases} \]
Definition 196 Second Coboundary Map \(\delta _2\)

The second coboundary map \(\delta _2 : \mathbb {Z}_2^E \to \mathbb {Z}_2^C\) is the \(\mathbb {Z}_2\)-linear map defined by:

\[ \delta _2(f) = \sum _{e \in E} f(e) \cdot \delta _2 e, \]

where \(\delta _2 e\) is the characteristic vector of cycles containing \(e\).

Lemma 197 Second Coboundary of Basis Edge

For any edge \(e\),

\[ \delta _2(\mathbf{e}_e) = \delta _2 e. \]
Proof

By the definition of the second coboundary map, \(\delta _2(\mathbf{e}_e) = \sum _{e' \in E} \mathbf{e}_e(e') \cdot \delta _2 e'\). We isolate the term \(e' = e\) using Finset.sum_eq_single. For \(e' = e\), \(\mathbf{e}_e(e) = 1\), giving \(1 \cdot \delta _2 e = \delta _2 e\). For \(e' \neq e\), \(\mathbf{e}_e(e') = 0\), giving \(0 \cdot \delta _2 e' = 0\). The case \(e \notin \mathrm{univ}\) is absurd.

Lemma 198 Second Coboundary Map at a Cycle

For any edge-vector \(f \in \mathbb {Z}_2^E\) and cycle \(c\),

\[ \delta _2(f)(c) = \sum _{e \in \mathrm{cycles}(c)} f(e). \]
Proof

By definition, \(\delta _2(f)(c) = \sum _{e \in E} f(e) \cdot (\delta _2 e)(c)\). Evaluating the pointwise sum, we split \(E\) into edges in cycle \(c\) and those not in cycle \(c\). The filter of edges in cycle \(c\) equals \(\mathrm{cycles}(c)\) (by simplification). For edges \(e \notin \mathrm{cycles}(c)\), \((\delta _2 e)(c) = 0\), so \(f(e) \cdot 0 = 0\), and the sum vanishes. For edges \(e \in \mathrm{cycles}(c)\), \((\delta _2 e)(c) = 1\), so \(f(e) \cdot 1 = f(e)\). The result follows by congruence.

Theorem 199 Second Coboundary is Transpose of Second Boundary

For any \(f \in \mathbb {Z}_2^C\) and \(g \in \mathbb {Z}_2^E\),

\[ \sum _{e \in E} \partial _2(f)(e) \cdot g(e) = \sum _{c \in C} f(c) \cdot \delta _2(g)(c). \]

That is, \(\langle \partial _2 f, g \rangle = \langle f, \delta _2 g \rangle \), so \(\delta _2 = \partial _2^T\).

Proof

We proceed by a chain of equalities:

\begin{align*} \sum _{e \in E} \partial _2(f)(e) \cdot g(e) & = \sum _{e \in E} \Bigl(\sum _{c \in \mathrm{cyclesContaining}(e)} f(c)\Bigr) \cdot g(e) & \text{(by second boundary at edge)}\\ & = \sum _{e \in E} \sum _{c \in \mathrm{cyclesContaining}(e)} f(c) \cdot g(e) & \text{(distributing multiplication)}\\ & = \sum _{c \in C} \sum _{e \in \mathrm{cycles}(c)} f(c) \cdot g(e) & \text{(exchanging order of summation)}\\ & = \sum _{c \in C} f(c) \cdot \sum _{e \in \mathrm{cycles}(c)} g(e) & \text{(factoring out $f(c)$)}\\ & = \sum _{c \in C} f(c) \cdot \delta _2(g)(c) & \text{(by second coboundary at cycle).} \end{align*}

The exchange of summation order is justified by the equivalence: \(c \in \mathrm{cyclesContaining}(e) \iff e \in \mathrm{cycles}(c)\), which follows from the definitions of \(\mathrm{cyclesContaining}\) and \(\mathrm{cycleContainsEdge}\) by propositional logic.

Lemma 200 Boundary Map Preserves Zero

\(\partial (0) = 0\).

Proof

This follows directly from the linearity of \(\partial \) (the map_zero property of linear maps).

Lemma 201 Coboundary Map Preserves Zero

\(\delta (0) = 0\).

Proof

This follows directly from the linearity of \(\delta \) (the map_zero property of linear maps).

Lemma 202 Second Boundary Map Preserves Zero

\(\partial _2(0) = 0\).

Proof

This follows directly from the linearity of \(\partial _2\) (the map_zero property of linear maps).

Lemma 203 Second Coboundary Map Preserves Zero

\(\delta _2(0) = 0\).

Proof

This follows directly from the linearity of \(\delta _2\) (the map_zero property of linear maps).

Lemma 204 Boundary Map Preserves Addition

For \(f, g \in \mathbb {Z}_2^E\), \(\partial (f + g) = \partial (f) + \partial (g)\).

Proof

This follows directly from the linearity of \(\partial \) (the map_add property of linear maps).

Lemma 205 Coboundary Map Preserves Addition

For \(f, g \in \mathbb {Z}_2^V\), \(\delta (f + g) = \delta (f) + \delta (g)\).

Proof

This follows directly from the linearity of \(\delta \) (the map_add property of linear maps).

Lemma 206 Second Boundary Map Preserves Addition

For \(f, g \in \mathbb {Z}_2^C\), \(\partial _2(f + g) = \partial _2(f) + \partial _2(g)\).

Proof

This follows directly from the linearity of \(\partial _2\) (the map_add property of linear maps).

Lemma 207 Second Coboundary Map Preserves Addition

For \(f, g \in \mathbb {Z}_2^E\), \(\delta _2(f + g) = \delta _2(f) + \delta _2(g)\).

Proof

This follows directly from the linearity of \(\delta _2\) (the map_add property of linear maps).

Definition 208 Incidence Matrix

The incidence matrix \(M : V \times E \to \mathbb {Z}_2\) is defined by:

\[ M(v, e) = \begin{cases} 1 & \text{if } \mathrm{isIncident}(e, v), \\ 0 & \text{otherwise.} \end{cases} \]
Lemma 209 Incidence Matrix equals Boundary Evaluation

For any vertex \(v\) and edge \(e\),

\[ M(v, e) = (\partial e)(v). \]
Proof

By simplification using the definitions of the incidence matrix and the boundary evaluation characterization, both expressions equal \(1\) if \(\mathrm{isIncident}(e, v)\) and \(0\) otherwise.

Theorem 210 Boundary Map as Matrix Multiplication

For any \(f \in \mathbb {Z}_2^E\) and vertex \(v\),

\[ \partial (f)(v) = \sum _{e \in E} M(v, e) \cdot f(e). \]

That is, \(\partial \) is multiplication by the incidence matrix.

Proof

By the vertex characterization, \(\partial (f)(v) = \sum _{e \in \mathrm{incidentEdges}(v)} f(e)\). We split the universal sum \(\sum _{e \in E} M(v, e) \cdot f(e)\) into incident and non-incident edges. For incident edges, \(M(v, e) = 1\), so \(M(v, e) \cdot f(e) = f(e)\), matching the restricted sum. For non-incident edges, \(M(v, e) = 0\), so \(M(v, e) \cdot f(e) = 0\), and by summing these to zero and adding zero, both sides agree.

Theorem 211 Coboundary Map as Transpose Matrix Multiplication

For any \(f \in \mathbb {Z}_2^V\) and edge \(e\),

\[ \delta (f)(e) = \sum _{v \in V} M(v, e) \cdot f(v). \]

That is, \(\delta \) is multiplication by the transpose of the incidence matrix.

Proof

By the edge characterization, \(\delta (f)(e) = \sum _{v \in \mathrm{edgeVertices}(e)} f(v)\). We split the universal sum \(\sum _{v \in V} M(v, e) \cdot f(v)\) into incident and non-incident vertices. The incident filter equals \(\mathrm{edgeVertices}(e)\) by the equivalence between incidence and edge vertex membership (using the membership lemma and tautological reasoning). For incident vertices, \(M(v, e) = 1\), so the contribution is \(f(v)\). For non-incident vertices, \(M(v, e) = 0\), so the contribution is \(0\). Summing the non-incident terms to zero and adding zero, both sides agree.

Definition 212 Cycle-Edge Matrix
#

The cycle-edge incidence matrix \(N : C \times E \to \mathbb {Z}_2\) is defined by:

\[ N(c, e) = \begin{cases} 1 & \text{if } e \in \mathrm{cycles}(c), \\ 0 & \text{otherwise.} \end{cases} \]
Theorem 213 Second Boundary Map as Matrix Multiplication

For any \(f \in \mathbb {Z}_2^C\) and edge \(e\),

\[ \partial _2(f)(e) = \sum _{c \in C} N(c, e) \cdot f(c). \]

That is, \(\partial _2\) is multiplication by the cycle-edge matrix.

Proof

By the edge characterization, \(\partial _2(f)(e) = \sum _{c \in \mathrm{cyclesContaining}(e)} f(c)\). We split the universal sum \(\sum _{c \in C} N(c, e) \cdot f(c)\) into cycles containing \(e\) and those not containing \(e\). For cycles containing \(e\), \(N(c, e) = 1\), so \(N(c, e) \cdot f(c) = f(c)\), matching the restricted sum. For cycles not containing \(e\), \(N(c, e) = 0\), so \(N(c, e) \cdot f(c) = 0\), and the sum vanishes. Adding zero, both sides agree.

Theorem 214 Second Coboundary Map as Transpose Matrix Multiplication

For any \(f \in \mathbb {Z}_2^E\) and cycle \(c\),

\[ \delta _2(f)(c) = \sum _{e \in E} N(c, e) \cdot f(e). \]

That is, \(\delta _2\) is multiplication by the transpose of the cycle-edge matrix.

Proof

By the cycle characterization, \(\delta _2(f)(c) = \sum _{e \in \mathrm{cycles}(c)} f(e)\). We split the universal sum \(\sum _{e \in E} N(c, e) \cdot f(e)\) into edges in cycle \(c\) and those not in cycle \(c\). The filter of edges in cycle \(c\) equals\(\mathrm{cycles}(c)\) (by simplification). For edges in the cycle, \(N(c, e) = 1\), so \(N(c, e) \cdot f(e) = f(e)\). For edges not in the cycle, \(N(c, e) = 0\), so \(N(c, e) \cdot f(e) = 0\), and the sum vanishes. Adding zero, both sides agree.