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 #
BoundaryProgram.query,BoundaryProgram.position,BoundaryProgram.one,BoundaryProgram.next,BoundaryProgram.power,BoundaryProgram.low,BoundaryProgram.stem,BoundaryProgram.lower,BoundaryProgram.upper,BoundaryProgram.bit: register indices for boundary computation.BoundaryProgram.code,BoundaryProgram.result: ten standard instructions computing both correction boundaries and the resulting machine state.
Main results #
BoundaryProgram.exec: exact checked execution, including the top-bit case.
References #
Original query, preserved.
Highest differing bit position, preserved.
Constant one.
Position immediately above the differing bit.
The differing bit's power of two.
Mask below the differing bit.
Common stem followed by zeros.
All-ones extreme in the lower sibling subtree.
All-zeros extreme in the upper sibling subtree.
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.
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.