Documentation

CslibFrontier.DataStructure.FusionTree.WordRAM.Node.Registers

Register banks for fusion-node queries #

The query uses a fixed register file. Header, compression, rank, neighbor, boundary, and multiword highest-bit workspaces occupy disjoint intervals. Explicit copies connect them.

Main definitions #

Main results #

References #

@[reducible, inline]

Fixed physical register count, independent of width and node occupancy.

@[reducible, inline]

Original bounded query.

@[reducible, inline]

Original record address.

@[reducible, inline]

Final full-key inclusive rank.

@[reducible, inline]

Full word to compress, and later the compressed result.

@[reducible, inline]

Initial inclusive sketch rank.

@[reducible, inline]

Constant zero for control flow.

@[reducible, inline]

Exclusive or of the selected full key and original query.

@[reducible, inline]

Highest differing position on a miss.

A contiguous register embedding.

Contiguous register embeddings are injective.

@[reducible, inline]

Eighteen-word header reader, including its pointer and address scratch.

@[reducible, inline]

Compression workspace.

@[reducible, inline]

Inclusive or strict rank workspace.

@[reducible, inline]

Two-neighbor loader and selector.

@[reducible, inline]

Correction boundaries.

Header register holding one of the fifteen stored preprocessing words.

@[reducible, inline]

Header register holding occupancy.

Memory and caller registers below forty agree. The direction follows execution.

Updating a register at index at least 40 preserves Frame.

theorem Cslib.DataStructure.FusionTree.WordRAM.NodeProgram.frame_extend {k offset : ℕ} (hk : offset + k ≤ registers) (ho : 40 ≤ offset) (x : WordRAM.Data registers) (y : WordRAM.Data k) (hm : y.mem = x.mem) :
Frame x (WordRAM.Data.extend (bank offset hk) y x)

Extending a subroutine state into a register bank at offset at least 40 preserves Frame.

Copy a finite sequence of registers, charging also a final self-copy of register 39. The final self-copy supplies an executable empty sequence without a special RAM primitive.

The instruction count of moves xs is xs.length + 1.

Executing moves xs reaches moved xs x in xs.length + 1 steps.

Register copies whose destinations are at index at least 40 preserve Frame.

theorem Cslib.DataStructure.FusionTree.WordRAM.NodeProgram.exec_bankCall {w t k offset : ℕ} (hk : offset + k ≤ registers) (ho : 40 ≤ offset) {xs : List (Fin registers × Fin registers)} (hxs : ∀ p ∈ xs, 40 ≤ ↑p.1) {c : WordRAM.Code WordRAM.Basis.standard k} {x : WordRAM.Data registers} {v : WordRAM.Data k} (hev : WordRAM.Exec w c (WordRAM.Data.comap (bank offset hk) (moved xs x)) v t) (hm : v.mem = (moved xs x).mem) :
WordRAM.Exec w ((moves xs).seq (WordRAM.Code.rename (bank offset hk) c)) x (WordRAM.Data.extend (bank offset hk) v (moved xs x)) (xs.length + 1 + t) ∧ Frame x (WordRAM.Data.extend (bank offset hk) v (moved xs x))

A charged call into a register bank at offset at least 40: moves xs copies the arguments into registers at index at least 40, then the routine runs renamed into the bank. The cost is the copies plus the routine, and the caller's frame is preserved.

theorem Cslib.DataStructure.FusionTree.WordRAM.NodeProgram.regs_extend_bank {k offset : ℕ} (hk : offset + k ≤ registers) (v : WordRAM.Data k) (u : WordRAM.Data registers) (i : Fin k) :
(WordRAM.Data.extend (bank offset hk) v u).regs (bank offset hk i) = v.regs i

After a bank call, a bank register holds the routine's corresponding register.

Literal values loaded from the actual header. This is a register contract, with no correctness, execution, or rank oracle among its fields.

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

The Prepared header invariant is preserved across Frame transitions.

theorem Cslib.DataStructure.FusionTree.WordRAM.NodeProgram.Prepared.set_low {w n : ℕ} {keys : Fin n → ℕ} {p : NodeParameters w keys} {x : WordRAM.Data registers} (hx : Prepared p x) (i : Fin registers) (v : ℕ) (hi : ↑i < 10) :
Prepared p (x.set i v)

Caller scratch registers zero through nine are disjoint from the loaded header.