{
  "id": "3286",
  "ident": "NS.03286",
  "slug": "erdos-816",
  "title": "Erdős Problem 816",
  "status": "solved",
  "statement_status": "reviewed",
  "statement_md": "Let $G$ be a graph with $2n+1$ vertices and $n^2+n+1$ edges. Must $G$ contain two vertices of the\nsame degree which are joined by a path of length $3$?\n\nA problem of Erdős and Hajnal. The example of $K_{n,n+1}$ shows that this fails if we only have\n$n^2+n$ edges.\n\nThis is true, and was proved by Chen and Ma [ChMa25], who prove the stronger statement that,\nprovided $n\\geq 600$, all graphs with $2n+1$ vertices and at least $n^2+n$ edges contain two\nvertices of the same degree joined by a path of length $3$, except $K_{n,n+1}$.\n\nFor $n = 1$ the graph is a triangle, which contains no path of length $3$, so we assume $n \\geq 2$.",
  "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": "Erdos816.erdos_816",
  "statement_lean": "theorem erdos_816 : ∀ n : ℕ, 2 ≤ n → ∀ G : SimpleGraph (Fin (2 * n + 1)),\n    G.edgeFinset.card = n ^ 2 + n + 1 → HasEqualDegreePathThree G",
  "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 816\n\n*References:*\n- [erdosproblems.com/816](https://www.erdosproblems.com/816)\n- [Er91] Erdős, P., *Problems and results in combinatorial analysis and combinatorial number\n  theory*. Graph theory, combinatorics, and applications, Vol. 1 (Kalamazoo, MI, 1988) (1991),\n  397-406.\n- [ChMa25] K. Chen and J. Ma, *A problem of Erdős and Hajnal on paths with equal-degree\n  endpoints*. arXiv:2503.19569 (2025).\n-/\n\n@[expose] public section\n\nopen SimpleGraph\n\nnamespace Erdos816\n\nopen scoped Classical in\n/--\n`G` contains two vertices of the same degree which are joined by a path of length `3`.\n-/\ndef HasEqualDegreePathThree {V : Type*} [Fintype V] (G : SimpleGraph V) : Prop :=\n  ∃ u v : V, u ≠ v ∧ G.degree u = G.degree v ∧ ∃ p : G.Walk u v, p.IsPath ∧ p.length = 3\n\nopen scoped Classical in\nset_option linter.style.formal_proof_palomar false in\n/--\nLet $G$ be a graph with $2n+1$ vertices and $n^2+n+1$ edges. Must $G$ contain two vertices of the\nsame degree which are joined by a path of length $3$?\n\nA problem of Erdős and Hajnal. The example of $K_{n,n+1}$ shows that this fails if we only have\n$n^2+n$ edges.\n\nThis is true, and was proved by Chen and Ma [ChMa25], who prove the stronger statement that,\nprovided $n\\geq 600$, all graphs with $2n+1$ vertices and at least $n^2+n$ edges contain two\nvertices of the same degree joined by a path of length $3$, except $K_{n,n+1}$.\n\nFor $n = 1$ the graph is a triangle, which contains no path of length $3$, so we assume $n \\geq 2$.\n-/\n@[category research solved, question, AMS 5, formal_proof using lean4 at\n  \"https://github.com/plby/lean-proofs/blob/8822f7ddef30fadbd92e1c6ab4ed897af356af5e/src/latest/ErdosProblems/Erdos816.lean#L939\"]\ntheorem erdos_816 : ∀ n : ℕ, 2 ≤ n → ∀ G : SimpleGraph (Fin (2 * n + 1)),\n    G.edgeFinset.card = n ^ 2 + n + 1 → HasEqualDegreePathThree G := by\n  sorry\n\nopen scoped Classical in\n/--\nChen and Ma [ChMa25] proved that, provided $n\\geq 600$, all graphs with $2n+1$ vertices and at\nleast $n^2+n$ edges contain two vertices of the same degree joined by a path of length $3$, except\n$K_{n,n+1}$.\n-/\n@[category research solved, AMS 5]\ntheorem erdos_816.variants.chen_ma : ∀ n : ℕ, 600 ≤ n →\n    ∀ G : SimpleGraph (Fin (2 * n + 1)), n ^ 2 + n ≤ G.edgeFinset.card →\n      ¬ Nonempty (G ≃g completeBipartiteGraph (Fin n) (Fin (n + 1))) →\n        HasEqualDegreePathThree G := by\n  sorry\n\nopen scoped Classical in\n/-- The example of $K_{n,n+1}$ shows that this fails if we only have $n^2+n$ edges. -/\n@[category research solved, AMS 5]\ntheorem erdos_816.variants.complete_bipartite : ∀ n : ℕ,\n    (completeBipartiteGraph (Fin n) (Fin (n + 1))).edgeFinset.card = n ^ 2 + n ∧\n      ¬ HasEqualDegreePathThree (completeBipartiteGraph (Fin n) (Fin (n + 1))) := by\n  sorry\n\nend Erdos816\n",
  "statement_hash": "bb01638986790f13a35de24d6b865e89812085987a7efe37bb5ab1c44f2c9f50",
  "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."
}