/- Copyright 2025 The Formal Conjectures Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at https://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -/ import FormalConjecturesUtil import Mathlib.Topology.Basic

Erdős Problem 1062

Reference: erdosproblems.com/1062

open Filteropen scoped Topology namespace Erdos1062

A set A of positive integers is fork-free if no element divides two distinct other elements of A.

def ForkFree (A : Set ) : Prop := a A, ({b | b A \ {a} a b} : Set ).Subsingleton open scoped Classical in

The extremal function from Erdős problem 1062: the largest size of a fork-free subset of {1,...,n}.

noncomputable def f (n : ) : := Nat.findGreatest (fun k => A Set.Icc 1 n, ForkFree A A.ncard = k) n

Erdős asked whether the limiting density f n / n exists and, if so, whether it is irrational.

@[category research open, AMS 11] theorem declaration uses 'sorry'erdos_1062.parts.ii : ( l, Tendsto (fun n => (f n : ) / n) atTop (𝓝 l) Irrational l) answer(sorry) := (∃ l, Tendsto (fun n => (f n) / n) atTop (𝓝 l) Irrational l) True All goals completed! 🐙

The interval [⌊n/3⌋, n] is fork-free, and therefore f n is at least ⌈2n / 3⌉.

@[category research solved, AMS 11] theorem erdos_1062.variants.lower_bound (n : ) : (2 * n / 3 : )⌉₊ f n := n:2 * n / 3⌉₊ f n classical n:b: := n / 3hb:b = n / 3 := rfl2 * n / 3⌉₊ f n n:b: := n / 3hb:b = n / 3 := rflA:Finset := Finset.Icc (b + 1) n2 * n / 3⌉₊ f n calc (2 * n / 3 : )⌉₊ n - b := n:b: := n / 3hb:b = n / 3 := rflA:Finset := Finset.Icc (b + 1) n2 * n / 3⌉₊ n - b grw [Nat.ceil_le, Nat.cast_sub (n:b: := n / 3hb:b = n / 3 := rflA:Finset := Finset.Icc (b + 1) nb n All goals completed! 🐙), le_sub_iff_add_le, hb, Nat.cast_div_len:b: := n / 3hb:b = n / 3 := rflA:Finset := Finset.Icc (b + 1) n2 * n / 3 + n / 3 n -- FIXME: `ring` should have some basic inequality support. n:b: := n / 3hb:b = n / 3 := rflA:Finset := Finset.Icc (b + 1) n2 * n / 3 + n / 3 = n All goals completed! 🐙 _ f n := Nat.le_findGreatest (n:b: := n / 3hb:b = n / 3 := rflA:Finset := Finset.Icc (b + 1) nn - b n All goals completed! 🐙) A, n:b: := n / 3hb:b = n / 3 := rflA:Finset := Finset.Icc (b + 1) nA Set.Icc 1 n n:b: := n / 3hb:b = n / 3 := rflA:Finset := Finset.Icc (b + 1) nSet.Icc (b + 1) n Set.Icc 1 n; n:b: := n / 3hb:b = n / 3 := rflA:Finset := Finset.Icc (b + 1) n1 b + 1; All goals completed! 🐙, ?_, n:b: := n / 3hb:b = n / 3 := rflA:Finset := Finset.Icc (b + 1) n(↑A).ncard = n - b All goals completed! 🐙 n:b: := n / 3hb:b = n / 3 := rflA:Finset := Finset.Icc (b + 1) n (a : ), b + 1 a a n {b_1 | b + 1 b_1 b_1 n ¬b_1 = a a b_1}.Subsingleton n:b: := n / 3hb:b = n / 3 := rflA:Finset := Finset.Icc (b + 1) na:ha:b + 1 a{b_1 | b + 1 b_1 b_1 n ¬b_1 = a a b_1}.Subsingleton n:b: := n / 3hb:b = n / 3 := rflA:Finset := Finset.Icc (b + 1) na:ha:b + 1 a b_1 {b_2 | b + 1 b_2 b_2 n ¬b_2 = a a b_2}, b_1 = a * 2 n:b: := n / 3hb:b = n / 3 := rflA:Finset := Finset.Icc (b + 1) na:ha:b + 1 a (b_1 : ), b + 1 b_1 b_1 n ¬b_1 = a a b_1 b_1 = a * 2 n:b: := n / 3hb:b = n / 3 := rflA:Finset := Finset.Icc (b + 1) na:ha:b + 1 ak:a✝¹:b + 1 a * khk:a * k na✝:¬a * k = aa * k = a * 2 match k with n:b: := n / 3hb:b = n / 3 := rflA:Finset := Finset.Icc (b + 1) na:ha:b + 1 ak:a✝¹:b + 1 a * 2hk:a * 2 na✝:¬a * 2 = aa * 2 = a * 2n:b: := n / 3hb:b = n / 3 := rflA:Finset := Finset.Icc (b + 1) na:ha:b + 1 ak:a✝¹:b + 1 a * 1hk:a * 1 na✝:¬a * 1 = aa * 1 = a * 2n:b: := n / 3hb:b = n / 3 := rflA:Finset := Finset.Icc (b + 1) na:ha:b + 1 ak:a✝¹:b + 1 a * 0hk:a * 0 na✝:¬a * 0 = aa * 0 = a * 2 All goals completed! 🐙 n:b: := n / 3hb:b = n / 3 := rflA:Finset := Finset.Icc (b + 1) na:ha:b + 1 ak✝:k:a✝¹:b + 1 a * (k + 3)hk:a * (k + 3) na✝:¬a * (k + 3) = aa * (k + 3) = a * 2 grw [ le_add_selfn:b: := n / 3hb:b = n / 3 := rflA:Finset := Finset.Icc (b + 1) na:ha:b + 1 ak✝:k:a✝¹:b + 1 a * (k + 3)hk:a * 3 na✝:¬a * (k + 3) = aa * (k + 3) = a * 2 at hk; All goals completed! 🐙

Lebensold proved that for large n, the function f n lies between 0.6725 n and 0.6736 n.

@[category research solved, AMS 11] theorem declaration uses 'sorry'erdos_1062.variants.lebensold_bounds : ∀ᶠ n in atTop, (0.6725 : ) * n f n f n (0.6736 : ) * n := ∀ᶠ (n : ) in atTop, 0.6725 * n (f n) (f n) 0.6736 * n All goals completed! 🐙 end Erdos1062