Proofs: k-dimensional Weisfeiler-Leman algorithm
These are the human proofs of k-dimensional Weisfeiler-Leman algorithm, at full length.
k-WL terminates, and a difference in its colors proves non-isomorphism full
This proof shows: correctness, termination.
Setting. is a simple undirected graph on with a vertex coloring, and . For a -tuple and , is with entry replaced by . The colorings of are: is the atomic type of , and is the rank, in the sorted list of all signatures, of
When two graphs are compared, the ranks are taken in the sorted list of the signatures of both graphs together.
Lemma 1 (refinement). For every , implies .
Proof. Equal ranks mean equal signatures, and the signature starts with .
Lemma 2 (stability). If has as many classes as , then and induce the same partition of , and so do all later colorings.
Proof. By Lemma 1 every class of lies inside a class of . With the same number of classes, each class of is exactly one class of , so the partitions are equal. Then iff , because is with every color renamed by the same bijection; hence induces the same partition again, and by induction all later ones.
Lemma 3 (termination). The loop L2 to L5 ends after at most rounds.
Proof. By Lemmas 1 and 2, every round that does not stop strictly increases the number of classes, which is at most .
Lemma 4 (invariance). Let be an isomorphism of colored graphs, and run the joint refinement. Then for all and all , where applies entrywise.
Proof. By induction on . For , an isomorphism keeps colors, equalities and edges, so atomic types agree. For the step, , and is a bijection of onto , so the multisets in and are equal by the induction hypothesis, as are the first entries. The two signatures are equal, so they get the same rank in the shared sorted list.
Theorem. kwl_colors terminates and returns a stable coloring that refines the atomic types. kwl_distinguishes terminates, and if it returns true, the graphs are not isomorphic.
Proof. Termination of both functions is Lemma 3, applied to the joint coloring of the disjoint pair of tuple sets: the joint number of classes is at most and grows strictly in every round that does not stop. On stopping, Lemma 2 says the coloring is stable. If by , Lemma 4 shows that is a bijection of onto that keeps colors in every round, so the color histograms are equal in every round and the function never returns true. Also, once the joint partition is stable, the histograms do not change any more up to the same renaming of colors, so comparing them at the stopping round is enough.