{
  "id": "841",
  "ident": "NS.00841",
  "slug": "erdos-1166",
  "title": "Erdős Problem 1166",
  "status": "solved",
  "statement_status": "reviewed",
  "statement_md": "Given a random walk $s_0,s_1,\\ldots$ in $\\mathbb{Z}^2$, starting at the origin, let $f_k(x)$ count\nthe number of $0\\leq l\\leq k$ such that $s_l=x$.\n\nLet\n$$F(k)=\\{ x: f_k(x) = \\max_y f_k(y)\\}$$\nbe the set of 'favourite values'. Is it true that\n$$\\left\\lvert \\bigcup_{k\\leq n}F(k)\\right\\rvert \\leq (\\log n)^{O(1)}$$\nalmost surely, for all but finitely many $n$?\n\nA problem of Erdős and Révész [Va99, 6.78]. The answer is yes. Almost surely there are at most\nthree favourite sites at all large times [HLOZ24, Theorem 1.1], see\n`Erdos1165.erdos_1165.variants.hao_li_okada_zheng`, and the maximal local time is\n$O((\\log n)^2)$ [ErTa60, p. 162], see `erdos_1166.variants.erdos_taylor`. A favourite\nsite stays a favourite site for as long as the maximal local time does not change. So for each\nvalue of the maximal local time, the sites that are favourite at some time while it has that value\nare all favourite at the last such time, and there are at most three of them, up to finitely many\nexceptions. This gives the bound $O((\\log n)^2)$ stated on the problem page.\n\nWe take the simple random walk (`IsSimpleRandomWalkSteps`). We read $O(1)$ as a single exponent\n`C` that works for almost every walk. The cardinality is `Set.encard`, so an infinite union would\nnot satisfy the bound.",
  "subjects": [
    "math.PR",
    "msc:60"
  ],
  "tags": [
    "question"
  ],
  "collection": "erdos",
  "source_url": null,
  "solved_on_platform": false,
  "needs_answer": false,
  "version": 1,
  "decl_name": "Erdos1166.erdos_1166",
  "statement_lean": "theorem erdos_1166 {Ω : Type*} [MeasureSpace Ω] [IsProbabilityMeasure (ℙ : Measure Ω)]\n    {X : ℕ → Ω → ℤ × ℤ} (hX : IsSimpleRandomWalkSteps X) :\n    ∃ C : ℕ, ∀ᵐ ω, ∀ᶠ n : ℕ in atTop,\n      ((⋃ k ≤ n, favouriteSites X k ω).encard : ℝ≥0∞) ≤ ENNReal.ofReal (Real.log n ^ C)",
  "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\npublic import FormalConjectures.ErdosProblems.«1165»\n\n/-!\n# Erdős Problem 1166\n\n*References:*\n- [erdosproblems.com/1166](https://www.erdosproblems.com/1166)\n- [Va99] Various, *Some of Paul's favorite problems*. Booklet produced for the conference\n  \"Paul Erdős and his mathematics\", Budapest, July 1999 (1999).\n- [ErTa60] Erdős, P. and Taylor, S. J., *Some problems concerning the structure of random walk\n  paths*. Acta Math. Acad. Sci. Hungar. 11 (1960), 137--162.\n  [PDF](https://www.renyi.hu/~p_erdos/1960-17.pdf)\n- [DPRZ01] Dembo, A., Peres, Y., Rosen, J. and Zeitouni, O., *Thick points for planar Brownian\n  motion and the Erdős-Taylor conjecture on random walk*. Acta Math. 186 (2001), 239--270.\n  [doi:10.1007/BF02401841](https://doi.org/10.1007/BF02401841)\n- [HLOZ24] Hao, C., Li, X., Okada, I. and Zheng, Y., *Favorite sites for simple random walk in\n  two and more dimensions*. [arXiv:2409.00995](https://arxiv.org/abs/2409.00995) (2024).\n-/\n\n@[expose] public section\n\nopen MeasureTheory Filter\nopen scoped ProbabilityTheory Topology Real ENNReal\n\nnamespace Erdos1166\n\nopen Erdos1165\n\n/-- The maximal local time $\\max_y f_n(y)$ at time `n`. It is the largest of the local times of\nthe sites $s_0,\\ldots,s_n$ visited so far, because every other site has local time $0$. -/\ndef maxLocalTime {Ω : Type*} (X : ℕ → Ω → ℤ × ℤ) (n : ℕ) (ω : Ω) : ℕ :=\n  (Finset.range (n + 1)).sup fun k ↦ localTime X n ω (position X k ω)\n\n/-- Every site has local time at most the maximal local time. -/\n@[category API, AMS 60]\ntheorem localTime_le_maxLocalTime {Ω : Type*} (X : ℕ → Ω → ℤ × ℤ) (n : ℕ) (ω : Ω)\n    (x : ℤ × ℤ) : localTime X n ω x ≤ maxLocalTime X n ω := by\n  by_cases h : localTime X n ω x = 0\n  · rw [h]\n    exact Nat.zero_le _\n  · have hpos : 0 < ((Finset.range (n + 1)).filter fun k ↦ position X k ω = x).card :=\n      Nat.pos_of_ne_zero h\n    obtain ⟨k, hk⟩ := Finset.card_pos.1 hpos\n    rw [Finset.mem_filter] at hk\n    rw [← hk.2]\n    exact Finset.le_sup (f := fun j ↦ localTime X n ω (position X j ω)) hk.1\n\n/-- A site is a favourite site at time `n` if and only if its local time equals the maximal local\ntime. -/\n@[category API, AMS 60]\ntheorem mem_favouriteSites_iff {Ω : Type*} (X : ℕ → Ω → ℤ × ℤ) (n : ℕ) (ω : Ω)\n    (x : ℤ × ℤ) : x ∈ favouriteSites X n ω ↔ localTime X n ω x = maxLocalTime X n ω := by\n  constructor\n  · intro hx\n    refine le_antisymm (localTime_le_maxLocalTime X n ω x) ?_\n    exact Finset.sup_le fun k _ ↦ hx _\n  · intro h\n    show ∀ y, localTime X n ω y ≤ localTime X n ω x\n    intro y\n    rw [h]\n    exact localTime_le_maxLocalTime X n ω y\n\n/--\nGiven a random walk $s_0,s_1,\\ldots$ in $\\mathbb{Z}^2$, starting at the origin, let $f_k(x)$ count\nthe number of $0\\leq l\\leq k$ such that $s_l=x$.\n\nLet\n$$F(k)=\\{ x: f_k(x) = \\max_y f_k(y)\\}$$\nbe the set of 'favourite values'. Is it true that\n$$\\left\\lvert \\bigcup_{k\\leq n}F(k)\\right\\rvert \\leq (\\log n)^{O(1)}$$\nalmost surely, for all but finitely many $n$?\n\nA problem of Erdős and Révész [Va99, 6.78]. The answer is yes. Almost surely there are at most\nthree favourite sites at all large times [HLOZ24, Theorem 1.1], see\n`Erdos1165.erdos_1165.variants.hao_li_okada_zheng`, and the maximal local time is\n$O((\\log n)^2)$ [ErTa60, p. 162], see `erdos_1166.variants.erdos_taylor`. A favourite\nsite stays a favourite site for as long as the maximal local time does not change. So for each\nvalue of the maximal local time, the sites that are favourite at some time while it has that value\nare all favourite at the last such time, and there are at most three of them, up to finitely many\nexceptions. This gives the bound $O((\\log n)^2)$ stated on the problem page.\n\nWe take the simple random walk (`IsSimpleRandomWalkSteps`). We read $O(1)$ as a single exponent\n`C` that works for almost every walk. The cardinality is `Set.encard`, so an infinite union would\nnot satisfy the bound.\n-/\n@[category research solved, question, AMS 60]\ntheorem erdos_1166 {Ω : Type*} [MeasureSpace Ω] [IsProbabilityMeasure (ℙ : Measure Ω)]\n    {X : ℕ → Ω → ℤ × ℤ} (hX : IsSimpleRandomWalkSteps X) :\n    ∃ C : ℕ, ∀ᵐ ω, ∀ᶠ n : ℕ in atTop,\n      ((⋃ k ≤ n, favouriteSites X k ω).encard : ℝ≥0∞) ≤ ENNReal.ofReal (Real.log n ^ C) := by\n  sorry\n\n/--\nErdős and Taylor [ErTa60, p. 162] proved that, for the simple random walk on $\\mathbb{Z}^2$, if\n$T_n$ is the maximal number of visits to a point in the first $n$ steps, then almost surely\n$$\\frac{1}{4\\pi}\\leq\\liminf_{n\\to\\infty}\\frac{T_n}{(\\log n)^2}\n  \\leq\\limsup_{n\\to\\infty}\\frac{T_n}{(\\log n)^2}\\leq\\frac{1}{\\pi}.$$\nThey conjectured that the limit exists and equals $1/\\pi$, see\n`erdos_1166.variants.dembo_peres_rosen_zeitouni`.\n\nWe use `maxLocalTime`, which also counts the visit at time $0$. This changes $T_n$ by at most one.\nThe bounds are stated with $\\varepsilon$ to avoid the junk values of `liminf` and `limsup`.\n-/\n@[category research solved, AMS 60]\ntheorem erdos_1166.variants.erdos_taylor {Ω : Type*} [MeasureSpace Ω]\n    [IsProbabilityMeasure (ℙ : Measure Ω)] {X : ℕ → Ω → ℤ × ℤ}\n    (hX : IsSimpleRandomWalkSteps X) :\n    ∀ᵐ ω, ∀ ε : ℝ, 0 < ε →\n      (∀ᶠ n : ℕ in atTop, 1 / (4 * π) - ε ≤ (maxLocalTime X n ω : ℝ) / Real.log n ^ 2) ∧\n      (∀ᶠ n : ℕ in atTop, (maxLocalTime X n ω : ℝ) / Real.log n ^ 2 ≤ 1 / π + ε) := by\n  sorry\n\n/--\nDembo, Peres, Rosen and Zeitouni [DPRZ01, Theorem 1.1] proved the conjecture of Erdős and Taylor:\nfor the simple random walk on $\\mathbb{Z}^2$, if $T_n^*$ is the maximal number of visits to a\npoint in the first $n$ steps, then almost surely\n$$\\lim_{n\\to\\infty}\\frac{T_n^*}{(\\log n)^2}=\\frac{1}{\\pi}.$$\n\n`maxLocalTime` counts the visit at time $0$. Whether this visit is counted changes $T_n^*$ by at\nmost one, so the limit is the same.\n-/\n@[category research solved, AMS 60]\ntheorem erdos_1166.variants.dembo_peres_rosen_zeitouni {Ω : Type*} [MeasureSpace Ω]\n    [IsProbabilityMeasure (ℙ : Measure Ω)] {X : ℕ → Ω → ℤ × ℤ}\n    (hX : IsSimpleRandomWalkSteps X) :\n    ∀ᵐ ω, Tendsto (fun n : ℕ ↦ (maxLocalTime X n ω : ℝ) / Real.log n ^ 2) atTop (𝓝 (1 / π)) := by\n  sorry\n\nend Erdos1166\n",
  "statement_hash": "5a27526f768103eb28442dc5ee9cd0aefc431c4f9848acb05adabf67c3c42a82",
  "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."
}