Theorem W, stage B3: the wrapper's stored values #
WBW t om nx: the wrapper state om, with next core nx, after t operations: each core
bounded at its own word size (WB (wK c.P) c), the element index arrays and the cursor bounded at
their core's word size, every handle stored in a core at most nextHandle, and the counters
(live, nextHandle, rebuilds) at most t. The next core is a separate argument because the
rebuild loop holds it outside the record.
This file proves that the wrapper's operations keep WBW, along the Level M invariant MInv (whose
InService, CopyOK and PrepM contexts give each core operation its hypotheses):
loop_wb: the rebuild loop (preparation steps, copy steps, the swap), followingRLSafe;rebuild_wb: the rebuild step (a fresh core, or the loop);insert_wbw,delete_wbw: an insertion and a deletion (the core operation oncur, the mirrored one onnxt, the rebuild step).
The predicate #
The wrapper's values, each core at its own word size.
Instances For
Facts about a core in service #
The element count of a core in service is far below its word size.
The handles across an insertion into a core in service: the new element gets hh.
The rebuild loop #
A copy step keeps the bound: the copied element goes after the tail of nxt (a core in
service), with its handle; the index array records its index; the cursor moves on.
The rebuild loop keeps the bound, along Level M's loop context RLSafe: preparation
steps (PrepM), copy steps (CopyOK), the swap. The counters do not change.
The rebuild step #
The fresh core of a rebuild start has no handles yet.
The rebuild step keeps the bound: a rebuild start (a fresh core, wb_prepStart; one more
rebuild), or the loop (loop_wb, with Level M's loop context from loop_M).
Mirroring an insertion #
A mirrored insertion keeps the bound: the insertion into nxt (a core in service, at the
mirrored anchor), its index, its handle.
Mirroring a deletion #
The operations #
Inserting into the current core preserves the wrapper's stored-value bounds, with one additional operation counted.
Marking a current element dead preserves all stored-value bounds and advances only the history allowance.
An insertion keeps the Level M invariant and the bound.
A deletion keeps the Level M invariant and the bound.
Initialization #
Initialization: the Level M invariant and the bound after no operation.
An operation #
An operation keeps the Level M invariant and the bound, one more operation counted.
Reachable wrapper states #
The wrapper states reached by initialization and valid operations, with the number of operations and the specification state.
- init {KB : ℕ} {om : Model.OrderMaintenance} : Model.OrderMaintenance.init proofParams KB = Except.ok om → ReachW KB 0 om Spec.State.empty
- step {KB t : ℕ} {om om' : Model.OrderMaintenance} {Sp : Spec.State} {op : Spec.Op} {a : Spec.Ans} : ReachW KB t om Sp → Spec.Op.Valid Sp op → Model.OrderMaintenance.apply proofParams om op = Except.ok (a, om') → ReachW KB (t + 1) om' (Spec.step Sp op).1
Instances For
Theorem W, option B #
The word size of a wrapper state: 64·L for the larger L of its two cores.
Equations
- OrderMaintenance.Proof.Word.wKom om = max (OrderMaintenance.Proof.Word.wK om.cur.P) (match om.nxt with | some c => OrderMaintenance.Proof.Word.wK c.P | none => 0)
Instances For
Theorem W (stored values, Level F). On every wrapper state reached by initialization and
t valid operations, every value stored in either core is below 2^K, K = 64·L for the larger
L = pL N of the two cores (wKom), handles excepted; the element index arrays and the cursor are
below 2^K; every handle stored in a core, the live count, the handle counter and the rebuild
counter are at most t. (K_B < 2^512 puts the constant K_B below 2^K too.)