OctoInform Beta

OpenAI preprint, September 2026 · §2. WL refinement and homomorphism tests

Definition 2.1: Rooted counts sum to total homomorphisms, detect edges, and span a space closed under single and joint replacement sums

Rooted homomorphism tests and replacement sum closure.

Hover over a blue or green term in the text, or a node in the graph, to find it in the other. Select it to read its declaration both in Lean and in words.

The setting

The kk-dimensional Weisfeiler-Leman (kk-WL) algorithm refines colorings of kk-tuples of vertices in a finite simple graph by aggregating color information over single-coordinate substitutions. In separate kk-WL, each refinement step aggregates one coordinate at a time, matching graphs of bag size at most t=kt = k; in joint kk-WL, a refinement step aggregates all kk single-coordinate substitutions simultaneously at a common replacement vertex, matching graphs of bag size at most t=k+1t = k + 1.

To connect kk-WL colorings on two finite simple graphs GG and HH with homomorphism counts from graphs of bounded treewidth, one considers kk-rooted homomorphism tests of bag size at most tt and the rational vector space spanned by their evaluations on pairs of kk-tuples. Showing that this test span detects edges, sums to total homomorphism counts, and is closed under single-coordinate replacement sums (when k≤tk \le t) and joint replacement sums (when k+1≤tk + 1 \le t) supplies the algebraic closure properties needed to track kk-WL refinement steps.

Ranked tree decompositions

A ranked rooted tree D=(r,p,ρ)D = (r, p, \rho) on a node set NN consists of a distinguished root r∈Nr \in N, a parent map p:N→Np : N \to N, and a rank function ρ:N→ℕ\rho : N \to \mathbb{N} such that ρ(p(u))<ρ(u)\rho(p(u)) < \rho(u) for every u∈N\{r}u \in N \setminus \{r\}.

The ancestor relation ≼D\preceq_D on NN is the smallest reflexive binary relation on NN such that whenever v∈N\{r}v \in N \setminus \{r\} and u≼Dp(v)u \preceq_D p(v), one has u≼Dvu \preceq_D v.✦

Let UU and NN be sets, let RR be a binary relation on UU, and let t∈ℕt \in \mathbb{N}. A ranked tree decomposition of (U,R)(U, R) of bag size at most tt on NN is a ranked rooted tree D=(r,p,ρ)D = (r, p, \rho) on NN equipped with a bag map BB assigning to each node u∈Nu \in N a finite subset B(u)⊆UB(u) \subseteq U and a top-node map top⁡:U→N\operatorname{top} : U \to N satisfying six properties. First, a∈B(top⁡(a))a \in B(\operatorname{top}(a)) for every a∈Ua \in U. Second, for every a∈Ua \in U and u∈Nu \in N, membership a∈B(u)a \in B(u) implies top⁡(a)≼Du\operatorname{top}(a) \preceq_D u. Third, for every a∈Ua \in U and u,v∈Nu, v \in N, if top⁡(a)≼Du≼Dv\operatorname{top}(a) \preceq_D u \preceq_D v and a∈B(v)a \in B(v), then a∈B(u)a \in B(u). Fourth, whenever a,b∈Ua, b \in U satisfy R(a,b)R(a, b), there exists u∈Nu \in N with a,b∈B(u)a, b \in B(u). Fifth, |B(u)|≤t|B(u)| \le t for every u∈Nu \in N. Sixth, |B(u)∩B(p(u))|<t|B(u) \cap B(p(u))| < t for every u∈N\{r}u \in N \setminus \{r\}.

Rooted homomorphism tests

Given a binary relation RR on a set AA and a simple graph GG on a vertex set VV, the set Hom⁡(R,G)\operatorname{Hom}(R, G) of homomorphisms from (A,R)(A, R) to GG consists of all maps φ:A→V\varphi : A \to V such that R(a,b)R(a, b) implies φ(a)\varphi(a) and φ(b)\varphi(b) are adjacent in GG.✦

For k∈ℕk \in \mathbb{N}, let [k][k] denote the kk-element index set {1,…,k}\{1, \dots, k\} (empty when k=0k = 0).

Rooted homomorphism counts on bounded-bag-size sources provide the self-contained framework for the preservation direction of the homomorphism characterization of Weisfeiler-Leman equivalence.

