FALLBACK establishes INV-S (Lemma 3.3) #
FALLBACK reads only the element list. It cuts the list into groups and chunks with evenly spaced
labels (fbLayout) and rebuilds the top structure, whose tags relabelAll checks along the
chunk list (renumbering if they do not increase). The result satisfies INV-S with the same
element list, and the element records keep their links, liveness and handles.
Cutting a list into pieces #
Relabelling the elements #
The element updates for one group (the k-th, numbered n + 1).
Equations
- One or more equations did not get rendered due to their size.
Instances For
Assign consecutive fallback group indices and labels to a partition of the elements.
Equations
- OrderMaintenance.Proof.fbE P x✝¹ [] x✝ = x✝
- OrderMaintenance.Proof.fbE P x✝¹ (g :: gs) x✝ = OrderMaintenance.Proof.fbE P (x✝¹ + 1) gs (OrderMaintenance.Proof.assignGroup P x✝¹ g x✝)
Instances For
The element e of the k-th group gets group n + k + 1 and label (i + 1)·step.
Consecutive indices #
Blocks of gpc consecutive indices, the last one shorter, cover 1 .. m.
INV-S without the tag condition #
The linked-list and allocation part of the core invariant before restoring labels.
- gList : LList (gN s) (gP s) s.firstGroup A.glist
- cList : LList (cN s) (cP s) s.firstChunk A.chunks
Instances For
The element list part, which FALLBACK reads #
The element-list, allocation and endpoint invariants needed by a fallback rebuild.
Instances For
Arithmetic of the layout #
Evenly spaced labels along a list without duplicates increase.
The abstract nesting of FALLBACK's layout of l.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Label widths fit FALLBACK's spacing (docs/PROOF.md §3.4): every gap is at least 1.
Equations
Instances For
FALLBACK's layout satisfies INV-S without the tag condition, for the nesting fbAbs.
Rebuilding the top structure #
Walking a linked list #
Renumbering the chunks #
FALLBACK's top part: from INV-S without tags, relabelAll succeeds with INV-S.
Lemma 3.3 (FALLBACK). From any state whose element list l is a well-formed non-empty
doubly linked list, FALLBACK succeeds, keeps the element records' links, liveness and handles,
and establishes INV-S with the same element list.
Room for the retried insertion #
Parameters for the retry: FALLBACK's element gap exceeds the append distance
elementSpacing ≥ 1.
Equations
- OrderMaintenance.Proof.RoomP P = (1 ≤ P.elementSpacing ∧ P.elementSpacing < 1 <<< P.elementBits / (OrderMaintenance.Model.fbGS P + 1))
Instances For
Every element has room for an insertion right after it.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Lemma 3.3 with room: under RoomP, every element also has room after FALLBACK.