Documentation

CslibFrontier.DataStructure.Dictionary.WordRAM.ResizableSuccinct.Dispatch.BucketOps.QueryInsertSpec

Dictionary-Level Lookup and Split Insertion Specifications (DictStateInv) #

Establishes DictStateInv, FixedCoupled, and amortized memoryCost bounds for compacted lookup (compQueryWithHashGenProg_dict_spec) and two-phase split insertion (compInsertSearchWithHashGenProg_dict_spec, compInsertHit_dict_spec, compInsertMiss_dict_spec).

Main results #

theorem Cslib.DataStructure.Dictionary.WordRAM.ResizableSuccinct.compQueryWithHashGenProg_dict_spec {metaBase itemBase U V w N m_items : ℕ} {θ : Succinct.QuotHashSeed U N} {s_abs : State U} {s_fix s : Memory.State} (henv : CompEpochEnv U V w N metaBase itemBase m_items s) (hfit_off : WordRAM.Fits w (metaBase + offCompItems U w N)) (hinv : Succinct.DictStateInv U V (ghostW w) N 0 θ s_abs s_fix) (hcpl : FixedCoupled metaBase itemBase U V w N s_fix s) (hm_items : Succinct.totalSlots N (compGmAt metaBase U w N s.mem) ≤ m_items) (u : Fin U) :
have q := FeistelQuotient.keyQuotient (FeistelQuotient.bucketBits N) ↑u; have h_q := Succinct.hValOfSeed U N θ q; have d := ((mkCompParams U V w N, metaBase, itemBase), ↑u, h_q); have prog := compQueryWithHashGenProg d; CompQueryWithHashPre w d s ∧ (Memory.spec 0).clientState s prog = s ∧ (Memory.spec 0).clientResult s prog = s_abs u ∧ WordRAM.Realization.memoryCost prog s ≤ 38 + 12 * SuccinctBucket.probeExcess N (Succinct.qStage1 U N θ.1) (Succinct.polyStage2 U N) θ.2 (dom s_abs) u

Dictionary-level specification of compQueryWithHashGenProg: establishes CompQueryWithHashPre, leaves s unchanged, returns s_abs u, and bounds memoryCost by 38 + 12 * probeExcess.

theorem Cslib.DataStructure.Dictionary.WordRAM.ResizableSuccinct.compInsertSearchWithHashGenProg_dict_spec {metaBase itemBase U V w N m_items : ℕ} {θ : Succinct.QuotHashSeed U N} {s_abs : State U} {s_fix s : Memory.State} (henv : CompEpochEnv U V w N metaBase itemBase m_items s) (hfit_off : WordRAM.Fits w (metaBase + offCompItems U w N)) (hinv : Succinct.DictStateInv U V (ghostW w) N 0 θ s_abs s_fix) (hcpl : FixedCoupled metaBase itemBase U V w N s_fix s) (hm_items : Succinct.totalSlots N (compGmAt metaBase U w N s.mem) ≤ m_items) (u : Fin U) :
have q := FeistelQuotient.keyQuotient (FeistelQuotient.bucketBits N) ↑u; have h_q := Succinct.hValOfSeed U N θ q; have b := FeistelQuotient.feistelBucket (FeistelQuotient.bucketBits N) (Succinct.hValOfSeed U N θ) ↑u; have m := Succinct.mOfSeed U N θ q; have d := ((mkCompParams U V w N, metaBase, itemBase), ↑u, h_q); have prog := compInsertSearchWithHashGenProg d; have res_sb := (Memory.spec 0).clientResult s_fix (Succinct.searchBucketProg U V (ghostW w) N (epochHashSpace U (ghostW w) N) (((0, b), q), m)); CompQueryWithHashPre w d s ∧ (Memory.spec 0).clientState s prog = s ∧ (Memory.spec 0).clientResult s prog = ((sbFound res_sb, res_sb.2), b, m) ∧ (sbFound res_sb = 1 ↔ (s_abs u).isSome = true) ∧ (sbFound res_sb = 1 → ∃ j < Succinct.bCount N (compGmAt metaBase U w N s.mem) b, res_sb.2 = Succinct.slotOf N (compGmAt metaBase U w N s.mem) b j) ∧ WordRAM.Realization.memoryCost prog s ≤ 32 + 12 * SuccinctBucket.probeExcess N (Succinct.qStage1 U N θ.1) (Succinct.polyStage2 U N) θ.2 (dom s_abs) u

Dictionary-level specification of Phase 1 (compInsertSearchWithHashGenProg) of split compacted insertion.

