Properties of list utilities #
Miscellaneous list lemmas: Forall/Rel₂, Disj, Subset,
removeAll/replaceAll, uniq, and zip/map results.
Key theorems #
List.Forall_mem_iff,List.Forall_append,List.Forall_flatMap,List.all_mono,List.forall_of_all_decideList.Disjoint_app,List.Disjoint_Nodup_iffList.nodup_uniq,List.length_dedup_of_subset_leList.length_eq_of_nodup_of_mem_iff,List.inj_implies_nodup,List.sum_size_leList.nodupB_eq_true_iff— the linearnodupBcheck decidesNodupList.mem_groupValuesByKey,List.of_mem_groupValuesByKey— membership ingroupValuesByKey
Nodup / membership length lemmas #
A deduplicated list satisfies Nodup.
The upper bound of the length of a deduplicated list is the length of the original list.
An element a is in a list l iff it is in the deduplicated version
of l.
If P x → Q x for all x ∈ L, and there is a witness a ∈ L with Q a but ¬P a,
then (L.filter P).length < (L.filter Q).length.
foldl over zipped lists is congruent when the function produces equal
results on corresponding elements.
nodupB decides List.Nodup: it accepts a list exactly when the list has no
duplicate elements.
Zip / map lemmas #
After inserting key d ↦ val d into m for each d ∈ l, a lookup finds a value some d
contributed or one m held.
Searching key-aligned, pointwise-related association lists for a key fails on both or finds related values.
If f and g fail together or give R-related results on each element, so do their
findSome? searches.
An injective map preserves duplicate-freedom.
Looking a key up in zips of one key list with position-wise R-related value lists misses
in both or finds R-related values.
If on R-related entries f and g both decline or give S-related results, then
filterMap takes R-related lists to S-related lists.