Reading a fusion-node header #
All eighteen words of an internal-node header are loaded by a fixed straight-line program. The constant offsets and their address additions are charged. Query-dependent array accesses are separate from this header load.
Main definitions #
ReadHeaderProgram.pointer,ReadHeaderProgram.offset,ReadHeaderProgram.address: register assignments for the header reader.ReadHeaderProgram.word: three-instruction block loading a single header word.ReadHeaderProgram.code: the 54-instruction header reader.ReadHeaderProgram.result: output state after loading all eighteen header words.
Main results #
ReadHeaderProgram.exec: checked execution with an explicit header-address bound.
References #
@[reducible, inline]
Base address of the record, preserved.
@[reducible, inline]
Constant-offset scratch.
@[reducible, inline]
Address scratch.
Load header word i into register i+1.
All eighteen header loads, with their constant offsets and address additions.
def Cslib.DataStructure.FusionTree.WordRAM.ReadHeaderProgram.result (x : WordRAM.Data 21) :
WordRAM.Data 21
Output state after the eighteen loaded words.
theorem Cslib.DataStructure.FusionTree.WordRAM.ReadHeaderProgram.exec {w : ℕ} (x : WordRAM.Data 21) (ha : WordRAM.Fits w (x.regs pointer + 17)) :
All header words are read in 54 checked standard instructions, counting constants and address additions. The address bound implies that all constant offsets fit as well.
theorem Cslib.DataStructure.FusionTree.WordRAM.ReadHeaderProgram.result_spec (x : WordRAM.Data 21) :
The record base and memory are preserved, and each output register contains its header word.