Named field arrays over the memory oracle #
A field array is a Cslib.WordRAM.Block: a base address and a length. A data structure lays out
its storage as a structure whose fields are blocks (a struct of arrays) and accesses entry i of
a field f with the programs f.get i and f.set i v over Memory.spec w. Addresses are thus
named (par.get v) rather than computed by hand (base + n + v), while computed indices, pointer
chasing (do let p ← next.get v; key.get p) and reuse of a block across operations remain
ordinary programs.
The lemmas here evaluate these programs, discharge their admissibility from Block.Allocated,
and describe their frame: a write to a field leaves every other address unchanged.
Block.entries reads the first n entries of a field as a list, which is how an abstraction
function usually sees an array. It realizes Block.HoldsList.
Main definitions #
Cslib.WordRAM.Block.get,Cslib.WordRAM.Block.set: entry access through the oracle.Cslib.WordRAM.Block.Allocated: the block lies below the frontier.Cslib.WordRAM.Block.entries: the firstnentries of a field in index order.Cslib.DataStructure.Memory.allocBlock,Cslib.DataStructure.Memory.allocBlockDirty: allocate a field.
Main results #
Cslib.WordRAM.Block.runClient_get_bind,Cslib.WordRAM.Block.runClient_set_bind: one-step evaluation of field accesses.Cslib.WordRAM.Block.Allocated.lt_frontier,Cslib.WordRAM.Block.Allocated.mono: allocated entries are admissible addresses, and stay allocated.Cslib.WordRAM.Block.entries_succ,Cslib.WordRAM.Block.entries_congr,Cslib.WordRAM.Block.entries_update_of_le,Cslib.WordRAM.Block.entries_update_of_not_owns: the list view under appends and writes.Cslib.WordRAM.Block.holdsList_entries: the list view realizesBlock.HoldsList.Cslib.DataStructure.Memory.runClient_allocBlock_bind: allocation hands out a zeroed, allocated block at the frontier.Cslib.DataStructure.Memory.clientResult_allocBlockDirty,Cslib.DataStructure.Memory.clientState_allocBlockDirty: evaluation ofallocBlockDirty.
Read entry i of the field b through the memory oracle.
Write v to entry i of the field b through the memory oracle.
The block lies below the frontier, so all of its entries are allocated.
A block stays allocated as the frontier grows.
Reading an entry returns the cell and leaves memory unchanged.
Writing an entry updates its cell.
The list of entries #
Allocate a zeroed field of k cells.
Allocate a field of k cells without clearing it.
A zeroed allocation hands out the block at the frontier, clears it, and advances the frontier past it.
A dirty allocation hands out the block at the frontier without changing memory.
allocBlockDirty k returns the freshly allocated block starting at s.frontier.
allocBlockDirty k leaves memory unchanged and advances the frontier by k.
A freshly allocated zeroed block holds zeros.