odd_run_aux
def
odd_run_aux inRun oddLen l scans the boolean list l left to right, keeping a flag inRun (currently inside a run of trues) and oddLen (that run has odd length so far), and returns the number of completed runs of true of odd length.
Statement
def odd_run_aux : Bool → Bool → List Bool → ℕ- Source
- step towards claw_free_tree_graph_state_mmi
- Verified
- 01 Nov 2026
- Axioms
- none listed
- Used by 4
- path_cut_word_odd_run_ineqFor a four-partition A,B,C,D of the vertices of the path P_n, the sum of the numbers of maximal odd-length crossing runs for A, B, C and D…
- pathOddRunFinish_identityThe pending parity counter agrees with the existing odd-run counter.
- pathGreedyRun_eq_count_and_oddTwice the greedy count equals the number of true edges plus the number of odd true runs.
- odd_run_count
odd_run_count lis the number of maximal runs oftruein the boolean wordlwhose length is odd. The finalfalseis appended so…
Lean source view module on GitHub
/-- Scanning accumulator counting completed odd-length runs of `true`. -/ def odd_run_aux : Bool → Bool → List Bool → ℕ := fun inRun oddLen l => match l with | [] => 0 | b :: t => match b with | true => odd_run_aux true (cond inRun (Bool.not oddLen) true) t | false => (cond (inRun && oddLen) 1 0) + odd_run_aux false false t