Metadata and Circular-Window Memory.Prog Primitives #
This module builds on Accessors.lean to provide RealizesBounded .exact (¬ReadsWidth)
Memory.Prog primitives for:
- dense item copy/clear (
copyCompItemGenProg,clearCompItemGenProg); - compacted metadata arrays (
readCompLMGenProg,writeCompLMGenProg,readCompGMGenProg,writeCompGMGenProg,readCompTDGenProg,writeCompTDGenProg,readCompDTGenProg,writeCompDTGenProg); - circular tail-to-dense window transitions (
denseOfCircGenProg,denseOfPhysGenProg,winGrowRightGenProg,winGrowLeftGenProg,winShrinkRightGenProg,winShrinkLeftGenProg).
Main definitions #
Cslib.DataStructure.Dictionary.WordRAM.ResizableSuccinct.readCompLMGenProg,writeCompLMGenProg,readCompGMGenProg,writeCompGMGenProg,readCompTDGenProg,writeCompTDGenProg,readCompDTGenProg,writeCompDTGenProg: metadata accessors.Cslib.DataStructure.Dictionary.WordRAM.ResizableSuccinct.denseOfCircGenProg,denseOfPhysGenProg,winGrowRightGenProg,winGrowLeftGenProg,winShrinkRightGenProg,winShrinkLeftGenProg: circular windowMemory.Progoperations.
Main results #
realizesBounded_denseOfPhysGen,realizesBounded_winGrowRightGen,realizesBounded_winGrowLeftGen,realizesBounded_winShrinkRightGen,realizesBounded_winShrinkLeftGen: parameter-freeRealizesBounded .exactcertificates.
Section 1: Item Copy/Clear and Metadata Array Accessors #
Copy (quot, val) from dense slot src to dst at itemBase.
copyCompItemGenProg returns ().
Copying dense item slot src (src < m_items) to dst writes its quotient and value into
dst and preserves s.frontier.
copyCompItemGenProg issues 12 memory operations.
Precondition for copying an item between two compacted item slots.
Exact, width-independent realization certificate for copyCompItemGenProg.
Clear (quot, val) to (0, 0) at dense index d before shrinking trailing words.
clearCompItemGenProg returns ().
Clearing dense slot d writes 0 to both its quotient and value, preserving s.frontier.
clearCompItemGenProg issues 8 memory operations.
Exact, width-independent realization certificate for clearCompItemGenProg.
Read LocalMeta[c, idx] at metaBase in Memory.Prog.
Reading LocalMeta[c, idx] returns compLmAt metaBase U w N s.mem (c.val, idx).
readCompLMGenProg leaves the memory state unchanged.
simp-indexed projection form of clientState_readCompLMGenProg (clientState unfolds to a
match that simp cannot index directly).
readCompLMGenProg issues 2 memory operations.
Precondition for reading from local metadata array LM.
Exact, width-independent realization certificate for readCompLMGenProg c.
Write val into LocalMeta[c, idx] at metaBase in Memory.Prog.
writeCompLMGenProg returns ().
Writing val to LocalMeta[c, idx] updates that packed slot and preserves s.frontier.
simp-indexed projection form of clientState_writeCompLMGenProg.
writeCompLMGenProg issues 4 memory operations.
Precondition for writing to local metadata array LM.
Exact, width-independent realization certificate for writeCompLMGenProg c.
Read GlobalMeta[idx] at metaBase in Memory.Prog.
Reading GlobalMeta[idx] returns compGmAt metaBase U w N s.mem idx.
readCompGMGenProg leaves the memory state unchanged.
simp-indexed projection form of clientState_readCompGMGenProg.
readCompGMGenProg issues 2 memory operations.
Precondition for reading from global metadata array GM.
Exact, width-independent realization certificate for readCompGMGenProg.
Write val into GlobalMeta[idx] at metaBase in Memory.Prog.
writeCompGMGenProg returns ().
Writing val to GlobalMeta[idx] updates that packed slot and preserves s.frontier.
simp-indexed projection form of clientState_writeCompGMGenProg.
writeCompGMGenProg issues 4 memory operations.
Precondition for writing to global metadata array GM.
Exact, width-independent realization certificate for writeCompGMGenProg.
Read TailToDense[t] at metaBase in Memory.Prog.
Reading TailToDense[t] (t < maxTailItems N) returns compTDAt metaBase U w N s.mem t.
readCompTDGenProg leaves the memory state unchanged.
simp-indexed projection form of clientState_readCompTDGenProg.
readCompTDGenProg issues 2 memory operations.
Precondition for reading from tail map TailToDense.
Exact, width-independent realization certificate for readCompTDGenProg.
Write val into TailToDense[t] at metaBase in Memory.Prog.
writeCompTDGenProg returns ().
Writing val to TailToDense[t] updates that packed slot and preserves s.frontier.
simp-indexed projection form of clientState_writeCompTDGenProg.
writeCompTDGenProg issues 4 memory operations.
Precondition for writing to tail map TailToDense.
Exact, width-independent realization certificate for writeCompTDGenProg.
Read DenseToTail[r] at metaBase in Memory.Prog.
Reading DenseToTail[r] (r < maxTailItems N) returns compDTAt metaBase U w N s.mem r.
readCompDTGenProg leaves the memory state unchanged.
simp-indexed projection form of clientState_readCompDTGenProg.
readCompDTGenProg issues 2 memory operations.
Exact, width-independent realization certificate for readCompDTGenProg.
Write val into DenseToTail[r] at metaBase in Memory.Prog.
writeCompDTGenProg returns ().
Writing val to DenseToTail[r] updates that packed slot and preserves s.frontier.
simp-indexed projection form of clientState_writeCompDTGenProg.
writeCompDTGenProg issues 4 memory operations.
Exact, width-independent realization certificate for writeCompDTGenProg.
Section 2: Circular-Window Transitions, Owner-Bucket Recovery, and fits_mkCompParams #
When positive, the tail-capacity bound maxTailItems N is at most N.
Overflow-free evaluation of denseOfCirc (cpMaxTail cp) b_win c in Memory.Prog.
denseOfCircGenProg returns denseOfCirc (maxTailItems N) b_win c when
0 < maxTailItems N → c < maxTailItems N.
denseOfCircGenProg leaves the memory state unchanged.
simp-indexed projection form of clientState_denseOfCircGenProg.
denseOfCircGenProg issues 0 memory operations.
Precondition for circular tail offset mapping denseOfCirc.
Exact, width-independent realization certificate for denseOfCircGenProg.
Map physical slot g < N to dense index denseOfPhys N gm td g in Memory.Prog.
denseOfPhysGenProg returns denseOfPhys N applied to the packed GlobalMeta and
TailToDense arrays at metaBase.
denseOfPhysGenProg leaves the memory state unchanged.
simp-indexed projection form of clientState_denseOfPhysGenProg.
Precondition for mapping physical slot index to dense index denseOfPhys.
Exact, width-independent realization certificate for denseOfPhysGenProg.
Grow circular window [b_win, b_win + n_win) on the right by 1 (winGrowRight).
winGrowRightGenProg issues 8 memory operations.
Precondition for growing the circular window on the right.
Exact, width-independent realization certificate for winGrowRightGenProg.
Growing the circular window on the right links TailToDense[n_win] and DenseToTail[c] for
c = (b_win + n_win) % maxTailItems N, preserving s.frontier.
Grow circular window [b_win + 1, b_win + 1 + n_win) on the left by 1 (winGrowLeft).
winGrowLeftGenProg issues 8 memory operations.
Precondition for growing the circular window on the left.
Exact, width-independent realization certificate for winGrowLeftGenProg.
Growing the circular window on the left links TailToDense[n_win] and DenseToTail[c] for
c = b_win % maxTailItems N, preserving s.frontier.
Shrink circular window [b_win, b_win + n_win + 1) on the right by 1 (winShrinkRight).
winShrinkRightGenProg issues 12 memory operations.
Precondition for shrinking the circular window on the right.
Exact, width-independent realization certificate for winShrinkRightGenProg.
Shrink circular window [b_win, b_win + n_win + 1) on the left by 1 (winShrinkLeft).
winShrinkLeftGenProg issues 12 memory operations.
Precondition for shrinking the circular window on the left.
Exact, width-independent realization certificate for winShrinkLeftGenProg.
Final memory state of winShrinkRightGenProg, linking DenseToTail[c_rem] with
TailToDense[n_win] for c_rem = (b_win + n_win) % maxTailItems N and preserving s.frontier.
Final memory state of winShrinkLeftGenProg, linking DenseToTail[c_rem] with
TailToDense[n_win] for c_rem = b_win % maxTailItems N and preserving s.frontier.