Documentation

CslibFrontier.Foundations.Data.List.SortedAssoc.Flatten

Range restriction of a concatenation of sorted association lists #

A sorted association list that is stored as a sequence of non-empty blocks, such as the leaves of a B+-tree, is restricted to a closed interval block by block. The blocks that contribute form a contiguous run, and every block of the run other than its first and last is kept whole.

Main result #

theorem Cslib.SortedAssoc.exists_run_range_flatten {α : Type u} {β : Type v} [LinearOrder α] {L : List (List (α × β))} (hs : L.flatten.IsSortedAssoc) (hne : ∀ l ∈ L, l ≠ []) (lo hi : α) :
∃ (pre : List (List (α × β))) (run : List (List (α × β))) (post : List (List (α × β))), L = pre ++ run ++ post ∧ range lo hi L.flatten = (List.map (range lo hi) run).flatten ∧ (∀ l ∈ run, range lo hi l ≠ []) ∧ ∀ l ∈ (List.drop 1 run).dropLast, range lo hi l = l

Restricting a concatenation of non-empty blocks with strictly increasing keys to a closed interval: the blocks split as a prefix, a run and a suffix such that the restriction is that of the run, every block of the run contributes, and every block of the run other than its first and last is kept whole.