NLA-lib Explorer

Block specifications with footprints and named states

Library · Source module

Block specifications with footprints and named states

NLAlib.Ops.Writes md I τ c ρ F P m: the run of c from m, in the mode md, writes only the cells of F (the store keeps its shape and every cell off F) and ends in a memory satisfying P. It is Wp with a frame; every rule here is a rule of Wp with the frame carried, so nothing is added to the trusted base.

The point is the form in which a proof continues after a step (NLAlib.Ops.Writes.then_): the continuation receives a fresh memory m' with the frame m.store.EqOff F m'.store and the postcondition, and never a chain of updates. That is a named state: what a later step needs of m' is read off the frame (lengths by Store.EqOff.len_eq, kept blocks by Store.EqOff.keep) and the postcondition (the blocks just written). Frames of consecutive steps compose by ⊔ (Store.EqOff.trans'), and the footprint of a block is compared with the declared one once, at the end (fp_sub).

Every rule is mode-generic: what is needed only for success (live handles, readable inputs, room, a nonzero divisor) is under md.Needs, and a successful liberal run gives it back in the postcondition. One proof gives the total statement and the refinement.

Main results

* NLAlib.Ops.Writes, NLAlib.Ops.Writes.then_ (the named step), NLAlib.Ops.Writes.seq, NLAlib.Ops.Writes.mono, NLAlib.Ops.Writes.keep (frame-carry of a bundle of facts). * NLAlib.Ops.writes_call: the call rule with a footprint, in every mode, for any contract in operand form; NLAlib.Ops.writes_call1, NLAlib.Ops.writes_call_cell, NLAlib.Ops.writes_call2, NLAlib.Ops.writes_call_bin: shapes. * NLAlib.Ops.writes_alloc, NLAlib.Ops.writes_allocs: scratch buffers as named states, with their handles and lengths; the frame after the pops is the caller's. * NLAlib.Ops.writes_ite, NLAlib.Ops.writes_bindIdx, NLAlib.Ops.writes_bindIdx_of_isIndex. * NLAlib.Ops.Wp.named: generalise a chain of updates into a fresh memory (checkpoint). * NLAlib.Ops.Impl.satisfies_of_writes: an implementation satisfies a contract, from a block specification; the equation of the contract is built once, here.

Declarations