The setting
In finite model theory and graph isomorphism, the -dimensional Weisfeiler-Leman (-WL) algorithm refines colorings of -tuples of vertices by iteratively recording how each coordinate can be replaced by a new vertex. When , this refinement is strong enough to detect vertex degrees and the distribution of degrees among a vertex’s neighbors. Encoding vertex colors as prescribed numbers of pendant leaves attached to each vertex turns degree preservation into a mechanism for recovering those colors across graphs whose tuples remain indistinguishable under -WL refinement.
Weisfeiler-Leman refinement
A finite simple graph consists of a natural number , called its order, giving the vertex set , together with a symmetric, irreflexive adjacency relation on .✦ For a vertex and a natural number , the vertex degree and the degree- neighbor count are defined by (1) The counts in (1) record both the size of the neighborhood of and how many of its neighbors have each prescribed degree.
For one-dimensional refinement, the 1-WL color space at a natural number round is defined recursively: is a singleton, and is the product of with the space of finite multisets of elements of .✦ The 1-WL vertex coloring assigns the unique initial color to every vertex at round , and updates by (2) The 1-WL color histogram of at round is the multiset induced by (2).✦
For a natural number dimension , the -WL color space at round is defined recursively: is the product of two copies of the space of Boolean matrices, and is the product of with the space of finite multisets of -tuples of elements of .✦ For a -tuple and , let denote the -tuple obtained by replacing the th entry of with . The -WL tuple coloring records at round the Boolean matrices of equalities and adjacencies , and updates at round by (3) The -WL color histogram of at round is the multiset obtained from (3).✦
Two finite simple graphs and are -WL equivalent, written , if for every round their 1-WL color histograms agree when , and their -WL color histograms agree when .✦ A pair of -tuples and is a stable -WL tuple pair if for every round .
Leaf-encoded vertex colors
For a finite simple graph on an arbitrary finite vertex set , its indexed graph representation is the finite simple graph on obtained by transporting the adjacency relation of along a fixed enumeration of .✦ Given finite simple graphs on and on and a natural number , a pair of -tuples and is a simple-graph stable -tuple if their images under the fixed enumerations of and form a stable -WL tuple pair in the indexed graph representations of and .✦
Given a finite vertex set and a leaf-count function , the leaf-augmented vertex set is the disjoint union of with distinct indexed pendant leaves attached to each base vertex .✦ For a finite simple graph on , the graph with pendant leaves is the finite simple graph on in which two base vertices in are adjacent if and only if they are adjacent in , each pendant leaf is adjacent only to its own base vertex, and no two pendant leaves are adjacent.✦
For a finite vertex set and a natural-number vertex coloring , the leaf-tag size of a vertex is Given finite simple graphs on and on with natural-number vertex colorings and , and a natural number , a pair of -tuples and is a tag-stable -tuple if the inclusions of and as base vertices form a simple-graph stable -tuple in the graphs with pendant leaves and defined via (4).✦
The claim
Lemma 2.3. Let and be finite simple graphs and let and be integers such that . For every -tuple , there exists an -tuple such that for all and every natural number , (5)✦
Furthermore, let and be finite simple graphs on finite vertex sets and with , let and be vertex colorings, and let be an integer. If is a tag-stable -tuple, then for every , (6)✦
In the paper, the result reads: in every history following a winning strategy with at least two pair slots, matched vertices have equal degrees, and every vertex bijection announced by that strategy therefore preserves degrees for all its possible choices.
The Lean library formulates this preservation directly in terms of -WL refinement, recording the matching of degrees and degree-stratified neighbor counts for -tuples in (5) and the resulting recovery of leaf-encoded vertex colors on tag-stable -tuples in (6).
What is checked
In the Lean library, Lemma 2.3 consists of the local neighborhood match (5), stated over -WL equivalent finite simple graphs and with and in terms of vertex degrees and degree- neighbor counts, and the color-matching identity (6), stated over equal-order finite simple graphs with natural-number vertex colorings and tag-stable -tuples built from pendant leaves of leaf-tag size.