AFTD Auto-Formalizing Theoretical Domains

mask_u_runs

def

The number of maximal nonempty U-runs in a binary mask M is defined by mask_u_runs M = mask_u_runs_aux false M, counting contiguous blocks of true starting with initial previous label false.

Statement

def mask_u_runs (M : List Bool) : ℕ
Defined in
arXiv:2610.39941, Section 3
Verified
31 Oct 2026
Axioms
none listed
Built on 1
  • mask_u_runs_auxAuxiliary recursive function mask_u_runs_aux prev bs taking a previous boolean label prev and a list of booleans bs, returning the number…
Used by 5
  • word_block_exchange_cThe commuting minimum degree word_block_exchange_c E u v is the infimum in WithTop Nat of mask_u_runs N over all commuting masks N of the…
  • mask_u_runs_nilAn empty binary mask has zero U-runs: mask_u_runs [] = 0.
  • word_block_exchange_bThe noncommuting minimum degree word_block_exchange_b E u v is the infimum in WithTop Nat of mask_u_runs N over all noncommuting masks N…
  • word_block_exchange_is_pureAn exchange E = (X, A, B, Y) swaps adjacent pure blocks of opposite sources from mask M if A and B are nonempty, either the slice of M for…
  • word_insertion_degreeThe minimum insertion degree word_insertion_degree u v w of word w with respect to source words u and v is the infimum in WithTop Nat of…

Read back from the Lean

The function mask_u_runs takes a list of booleans M and returns a natural number, defined as mask_u_runs_aux false M. This counts the number of maximal contiguous runs of true values in M (or equivalently, the number of transitions from false to true, treating the list as if it were preceded by false).

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 number of maximal nonempty U-runs (contiguous blocks of true) in a binary mask. -/
def mask_u_runs (M : List Bool) : ℕ :=
  mask_u_runs_aux false M
See it in the graphDiscuss this resultChallenge it