7  Sheaf Cohomology, Laplacians, and Harmonic Extensions

Purpose. Develops the spectral viewpoint: the sheaf Laplacian \(\mathcal{L}_\mathcal{F} = \delta^T\delta\), the Hodge theorem, relative cohomology, and the harmonic-extension principle. These are the tools that will let us characterize equilibria of sheaf-valued dynamics once we start running them in later chapters — in particular, they underwrite the two central results of Part III and IV (Proposition 3.4 and Theorem 4.1 of [1]).

7.1 Motivating example

Return to the path graph with two pinned ends from Ch. 2 — but now let the stalks be multidimensional and the restriction maps be arbitrary matrices. The pinned dynamics now drive a vector at each interior vertex toward consistency with its neighbors, where “consistency” means agreement after passing through the restriction maps. The unique equilibrium of this process is the harmonic extension of the boundary data.

The whole machinery of Ch. 2 — Laplacian, Dirichlet energy, Dirichlet problem, exponential convergence — extends to sheaves with almost no change. The only difference is that the coboundary \(\delta\) now involves restriction maps, and the spectral gap depends on those maps. This chapter develops the theory; Ch. 6 runs the dynamics.

7.2 Key concepts and results

  • Coboundary \(\delta\) as a block matrix; sheaf Laplacian \(\mathcal{L}_\mathcal{F} = \delta^T\delta\).
  • The Hodge theorem: \(\ker\mathcal{L}_\mathcal{F} = \ker\delta = H^0(G;\mathcal{F})\) (global sections).
  • Relative cohomology \(H^0(G,U;\mathcal{F})\) with respect to a boundary set \(U\).
  • When is \(H^0(G,U;\mathcal{F}) = 0\)? (Equivalently: when is the restricted Laplacian positive definite?)
  • Unique harmonic extension under vanishing relative cohomology.

7.3 Intuition

In Ch. 2, the key fact was: “on a connected graph with at least one pinned vertex, the restricted Laplacian \(L[\Omega,\Omega]\) is positive definite.” This forced the harmonic extension to exist and be unique. The sheaf generalization is: “when the relative cohomology \(H^0(G,U;\mathcal{F})\) vanishes, the restricted sheaf Laplacian is positive definite.”

For the book’s main application, the vanishing of \(H^0\) won’t come from connectivity — it will come from a specific algebraic property of the restriction maps: once we line them up along the layers of a neural network, the relevant operator turns out to be block-triangular with identity blocks on the diagonal, and therefore automatically invertible. The geometric message to carry now is just this: when the boundary-relative cohomology vanishes, boundary conditions force a unique equilibrium. (The algebraic fact that delivers this in Ch. 7 is the unitriangular structure of \(\delta_\Omega\), Lemma 3.2 of [1].)

The Hodge theorem is the statement that global sections are exactly the “frequency zero” modes of the sheaf — the kernel of the Laplacian. Everything else can be expressed as a “gradient” (\(\delta^T c\) for some 1-cochain \(c\)) or a “curl” (\(\delta h\) for some 0-cochain \(h\)). For graphs, the curl part is trivial and the decomposition simplifies to the statement used in the convergence proofs.

7.4 Formal development

The sheaf Laplacian

Definition 7.1 Definition 5.1 (Sheaf Laplacian). For a cellular sheaf \(\mathcal{F}\) on a graph \(G\) with coboundary \(\delta : C^0(G;\mathcal{F}) \to C^1(G;\mathcal{F})\), the sheaf Laplacian is \[\mathcal{L}_\mathcal{F} = \delta^T \delta : C^0(G;\mathcal{F}) \to C^0(G;\mathcal{F}).\]

\(\mathcal{L}_\mathcal{F}\) is positive semidefinite by construction: \(\langle x, \mathcal{L}_\mathcal{F} x\rangle = \|\delta x\|^2 \geq 0\). Its local action at vertex \(v\) is \[(\mathcal{L}_\mathcal{F} x)_v = \sum_{e:\, v \leq e} \mathcal{F}_{v \leq e}^T \bigl(\mathcal{F}_{v \leq e}\, x_v - \mathcal{F}_{w \leq e}\, x_w\bigr),\] where \(w\) denotes the other endpoint of edge \(e\). Each vertex \(v\) is updated using only its own data and the data at neighboring vertices \(w\) — the dynamics are local in the graph-theoretic sense.

