AFTD Auto-Formalizing Theoretical Domains

seeded_subtraction_seq_initial

theoremverified

The value of the seeded subtraction sequence at any index $i < 2a + 1$ is equal to the corresponding seed value $\text{seed}(i)$.

Statement

theorem seeded_subtraction_seq_initial (a : ℕ) (seed : Fin (2 * a + 1) → Bool) (i : Fin (2 * a + 1)) :
    seeded_subtraction_seq a seed i.val = seed i
Source
knowledgebase, OP-1251
Verified
08 Nov 2026
Axioms
Classical.choiceQuot.soundpropext
Built on 1
  • 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…

Read back from the Lean

For every natural number $a$, every seed function $seed : \text{Fin}(2a + 1) \to \text{Bool}$, and every index $i \in \text{Fin}(2a + 1)$, the sequence $\text{seeded\_subtraction\_seq}(a, seed)$ evaluated at the natural number $i.\text{val}$ is equal to $seed(i)$.

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 evaluates the definition of the seeded subtraction sequence at an index within the seed window. By definition, the sequence checks whether the index is strictly less than $2a + 1$; since the index $i$ is drawn from $\text{Fin}(2a + 1)$, this condition holds automatically. Reducing the conditional expression to its true branch yields the initial seed value $\text{seed}(i)$.

  1. The sequence value `seeded_subtraction_seq a seed i.val` equals `seed i`.

    Unfold the definition of `seeded_subtraction_seq` via its defining equation `seeded_subtraction_seq.eq_1`. Since `i` belongs to `Fin (2 * a + 1)`, its numerical value `i.val` satisfies `i.val < 2 * a + 1` (given by `i.isLt`). Rewriting with `dif_pos` applied to this inequality selects the `then`-branch, which evaluates directly to `seed i`.

    line 4

    uses seeded_subtraction_seq.eq_1, dif_pos

      rw [seeded_subtraction_seq.eq_1, dif_pos i.isLt]
seeded_subtraction_seq.eq_1
The defining equation of `seeded_subtraction_seq`, stating that for an input `x`, the function evaluates to `seed ⟨x, h⟩` if `x < 2 * a + 1` (with proof `h`), and to a recursively defined boolean combination otherwise.
dif_pos
A dependent if-then-else expression evaluates to its `then` branch when provided with a proof that the condition holds.

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 initial window of length 2a+1 of the seeded subtraction sequence coincides with the seed. -/theorem seeded_subtraction_seq_initial (a : ℕ) (seed : Fin (2 * a + 1) → Bool) (i : Fin (2 * a + 1)) :    seeded_subtraction_seq a seed i.val = seed i := by  rw [seeded_subtraction_seq.eq_1, dif_pos i.isLt]
See it in the graphDiscuss this resultChallenge it