Memory.Prog Dictionary Array Accessors and Slot Resolution via realize #
This module builds on the shared Memory.Prog bit-packed array primitives (readPackedProg,
writePackedProg, realizes_readPackedGen, realizes_writePackedGen in
CslibFrontier.DataStructure.Dictionary.WordRAM.BitPackedArrayProg) to wrap the four dictionary
arrays (Quotients, Values, LocalMeta, GlobalMeta) as Memory.Prog operations with uniform
Realizes .exact certificates, and realizes readBucketCountProg and resolveIndexedSlotProg via
the realize tactic.
Main definitions #
Cslib.DataStructure.Dictionary.WordRAM.Succinct.DictParams,Cslib.DataStructure.Dictionary.WordRAM.Succinct.mkDictParams: 36-word runtime register block holding precomputed layout parameters for parameter-freeRealizescertificates.Cslib.DataStructure.Dictionary.WordRAM.Succinct.DictEnv,Cslib.DataStructure.Dictionary.WordRAM.Succinct.DictEnvGen: common entry envelopes for dictionaryMemory.Progsubroutines.Cslib.DataStructure.Dictionary.WordRAM.Succinct.readQuotProg,Cslib.DataStructure.Dictionary.WordRAM.Succinct.writeQuotProg,Cslib.DataStructure.Dictionary.WordRAM.Succinct.readValProg,Cslib.DataStructure.Dictionary.WordRAM.Succinct.writeValProg,Cslib.DataStructure.Dictionary.WordRAM.Succinct.readLMProg,Cslib.DataStructure.Dictionary.WordRAM.Succinct.writeLMProg,Cslib.DataStructure.Dictionary.WordRAM.Succinct.readGMProg,Cslib.DataStructure.Dictionary.WordRAM.Succinct.writeGMProg: typedMemory.Progread/write accessors for the four packed dictionary arrays.Cslib.DataStructure.Dictionary.WordRAM.Succinct.readBucketCountProg:Memory.Progoperation readingbCount.Cslib.DataStructure.Dictionary.WordRAM.Succinct.resolveIndexedSlotProg:Memory.Progoperation translating a bucket-local indexjinto physical slotslotOf n_max gm b j.
Main results #
Cslib.DataStructure.Dictionary.WordRAM.Succinct.realizes_readBucketCountGen,Cslib.DataStructure.Dictionary.WordRAM.Succinct.realizes_resolveIndexedSlotGen: uniformRealizescertificates forreadBucketCountGenProgandresolveIndexedSlotGenProg.Cslib.DataStructure.Dictionary.WordRAM.Succinct.writeQuotProg_effect,Cslib.DataStructure.Dictionary.WordRAM.Succinct.writeValProg_effect,Cslib.DataStructure.Dictionary.WordRAM.Succinct.writeLMProg_effect,Cslib.DataStructure.Dictionary.WordRAM.Succinct.writeGMProg_effect: pure logical array update lemmas for the four packed dictionary arrays.Cslib.DataStructure.Dictionary.WordRAM.Succinct.GmFrame,Cslib.DataStructure.Dictionary.WordRAM.Succinct.gmFrame_writeGMProg,Cslib.DataStructure.Dictionary.WordRAM.Succinct.gmAt_writeGMProg: the frame of a run that writes onlyGlobalMeta(chained withGmFrame.trans, turned into the six-part_effectform byGmFrame.effect) and the frame andgmAtupdate of onewriteGMProg.Cslib.DataStructure.Dictionary.WordRAM.Succinct.memoryCost_bind_of_clientState_eq: memory charges ofp >>= kafter a state-preserving prefixp, indo-block form.
Memory charges of p >>= k when p leaves the state unchanged (for example, a run of reads):
the continuation is charged from the same state. Unlike memoryCost_bind, this is stated for
>>=, the form do blocks elaborate to, so it rewrites them directly.
Runtime register block of 36 precomputed dictionary layout parameters.
Instances For
Construct the 36-word parameter vector for (U, V, w, n_max, h_space).
Word width w in DictParams.
Maximum capacity n_max in DictParams.
Precomputed n_max - 1 in DictParams.
Quotient array word offset offQuot h_space in DictParams.
Quotient bit width quotientBits U n_max in DictParams.
Value array word offset offVal U w n_max h_space in DictParams.
Value bit width valBits V in DictParams.
Sub-array word offset offLMSub U V w n_max h_space c in DictParams.
Local metadata bit width effBucketPosBits n_max in DictParams.
Global metadata word offset offGM U V w n_max h_space in DictParams.
Global metadata pointer bit width globalPtrBits n_max in DictParams.
Bucket index bit width bucketBits n_max in DictParams.
Bucket bitmask 2 ^ bucketBits n_max - 1 in DictParams.
Full-slab size slabSize n_max in DictParams.
Precomputed slabSize n_max - 1 in DictParams.
Precomputed 2 * slabSize n_max in DictParams.
Per-bucket slab directory size dirSlabsPerBucket n_max in DictParams.
Precomputed dirSlabsPerBucket n_max - 1 in DictParams.
Per-bucket tail capacity tailCapPerBucket n_max in DictParams.
Slab directory base index gmSlabDirBase n_max in DictParams.
Tail pointer base index gmTailPtrBase n_max in DictParams.
Tail owner base index gmTailOwnerBase n_max in DictParams.
Slab metadata base index gmSlabMetaBase n_max in DictParams.
Micro-buckets per bucket numMicroPerBucket n_max in DictParams.
Effective per-bucket slot cap min n_max (effBucketCap n_max) in DictParams.
Key universe size U in DictParams.
Value universe size V in DictParams.
Hash block word count h_space in DictParams.
Common entry envelope for dictionary Memory.Prog operations at base.
Combined runtime parameter and memory envelope for parameter-free Realizes certificates.
Base address d.2.1 in a parameter-free dictionary read/bucket input (dp, (base, idx)).
Slot, entry, or bucket index d.2.2 in a parameter-free dictionary read/bucket input
(dp, (base, idx)).
Base address d.2.1.1 in a parameter-free dictionary write/slot input
(dp, ((base, idx), val)).
Primary slot or bucket index d.2.1.2 in a parameter-free dictionary write/slot input
(dp, ((base, idx), val)).
Trailing value or local slot index d.2.2 in a parameter-free dictionary write/slot input
(dp, ((base, idx), val)).
Parameter-free Memory.Prog operation reading Quotients[dictReadIdx d] at
base = dictReadBase d.
Read Quotients[d.2] at base = d.1 in Memory.Prog.
Parameter-free Memory.Prog operation writing dictWriteVal d to
Quotients[dictWriteIdx d] at base = dictWriteBase d.
Write val to Quotients[idx] at base in Memory.Prog.
Parameter-free Memory.Prog operation reading Values[dictReadIdx d] at
base = dictReadBase d.
Read Values[d.2] at base = d.1 in Memory.Prog.
Parameter-free Memory.Prog operation writing dictWriteVal d to
Values[dictWriteIdx d] at base = dictWriteBase d.
Write val to Values[idx] at base in Memory.Prog.
Parameter-free Memory.Prog operation reading LocalMeta[c, dictReadIdx d] at
base = dictReadBase d.
Read LocalMeta[c, d.2] at base = d.1 in Memory.Prog.
Parameter-free Memory.Prog operation writing dictWriteVal d to
LocalMeta[c, dictWriteIdx d] at base = dictWriteBase d.
Write val to LocalMeta[c, idx] at base in Memory.Prog.
Parameter-free Memory.Prog operation reading GlobalMeta[dictReadIdx d] at
base = dictReadBase d.
Read GlobalMeta[d.2] at base = d.1 in Memory.Prog.
Parameter-free Memory.Prog operation writing dictWriteVal d to
GlobalMeta[dictWriteIdx d] at base = dictWriteBase d.
Write val to GlobalMeta[idx] at base in Memory.Prog.
Parameter-free Memory.Prog operation reading bCount (d = (dp, (base, b))).
Memory.Prog operation reading bCount n_max gm b (d = (base, b)).
Parameter-free Memory.Prog operation resolving indexed local slot j = dictWriteVal d of
bucket b = dictWriteIdx d at base = dictWriteBase d.
Memory.Prog operation resolving indexed local slot j = d.2 < effBucketCap n_max of bucket
b = dictArgIdx d at base = dictArgBase d to physical slot slotOf n_max gm b j < n_max.
Helper tactic that simplifies all DictParams field accessors and primitive Memory.Prog
projections after dp = mkDictParams U V w₀ n_max h_space has been substituted.
Helper tactic for parameter-free Realizes proofs over DictParams × D with extra
simplification lemmas for sub-programs and preconditions. Optional using [certificates]
forwards method certificates to realize.
Helper tactic for parameter-free Realizes proofs over DictParams × D:
runs realize and unpacks d = (dp, d) and DictEnvGen (h.1) in every resulting goal.
Optional using [certificates] supplies local method certificates.
Closes a routine side goal left by realizeDict/realizeDictWith over GlobalMeta: the entry
envelope or an index bound from the context (possibly under the branch condition), or a Fits
goal for a small constant, a GlobalMeta index or a value at most n_max. It uses the names
hw, hnU and hU that realizeDict binds, and matches hypotheses only up to reducible
unfolding, so that it never evaluates the programs inside clientResult.
Section 3: readBucketCountProg and resolveIndexedSlotProg via realize #
Section 4: Pure state effects and costs of read*Prog and write*Prog #
Pure state effect of writeQuotProg.
Pure state effect of writeValProg.
Pure state effect of writeLMProg.
Section 5: GlobalMeta-only frames #
Frame of a run that writes only the GlobalMeta region of the dictionary at base: the
frontier and all memory outside [base + offGM U V w n_max h_space, base + totalSpace U V w n_max h_space) are unchanged. GmFrame.trans chains the frames of consecutive writes, and
GmFrame.effect turns a frame and the resulting gmAt into the six-part form of the
GlobalMeta operations' _effect theorems.
The six-part effect of a GlobalMeta-only run with resulting GlobalMeta contents g.
Pure state effect of writeGMProg.