Asymptotic cost bounds #
Cslib.CostIsBigO l g size cost says that the cost of every input is bounded by one cost
function of its size, chosen before the input: some monotone, nonnegative f with f =O[l] g
satisfies cost a ≤ f (size a) for all a. This is the form of asymptotic cost specification
used by Guéneau, Charguéraud and Pottier [GCP18]. Because f is chosen
once, the statement is ∃ f, ∀ a. Inductive reasoning with "O(1) + O(1) = O(1)" proves
∀ a, ∃ c instead, which is unsound as a cost claim. The filter makes multivariate bounds
explicit: for example, atTop on ℕ × ℕ for a bound in two size parameters.
Exact constants are proved internally and exported in this form: CostIsBigO.of_le_nat turns an
exact natural-number bound into an asymptotic one.
Main definitions #
Cslib.CostIsBigO: a cost bounded by a monotone, nonnegative function that isO(g)along a filter.
Main results #
Cslib.CostIsBigO.of_le_nat: export an exact monotone natural-number bound.Cslib.CostIsBigO.of_le_add_mul: an affine bounda + b * sizeisO(size).Cslib.CostIsBigO.mono: a smaller cost has the same bound.Cslib.CostIsBigO.trans_isBigO: weaken the comparison function.
References #
An exact monotone natural-number bound that is O(g) gives an asymptotic cost bound.
A cost below a bounded cost has the same bound.
A cost that is O(g) is O(g') whenever g =O[l] g'.