NLA-lib Explorer

Linking with routines

Library · Source module

Linking with routines

A table implements an operation of a model by a tree over the operations below it, and the induced interpretation satisfies the contract of that operation when the tree does (NLAlib.Ops.Interp.link_satisfies). The contract of an operation is in operand form (NLAlib.Ops.BlockRel.spec): input operands, output operands, an admission of operands.

This file states that step for a routine. A routine implements an operation contract (NLAlib.Ops.Routine.Implements) when the admitted input and output operands of the contract are, through a map port, separated operands of the routine: the buffer variables of the tree are the inputs followed by the outputs, the blocks the routine reads are the inputs and the blocks it writes are the outputs, with the same lengths, and it draws the window of the contract. Then a routine that meets a specification whose precondition follows from the domain of the contract and whose postcondition gives its relation satisfies the contract as an implementation, and the operation of the induced interpretation meets it.

An operation contract may admit several layouts of its operands that no single interface covers: an output that is either apart from an input or exactly that input (a copy, a scaling or an update that may run in place). Such a contract is implemented by one routine for each layout, all with the same tree: one with separate operands, one with an operand updated in place and its buffer variables bound to it. The contract follows by cases on the admission, each case a run of the routine of that layout (NLAlib.Ops.Routine.Meets.writes_ofRel). An output placed in the buffer of an input, where that input ends, is an operand that continues it (NLAlib.Ops.Port.cont).

The three statements of the layer, NLAlib.Ops.Routine.Meets, NLAlib.Ops.Interp.Satisfies and NLAlib.Ops.Impl.Satisfies, and their roles are described once, in NLAlib/Ops/README.md ("Three statements") and the header of NLAlib/Ops/Routine.lean.

Main definitions

* NLAlib.Ops.Routine.impl: a routine as an implementation. * NLAlib.Ops.Routine.Implements: the operands of a contract are operands of the routine.

Main results

* NLAlib.Ops.Routine.Meets.satisfies: a routine that meets its specification satisfies the operation contract it implements. * NLAlib.Ops.Routine.Meets.satisfies_ofRel: the same for the specification read off the block relation of the contract (NLAlib.Ops.Routine.Spec.ofRel). * NLAlib.Ops.Routine.meets_ofRel_of_post: the judgment from a run stated in operand form. * NLAlib.Ops.Routine.Meets.writes_ofRel: the run of a routine as a call of an operation.

Declarations