Title:Density of ones in the Kolakoski sequence
Statement:"It is an unsolved problem to show that the density of 1's is equal to 1/2." — A000002
| Subjects: | Number Theory (math.NT); Combinatorics (math.CO) |
| MSC classes: | 11, 68 |
| Cite as: | NS.05232 [math.NT] · NS.05232v1 for this version |
| Declaration: | OeisA2.density_one |
| Verification: | Lean kernel (formal proof) |
| Points: | first verified proof or disproof: 100, later ones: 10; accepted critique: up to 60 |
| Statement hash: | d37fd2f16d59539e88f76a3c0693a31a093105547bb8c1168ad916686df8150d |
| Toolchain: | leanprover/lean4:v4.33.1 |
| Licence: | Apache-2.0 · google-deepmind/formal-conjectures contributors |
| Upstream: | FormalConjectures/OEIS/2.lean |
Formal statement
theorem density_one : {n : ℕ | a n = 1}.HasDensity (1 / 2 : ℝ)Show the full Challenge.lean (141 lines) — definitions included
module
public import FormalConjecturesUtil
/-!
# Density of ones in the Kolakoski sequence
The Kolakoski sequence is the self-describing sequence of ones and twos whose terms are the
lengths of its successive runs. Its official indexing begins with $a(1) = 1$; here it is extended
by $a(0) = 0$.
*References:*
- [A000002](https://oeis.org/A000002)
- E. S. Kupin and E. S. Rowland,
["Bounds on the frequency of 1 in the Kolakoski word"](https://arxiv.org/abs/0809.2776),
arXiv:0809.2776 [math.CO] (2008).
-/
@[expose] public section
namespace OeisA2
/--
`wordPrefix n` is the finite Kolakoski word after expanding `n` runs beyond the seed `[1, 2, 2]`.
At stage $n$, position $n+2$ supplies the next run length, and the emitted symbol is $1$ for
even $n$ and $2$ for odd $n$.
-/
def wordPrefix : ℕ → List ℕ
| 0 => [1, 2, 2]
| n + 1 =>
let xs := wordPrefix n
let runLength := if xs.getD (n + 2) 1 = 2 then 2 else 1
let nextSymbol := if n % 2 = 0 then 1 else 2
xs ++ List.replicate runLength nextSymbol
/-- Every generated prefix is long enough for the next unread run length. -/
@[category API, AMS 11 68]
theorem prefix_length (n : ℕ) : n + 3 ≤ (wordPrefix n).length := by
induction n with
| zero => norm_num [wordPrefix]
| succ n ih =>
simp only [wordPrefix, List.length_append, List.length_replicate]
split <;> omega
/-- The read cursor used to generate the next run is always inside the generated prefix. -/
@[category API, AMS 11 68]
theorem cursor_lt_prefix_length (n : ℕ) : n + 2 < (wordPrefix n).length := by
have h := prefix_length n
omega
/-- Every symbol in every generated prefix is either `1` or `2`. -/
@[category API, AMS 11 68]
theorem prefix_mem_one_or_two (n : ℕ) : ∀ x ∈ wordPrefix n, x = 1 ∨ x = 2 := by
induction n with
| zero => simp [wordPrefix]
| succ n ih =>
intro x hx
simp only [wordPrefix, List.mem_append] at hx
rcases hx with hx | hx
· exact ih x hx
· rw [List.eq_of_mem_replicate hx]
by_cases h : n % 2 = 0 <;> simp [h]
/-- The Kolakoski sequence, using its official one-based indexing and extended by `a 0 = 0`. -/
def a : ℕ → ℕ
| 0 => 0
| n + 1 => (wordPrefix n).getD n 0
/-- Every positive-index term of the public sequence is one or two. -/
@[category API, AMS 11 68]
theorem a_one_or_two {n : ℕ} (hn : 0 < n) : a n = 1 ∨ a n = 2 := by
obtain ⟨n, rfl⟩ := Nat.exists_eq_succ_of_ne_zero (by omega : n ≠ 0)
have hlt : n < (wordPrefix n).length := by
have h := prefix_length n
omega
apply prefix_mem_one_or_two n
rw [a]
have hget : (wordPrefix n).getD n 0 = (wordPrefix n)[n] :=
List.getD_eq_getElem (l := wordPrefix n) (d := 0) hlt
rw [hget]
exact List.getElem_mem hlt
@[category test, AMS 11 68]
theorem a_0 : a 0 = 0 := by rfl
@[category test, AMS 11 68]
theorem a_1 : a 1 = 1 := by norm_num [a, wordPrefix]
@[category test, AMS 11 68]
theorem a_2 : a 2 = 2 := by norm_num [a, wordPrefix]
@[category test, AMS 11 68]
theorem a_3 : a 3 = 2 := by norm_num [a, wordPrefix]
@[category test, AMS 11 68]
theorem a_4 : a 4 = 1 := by norm_num [a, wordPrefix]
@[category test, AMS 11 68]
theorem a_5 : a 5 = 1 := by norm_num [a, wordPrefix]
@[category test, AMS 11 68]
theorem a_6 : a 6 = 2 := by norm_num [a, wordPrefix]
@[category test, AMS 11 68]
theorem a_7 : a 7 = 1 := by norm_num [a, wordPrefix]
@[category test, AMS 11 68]
theorem a_8 : a 8 = 2 := by norm_num [a, wordPrefix]
@[category test, AMS 11 68]
theorem a_9 : a 9 = 2 := by norm_num [a, wordPrefix]
@[category test, AMS 11 68]
theorem a_10 : a 10 = 1 := by norm_num [a, wordPrefix]
/--
"It is an unsolved problem to show that the density of 1's is equal to 1/2."
— [A000002](https://oeis.org/A000002)
-/
@[category research open, AMS 11 68]
theorem density_one : {n : ℕ | a n = 1}.HasDensity (1 / 2 : ℝ) := by
sorry
end OeisA2
To prove it: keep every definition of Challenge.lean unchanged and prove OeisA2.density_one with the same type — no sorry in what it depends on, no new axioms. To disprove it: add theorem not_density_one : ¬ (…) in the same namespace, stating exactly the negation, and submit it as a disproof.
nosorry fetch oeis-2 nosorry submit oeis-2 nosorry/oeis-2/Solution.lean --wait
Contributions
No contributions yet — be the first. Submit a proof or a finding.
Research in progress
People working on this problem share their repository and a summary of what they have tried — dead ends included. Read these before starting, build on them, and credit them in prior work when you submit.
Nobody has shared research on this problem yet.
Sign in to share your research.
Statement review
Is the formal statement faithful to the problem? Too weak, too strong, already solved in the literature? An accepted critique creates a new statement version; proofs of the previous version are re-checked and their points adjusted.
Sign in to open a critique.