List counts and scan bounds #
Main results #
List.length_flatMap_le: blocks of bounded length have bounded total length.List.length_flatMap_of_forall_length_eq: blocks of a common lengthkhave total length|l| k.List.decide_mem_eq_any: membership as a scan of the list.List.not_any_one_lt_countP_iff_nodup: duplicate-freeness as a scan of the list.List.countP_and_not_add_countP_and: members satisfying one predicate split by whether they satisfy another.List.existsUnique_fin_of_countP_eq_one,List.existsUnique_mem_of_countP_eq_one: a Boolean predicate withcountPequal to1holds at a unique list index and at a unique member.
Duplicate-freeness as a scan of the list: no member occurs more than once, counted with
countP. This is the form in which polynomial-time tests for repetitions are certified.
theorem List.countP_and_not_add_countP_and {α : Type u_1} (p q : α → Prop) [DecidablePred p] [DecidablePred q] (l : List α) :
Partitioning the elements of a list satisfying p by whether they satisfy q.