Word-RAM B-Tree Lookup (O(t log_t n)) #
Root-to-leaf B-tree lookup code lookupCode and complete halting flat program lookupProgram over
Cslib.WordRAM.Basis.standard (20 registers), computing BTree.lookup k tr in at most
(16 * t + 21) * tr.height + 16 (O(t log_t n)) instructions without modifying memory while
preserving Rep.
Main definitions #
Cslib.DataStructure.BTree.WordRAM.lookupCode: structured B-tree lookup code overBasis.standard.Cslib.DataStructure.BTree.WordRAM.lookupProgram: halting flat program (lookupCode.program rVal).
Main results #
Cslib.DataStructure.BTree.WordRAM.lookupCode_spec,Cslib.DataStructure.BTree.WordRAM.lookupCode_log_spec,Cslib.DataStructure.BTree.WordRAM.lookupProgram_spec:O(t * tr.height)andO(t log_t n)Word-RAM instruction bounds forlookupCodeandlookupProgram.Cslib.DataStructure.BTree.WordRAM.not_readsWidth_lookupCode,Cslib.DataStructure.BTree.WordRAM.isRandFree_lookupCode,Cslib.DataStructure.BTree.WordRAM.not_readsWidth_lookupProgram,Cslib.DataStructure.BTree.WordRAM.isRandFree_lookupProgram: width-independence and determinism (rand-freedom) certificates.
Look up key rKey in the arena at rBase of minimum degree rDeg, setting rFound (1 or
0) and rVal (found value or 0) without modifying memory.
lookupCode evaluates BTree.lookup k tr in at most (16 * t + 21) * tr.height + 16
standard Word-RAM instructions without modifying memory, preserving Rep.
Logarithmic O(t log_t n) Word-RAM instruction bound for lookupCode.
Complete flat Word-RAM lookup program (lookupCode followed by halt rVal).
lookupCode does not read the runtime word width w.
lookupCode is deterministic (rand-free).
lookupProgram does not read the runtime word width w.
lookupProgram is deterministic (rand-free).
Complete halting flat-program specification of lookupProgram: runs in at most
(16 * t + 21) * (Nat.log t ((tr.size + 1) / 2) + 1) + 17 Word-RAM instructions (charging the
final halt), halting with (BTree.lookup k tr).getD 0 in rVal, the hit/miss bit in rFound
(distinguishing some 0 from none), unchanged memory y.mem = x.mem, and preserved Rep.