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

02/17/2020
by   Norman Danner, et al.
0

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.

READ FULL TEXT

page 1

page 2

page 3

page 4

research
06/26/2020

Denotational recurrence extraction for amortized analysis

A typical way of analyzing the time complexity of functional programs is...
research
07/12/2023

Decalf: A Directed, Effectful Cost-Aware Logical Framework

We present decalf, a directed, effectful cost-aware logical framework fo...
research
11/11/2019

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...
research
12/28/2021

Inductive and Coinductive Predicate Liftings for Effectful Programs

We formulate a framework for describing behaviour of effectful higher-or...
research
04/02/2022

Differential Cost Analysis with Simultaneous Potentials and Anti-potentials

We present a novel approach to differential cost analysis that, given a ...
research
04/10/2023

Defunctionalization with Dependent Types

The defunctionalization translation that eliminates higher-order functio...
research
11/02/2017

Formal Analysis of Hybrid Systems Using Feature Indented Assertions

Model based design is a recommended step in the design of embedded contr...

Please sign up or login with your details

Forgot password? Click here to reset