FormalConjecturesForMathlib/Combinatorics/Ramsey/Diagonal.lean

GitHub source file

Explanation legend Lean4 Domain Explanation Language (L4DEL)

L4DEL explanations are a separate layer. They do not change the Lean source. Intuition is explanatory prose; numbered items are a reading path; sources link the wording back to evidence.

L4DEL
Lean4 Domain Explanation Language

Credit: The upstream authors and contributors retain credit for the project and mathematics. lean4-explainer only renders their pinned source and adds the separately disclosed explanation layer.

Project sources: Pinned project documentation, Formal Conjectures paper, arXiv v1

12 declarations, 0 contain sorry, 0 declared as axioms

Erdős–Szekeres 1935 upper bound for the diagonal Ramsey number

Statement (Erdős–Szekeres 1935): For every k : ℕ, the diagonal Ramsey number satisfies Combinatorics.hypergraphRamsey 2 k ≤ 4 ^ k.

Proof sketch. Use the symmetric recursion R(s, t) ≤ R(s-1, t) + R(s, t-1) with base cases R(0, t) = R(s, 0) = 1. Induction on s + t then gives R(s, t) ≤ C(s+t, s); for s = t = k this is R(k, k) ≤ C(2k, k) ≤ 4 ^ k (the Catalan-like central binomial coefficient bound).

The whole argument is phrased directly on the Mathlib-style coloring data c : Finset (Fin m) → Bool of 2-element subsets — no auxiliary "edge colouring" structure is introduced.

Reference: [ES35] Erdős, P. and Szekeres, G. (1935). "A combinatorial problem in geometry." Compositio Math. 2, pp. 463–470.

