The genericity theorem and parametricity in the polymorphic λ-calculus (original) (raw)

The genericity theorem and the notion of parametricity in the polymorphic λ-calculus

Logic in Computer Science, …, 1993

In the polymorphic-calculus, one may explicitly define functions that take a type as input and return a term as output. This work focuses on how such functions depend on their input types. Indeed, these functions are generally understood to have an essentially constant meaning on input types. We show how the proof theory of the polymorphic-calculus suggests a clear syntactic description of this phenomenon. Namely, under a reasonable condition, we show that if two polymorphic functions agree on an input type, then they are, in fact, the same function. Equivalently, types are generic inputs to polymorphic functions. Résumé Dans le-calcul polymorphe, on peut explicitement définir des fonctions qui prennent un type comme argument et qui renvoient un terme comme résultat. Le but de ce travail est de mieux comprendre la dépendance de ces fonctions vis-à-vis de leurs arguments types. En effet, ces fonctions sont généralement considérées commeétant essentiellement constantes par rapport aux arguments types. Nous montrons que la théorie syntaxique du-calcul polymorphe suggère une description claire de ce phénomène : sous une condition raisonnable, si deux fonctions polymorphes s'accordent sur un seul type, elles sont identiques. Autrement dit, les types sont des arguments génériques aux fonctions polymorphes.

The genericity theorem and the notion of parametricity in the polymorphic lambda -calculus

[1993] Proceedings Eighth Annual IEEE Symposium on Logic in Computer Science, 1993

In the polymorphic -calculus, one may explicitly define functions that take a type as input and return a term as output. This work focuses on how such functions depend on their input types. Indeed, these functions are generally understood to have an essentially constant meaning on input types. We show how the proof theory of the polymorphic -calculus suggests a clear syntactic description of this phenomenon. Namely, under a reasonable condition, we show that if two polymorphic functions agree on an input type, then they are, in fact, the same function. Equivalently, types are generic inputs to polymorphic functions.

The Polymorphic Rewriting-calculus::[Type Checking vs. Type Inference]

Electronic Notes in Theoretical Computer Science, 2005

The Rewriting-calculus (Rho-calculus), is a minimal framework embedding Lambdacalculus and Term Rewriting Systems, by allowing abstraction on variables and patterns. The Rho-calculus features higher-order functions (from Lambda-calculus) and pattern-matching (from Term Rewriting Systems). In this paper, we study extensively a second-order Rho-calculusà la Church (RhoF) that enjoys subject reduction, type uniqueness, and decidability of typing. We then apply a classical type-erasing function to RhoF obtaining an untyped Rho-calculusà la Curry (uRhoF). The related type inference system is isomorphic to RhoF and enjoys subject reduction. Both RhoF and uRhoF systems can be considered as minimal calculi for polymorphic rewriting-based programming languages. We discuss the possibility of a logic existing underneath the type systems via a Curry-Howard Isomorphism.

The typed polymorphic label-selective λ-calculus

Proceedings of the 21st ACM SIGPLAN-SIGACT symposium on Principles of programming languages - POPL '94, 1994

Formal calculi of reeord structures have recently been a focus of active mearch. However, scamely anyone has studied formally the dual notion-+. e., argument-passing to functions by keywords, and its harmonization with currying. We have. Recently, we introduced the label-selective A-calculus, a conservative extension of A-calculus that uses a labeling of abstractions and applications to perform unordered cttmying. In other words, it enables some form of commutation between arguments, This improves program legibility, thanks to the presence of labels, and efficiency, thanks to argument commuting. In this paper, we propose a simply typed version of the calculus, then extend it to one with ML-like polymo~hic types. For the latter calculus, we establish the existence of principal types and we give an algorithm to compute them. Thanks to the fact that label-selective A-calculus is a conservative extension of A-calculus by adding numeric labels to stand for argument positions, its polymoqhic typing provides us with a keyword argument-passing extension of ML obviating the need of I-CCO*. In this contex~conventional ML syntax can be seenas a restriction of the mo~geneml keyword-oriented syntax limited to using only implicit positions instead of keywords.

Formal parametric polymorphism

Proceedings of the 20th ACM SIGPLAN-SIGACT symposium on Principles of programming languages - POPL '93, 1993

A polymorphic function is parametric if its behavior does not depend on the type at which it is instantiated. Starting with Reynolds' work, the study of parametricity is typically semantic. In this paper, we develop a syntactic approach to parametricity, and a formal system that embodies this approach: system Z. Girard's system F deals with terms and types; !Ris an extension of F that deals also with relations between types. In %, it is possible to derive theorems about functions from their types, or "theorems for free", as Wadler calls them. An easy "theorem for free" asserts that the type V(X)X+Bool contains only constant functions; this is not provable in F. There are many harder and more substantial examples. Various metatheorems can also be obtained, such as a syntactic version of Reynolds' abstraction theorem.

Polymorphic Functions with Set-Theoretic Types

This article is the second part of a two articles series about the definition of higher-order polymorphic functions in a type system with recursive types and set-theoretic type connectives (unions, intersections, and negations). In the first part, presented in a companion paper, we defined and studied the syntax, semantics, and evaluation of the explicitlytyped version of a calculus, in which type instantiation is driven by explicit instantiation annotations. In this second part we present a local type inference system that allows the programmer to omit explicit instantiation annotations for function applications, and a type reconstruction system that allows the programmer to omit explicit type annotations for function definitions.

A New Model Construction for the Polymorphic Lambda Calculus

Logic Programming and Automated Reasoning/Russian Conference on Logic Programming, 2000

Various models for the Girard-Reynolds second-order lambda calculus have been pre- sented in the literature. Except the term model they are either realizability or domain models. In this paper a further model construction is introduced. Types are interpreted as inverse limits of !-cochains of finite sets. The corresponding morphisms are sequences of maps acting locally on the finte sets in

Metacircularity in the polymorphic λ-calculus

Theoretical Computer Science, 1991

We consider the question of whether a useful notion of metacircularity exists for the polymorphic A-calculus. Even though complete metacircularity seems to be impossible, we obtain a close approximation to a metacircular interpreter. We begin by presenting an encoding for the Girard-Reynolds second-order polymorphic A-calculus in the third-order polymorphic A-calculus. The encoding makes use of representations in which abstractions are represented by abstractions, thus eliminating the need for the explicit representation of environments. We then extend this construction to encompass all of the w-order polymorphic A-calculus (F,). The representation has the property that evaluation is definable, and furthermore that only well-typed terms can be represented and thus type inference does not have to be explicitly defined. Unfortunately, this metacircularity result seems to fall short of providing a useful framework for typed metaprogramming. We speculate on the reasons for this failure and the prospects for overcoming it in the future. In addition, we briefly describe our efforts in designing a practical programming language based on F,.