Theorem W, stage B1: the core's write sites #
Stored-value bounds for the operations in OrderMaintenance/Model/Core.lean, excluding FALLBACK.
The classes of docs/WORD.md §2:
- R (a value read from the state,
NIL, a constant, a sublist): no hypothesis. - Lab (a label): bounded by the guards, given
LabRoom K P(elementBits, groupBits ≤ K). - F (a fresh index) and Sz (a size or count): the bound is a hypothesis of the lemma
(
hy : y < 2 ^ K,hg : size + 1 < 2 ^ K, ...). The cost invariants discharge it (OrderMaintenance/Proof/Word/Hooks.lean).
The pure state functions that the cost proof uses for each step (linkElem, allocGroup,
linkGroupPair, sizeAdj, moveLState, ..., cmoveSizes, markState) get lemmas
wb_*; the monadic functions get Hoare triples ht_*.
Room for labels: the label widths are at most K.
Instances For
The groups u take chunk y and the labels labs.
Pure state functions #
Element insertion: the new index y (F), its label (Lab), the group size and the count (Sz).
Chunk sizes after a chunk-split move: the decrement is R, the increment needs the bound.
Labels (class Lab) #
Queries and deletion (class R) #
Chunk sizes (class Sz) #
The size update of a chunk and the queue's: the increment needs the bound.
Element insertion #
An element insertion writes the new element with a label below 2^K (Lab): the label
is below the next element's (between) or below 2^elementBits (after).
Group splits #
A split start: two fresh groups (F; room for two more groups is the hypothesis) and two
labels (Lab, from labBefore/labAfter).
A move of the first element of a splitting group to its left sibling: the label (Lab, from the room condition of the move) and the sibling's size (Sz, the hypothesis).
The move to the right sibling.
Chunk splits #
A chunk-split move to the left sibling: the groups' labels (Lab), and the sibling's size plus the moved groups' sizes (Sz, the hypothesis).
The labels of a left move are below 2^K (Lab: after with groupBits ≤ K, or the centre).
Reservation: the split start's own writes #
Context-free triples for the remaining steps (classes R and Lab) #
A chunk removal: the chunk dies, its siblings become quiet and may enter the queue (R).
A move of one element of a splitting group to a sibling (R, Lab).