{
  "id": "6138",
  "ident": "NS.06138",
  "slug": "oeis-300997",
  "title": "Step difference bound $a(n+1) - a(n) \\in \\{1, 2\\}$ in mass-redistribution cellular automata",
  "status": "solved",
  "statement_status": "reviewed",
  "statement_md": "Conjecture: It appears that the finite difference of this sequence only contains 1's and 2's.\n\nA formal proof has been found with the methods described in\n[arxiv/2605.22763](https://arxiv.org/abs/2605.22763).",
  "subjects": [
    "math.NT",
    "msc:11"
  ],
  "tags": [
    "formal_proof"
  ],
  "collection": "oeis",
  "source_url": null,
  "solved_on_platform": false,
  "needs_answer": false,
  "version": 1,
  "decl_name": "OeisA300997.a_succ_eq",
  "statement_lean": "theorem a_succ_eq : ∀ n : ℕ, 1 ≤ n → a (n + 1) = a n + 1 ∨ a (n + 1) = a n + 2",
  "challenge_source": "/-\nCopyright 2026 The Formal Conjectures Authors.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n    https://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n-/\nmodule\n\npublic import FormalConjecturesUtil\n\n/-!\n# Step difference bound $a(n+1) - a(n) \\in \\{1, 2\\}$ in mass-redistribution cellular automata\n\n$a(n)$ is the number of steps needed to reach a stable configuration in the 1D cellular\nautomaton initialized with one cell with mass $n$ and based on the rule \"each cell gives half of\nits mass, rounded down, to its right neighbor\".\nThe stable configuration is $n$ cells with mass 1.\n\n*References:*\n- [A300997](https://oeis.org/A300997)\n- [arxiv/2605.22763](https://arxiv.org/abs/2605.22763) *Advancing Mathematics Research with AI-Driven Formal Proof Search* by George Tsoukalas et al.\n-/\n\n@[expose] public section\n\nnamespace OeisA300997\n\n\nopen List Nat Function Set\n\n/--\n$a(n)$ is the number of steps needed to reach a stable configuration in the 1D cellular\nautomaton initialized with one cell with mass $n$ and based on the rule \"each cell gives half of\nits mass, rounded down, to its right neighbor\".\nThe stable configuration is $n$ cells with mass 1.\n-/\nnoncomputable def a (n : ℕ) : ℕ :=\n  let half_ceil (m : ℕ) : ℕ := (m + 1) / 2\n  let half_floor (m : ℕ) : ℕ := m / 2\n\n  let trim_trailing_zeros (l : List ℕ) : List ℕ :=\n    (List.reverse l).dropWhile (fun x => x = 0) |>.reverse\n\n  let ca_step (config : List ℕ) : List ℕ :=\n    let base_masses := config.map half_ceil ++ [0]\n    let received_masses := 0 :: config.map half_floor\n\n    let next_config_long := List.zipWith Nat.add base_masses received_masses\n\n    trim_trailing_zeros next_config_long\n\n  if n = 0 then\n    0\n  else\n    let initial_config : List ℕ := [n]\n    let target_config : List ℕ := List.replicate n 1\n\n    -- State after t steps, computed by folding ca_step t times using foldl over a range.\n    let S (t : ℕ) : List ℕ := (List.range t).foldl (fun acc _ => ca_step acc) initial_config\n\n    -- The set of time steps k at which the configuration is stable.\n    let stable_steps : Set ℕ := {k | S k = target_config}\n\n    -- a(n) is the smallest k in this set, defined by the set infimum (sInf).\n    sInf stable_steps\n\n\n@[category test, AMS 11]\nlemma a_1 : a 1 = 0 := by simp [a, Nat.sInf_eq_zero, Set.mem_ofPred_eq, List.replicate]\n\n@[category test, AMS 11]\nlemma a_2 : a 2 = 1 := by\n  unfold a\n  norm_num\n  refine le_antisymm (Nat.sInf_le ?_) ?_\n  · simp only [Set.mem_ofPred_eq]\n    decide\n  · refine Nat.one_le_iff_ne_zero.mpr fun h => ?_\n    rcases Nat.sInf_eq_zero.mp h with h0 | h0\n    · simp only [Set.mem_ofPred_eq] at h0\n      exact absurd h0 (by decide)\n    · exact absurd h0 (Set.nonempty_iff_ne_empty.mp ⟨1, by simp only [Set.mem_ofPred_eq]; decide⟩)\n\n@[category test, AMS 11]\nlemma a_3 : a 3 = 3 := by\n  norm_num [a]\n  refine IsLeast.csInf_eq ⟨?_, ?_⟩\n  · simp only [Set.mem_ofPred_eq]\n    decide\n  · intro k hk\n    simp only [Set.mem_ofPred_eq] at hk\n    by_contra hlt\n    push Not at hlt\n    interval_cases k <;> exact absurd hk (by decide)\n\n@[category test, AMS 11]\nlemma a_4 : a 4 = 4 := by\n  norm_num [a]\n  apply le_antisymm\n  · apply Nat.sInf_le\n    simp only [Set.mem_ofPred_eq]\n    decide\n  · apply le_csInf\n    · refine ⟨4, ?_⟩\n      simp only [Set.mem_ofPred_eq]\n      decide\n    · intro b hb\n      simp only [Set.mem_ofPred_eq] at hb\n      by_contra hb4\n      push Not at hb4\n      interval_cases b <;> exact absurd hb (by decide)\n\n@[category test, AMS 11]\nlemma a_5 : a 5 = 6 := by\n  have key : ∀ s : Set ℕ, 6 ∈ s → (∀ k < 6, k ∉ s) → sInf s = 6 := by\n    intro s h6 hlt\n    refine le_antisymm (Nat.sInf_le h6) ?_\n    by_contra h\n    push Not at h\n    exact hlt _ h (Nat.sInf_mem ⟨6, h6⟩)\n  unfold a\n  norm_num\n  apply key\n  · simp only [Set.mem_ofPred_eq]\n    decide\n  · intro k hk\n    simp only [Set.mem_ofPred_eq]\n    interval_cases k <;> decide\n\n\nset_option linter.style.formal_proof_palomar false in\n/--\nConjecture: It appears that the finite difference of this sequence only contains 1's and 2's.\n\nA formal proof has been found with the methods described in\n[arxiv/2605.22763](https://arxiv.org/abs/2605.22763).\n-/\n@[category research solved, AMS 11, formal_proof using formal_conjectures at\n\"https://github.com/mo271/formal-conjectures/blob/a32396489dcb8f86c3549b93aa358ac6a10a3a1f/FormalConjectures/OEIS/300997.wip.lean#L1153\"]\ntheorem a_succ_eq : ∀ n : ℕ, 1 ≤ n → a (n + 1) = a n + 1 ∨ a (n + 1) = a n + 2 := by\n    sorry\n\nend OeisA300997\n",
  "statement_hash": "726c5644c941730ee9ad6f1befe2fa896f5d5a32f63daf75a32cf5a94b8ebbe9",
  "toolchain": "leanprover/lean4:v4.33.1",
  "upstream_commit": "f9b3868d5ca994a7bf95039bcec05338c0c21e2f",
  "workspace": "formal-conjectures",
  "field": "math",
  "formalization": "formal",
  "verification": "lean-kernel",
  "license": "Apache-2.0",
  "attribution": "google-deepmind/formal-conjectures contributors",
  "metric_name": null,
  "metric_direction": null,
  "critiques": [],
  "public_partial_proofs": [],
  "research_threads": [],
  "instructions": "Read research_threads first: other people's public repositories and what they already tried. Write Solution.lean starting from challenge_source. Keep every definition identical, prove decl_name with exactly the same type, no sorry in its dependency closure, no new axioms, no native_decide, no metaprogramming. Submit with POST /api/v1/submissions."
}