Documentation

CslibFrontier.DataStructure.FusionTree.WordRAM.Boundary

Checked correction boundaries #

After finding the highest differing position, fusion-node correction replaces the query's suffix by a sibling-subtree extreme. Both extremes and the original query bit are computed without constructing the overflowing word 2^w.

Main definitions #

Main results #

References #

@[reducible, inline]

Original query, preserved.

@[reducible, inline]

Highest differing bit position, preserved.

@[reducible, inline]

Constant one.

@[reducible, inline]

Position immediately above the differing bit.

@[reducible, inline]

The differing bit's power of two.

@[reducible, inline]

Mask below the differing bit.

@[reducible, inline]

Common stem followed by zeros.

@[reducible, inline]

All-ones extreme in the lower sibling subtree.

@[reducible, inline]

All-zeros extreme in the upper sibling subtree.

@[reducible, inline]

Zero or one according to the query's differing bit.

Compute both extremes and the bit selecting the correction convention.

The precise output state, including all scratch registers.

theorem Cslib.DataStructure.FusionTree.WordRAM.BoundaryProgram.exec {w q p : ℕ} (x : WordRAM.Data 10) (hq : WordRAM.Fits w q) (hp : p < w) (hxq : x.regs query = q) (hxp : x.regs position = p) :

Ten checked instructions compute both sibling extremes and the selecting bit. The position may be w-1; the program never materializes 2^w. Query, position, and memory are preserved. Finding the differing position is a separate operation.