Documentation

CslibFrontier.DataStructure.Dictionary.WordRAM.BitPackedArrayProg

Memory.Prog Bit-Packed Array Primitives and Uniform Realizes Certificates #

This module wraps the overflow-free bit-packed array operations (readPacked, writePacked) from CslibFrontier.DataStructure.Dictionary.WordRAM.BitPackedArray as Memory.Prog operations (readPackedProg, writePackedProg) together with their Memory.spec functional, admissibility, and cost lemmas and uniform parameter-free Realizes .exact certificates (realizes_readPackedGen, realizes_writePackedGen).

Main definitions #

Main results #

Memory.Prog operation reading the k-bit entry at index idx from a bit-packed array at base + offset on a w-bit machine.

Memory.Prog operation writing val (< 2 ^ k) into the k-bit entry at index idx of a bit-packed array at base + offset on a w-bit machine.

@[simp]
theorem Cslib.DataStructure.Dictionary.WordRAM.BitPackedArray.clientResult_readPackedProg (base offset k w idx : ℕ) (s : Memory.State) :
(Memory.spec 0).clientResult s (readPackedProg base offset k w idx) = readPacked (base + offset) k w s.mem idx
theorem Cslib.DataStructure.Dictionary.WordRAM.BitPackedArray.clientState_writePackedProg (base offset k w idx val : ℕ) (s : Memory.State) :
(Memory.spec 0).clientState s (writePackedProg base offset k w idx val) = { mem := writePacked (base + offset) k w s.mem idx val, frontier := s.frontier }
theorem Cslib.DataStructure.Dictionary.WordRAM.BitPackedArray.validHistory_readPackedProg {w base offset N k idx : ℕ} {s : Memory.State} (hw : 0 < w) (hidx : idx < N) (ha : base + offset + packedWords N k w ≤ s.frontier) :
theorem Cslib.DataStructure.Dictionary.WordRAM.BitPackedArray.validHistory_writePackedProg {w base offset N k idx val : ℕ} {s : Memory.State} (hw : 0 < w) (hkw : k ≤ w) (hidx : idx < N) (hwf : Memory.WellFormed w s) (ha : base + offset + packedWords N k w ≤ s.frontier) :
(Memory.spec w).ValidHistory s ((Memory.spec w).clientHistory s (writePackedProg base offset k w idx val))
theorem Cslib.DataStructure.Dictionary.WordRAM.BitPackedArray.wellFormed_clientState_writePackedProg {w w' base offset k idx val : ℕ} {s : Memory.State} (hw : 0 < w) (hkw : k ≤ w) (hwf : Memory.WellFormed w s) :
Memory.WellFormed w ((Memory.spec w').clientState s (writePackedProg base offset k w idx val))

writePackedProg preserves Memory.WellFormed w at every interpreter width w' whenever 0 < w and k ≤ w.

Parameter-free Memory.Prog wrapper for readPackedProg taking (((base, offset), (k, w)), idx).

Parameter-free Memory.Prog wrapper for writePackedProg taking ((((base, offset), (k, w)), idx), val).

Uniform parameter-free Realizes .exact certificate for readPackedGenProg.

Uniform parameter-free Realizes .exact certificate for writePackedGenProg.