Bucket Bijection and Rebuild/Overmars Metadata Lemmas for SuccinctWhpFastProb #
Internal cardinality, rebScanSteps, ClearableBufTrie, overmarsStep, and bufDelete helper
lemmas used across the SuccinctWhpFastProb proof submodules (not re-exported by
SuccinctWhpFastProb).
theorem Cslib.DataStructure.Dictionary.SuccinctWhp.CoreFastInv.mem_dom_of_loc {c U V n_max : ℕ} {θ : SeedWhp c U n_max} {fs : FastState} {dict : State U} (hc : CoreFastInv c U V n_max θ fs dict) {b loc : ℕ} (hb : b < numBucketsWhp n_max) (hloc : loc < fs.bktCount b) :
have u := ⟨FastState.keyValAt c U n_max θ.1 fs b loc, ⋯⟩;
u ∈ dom dict ∧ FeistelQuotient.feistelBucket (bWhp n_max) (bktHash c U n_max θ.1) ↑u = b
Helper: every active coordinate (b, loc) (b < M, loc < fs.bktCount b) in CoreFastInv
yields a key u : Fin U in Dictionary.dom dict with bucket b and quotient
fs.quotArr (fs.physSlot n_max b loc).
theorem Cslib.DataStructure.Dictionary.SuccinctWhp.CoreFastInv.bktCount_eq_card_filter {c U V n_max : ℕ} {θ : SeedWhp c U n_max} {fs : FastState} {dict : State U} (hc : CoreFastInv c U V n_max θ fs dict) {b : ℕ} (hb : b < numBucketsWhp n_max) :
In any CoreFastInv state, fs.bktCount b equals the exact number of keys in
Dictionary.dom dict hashing to Feistel bucket b.
theorem Cslib.DataStructure.Dictionary.SuccinctWhp.rebScanSteps_rebCollision_eq_zero_of_inj {c U n_max b : ℕ} (hth : whpThreshold c ≤ n_max) (θ : SeedWhp c U n_max) (rem : ℕ) (fs : FastState) (hcoll0 : fs.rebCollision = 0) (hcnt_le : fs.bktCount b ≤ 3 * FeistelQuotient.slabScale n_max ^ 12) (hins_ub : fs.rebInsCount + rem ≤ 8 * FeistelQuotient.slabScale n_max ^ 12) (hinj_all :
∀ l₁ < fs.bktCount b,
∀ l₂ < fs.bktCount b,
fs.locState b l₁ = 1 ∨ fs.locState b l₁ = 2 + fs.oldEp →
fs.locState b l₂ = 1 ∨ fs.locState b l₂ = 2 + fs.oldEp →
FastState.fpAt c U n_max θ fs fs.rebCandSalt b l₁ = FastState.fpAt c U n_max θ fs fs.rebCandSalt b l₂ →
l₁ = l₂) (hreb0 :
∃ (rebMap : ℕ → Option ℕ),
ValidWhpSlice n_max fs.rebInsCount (fs.slices (fs.rebSliceIdx b)) rebMap ∧ SliceMapRel (FastState.fpAt c U n_max θ fs fs.rebCandSalt b)
(fun (loc : ℕ) => fs.locState b loc = 1 ∨ fs.locState b loc = 2 + fs.oldEp)
(min (fs.bktCount b) fs.rebScanCursor) rebMap) :
When fs.fpAt c U n_max θ fs.rebCandSalt b is injective on all active Stage-2 coordinates of
bucket b, rebScanSteps never sets rebCollision to non-zero.
theorem Cslib.DataStructure.Dictionary.SuccinctWhp.ClearableBufTrie.clearSteps_nodeAlloc_eq (k : ℕ) {tr : BufTrie} :
bufClearSteps k on a ClearableBufTrie sets nodeAlloc = max 1 (tr.nodeAlloc - k).
theorem Cslib.DataStructure.Dictionary.SuccinctWhp.rebScanSteps_meta (c U n_max b : ℕ) (θ : SeedWhp c U n_max) (k : ℕ) (s : FastState) :
(rebScanSteps c U n_max θ b k s).epochClock = s.epochClock ∧ (rebScanSteps c U n_max θ b k s).curEp = s.curEp ∧ (rebScanSteps c U n_max θ b k s).buf = s.buf ∧ (rebScanSteps c U n_max θ b k s).rebStage = s.rebStage ∧ (rebScanSteps c U n_max θ b k s).dirtyCount = s.dirtyCount ∧ (rebScanSteps c U n_max θ b k s).dirtyIdx = s.dirtyIdx ∧ (rebScanSteps c U n_max θ b k s).dirtyBuckets = s.dirtyBuckets ∧ (rebScanSteps c U n_max θ b k s).rebCandSalt = s.rebCandSalt ∧ (rebScanSteps c U n_max θ b k s).bktCount = s.bktCount
theorem Cslib.DataStructure.Dictionary.SuccinctWhp.rebScanSteps_cursor_of_zero (c U n_max b : ℕ) (θ : SeedWhp c U n_max) (k : ℕ) (s : FastState) :
(rebScanSteps c U n_max θ b k s).rebCollision = 0 → (rebScanSteps c U n_max θ b k s).rebScanCursor = s.rebScanCursor + k
theorem Cslib.DataStructure.Dictionary.SuccinctWhp.overmarsStep_meta (c U n_max b : ℕ) (θ : SeedWhp c U n_max) (s : FastState) :
(overmarsStep c U n_max θ b s).epochClock = s.epochClock ∧ (overmarsStep c U n_max θ b s).curEp = s.curEp ∧ (overmarsStep c U n_max θ b s).buf = s.buf ∧ (overmarsStep c U n_max θ b s).rebStage = s.rebStage ∧ (overmarsStep c U n_max θ b s).stageCursor = s.stageCursor ∧ (overmarsStep c U n_max θ b s).dirtyCount = s.dirtyCount ∧ (overmarsStep c U n_max θ b s).dirtyIdx = s.dirtyIdx ∧ (overmarsStep c U n_max θ b s).dirtyBuckets = s.dirtyBuckets ∧ (overmarsStep c U n_max θ b s).rebCandSalt = s.rebCandSalt ∧ (overmarsStep c U n_max θ b s).rebScanCursor = s.rebScanCursor
theorem Cslib.DataStructure.Dictionary.SuccinctWhp.bufDelete_everPresent (cTab bChar : ℕ) (tr : BufTrie) (rKey k : ℕ) :