Non-parametric parametricity

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.

[1]  Lars Birkedal,et al.  Relational Interpretations of Recursive Types in an Operational Setting , 1999, Inf. Comput..

[2]  Derek Dreyer,et al.  State-dependent representation independence , 2009, POPL '09.

[3]  Nicolas Tabareau,et al.  Compiling functional types to relational specifications for low level imperative code , 2009, TLDI '09.

[4]  Dan Grossman,et al.  Syntactic type abstraction , 2000, TOPL.

[5]  Andreas Rossberg The missing link: dynamic components for ML , 2006, ICFP '06.

[6]  Andreas Rossberg,et al.  Generativity and dynamic opacity for abstract types , 2003, PPDP '03.

[7]  J. Y. Girard,et al.  Interpretation fonctionelle et elimination des coupures dans l'aritmetique d'ordre superieur , 1972 .

[8]  Karl Crary,et al.  Syntactic Logical Relations for Polymorphic and Recursive Types , 2007, Computation, Meaning, and Logic.

[9]  Simon L. Peyton Jones,et al.  Generative type abstraction and type-level computation , 2011, POPL '11.

[10]  John C. Mitchell,et al.  Abstract types have existential types , 1985, POPL.

[11]  John C. Reynolds,et al.  Types, Abstraction and Parametric Polymorphism , 1983, IFIP Congress.

[12]  John C. Mitchell,et al.  Representation independence and data abstraction , 1986, POPL '86.

[13]  Amal Ahmed,et al.  Step-Indexed Syntactic Logical Relations for Recursive and Quantified Types , 2006, ESOP.

[14]  Andreas Rossberg Dynamic Translucency with Abstraction Kinds and Higher-Order Coercions , 2008, MFPS.

[15]  I. Stark,et al.  Operational reasoning for functions with local state , 1999 .

[16]  John C. Mitchell,et al.  Parametricity and Variants of Girard's J Operator , 1999, Inf. Process. Lett..

[17]  Amal Ahmed,et al.  Semantics of types for mutable state , 2004 .

[18]  Lars Birkedal,et al.  Relational Interpretations of Recursive Types in an operational Setting (Summary) , 1997, TACS.

[19]  James H. Morris,et al.  Types are not sets , 1973, POPL.

[20]  Benjamin C. Pierce,et al.  Logical relations for encryption , 2001, Proceedings. 14th IEEE Computer Security Foundations Workshop, 2001..

[21]  Andrew M. Pitts,et al.  Observable Properties of Higher Order Functions that Dynamically Create Local Names, or What's new? , 1993, MFCS.

[22]  Peter Sewell Modules, abstract types, and distributed versioning , 2001, POPL '01.

[23]  Benjamin C. Pierce,et al.  A bisimulation for dynamic sealing , 2007, Theor. Comput. Sci..

[24]  Benjamin C. Pierce,et al.  A bisimulation for type abstraction and recursion , 2005, POPL '05.

[25]  Stephanie Weirich Type-FUNCTIONAL PEARL safe cast , 2004 .

[26]  Georg Neis,et al.  Non-parametric parametricity , 2011, J. Funct. Program..

[27]  Benjamin C. Pierce,et al.  Logical relation for encryption , 2003 .

[28]  Andreas Rossberg,et al.  Typed open programming: a higher-order, typed approach to dynamic modularity and distribution , 2007 .

[29]  Philip Wadler,et al.  Theorems for free! , 1989, FPCA.

[30]  Martín Abadi,et al.  Dynamic typing in polymorphic languages , 1995, Journal of Functional Programming.

[31]  Gert Smolka,et al.  Alice through the looking glass , 2021, Trends in Functional Programming.

[32]  James H. Morris Protection in programming languages , 1973, CACM.

[33]  Robert Harper,et al.  Compiling polymorphism using intensional type analysis , 1995, POPL '95.

[34]  Amal Ahmed,et al.  Parametric Polymorphism through Run-Time Sealing or, Theorems for Low, Low Prices! , 2008, ESOP.

[35]  Viktor Vafeiadis,et al.  Acute: high-level programming language design for distributed computation , 2005, ICFP '05.

[36]  Benjamin C. Pierce,et al.  Advanced Topics In Types And Programming Languages , 2004 .

[37]  Andrew W. Appel,et al.  An indexed model of recursive types for foundational proof-carrying code , 2001, TOPL.

[38]  Stephanie Weirich,et al.  An open and shut typecase , 2005, TLDI '05.

[39]  Stephanie Weirich,et al.  Type-safe cast , 2004, J. Funct. Program..

[40]  Matthias Blume,et al.  Typed closure conversion preserves observational equivalence , 2008, ICFP 2008.

[41]  Stephanie Weirich,et al.  Generalizing parametricity using information-flow , 2005, 20th Annual IEEE Symposium on Logic in Computer Science (LICS' 05).