Fixed-stride record arrays and three-way concatenation #
This module provides:
HoldsRecords: a fixed-stride record-array representation predicate over raw RAM memory, together with framing (HoldsRecords.congr,HoldsRecords.of_modifies_disjoint), slicing (HoldsRecords.append_iff), andMemory.copy-based record copying (HoldsRecords.copy).FramedTriple.frame_empty_of_ge_frontier: shrinks aMemory.FramedTriple's modification set to∅whenever all modified addresses lie at or aboves.frontier.concatRecordsProg: three-way dirty concatenation of fixed-stride record slices.
Main definitions #
HoldsRecords:rows.lengthrecords of widthstridestored consecutively atbase.ConcatRecordsArgs,concatRecordsArgsWords,concatRecordsProg: concatenate three stride-striderecord arrays into a freshly allocated dirty block.
Main results #
HoldsRecords.of_modifies_disjoint,HoldsRecords.append_iff,HoldsRecords.copy: framing, concatenation, and copy transport for fixed-stride record arrays.Cslib.DataStructure.Memory.FramedTriple.frame_empty_of_ge_frontier: frontier-disjoint frame reduction toS = ∅.concatRecordsProg_spec,realizes_concatRecordsProg: framed specification andRealizes .exact(work = 0) certificate forconcatRecordsProg.
Fixed-stride record arrays (HoldsRecords) #
An empty list of records holds trivially at any base and stride.
Congruence for HoldsRecords over [base, base + stride * rows.length).
A HoldsRecords predicate on an allocated block disjoint from S survives
Memory.Modifies S s s'.
Concatenating two consecutive HoldsRecords slices into one rows₁ ++ rows₂ slice.
Non-overlapping Memory.copy transfers HoldsRecords stride src rows directly to
HoldsRecords stride dst rows under Memory.FramedTriple.
Three-way dirty record concatenation (concatRecordsProg) #
Input arguments for concatenating three stride-stride record arrays into a freshly
allocated dirty block.
Explicit 7-word encoding of ConcatRecordsArgs.
Shrink the modification set of a Memory.FramedTriple to ∅ when every address in S lies
at or above s.frontier.
Concatenate three fixed-stride record slices into a freshly dirty-allocated Block of
length a.stride * (a.lenA + a.lenB + a.lenC).
Framed specification for concatRecordsProg: allocates a dirty Block of size
stride * (rowsA.length + rowsB.length + rowsC.length) at s.frontier, preserves all cells
below s.frontier (Memory.Modifies ∅), realizes HoldsRecords stride out.base (rowsA ++ rowsB ++ rowsC) in cost at most 2 * (stride * (rowsA.length + rowsB.length + rowsC.length)) + 1, and
preserves Memory.WellFormed.
Uniform Realizes .exact certificate for concatRecordsProg with work = 0.