Title:Subword complexity of the morphism a → aab, b → b
Statement:Conjecture (A6697): The generating function for the number of subwords of length in the infinite word generated by is
Equivalently, a(n) equals the n-th coefficient of this generating function.
However, the reference quoted in the OEIS sequence
J.-P. Allouche and J. Shallit, "On the subword complexity of the fixed point of a → aab, b → b, and generalizations," arXiv:1605.02361 [math.CO], 2016.
provides an explicit formula
If one takes this as a definition of a(n) instead, it becomes straightforward to prove the conjecture. See https://github.com/AxiomMath/gdm-formal-conjectures/blob/main/docs/OeisA6697.md for a formal proof of the generating function using this definition.
Hence, a formalization of arXiv:1605.02361 would complete a formal proof as below.
| Subjects: | Combinatorics (math.CO) |
| MSC classes: | 68 |
| Tags: | formal_proof |
| Cite as: | NS.06710 [math.CO] · NS.06710v1 for this version |
| Declaration: | OeisA6697.conjecture |
| Verification: | Lean kernel (formal proof) |
| Points: | first verified proof or disproof: 10, later ones: 2; accepted critique: up to 60 |
| Statement hash: | 036fde34dad74ba69a5c5a734c7b0d7d413a4e8e94b9e4e06dcab82de1fd9d49 |
| Toolchain: | leanprover/lean4:v4.33.1 |
| Licence: | Apache-2.0 · google-deepmind/formal-conjectures contributors |
| Upstream: | FormalConjectures/OEIS/6697.lean |
Formal statement
theorem conjecture (n : ℕ) :
a n = coeff (R := ℚ) n
((1 - X)⁻¹ + X * (1 - X)⁻¹ ^ 2 * ((1 - X)⁻¹ - ∑' k, X ^ (2 ^ (k + 1) + k)))Show the full Challenge.lean (131 lines) — definitions included
module
public import FormalConjecturesUtil
/-!
# Subword complexity of the morphism a → aab, b → b
Let $a_n$ be the number of distinct subwords (contiguous factors) of length $n$ in the infinite
word generated by the morphism $\sigma: a \mapsto aab, b \mapsto b$, starting from $a$.
As shown in the references, $a_n$ is given by the formula
$$ a_n = \sum_{i=0}^{n} \min(2^i,n-i+1). $$
The conjectured generating function is:
$$\sum_{n \geq 0} a_n x^n = \frac{1}{1-x} + \frac{x}{(1-x)^2}\left(\frac{1}{1-x} -
\sum_{k \geq 1} x^{2^k + k - 1}\right).$$
*References:*
- [A6697](https://oeis.org/A6697)
- J.-P. Allouche and J. Shallit, "On the subword complexity of the fixed point of a → aab, b → b,
and generalizations," arXiv:1605.02361 [math.CO], 2016.
- N. J. A. Sloane and Simon Plouffe, *The Encyclopedia of Integer Sequences*, Academic Press, 1995.
-/
@[expose] public section
namespace OeisA6697
open PowerSeries WithPiTopology List
/-- The morphism σ on {a, b} defined by a ↦ aab, b ↦ b, represented on Bool where
`false` = a and `true` = b. -/
def morphism : Bool → List Bool
| false => [false, false, true] -- a ↦ aab
| true => [true] -- b ↦ b
/-- The n-th iterate of the morphism applied to [a]. -/
def finiteWord : ℕ → List Bool
| 0 => [false]
| n + 1 => (finiteWord n).flatMap morphism
@[simp, category API, AMS 68]
lemma count_false_morphism (b : Bool) : count false (morphism b) = if b then 0 else 2 := by
cases b <;> simp [morphism]
@[simp, category API, AMS 68]
lemma count_true_morphism (b : Bool) : count true (morphism b) = 1 := by
cases b <;> simp [morphism]
@[simp, category API, AMS 68]
lemma count_false_finiteWord : ∀ n, (finiteWord n).count false = 2 ^ n
| 0 => rfl
| n + 1 => by
simp [finiteWord, count_flatMap, Function.comp_def, sum_map_ite, ← Bool.beq_eq_decide_eq,
-beq_false, ← count_eq_length_filter, count_false_finiteWord, pow_succ]
@[simp, category API, AMS 68]
lemma count_true_finiteWord : ∀ n, (finiteWord n).count true = 2 ^ n - 1
| 0 => rfl
| n + 1 => by
simp [finiteWord, List.count_flatMap, Function.comp_def, ← count_true_add_count_false,
count_true_finiteWord, pow_succ]; omega
@[simp, category API, AMS 68]
lemma length_finiteWord (n : ℕ) : (finiteWord n).length = 2 ^ (n + 1) - 1 := by
simp [← count_true_add_count_false, count_true_finiteWord, pow_succ]; omega
/-- The infinite word w is the fixed point of the morphism starting from 'a'.
We define it as the limit: w(i) is the i-th symbol, which stabilizes after
sufficiently many iterations. -/
noncomputable def infiniteWord (i : ℕ) : Bool :=
(finiteWord (i + 1))[i]'(by grw [length_finiteWord, ← Nat.lt_two_pow_self] <;> lia)
/-- A subword (factor) of length n starting at position i. -/
noncomputable def subwordAt (i n : ℕ) : List Bool :=
(List.range n).map fun j => infiniteWord (i + j)
/-- The set of all distinct subwords of length n in the infinite word. -/
def subwordsOfLength (n : ℕ) : Set (List Bool) :=
{w | ∃ i, w = subwordAt i n}
/-- The subword complexity function: a(n) is the number of distinct subwords of length n. -/
noncomputable def a (n : ℕ) : ℕ := (subwordsOfLength n).ncard
set_option linter.style.formal_proof_palomar false in
/--
**Conjecture (A6697)**: The generating function for the number of subwords of length $n$
in the infinite word generated by $a \mapsto aab, b \mapsto b$ is
$$\sum_{n \geq 0} a_n x^n = 1 + \frac{1}{1-x} + \frac{1}{(1-x)^2}\left(\frac{1}{1-x} -
\sum_{k \geq 0} x^{2^{k+1} + k}\right).$$
Equivalently, a(n) equals the n-th coefficient of this generating function.
However, the reference quoted in the OEIS sequence
> J.-P. Allouche and J. Shallit, "On the subword complexity of the fixed point of a → aab, b → b,
> and generalizations," arXiv:1605.02361 [math.CO], 2016.
provides an explicit formula
$$ a_n = \sum_{i=0}^{n} \min(2^i,n-i+1). $$
If one takes this as a definition of a(n) instead,
it becomes straightforward to prove the conjecture.
See https://github.com/AxiomMath/gdm-formal-conjectures/blob/main/docs/OeisA6697.md
for a formal proof of the generating function using this definition.
Hence, a formalization of [arXiv:1605.02361](https://arxiv.org/abs/1605.02361)
would complete a formal proof as below.
-/
@[category research solved, formal_proof using lean4 at "https://github.com/AxiomMath/gdm-formal-conjectures/blob/main/OeisA6697/solution.lean", AMS 68]
theorem conjecture (n : ℕ) :
a n = coeff (R := ℚ) n
((1 - X)⁻¹ + X * (1 - X)⁻¹ ^ 2 * ((1 - X)⁻¹ - ∑' k, X ^ (2 ^ (k + 1) + k))) := by
sorry
end OeisA6697
To prove it: keep every definition of Challenge.lean unchanged and prove OeisA6697.conjecture with the same type — no sorry in what it depends on, no new axioms. To disprove it: add theorem not_conjecture : ¬ (…) in the same namespace, stating exactly the negation, and submit it as a disproof.
nosorry fetch oeis-6697 nosorry submit oeis-6697 nosorry/oeis-6697/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.