Contiguous static fusion-tree records #
Every record has an 18-word header. Leaves store tag 0, presence, and key (zero when
absent), followed by fifteen zero words. Internal nodes have tag 1, followed by exactly
n interleaved pairs of full child minima and absolute child pointers, and the recursively
encoded children in order. No capacity-sized arrays are allocated. The header indices are:
tag 0, child count 1, minimum 2, compression
mask C 3, multiplier digits 4--6, D 7, copies 8, packed complements 9, packed normal 10,
guards 11, bits 12, middle 13, radix 14, maximum 15, width-dependent global offset 16,
and reserved 17, where NodeParameters.words stores the selected-bit count. Parameters
supplies indices 3--17; it asserts no node-search oracle.
This is a static representation, with explicit arena/address and stored-word fit contracts. It asserts neither preprocessing time nor a query running time.
Main definitions #
headerWords,HeaderOffset.tag,HeaderOffset.count,HeaderOffset.minimum,HeaderOffset.compression,HeaderOffset.multiplierLow,HeaderOffset.multiplierMiddle,HeaderOffset.multiplierHigh,HeaderOffset.maskD,HeaderOffset.copies,HeaderOffset.packedComplements,HeaderOffset.packedNormal,HeaderOffset.guards,HeaderOffset.bits,HeaderOffset.middle,HeaderOffset.radix,HeaderOffset.maximum,HeaderOffset.globalOffset,HeaderOffset.reserved: record header length and named offsets.span,childAddress,header,childTable,encode,encodeForest,decode: allocation length, serialized RAM word lists, and load-based decoder.Rep,arena,memory: generic list-block realization, heap assertion, and concrete zero-extended RAM realization.ArenaFits,ContentFits: separate address/frontier and stored-content contracts.
Main results #
encode_length: the concrete list has precisely the claimed allocation length.Rep.node_header,Rep.child: literal loads and recursive child representations.child_span_le,access_owned,child_access_owned: allocation safety.decode_encode: the concrete memory round-trips through a load-based decoder.span_build_le: at most126n + 18allocated words, uniformly in branching capacity.encoding_exists: a fitting concrete memory, decoder and linear allocation bound together.
References #
The fifteen preprocessing words in header slots 3 through 17, for each internal node. The final two slots accommodate a width-dependent global offset and one reserved word.
Fixed record header length, independent of branching capacity.
Stable offsets within internal headers. The fifteen parameter words are named here so node-search implementations can use the layout without duplicating numerical indices.
Record tag: 0 for leaves, 1 for internal nodes.
Number of actual children (presence for a leaf).
Cached minimum (the key for a leaf).
First multiplier digit.
Second multiplier digit.
Third multiplier digit.
Packed complement sketches.
Packed ordinary sketches.
Width-dependent global offset.
Reserved preprocessing word; NodeParameters.words stores the selected-bit count here.
Actual allocated words, without any padding to the maximum branching capacity.
The concrete internal header.
Serialize a tree at its absolute address. Invalid nonsingleton leaves are truncated;
decode_encode requires Tree.Valid, which excludes them.
Serialize consecutive child records; the next record starts at the previous one's end.
Every serialized tree occupies exactly its claimed span.
The concrete child-record list has the sum of the child spans as its length.
Memory represents the concrete serialized tree, with arbitrary memory outside its block.
The existing heap assertion for the serialized arena, including exactly its allocated cells.
Writes disjoint from the contiguous arena preserve the complete tree representation.
A concrete total memory obtained by placing the serialized words into an otherwise zero RAM.
The explicit list encoding has an actual RAM realization.
The first three internal header words and all fifteen preprocessing words decode literally.
The three leaf words decode as tag, presence and key.
Uniform linear allocated RAM words, with constants independent of branching capacity and word width. This counts the actual serialized words, including all preprocessing headers.
Recover the functional tree by loads of tags, fields and absolute child pointers. Fuel bounds recursive depth, not the number of machine instructions. The zero-fuel result is a default; correctness requires fuel strictly larger than the tree height.
Concrete RAM decoding recovers every valid tree. In particular, empty and singleton leaves remain distinct even when the stored key is zero.
The explicit serializer and total RAM realization round-trip through the load-based decoder.
Every owned address and the one-past-end allocation frontier fit a word. This strict
frontier condition also suffices for the existing WordRAM.alloc execution contract.
A numerical sufficient arena contract, using only input length and the allocation base. It bounds the entire one-past-end frontier, rather than only the input key values.
Allocation size, base address and tag one all fit under the arena contract. Together
with the fitting frontier, these are the numerical inputs to WordRAM.alloc_exec.
Explicit key and preprocessing-word assumptions. Child counts and addresses are instead
bounded by ArenaFits; fitting input keys alone does not imply either contract.
Cached child minima fit whenever all explicit tree contents fit.
The fit assumption for the arena bounds every owned access address.
The concrete memory consists entirely of fitting words, including its zero exterior.
A fitting contiguous encoding exists for every built tree whose explicit address and content assumptions hold. The decoder uses depth fuel; no preprocessing-time claim is made.