An exact-count form of the Hanf locality lemma is as follows. For every quantifier rank , put . If finite relational structures admit a bijection such that
then and agree on every first-order sentence of quantifier rank at most . Equivalently, they have the same number of occurrences of every marked radius- one-point neighbourhood type. The individual local isomorphisms need not be restrictions of .
A bounded-degree threshold version permits the type counts to be different when both exceed a sufficiently large bound depending on the degree bound and . We need only the exact-count form. Its locality content is that sufficiently large matching neighbourhoods and their multiplicities determine all sentences up to the prescribed quantifier rank.
Suppose a first-order sentence defined the bipartite graphs, equivalently the 2-colourable graphs. Let be its quantifier rank and . Choose an odd integer , and compare
Both have vertices. Every marked radius- neighbourhood in either graph is a path with vertices and its middle vertex marked: the choice of prevents the ball from wrapping around a cycle. Thus every vertex has exactly the same neighbourhood type in both graphs, and that type occurs times in each. Any bijection of their universes meets the Hanf locality lemma hypothesis.
Therefore and agree on . But is an even cycle and is bipartite, whereas contains odd cycles and is not bipartite. This contradiction proves
The equal total size is useful here: no large-count threshold or comparison of unequal multiplicities is needed.