NLA-lib Explorer

Contracts in operand form

Library · Source module

Contracts in operand form

One structure for every contract of the library. A NLAlib.Ops.BlockRel gives, at the dimensions of a call: the lengths of the input blocks, the lengths of the output blocks (any number of each), the stream and the length of a tape window, a domain (what the inputs must satisfy for the call to succeed) and a relation between the input blocks, the entries of the window and the output blocks. Its contract NLAlib.Ops.BlockRel.spec says: on admitted operands, the call reads the input blocks, writes output blocks of the declared lengths that are related to the inputs and to the window, advances the tape by the window, and changes nothing else.

The three kinds of contract are instances.

* Relational: the relation is a bound (dot, axpy, a factorization qr with two output blocks, a rotation that updates two vectors). * Functional: the relation is the graph of a function (NLAlib.Ops.BlockFn.rel, file NLAlib.Ops.Blocks); the domain is where the function is defined. * With a window: the relation mentions the window. A visible draw returns the window (NLAlib.Ops.drawRel); an operation with hidden randomness returns a function of its inputs and of the window, and takes no random operand.

The contract reads the operand blocks and the window, and nothing else, by construction.

Main results

* NLAlib.Ops.BlockRel.spec: the contract. * NLAlib.Ops.Mem.writes_eq_some_iff: guarded writes of several blocks. * NLAlib.Ops.Mem.readBlocks_one, NLAlib.Ops.Mem.room_one and their analogues: the operands of a call with a given number of blocks.

Declarations