mask_u_runs_aux
Auxiliary recursive function mask_u_runs_aux prev bs taking a previous boolean label prev and a list of booleans bs, returning the number of transitions from false to true in bs, where an empty list has 0 transitions, and a cons b :: bs adds 1 if prev is false and b is true, then recurses with prev replaced by b.
Statement
def mask_u_runs_aux (prev : Bool) : List Bool → ℕ- Defined in
- arXiv:2610.39941, Section 4
- Verified
- 31 Oct 2026
- Axioms
- none listed
- Used by 1
- mask_u_runsThe 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…
Read back from the Lean
A definition of the function mask_u_runs_aux : Bool → List Bool → ℕ by structural recursion on the list:
- mask_u_runs_aux prev [] = 0
- mask_u_runs_aux prev (b :: bs) = (if (!prev && b) then 1 else 0) + mask_u_runs_aux b bs
That is, given an initial boolean prev and a list of booleans, it counts the number of transitions from false to true in the list, treating prev as the value immediately preceding the first element.
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
/-- Auxiliary function to count maximal contiguous true runs in a binary list. -/ def mask_u_runs_aux (prev : Bool) : List Bool → ℕ | [] => 0 | b :: bs => (if !prev && b then 1 else 0) + mask_u_runs_aux b bs