A cost-aware logical framework

07/09/2021
by   Yue Niu, et al.
0

We present calf, a cost-aware logical framework for studying quantitative aspects of functional programs. Taking inspiration from recent work that reconstructs traditional aspects of programming languages in terms of a modal account of phase distinctions, we argue that the cost structure of programs motivates a phase distinction between intension and extension. Armed with this technology, we contribute a synthetic account of cost structure as a computational effect in which cost-aware programs enjoy an internal noninterference property: input/output behavior cannot depend on cost. As a full-spectrum dependent type theory, calf presents a unified language for programming and specification of both cost and behavior that can be integrated smoothly with existing mathematical libraries available in type theoretic proof assistants. We evaluate calf as a general framework for cost analysis by implementing two fundamental techniques for algorithm analysis: the method of recurrence relations and physicist's method for amortized analysis. We deploy these techniques on a variety of case studies: we prove a tight, closed bound for Euclid's algorithm, verify the amortized complexity of batched queues, and derive tight, closed bounds for the sequential and parallel complexity of merge sort, all fully mechanized in the Agda proof assistant. Lastly we substantiate the soundness of quantitative reasoning in calf by means of a model construction.

READ FULL TEXT
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/07/2020

Cost-Aware Type Theory

Although computational complexity is a fundamental aspect of program beh...
research
10/16/2020

Logical Relations as Types: Proof-Relevant Parametricity for Program Modules

The theory of program modules is of interest to language designers not o...
research
09/26/2022

A metalanguage for cost-aware denotational semantics

We present two metalanguages for developing synthetic cost-aware denotat...
research
04/20/2022

Sheaf semantics of termination-insensitive noninterference

We propose a new sheaf semantics for secure information flow over a spac...
research
07/10/2018

Competitive Parallelism: Getting Your Priorities Right

Multi-threaded programs have traditionally fallen into one of two domain...
research
04/06/2020

Responsive Parallelism with Futures and State

Motivated by the increasing shift to multicore computers, recent work ha...

Please sign up or login with your details

Forgot password? Click here to reset