NLA-lib Explorer

Counts in the logic layer

Library · Source module

Counts in the logic layer

Two things a program proof does with counts:

* Static counts in closed form. stmtCost of a tree is a sum over its loops; the abstract theorem states it in closed form (m p • dot [n], (p (p - 1) / 2) • (neg + axpy) + …). The tactic count_eval unfolds stmtCost on the tree, evaluates the index expressions and rewrites the sums of NLAlib.Ops.Count.sum_range_nsmul and sum_range_id_nsmul (phase B). * Counts that depend on the data, by RunsFromW (NLAlib.Ops.Counted), and the partial-correctness form: NLAlib.Ops.RunsFromWL ("if the counted run succeeds, Q holds of the counts added and the memory"), with one rule per constructor: it is the core's (NLAlib.Ops.Counted, decision D12). Here: the bridge from a block specification, NLAlib.Ops.RunsFromW.of_writes.

Main results

* NLAlib.Ops.RunsFromW.of_writes: a block specification with its static counts. * NLAlib.Ops.Count.sum_range_nsmul, NLAlib.Ops.Count.sum_range_id_nsmul: closed forms.

Declarations