Correctness of van Emde Boas insertion #
The recursive minimum-excluded insertion algorithm follows [Dem15], pp. 4–5. The results here concern the functional Lean implementation and its represented set, with no machine running-time claim.
Main definitions #
The algorithm and recursive invariant are Tree.insert and Tree.Valid, imported from Basic.
Main results #
Tree.valid_insert: insertion of a bounded key preserves the recursive invariant.Tree.contains_insert: insertion represents exactly the union with the inserted key.
References #
theorem Cslib.Algorithms.Lean.VanEmdeBoas.Tree.singleton_of_bounds_none {d : ℕ} {t : Tree d} (ht : t.Valid) (hb : t.bounds = none) {x : ℕ} (hx : x < universeSize d) :
Installing the first key changes only an empty node's local header.
theorem Cslib.Algorithms.Lean.VanEmdeBoas.Tree.valid_insert {d : ℕ} {t : Tree d} (ht : t.Valid) {x : ℕ} (hx : x < universeSize d) :
Bounded insertion preserves the recursive representation invariant.