| 1 | module |
| 2 | |
| 3 | public import Mathlib.Analysis.SpecificLimits.Basic |
| 4 | public import Mathlib.Data.Set.Card |
| 5 | public import Mathlib.Data.Real.Basic |
| 6 | |
| 7 | public section |
| 8 | |
| 9 | /-! |
| 10 | # Hofstadter's set has natural density 2/3 |
| 11 | |
| 12 | Let `A` be the smallest set of natural numbers that contains 2 and 3 and contains `a * b - 1` for all distinct members `a` and `b` |
| 13 | (Erdős problem 424, attributed by Erdős to Hofstadter; OEIS A005244). Korsky (arXiv:2608.07910) proved that `A` has positive lower |
| 14 | density. The statement below says that the proportion of members of `A` below `n` converges, and that its limit is `2 / 3`. |
| 15 | No member of `A` is congruent to 1 modulo 3, so `2 / 3` is the largest possible value. |
| 16 | -/ |
| 17 | |
| 18 | namespace Hofstadter |
| 19 | |
| 20 | /-- `Generated n` says that `n` lies in the smallest set of natural numbers that contains 2 and 3 and contains `a * b - 1` whenever it |
| 21 | contains `a` and `b` and `a ≠ b`. (Members are at least 2, so `a * b - 1` is ordinary subtraction.) -/ |
| 22 | inductive Generated : ℕ → Prop |
| 23 | | two : Generated 2 |
| 24 | | three : Generated 3 |
| 25 | | step {a b : ℕ} : Generated a → Generated b → a ≠ b → Generated (a * b - 1) |
| 26 | |
| 27 | /-- The proportion of generated numbers among the natural numbers below `n` tends to `2 / 3` as `n` tends to infinity. -/ |
| 28 | theorem density_eq_two_thirds : |
| 29 | Filter.Tendsto (fun n : ℕ => (Set.ncard {m : ℕ | m < n ∧ Generated m} : ℝ) / n) Filter.atTop |
| 30 | (nhds (2 / 3)) := by |
| 31 | sorry |
| 32 | |
| 33 | end Hofstadter |
| 34 | |