Documentation

CslibFrontier.DataStructure.FusionTree.WordRAM.Node.Sketch

Composing compression and packed ranks #

All transfers into the two fixed workspaces are charged. Only the actual loaded header values supply node-dependent constants. The caller's registers and all memory are framed.

Main definitions #

Main results #

References #

Prepare the compression workspace and run the actual multiplier program.

theorem Cslib.DataStructure.FusionTree.WordRAM.NodeProgram.exec_compress {w n q : ℕ} {keys : Fin n → ℕ} (p : NodeParameters w keys) (hw : 2 ≤ w) (hn : 0 < n) (hnB : n ≤ branching w) (hlarge : 9 ≤ Nat.log 2 w) (x : WordRAM.Data registers) (hx : Prepared p x) (hq : WordRAM.Fits w q) (hxq : x.regs argument = q) :

Seven transfers plus the terminal self-copy and 94 arithmetic instructions.

Transfer a compressed query and seven stored constants to a packed-rank workspace. The Boolean selects strict rank (original packed sketches) or inclusive rank (complements).

Eight charged transfers followed by the chosen eight-instruction rank program.

def Cslib.DataStructure.FusionTree.WordRAM.NodeProgram.sketchCut {n : ℕ} (strict : Bool) (w : ℕ) (keys : Fin n → ℕ) (q : ℕ) :

Perfect-sketch comparison count with the chosen convention.

theorem Cslib.DataStructure.FusionTree.WordRAM.NodeProgram.exec_rank {w n q : ℕ} {keys : Fin n → ℕ} (p : NodeParameters w keys) (strict : Bool) (hn : 0 < n) (hs : StrictMono keys) (hk : ∀ (i : Fin n), keys i < 2 ^ w) (hnB : n ≤ branching w) (hlarge : 9 ≤ Nat.log 2 w) (x : WordRAM.Data registers) (hx : Prepared p x) (hxq : x.regs (compressBank 20) = p.compressed q) :
∃ (y : WordRAM.Data registers), WordRAM.Exec w (rank strict) x y 17 ∧ y.regs (rankBank 9) = sketchCut strict w keys q ∧ Frame x y

The rank call includes every transfer and preserves the caller and memory.

Compression followed by the requested sketch-rank convention.

theorem Cslib.DataStructure.FusionTree.WordRAM.NodeProgram.exec_sketchQuery {w n q : ℕ} {keys : Fin n → ℕ} (p : NodeParameters w keys) (strict : Bool) (hw : 2 ≤ w) (hn : 0 < n) (hs : StrictMono keys) (hk : ∀ (i : Fin n), keys i < 2 ^ w) (hnB : n ≤ branching w) (hlarge : 9 ≤ Nat.log 2 w) (x : WordRAM.Data registers) (hx : Prepared p x) (hq : WordRAM.Fits w q) (hxq : x.regs argument = q) :
∃ (y : WordRAM.Data registers), WordRAM.Exec w (sketchQuery strict) x y 119 ∧ y.regs (rankBank 9) = sketchCut strict w keys q ∧ Frame x y

A complete sketch query, including all register transfers, takes 119 instructions.