AFTD Auto-Formalizing Theoretical Domains

seeded_subtraction_period_divisibility_case_one

theoremverifiedoriginal

For parameter $a = 1$, every binary seed of length 3 generates a subtraction sequence whose least eventual period is 4, which divides $3(1) + 1 = 4$.

Statement

theorem seeded_subtraction_period_divisibility_case_one :
    (∀ seed : Fin 3 → Bool, least_eventual_period (seeded_subtraction_seq 1 seed) = 4) ∧
    (∀ seed : Fin 3 → Bool,
      least_eventual_period (seeded_subtraction_seq 1 seed) ∣ 3 * 1 ∨
      least_eventual_period (seeded_subtraction_seq 1 seed) ∣ 3 * 1 + 1)
Related work
knowledgebase, OP-1251
Verified
08 Nov 2026
Axioms
Classical.choiceQuot.soundpropext
Built on 3
  • seeded_subtraction_seqThe binary sequence defined recursively from a seed of length $2a + 1$, where the first $2a + 1$ values are given by the seed, and each…
  • least_eventual_periodThe least eventual period of a sequence $w : \mathbb{N} \to \text{Bool}$ is the infimum of the set of its positive eventual periods.
  • is_eventual_periodA positive integer $p$ is an eventual period of a sequence $w : \mathbb{N} \to \text{Bool}$ if there exists $N \in \mathbb{N}$ such that…

Read back from the Lean

The theorem asserts that both of the following hold: 1. For every initial seed seed : Fin 3 → Bool, the least eventual period of the sequence seeded_subtraction_seq 1 seed is equal to 4. 2. For every initial seed seed : Fin 3 → Bool, the least eventual period of seeded_subtraction_seq 1 seed divides 3 * 1 (i.e., 3) or divides 3 * 1 + 1 (i.e., 4).

Written by a model that saw only the Lean, never the English above. If the two disagree, that is worth a challenge.

The proof, explained

