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:
- internal
LocalMetaaccessors and chain updates realizingcompPrependIfIndexedGenProgandcompUnlinkIfIndexedGenProg:O(1)doubly-linked micro-chain updates preservingFixedCoupledagainstprependIfIndexedProgandunlinkIfIndexedProg; compReadPhysQuotGenProg,compSearchBucketGenProg,compQueryBodyGenProg: read-only physical quotient lookup and two-phase bucket search and lookup (via internal Phase 1 micro-chain and Phase 2 overflow subroutines) returning the exact same results as their fixed-capacity counterparts ons_fix.
Main definitions #
Cslib.DataStructure.Dictionary.WordRAM.ResizableSuccinct.compPrependIfIndexedGenProg,Cslib.DataStructure.Dictionary.WordRAM.ResizableSuccinct.compUnlinkIfIndexedGenProg: conditional micro-chain prepend and unlink on compactedLocalMeta.Cslib.DataStructure.Dictionary.WordRAM.ResizableSuccinct.compReadPhysQuotGenProg,Cslib.DataStructure.Dictionary.WordRAM.ResizableSuccinct.compSearchBucketGenProg,Cslib.DataStructure.Dictionary.WordRAM.ResizableSuccinct.compQueryBodyGenProg: compacted physical quotient read, two-phase bucket search, and lookup body.
Main results #
Cslib.DataStructure.Dictionary.WordRAM.ResizableSuccinct.compPrependIfIndexedGenProg_effect,realizesBounded_compPrependIfIndexedGen,validProg_compPrependIfIndexedGen:FixedCoupledequivalence toprependIfIndexedProgandRealizesBounded/ValidProg.Cslib.DataStructure.Dictionary.WordRAM.ResizableSuccinct.compUnlinkIfIndexedGenProg_effect,realizesBounded_compUnlinkIfIndexedGen,validProg_compUnlinkIfIndexedGen:FixedCoupledequivalence tounlinkIfIndexedProg,RealizesBounded .exact, andValidProg.Cslib.DataStructure.Dictionary.WordRAM.ResizableSuccinct.compSearchBucketGenProg_spec,Cslib.DataStructure.Dictionary.WordRAM.ResizableSuccinct.realizesBounded_compSearchBucketGen,Cslib.DataStructure.Dictionary.WordRAM.ResizableSuccinct.validProg_compSearchBucketGen: exact result agreement withsearchBucketProg,O(1 + |L| + ovf)memoryCost,RealizesBounded .exact, andValidProg.Cslib.DataStructure.Dictionary.WordRAM.ResizableSuccinct.compQueryBodyGenProg_spec,Cslib.DataStructure.Dictionary.WordRAM.ResizableSuccinct.realizesBounded_compQueryBodyGen,Cslib.DataStructure.Dictionary.WordRAM.ResizableSuccinct.validProg_compQueryBodyGen: exact result agreement withqueryBodyProg,RealizesBounded .exact, andValidProg.
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).
Precondition for compPrependIfIndexedGenProg.
Conditionally unlink j_del from micro-chain (b, m) when j_del < min N (effBucketCap N).
Precondition for compUnlinkIfIndexedGenProg.
Section 2: Phase 1 Micro-Chain Search (compSearchMicroChainGenProg) #
Resolve physical slot phys through denseOfPhysGenProg and read its dense quotient.
Precondition for compReadPhysQuotGenProg and compReadPhysValGenProg.
Precondition for compSearchBucketGenProg.
Section 3: Phase 2 Overflow Search (compSearchOverflowGenProg) #
Section 4: Combined Bucket Search (compSearchBucketGenProg) and Lookup #
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).
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.