A unifying type-theory for higher-order (amortized) cost analysis

Vineet Rajani, Marco Gaboardi, Deepak Garg, Jan Hoffmann
2021 Proceedings of the ACM on Programming Languages (PACMPL)  
This paper presents 𝜆-amor, a new type-theoretic framework for amortized cost analysis of higher-order functional programs and shows that existing type systems for cost analysis can be embedded in it. 𝜆-amor introduces a new modal type for representing potentials ś costs that have been accounted for, but not yet incurred, which are central to amortized analysis. Additionally, 𝜆-amor relies on standard type-theoretic concepts like affineness, refinement types and an indexed cost monad. 𝜆-amor is
more » ... proved sound using a rather simple logical relation. We embed two existing type systems for cost analysis in 𝜆-amor showing that, despite its simplicity, 𝜆-amor can simulate cost analysis for different evaluation strategies (call-by-name and callby-value), in different styles (effect-based and coeffect-based), and with or without amortization. One of the embeddings also implies that 𝜆-amor is relatively complete for all terminating PCF programs.
doi:10.1145/3434308 fatcat:wdzunsacrvgr5hwvo35e3c4u4m