AFTD Auto-Formalizing Theoretical Domains

is_longest_word_run

deforiginal

A run [a, b) of a word y : Fin n → α is a longest run if its length b - a is greater than or equal to the length b' - a' of every run [a', b') of y.

Statement

def is_longest_word_run {n : ℕ} {α : Type*} (y : Fin n → α) (a b : ℕ) : Prop
Related work
folklore
Verified
11 Nov 2026
Axioms
none listed
Built on 1
  • is_word_runA pair of indices 0 ≤ a < b ≤ n forms a run [a, b) of a word y : Fin n → α if all symbols y i for a ≤ i < b are equal, and the block…
Used by 3

Read back from the Lean

Given a sequence y : Fin n → α of length n and indices a, b : ℕ, is_longest_word_run y a b asserts that [a, b) is a maximal contiguous constant run in y (is_word_run y a b), and for all a', b' : ℕ, if [a', b') is also a maximal contiguous constant run in y (is_word_run y a' b'), then b' - a' ≤ b - a (that is, no maximal run in y is strictly longer than [a, b)).

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

/-- A run [a, b) of y is a longest run if its length b - a is at least the length of every run of y. -/
def is_longest_word_run {n : ℕ} {α : Type*} (y : Fin n → α) (a b : ℕ) : Prop := is_word_run y a b ∧ ∀ a' b' : ℕ, is_word_run y a' b' → b' - a' ≤ b - a
See it in the graphDiscuss this resultChallenge it