Explicit block structure. Ordering the stalk dimensions \(d_v = \dim\mathcal{F}(v)\), the \((v,v)\) block of \(\mathcal{L}_\mathcal{F}\) is \(\sum_{e:\, v \leq e} \mathcal{F}_{v \leq e}^T \mathcal{F}_{v \leq e}\) (a sum of positive semidefinite matrices), and the off-diagonal \((v,w)\) block is \(-\mathcal{F}_{v \leq e}^T \mathcal{F}_{w \leq e}\) for the unique edge \(e = \{v,w\}\) (zero if there is no such edge).

For the constant sheaf \(\underline{\mathbb{R}}\), all stalks are \(\mathbb{R}\) and all restriction maps are \(\pm1\), so \(\mathcal{L}_{\underline{\mathbb{R}}} = L\) recovers the ordinary graph Laplacian.

The Hodge theorem for sheaves

Theorem 7.1 Theorem 5.2 (Hodge theorem for sheaves, [2]). For any cellular sheaf \(\mathcal{F}\) on a graph \(G\), \[\ker\mathcal{L}_\mathcal{F} = \ker\delta = H^0(G;\mathcal{F}),\] where \(H^0(G;\mathcal{F}) = \ker\delta\) is the zeroth sheaf cohomology (the space of global sections).

Proof. \(x \in \ker\mathcal{L}_\mathcal{F}\) iff \(\langle x, \mathcal{L}_\mathcal{F} x\rangle = \|\delta x\|^2 = 0\) iff \(\delta x = 0\) iff \(x \in \ker\delta\). \(\square\)

Theorem 5.2 is the sheaf version of the statement “harmonic functions on a connected graph are constants.” Here, global sections play the role of constants. The dimension \(\dim H^0(G;\mathcal{F})\) counts the number of independent global sections; it equals the multiplicity of the eigenvalue 0 in the spectrum of \(\mathcal{L}_\mathcal{F}\).

Relative cohomology

When a boundary subset \(U \subseteq V\) is pinned to fixed data, the relevant question is not whether global sections exist but whether sections that vanish on \(U\) exist.

Definition 7.2 Definition 5.3 (Relative cohomology). The zeroth relative cohomology with respect to a boundary set \(U \subseteq V\) is \[H^0(G,U;\mathcal{F}) = \{x \in \ker\delta : x|_U = 0\}.\]

\(H^0(G,U;\mathcal{F}) = 0\) means: the only global section that vanishes on \(U\) is the zero section. Equivalently, any consistent assignment on the interior \(\Omega = V \setminus U\) extends to a consistent assignment on all of \(G\) that is uniquely determined by the boundary data — the harmonic extension is unique.

Restricted Laplacian and harmonic extension

Write the sheaf Laplacian in blocks: \[\mathcal{L}_\mathcal{F} = \begin{pmatrix} \mathcal{L}_\mathcal{F}[U,U] & \mathcal{L}_\mathcal{F}[U,\Omega] \\ \mathcal{L}_\mathcal{F}[\Omega,U] & \mathcal{L}_\mathcal{F}[\Omega,\Omega] \end{pmatrix}.\] The restricted Laplacian \(\mathcal{L}_\mathcal{F}[\Omega,\Omega]\) governs the interior dynamics; \(\mathcal{L}_\mathcal{F}[\Omega,U]\) encodes the boundary forcing.

Theorem 7.2 Theorem 5.4 (Unique harmonic extension). If \(H^0(G,U;\mathcal{F}) = 0\), then \(\mathcal{L}_\mathcal{F}[\Omega,\Omega]\) is positive definite and there exists a unique 0-cochain \(x^* \in C^0(G;\mathcal{F})\) satisfying \(x^*|_U = u\) and \((\mathcal{L}_\mathcal{F} x^*)_v = 0\) for all \(v \in \Omega\). This harmonic extension minimizes the total discrepancy \(\|\delta x\|^2\) subject to the boundary conditions.

