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 #
@[simp]
theorem Cslib.Algorithms.Lean.VanEmdeBoas.Tree.contains_node_some {d : ℕ} (m M : ℕ) (s : Tree d) (c : Fin (universeSize d) → Tree d) (y : ℕ) :
An internal node with bounds some (m, M) contains y iff y = m or y is in some
cluster.
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.