Fixed Word-RAM point updates for aggregation trees #
The program walks from the root to the updated leaf. Every visited node is incremented, and the next subtree is selected by the position relative to half the current length. The same code handles every height, position and increment. Its arithmetic and all its loads, stores, tests and jumps are actual bounded-word instructions.
Main definitions #
Reg.zero,Reg.one,Reg.two,Reg.ptr,Reg.len,Reg.idx,Reg.delta,Reg.val,Reg.tmp,Reg.ans,Reg.tag,Reg.root,Reg.capacity,Reg.position: register assignments for aggregation-tree updates and queries.Entry: the register calling convention.updateBody,updateLoop,updateNext: the single-iteration body, fixed update loop, and single-iteration state transition.
Main results #
updateLoop_spec: logarithmic instruction bound, restored tree representation and a frame theorem for every memory word outside the tree.
References #
Constant zero.
Constant one.
Constant two.
Current subtree pointer.
Current subtree length.
Position relative to the current subtree.
Increment supplied to an update.
Loaded value and arithmetic scratch.
Address scratch.
Query answer.
Operation tag, zero for update and nonzero for query.
Persistent root pointer.
Persistent array capacity.
External operation position.
Registers used by both tree traversals.
Increment one node and move to the selected child. A leaf has half-length zero; the resulting length stops the loop before another access.
Fixed update code, independent of array size, position and increment.
The data after one update iteration; this is a mathematical description, not an additional instruction in the machine.
One update iteration increments the memory word at the current node pointer b by δ and
leaves all other addresses unchanged.
The fixed update loop runs in at most 11 (h + 1) + 2 instructions. It restores the
complete aggregation invariant and preserves every word outside the original footprint.
The bound assumes the existing tree is supplied in memory; it does not include construction.