Documentation

CslibFrontier.DataStructure.FusionTree.WordRAM.Node.Correction

Executable correction subroutines #

The highest-bit call accepts an ordinary physical register and initializes its own bank. The boundary and second-rank calls charge all register transfers. No call changes memory.

Main definitions #

Main results #

References #

@[reducible, inline]

Disjoint workspace for the complete multiword highest-bit program.

Copy the physical input, run the actual highest-bit program, and copy its scalar result.

theorem Cslib.DataStructure.FusionTree.WordRAM.NodeProgram.exec_highest {w d : ℕ} (hw : 3 ≤ w) (x : WordRAM.Data registers) (hd : WordRAM.Fits w d) (hxd : x.regs divergence = d) :
∃ (y : WordRAM.Data registers), WordRAM.ExecWithin w (highest w) x y 200002 ∧ y.regs position = d.log2 ∧ y.mem = x.mem ∧ ∀ (i : Fin registers), ↑i < 40 → i ≠ position → y.regs i = x.regs i

The 200000-instruction MSB bound plus its two actual caller copies.

The boundary call includes three transfer instructions and ten arithmetic instructions.

Transfer a full word to the compressor, make a sketch query and return the rank.

theorem Cslib.DataStructure.FusionTree.WordRAM.NodeProgram.exec_secondQuery {w n q a z : ℕ} {keys : Fin n → ℕ} (p : NodeParameters w keys) (strict : Bool) (src : Fin registers) (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 : Ready p q a x) (hz : WordRAM.Fits w z) (hxz : x.regs src = z) :
∃ (y : WordRAM.Data registers), WordRAM.Exec w (secondQuery strict src) x y 121 ∧ y.regs out = sketchCut strict w keys z ∧ Ready p q a y ∧ y.mem = x.mem

Both caller copies and all 119 sketch-query instructions are charged.

The numeric bit tested by RAM is zero precisely when the Boolean query bit is false.

Both boundary words are physical words, including a differing bit at w - 1.