{
  "id": "2625",
  "ident": "NS.02625",
  "slug": "erdos-618",
  "title": "Erdős Problem 618",
  "status": "solved",
  "statement_status": "reviewed",
  "statement_md": "For a triangle-free graph $G$ let $h_2(G)$ be the smallest number of edges that need to be\nadded to $G$ so that it has diameter $2$ and is still triangle-free. Is it true that if $G$\nhas maximum degree $o(n^{1/2})$ then $h(G)=o(n^2)$?\n\nA problem of Erdős, Gyárfás, and Ruszinkó [EGR98]. Simonovits showed that there exist graphs\n$G$ with maximum degree $\\gg n^{1/2}$ and $h_2(G)\\gg n^2$. Alon has observed this problem is\nessentially identical to [134], and his solution in\n[this note](https://web.math.princeton.edu/~nalon/PDFS/remark1901.pdf) also solves this\nproblem in the affirmative.",
  "subjects": [
    "math.CO",
    "msc:05"
  ],
  "tags": [
    "question",
    "formal_proof"
  ],
  "collection": "erdos",
  "source_url": null,
  "solved_on_platform": false,
  "needs_answer": false,
  "version": 1,
  "decl_name": "Erdos618.erdos_618",
  "statement_lean": "theorem erdos_618 :\n    ∀ (G : ∀ n : ℕ, SimpleGraph (Fin n)),\n      (∀ n, (G n).CliqueFree 3) →\n      (fun n => ((G n).maxDegree : ℝ)) =o[atTop] (fun n => (n : ℝ) ^ ((1 : ℝ) / 2)) →\n      (fun n => (h2 (G n) : ℝ)) =o[atTop] (fun n => (n : ℝ) ^ 2)",
  "challenge_source": "/-\nCopyright 2026 The Formal Conjectures Authors.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n    https://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n-/\nmodule\n\npublic import FormalConjecturesUtil\n\n/-!\n# Erdős Problem 618\n\n*References:*\n- [erdosproblems.com/618](https://www.erdosproblems.com/618)\n- [Er99] Erdős, Paul, *A selection of problems and results in combinatorics*. Combin. Probab.\n  Comput. (1999), 1-6.\n- [EGR98] Erdős, Paul and Gyárfás, András and Ruszinkó, Miklós, *How to decrease the diameter\n  of triangle-free graphs*. Combinatorica (1998), 493-501.\n-/\n\n@[expose] public section\n\nnamespace Erdos618\n\nopen Filter Asymptotics\n\nopen scoped Classical in\n/-- For a graph `G` on `Fin n`, `h2 G` is the smallest number of edges that need to be added\nto `G` so that the resulting supergraph has diameter at most `2` (every two distinct vertices\nare adjacent or have a common neighbour) and is still triangle-free (`CliqueFree 3`).\nBy the `sInf` convention on `ℕ`, `h2 G = 0` if no such supergraph exists. -/\nnoncomputable def h2 {n : ℕ} (G : SimpleGraph (Fin n)) : ℕ :=\n  sInf {k : ℕ | ∃ H : SimpleGraph (Fin n),\n    G ≤ H ∧\n    H.CliqueFree 3 ∧\n    (∀ x y : Fin n, x ≠ y → H.Adj x y ∨ ∃ z, H.Adj x z ∧ H.Adj z y) ∧\n    (H.edgeFinset \\ G.edgeFinset).card = k}\n\nopen scoped Classical in\nset_option linter.style.formal_proof_palomar false in\n/--\nFor a triangle-free graph $G$ let $h_2(G)$ be the smallest number of edges that need to be\nadded to $G$ so that it has diameter $2$ and is still triangle-free. Is it true that if $G$\nhas maximum degree $o(n^{1/2})$ then $h(G)=o(n^2)$?\n\nA problem of Erdős, Gyárfás, and Ruszinkó [EGR98]. Simonovits showed that there exist graphs\n$G$ with maximum degree $\\gg n^{1/2}$ and $h_2(G)\\gg n^2$. Alon has observed this problem is\nessentially identical to [134], and his solution in\n[this note](https://web.math.princeton.edu/~nalon/PDFS/remark1901.pdf) also solves this\nproblem in the affirmative.\n-/\n@[category research solved, question, AMS 5, formal_proof using lean4 at \"https://github.com/plby/lean-proofs/blob/1d7b3f00780b85ed0462e79a1cd5650ee9055655/src/v4.29.1/ErdosProblems/Erdos618.lean\"]\ntheorem erdos_618 :\n    ∀ (G : ∀ n : ℕ, SimpleGraph (Fin n)),\n      (∀ n, (G n).CliqueFree 3) →\n      (fun n => ((G n).maxDegree : ℝ)) =o[atTop] (fun n => (n : ℝ) ^ ((1 : ℝ) / 2)) →\n      (fun n => (h2 (G n) : ℝ)) =o[atTop] (fun n => (n : ℝ) ^ 2) := by\n  sorry\n\nend Erdos618\n",
  "statement_hash": "51c7fb55d8ad89788345dff4ee7e047ce6d33b6b23c8b83825a325746b7d8542",
  "toolchain": "leanprover/lean4:v4.33.1",
  "upstream_commit": "f9b3868d5ca994a7bf95039bcec05338c0c21e2f",
  "workspace": "formal-conjectures",
  "field": "math",
  "formalization": "formal",
  "verification": "lean-kernel",
  "license": "Apache-2.0",
  "attribution": "google-deepmind/formal-conjectures contributors",
  "metric_name": null,
  "metric_direction": null,
  "critiques": [],
  "public_partial_proofs": [],
  "research_threads": [],
  "instructions": "Read research_threads first: other people's public repositories and what they already tried. Write Solution.lean starting from challenge_source. Keep every definition identical, prove decl_name with exactly the same type, no sorry in its dependency closure, no new axioms, no native_decide, no metaprogramming. Submit with POST /api/v1/submissions."
}