/-
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.BasicErdős Problem 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 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 := rfl⊢ ⌈2 * ↑n / 3⌉₊ ≤ f n
n:ℕb:ℕ := n / 3hb:b = n / 3 := rflA:Finset ℕ := Finset.Icc (b + 1) n⊢ ⌈2 * ↑n / 3⌉₊ ≤ f n
calc
⌈(2 * n / 3 : ℝ)⌉₊
≤ n - b := n:ℕb:ℕ := n / 3hb:b = n / 3 := rflA:Finset ℕ := Finset.Icc (b + 1) n⊢ ⌈2 * ↑n / 3⌉₊ ≤ n - b
grw [Nat.ceil_le, Nat.cast_sub (n:ℕb:ℕ := n / 3hb:b = n / 3 := rflA:Finset ℕ := Finset.Icc (b + 1) n⊢ b ≤ 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) n⊢ 2 * ↑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) n⊢ 2 * ↑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) n⊢ n - b ≤ n All goals completed! 🐙)
⟨A, n:ℕb:ℕ := n / 3hb:b = n / 3 := rflA:Finset ℕ := Finset.Icc (b + 1) n⊢ ↑A ⊆ Set.Icc 1 n n:ℕb:ℕ := n / 3hb:b = n / 3 := rflA:Finset ℕ := Finset.Icc (b + 1) n⊢ Set.Icc (b + 1) n ⊆ Set.Icc 1 n; n:ℕb:ℕ := n / 3hb:b = n / 3 := rflA:Finset ℕ := Finset.Icc (b + 1) n⊢ 1 ≤ 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 = a⊢ a * 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 = a⊢ a * 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 = a⊢ a * 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 = a⊢ a * 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) = a⊢ a * (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) = a⊢ a * (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 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