Proof. The condition \((\mathcal{L}_\mathcal{F} x^*)_\Omega = 0\) with \(x^*|_U = u\) is equivalent to \(\mathcal{L}_\mathcal{F}[\Omega,\Omega]\, x^*|_\Omega = -\mathcal{L}_\mathcal{F}[\Omega,U]\, u\). If \(H^0(G,U;\mathcal{F}) = 0\), then \(\mathcal{L}_\mathcal{F}[\Omega,\Omega]\) is positive definite (because any nonzero \(\omega \in \ker\mathcal{L}_\mathcal{F}[\Omega,\Omega]\) would extend to a nonzero global section vanishing on \(U\)). Positive definiteness implies unique solvability. The minimum-discrepancy characterization follows from the fact that \(\|\delta x\|^2 = \langle x, \mathcal{L}_\mathcal{F} x\rangle\) is strictly convex on the affine subspace \(\{x : x|_U = u\}\). \(\square\)

Note

Why this theorem matters downstream. The statement above will be the workhorse of Parts III–IV. For any sheaf-like setup where we can pin some vertices (the “inputs”) and check that the boundary-relative cohomology vanishes, Theorem 5.4 hands us a unique equilibrium for free — no dynamics computation required. In the book’s main application, the pinned vertices will be the network’s inputs, the cohomology will vanish for an algebraic reason specific to layered networks, and the resulting equilibrium will be precisely the forward pass. Technical pointers for the reader skipping ahead: Theorem 5.4 is Theorem 2.5 of [1] (via [3] Theorem 5.1); the cohomology-vanishing step is Ch. 8, delivered by the unitriangular factorization argument (Lemma 3.2).

Spectral gap of the restricted Laplacian

Definition 7.3 Definition 5.5. The spectral gap of the restricted sheaf Laplacian is \(\lambda_{\min}(\mathcal{L}_\mathcal{F}[\Omega,\Omega])\), the smallest eigenvalue of \(\mathcal{L}_\mathcal{F}[\Omega,\Omega]\).

If \(H^0(G,U;\mathcal{F}) = 0\), then \(\lambda_{\min}(\mathcal{L}_\mathcal{F}[\Omega,\Omega]) > 0\) and the restricted dynamics (Ch. 6) converge at rate \(\alpha\lambda_{\min}\). A preview of a subtlety that will matter in Part IV: in the book’s main application the sheaf itself will change as the state evolves (each activation pattern gives a slightly different sheaf). The convergence rate one should carry in mind is therefore the worst-case spectral gap across all patterns — and because there are only finitely many patterns, this worst-case minimum is still strictly positive, so convergence survives the switching. Concretely (Ch. 9), [1] define \[\lambda^* = \alpha \min_R \lambda_{\min}(\mathcal{L}_{\mathcal{F}_R}[\Omega,\Omega]) > 0,\] where the minimum is over all activation patterns \(R\).

7.5 Worked example: the discourse sheaf on a path

Return to the three-agent discourse sheaf from Ch. 4 (Example 4.4): path \(v_1 - e_{12} - v_2 - e_{23} - v_3\), stalks \(\mathbb{R}^2\), edge stalks \(\mathbb{R}\), with restrictions \(\mathcal{F}_{v_1 \leq e_{12}} = (1,0)\), \(\mathcal{F}_{v_2 \leq e_{12}} = (0,1)\), \(\mathcal{F}_{v_2 \leq e_{23}} = (1,0)\), \(\mathcal{F}_{v_3 \leq e_{23}} = (0,1)\).

Coboundary. With 0-cochains \(x = (x_{v_1}, x_{v_2}, x_{v_3}) \in (\mathbb{R}^2)^3\) and 1-cochains \(y = (y_{e_{12}}, y_{e_{23}}) \in \mathbb{R}^2\): \[\delta = \begin{pmatrix} -\mathcal{F}_{v_1 \leq e_{12}} & \mathcal{F}_{v_2 \leq e_{12}} & 0 \\ 0 & -\mathcal{F}_{v_2 \leq e_{23}} & \mathcal{F}_{v_3 \leq e_{23}} \end{pmatrix} = \begin{pmatrix} -(1,0) & (0,1) & 0 \\ 0 & -(1,0) & (0,1) \end{pmatrix}.\]