For k,t∈ℕk, t \in \mathbb{N}, a kk-rooted homomorphism test FF of bag size at most tt consists of a finite vertex set V(F)V(F), a symmetric binary relation RFR_F on V(F)V(F), a root tuple 𝒓F:[k]→V(F)\mathbf{r}_F : [k] \to V(F), a finite node set NFN_F, and a ranked tree decomposition DFD_F of (V(F),RF)(V(F), R_F) of bag size at most tt on NFN_F with root rFr_F and bag map BFB_F whose root bag equals the image of 𝒓F\mathbf{r}_F: BF(rF)={𝒓F(i):i∈[k]}.B_F(r_F) = \{ \mathbf{r}_F(i) : i \in [k] \}.(1)✦

For a kk-rooted homomorphism test FF, a simple graph GG on a vertex set VV, and a kk-tuple x=(x1,…,xk)∈Vkx = (x_1, \dots, x_k) \in V^k, the set Hom⁡(F,G;x)\operatorname{Hom}(F, G; x) of rooted homomorphisms from FF to GG at xx consists of all φ∈Hom⁡(RF,G)\varphi \in \operatorname{Hom}(R_F, G) satisfying φ(𝒓F(i))=xi\varphi(\mathbf{r}_F(i)) = x_i for every i∈[k]i \in [k].✦ When VV is finite, the rooted homomorphism count of FF in GG at xx is the rational number hom⁡(F,G;x)=|Hom⁡(F,G;x)|∈ℚ,\operatorname{hom}(F, G; x) = |\operatorname{Hom}(F, G; x)| \in \mathbb{Q},(2)✦ and the total homomorphism count of FF in GG is hom⁡(F,G)=|Hom⁡(RF,G)|∈ℚ\operatorname{hom}(F, G) = |\operatorname{Hom}(R_F, G)| \in \mathbb{Q}.

Given a finite set AA with |A|≤t|A| \le t, a symmetric binary relation RR on AA, and a surjective map r:[k]→Ar : [k] \to A, the single-bag test on (A,R,r)(A, R, r) is the kk-rooted homomorphism test of bag size at most tt with vertex set AA, relation RR, root tuple rr, and a one-node ranked tree decomposition of rank 00 whose sole bag is AA and whose top-node map sends every element of AA to that unique node.✦ When k≤tk \le t and i,j∈[k]i, j \in [k], the edge indicator test Ei,jE_{i,j} is the single-bag test on vertex set [k][k] with the identity map on [k][k] as its root tuple and the symmetric relation holding on (a,b)∈[k]2(a, b) \in [k]^2 precisely when (a,b)=(i,j)(a, b) = (i, j) or (a,b)=(j,i)(a, b) = (j, i).✦

Test evaluations and replacement sums

For sets VV and WW and k∈ℕk \in \mathbb{N}, let Vk⊔WkV^k \sqcup W^k denote the disjoint union of the sets of kk-tuples in VV and WW, with canonical inclusions ιV:Vk→Vk⊔Wk\iota_V : V^k \to V^k \sqcup W^k and ιW:Wk→Vk⊔Wk\iota_W : W^k \to V^k \sqcup W^k.✦

Now let GG and HH be finite simple graphs on vertex sets VV and WW, respectively. For a kk-rooted homomorphism test FF of bag size at most tt, the paired test evaluation ΦG,H(F):Vk⊔Wk→ℚ\Phi_{G,H}(F) : V^k \sqcup W^k \to \mathbb{Q} is defined for x∈Vkx \in V^k and w∈Wkw \in W^k by ΦG,H(F)(ιV(x))=hom⁡(F,G;x),ΦG,H(F)(ιW(w))=hom⁡(F,H;w).\begin{aligned} \Phi_{G,H}(F)(\iota_V(x)) &= \operatorname{hom}(F, G; x), \\ \Phi_{G,H}(F)(\iota_W(w)) &= \operatorname{hom}(F, H; w). \end{aligned}(3)✦ The test span 𝒜k,t(G,H)\mathcal{A}_{k,t}(G, H) is the ℚ\mathbb{Q}-linear subspace of ℚVk⊔Wk\mathbb{Q}^{V^k \sqcup W^k} spanned by ΦG,H(F)\Phi_{G,H}(F) as FF ranges over all kk-rooted homomorphism tests of bag size at most tt.✦

