Nothing Special   »   [go: up one dir, main page]

skip to main content
10.1145/1596550.1596572acmconferencesArticle/Chapter ViewAbstractPublication PagesicfpConference Proceedingsconference-collections
research-article

Non-parametric parametricity

Published: 31 August 2009 Publication History

Abstract

Type abstraction and intensional type analysis are features seemingly at odds-type abstraction is intended to guarantee parametricity and representation independence, while type analysis is inherently non-parametric. Recently, however, several researchers have proposed and implemented "dynamic type generation" as a way to reconcile these features. The idea is that, when one defines an abstract type, one should also be able to generate at run time a fresh type name, which may be used as a dynamic representative of the abstract type for purposes of type analysis. The question remains: in a language with non-parametric polymorphism, does dynamic type generation provide us with the same kinds of abstraction guarantees that we get from parametric polymorphism?
Our goal is to provide a rigorous answer to this question. We define a step-indexed Kripke logical relation for a language with both non-parametric polymorphism (in the form of type-safe cast) and dynamic type generation. Our logical relation enables us to establish parametricity and representation independence results, even in a non-parametric setting, by attaching arbitrary relational interpretations to dynamically-generated type names. In addition, we explore how programs that are provably equivalent in a more traditional parametric logical relation may be "wrapped" systematically to produce terms that are related by our non-parametric relation, and vice versa. This leads us to a novel "polarized" form of our logical relation, which enables us to distinguish formally between positive and negative notions of parametricity.

Supplementary Material

JPG File (non-parametricparametricityonvimeo2.jpg)
MP4 File (non-parametricparametricityonvimeo2.mp4)

References

[1]
Martin Abadi, Luca Cardelli, Benjamin Pierce, and Didier Remy. Dynamic typing in polymorphic languages. JFP, 5(1):111--130, 1995.
[2]
Amal Ahmed. Semantics of Types for Mutable State. PhD thesis, Princeton University, 2004.
[3]
Amal Ahmed. Step-indexed syntactic logical relations for recursive and quantified types. In ESOP, 2006.
[4]
Amal Ahmed. Personal communication, 2009.
[5]
Amal Ahmed and Matthias Blume. Typed closure conversion preserves observational equivalence. In ICFP, 2008.
[6]
Amal Ahmed, Derek Dreyer, and Andreas Rossberg. State-dependent representation independence. In POPL, 2009.
[7]
Andrew W. Appel and David McAllester. An indexed model of recursive types for foundational proof-carrying code. TOPLAS, 23(5):657--683, 2001.
[8]
Karl Crary and Robert Harper. Syntactic logical relations for polymorphic and recursive types. In Computation, Meaning and Logic: Articles dedicated to Gordon Plotkin. 2007.
[9]
Jean-Yves Girard. Interpretation fonctionelle et elimination des coupures de l'arithmetique d'ordre superieur. PhD thesis, Universite Paris VII, 1972.
[10]
Dan Grossman, Greg Morrisett, and Steve Zdancewic. Syntactic type abstraction. TOPLAS, 22(6):1037--1080, 2000.
[11]
Robert Harper and John C. Mitchell. Parametricity and variants of Girard's J operator. Information Processing Letters, 1999.
[12]
Robert Harper and Greg Morrisett. Compiling polymorphism using intensional type analysis. In POPL, 1995.
[13]
JacobMatthews and Amal Ahmed. Parametric polymorphism through run-time sealing, or, theorems for low, low prices! In ESOP, 2008.
[14]
John C. Mitchell. Representation independence and data abstraction. In POPL, 1986.
[15]
John C. Mitchell and Gordon D. Plotkin. Abstract types have existential type. TOPLAS, 10(3):470--502, 1988.
[16]
Georg Neis. Non-parametric parametricity. Master's thesis, Universitat des Saarlandes, 2009.
[17]
Andrew Pitts. Typed operational reasoning. In Benjamin C. Pierce, editor, Advanced Topics in Types and Programming Languages, chapter 7. MIT Press, 2005.
[18]
Andrew Pitts and Ian Stark. Observable properties of higher order functions that dynamically create local names, or: What's new? In MFCS, volume 711 of LNCS, 1993.
[19]
Andrew Pitts and Ian Stark. Operational reasoning for functions with local state. In HOOTS, 1998.
[20]
John C. Reynolds. Types, abstraction and parametric polymorphism. In Information Processing, 1983.
[21]
Andreas Rossberg. Generativity and dynamic opacity for abstract types. In PPDP, 2003.
[22]
Andreas Rossberg. Dynamic translucency with abstraction kinds and higher-order coercions. In MFPS, 2008.
[23]
Andreas Rossberg, Didier Le Botlan, Guido Tack, Thorsten Brunklaus, and Gert Smolka. Alice ML through the looking glass. In TFP, volume 5, 2004.
[24]
Peter Sewell. Modules, abstract types, and distributed versioning. In POPL, 2001.
[25]
Peter Sewell, James Leifer, Keith Wansbrough, Francesco Zappa Nardelli, Mair Allen-Williams, Pierre Habouzit, and Viktor Vafeiadis. Acute: High-level programming language design for distributed computation. JFP, 17(4&5):547--612, 2007.
[26]
Eijiro Sumii and Benjamin C. Pierce. Logical relations for encryption. JCS, 11(4):521--554, 2003.
[27]
Eijiro Sumii and Benjamin C. Pierce. A bisimulation for dynamic sealing. TCS, 375(1-3):161--192, 2007.
[28]
Eijiro Sumii and Benjamin C. Pierce. A bisimulation for type abstraction and recursion. JACM, 54(5):1--43, 2007.
[29]
Dimitrios Vytiniotis, Geoffrey Washburn, and Stephanie Weirich. An open and shut typecase. In TLDI, 2005.
[30]
Philip Wadler. Theorems for free! In FPCA, 1989.
[31]
Geoffrey Washburn and Stephanie Weirich. Generalizing parametricity using information flow. In LICS, 2005.
[32]
Stephanie Weirich. Type-safe cast. JFP, 14(6):681--695, 2004.

