Parametric view and frame lemmas for disjoint bit-packed slices #
Companion to BitPackedArray.lean giving reusable congruence and disjoint-region frame lemmas
for bounded bit-packed array views fun i => if i < len then readPacked base k w mem i else 0,
together with readPacked_writePacked_bounded in BitPackedArray.lean.
Keeping these theorems parameterized by (base, k, w, len) lets metadata layout files such as
ResizableSuccinct.MetaSync collapse repeated write*_effect theorems into compact instantiations
instead of repeating funext/split_ifs/writePacked_outside boilerplate.
Main definitions #
Cslib.DataStructure.Dictionary.WordRAM.BitPackedArray.WriteOutside: witnesses that a memory update leaves all words outside[lo, hi)unchanged.Cslib.DataStructure.Dictionary.WordRAM.BitPackedArray.DisjointIntervals: two half-open word intervals[lo₁, hi₁)and[lo₂, hi₂)do not overlap.
Main results #
Cslib.DataStructure.Dictionary.WordRAM.BitPackedArray.writePacked_writeOutside:writePackedatidx < lenwrites only within[lo, hi)when[base, base + packedWords len k w) ⊆ [lo, hi).Cslib.DataStructure.Dictionary.WordRAM.BitPackedArray.packedView_congr: a bounded packed view depends only on[base, base + packedWords len k w).Cslib.DataStructure.Dictionary.WordRAM.BitPackedArray.packedView_writePacked_disjoint: writing inside a disjoint packed slice preserves a read-only view.
Two half-open word intervals [lo₁, hi₁) and [lo₂, hi₂) are disjoint.
Symmetry of DisjointIntervals.
A write confined to [lo, hi) agrees with the original memory across any disjoint interval
[lo', hi').
Writing at idx < len in a packed array at base is confined to any [lo, hi) containing
[base, base + packedWords len k w).
A bounded k-bit packed array view if i < len then readPacked base k w mem i else 0 depends
only on the half-open word interval [base, base + packedWords len k w).
Writing inside a packed slice disjoint from [base₁, base₁ + packedWords len₁ k₁ w) leaves the
bounded view at base₁ unchanged.