NLA-lib Explorer

Static counts and workspace

Library · Source module

Static counts and workspace

The counts and the scratch payload bytes of a run are bounded by functions of the tree and the values of its index variables alone: NLAlib.Ops.stmtCost and NLAlib.Ops.stmtPeak. For a tree without tests and index binders the count is exact; a branch counts the larger side, a whileFuel its fuel, a bindIdx its worst value.

NLAlib.Ops.exec_within: every successful counted run stays within them. So a count is obtained by evaluating a function on the tree, never by a proof about loops, and NLAlib.Ops.ConditionalRuns.of_run turns a statement about the memory (program logic) into the full statement with counts and workspace.

Main definitions

* NLAlib.Ops.stmtCost, NLAlib.Ops.stmtPeak: the static count and workspace of a tree. * NLAlib.Ops.staticCost, NLAlib.Ops.staticPeak: those of a program, with its structural instructions.

Main results

* NLAlib.Ops.exec_within: soundness of the static count and workspace. * NLAlib.Ops.ConditionalRuns.of_run: from a run to a run within its static budget.

Declarations