Cited By

View all

Recommendations

Reviews

Markus Wolf

Programming languages with language constructs for analyzing types or casting from some abstract type to its concrete implementation type seem to violate abstraction principles (especially the parametricity principle that the current concrete implementation of an abstract type can be replaced by any other concrete implementation conforming to the abstract type). However, if the type system carefully guards against "unsafe" applications of these constructs and allows concrete type instantiations to hide behind dynamically generated type names, then parametricity can be recovered. This is elaborated and rigorously proved in this paper. The first two sections introduce the topic, present the motivation, and define a simple polymorphic language (complete with syntax, type system, and operational semantics) with a cast function and a dynamic type name generation operation. The following two sections explain how parametricity for the language is proved via a classic technique using logical relations. The logical relation in itself combines a step-indexed logical relation with a Kripke logical relation. The main structure of the proof is shown. Some technical details are not fully presented in the paper, but can be downloaded in the form of a technical report from the homepage of one of the authors. The previous result showed that parametricity can be regained via the introduction of fresh type names. It is, however, not immediately obvious how to systematically replace an arbitrary expression with an expression that is parametric. To achieve this, a wrapping operator is defined. In the following sections, the logical relation is extended and refined in order to reason about parametricity in a more natural way and to include iso-recursive types. Finally, the authors show one direction of a full abstraction result of an embedding of System F (with recursion) into the language of the paper; the other direction is an open problem. The article concludes with references to related work and a conclusion. The article is very well written, but the density of technical definitions is quite high, making it difficult for the reader to follow all of the details. The basic ideas and the reasons why the technical results are correct are presented in a very compelling way. I recommended this paper to anyone interested in typed functional programming languages. Online Computing Reviews Service

Access critical reviews of Computing literature here

Become a reviewer for Computing Reviews.

Comments

Please enable JavaScript to view thecomments powered by Disqus.

Information & Contributors

Information

Published In

cover image ACM Conferences
ICFP '09: Proceedings of the 14th ACM SIGPLAN international conference on Functional programming
August 2009
364 pages
ISBN:9781605583327
DOI:10.1145/1596550
  • cover image ACM SIGPLAN Notices
    ACM SIGPLAN Notices  Volume 44, Issue 9
    ICFP '09
    September 2009
    343 pages
    ISSN:0362-1340
    EISSN:1558-1160
    DOI:10.1145/1631687
    Issue’s Table of Contents
Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

Sponsors

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 31 August 2009

Permissions

Request permissions for this article.

Check for updates

Author Tags

  1. intensional type analysis
  2. parametricity
  3. representation independence
  4. step-indexed logical relations
  5. type-safe cast

Qualifiers

  • Research-article

Conference

ICFP '09
Sponsor:
ICFP '09: ACM SIGPLAN International Conference on Functional Programming
August 31 - September 2, 2009
Edinburgh, Scotland

Acceptance Rates

Overall Acceptance Rate 300 of 972 submissions, 31%

Upcoming Conference

ICFP '25
ACM SIGPLAN International Conference on Functional Programming
October 12 - 18, 2025
Singapore , Singapore

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)4
  • Downloads (Last 6 weeks)0
Reflects downloads up to 18 Nov 2024

Other Metrics

Citations

Cited By

View all
  • (2024)A Logical Approach to Type SoundnessJournal of the ACM10.1145/367695471:6(1-75)Online publication date: 11-Nov-2024
  • (2024)Type-directed operational semantics for gradual typingJournal of Functional Programming10.1017/S095679682400007834Online publication date: 26-Sep-2024
  • (2022)Gradual System FJournal of the ACM10.1145/355598669:5(1-78)Online publication date: 28-Oct-2022
  • (2022)Two Parametricities Versus Three Universal TypesACM Transactions on Programming Languages and Systems10.1145/353965744:4(1-43)Online publication date: 21-Sep-2022
  • (2019)Consistent Subtyping for AllACM Transactions on Programming Languages and Systems10.1145/331033942:1(1-79)Online publication date: 21-Nov-2019
  • (2019)Gradual parametricity, revisitedProceedings of the ACM on Programming Languages10.1145/32903303:POPL(1-30)Online publication date: 2-Jan-2019
  • (2019)Gradual type theoryProceedings of the ACM on Programming Languages10.1145/32903283:POPL(1-31)Online publication date: 2-Jan-2019
  • (2017)Parametricity versus the universal typeProceedings of the ACM on Programming Languages10.1145/31581262:POPL(1-23)Online publication date: 27-Dec-2017
  • (2017)Theorems for free for free: parametricity, with and without typesProceedings of the ACM on Programming Languages10.1145/31102831:ICFP(1-28)Online publication date: 29-Aug-2017
  • (2017)Typed self-evaluation via intensional type functionsACM SIGPLAN Notices10.1145/3093333.300985352:1(415-428)Online publication date: 1-Jan-2017
  • Show More Cited By

View Options

Login options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Media

Figures

Other

Tables

Share

Share

Share this Publication link

Share on social media