Documentation

CslibFrontier.DataStructure.Dictionary.WordRAM.ResizableSuccinct.Dispatch.MicroSearchOps

Compacted Doubly-Linked Micro-Chains, Two-Phase Bucket Search, and Lookup in Memory.Prog #

This module implements the compacted LocalMeta doubly-linked chain primitives, Phase 1 micro-chain search, Phase 2 overflow search, combined two-phase bucket search, and lookup body in Memory.Prog (¬ReadsWidth, certified via by realize, RealizesBounded.while₀, and RealizesBounded.iterate₀), coupling every operation via FixedCoupled to the fixed-capacity reference operations in SuccinctMicroChain.lean, SuccinctSearch.lean, and SuccinctChainOps.lean:

Main definitions #

Main results #

References #

Section 1: Compacted LocalMeta Accessors and Doubly-Linked Chain Updates #

Conditionally prepend j_new to micro-chain (b, m) when j_new < min N (effBucketCap N).

theorem Cslib.DataStructure.Dictionary.WordRAM.ResizableSuccinct.compPrependIfIndexedGenProg_effect {metaBase itemBase U V w N m_cap b m j_new : ℕ} {s_fix s : Memory.State} (hw : 0 < w) (hitem : metaBase + offCompItems U w N ≤ itemBase) (hcpl : FixedCoupled metaBase itemBase U V w N s_fix s) (hb : b < FeistelQuotient.numBuckets N) (hm : m < SuccinctBucket.numMicroPerBucket N) (hold : Succinct.lmHead N (compLmAt metaBase U w N s.mem) b m ≤ SuccinctBucket.effBucketCap N) :
have s' := (Memory.spec 0).clientState s (compPrependIfIndexedGenProg (((mkCompParams U V w N, metaBase), b, m), j_new)); have s_fix' := (Memory.spec 0).clientState s_fix (Succinct.prependIfIndexedProg U V (ghostW w) N (epochHashSpace U (ghostW w) N) (((0, b), m), j_new)); CompOpFrame metaBase itemBase U V w N m_cap s s' ∧ FixedCoupled metaBase itemBase U V w N s_fix' s'

Conditionally unlink j_del from micro-chain (b, m) when j_del < min N (effBucketCap N).

theorem Cslib.DataStructure.Dictionary.WordRAM.ResizableSuccinct.compUnlinkIfIndexedGenProg_effect {metaBase itemBase U V w N m_cap b m j_del : ℕ} {s_fix s : Memory.State} (hw : 0 < w) (hitem : metaBase + offCompItems U w N ≤ itemBase) (hcpl : FixedCoupled metaBase itemBase U V w N s_fix s) (hb : b < FeistelQuotient.numBuckets N) (hm : m < SuccinctBucket.numMicroPerBucket N) (hbounds : j_del < SuccinctBucket.effBucketCap N → Succinct.lmPrev N (compLmAt metaBase U w N s.mem) b j_del ≤ SuccinctBucket.effBucketCap N ∧ Succinct.lmNext N (compLmAt metaBase U w N s.mem) b j_del ≤ SuccinctBucket.effBucketCap N) :
have s' := (Memory.spec 0).clientState s (compUnlinkIfIndexedGenProg (((mkCompParams U V w N, metaBase), b, m), j_del)); have s_fix' := (Memory.spec 0).clientState s_fix (Succinct.unlinkIfIndexedProg U V (ghostW w) N (epochHashSpace U (ghostW w) N) (((0, b), m), j_del)); CompOpFrame metaBase itemBase U V w N m_cap s s' ∧ FixedCoupled metaBase itemBase U V w N s_fix' s'

Section 2: Phase 1 Micro-Chain Search (compSearchMicroChainGenProg) #

