Calculi for Time Analysis of Functional Programs. Sands, D. Ph.D. Thesis, Department of Computing, Imperial College, University of London, September, 1990.
Calculi for Time Analysis of Functional Programs [pdf]Paper  abstract   bibtex   
Techniques for reasoning about extensional properties of functional programs are well-understood, but methods for analysing the underlying intensional, or operational properties have been much neglected. This thesis presents the development of several calculi for time analysis of functional programs. We focus on two features, higher-order functions and lazy evaluation, which contribute much to the expressive power and semantic elegance of functional languages, but serve to make operational properties more opaque. Analysing higher-order functions is problematic because complexity is dependent not only on the cost of computing, but also on the cost of \em applying\ function-valued expressions. Techniques for statically deriving programs which compute time-cost in the presence of arbitrary higher-order functions are developed. The key to this process is the introduction of syntactic structures called \em cost-closures, which enable intensional properties to be carried by functions. The approach is formalised by the construction of an appropriate cost-model, against which the correctness of the derivation is proved. A specific factorisation tactic for reasoning about higher-order functions out of context is illustrated. Reasoning about lazy evaluation (ie call-by-name, or more usually, call-by-need) is problematic because the cost of evaluating an expression cannot be understood simply from the costs of its sub-expressions. A direct calculus for reasoning about a call-by-name language with lazy lists is derived from a simple operational model. In order to extend this calculus with a restricted form of equational reasoning, a nonstandard notion of operational approximation called \em cost-simulation is developed, by analogy with \em (bi)simulation in CCS. The problem with calculi of the above form, based directly on an operational model, is that they do not yield a \em compositional description of cost, and cannot model \em lazy evaluation (graph-reduction) easily. We show how a description of the \em context in which a function is evaluated can be used to parameterise two types of time-equation: \em sufficient-time equations and \em necessary-time equations, which together provide bounds on the exact time-cost of lazy evaluation. This approach is extended to higher-order functions using a modification of the cost-closure technique.

Downloads: 0