GNNTheory: A Lean 4 Formalization of Graph Neural Network Theory

2.1 Vertex-Level Upper Bound

For every \(d \in \mathbb {N}\), every \(d\)-layer MPNN \(N\), all finite \(L\)-labelled graphs \(G, H\), and all vertices \(v \in V(G), w \in V(H)\), \(\operatorname {cr}^{(d)}(G, v) = \operatorname {cr}^{(d)}(H, w) \implies \zeta ^{(d)}_N(G, v) = \zeta ^{(d)}_N(H, w)\). (Grohe, arXiv:2104.14624, Theorem 8.1; Morris et al., arXiv:1810.02244, Theorem 1; Xu et al., arXiv:1810.00826, Lemma 2.)

Lean 4 Spec · GNNTheory/Spec/MPNN.lean:L109–L112 · Proved in GNNTheory/Proofs/MPNN.lean:L82–L84Pending AuditApprove SpecDispute
def mpnn_le_wl_vertex_stmt : Prop :=
  ∀ {V W L Y : Type} [Fintype V] [Fintype W] {d : ℕ}
    (N : MPNN L Y d) (G : LabelledGraph V L) (H : LabelledGraph W L),
    CrossRefines (wlColor G d) (wlColor H d) (N.nodeEmbed G) (N.nodeEmbed H)
Proof ▶

Paper proofs: Grohe (arXiv:2104.14624), §8 (Proof of Theorem 8.1); Morris et al. (arXiv:1810.02244), Appendix §10 (Proof of Theorem 1). Lean formalization: Structural induction on N.layers (mpnnLayers_le_wl), using CrossRefines.map_eq_of_map_eq at each layer to convert equal neighbor-colour multisets into equal neighbor-feature multisets.

Lean 4 Proof · GNNTheory/Proofs/MPNN.lean:L82–L84Verified ✓
theorem mpnn_le_wl_vertex : Spec.mpnn_le_wl_vertex_stmt := by
  intro V W L Y _ _ d N G H
  exact mpnnLayers_le_wl N.init N.layers G H