← All papers
First page of Small Ramsey numbers in Lean

Small Ramsey numbers in Lean

Mayank Kejriwal

cs.DM Dec 1, 2026 · v1 math.CO
Lean 4/Mathlib formalization of small Ramsey numbers, including R(3,6)=18, plus a kernel-verified sound clique-search checker for lower-bound witness graphs.
We present a Lean 4 development, built on Mathlib, that proves the small two-colour Ramsey numbers $R(3,3)=6$, $R(3,4)=9$, $R(3,5)=14$, $R(4,4)=18$ and $R(3,3,3)=17$ from the definition, together with $R(3,6)=18$, which to our knowledge had not been formalized before - its upper bound is proved without any computer search, by a variant of Cariolaro's argument. We formalize the Graver-Yackel edge-counting method, which yields 131 non-trivial minimum-edge bounds for triangle-free graphs automatically, show that counting alone cannot prove $R(3,7) \le 23$, and formalize Graver and Yackel's proof of $R(3,7)=23$ except for its two long parts, which enter as explicit hypotheses. For lower bounds, a clique search with a machine-checked soundness proof lets the Lean kernel, using only Lean's three standard axioms, check seven published witness graphs on up to 58 vertices; compiled evaluation checks eleven more, on up to 173 vertices, including recent graphs found by AlphaEvolve. Finally, we record a series of inexpensive experiments aimed at improving published lower bounds, from sweeps of Cayley graphs to random geometric and Hermitian unital graphs. Although none succeeded, we report their scale and limits so that they need not be repeated blindly. All code and data are public.

Much of what is known about small Ramsey numbers rests on unverified computer searches and witness graphs, and few results have been checked in a proof assistant. No formal proof of R(3,6)=18 existed.

The authors build a Lean 4 library on Mathlib that defines Ramsey numbers via cliques in simple graphs on Fin n and proves the recurrence and exact values from the definition. The R(3,6)≤18 upper bound uses a variant of Cariolaro's argument with no computer search. The library formalizes the Graver–Yackel edge-counting method and Graver and Yackel's proof of R(3,7)=23, with its two long parts entering as explicit hypotheses. For lower bounds, a bitmask clique search is proved sound in Lean and used to check published witness graphs either in the kernel or by compiled evaluation.

The exact values R(3,3), R(3,4), R(3,5), R(4,4), R(3,3,3) and R(3,6) are proved using only Lean's three standard axioms, along with 131 minimum-edge bounds. The kernel checks seven witness graphs on up to 58 vertices, and compiled evaluation checks eleven more on up to 173 vertices, including AlphaEvolve graphs. Experiments aimed at improving lower bounds all failed and are reported for reference.

BoundSourceModeTime (s)
R(5,5) ≥ 43Exookernel233
R(3,11) ≥ 47Exookernel1665
R(3,12) ≥ 53AlphaEvolvekernel8558
R(3,18) ≥ 100AlphaEvolvecompiled13071
Selected lower-bound witness checks