NLA-lib Explorer

An explicit polynomial for the number of instructions of a program

Library · Source module

An explicit polynomial for the number of instructions of a program

The static count of a program (NLAlib.Ops.staticCost) is a sum over the loops of its tree. This file computes from the tree a polynomial in the sizes, one variable per size, that bounds the number of instructions of every run: primitives, queries and structural instructions alike. Under a model whose weights are all at most one, that number bounds the work.

A polynomial is a list of terms, a coefficient and the list of its variables with multiplicity (NLAlib.Ops.CountPoly). The polynomial of a tree is computed by a structural recursion with no proof inside, so the kernel evaluates it on a fixed program and the result is an explicit list. A loop multiplies the polynomial of its body by an upper bound of its number of rounds; a branch adds its two sides; a truncated difference and a quotient are bounded by their first argument.

Main results

* NLAlib.Ops.stmtWeightedCost_le_countPoly: the weighted static cost of a tree is at most its polynomial, when every weight is at most one. * NLAlib.Ops.Program.exec_work_le_countPoly: the work of a canonical run is at most the polynomial of the instrumented program at its sizes. * NLAlib.Ops.Program.exec_weight_le_countPoly: the same for any weights at most one, which need not be those of the run. * NLAlib.Ops.Algorithm.withCountPoly: a certificate restated with that explicit work.

Declarations