Sheaf Laplacian. \(\mathcal{L}_\mathcal{F} = \delta^T\delta\) is a \(6\times6\) matrix (two \(\mathbb{R}^2\) blocks per vertex). Computing explicitly: \[\mathcal{L}_\mathcal{F} = \begin{pmatrix} \begin{pmatrix}1&0\\0&0\end{pmatrix} & \begin{pmatrix}0&-1\\0&0\end{pmatrix} & 0 \\ \begin{pmatrix}0&0\\-1&0\end{pmatrix} & \begin{pmatrix}1&0\\0&1\end{pmatrix} & \begin{pmatrix}0&0\\0&-1\end{pmatrix} \\ 0 & \begin{pmatrix}0&0\\0&-1\end{pmatrix} & \begin{pmatrix}0&0\\0&1\end{pmatrix} \end{pmatrix}.\]

Global sections. \(x \in \ker\delta\) requires \(x^{(2)}_{v_2} = x^{(1)}_{v_1}\) and \(x^{(2)}_{v_3} = x^{(1)}_{v_2}\), a 3-dimensional space. The eigenvalue 0 has multiplicity 3, consistent with Theorem 5.2.

Pinned dynamics. Pin \(v_1\) and \(v_3\) (to \(u_1 \in \mathbb{R}^2\) and \(u_3 \in \mathbb{R}^2\)). The restricted Laplacian \(\mathcal{L}_\mathcal{F}[\{v_2\},\{v_1,v_3\}]\) is the \(2\times2\) block \(\begin{pmatrix}1&0\\0&1\end{pmatrix} = I_2\), which is positive definite. By Theorem 5.4, there is a unique harmonic extension — the unique \(x_{v_2}\) consistent with both neighbors.

Solving: \(I_2 \cdot x_{v_2} = \frac{1}{2}\bigl((0,x^{(2)}_{v_1}) + (x^{(1)}_{v_3}, 0)\bigr) + \text{boundary terms}\). The harmonic extension picks out the “right” components of each neighbor’s opinion as the intermediate agent’s opinion.

7.6 Exercises

5.1 (Warm-up — sheaf Laplacian on the constant sheaf). Verify that \(\mathcal{L}_{\underline{\mathbb{R}}} = L\) (the ordinary graph Laplacian) for any graph \(G\).

5.2 (Positive definite vs. positive semidefinite). Give an example of a sheaf \(\mathcal{F}\) on a connected graph \(G\) for which \(\mathcal{L}_\mathcal{F}\) is positive definite (not just semidefinite). (Hint: what restriction maps can make all cochains have nonzero discrepancy?)

5.3 (Relative cohomology). For the discourse sheaf of Example 4.4, pin vertex \(v_1\). Show that \(H^0(G,\{v_1\};\mathcal{F}) = 0\) and find the harmonic extension of arbitrary boundary data \(u_{v_1} \in \mathbb{R}^2\).

5.4 (Spectral gap and restriction maps). Consider a sheaf on the single edge \(v \to w\) with \(\mathcal{F}(v) = \mathcal{F}(w) = \mathbb{R}^n\) and \(\mathcal{F}(e) = \mathbb{R}^k\). The restriction maps are \(A : \mathbb{R}^n \to \mathbb{R}^k\) (from \(v\)) and \(B : \mathbb{R}^n \to \mathbb{R}^k\) (from \(w\)). Pin \(v\) to boundary data \(u\). Show that the restricted Laplacian (acting on \(\mathcal{F}(w) = \mathbb{R}^n\)) is \(B^T B\), and find conditions on \(B\) for it to be positive definite.

