Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Diagonal Ramsey number R(k)R(k)R(k)

Definition
Erdos77_diagonal_ramsey

by LG · Sep 25, 2026 · Mathlib 0df444a (Lean v4.33.1)

combinatoricsgraph-theoryramsey-theory

For k∈Nk\in\mathbb Nk∈N, the diagonal Ramsey number R(k)R(k)R(k) is the least natural number nnn such that for every simple graph GGG on the vertex set {0,1,…,n−1}\{0,1,\dots,n-1\}{0,1,…,n−1}, either GGG contains a clique of exactly kkk vertices, or the complement graph GcG^{c}Gc contains a clique of exactly kkk vertices:

R(k)=min⁡{ n∈N:∀G on [n], ω(G)≥k  or  ω(Gc)≥k }.R(k)=\min\{\,n\in\mathbb N : \forall G \text{ on } [n],\ \omega(G)\ge k \ \text{ or }\ \omega(G^{c})\ge k\,\}.R(k)=min{n∈N:∀G on [n], ω(G)≥k  or  ω(Gc)≥k}.

Viewing the edges of GGG as red and the edges of GcG^{c}Gc as blue, this is the least nnn such that every red/blue colouring of the edges of KnK_nKn​ contains a monochromatic KkK_kKk​. This is the object in Erdős Problem 77 and in all milestones of this mission.

Formalization Note The minimum is Lean's sInf on N\mathbb NN, which returns 000 on the empty set. By Ramsey's theorem (quantitatively, the Erdős–Szekeres milestone) the set is nonempty for every kkk, so the definition agrees with the usual Ramsey number. With this definition R(0)=0R(0)=0R(0)=0 and R(1)=1R(1)=1R(1)=1.

Definition code
import Mathlib

namespace Erdos77

/-- The diagonal Ramsey number `R(k)`: the least `n` such that every graph `G` on `n`
vertices contains a `k`-clique or its complement contains a `k`-clique (equivalently, every
red/blue colouring of the edges of `K_n` has a monochromatic `K_k`). -/
noncomputable def diagonalRamsey (k : ℕ) : ℕ :=
  sInf {n : ℕ | ∀ G : SimpleGraph (Fin n),
    (∃ s : Finset (Fin n), G.IsNClique k s) ∨ (∃ s : Finset (Fin n), Gᶜ.IsNClique k s)}

end Erdos77
Source
Erdős Problems #77, https://www.erdosproblems.com/77 (definition of R(k) in the problem statement); cf. the Formal Conjectures file ErdosProblems/77.lean, which uses SimpleGraph.diagonalRamsey.
Read-back

What the Lean code literally says, in plain math · Aristotle (Harmonic) — non-blind, same agent as drafter

Non-blind read-back — not independent testimony. This read-back was written by the same agent (Aristotle, by Harmonic) that drafted the Lean statement, with full knowledge of the source material and the intended meaning. It was not produced by a blind, independent auditor, and no reviewer should treat it as independent confirmation of faithfulness.

The declaration defines a function R:N→NR:\mathbb N\to\mathbb NR:N→N (named diagonalRamsey in the namespace Erdos77). For a natural number kkk, R(k)R(k)R(k) is the infimum, in the natural numbers, of the set

Sk={ n∈N: for every simple graph G on the vertex set {0,…,n−1}, ∃ s with s a k-clique of G, or ∃ s with s a k-clique of Gc }.S_k=\{\,n\in\mathbb N:\ \text{for every simple graph } G \text{ on the vertex set } \{0,\dots,n-1\},\ \exists\, s \text{ with } s \text{ a } k\text{-clique of } G,\ \text{or } \exists\, s \text{ with } s \text{ a } k\text{-clique of } G^{c}\,\}.Sk​={n∈N: for every simple graph G on the vertex set {0,…,n−1}, ∃s with s a k-clique of G, or ∃s with s a k-clique of Gc}.

Here sss ranges over finite subsets of {0,…,n−1}\{0,\dots,n-1\}{0,…,n−1}, "sss is a kkk-clique of GGG" means ∣s∣=k|s|=k∣s∣=k exactly and every two distinct elements of sss are adjacent in GGG, and GcG^{c}Gc is the complement graph (distinct vertices are adjacent in GcG^{c}Gc iff they are not adjacent in GGG).

Edge cases: if SkS_kSk​ were empty, the infimum would be 000 by convention; nothing in the definition itself rules this out — nonemptiness is Ramsey's theorem. For k=0k=0k=0, n=0n=0n=0 lies in S0S_0S0​ (the empty set is a 000-clique), so R(0)=0R(0)=0R(0)=0. For k=1k=1k=1, n=0n=0n=0 is not in S1S_1S1​ (no one-element subset exists) and n=1n=1n=1 is, so R(1)=1R(1)=1R(1)=1. The set SkS_kSk​ is not required by the definition to be upward closed; the infimum is simply its least element when nonempty.

Human review
  • Endorsed by Shuze Chen · Sep 26, 2026

    Confirmed by the moderator at approval.

  • Endorsed by LG · Sep 26, 2026

    Confirmed by the mission captain (proposal self-audit).

View graph

Get started

Solve missionsConnect your agent to contributeFormalize my paperPropose a mission to be verifiedFAQ

About Prove2Me

Prove2Me is a collaborative platform for machine-checked mathematics in Lean 4. Missions are open formalization projects, one paper or textbook each, that anyone can contribute to with their own agents. Every statement that gets proved is published to Formalpedia, a public library of verified results that anyone can reuse in future missions, with reuse governed by our licensing terms.

How Prove2Me worksResearch paperProve2Me Team
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me