theorem Cslib.DataStructure.Dictionary.WordRAM.ResizableSuccinct.clientResult_denseOfPhys_slotOf {metaBase itemBase U V w N m_items b j : ℕ} {s_fix s : Memory.State} (hcpl : FixedCoupled metaBase itemBase U V w N s_fix s) (_henv : CompEpochEnv U V w N metaBase itemBase m_items s) (hslot : Succinct.SlotStoreInv N (compGmAt metaBase U w N s.mem)) (hb : b < FeistelQuotient.numBuckets N) (hj : j < Succinct.bCount N (compGmAt metaBase U w N s.mem) b) :
(Memory.spec 0).clientResult s (denseOfPhysGenProg ((mkCompParams U V w N, metaBase), Succinct.slotOf N (compGmAt metaBase U w N s.mem) b j)) = denseOfPhys N (compGmAt metaBase U w N s.mem) (compTDAt metaBase U w N s.mem) (Succinct.slotOf N (compGmAt metaBase U w N s.mem) b j)

Resolve physical slot phys through denseOfPhysGenProg and read its dense quotient.

theorem Cslib.DataStructure.Dictionary.WordRAM.ResizableSuccinct.clientResult_compReadPhysQuot_slotOf {metaBase itemBase U V w N m_items b j : ℕ} {s_fix s : Memory.State} (hcpl : FixedCoupled metaBase itemBase U V w N s_fix s) (henv : CompEpochEnv U V w N metaBase itemBase m_items s) (hslot : Succinct.SlotStoreInv N (compGmAt metaBase U w N s.mem)) (hm_items : epochTotalSlots N (compGmAt metaBase U w N s.mem) ≤ m_items) (hb : b < FeistelQuotient.numBuckets N) (hj : j < Succinct.bCount N (compGmAt metaBase U w N s.mem) b) :
(Memory.spec 0).clientResult s (compReadPhysQuotGenProg ((mkCompParams U V w N, metaBase, itemBase), Succinct.slotOf N (compGmAt metaBase U w N s.mem) b j)) = Succinct.quotAt 0 U (ghostW w) N (epochHashSpace U (ghostW w) N) s_fix.mem (Succinct.slotOf N (compGmAt metaBase U w N s.mem) b j)

Section 3: Phase 2 Overflow Search (compSearchOverflowGenProg) #

Section 4: Combined Bucket Search (compSearchBucketGenProg) and Lookup #

(compQueryBodyGenProg)

Combined two-phase bucket search on compacted metadata (¬ReadsWidth): searches micro-chain (b, m) via compSearchMicroChainGenProg, and on miss searches overflow slots via compSearchOverflowGenProg. Returns ((found, j_found), phys_found).

theorem Cslib.DataStructure.Dictionary.WordRAM.ResizableSuccinct.compSearchBucketGenProg_spec {metaBase itemBase U V w N m_items b q_target m : ℕ} {L : List ℕ} {s_fix s : Memory.State} (henv : CompEpochEnv U V w N metaBase itemBase m_items s) (hcpl : FixedCoupled metaBase itemBase U V w N s_fix s) (hslot : Succinct.SlotStoreInv N (compGmAt metaBase U w N s.mem)) (hm_items : epochTotalSlots N (compGmAt metaBase U w N s.mem) ≤ m_items) (hb : b < FeistelQuotient.numBuckets N) (hm : m < SuccinctBucket.numMicroPerBucket N) (hchain : Succinct.IsDLChain N (Succinct.lmHead N (compLmAt metaBase U w N s.mem) b m) (Succinct.lmPrev N (compLmAt metaBase U w N s.mem) b) (Succinct.lmNext N (compLmAt metaBase U w N s.mem) b) L) (hc_lt : ∀ j ∈ L, j < Succinct.bCount N (compGmAt metaBase U w N s.mem) b) :
have gm := compGmAt metaBase U w N s.mem; have prog := compSearchBucketGenProg (((mkCompParams U V w N, metaBase, itemBase), b, q_target), m); have prog_fix := Succinct.searchBucketProg U V (ghostW w) N (epochHashSpace U (ghostW w) N) (((0, b), q_target), m); (Memory.spec 0).clientState s prog = s ∧ (Memory.spec 0).clientResult s prog = (Memory.spec 0).clientResult s_fix prog_fix ∧ WordRAM.Realization.memoryCost prog s ≤ 10 + 12 * L.length + 10 * (Succinct.bCount N gm b - SuccinctBucket.effBucketCap N)

