Documentation

CslibFrontier.DataStructure.PriorityQueue.WordRAM.SoftHeap.Program

Word-RAM Memory.Prog Operations and Certificates for Soft Heaps #

Low-level memory layout (+0..+2 stride-3 item slots and +0..+11 stride-12 node slots), SHHandle, Memory.Prog implementations of pool allocation, iterative defill, lazy binomial-style insertion (shInsert), minimum extraction (shExtractMin), and corrupted-item harvesting (shCollectCorrupted), together with uniform Realizes .exact (work := 0) compilation certificates.

Main definitions #

Main results #

Soft-heap pool handle storing bump pool bases, root-list head, allocated counts, and corruption rank threshold rankThreshold.

  • itemBase : ℕ

    Base address of the stride-3 item pool.

  • nodeBase : ℕ

    Base address of the stride-12 node pool.

  • firstRoot : ℕ

    1-based index of the minimum-rank root in the doubly-linked root list (0 = empty).

  • itemCount : ℕ

    Number of allocated item slots (1..itemCount).

  • nodeCount : ℕ

    Number of allocated node slots (1..nodeCount).

  • rankThreshold : ℕ

    Corruption rank threshold r (items at rank ≤ r stay uncorrupted).

Instances For

    Allocate dirty Soft Heap item and node pools of capacities maxItems and maxNodes.

    allocPool admits a uniform Realizes .exact compilation certificate (work := 0).

    Refill node rootIdx (d = ![itemBase, nodeBase, rootIdx, fuel]) along its smallest-ckey child chain up to targetSize, clearing rootIdx.parent := 0 before ascending back to 0.

    Native safety domain for defill d (d = ![itemBase, nodeBase, rootIdx, fuel]).

    Insert item (val, origKey) into soft heap h (d = (h, val, origKey, fuel)).

    Result returned by shExtractMin: updated handle, found flag (1 iff non-empty), extracted item payload val, and extracted corrupted key key.

    • handle : SHHandle

      Updated soft-heap handle after extraction.

    • found : ℕ

      1 if an item was extracted, 0 if the heap was empty.

    • val : ℕ

      Payload value of the extracted item (0 if empty).

    • key : ℕ

      Corrupted key of the extracted item (0 if empty).

    Instances For

      Extract a minimum-key item from soft heap d.1 (d = (h, fuel)).

      Scan nodes allocated since nodeStart ((nodeStart, h.nodeCount]), appending corrupted payload values val (origKey < ckey) to outBase[outCount..] and returning the new outCount (d = (h, nodeStart, outBase, outCount, fuel)).