Use the equitable form of the Szemerédi regularity lemma. For and a prescribed lower bound , there are such that every sufficiently large graph admits a set partition
with at most unordered irregular pairs among the nonexceptional cells. A uniform pair here means a regular pair of vertex sets. Larger values of follow from a smaller parameter, so the stated restriction loses nothing.
For the proof, retain the exceptional vertices as singleton cells in an auxiliary set partition . Define its regularity energy by the ordered sum
For diagonal rectangles the adjacency matrix of a graph defines ; diagonal terms are included. Thus . If is split into rectangles of densities and sizes , their weighted mean is . Expanding squares proves the refinement variance identity for regularity energy:
Every refinement therefore increases or preserves energy.
Suppose equal cells of size are -irregular. Choose witnesses , of sizes at least , whose density differs from by more than . Refine the cells so that these witnesses are unions of refined atoms. Applying the Cauchy-Schwarz inequality inside gives an increase, for this oriented rectangle, greater than
Choose witnesses simultaneously for every irregular pair. Each original cell is cut by at most witness sets and has at most atoms. If more than unordered pairs are irregular, both orientations contribute, giving
as long as the exceptional set has at most vertices.
To restore equal sizes without sacrificing this increase, use equalization with a controlled exceptional set. Cut every witness atom into blocks of size , leaving fewer than unused vertices in each atom. Make each unused vertex a singleton exceptional cell. This is a further refinement, so there is no energy loss. The number newly exceptional is at most
When , the new nonexceptional cell count is at most : indeed and . It is at least , since each old cell supplies at least blocks.
Let . Choose the initial count so large that , and begin with equal cells and fewer than leftover vertices. Take large enough that these initial leftovers are at most . Iterate the bound for rounds to obtain a finite number . Increase further to ensure . Then every cell size encountered satisfies , so every equalization is legitimate. The total exception budget is at most , because the initial losses use half the budget and all later losses sum to at most . Energy cannot increase by more than one, so failing rounds are impossible. The process must stop with at most irregular pairs. This proves the Szemerédi regularity lemma, including the bounded cell count, equitability and exceptional-set control.
For the dense-pair application, apply this proof with and . Suppose every -regular pair of nonexceptional cells has density at most . Edges touching number at most . Edges inside nonexceptional cells number at most . The at most irregular cell pairs contribute at most . Finally the regular cross-cell pairs contribute at most . Therefore
a contradiction. Some regular pair consequently has density greater than . It is also a -uniform pair, since subsets of relative size at least qualify in the stronger -regularity condition. The common cell size satisfies . Thus the dense regular pair from edge surplus gives
This first proves the assertion for . For the finitely many smaller possible orders, choose the endpoints of any edge as singleton sets: the pair has density one and is regular for every positive parameter. Taking includes these cases as well.