The elimination of nesting in SPCF

  • Authors:
  • J. Laird

  • Affiliations:
  • Dept. of Informatics, University of Sussex, UK

  • Venue:
  • TLCA'05 Proceedings of the 7th international conference on Typed Lambda Calculi and Applications
  • Year:
  • 2005

Quantified Score

Hi-index 0.00

Visualization

Abstract

We use a fully abstract denotational model to show that nested function calls and recursive definitions can be eliminated from SPCF (a typed functional language with simple non-local control operators) without losing expressiveness. We describe — via simple typing rules — an affine fragment of SPCF in which function nesting and recursion (other than iteration) are not permitted. We prove that this affine fragment is fully expressive in the sense that every term of SPCF is observationally equivalent to an affine term. Our proof is based on the observation of Longley — already used to prove universality and full abstraction results for models of SPCF — that every type of SPCF is a retract of a first-order type. We describe retractions of this kind which are definable in the affine fragment. This allows us to transform an arbitrary SPCF term into an affine one by mapping it to a first-order term, obtaining an (affine) normal form, and then projecting back to the original type. In the case of finitary SPCF, the retraction is based on a simple induction, which yields bounds for the size of the resulting term. In the infinitary case, it is based on an analysis of the relationship between SPCF definable functions and strategies for computing them sequentially.