Imports (2)
Imported by 1 file
  1. def Combinatorics.Diagonal.HasRamseyProperty Documented declaration: HasRamseyProperty line 61 source

    Source documentation

    HasRamseyProperty N s t asserts: for every m, every coloring c : Finset (Fin m) → Bool, and every V : Finset (Fin m) with V.card ≥ N, the subset V contains either a subset of size s whose 2-element subsets are all false-coloured, or a subset of size t whose 2-element subsets are all true-coloured.

    This is the "off-diagonal Ramsey number does not exceed N" form of the classical Erdős–Szekeres Ramsey recurrence, packaged in the same shape used by Combinatorics.hypergraphRamsey.

    standard axioms: Classical.choice, Quot.sound, propext what this means

    Statement uses: Nat

    Proof uses: Finset, Fin, Bool, LE.le, Finset.card, Or, Exists, And, Eq, OfNat.ofNat, Bool.false, Bool.true

    5 instances, coercions and auxiliary constants left out.

    def HasRamseyProperty (N s t : ℕ) : Prop :=
    …
  2. lemma Combinatorics.Diagonal.HasRamseyProperty.mono Monotonicity line 67 source

    Source documentation

    Monotonicity. If N ≤ N' then HasRamseyProperty N s t → HasRamseyProperty N' s t.

    standard axioms: Classical.choice, Quot.sound, propext what this means

    Statement uses: Nat, LE.le, Combinatorics.Diagonal.HasRamseyProperty

    Proof uses: Finset, Fin, Bool, Finset.card, LE.le.trans

    3 instances, coercions and auxiliary constants left out.

    Tactic trace: 2 steps

    Open to load the checked before-and-after goal states.

    lemma HasRamseyProperty.mono {N N' s t : ℕ} (hNN' : N ≤ N') (h : HasRamseyProperty N s t) :
        HasRamseyProperty N' s t := by
    …

    Mentions: Combinatorics.Diagonal.HasRamseyProperty

  3. lemma Combinatorics.Diagonal.hasRamseyProperty_zero_left Base case s = 0 line 73 source

    Source documentation

    Base case s = 0. Any V contains an empty false-monochromatic set.

    standard axioms: Classical.choice, Quot.sound, propext what this means

    Statement uses: Nat, Combinatorics.Diagonal.HasRamseyProperty, OfNat.ofNat

    Proof uses: Finset, Fin, Bool, LE.le, Finset.card, Or.inl, Exists, And, Eq, Bool.false, Bool.true, Exists.intro, EmptyCollection.emptyCollection, And.intro, Finset.empty_subset, of_eq_true, eq_self, Iff.mp, Finset.subset_empty, False.elim and 5 more

    12 instances, coercions and auxiliary constants left out.

    Tactic trace: 6 steps

    Open to load the checked before-and-after goal states.

    lemma hasRamseyProperty_zero_left (N t : ℕ) : HasRamseyProperty N 0 t := by
    …

    Mentions: Combinatorics.Diagonal.HasRamseyProperty

  4. lemma Combinatorics.Diagonal.hasRamseyProperty_zero_right Base case t = 0 line 82 source

    Source documentation

    Base case t = 0. Any V contains an empty true-monochromatic set.

    standard axioms: Classical.choice, Quot.sound, propext what this means

    Statement uses: Nat, Combinatorics.Diagonal.HasRamseyProperty, OfNat.ofNat

    Proof uses: Finset, Fin, Bool, LE.le, Finset.card, Or.inr, Exists, And, Eq, Bool.false, Bool.true, Exists.intro, EmptyCollection.emptyCollection, And.intro, Finset.empty_subset, of_eq_true, eq_self, Iff.mp, Finset.subset_empty, False.elim and 5 more

    12 instances, coercions and auxiliary constants left out.

    Tactic trace: 6 steps

    Open to load the checked before-and-after goal states.

    lemma hasRamseyProperty_zero_right (N s : ℕ) : HasRamseyProperty N s 0 := by
    …

    Mentions: Combinatorics.Diagonal.HasRamseyProperty

  5. lemma Combinatorics.Diagonal.forall_two_subset_singleton A singleton has no 2-element subsets, hence is monochromatic of any colour line 90 source

    Source documentation

    A singleton has no 2-element subsets, hence is monochromatic of any colour.

    standard axioms: Classical.choice, Quot.sound, propext what this means

    Statement uses: Nat, Fin, Bool, Finset, LE.le, Singleton.singleton, Eq, Finset.card, OfNat.ofNat

    Proof uses: Finset.card_le_card, Eq.mpr, id, Eq.mp, congrArg, Finset.card_singleton, Decidable.byContradiction, Not

    14 instances, coercions and auxiliary constants left out.

    Tactic trace: 5 steps

    Open to load the checked before-and-after goal states.

    lemma forall_two_subset_singleton {m : ℕ} (v : Fin m) (b : Bool)
        (c : Finset (Fin m) → Bool) :
        ∀ e ⊆ ({v} : Finset (Fin m)), e.card = 2 → c e = b := by
    …

    Mentions: c

  6. lemma Combinatorics.Diagonal.hasRamseyProperty_one_left Base case s = 1 line 101 source

    Source documentation

    Base case s = 1. Any nonempty V contains a singleton false-monochromatic set.

    standard axioms: Classical.choice, Quot.sound, propext what this means

    Statement uses: Nat, Combinatorics.Diagonal.HasRamseyProperty, OfNat.ofNat

    Proof uses: Finset, Fin, Bool, LE.le, Finset.card, Membership.mem, Finset.Nonempty, Or, Exists, And, Eq, Bool.false, Bool.true, Iff.mp, LT.lt, Finset.card_pos, Decidable.byContradiction, Not, Or.inl, Exists.intro and 12 more

    14 instances, coercions and auxiliary constants left out.

    Tactic trace: 7 steps

    Open to load the checked before-and-after goal states.

    lemma hasRamseyProperty_one_left (t : ℕ) : HasRamseyProperty 1 1 t := by
    …

    Mentions: Combinatorics.Diagonal.HasRamseyProperty

  7. lemma Combinatorics.Diagonal.hasRamseyProperty_one_right Base case t = 1 line 108 source

    Source documentation

    Base case t = 1. Any nonempty V contains a singleton true-monochromatic set.

    standard axioms: Classical.choice, Quot.sound, propext what this means

    Statement uses: Nat, Combinatorics.Diagonal.HasRamseyProperty, OfNat.ofNat

    Proof uses: Finset, Fin, Bool, LE.le, Finset.card, Membership.mem, Finset.Nonempty, Or, Exists, And, Eq, Bool.false, Bool.true, Iff.mp, LT.lt, Finset.card_pos, Decidable.byContradiction, Not, Or.inr, Exists.intro and 12 more

    14 instances, coercions and auxiliary constants left out.

    Tactic trace: 7 steps

    Open to load the checked before-and-after goal states.

    lemma hasRamseyProperty_one_right (s : ℕ) : HasRamseyProperty 1 s 1 := by
    …

    Mentions: Combinatorics.Diagonal.HasRamseyProperty

  8. lemma Combinatorics.Diagonal.card_false_true_split Pigeonhole step: splitting V \ {v} by colour line 117 source

    Source documentation

    Pigeonhole step: splitting V \ {v} by colour. For any vertex v ∈ V, the set V.erase v partitions into false-neighbours of v and true-neighbours of v, and the cardinalities sum to V.card - 1.

    standard axioms: Classical.choice, Quot.sound, propext what this means

    Statement uses: Nat, Finset, Fin, Bool, Membership.mem, Eq, HAdd.hAdd, Finset.card, Finset.filter, Insert.insert, Singleton.singleton, Bool.false, Finset.erase, Bool.true, HSub.hSub, OfNat.ofNat

    Proof uses: Not, Finset.card_filter_add_card_filter_not, Iff, of_eq_true, Eq.trans, False, True, congr, congrArg, eq_self, not_true_eq_false, Bool.false_eq_true, iff_self, Eq.symm, Bool.true_eq_false, not_false_eq_true, Eq.refl, Eq.rec, Finset.ext, Eq.mpr and 4 more

    27 instances, coercions and auxiliary constants left out.

    Tactic trace: 14 steps

    Open to load the checked before-and-after goal states.

    lemma card_false_true_split {m : ℕ} (c : Finset (Fin m) → Bool) (V : Finset (Fin m))
        {v : Fin m} (hv : v ∈ V) :
        ((V.erase v).filter (fun u => c {v, u} = false)).card
          + ((V.erase v).filter (fun u => c {v, u} = true)).card = V.card - 1 := by
    …

    Mentions: c

  9. lemma Combinatorics.Diagonal.mono_insert Extending a b-monochromatic clique S by a vertex v that is b-adjacent to every element of S line 142 source

    Source documentation

    Extending a b-monochromatic clique S by a vertex v that is b-adjacent to every element of S. Parameterised over the colour b : Bool, this covers both the false and true extension steps used in HasRamseyProperty.step.

    private lemma mono_insert {m : ℕ} {c : Finset (Fin m) → Bool} {b : Bool}
        {S : Finset (Fin m)} (hSmono : ∀ e ⊆ S, e.card = 2 → c e = b)
        {v : Fin m} (hvAdj : ∀ u ∈ S, c {v, u} = b) :
        ∀ e ⊆ insert v S, e.card = 2 → c e = b := by
    …

    Mentions: c

  10. lemma Combinatorics.Diagonal.HasRamseyProperty.step Recurrence line 180 source

    Source documentation

    Recurrence. If HasRamseyProperty Ns s (t+1) and HasRamseyProperty Nt (s+1) t hold, then HasRamseyProperty (Ns + Nt) (s+1) (t+1) holds.

    This is the core Erdős–Szekeres 1935 pigeonhole step: pick any vertex v ∈ V, split V.erase v into false-neighbours R_v and true-neighbours B_v; by pigeonhole |R_v| ≥ Ns or |B_v| ≥ Nt. In the first case, invoke HasRamseyProperty Ns s (t+1) on R_v: either we get a false-mono K_s on R_v (extend by v to a false-mono K_{s+1} on V), or a true-mono K_{t+1} on R_v ⊆ V (done). The second case is symmetric.

    standard axioms: Classical.choice, Quot.sound, propext what this means

    Statement uses: Nat, Combinatorics.Diagonal.HasRamseyProperty, HAdd.hAdd, OfNat.ofNat, LE.le

    Proof uses: Finset, Fin, Bool, Finset.card, LT.lt, Nat.le_trans, Nat.le_add_right, Membership.mem, Finset.Nonempty, Or, Exists, And, Eq, Bool.false, Bool.true, Iff.mp, Finset.card_pos, Finset.filter, Insert.insert, Singleton.singleton and 23 more

    29 instances, coercions and auxiliary constants left out.

    Tactic trace: 57 steps

    Open to load the checked before-and-after goal states.

    lemma HasRamseyProperty.step {Ns Nt s t : ℕ}
        (hs : HasRamseyProperty Ns s (t + 1))
        (ht : HasRamseyProperty Nt (s + 1) t) (hNs : 1 ≤ Ns) :
        HasRamseyProperty (Ns + Nt) (s + 1) (t + 1) := by
    …

    Mentions: Combinatorics.Diagonal.HasRamseyProperty

  11. lemma Combinatorics.Diagonal.hasRamseyProperty_choose Binomial bound via Erdős–Szekeres induction line 237 source

    Source documentation

    Binomial bound via Erdős–Szekeres induction. HasRamseyProperty (Nat.choose (s + t) s) s t for all s, t.

    standard axioms: Classical.choice, Quot.sound, propext what this means

    Statement uses: Nat, Combinatorics.Diagonal.HasRamseyProperty, Nat.choose, HAdd.hAdd

    Proof uses: Eq, Nat.strong_induction_on, LT.lt, OfNat.ofNat, id, Eq.mpr, congrArg, Nat.choose_zero_right, Combinatorics.Diagonal.HasRamseyProperty.mono, Nat.zero_le, Combinatorics.Diagonal.hasRamseyProperty_zero_left, Combinatorics.Diagonal.hasRamseyProperty_zero_right, HSub.hSub, Decidable.byContradiction, Not, LE.le, Nat.choose_pos, Combinatorics.Diagonal.HasRamseyProperty.step, Eq.rec, Eq.refl and 5 more

    18 instances, coercions and auxiliary constants left out.

    Tactic trace: 33 steps

    Open to load the checked before-and-after goal states.

    lemma hasRamseyProperty_choose : ∀ (s t : ℕ),
        HasRamseyProperty (Nat.choose (s + t) s) s t := by
    …

    Mentions: Combinatorics.Diagonal.HasRamseyProperty

  12. lemma Combinatorics._root_.Combinatorics.hypergraphRamsey_two_le_four_pow Erdős–Szekeres 1935 in hypergraphRamsey form: Combinatorics.hypergraphRamsey 2 k ≤ 4 ^ k for all k line 290 source

    Source documentation

    Erdős–Szekeres 1935 in hypergraphRamsey form: Combinatorics.hypergraphRamsey 2 k ≤ 4 ^ k for all k.

    Proof. Diagonal.hasRamseyProperty_choose applied at s = t = k and the full vertex set V = Finset.univ of Fin (C(2k, k)) shows that C(2k, k) is a member of the defining set of hypergraphRamsey 2 k, hence by Nat.sInf_le we get hypergraphRamsey 2 k ≤ C(2k, k); the central binomial bound C(2k, k) ≤ 4 ^ k closes the result.

    lemma _root_.Combinatorics.hypergraphRamsey_two_le_four_pow (k : ℕ) :
        Combinatorics.hypergraphRamsey 2 k ≤ 4 ^ k := by
    …

    Mentions: Combinatorics.hypergraphRamsey