NLA-lib Explorer

Example: a functional contract, the matrix product by a triple loop

Library · Source module

Example: a functional contract, the matrix product by a triple loop

The contract of mm is functional: the result is f of the two input blocks, for some f (NLAlib.Ops.Examples.mmFn, NLAlib.Ops.Examples.IsMM). Properties of f are mathematics.

Main results

* Abstract theorem (NLAlib.Ops.Examples.runs_sq2): squaring a matrix twice, for every f: two calls at [n, n, n], and the memory is given by f. Each call is one equation. * Exact satisfaction (NLAlib.Ops.Examples.mm_satisfies): the run of the triple loop NLAlib.Ops.Examples.mmImpl is the block function of NLAlib.Ops.Examples.mmF, the triple loop written as a function on lists through a machine. It reuses the accumulation loop of the dot product (NLAlib.Ops.Examples.dotLoop_wp) for each entry. * Mathematics (NLAlib.Ops.Examples.abs_dec_mmF_sub_le): each entry of mmF is a rounded dot product. * Corollary (NLAlib.Ops.Examples.runs_sq2_link): the linked program computes mmF, within 2 n² (lit + n (mul + add)) scalar operations and one scratch cell.

Declarations