Native van Emde Boas insertion descent #
Insertion updates local extrema in place and recurses at most once per level: either into the summary when the target cluster was empty (after installing the cluster's singleton extrema directly), or into the already-occupied target cluster. Repeated insertion of a local minimum terminates immediately.
Main definitions #
InsertEntry: the insertion-loop register invariant.
Main results #
insertLoop_spec: insertion takes at most39 * (d + 1) + 2loop instructions, produces a valid memory representation oftree.insert key, and preserves all memory outside[base, base + span d).
References #
structure Cslib.DataStructure.VanEmdeBoas.WordRAM.InsertEntry (base key : ℕ) (s : WordRAM.Data 32) :
The constant and traversal registers at entry to an unfinished insertion.
theorem Cslib.DataStructure.VanEmdeBoas.WordRAM.insertLoop_spec {d w base key : ℕ} {tree : Tree d} {s : WordRAM.Data 32} (hs : InsertEntry base key s) (ht : tree.Valid) (hr : Rep tree base s.mem) (hkey : key < universeSize d) (ha : WordRAM.Fits w (base + span d)) :
The insertion loop is correct for every depth and arbitrary surrounding memory.
It executes within 39 * (d + 1) + 2 instructions, establishes Rep (tree.insert key) base z.mem,
and leaves all memory outside [base, base + span d) unchanged.