The wrapper (Invariant R) #
cur is a well-formed core whose live handles, in list order, are the specification's list,
and curIdx maps each of them to its element. A rebuild core nxt is either being prepared
(the sentinel alone) or holds exactly the live handles of the part pre of cur's list
before the cursor, with nxtIdx mapping them; mirrored operations keep this.
The invariant #
The rebuild core n relative to cur = c with nesting A.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Require the replacement-core invariant when an incremental rebuild is active.
Equations
- OrderMaintenance.Proof.NxtR c A om = match om.nxt with | none => True | some n => OrderMaintenance.Proof.NxtR' c A om n
Instances For
The rebuild #
The swap: once the cursor has passed the end, nxt holds every live handle.
One preparation step of nxt; when it completes, the cursor starts after the sentinel.
The rebuild step keeps Invariant R.
The specification operation of a wrapper insertion.
Equations
Instances For
The wrapper's index supplies a concrete insertion position, including the sentinel case.
Core insertion preserves the live-handle interpretation, including insertion at the sentinel.
Updating the fresh handle's index preserves every live element's lookup.
Deleting a handle preserves all remaining index entries when the other elements stay live.
The common wrapper invariant after a core insertion has been mirrored.
The common wrapper invariant after a core deletion has been mirrored.
Insertion keeps Invariant R and returns the specification's new name.
Deletion keeps Invariant R.
Order queries answer as the specification.
Initialization establishes Invariant R for the empty list.
Each operation answers as the specification and keeps Invariant R.
Theorem A (correctness of Level F). For parameters satisfying the conditions of
docs/PROOF.md §3.4 at every capacity, the structure initializes, and on every valid sequence
of operations it never fails and answers exactly as the list specification.
The parameter conditions hold for the prototype's shape (Params.for_capacity):
elementSpacing = 2^(elementBits-1) / (8G+8) with 8G+8 ≤ 2^(elementBits-1), and T + 1 < 2^groupBits.