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
- is_longest_word_run_of_constantFor any constant word y on Fin n with 1 ≤ n, the interval [0, n) is a longest run of y.
- op_1537_binary_length_two_one_deletionFor any nonconstant binary word y : Fin 2 → Fin 2 of length 2, there exists a longest run [a, b) of y and an immediately adjacent run [a',…
- op_1537_ternary_length_two_one_deletionFor any nonconstant ternary word y : Fin 2 → Fin 3 of length 2, there exists a longest run [a, b) of y and an immediately adjacent run…
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