NLA-lib Explorer

Straight-line scalar blocks

Library · Source module

Straight-line scalar blocks

A rotation, a norm, a coefficient update: a few dozen scalar instructions without loops or branches. Under IsScalar M I (scalar arithmetic is the machine M, a total function on words) their run is a fold of M over the cells, so the whole block is one specification: the cells written, each with its value computed by NLAlib.Ops.ScalarIns.evalBlock on the cell function of the store. The proof of a block is then one application of NLAlib.Ops.writes_scalarBlock and one evaluation per output word (one simp over all outputs of a long block is too slow: evaluate each output by its own lemma).

Success needs only that the cells read hold words when they are read (cells written earlier in the block need no initialisation: the evaluation reads the updated cell function) and room for the cells written; division is total in the machine, and its meaning at zero is the business of the arithmetic contract (StdModel.div), not of the block.

Main results

* NLAlib.Ops.ScalarIns, NLAlib.Ops.Stmt.scalarBlock, NLAlib.Ops.ScalarIns.evalBlock. * NLAlib.Ops.ScalarCall, NLAlib.Ops.IsScalar.scalarCall: operations as functions of cells. * NLAlib.Ops.writes_scalarBlock: the block rule, in total mode.

Declarations