Documentation

CslibFrontier.DataStructure.VanEmdeBoas.WordRAM.Member

Native van Emde Boas membership descent #

The proof state records only the registers required by membership; all other registers and all memory outside the represented tree may be arbitrary. Queries need not belong to the tree universe. The maximum guard is checked before any cluster address is calculated.

Main definitions #

Main results #

References #

The constant, traversal and result registers at entry to an unfinished lookup.

theorem Cslib.DataStructure.VanEmdeBoas.WordRAM.member_eq_false_of_max_lt {d m M query : ℕ} {tree : Tree d} (ht : tree.Valid) (hb : tree.bounds = some (m, M)) (hx : M < query) :
tree.member query = false

A query above the cached maximum is absent; this fact uses validity, not outside memory.

theorem Cslib.DataStructure.VanEmdeBoas.WordRAM.member_maximum {d m M : ℕ} {tree : Tree d} (ht : tree.Valid) (hb : tree.bounds = some (m, M)) :
tree.member M = true

The cached maximum is a valid early successful membership result.

theorem Cslib.DataStructure.VanEmdeBoas.WordRAM.memberLoop_spec {d w base query : ℕ} {tree : Tree d} {s : WordRAM.Data 32} (hs : MemberEntry base query s) (ht : tree.Valid) (hr : Rep tree base s.mem) (ha : WordRAM.Fits w (base + span d)) :
∃ (z : WordRAM.Data 32), WordRAM.ExecWithin w memberLoop s z (28 * (d + 1) + 2) ∧ (z.regs out = if tree.member query = true then 1 else 0) ∧ z.mem = s.mem

The membership loop is correct for every depth and arbitrary surrounding memory. Its bound charges each body, loop test and jump; setup, dispatch and halt are separate.