Documentation

CslibFrontier.DataStructure.FusionTree.WordRAM.Node.Header

Loading concrete fusion-node parameters #

The representation below consists entirely of literal memory equalities. It supplies no query result or execution assumption. The complete eighteen-word header load is charged.

Main definitions #

Main results #

References #

structure Cslib.DataStructure.FusionTree.WordRAM.NodeProgram.Rep {w n : ℕ} {keys : Fin n → ℕ} (p : NodeParameters w keys) (a : ℕ) (mem : ℕ → ℕ) :

Literal representation of an internal node's occupancy, fifteen parameters and full-key minima. The unused tag, cached minimum and child pointers are read or skipped as appropriate; they carry no query oracle. This is a projection of the contiguous tree representation.

  • count_eq : mem (a + 1) = n

    Actual occupancy at header offset one.

  • words_eq (j : Fin 15) : mem (a + 3 + ↑j) = p.words j

    Actual fifteen preprocessing words at offsets three through seventeen.

  • keys_eq (i : Fin n) : mem (a + 18 + ↑i * 2) = keys i

    Full-key minima in the interleaved child table.

theorem Cslib.DataStructure.FusionTree.WordRAM.NodeProgram.rep_of_tree {w a m : ℕ} {cs : List Tree} {parameters : Parameters} {mem : ℕ → ℕ} (p : NodeParameters w fun (i : Fin cs.length) => cs[i].minimum) (hr : WordRAM.Rep parameters (Tree.node m cs) a mem) (hp : parameters (Tree.node m cs) = p.words) :
Rep p a mem

The node contract is a literal projection of the contiguous tree representation. Only equality with the actual stored parameter words is required.

Loaded parameters and original inputs, with the actual full-key table.

  • prepared : Prepared p x

    Actual loaded header.

  • query_eq : x.regs query = q

    Original query.

  • pointer_eq : x.regs pointer = a

    Original record base.

  • keys_eq (i : Fin n) : x.mem (a + 18 + ↑i * 2) = keys i

    Actual stride-two full-key table.

theorem Cslib.DataStructure.FusionTree.WordRAM.NodeProgram.Ready.frame {w n q a : ℕ} {keys : Fin n → ℕ} {p : NodeParameters w keys} {x y : WordRAM.Data registers} (hx : Ready p q a x) (hf : Frame x y) :
Ready p q a y

Framing memory and the first 40 registers preserves Ready.

theorem Cslib.DataStructure.FusionTree.WordRAM.NodeProgram.Ready.set_scratch {w n q a : ℕ} {keys : Fin n → ℕ} {p : NodeParameters w keys} {x : WordRAM.Data registers} (hx : Ready p q a x) (i : Fin registers) (v : ℕ) (hlo : 2 ≤ ↑i) (hhi : ↑i < 10) :
Ready p q a (x.set i v)

Scratch register updates preserve the original inputs and loaded node data.

theorem Cslib.DataStructure.FusionTree.WordRAM.NodeProgram.Ready.except_scratch {w n q a : ℕ} {keys : Fin n → ℕ} {p : NodeParameters w keys} {x y : WordRAM.Data registers} (hx : Ready p q a x) (i : Fin registers) (hlo : 2 ≤ ↑i) (hhi : ↑i < 10) (hm : y.mem = x.mem) (hp : ∀ (j : Fin registers), ↑j < 40 → j ≠ i → y.regs j = x.regs j) :
Ready p q a y

A subroutine may return through one caller scratch register while framing the rest.

Copy the base pointer, then perform the actual eighteen-word header load.

theorem Cslib.DataStructure.FusionTree.WordRAM.NodeProgram.exec_readHeader {w n q a : ℕ} {keys : Fin n → ℕ} (p : NodeParameters w keys) (x : WordRAM.Data registers) (hr : Rep p a x.mem) (ha : WordRAM.Fits w (a + 17)) (hxq : x.regs query = q) (hxa : x.regs pointer = a) :
∃ (y : WordRAM.Data registers), WordRAM.Exec w readHeader x y 55 ∧ Ready p q a y ∧ y.mem = x.mem

Header loading takes 55 actual instructions and preserves memory and both inputs.