DeepAI AI Chat
Log In Sign Up

Denotational semantics as a foundation for cost recurrence extraction for functional languages

by   Norman Danner, et al.

A standard method for analyzing the asymptotic complexity of a program is to extract a recurrence that describes its cost in terms of the size of its input, and then to compute a closed-form upper bound on that recurrence. In practice there is rarely a formal argument that the recurrence is in fact an upper bound; indeed, there is usually no formal connection between the program and the recurrence at all. Here we develop a method for extracting recurrences from functional programs in a higher-order language with let-polymorphism that provably bound their operational cost. The method consists of two phases. In the first phase, a monadic translation is performed to extract a cost-annotated version of the original program. In the second phase, the extracted program is interpreted in a model. The key feature of this second phase is that different models describe different notions of size. This plays out specifically for values of inductive type, where different notions of size may be appropriate depending on the analysis, and for polymorphic functions, where we show that the notion of size for a polymorphic function can be described formally as the data that is common to the notions of size of its instances. We give several examples of different models that formally justify various informal extract-a-recurrence-and-solve cost analyses to show the applicability of our approach.


page 1

page 2

page 3

page 4


Denotational recurrence extraction for amortized analysis

A typical way of analyzing the time complexity of functional programs is...

Recurrence Extraction for Functional Programs through Call-by-Push-Value (Extended Version)

The main way of analyzing the complexity of a program is that of extract...

Inductive and Coinductive Predicate Liftings for Effectful Programs

We formulate a framework for describing behaviour of effectful higher-or...

Defunctionalization with Dependent Types

The defunctionalization translation that eliminates higher-order functio...

Differential Cost Analysis with Simultaneous Potentials and Anti-potentials

We present a novel approach to differential cost analysis that, given a ...

Non-homotopic Loops with a Bounded Number of Pairwise Intersections

Let V_n be a set of n points in the plane and let x ∉ V_n. An x-loop is ...

Reasoning about the garden of forking paths

Lazy evaluation is a powerful tool for functional programmers. It enable...