Level F: the insert-only core (prototype/core.py) #
Elements → groups → chunks, guarded label writes, group and chunk splits, the reservation process, and FALLBACK.
Allocation #
Append an element with the given group, label and external handle.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Allocate a group in a chunk, reusing the free list when possible.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Chunks are never freed: emptied ones stay as DEAD tombstones until the next rebuild.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Label primitives (guarded) #
Queries #
Compare the order labels of two element indices.
Equations
- OrderMaintenance.Model.order x y = do let __do_lift ← OrderMaintenance.Model.key x let __do_lift_1 ← OrderMaintenance.Model.key y pure (OrderMaintenance.Model.keyLt __do_lift __do_lift_1)
Instances For
Mark an element deleted while retaining its linked-list position.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Chunk sizes #
Element insertion #
Insert after an element, choosing a guarded label before mutating the list.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Group splits #
Link new groups gl (label labL) and gr (label labR) right before and after g, in
the group list and in g's chunk, as the overflow siblings of g.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Unlink group g from the group list and from its chunk, and free it.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Move element e, the first of group g, to the end of group gl with label lab.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Move element e, the last of group g, to the front of group gr with label lab.
Equations
- One or more equations did not get rendered due to their size.
Instances For
A label for a new group right before g in its chunk.
Equations
- One or more equations did not get rendered due to their size.
Instances For
A label for a new group right after g in its chunk.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Allocate the overflow siblings and begin incrementally splitting a group.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Unlink and free group g, which must be alive and empty.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Remove an empty group and release its overflow siblings to the quiet state.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Move one element of the splitting group g (alive, non-empty) to its lighter sibling.
Returns the sibling.
Equations
- One or more equations did not get rendered due to their size.
Instances For
One move of a splitting group. Returns false once g is gone.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Perform at most the configured number of steps of a group split.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Advance the split of a group or of its source if it is an overflow sibling.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Chunk splits #
The candidate unit at the left/right end of chunk x: the family (gl, g, gr) of a
splitting group if the end group is its overflow sibling on that side, else the end group.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The groups that one chunk-split move takes from the left/right end of chunk x: a whole
family (gl, g, gr) of a splitting group, or one group (invariant F).
Equations
- One or more equations did not get rendered due to their size.
Instances For
Leave an empty chunk as a tombstone and release its overflow siblings.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Labels for k groups appended after a group labelled prev (none: the receiving chunk
is empty; start at the centre).
Equations
- One or more equations did not get rendered due to their size.
- OrderMaintenance.Model.pushBackLabs center D B x✝ 0 = pure []
Instances For
Labels for k groups prepended before a group labelled nxt, in list order.
Equations
- One or more equations did not get rendered due to their size.
- OrderMaintenance.Model.pushFrontLabs center D x✝ 0 = pure []
Instances For
Move one end unit into an overflow sibling, or finish an empty chunk split.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Perform at most the configured number of steps of a chunk split.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Advance the split of a chunk or of its source if it is an overflow sibling.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Reservation #
Spend a bounded number of steps on the largest queued chunk and its top-tree job.
Equations
- One or more equations did not get rendered due to their size.
Instances For
FALLBACK #
FALLBACK's layout, in closed form: the element list cut into groups of ⌊G/2⌋, the groups
cut into chunks of ⌊⌊T/2⌋/⌊G/2⌋⌋; group k (0-based) gets index k + 1 and lies in chunk
⌊k / gpc⌋ + 1; labels are evenly spaced at every level.
The target number of elements per group during a fallback rebuild.
Equations
- OrderMaintenance.Model.fbGS P = max 1 (P.G / 2)
Instances For
The target number of groups per chunk during a fallback rebuild.
Equations
- OrderMaintenance.Model.fbGPC P = max 1 (P.T / 2 / OrderMaintenance.Model.fbGS P)
Instances For
The number of groups in FALLBACK's chunk c (0-based), out of m.
Equations
- OrderMaintenance.Model.fbChunkLen P m c = min (OrderMaintenance.Model.fbGPC P) (m - c * OrderMaintenance.Model.fbGPC P)
Instances For
The number of chunks for m groups.
Equations
Instances For
Synchronous rebuild of groups, chunks and tags from the element list.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Insertion with background work #
Update sizes and spend the scheduled group, chunk and reservation work after insertion.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Run act; on a failed guard run handler from the state reached (bugs propagate).
Equations
- OrderMaintenance.Model.onGuard act handler = tryCatch act fun (x : OrderMaintenance.Model.Err) => match x with | OrderMaintenance.Model.Err.guard msg => handler | e => throw e
Instances For
Insert an element and run background work, rebuilding after recoverable guard failures.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Construction #
A fresh core's lists: one chunk, one group, and the sentinel element (dead), all index 1.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The top structure of a fresh core: built now, or with lazy later, one prepareStep at a
time.
Equations
- One or more equations did not get rendered due to their size.
Instances For
A fresh core (Core.__init__).
Equations
Instances For
One step of deferred initialization; true once the core is ready.
Equations
- One or more equations did not get rendered due to their size.