Potential Functions as Types

📅 2026-07-09
📈 Citations: 0
Influential: 0
📄 PDF
🤖 AI Summary
This work addresses the challenge of unifying manual cost verification based on potential functions with automatic cost inference via credit accounting to enable modular and verifiable program resource analysis. We propose a unified framework that integrates the physicist’s perspective (potential) and the banker’s perspective (credit), formalized within the dependent type theory Calf and supported by its sublanguage Giralf for automated derivation. Key innovations include the fracture-and-glue theorems, which decompose arbitrary types into abstractions paired with potential functions, and the first embedding of credit/debit operators directly into a dependent type system, thereby achieving semantic unity between manual verification and automatic inference. This approach successfully automates cost analysis for common algorithms while guaranteeing modularity in both program behavior and resource usage.
📝 Abstract
Amortized analysis can be framed from the physicist's view, amenable to manual verification in dependent type theory using potential functions, and the banker's view, amenable to automated inference in substructural type theory using type-level credit annotations. In this work, we synthesize these perspectives in Calf, a dependent type theory cost verification. From the physicist's view, we present a fracture and gluing theorem that renders every type as containing a fusion of an abstraction function and a potential function. By construction, every program between two such types must preserve abstraction, to facilitate modularity of behavior, and conserve potential, to facilitate modularity of cost. Incorporating the banker's view, we synthetically construct type operators for credits and debits. We then define Giralf, a graded substructural dependent type theory for programming with credits and debits, which is semantically interpreted as a sub-language of Calf. Finally, we adapt an inference algorithm to transform a limited class of Calf programs into Giralf counterparts, automating the cost analysis of common algorithms in Calf.
Problem

Research questions and friction points this paper is trying to address.

amortized analysis
dependent type theory
potential functions
cost verification
substructural type theory
Innovation

Methods, ideas, or system contributions that make the work stand out.

potential functions
amortized analysis
dependent type theory
substructural types
cost verification