Documentation

HexBasic.List

theorem List.nodup_flatMap_of_disjoint {α : Type u_1} {β : Type u_2} {xs : List α} {f : αList β} (hxs : xs.Nodup) (hrow : ∀ (x : α), x xs(f x).Nodup) (hdisj : ∀ (x : α), x xs∀ (y : α), y xsx y∀ (z : β), z f xz f yFalse) :
(flatMap f xs).Nodup

A flat map is duplicate-free when every row is duplicate-free and rows coming from distinct source elements are disjoint.

theorem List.compareLex_zipWith {α : Type u_1} {β : Type u_2} (cmp : ααOrdering) (f : αβα) (hcmp : ∀ (a b : α) (c : β), cmp a b = cmp (f a c) (f b c)) (as bs : List α) (cs : List β) :
as.length = bs.lengthas.length = cs.lengthList.compareLex cmp as bs = List.compareLex cmp (zipWith f as cs) (zipWith f bs cs)

Lexicographic comparison is unchanged by pointwise combining both lists with the same third list when the element comparison has the corresponding invariance. The length hypotheses ensure zipWith does not truncate.