5.5 (A determinant-one restriction operator — preview). Let \(G\) be the path \(v_0 - e_1 - v_1 - e_2 - v_2\) with stalks \(\mathcal{F}(v_0) = \mathcal{F}(e_1) = \mathcal{F}(e_2) = \mathbb{R}^2\) and \(\mathcal{F}(v_1) = \mathcal{F}(v_2) = \mathbb{R}^2\). Choose restriction maps so that \(\delta_\Omega\) (the restriction of \(\delta\) to the free coordinates \(v_1, v_2\), with \(v_0\) pinned) is the matrix \(\begin{pmatrix}I & 0 \\ -A & I\end{pmatrix}\) for some \(A \in \mathbb{R}^{2\times2}\). Show \(\det\delta_\Omega = 1\) regardless of \(A\) and conclude \(\mathcal{L}_\mathcal{F}[\Omega,\Omega]\) is positive definite. Note how lightly this depends on \(A\): it is a structural fact about layered restriction maps, not about any specific choice. This is the one-layer case of what Ch. 7 will develop in full generality (Lemma 3.2 in [1]).

5.6 (Project — spectral analysis). Using the Ch. 7 neural-sheaf construction, take a trained [2, 30, 1] network, compute the spectrum of \(\mathcal{L}_\mathcal{F}[\Omega,\Omega]\) for 50 random inputs, and look at where the slowest mode lives: the intuition to verify is that the Fiedler eigenvector concentrates its energy on the stalk carrying the network’s output pre-activation, matching the informal statement “the slowest part of the dynamics is the last layer settling.” This reproduces Figure 15a from [1]; the output pre-activation stalk is the one denoted \(z^{(k+1)}\) there. See lab-05-sheaf-laplacian.

7.7 Coding lab

Lab 05 — Sheaf Laplacian — Implement the sheaf Laplacian \(\mathcal{L}_\mathcal{F} = \delta^T\delta\) from the coboundary matrix built in Lab 04. For the path sheaf, verify the block-tridiagonal structure of \(\mathcal{L}_\mathcal{F}\) (equation (A.1.36) from [1], Appendix A). Compute eigenvalues and eigenvectors. As a preview of Ch. 7: initialize a random [2, 4, 1] network, compute the restricted Laplacian \(\mathcal{L}_\mathcal{F}[\Omega,\Omega]\), verify positive definiteness (all eigenvalues \(> 0\)), and — surprisingly — observe that its determinant is exactly 1 regardless of the weights. This numerical fact is the footprint of the structural identity we’ll prove later (Lemma 3.2 of [1]). Visualize the Fiedler eigenvector energy per stalk.

7.8 Further reading

The spectral theory of sheaf Laplacians and the Hodge theorem on graphs is developed in [2]. The relative cohomology perspective and the harmonic extension result (Theorem 5.4 = [3] Theorem 5.1) are in [3]. For the categorical and higher-dimensional generalization, see [4]. The Hodge Laplacian on simplicial complexes (the generalization of the graph Laplacian to higher-order data) is surveyed in [5].

7.9 FAQ / common misconceptions

Q: Is the sheaf Laplacian the same as the graph Laplacian? No, in general. \(\mathcal{L}_\mathcal{F} = \delta^T\delta\) has the same form as \(L = \delta^T\delta\), but the coboundary \(\delta\) for a sheaf involves the restriction maps \(\mathcal{F}_{v \leq e}\), which can be arbitrary matrices. When all stalks are \(\mathbb{R}\) and all restrictions are \(\pm1\), \(\mathcal{L}_\mathcal{F} = L\).

Q: When can \(H^0(G,U;\mathcal{F}) \neq 0\)? If \(U\) does not “see” some part of the sheaf — for example, if some interior vertex’s stalk is entirely in the kernel of all adjacent restriction maps — then there can be nonzero sections that vanish on \(U\). The heuristic is that the boundary has to be “connected enough through the restriction maps” to reach every interior degree of freedom. Preview for Ch. 7: this condition will hold automatically for the book’s main application (layered feedforward networks) by a clean algebraic reason, but can fail for architectures with skip connections or shared parameters, where it must be verified separately — Lemma 3.2 and §7 of [1] give the precise statements.

Q: Why is the minimum eigenvalue across all activation patterns the right convergence rate? Because the sheaf switches between activation patterns during the heat equation trajectory. Within each pattern, the convergence rate is \(\alpha\lambda_{\min}(\mathcal{L}_{\mathcal{F}_R}[\Omega,\Omega])\) for that pattern \(R\). The slowest rate (minimum over all patterns) gives a uniform lower bound on how fast the energy decreases in the worst case. Since there are finitely many patterns, this minimum is positive.