Table of Contents
Fetching ...

Don't exhaust, don't waste

Riccardo Bianchini, Francesco Dagnino, Paola Giannini, Elena Zucca

Abstract

We extend the semantics and type system of a lambda calculus equipped with common constructs to be "resource-aware". That is, the semantics keeps track of the usage of resources, and is stuck, besides in case of type errors, if either a needed resource is exhausted, or a provided resource would be wasted. In such way, the type system guarantees, besides standard soundness, that for well-typed programs there is a computation where no resource gets either exhausted or wasted. The extension is parametric on an arbitrary "grade algebra", modeling an assortment of possible usages, and does not require ad-hoc changes to the underlying language. To this end, the semantics needs to be formalized in big-step style; as a consequence, expressing and proving (resource-aware) soundness is challenging, and is achieved by applying recent techniques based on coinductive reasoning.

Don't exhaust, don't waste

Abstract

We extend the semantics and type system of a lambda calculus equipped with common constructs to be "resource-aware". That is, the semantics keeps track of the usage of resources, and is stuck, besides in case of type errors, if either a needed resource is exhausted, or a provided resource would be wasted. In such way, the type system guarantees, besides standard soundness, that for well-typed programs there is a computation where no resource gets either exhausted or wasted. The extension is parametric on an arbitrary "grade algebra", modeling an assortment of possible usages, and does not require ad-hoc changes to the underlying language. To this end, the semantics needs to be formalized in big-step style; as a consequence, expressing and proving (resource-aware) soundness is challenging, and is achieved by applying recent techniques based on coinductive reasoning.

Paper Structure

This paper contains 20 sections, 35 theorems, 10 equations, 22 figures.

Key Result

Proposition 1

If $\mathit{R} = \langle |\mathit{R}|,\preceq,+,{\cdot},\mathbf{0},\mathbf{1} \rangle$ is a grade algebra, then $\mathit{R}_\mathbf{0}$ is a reduced and integral grade algebra.

Figures (22)

  • Figure 1: Examples of resource-aware evaluation (counting usages)
  • Figure 2: Examples of resource-aware evaluation ( access levels)
  • Figure 3: Fine-grained syntax
  • Figure 4: Resource-aware semantics
  • Figure 5: Example of resource-aware evaluation: consumption/divergency
  • ...and 17 more figures

Theorems & Definitions (86)

  • Example 1
  • Example 2
  • Definition 1: Ordered Semiring
  • Definition 2: Grade Algebra
  • Example 3
  • Definition 3
  • Definition 4
  • Proposition 1
  • Example 4
  • Definition 5: Discardable grade and affine grade algebra
  • ...and 76 more