The proof tracks the sequence generated by parameter a = 1 using a sliding window of three consecutive Boolean values. Because the state space consists of only 8 triples, exhaustive checking establishes that the 6th iterate of the state transition equals the 2nd iterate (T^6 = T^2), proving that every sequence eventually repeats with period 4 from index 2 onwards. Exhaustive verification also shows that within the 4-cycle every candidate period p ∈ {1, 2, 3} produces a mismatch, so 4 is the minimal eventual period, and 4 divides 3(1) + 1 = 4.

  1. For indices n ≥ 3, the subtraction recurrence with a = 1 simplifies to w(n) = ¬w(n-1) ∨ ¬w(n-2) ∨ ¬w(n-3).

    Unfolding the definition of seeded_subtraction_seq for a = 1, the condition n < 2(1) + 1 = 3 is false since n ≥ 3, and the branch a = 0 is also false since 1 ≠ 0. In both cases, dif_neg selects the recursive branch.

    lines 13–16

    uses dif_neg

      conv_lhs => rw [seeded_subtraction_seq]
      dsimp only
      rw [dif_neg (by omega : ¬ n < 2 * 1 + 1)]
      rw [dif_neg (by decide : ¬ (1 = 0))]
  2. Advancing the 3-element window by one position corresponds to applying the state transition step.

    Unfolding the window triple and the step function, the first two coordinates shift naturally, while the third coordinate at index n + 3 matches the recurrence formula established by seeded_subtraction_period_divisibility_case_one_rec.

    lines 22–25

    uses seeded_subtraction_period_divisibility_case_one_rec

      unfold seeded_subtraction_period_divisibility_case_one_triple seeded_subtraction_period_divisibility_case_one_step
      simp only
      rw [seeded_subtraction_period_divisibility_case_one_rec seed (n+3) (by omega)]
      simp
  3. The sliding window at index n is the n-fold iterate of the transition step applied to the initial seed triple.

    By induction on n. The base case n = 0 is trivial. For the inductive step, seeded_subtraction_period_divisibility_case_one_triple_succ and Function.iterate_succ_apply' advance the iterate by one step.

    lines 31–34

    uses seeded_subtraction_period_divisibility_case_one_triple_succ, Function.iterate_succ_apply'

      induction n with
      | zero => simp
      | succ k ih =>
          rw [seeded_subtraction_period_divisibility_case_one_triple_succ, ih, Function.iterate_succ_apply']
  4. For all eight 3-bit states, the 6th iterate of the transition equals the 2nd iterate. automation

    Decided by finite exhaustive computation over all 2^3 = 8 possible Boolean triples.

    line 40

            seeded_subtraction_period_divisibility_case_one_step^[2] t := by decide
  5. For every state and each shift p ∈ {1, 2, 3}, there is a witness index where the shifted sequence value differs. automation

    Decided by finite exhaustive computation over all 8 triples and 3 candidate periods.

    line 47

            (seeded_subtraction_period_divisibility_case_one_step^[2 + n.val] t).1 := by decide
  6. From index 2 onwards, the sequence repeats with period 4: w(n+4) = w(n).

    Expressing the window at n+4 as the (n+4)-fold iterate of the transition on the seed, we decompose n+4 as (n-2)+6 via Function.iterate_add_apply. Since T^6 = T^2 on all states by seeded_subtraction_period_divisibility_case_one_step_six, this simplifies to the n-fold iterate, which is the window at n. Taking the first component via congrArg gives w(n+4) = w(n).

    lines 52–63

    uses seeded_subtraction_period_divisibility_case_one_triple_iterate, Function.iterate_add_apply, seeded_subtraction_period_divisibility_case_one_step_six, congrArg

      have key : seeded_subtraction_period_divisibility_case_one_triple seed (n+4) =
          seeded_subtraction_period_divisibility_case_one_triple seed n := by
        calc seeded_subtraction_period_divisibility_case_one_triple seed (n+4)
            = seeded_subtraction_period_divisibility_case_one_step^[n+4] (seeded_subtraction_period_divisibility_case_one_triple seed 0) := seeded_subtraction_period_divisibility_case_one_triple_iterate seed (n+4)
          _ = seeded_subtraction_period_divisibility_case_one_step^[n-2] (seeded_subtraction_period_divisibility_case_one_step^[6] (seeded_subtraction_period_divisibility_case_one_triple seed 0)) := by
                rw [show n + 4 = (n - 2) + 6 from by omega, Function.iterate_add_apply]
          _ = seeded_subtraction_period_divisibility_case_one_step^[n-2] (seeded_subtraction_period_divisibility_case_one_step^[2] (seeded_subtraction_period_divisibility_case_one_triple seed 0)) := by
                rw [seeded_subtraction_period_divisibility_case_one_step_six]
          _ = seeded_subtraction_period_divisibility_case_one_step^[(n-2)+2] (seeded_subtraction_period_divisibility_case_one_triple seed 0) := by rw [← Function.iterate_add_apply]
          _ = seeded_subtraction_period_divisibility_case_one_step^[n] (seeded_subtraction_period_divisibility_case_one_triple seed 0) := by rw [show (n-2)+2 = n from by omega]
          _ = seeded_subtraction_period_divisibility_case_one_triple seed n := (seeded_subtraction_period_divisibility_case_one_triple_iterate seed n).symm
      exact congrArg Prod.fst key
  7. For any index m ≥ 2, shifting by any multiple of 4 leaves the sequence value invariant: w(m + 4k) = w(m).

    By induction on k. The base case k = 0 is trivial. For the induction step, we rewrite m + 4(j+1) as (m + 4j) + 4 and apply seeded_subtraction_period_divisibility_case_one_period_four together with the inductive hypothesis.

    lines 68–72

    uses seeded_subtraction_period_divisibility_case_one_period_four

      induction k with
      | zero => simp
      | succ j ih =>
          have hstep : m + 4*(j+1) = (m + 4*j) + 4 := by ring
          rw [hstep, seeded_subtraction_period_divisibility_case_one_period_four seed (m+4*j) (by omega), ih]
  8. 4 is an eventual period of the sequence.

    4 is strictly positive (checked by decide) and setting the eventual threshold to N = 2 satisfies the periodicity condition by seeded_subtraction_period_divisibility_case_one_period_four.

    lines 75–77

    uses seeded_subtraction_period_divisibility_case_one_period_four

    theorem seeded_subtraction_period_divisibility_case_one_eventual_four (seed : Fin 3 → Bool) :
        is_eventual_period (seeded_subtraction_seq 1 seed) 4 :=
      ⟨by decide, 2, fun n hn => seeded_subtraction_period_divisibility_case_one_period_four seed n hn⟩
  9. No integer p with 1 ≤ p ≤ 3 can be an eventual period of the sequence.

    Assuming p were an eventual period with threshold N, seeded_subtraction_period_divisibility_case_one_witness provides an offset n < 5 such that w(a) ≠ w(b) for a = 2 + n and b = 2 + n + p. But since a + 4N ≥ N, periodicity implies w((a + 4N) + p) = w(a + 4N), so w(b + 4N) = w(a + 4N). By seeded_subtraction_period_divisibility_case_one_period_mult, w(b + 4N) = w(b) and w(a + 4N) = w(a), forcing w(b) = w(a), a contradiction.

    lines 82–111

    uses seeded_subtraction_period_divisibility_case_one_witness, seeded_subtraction_period_divisibility_case_one_triple_iterate, seeded_subtraction_period_divisibility_case_one_period_mult

      rintro ⟨_, N, hN⟩
      have hp3 : p - 1 < 3 := by omega
      obtain ⟨n, hn⟩ := seeded_subtraction_period_divisibility_case_one_witness
        (seeded_subtraction_period_divisibility_case_one_triple seed 0) ⟨p-1, hp3⟩
      have hval : (⟨p-1, hp3⟩ : Fin 3).val + 1 = p := by simp; omega
      rw [hval] at hn
      have hv : ∀ k : ℕ,
          (seeded_subtraction_period_divisibility_case_one_step^[k] (seeded_subtraction_period_divisibility_case_one_triple seed 0)).1 =
            seeded_subtraction_seq 1 seed k := by
        intro k
        rw [← seeded_subtraction_period_divisibility_case_one_triple_iterate]
        rfl
      have hmismatch : seeded_subtraction_seq 1 seed (2 + n.val + p) ≠ seeded_subtraction_seq 1 seed (2 + n.val) := by
        rw [← hv (2+n.val+p), ← hv (2+n.val)]
        exact hn
      set a := 2 + n.val with ha
      set b := 2 + n.val + p with hb
      have ha2 : 2 ≤ a := by omega
      have hb2 : 2 ≤ b := by omega
      have h1 : seeded_subtraction_seq 1 seed ((a + 4*N) + p) = seeded_subtraction_seq 1 seed (a + 4*N) := hN _ (by omega)
      have h2 : seeded_subtraction_seq 1 seed (a + 4*N) = seeded_subtraction_seq 1 seed a := seeded_subtraction_period_divisibility_case_one_period_mult seed a ha2 N
      have h3 : seeded_subtraction_seq 1 seed (b + 4*N) = seeded_subtraction_seq 1 seed b := seeded_subtraction_period_divisibility_case_one_period_mult seed b hb2 N
      have heq : (a + 4*N) + p = b + 4*N := by omega
      rw [heq] at h1
      have hfinal : seeded_subtraction_seq 1 seed b = seeded_subtraction_seq 1 seed a := by
        calc seeded_subtraction_seq 1 seed b
            = seeded_subtraction_seq 1 seed (b + 4*N) := h3.symm
          _ = seeded_subtraction_seq 1 seed (a + 4*N) := h1
          _ = seeded_subtraction_seq 1 seed a := h2
      exact hmismatch hfinal
  10. The least eventual period of the sequence is exactly 4.

    The set of eventual periods is nonempty because 4 is an eventual period (by seeded_subtraction_period_divisibility_case_one_eventual_four), so its infimum is at most 4 by Nat.sInf_le and belongs to the set by Nat.sInf_mem. If the infimum were strictly less than 4, it would be in {1, 2, 3} (using Nat.lt_of_not_le), contradicting seeded_subtraction_period_divisibility_case_one_not_eventual_lt_four. Thus it equals 4 by le_antisymm.

    lines 116–125

    uses seeded_subtraction_period_divisibility_case_one_eventual_four, Nat.sInf_mem, Nat.sInf_le, Nat.lt_of_not_le, seeded_subtraction_period_divisibility_case_one_not_eventual_lt_four, le_antisymm

      unfold least_eventual_period
      set S := {p : ℕ | is_eventual_period (seeded_subtraction_seq 1 seed) p} with hS
      have hne : S.Nonempty := ⟨4, seeded_subtraction_period_divisibility_case_one_eventual_four seed⟩
      have hmem : sInf S ∈ S := Nat.sInf_mem hne
      have hle : sInf S ≤ 4 := Nat.sInf_le (seeded_subtraction_period_divisibility_case_one_eventual_four seed)
      apply le_antisymm hle
      by_contra hcon
      have hlt : sInf S < 4 := Nat.lt_of_not_le hcon
      have hpos : 0 < sInf S := hmem.1
      exact seeded_subtraction_period_divisibility_case_one_not_eventual_lt_four seed (sInf S) hpos (by omega) hmem
  11. Every length-3 binary seed generates a sequence with least eventual period 4, dividing 3(1) + 1.

    The conjunction splits into two goals: first, that the least eventual period is 4, which is seeded_subtraction_period_divisibility_case_one_least_period; second, that 4 divides 3(1) or 3(1) + 1 = 4, where the right disjunct holds since 4 divides 4.

    lines 133–139

    uses seeded_subtraction_period_divisibility_case_one_least_period

      constructor
      · intro seed
        exact seeded_subtraction_period_divisibility_case_one_least_period seed
      · intro seed
        rw [seeded_subtraction_period_divisibility_case_one_least_period seed]
        right
        norm_num
dif_neg
A dependent if-then-else evaluates to its else branch when the condition is false.
seeded_subtraction_period_divisibility_case_one_rec
For indices at least 3, the subtraction sequence satisfies w(n) = ¬w(n-1) ∨ ¬w(n-2) ∨ ¬w(n-3).
seeded_subtraction_period_divisibility_case_one_triple_succ
Shifting the window of three values by one index corresponds to applying the state transition step.
Function.iterate_succ_apply'
Iterating a function n+1 times is the same as applying the function to the n-fold iterate.
Function.iterate_add_apply
Composing the m-fold and n-fold iterates of a function gives the (m+n)-fold iterate.
seeded_subtraction_period_divisibility_case_one_step_six
The transition operator on 3-bit states satisfies T^6 = T^2.
seeded_subtraction_period_divisibility_case_one_triple_iterate
The sliding window at index n is the n-fold iterate of the transition operator applied to the initial triple.
congrArg
Applying a function to equal inputs yields equal outputs.
seeded_subtraction_period_divisibility_case_one_period_four
From index 2 onwards, the sequence repeats every 4 steps: w(n+4) = w(n).
seeded_subtraction_period_divisibility_case_one_period_mult
From index 2 onwards, shifting by any multiple of 4 leaves the sequence value unchanged: w(m+4k) = w(m).
seeded_subtraction_period_divisibility_case_one_eventual_four
4 is an eventual period of the sequence.
seeded_subtraction_period_divisibility_case_one_witness
For any initial state and any candidate period p ∈ {1, 2, 3}, there is an index within 5 steps where the sequence disagrees under a shift by p.
seeded_subtraction_period_divisibility_case_one_not_eventual_lt_four
No integer p between 1 and 3 can be an eventual period of the sequence.
Nat.sInf_mem
The infimum of a nonempty set of natural numbers belongs to the set.
Nat.sInf_le
The infimum of a set of natural numbers is less than or equal to any element of the set.
le_antisymm
Two values that are less than or equal to each other are equal.
Nat.lt_of_not_le
If a natural number is not less than or equal to another, then the other is strictly smaller.
seeded_subtraction_period_divisibility_case_one_least_period
The least eventual period of the sequence is exactly 4.

Written by a model (gemini-3.8-flash) from the Lean proof and the goal states Lean reported at each step. Lean verified the proof; this explanation is a reading aid and is not itself machine-checked.

Lean source view module on GitHub

/-- The state transition for the a=1 subtraction recurrence acting on the last-three-values triple. -/def seeded_subtraction_period_divisibility_case_one_step (t : Bool × Bool × Bool) : Bool × Bool × Bool :=  (t.2.1, t.2.2, !t.2.2 || !t.2.1 || !t.1)/-- The window `(w n, w (n+1), w (n+2))` of the generated sequence. -/def seeded_subtraction_period_divisibility_case_one_triple (seed : Fin 3 → Bool) (n : ℕ) : Bool × Bool × Bool :=  (seeded_subtraction_seq 1 seed n, seeded_subtraction_seq 1 seed (n+1), seeded_subtraction_seq 1 seed (n+2))/-- Unfolding the recurrence for `a = 1` at indices at least 3. -/theorem seeded_subtraction_period_divisibility_case_one_rec (seed : Fin 3 → Bool) (n : ℕ) (h : 3 ≤ n) :    seeded_subtraction_seq 1 seed n =      (!seeded_subtraction_seq 1 seed (n-1) || !seeded_subtraction_seq 1 seed (n-2) || !seeded_subtraction_seq 1 seed (n-3)) := by  conv_lhs => rw [seeded_subtraction_seq]  dsimp only  rw [dif_neg (by omega : ¬ n < 2 * 1 + 1)]  rw [dif_neg (by decide : ¬ (1 = 0))]/-- Shifting the window by one applies the state transition. -/theorem seeded_subtraction_period_divisibility_case_one_triple_succ (seed : Fin 3 → Bool) (n : ℕ) :    seeded_subtraction_period_divisibility_case_one_triple seed (n+1) =      seeded_subtraction_period_divisibility_case_one_step (seeded_subtraction_period_divisibility_case_one_triple seed n) := by  unfold seeded_subtraction_period_divisibility_case_one_triple seeded_subtraction_period_divisibility_case_one_step  simp only  rw [seeded_subtraction_period_divisibility_case_one_rec seed (n+3) (by omega)]  simp/-- The window at index `n` is the `n`-fold iterate of the transition applied to the seed. -/theorem seeded_subtraction_period_divisibility_case_one_triple_iterate (seed : Fin 3 → Bool) (n : ℕ) :    seeded_subtraction_period_divisibility_case_one_triple seed n =      seeded_subtraction_period_divisibility_case_one_step^[n] (seeded_subtraction_period_divisibility_case_one_triple seed 0) := by  induction n with  | zero => simp  | succ k ih =>      rw [seeded_subtraction_period_divisibility_case_one_triple_succ, ih, Function.iterate_succ_apply']/-- The transition satisfies `T^6 = T^2` on all triples. -/theorem seeded_subtraction_period_divisibility_case_one_step_six :    ∀ t : Bool × Bool × Bool,      seeded_subtraction_period_divisibility_case_one_step^[6] t =        seeded_subtraction_period_divisibility_case_one_step^[2] t := by decide/-- The four-term block of values starting at any index at least 2 is not invariant under shifts by 1, 2, or 3. -/theorem seeded_subtraction_period_divisibility_case_one_witness :    ∀ t : Bool × Bool × Bool, ∀ p : Fin 3,      ∃ n : Fin 5,        (seeded_subtraction_period_divisibility_case_one_step^[2 + n.val + (p.val + 1)] t).1 ≠        (seeded_subtraction_period_divisibility_case_one_step^[2 + n.val] t).1 := by decide/-- Every value from index 2 onwards repeats with period 4. -/theorem seeded_subtraction_period_divisibility_case_one_period_four (seed : Fin 3 → Bool) (n : ℕ) (hn : 2 ≤ n) :    seeded_subtraction_seq 1 seed (n+4) = seeded_subtraction_seq 1 seed n := by  have key : seeded_subtraction_period_divisibility_case_one_triple seed (n+4) =      seeded_subtraction_period_divisibility_case_one_triple seed n := by    calc seeded_subtraction_period_divisibility_case_one_triple seed (n+4)        = seeded_subtraction_period_divisibility_case_one_step^[n+4] (seeded_subtraction_period_divisibility_case_one_triple seed 0) := seeded_subtraction_period_divisibility_case_one_triple_iterate seed (n+4)      _ = seeded_subtraction_period_divisibility_case_one_step^[n-2] (seeded_subtraction_period_divisibility_case_one_step^[6] (seeded_subtraction_period_divisibility_case_one_triple seed 0)) := by            rw [show n + 4 = (n - 2) + 6 from by omega, Function.iterate_add_apply]      _ = seeded_subtraction_period_divisibility_case_one_step^[n-2] (seeded_subtraction_period_divisibility_case_one_step^[2] (seeded_subtraction_period_divisibility_case_one_triple seed 0)) := by            rw [seeded_subtraction_period_divisibility_case_one_step_six]      _ = seeded_subtraction_period_divisibility_case_one_step^[(n-2)+2] (seeded_subtraction_period_divisibility_case_one_triple seed 0) := by rw [← Function.iterate_add_apply]      _ = seeded_subtraction_period_divisibility_case_one_step^[n] (seeded_subtraction_period_divisibility_case_one_triple seed 0) := by rw [show (n-2)+2 = n from by omega]      _ = seeded_subtraction_period_divisibility_case_one_triple seed n := (seeded_subtraction_period_divisibility_case_one_triple_iterate seed n).symm  exact congrArg Prod.fst key/-- Shifting an index at least 2 by any multiple of 4 leaves the value unchanged. -/theorem seeded_subtraction_period_divisibility_case_one_period_mult (seed : Fin 3 → Bool) (m : ℕ) (hm : 2 ≤ m) (k : ℕ) :    seeded_subtraction_seq 1 seed (m + 4*k) = seeded_subtraction_seq 1 seed m := by  induction k with  | zero => simp  | succ j ih =>      have hstep : m + 4*(j+1) = (m + 4*j) + 4 := by ring      rw [hstep, seeded_subtraction_period_divisibility_case_one_period_four seed (m+4*j) (by omega), ih]/-- 4 is an eventual period of every sequence generated with `a = 1`. -/theorem seeded_subtraction_period_divisibility_case_one_eventual_four (seed : Fin 3 → Bool) :    is_eventual_period (seeded_subtraction_seq 1 seed) 4 :=  ⟨by decide, 2, fun n hn => seeded_subtraction_period_divisibility_case_one_period_four seed n hn⟩/-- No `p` with `1 ≤ p ≤ 3` is an eventual period, because within each period-4 block the lone `false` shifts. -/theorem seeded_subtraction_period_divisibility_case_one_not_eventual_lt_four (seed : Fin 3 → Bool) (p : ℕ) (hp : 0 < p) (hp4 : p ≤ 3) :    ¬ is_eventual_period (seeded_subtraction_seq 1 seed) p := by  rintro ⟨_, N, hN⟩  have hp3 : p - 1 < 3 := by omega  obtain ⟨n, hn⟩ := seeded_subtraction_period_divisibility_case_one_witness    (seeded_subtraction_period_divisibility_case_one_triple seed 0) ⟨p-1, hp3⟩  have hval : (⟨p-1, hp3⟩ : Fin 3).val + 1 = p := by simp; omega  rw [hval] at hn  have hv : ∀ k : ℕ,      (seeded_subtraction_period_divisibility_case_one_step^[k] (seeded_subtraction_period_divisibility_case_one_triple seed 0)).1 =        seeded_subtraction_seq 1 seed k := by    intro k    rw [← seeded_subtraction_period_divisibility_case_one_triple_iterate]    rfl  have hmismatch : seeded_subtraction_seq 1 seed (2 + n.val + p) ≠ seeded_subtraction_seq 1 seed (2 + n.val) := by    rw [← hv (2+n.val+p), ← hv (2+n.val)]    exact hn  set a := 2 + n.val with ha  set b := 2 + n.val + p with hb  have ha2 : 2 ≤ a := by omega  have hb2 : 2 ≤ b := by omega  have h1 : seeded_subtraction_seq 1 seed ((a + 4*N) + p) = seeded_subtraction_seq 1 seed (a + 4*N) := hN _ (by omega)  have h2 : seeded_subtraction_seq 1 seed (a + 4*N) = seeded_subtraction_seq 1 seed a := seeded_subtraction_period_divisibility_case_one_period_mult seed a ha2 N  have h3 : seeded_subtraction_seq 1 seed (b + 4*N) = seeded_subtraction_seq 1 seed b := seeded_subtraction_period_divisibility_case_one_period_mult seed b hb2 N  have heq : (a + 4*N) + p = b + 4*N := by omega  rw [heq] at h1  have hfinal : seeded_subtraction_seq 1 seed b = seeded_subtraction_seq 1 seed a := by    calc seeded_subtraction_seq 1 seed b        = seeded_subtraction_seq 1 seed (b + 4*N) := h3.symm      _ = seeded_subtraction_seq 1 seed (a + 4*N) := h1      _ = seeded_subtraction_seq 1 seed a := h2  exact hmismatch hfinal/-- The least eventual period of every sequence generated with `a = 1` is exactly 4. -/theorem seeded_subtraction_period_divisibility_case_one_least_period (seed : Fin 3 → Bool) :    least_eventual_period (seeded_subtraction_seq 1 seed) = 4 := by  unfold least_eventual_period  set S := {p : ℕ | is_eventual_period (seeded_subtraction_seq 1 seed) p} with hS  have hne : S.Nonempty := ⟨4, seeded_subtraction_period_divisibility_case_one_eventual_four seed⟩  have hmem : sInf S ∈ S := Nat.sInf_mem hne  have hle : sInf S ≤ 4 := Nat.sInf_le (seeded_subtraction_period_divisibility_case_one_eventual_four seed)  apply le_antisymm hle  by_contra hcon  have hlt : sInf S < 4 := Nat.lt_of_not_le hcon  have hpos : 0 < sInf S := hmem.1  exact seeded_subtraction_period_divisibility_case_one_not_eventual_lt_four seed (sInf S) hpos (by omega) hmem/-- For a = 1, every seed of length 3 generates a sequence with least eventual period 4, dividing 3(1)+1. -/theorem seeded_subtraction_period_divisibility_case_one :    (∀ seed : Fin 3 → Bool, least_eventual_period (seeded_subtraction_seq 1 seed) = 4) ∧    (∀ seed : Fin 3 → Bool,      least_eventual_period (seeded_subtraction_seq 1 seed) ∣ 3 * 1 ∨      least_eventual_period (seeded_subtraction_seq 1 seed) ∣ 3 * 1 + 1) := by  constructor  · intro seed    exact seeded_subtraction_period_divisibility_case_one_least_period seed  · intro seed    rw [seeded_subtraction_period_divisibility_case_one_least_period seed]    right    norm_num
See it in the graphDiscuss this resultChallenge it