Collected Size Semantics for Functional Programs ?

This work introduces collected size semantics of strict functional programs over lists. It is presented via non-deterministic numerical functions annotating types. These functions are defined by conditional rewriting rules generated during type inference. We focus on the connection between the size rewriting rules and lower and upper bounds on size dependencies, where the bounds are given by polynomials extended with the max0-operation. We show how, given a set of conditional rewriting rules, one can infer bounds that define an indexed family of max0-polynomials that approximates (from above) the non-deterministic size dependency. Using collected size semantics we are able to infer non-monotonic and non-linear lower and upper bounds for many functional programs. As a feasibility study we consider the Haskell list library.