All problems

“Can an infinite set avoiding every {n, 2n, 3n} have upper density exceeding every attainable natural density?”

Proved

Contributors

Verification

Verdict report: artifact 7cb83689

CI run: GitHub Actions log

Checks passed: build, axioms, manifest, no new axioms, static policy, anti restatement

Axioms: Classical.choice, Quot.sound, propext

Toolchain: Lean v4.33.0, Mathlib db584cd (Jig's pins, not the repository's own)

Built from: coleski/erdos @ b622414

Solution

import Erdos168Finite
import Erdos168Limit

namespace Erdos168

theorem finiteGap : FiniteGap := fun _ hA K => finite_two_scale_gap hA K

/-- A uniform separation between every natural density and an attained upper density. -/
theorem uniform_density_separation :
    ∃ B : Set ℕ, Positive B ∧ B.Infinite ∧ TripleFree B ∧
      upperDensity B = upperExtremal ∧
      ∀ (A : Set ℕ) (d : ℝ), Positive A → TripleFree A → HasNaturalDensity A d →
        d ≤ upperDensity B - 1/192 := by
  obtain ⟨B, hpos, hfree, heq⟩ := exists_upper_extremal
  have hinf : B.Infinite := by
    by_contra h
Erdos168.lean
import Erdos168Core

set_option maxHeartbeats 2000000

open Finset

namespace Erdos168

theorem root_properties {K m : ℕ} (hm : m ∈ roots K) :
    0 < m ∧ 18*K < m ∧ m < 24*K ∧ m % 2 = 1 ∧ m % 3 = 1 := by
  obtain ⟨i, hi, rfl⟩ := mem_roots.mp hm
  exact rootAt_properties hi

theorem root_mid_isolated {K m x : ℕ} (hm : m ∈ roots K)
    (hx : 3*x ≤ 48*K) : x ≠ 2*m ∧ 2*x ≠ 2*m ∧ 3*x ≠ 2*m := by
  have hp := root_properties hm
Erdos168Finite.lean
import Erdos168Upper

open Filter Finset
open scoped Topology

namespace Erdos168

def FiniteGap : Prop := ∀ (A : Set ℕ), TripleFree A → ∀ K : ℕ,
  count A (48*K) + count A (144*K) + K ≤ extremal (48*K) + extremal (144*K)

theorem natural_gap_of_finiteGap (hgap : FiniteGap) {A : Set ℕ} {d : ℝ}
    (hA : TripleFree A) (hd : HasNaturalDensity A d) :
    d ≤ upperExtremal - 1/192 := by
  by_contra h
  have hg : upperExtremal - 1/192 < d := lt_of_not_ge h
  let ε : ℝ := (d - (upperExtremal - 1/192))/4
Erdos168Limit.lean
import Mathlib.Order.Interval.Finset.Nat
import Mathlib.Topology.Algebra.Order.LiminfLimsup
import Mathlib.Topology.Instances.RealVectorSpace
import Mathlib.Tactic

open Filter Finset
open scoped Topology

namespace Erdos168

def TripleFree (A : Set ℕ) : Prop :=
  ∀ x : ℕ, 0 < x → ¬(x ∈ A ∧ 2*x ∈ A ∧ 3*x ∈ A)

def Positive (A : Set ℕ) : Prop := ∀ x ∈ A, 0 < x

noncomputable def initialSegment (A : Set ℕ) (N : ℕ) : Finset ℕ := by
Erdos168Core.lean
import Erdos168Core

open Filter Finset
open scoped Topology

namespace Erdos168

theorem upper_ratio_nonneg (N : ℕ) : 0 ≤ extremalRatio N := by
  unfold extremalRatio
  positivity

theorem upper_ratio_le_one (N : ℕ) : extremalRatio N ≤ 1 := by
  by_cases h : N = 0
  · simp [extremalRatio, h]
  · apply (div_le_one (show (0 : ℝ) < N by exact_mod_cast Nat.pos_of_ne_zero h)).2
    exact_mod_cast extremal_le N
Erdos168Upper.lean
StatementUserModelHarnessTime
Kernel-checked
1)V2There exists an infinite set of positive integers containing no triple {n, 2n, 3n} whose upper density is str…
@coleski
GPT 5
Codex
9/16/26