Parametric Polymorphism through Run-Time Sealing or, Theorems for Low, Low Prices!

  • Jacob Matthews
  • Amal Ahmed
Part of the Lecture Notes in Computer Science book series (LNCS, volume 4960)


We show how to extend System F’s parametricity guarantee to a Matthews-Findler-style multi-language system that combines System F with an untyped language by use of dynamic sealing. While the use of sealing for this purpose has been suggested before, it has never been proven to preserve parametricity. In this paper we prove that it does using step-indexed logical relations. Using this result we show a scheme for implementing parametric higher-order contracts in an untyped setting which corresponds to a translation given by Sumii and Pierce. These contracts satisfy rich enough guarantees that we can extract analogues to Wadler’s free theorems that rely on run-time enforcement of dynamic seals.


Type Variable Logical Relation Natural Embedding Lambda Calculus Conversion Scheme 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


  1. 1.
    Reynolds, J.C.: Types, abstraction and parametric polymorphism. In: IFIP Congress, pp. 513–523 (1983)Google Scholar
  2. 2.
    Wadler, P.: Theorems for free! In: Functional Programming Languages and Computer Architecture (FPCA), pp. 347–359 (1989)Google Scholar
  3. 3.
    Morris Jr., J.H.: Types are not sets. In: POPL (1973)Google Scholar
  4. 4.
    Flatt, M.: PLT MzScheme: Language manual. Technical Report TR97-280, Rice University (1997),
  5. 5.
    Sumii, E., Pierce, B.: A bisimulation for dynamic sealing. In: POPL (2004)Google Scholar
  6. 6.
    Matthews, J., Findler, R.B.: Operational semantics for multi-language programs. In: POPL (2007), Extended version: University of Chicago Technical Report TR-2007-8, under reviewGoogle Scholar
  7. 7.
    Ahmed, A.: Step-indexed syntactic logical relations for recursive and quantified types. In: ESOP. pp. 69–83 (2006), Extended version: Harvard University Technical Report TR-01-06,
  8. 8.
    Findler, R.B., Felleisen, M.: Contracts for higher-order functions. In: ICFP (2002)Google Scholar
  9. 9.
    Matthews, J., Ahmed, A.: Parametric polymorphism through run-time sealing, or, theorems for low, low prices! (extended version). Technical Report TR-2008-01, University of Chicago (2008)Google Scholar
  10. 10.
    Findler, R.B., Blume, M.: Contracts as pairs of projections. In: FLOPS (2006)Google Scholar
  11. 11.
    Pierce, B., Sumii, E.: Relating cryptography and polymorphism. Unpublished manuscript (2000)Google Scholar
  12. 12.
    Sumii, E., Pierce, B.: Logical relations for encryption. Journal of Computer Security (JSC) 11(4), 521–554 (2003)Google Scholar
  13. 13.
    Zdancewic, S., Grossman, D., Morrisett, G.: Principals in programming languages. In: ICFP (1999)Google Scholar
  14. 14.
    Grossman, D., Morrisett, G., Zdancewic, S.: Syntactic type abstraction. ACM Transactions on Programming Languages and Systems 22, 1037–1080 (2000)CrossRefGoogle Scholar
  15. 15.
    Rossberg, A.: Generativity and dynamic opacity for abstract types. In: Miller, D. (ed.) PADL, Uppsala, Sweden, ACM Press, New York (2003), Extended version: Google Scholar
  16. 16.
    Rossberg, A.: Typed Open Programming – A higher-order, typed approach to dynamic modularity and distribution. Phd thesis, Universität des Saarlandes, Saarbrücken, Germany. Preliminary version (2007)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2008

Authors and Affiliations

  • Jacob Matthews
    • 1
  • Amal Ahmed
    • 2
  1. 1.University of Chicago 
  2. 2.Toyota Technological Institute at Chicago 

Personalised recommendations