AFTD Auto-Formalizing Theoretical Domains

alternating_word

def

Given a natural number n and a boolean start, alternating_word n start is the function from Fin n to Bool that maps each index i : Fin n to start if i.val % 2 = 0, and to !start otherwise.

Statement

def alternating_word (n : ℕ) (start : Bool) : Fin n → Bool
Defined in
arXiv:2611.01064, Section 2
Verified
03 Nov 2026
Axioms
none listed
Used by 2
  • min_two_insertion_collision_five_lt_alternatingThe minimum two-insertion collision sum min_two_insertion_collision 5 is strictly less than two_insertion_collision 3 (alternating_word 5…
  • is_alternating_wordFor a function w : Fin n → Bool, is_alternating_word w asserts that w equals alternating_word n false or w equals alternating_word n true.

Read back from the Lean

The definition alternating_word, which takes a natural number n and a boolean start, and produces a function from Fin n to Bool (representing a boolean word of length n). For any index i : Fin n, the i-th value is start if i.val % 2 = 0 (i.e., i is even), and !start (the boolean negation of start) otherwise (i.e., i is odd).

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

Lean source view module on GitHub

/-- The alternating binary word of length n starting with a given bit. -/
def alternating_word (n : ℕ) (start : Bool) : Fin n → Bool := fun i => if i.val % 2 = 0 then start else !start
See it in the graphDiscuss this resultChallenge it