Automatic Amortized Resource Analysis with Regular Recursive Types

04/26/2023
by   Jessie Grosen, et al.
0

The goal of automatic resource bound analysis is to statically infer symbolic bounds on the resource consumption of the evaluation of a program. A longstanding challenge for automatic resource analysis is the inference of bounds that are functions of complex custom data structures. This article builds on type-based automatic amortized resource analysis (AARA) to address this challenge. AARA is based on the potential method of amortized analysis and reduces bound inference to standard type inference with additional linear constraint solving, even when deriving non-linear bounds. A key component of AARA is resource functions that generate the space of possible bounds for values of a given type while enjoying necessary closure properties. Existing work on AARA defined such functions for many data structures such as lists of lists but the question of whether such functions exist for arbitrary data structures remained open. This work answers this questions positively by uniformly constructing resource polynomials for algebraic data structures defined by regular recursive types. These functions are a generalization of all previously proposed polynomial resource functions and can be seen as a general notion of polynomials for values of a given recursive type. A resource type system for FPC, a core language with recursive types, demonstrates how resource polynomials can be integrated with AARA while preserving all benefits of past techniques. The article also proposes the use of new techniques useful for stating the rules of this type system and proving it sound. First, multivariate potential annotations are stated in terms of free semimodules, substantially abstracting details of the presentation of annotations and the proofs of their properties. Second, a logical relation giving semantic meaning to resource types enables a proof of soundness by a single induction on typing derivations.

READ FULL TEXT
research
06/24/2020

Raising Expectations: Automating Expected Cost Analysis with Types

This article presents a type-based analysis for deriving upper bounds on...
research
06/29/2020

Liquid Resource Types

This article presents liquid resource types, a technique for automatical...
research
04/16/2019

Resource-Guided Program Synthesis

This article presents resource-guided synthesis, a technique for synthes...
research
01/28/2021

Type-Based Analysis of Logarithmic Amortised Complexity

We introduce a novel amortised resource analysis couched in a type-and-e...
research
02/21/2020

Exponential Automatic Amortized Resource Analysis

Automatic amortized resource analysis (AARA) is a type-based technique f...
research
02/21/2020

Exponential Amortized Resource Analysis

Automatic amortized resource analysis (AARA) is a type-based technique f...
research
07/22/2018

Analysis of Logarithmic Amortised Complexity

We introduce a novel amortised resource analysis based on a potential-ba...

Please sign up or login with your details

Forgot password? Click here to reset