theorem Cslib.DataStructure.Dictionary.WordRAM.ResizableSuccinct.compInsertHit_dict_spec {metaBase itemBase U V w N m_items : ℕ} {θ : Succinct.QuotHashSeed U N} {s_abs : State U} {s_fix s : Memory.State} (henv : CompEpochEnv U V w N metaBase itemBase m_items s) (hfit_off : WordRAM.Fits w (metaBase + offCompItems U w N)) (hinv : Succinct.DictStateInv U V (ghostW w) N 0 θ s_abs s_fix) (hcpl : FixedCoupled metaBase itemBase U V w N s_fix s) (hm_items : Succinct.totalSlots N (compGmAt metaBase U w N s.mem) ≤ m_items) (u : Fin U) (v : ℕ) (hv : v < V) (hfound : sbFound ((Memory.spec 0).clientResult s_fix (Succinct.searchBucketProg U V (ghostW w) N (epochHashSpace U (ghostW w) N) (((0, FeistelQuotient.feistelBucket (FeistelQuotient.bucketBits N) (Succinct.hValOfSeed U N θ) ↑u), FeistelQuotient.keyQuotient (FeistelQuotient.bucketBits N) ↑u), Succinct.mOfSeed U N θ (FeistelQuotient.keyQuotient (FeistelQuotient.bucketBits N) ↑u)))) = 1) :
have q := FeistelQuotient.keyQuotient (FeistelQuotient.bucketBits N) ↑u; have b := FeistelQuotient.feistelBucket (FeistelQuotient.bucketBits N) (Succinct.hValOfSeed U N θ) ↑u; have m := Succinct.mOfSeed U N θ q; have res_sb := (Memory.spec 0).clientResult s_fix (Succinct.searchBucketProg U V (ghostW w) N (epochHashSpace U (ghostW w) N) (((0, b), q), m)); have d_wv := (((mkCompParams U V w N, metaBase, itemBase), res_sb.2), v); have s' := (Memory.spec 0).clientState s (compWritePhysValGenProg d_wv); CompWritePhysValPre w d_wv s ∧ CompOpFrame metaBase itemBase U V w N m_items s s' ∧ compGmAt metaBase U w N s'.mem = compGmAt metaBase U w N s.mem ∧ WordRAM.Realization.memoryCost (compWritePhysValGenProg d_wv) s ≤ 8 ∧ ∃ (s_fix' : Memory.State), Succinct.DictStateInv U V (ghostW w) N 0 θ (Function.update s_abs u (some v)) s_fix' ∧ FixedCoupled metaBase itemBase U V w N s_fix' s'

Dictionary-level specification of Phase 2a (hit path: found = 1) of split compacted insertion (compWritePhysValGenProg).

theorem Cslib.DataStructure.Dictionary.WordRAM.ResizableSuccinct.compInsertMiss_dict_spec {metaBase itemBase U V w N m_cap : ℕ} {θ : Succinct.QuotHashSeed U N} {s_abs : State U} {s_fix s s_grown : Memory.State} (henv_grown : CompEpochEnv U V w N metaBase itemBase m_cap s_grown) (hmem_grown : s_grown.mem = s.mem) (hinv : Succinct.DictStateInv U V (ghostW w) N 0 θ s_abs s_fix) (hcpl : FixedCoupled metaBase itemBase U V w N s_fix s) (htot_lt : Succinct.totalSlots N (compGmAt metaBase U w N s.mem) < N) (hm_cap : Succinct.totalSlots N (compGmAt metaBase U w N s.mem) + 1 ≤ m_cap) (u : Fin U) (v : ℕ) (hv : v < V) (hmiss : sbFound ((Memory.spec 0).clientResult s_fix (Succinct.searchBucketProg U V (ghostW w) N (epochHashSpace U (ghostW w) N) (((0, FeistelQuotient.feistelBucket (FeistelQuotient.bucketBits N) (Succinct.hValOfSeed U N θ) ↑u), FeistelQuotient.keyQuotient (FeistelQuotient.bucketBits N) ↑u), Succinct.mOfSeed U N θ (FeistelQuotient.keyQuotient (FeistelQuotient.bucketBits N) ↑u)))) ≠ 1) :
have q := FeistelQuotient.keyQuotient (FeistelQuotient.bucketBits N) ↑u; have b := FeistelQuotient.feistelBucket (FeistelQuotient.bucketBits N) (Succinct.hValOfSeed U N θ) ↑u; have m := Succinct.mOfSeed U N θ q; have d_app := (((mkCompParams U V w N, metaBase, itemBase), b, m), ↑u, v); have s' := (Memory.spec 0).clientState s_grown (compInsertAppendNewGenProg d_app); CompInsertAppendNewPre w d_app s_grown ∧ CompOpFrame metaBase itemBase U V w N m_cap s_grown s' ∧ WordRAM.Realization.memoryCost (compInsertAppendNewGenProg d_app) s_grown + 98 * Succinct.slotPotential N (compGmAt metaBase U w N s'.mem) ≤ 98 * Succinct.slotPotential N (compGmAt metaBase U w N s.mem) + 200 ∧ ∃ (s_fix' : Memory.State), Succinct.DictStateInv U V (ghostW w) N 0 θ (Function.update s_abs u (some v)) s_fix' ∧ FixedCoupled metaBase itemBase U V w N s_fix' s'

Dictionary-level specification of Phase 2b (miss path: found ≠ 1, executed after growZeroCode extends s to s_grown with s_grown.mem = s.mem and n + 1 ≤ m_cap) of split compacted insertion (compInsertAppendNewGenProg).