import Mathlib.Analysis.SpecialFunctions.Log.Basicimport Mathlib.Combinatorics.Enumerative.Stirlingimport Mathlib.Tactic.Linarithimport Mathlib.Tactic.NormNumimport Mathlib.Tactic.Positivity/-! Lewis–Won, arXiv:2609.03081v1, §3.4, Conjecture 3.17 as printed.Only a boundary counterexample is proved; there is no assertion about n ≥ 4. -/namespace LongtailProofs.LewisWon317/-- Expression (3.1), used on the domain `2*m ≤ n` of Proposition 3.16. -/def value (n m : ℕ) : ℕ := ∑ i ∈ Finset.range m,(Nat.stirlingSecond m (i+1) * (i+1)^(n-2*m) * (i+1).factorial)^2/-- The paper specifies the lower endpoint as the unique positive root. -/def Endpoint (n : ℕ) (x : ℝ) : Prop :=0 < x ∧ (n : ℝ) = Real.log (x+1) / Real.log (1+1/x) + 2*xdef Maximizes (n m : ℕ) : Prop := 2*m ≤ n ∧ ∀ j, 2*j ≤ n → value n j ≤ value n m/-- There is an admissible maximizer strictly between the lower endpointand that endpoint plus two. The endpoint is specified by its defining relation. -/def Conjecture317 : Prop := ∀ n : ℕ, 0 < n → ∀ x : ℝ, Endpoint n x →∃ m : ℕ, Maximizes n m ∧ x < (m : ℝ) ∧ (m : ℝ) < x+2theorem endpoint_three (x : ℝ) : Endpoint 3 x ↔ x = 1 := byconstructor· rintro ⟨hx, he⟩norm_num only [Nat.cast_ofNat] at hehave hd : 0 < Real.log (1 + 1/x) := Real.log_pos (by have := one_div_pos.mpr hx; linarith)rcases lt_trichotomy x 1 with h | h | h· have hi : 1 ≤ 1/x := (le_div_iff₀ hx).2 (by linarith)have hl := Real.log_le_log (show 0 < x+1 by linarith) (show x+1 ≤ 1+1/x by linarith)have := (div_le_one hd).2 hllinarith· exact h· have hi : 1/x ≤ 1 := (div_le_iff₀ hx).2 (by linarith)have hl := Real.log_le_log (show 0 < 1+1/x by positivity) (show 1+1/x ≤ x+1 by linarith)have := (one_le_div hd).2 hllinarith· rintro rflunfold Endpointhave h : Real.log 2 ≠ 0 := ne_of_gt (Real.log_pos (by norm_num))norm_num [div_self h]theorem values_three : value 3 0 = 0 ∧ value 3 1 = 1 := by decidetheorem maximizes_three (m : ℕ) : Maximizes 3 m ↔ m = 1 := byobtain ⟨hz, ho⟩ := values_threeconstructor· rintro ⟨hf, h⟩have h1 := h 1 (by decide)rcases (show m = 0 ∨ m = 1 by omega) with rfl | rfl· omega· rfl· rintro rflrefine ⟨by decide, fun j hj => ?_⟩rcases (show j = 0 ∨ j = 1 by omega) with rfl | rfl <;> omegatheorem not_conjecture317 : ¬ Conjecture317 := byintro hobtain ⟨m, hm, hlo, _⟩ := h 3 (by decide) 1 ((endpoint_three 1).2 rfl)rw [(maximizes_three m).1 hm] at hlonorm_num at hlo#print axioms endpoint_three#print axioms maximizes_three#print axioms not_conjecture317end LongtailProofs.LewisWon317