For a kk-tuple x∈Vkx \in V^k, an index i∈[k]i \in [k], and a vertex v∈Vv \in V, write x[i↦v]∈Vkx[i \mapsto v] \in V^k for the tuple agreeing with xx on every coordinate other than ii and taking value vv at coordinate ii, and use the same notation w[i↦u]∈Wkw[i \mapsto u] \in W^k for w∈Wkw \in W^k and u∈Wu \in W. Given i∈[k]i \in [k] and a function f:Vk⊔Wk→ℚf : V^k \sqcup W^k \to \mathbb{Q}, the coordinate replacement sum Si(f):Vk⊔Wk→ℚS_i(f) : V^k \sqcup W^k \to \mathbb{Q} is defined for x∈Vkx \in V^k and w∈Wkw \in W^k by Si(f)(ιV(x))=∑v∈Vf(ιV(x[i↦v])),Si(f)(ιW(w))=∑u∈Wf(ιW(w[i↦u])).\begin{aligned} S_i(f)(\iota_V(x)) &= \sum_{v \in V} f(\iota_V(x[i \mapsto v])), \\ S_i(f)(\iota_W(w)) &= \sum_{u \in W} f(\iota_W(w[i \mapsto u])). \end{aligned}(4)✦ Given a family f=(fi)i∈[k]f = (f_i)_{i \in [k]} of functions fi:Vk⊔Wk→ℚf_i : V^k \sqcup W^k \to \mathbb{Q}, the joint replacement sum J(f):Vk⊔Wk→ℚJ(f) : V^k \sqcup W^k \to \mathbb{Q} is defined for x∈Vkx \in V^k and w∈Wkw \in W^k by J(f)(ιV(x))=∑v∈V∏i∈[k]fi(ιV(x[i↦v])),J(f)(ιW(w))=∑u∈W∏i∈[k]fi(ιW(w[i↦u])).\begin{aligned} J(f)(\iota_V(x)) &= \sum_{v \in V} \prod_{i \in [k]} f_i(\iota_V(x[i \mapsto v])), \\ J(f)(\iota_W(w)) &= \sum_{u \in W} \prod_{i \in [k]} f_i(\iota_W(w[i \mapsto u])). \end{aligned}(5)✦

The claim

Definition 2.1. Let k,t∈ℕk, t \in \mathbb{N}, let GG be a finite simple graph on a vertex set VV, and let HH be a finite simple graph on a vertex set WW.

For every kk-rooted homomorphism test FF of bag size at most tt, the rooted homomorphism counts of FF in GG sum over VkV^k to the total homomorphism count: ∑x∈Vkhom⁡(F,G;x)=hom⁡(F,G).\sum_{x \in V^k} \operatorname{hom}(F, G; x) = \operatorname{hom}(F, G).(6)✦

If k≤tk \le t, then for all i,j∈[k]i, j \in [k] and every x∈Vkx \in V^k, the edge indicator test Ei,jE_{i,j} evaluates to the adjacency indicator of xix_i and xjx_j in GG: hom⁡(Ei,j,G;x)={1if xi and xj are adjacent in G,0otherwise.\operatorname{hom}(E_{i,j}, G; x) = \begin{cases} 1 & \text{if } x_i \text{ and } x_j \text{ are adjacent in } G, \\ 0 & \text{otherwise.} \end{cases}(7)✦

If k≤tk \le t, then for every i∈[k]i \in [k] and every f∈𝒜k,t(G,H)f \in \mathcal{A}_{k,t}(G, H), the test span is closed under the coordinate replacement sum: Si(f)∈𝒜k,t(G,H).S_i(f) \in \mathcal{A}_{k,t}(G, H).(8)✦

If k+1≤tk + 1 \le t, then for every family f=(fi)i∈[k]f = (f_i)_{i \in [k]} with fi∈𝒜k,t(G,H)f_i \in \mathcal{A}_{k,t}(G, H) for all i∈[k]i \in [k], the test span is closed under the joint replacement sum: J(f)∈𝒜k,t(G,H).J(f) \in \mathcal{A}_{k,t}(G, H).(9)✦

What is checked

In the Lean library, Definition 2.1 is stated over arbitrary natural numbers kk and tt, finite simple graphs GG on VV and HH on WW, kk-rooted homomorphism tests of bag size at most tt built from ranked tree decompositions, and the rational test span 𝒜k,t(G,H)\mathcal{A}_{k,t}(G, H) on Vk⊔WkV^k \sqcup W^k, covering the total-count identity (6), the edge-indicator evaluation (7) and coordinate replacement sum closure (8) for k≤tk \le t, and joint replacement sum closure (9) for k+1≤tk + 1 \le t.