Documentation

CslibFrontier.DataStructure.Dictionary.WordRAM.SuccinctWhpFastBaseProg.Internal

Internal Frame and Packed-Segment Helpers for SuccinctWhpFastBaseProg #

Privately imported proof infrastructure shared across the SuccinctWhpFastBaseProg submodules (SliceBuf, HeaderBkt, SlotArrays, LocPoolArrays). This module is intentionally omitted from the SuccinctWhpFastBaseProg umbrella's public imports so internal proof helpers do not leak into the public API.

theorem Cslib.DataStructure.Dictionary.WordRAM.SuccinctWhp.seg_add_le {base off len sp : ℕ} (h : off + len ≤ sp) :
base + off + len ≤ base + sp

Reassociate off + len ≤ sp into base + off + len ≤ base + sp.

theorem Cslib.DataStructure.Dictionary.WordRAM.SuccinctWhp.WhpLargeEnv.packed_safe_true {c U V w n_max base off N k idx : ℕ} (henv : WhpLargeEnv c U V w n_max w base) (hk : k ≤ w) (hidx : idx < N) (hseg : off + BitPackedArray.packedWords N k w ≤ SuccinctWhp.largeSpaceWhp c U V w n_max) :
∃ (N' : ℕ), True ∧ 0 < w ∧ k ≤ w ∧ idx < N' ∧ WordRAM.Fits w (base + off + BitPackedArray.packedWords N' k w)

Packed-array safety discharge in the form expected by realizes_readPackedGen / realizes_writePackedGen.

theorem Cslib.DataStructure.Dictionary.WordRAM.SuccinctWhp.mul_add_inj_right {B a₁ b₁ a₂ b₂ : ℕ} (hb₁ : b₁ < B) (hb₂ : b₂ < B) (heq : a₁ * B + b₁ = a₂ * B + b₂) :
a₁ = a₂ ∧ b₁ = b₂

Injectivity of row-major index encoding a * B + b for b < B.

theorem Cslib.DataStructure.Dictionary.WordRAM.SuccinctWhp.bktMeta_congr_of_readPacked {base c U V w n_max b : ℕ} {fs : SuccinctWhp.FastState} {mem₁ mem₂ : ℕ → ℕ} (h9 : ∀ k < 10, BitPackedArray.readPacked (base + offBktMeta c U V w n_max) (SuccinctBucket.globalPtrBits n_max) w mem₂ (16 * b + k) = BitPackedArray.readPacked (base + offBktMeta c U V w n_max) (SuccinctBucket.globalPtrBits n_max) w mem₁ (16 * b + k)) (hm : have bm := offBktMeta c U V w n_max; have g := SuccinctBucket.globalPtrBits n_max; BitPackedArray.readPacked (base + bm) g w mem₁ (16 * b + 0) = fs.bktCount b ∧ BitPackedArray.readPacked (base + bm) g w mem₁ (16 * b + 1) = fs.bktSalt b ∧ BitPackedArray.readPacked (base + bm) g w mem₁ (16 * b + 2) = fs.liveRole b ∧ BitPackedArray.readPacked (base + bm) g w mem₁ (16 * b + 3) = fs.liveInsCount b ∧ BitPackedArray.readPacked (base + bm) g w mem₁ (16 * b + 4) = fs.overmarsRole b ∧ BitPackedArray.readPacked (base + bm) g w mem₁ (16 * b + 5) = fs.overmarsActive b ∧ BitPackedArray.readPacked (base + bm) g w mem₁ (16 * b + 6) = fs.overmarsCursor b ∧ BitPackedArray.readPacked (base + bm) g w mem₁ (16 * b + 7) = fs.overmarsInsCount b ∧ BitPackedArray.readPacked (base + bm) g w mem₁ (16 * b + 8) = fs.rebDoneFlag b ∧ BitPackedArray.readPacked (base + bm) g w mem₁ (16 * b + 9) = fs.rebQueued b) :
have bm := offBktMeta c U V w n_max; have g := SuccinctBucket.globalPtrBits n_max; BitPackedArray.readPacked (base + bm) g w mem₂ (16 * b + 0) = fs.bktCount b ∧ BitPackedArray.readPacked (base + bm) g w mem₂ (16 * b + 1) = fs.bktSalt b ∧ BitPackedArray.readPacked (base + bm) g w mem₂ (16 * b + 2) = fs.liveRole b ∧ BitPackedArray.readPacked (base + bm) g w mem₂ (16 * b + 3) = fs.liveInsCount b ∧ BitPackedArray.readPacked (base + bm) g w mem₂ (16 * b + 4) = fs.overmarsRole b ∧ BitPackedArray.readPacked (base + bm) g w mem₂ (16 * b + 5) = fs.overmarsActive b ∧ BitPackedArray.readPacked (base + bm) g w mem₂ (16 * b + 6) = fs.overmarsCursor b ∧ BitPackedArray.readPacked (base + bm) g w mem₂ (16 * b + 7) = fs.overmarsInsCount b ∧ BitPackedArray.readPacked (base + bm) g w mem₂ (16 * b + 8) = fs.rebDoneFlag b ∧ BitPackedArray.readPacked (base + bm) g w mem₂ (16 * b + 9) = fs.rebQueued b

Congruence for the 10 scalar bucket-metadata fields in offBktMeta.

theorem Cslib.DataStructure.Dictionary.WordRAM.SuccinctWhp.bufTrieMemRep_congr_nonBuf {base c U V w n_max ep : ℕ} {tr : SuccinctWhp.BufTrie} {mem₁ mem₂ : ℕ → ℕ} (hw : 0 < w) (hep : ep = 0 ∨ ep = 1) (hhdr : ∀ (h : ℕ), 12 ≤ h → h < 16 → mem₂ (base + h) = mem₁ (base + h)) (htrie : ∀ (a : ℕ), base + offTrieChild0 c U V w n_max ≤ a → a < base + offTrieItems0 c U V w n_max → mem₂ a = mem₁ a) (hit0 : ∀ id < 3 * SuccinctWhp.qEpochWhp n_max, BitPackedArray.readPacked (base + offTrieItems0 c U V w n_max) (SuccinctBucket.globalPtrBits n_max) w mem₂ id = BitPackedArray.readPacked (base + offTrieItems0 c U V w n_max) (SuccinctBucket.globalPtrBits n_max) w mem₁ id) (hit1 : ∀ (a : ℕ), base + offTrieItems1 c U V w n_max ≤ a → a < base + SuccinctWhp.largeSpaceWhp c U V w n_max → mem₂ a = mem₁ a) (hrep : BufTrieMemRep base c U V w n_max ep tr mem₁) :
BufTrieMemRep base c U V w n_max ep tr mem₂

BufTrieMemRep invariance when headers 12..15 and [offTrieChild0, largeSpaceWhp) are unchanged (or offTrieItems0 is only modified at indices ≥ 3 * qEpochWhp).

theorem Cslib.DataStructure.Dictionary.WordRAM.SuccinctWhp.fastStep_nonSliceNonBuf {base c U V w n_max : ℕ} {θ : SuccinctWhp.SeedWhp c U n_max} {fs fs' : SuccinctWhp.FastState} {s s' : Memory.State} (hw : 0 < w) (hfr : s'.frontier = s.frontier) (hseed : SeedWhpMemRep base c U w n_max θ s.mem) (hrep : FastMemRep base c U V w n_max fs s.mem) (hsl_eq : fs'.slices = fs.slices) (hbuf_eq : fs'.buf = fs.buf) (hfence : ∀ (a : ℕ), a < base ∨ base + 12 ≤ a ∧ a < base + offQuotWhp c w n_max ∨ base + offBtMeta c U V w n_max ≤ a ∧ a < base + offTrieItems0 c U V w n_max ∨ base + offTrieItems1 c U V w n_max ≤ a → s'.mem a = s.mem a) (hbm_sl : ∀ idx < 16 * SuccinctWhp.numBucketsWhp n_max, 10 ≤ idx % 16 → BitPackedArray.readPacked (base + offBktMeta c U V w n_max) (SuccinctBucket.globalPtrBits n_max) w s'.mem idx = BitPackedArray.readPacked (base + offBktMeta c U V w n_max) (SuccinctBucket.globalPtrBits n_max) w s.mem idx) (hit0 : ∀ id < 3 * SuccinctWhp.qEpochWhp n_max, BitPackedArray.readPacked (base + offTrieItems0 c U V w n_max) (SuccinctBucket.globalPtrBits n_max) w s'.mem id = BitPackedArray.readPacked (base + offTrieItems0 c U V w n_max) (SuccinctBucket.globalPtrBits n_max) w s.mem id) (hdc_le : fs'.dirtyCount ≤ SuccinctWhp.qEpochWhp n_max) (hhdrs : s'.mem (base + hdrMode) = 1 ∧ s'.mem (base + hdrPoolFreeTop) = fs'.poolFreeTop ∧ s'.mem (base + hdrCurEp) = fs'.curEp ∧ s'.mem (base + hdrEpochClock) = fs'.epochClock ∧ s'.mem (base + hdrRebStage) = fs'.rebStage ∧ s'.mem (base + hdrStageCursor) = fs'.stageCursor ∧ s'.mem (base + hdrDirtyCount) = fs'.dirtyCount ∧ s'.mem (base + hdrDirtyIdx) = fs'.dirtyIdx ∧ s'.mem (base + hdrRebCandSalt) = fs'.rebCandSalt ∧ s'.mem (base + hdrRebScanCursor) = fs'.rebScanCursor ∧ s'.mem (base + hdrRebInsCount) = fs'.rebInsCount ∧ s'.mem (base + hdrRebCollision) = fs'.rebCollision) (hqv : ∀ i < n_max, BitPackedArray.readPacked (base + offQuotWhp c w n_max) (SuccinctWhp.quotBitsWhp U n_max) w s'.mem i = fs'.quotArr i ∧ BitPackedArray.readPacked (base + offValWhp c U w n_max) (FeistelQuotient.valBits V) w s'.mem i = fs'.valArr i) (hloc : ∀ b < SuccinctWhp.numBucketsWhp n_max, ∀ loc < SuccinctWhp.totalLocalCoordsWhp n_max, BitPackedArray.readPacked (base + offLocState c U V w n_max) 2 w s'.mem (b * SuccinctWhp.totalLocalCoordsWhp n_max + loc) = fs'.locState b loc) (hbmeta : ∀ b < SuccinctWhp.numBucketsWhp n_max, have bm := offBktMeta c U V w n_max; have g := SuccinctBucket.globalPtrBits n_max; BitPackedArray.readPacked (base + bm) g w s'.mem (16 * b + 0) = fs'.bktCount b ∧ BitPackedArray.readPacked (base + bm) g w s'.mem (16 * b + 1) = fs'.bktSalt b ∧ BitPackedArray.readPacked (base + bm) g w s'.mem (16 * b + 2) = fs'.liveRole b ∧ BitPackedArray.readPacked (base + bm) g w s'.mem (16 * b + 3) = fs'.liveInsCount b ∧ BitPackedArray.readPacked (base + bm) g w s'.mem (16 * b + 4) = fs'.overmarsRole b ∧ BitPackedArray.readPacked (base + bm) g w s'.mem (16 * b + 5) = fs'.overmarsActive b ∧ BitPackedArray.readPacked (base + bm) g w s'.mem (16 * b + 6) = fs'.overmarsCursor b ∧ BitPackedArray.readPacked (base + bm) g w s'.mem (16 * b + 7) = fs'.overmarsInsCount b ∧ BitPackedArray.readPacked (base + bm) g w s'.mem (16 * b + 8) = fs'.rebDoneFlag b ∧ BitPackedArray.readPacked (base + bm) g w s'.mem (16 * b + 9) = fs'.rebQueued b) (hbptr : ∀ b < SuccinctWhp.numBucketsWhp n_max, ∀ k < SuccinctWhp.capBackWhp n_max, BitPackedArray.readPacked (base + offBackPtr c U V w n_max) (SuccinctBucket.globalPtrBits n_max) w s'.mem (b * SuccinctWhp.capBackWhp n_max + k) = fs'.backPtr b k) (hpool : ∀ j < SuccinctWhp.poolSizeWhp n_max, BitPackedArray.readPacked (base + offPoolFreeStack c U V w n_max) (SuccinctBucket.globalPtrBits n_max) w s'.mem j = fs'.poolFreeStack j ∧ BitPackedArray.readPacked (base + offPoolOwner c U V w n_max) (SuccinctBucket.globalPtrBits n_max) w s'.mem j = fs'.poolOwner j) (hdirty : ∀ j < fs'.dirtyCount, BitPackedArray.readPacked (base + offTrieItems0 c U V w n_max) (SuccinctBucket.globalPtrBits n_max) w s'.mem (3 * SuccinctWhp.qEpochWhp n_max + j) = fs'.dirtyBuckets j) :
FastStateStep base c U V w n_max θ fs' s s'

Master frame helper for scalar/array updates that leave slices and buf unchanged.

theorem Cslib.DataStructure.Dictionary.WordRAM.SuccinctWhp.fastStep_pureArray {base c U V w n_max offW NW kW idxW valW : ℕ} {θ : SuccinctWhp.SeedWhp c U n_max} {fs fs' : SuccinctWhp.FastState} {s : Memory.State} (hw : 0 < w) (hidxW : idxW < NW) (hseg_lo : offQuotWhp c w n_max ≤ offW) (hseg_hi : offW + BitPackedArray.packedWords NW kW w ≤ offBtMeta c U V w n_max) (hbm_disj : offW + BitPackedArray.packedWords NW kW w ≤ offBktMeta c U V w n_max ∨ offFbStart c U V w n_max ≤ offW) (hseed : SeedWhpMemRep base c U w n_max θ s.mem) (hrep : FastMemRep base c U V w n_max fs s.mem) (hunch : fs'.slices = fs.slices ∧ fs'.buf = fs.buf ∧ fs'.dirtyCount = fs.dirtyCount ∧ fs'.poolFreeTop = fs.poolFreeTop ∧ fs'.curEp = fs.curEp ∧ fs'.epochClock = fs.epochClock ∧ fs'.rebStage = fs.rebStage ∧ fs'.stageCursor = fs.stageCursor ∧ fs'.dirtyIdx = fs.dirtyIdx ∧ fs'.rebCandSalt = fs.rebCandSalt ∧ fs'.rebScanCursor = fs.rebScanCursor ∧ fs'.rebInsCount = fs.rebInsCount ∧ fs'.rebCollision = fs.rebCollision ∧ fs'.bktCount = fs.bktCount ∧ fs'.bktSalt = fs.bktSalt ∧ fs'.liveRole = fs.liveRole ∧ fs'.liveInsCount = fs.liveInsCount ∧ fs'.overmarsRole = fs.overmarsRole ∧ fs'.overmarsActive = fs.overmarsActive ∧ fs'.overmarsCursor = fs.overmarsCursor ∧ fs'.overmarsInsCount = fs.overmarsInsCount ∧ fs'.rebDoneFlag = fs.rebDoneFlag ∧ fs'.rebQueued = fs.rebQueued ∧ fs'.dirtyBuckets = fs.dirtyBuckets) (hqv : ∀ i < n_max, have m' := BitPackedArray.writePacked (base + offW) kW w s.mem idxW valW; BitPackedArray.readPacked (base + offQuotWhp c w n_max) (SuccinctWhp.quotBitsWhp U n_max) w m' i = fs'.quotArr i ∧ BitPackedArray.readPacked (base + offValWhp c U w n_max) (FeistelQuotient.valBits V) w m' i = fs'.valArr i) (hloc : ∀ b < SuccinctWhp.numBucketsWhp n_max, ∀ loc < SuccinctWhp.totalLocalCoordsWhp n_max, have m' := BitPackedArray.writePacked (base + offW) kW w s.mem idxW valW; BitPackedArray.readPacked (base + offLocState c U V w n_max) 2 w m' (b * SuccinctWhp.totalLocalCoordsWhp n_max + loc) = fs'.locState b loc) (hbptr : ∀ b < SuccinctWhp.numBucketsWhp n_max, ∀ k < SuccinctWhp.capBackWhp n_max, have m' := BitPackedArray.writePacked (base + offW) kW w s.mem idxW valW; BitPackedArray.readPacked (base + offBackPtr c U V w n_max) (SuccinctBucket.globalPtrBits n_max) w m' (b * SuccinctWhp.capBackWhp n_max + k) = fs'.backPtr b k) (hpool : ∀ j < SuccinctWhp.poolSizeWhp n_max, have m' := BitPackedArray.writePacked (base + offW) kW w s.mem idxW valW; BitPackedArray.readPacked (base + offPoolFreeStack c U V w n_max) (SuccinctBucket.globalPtrBits n_max) w m' j = fs'.poolFreeStack j ∧ BitPackedArray.readPacked (base + offPoolOwner c U V w n_max) (SuccinctBucket.globalPtrBits n_max) w m' j = fs'.poolOwner j) :
FastStateStep base c U V w n_max θ fs' s { mem := BitPackedArray.writePacked (base + offW) kW w s.mem idxW valW, frontier := s.frontier }

Frame helper for a single writePacked inside [offQuotWhp, offBtMeta) disjoint from offBktMeta.