Pointer-machine memory dictionary operations #
The root lives in pointer register one. Scalar zero supplies the address, scalar three the value to write or the result of a read. Scalars one and two are scratch; registers from four onward belong to the simulated machine. Every access navigates ordinary AVL links.
Read a dictionary address, returning the default value on a missing key.
Insert an absent key and replace the selected node's payload. Existing keys keep their node address; scalar three supplies the fresh or replacement value.
A complete dictionary read follows the AVL search path and returns the represented value. It preserves the heap, root, query, and every client scalar register.
The output dictionary implements a total-memory update and preserves client registers.
Heap records implement the output tree.
Keys and height caches match functional AVL insertion.
- distinct : SearchTree.PointerMachine.AddressesDistinct tree
Distinct tree positions have distinct addresses.
The scalar payloads implement the written total memory.
Pointer one tracks the resulting root.
The operation allocates at most one node.
- data (i : Fin (SearchTree.PointerMachine.layout 2 (regs + 2)).dataRegs) : i ≠ 1 → i ≠ 2 → t.data i = s.data i
Only scalar search/height scratch registers may change.
A concrete dictionary write inserts a missing address and changes its payload, with logarithmic cost and at most one allocation. Existing memory cells retain their values.