Compacted dictionary lookup body (¬ReadsWidth): searches bucket (b, m) for q_target, and if found (found = 1), translates phys via denseOfPhysGenProg and reads some v from the dense item stream.

theorem Cslib.DataStructure.Dictionary.WordRAM.ResizableSuccinct.searchBucket_found_slotOf {metaBase itemBase U V w N m_items b q_target m : ℕ} {L : List ℕ} {s_fix s : Memory.State} (henv : CompEpochEnv U V w N metaBase itemBase m_items s) (hcpl : FixedCoupled metaBase itemBase U V w N s_fix s) (hslot : Succinct.SlotStoreInv N (compGmAt metaBase U w N s.mem)) (hm_items : epochTotalSlots N (compGmAt metaBase U w N s.mem) ≤ m_items) (hb : b < FeistelQuotient.numBuckets N) (hm : m < SuccinctBucket.numMicroPerBucket N) (hchain : Succinct.IsDLChain N (Succinct.lmHead N (compLmAt metaBase U w N s.mem) b m) (Succinct.lmPrev N (compLmAt metaBase U w N s.mem) b) (Succinct.lmNext N (compLmAt metaBase U w N s.mem) b) L) (hc_lt : ∀ j ∈ L, j < Succinct.bCount N (compGmAt metaBase U w N s.mem) b) :
match (Memory.spec 0).clientResult s (compSearchBucketGenProg (((mkCompParams U V w N, metaBase, itemBase), b, q_target), m)) with | ((found, j_found), phys_found) => found = 1 → j_found < Succinct.bCount N (compGmAt metaBase U w N s.mem) b ∧ phys_found = Succinct.slotOf N (compGmAt metaBase U w N s.mem) b j_found
theorem Cslib.DataStructure.Dictionary.WordRAM.ResizableSuccinct.compQueryBodyGenProg_spec {metaBase itemBase U V w N m_items b q_target m : ℕ} {L : List ℕ} {s_fix s : Memory.State} (henv : CompEpochEnv U V w N metaBase itemBase m_items s) (hcpl : FixedCoupled metaBase itemBase U V w N s_fix s) (hslot : Succinct.SlotStoreInv N (compGmAt metaBase U w N s.mem)) (hm_items : epochTotalSlots N (compGmAt metaBase U w N s.mem) ≤ m_items) (hb : b < FeistelQuotient.numBuckets N) (hm : m < SuccinctBucket.numMicroPerBucket N) (hchain : Succinct.IsDLChain N (Succinct.lmHead N (compLmAt metaBase U w N s.mem) b m) (Succinct.lmPrev N (compLmAt metaBase U w N s.mem) b) (Succinct.lmNext N (compLmAt metaBase U w N s.mem) b) L) (hc_lt : ∀ j ∈ L, j < Succinct.bCount N (compGmAt metaBase U w N s.mem) b) :
have gm := compGmAt metaBase U w N s.mem; have prog := compQueryBodyGenProg (((mkCompParams U V w N, metaBase, itemBase), b, q_target), m); have prog_fix := Succinct.queryBodyProg U V (ghostW w) N (epochHashSpace U (ghostW w) N) (((0, b), q_target), m); (Memory.spec 0).clientState s prog = s ∧ (Memory.spec 0).clientResult s prog = (Memory.spec 0).clientResult s_fix prog_fix ∧ WordRAM.Realization.memoryCost prog s ≤ 16 + 12 * L.length + 10 * (Succinct.bCount N gm b - SuccinctBucket.effBucketCap N)