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_flatMapList.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_le
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.
theorem
List.filter_length_lt_of_imp_witness
{α : Type u_1}
{L : List α}
{P Q : α → Bool}
{a : α}
(h_imp : ∀ (x : α), x ∈ L → P x = true → Q x = true)
(h_in : a ∈ L)
(hQa : Q a = true)
(hPa : ¬P a = true)
:
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.
theorem
List.foldl_zip_congr
{α : Type u_1}
{β : Type u_2}
{γ : Type u_3}
(f : γ → α → β → γ)
(l₁ l₁' : List α)
(l₂ l₂' : List β)
(h_len₁ : l₁.length = l₁'.length)
(h_len₂ : l₂.length = l₂'.length)
(h_f : ∀ (i : Nat) (hi₁ : i < l₁.length) (hi₂ : i < l₂.length) (acc : γ), f acc l₁[i] l₂[i] = f acc l₁'[i] l₂'[i])
(init : γ)
:
foldl over zipped lists is congruent when the function produces equal
results on corresponding elements.