fastInsert Success and Clean-Window Preservation for SuccinctWhpFastProb #
Internal proof (fastInsert_some_and_clean_props) showing fastInsert always returns some fs1
and maintains the clean-epoch buffer-allocation and rebuild-work invariants under GoodSeedOnWindow
(not re-exported by SuccinctWhpFastProb).
theorem Cslib.DataStructure.Dictionary.SuccinctWhp.fastInsert_some_and_clean_props {c U V n_max : ℕ} {θ : SeedWhp c U n_max} {W_keys W_ins BadIns : Finset (Fin U)} {fs : FastState} {dict : State U} (hcw : CleanWindowFast c U V n_max θ W_keys BadIns fs dict) {u : Fin U} {v : ℕ} (hval : Dynamic.valid V n_max dict (Dynamic.Op.insert u v)) (hu_ins : u ∈ W_ins) (hdom_sub : ↑(dom dict) ⊆ ↑W_keys) (hu_W : u ∈ W_keys) (hinj_rkey : Set.InjOn (fpReducedKey c U n_max θ.2) ↑W_keys) (hbal_nxt : BalancedBuckets U n_max (bktHash c U n_max θ.1) (dom (Dynamic.step dict (Dynamic.Op.insert u v)).1)) (hbad_def :
∀ x ∈ W_ins,
(∃
y ∈
{w ∈ W_keys |
FeistelQuotient.feistelBucket (bWhp n_max) (bktHash c U n_max θ.1) ↑w = FeistelQuotient.feistelBucket (bWhp n_max) (bktHash c U n_max θ.1) ↑x},
x ≠ y ∧ ∃ (salt : Fin (sMaxWhp c n_max)), fpHash c U n_max θ.2 salt x = fpHash c U n_max θ.2 salt y) →
x ∈ BadIns) (hbad_lt : BadIns.card < 2 * sMaxWhp c n_max) :
∃ (fs1 : FastState),
fastInsert c U n_max θ fs u v = some fs1 ∧ fs1.epochClock = fs.epochClock ∧ (fs1.buf fs1.curEp).itemAlloc ≤ {x ∈ BadIns |
bufEverPresent (cTabWhp c) (bCharWhp n_max) (fs1.buf fs1.curEp) (fpReducedKey c U n_max θ.2 x) = true}.card ∧ stageWorkRemaining c n_max fs1 = stageWorkRemaining c n_max fs ∧ SaltBoundAt c U n_max θ W_keys fs1