AFTD Auto-Formalizing Theoretical Domains

odd_run_count

def

odd_run_count l is the number of maximal runs of true in the boolean word l whose length is odd. The final false is appended so that a trailing run is also completed.

Statement

def odd_run_count (l : List Bool) : ℕ
Source
step towards claw_free_tree_graph_state_mmi
Verified
01 Nov 2026
Axioms
none listed
Built on 1
  • odd_run_auxodd_run_aux inRun oddLen l scans the boolean list l left to right, keeping a flag inRun (currently inside a run of trues) and…
Used by 3
  • 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…
  • pathGreedyRun_eq_count_and_oddTwice the greedy count equals the number of true edges plus the number of odd true runs.
  • pathCertOddRunIneqFor any four-color path word, the signed sum of odd crossing-run counts for the seven masks is nonpositive.

Lean source view module on GitHub

/-- Number of maximal odd-length runs of `true` in a boolean word. -/
def odd_run_count (l : List Bool) : ℕ := odd_run_aux false false (l ++ [false])
See it in the graphDiscuss this resultChallenge it