NLA-lib Explorer

Worked instances: shared lemmas

Library · Source module

Worked instances: shared lemmas

The modules NLAlib/Ops/Examples/WorkedInstances/ fix, for a few routines of the library, the exact outcome of one small run under the execution rules (NLAlib.Ops.Reference.Execution): the words written, the number of calls of each operation, the total number of instructions and the peak scratch. The purpose is to test the definitions of the core (indexing, strides, loop bounds, charges, scratch) against values obtained outside the library.

Provenance of the numbers. scripts/worked_instances.py computes, with exact rational arithmetic and from the textbook formula of each operation, the outputs and the numbers of arithmetic operations; scripts/test_worked_instances.py checks that the literals of that script occur in these modules. The totals that include structural instructions (index arithmetic, operand resolution, rounds, frames, allocations) have no source outside the library: they are regression values, and each module says which they are.

Method. A tree with no test makes the same instructions on every run, so its count and scratch are those of the tree (NLAlib.Ops.Reference.Execution.eq_static_of_straight); the output comes from the certificate of the routine, or from evaluating the run. This module holds the lemmas about weights that the instances share.

Main results

* NLAlib.Ops.Examples.WorkedInstances.lift_one_stmtCost_tally, NLAlib.Ops.Examples.WorkedInstances.lift_one_one: the weight of structural instructions and of one instruction.

Declarations