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
- NLAlib.Ops.IsScalar.scalarCall
- NLAlib.Ops.Machine.eval
- NLAlib.Ops.Mem.updCells
- NLAlib.Ops.ScalarCall
- NLAlib.Ops.ScalarIns
- NLAlib.Ops.ScalarIns.applyWrites
- NLAlib.Ops.ScalarIns.applyWrites_append
- NLAlib.Ops.ScalarIns.applyWrites_get
- NLAlib.Ops.ScalarIns.applyWrites_of_notMem
- NLAlib.Ops.ScalarIns.evalBlock
- NLAlib.Ops.ScalarIns.evalBlock_append_some
- NLAlib.Ops.ScalarIns.evalBlock_lift
- NLAlib.Ops.ScalarIns.lift
- NLAlib.Ops.ScalarIns.stmt
- NLAlib.Ops.Stmt.scalarBlock
- NLAlib.Ops.Store.cellFn
- NLAlib.Ops.get_updCells
- NLAlib.Ops.get_updCells_of_notMem
- NLAlib.Ops.len_updCells
- NLAlib.Ops.live_of_mapM
- NLAlib.Ops.mapM_cons_eq_some
- NLAlib.Ops.mapM_nil_eq_some
- NLAlib.Ops.updCells_append
- NLAlib.Ops.writes_machineScalarBlock
- NLAlib.Ops.writes_scalarBlock
- NLAlib.Ops.writes_scalarBlock_lift