Documentation

Complexity.Algorithms.WordRAM.VanEmdeBoas.Insert

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 #

Main results #

References #

The constant and traversal registers at entry to an unfinished insertion.

Instances For

    Mathematical description of one native insertion iteration.

    Instances For
      theorem Cslib.Algorithms.WordRAM.VanEmdeBoas.insertBody_exec {d w base key : ℕ} {tree : Lean.VanEmdeBoas.Tree d} {s : WordRAM.Data 32} (hs : InsertEntry base key s) (ht : tree.Valid) (hr : Rep tree base s.mem) (hkey : key < Lean.VanEmdeBoas.universeSize d) (ha : WordRAM.Fits w (base + Lean.VanEmdeBoas.span d)) :

      One actual insertion iteration, including all branches and address calculations, executes within 37 instructions.

      theorem Cslib.Algorithms.WordRAM.VanEmdeBoas.insertLoop_spec {d w base key : ℕ} {tree : Lean.VanEmdeBoas.Tree d} {s : WordRAM.Data 32} (hs : InsertEntry base key s) (ht : tree.Valid) (hr : Rep tree base s.mem) (hkey : key < Lean.VanEmdeBoas.universeSize d) (ha : WordRAM.Fits w (base + Lean.VanEmdeBoas.span d)) :
      ∃ (z : WordRAM.Data 32), WordRAM.ExecWithin w insertLoop s z (39 * (d + 1) + 2) ∧ Rep (tree.insert key) base z.mem ∧ ∀ (a : ℕ), a < base ∨ base + Lean.VanEmdeBoas.span d ≤ a → z.mem a = s.mem a

      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.