Fast-Mode Deletion With Swap-Last Relocation (fastDelete_afterDel_reloc_spec) #
This module proves fastDelete_afterDel_reloc_spec: when fastFindLoc locates key u at an
interior coordinate loc_del < fs.bktCount b - 1, fastDeleteRemove followed by
fastDeleteMoveLast and fastDeleteShrink relocates the terminal item loc_last into loc_del
across physical arrays, epoch buffers, the live B+-tree, the Overmars shadow B+-tree, and any
in-progress Stage-2 bucket rebuild, preserving CoreFastInv, OvermarsBucketInv on other buckets,
PreOvermarsBucketInv on bucket b, and ValidEpochStagePreTick.
Main results #
Cslib.DataStructure.Dictionary.SuccinctWhp.fastDelete_afterDel_reloc_spec: invariant preservation for fast-mode deletion with last-element relocation.
theorem Cslib.DataStructure.Dictionary.SuccinctWhp.fastDelete_afterDel_reloc_spec {c U V n_max : ℕ} {θ : SeedWhp c U n_max} {fs : FastState} {dict : State U} (hv : ValidFastState c U V n_max θ fs dict) (u : Fin U) {loc_del : ℕ} (hld_lt : loc_del < fs.bktCount (FeistelQuotient.feistelBucket (bWhp n_max) (bktHash c U n_max θ.1) ↑u)) (hq_del :
fs.quotArr
(FastState.physSlot n_max fs (FeistelQuotient.feistelBucket (bWhp n_max) (bktHash c U n_max θ.1) ↑u) loc_del) = FeistelQuotient.keyQuotient (bWhp n_max) ↑u) (hlt_ll : loc_del < fs.bktCount (FeistelQuotient.feistelBucket (bWhp n_max) (bktHash c U n_max θ.1) ↑u) - 1) :
have b := FeistelQuotient.feistelBucket (bWhp n_max) (bktHash c U n_max θ.1) ↑u;
have loc_last := fs.bktCount b - 1;
have rebActiveB :=
decide
(fs.rebStage = 2 ∧ fs.dirtyIdx < fs.dirtyCount ∧ fs.dirtyBuckets fs.dirtyIdx = b ∧ fs.rebCandSalt < sMaxWhp c n_max ∧ fs.rebCollision = 0);
have fs1 := fastDeleteRemove c U n_max θ fs u b loc_del;
have fs2 := fastDeleteMoveLast c U n_max θ b loc_del loc_last rebActiveB fs1;
have fsA := fastDeleteShrink n_max b loc_last fs2;
CoreFastInv c U V n_max θ fsA (Function.update dict u none) ∧ (∀ b' < numBucketsWhp n_max, b' ≠ b → OvermarsBucketInv c U n_max θ fsA b') ∧ PreOvermarsBucketInv c U n_max θ fsA b ∧ ValidEpochStagePreTick c U n_max θ fsA
Intermediate fsAfterDel invariant when fastFindLoc finds loc_del < loc_last.