Abstract
In 1991, Pfenning and Lee studied whether System F could support a typed self-interpreter. They concluded that typed self-representation for System F "seems to be impossible", but were able to represent System F in Fω. Further, they found that the representation of Fω requires kind polymorphism, which is outside Fω. In 2009, Rendel, Ostermann and Hofer conjectured that the representation of kind-polymorphic terms would require another, higher form of polymorphism. Is this a case of infinite regress? We show that it is not and present a typed self-representation for Girard's System U, the first for a λ-calculus with decidable type checking. System U extends System Fω with kind polymorphic terms and types. We show that kind polymorphic types (i.e. types that depend on kinds) are sufficient to "tie the knot" -- they enable representations of kind polymorphic terms without introducing another form of polymorphism. Our self-representation supports operations that iterate over a term, each of which can be applied to a representation of itself. We present three typed self-applicable operations: a self-interpreter that recovers a term from its representation, a predicate that tests the intensional structure of a term, and a typed continuation-passing-style (CPS) transformation -- the first typed self-applicable CPS transformation. Our techniques could have applications from verifiably type-preserving metaprograms, to growable typed languages, to more efficient self-interpreters.
Supplemental Material
- The webpage accompanying this paper is available at http://compilers.cs.ucla.edu/popl15/. The full paper with the appendix is available there, as are the source code for our implementation of System U and our operations.Google Scholar
- Harold Abelson, Gerald Jay Sussman, and Julie Sussman. Structure and Interpretation of Computer Programs. MIT Press, 1985. Google Scholar
Digital Library
- Emil Axelsson. A generic abstract syntax model for embedded languages. SIGPLAN Not., 47(9):323--334, September 2012. Google Scholar
Digital Library
- Henk Barendregt. Self-interpretations in lambda calculus. J. Funct. Program, 1(2):229--233, 1991.Google Scholar
Cross Ref
- HP Barendregt. Handbook of Logic in Computer Science (vol. 2): Background: Computational Structures: Abramski, S. (ed), chapter Lambda Calculi with Types. Oxford University Press, Inc., New York, NY, 1993. Google Scholar
Digital Library
- Gilles Barthe. Type-checking injective pure type systems. J. Funct. Program., 9(6):675--698, November 1999. Google Scholar
Digital Library
- Michel Bel. A recursion theoretic self interpreter for the lambda- calculus. http://www.belxs.com/michel/#selfint.Google Scholar
- Alessandro Berarducci and Corrado Böhm. A self-interpreter of lambda calculus having a normal form. In CSL, pages 85--99, 1992. Google Scholar
Digital Library
- Jacques Carette, Oleg Kiselyov, and Chung-chieh Shan. Finally tagless, partially evaluated: Tagless staged interpreters for simpler typed languages. Journal of Functional Programming, 19(5):509--543, 2009. Google Scholar
Digital Library
- Chiyan Chen and Hongwei Xi. Meta-Programming through Typeful Code Representation. In Proceedings of the Eighth ACM SIGPLAN International Conference on Functional Programming, pages 275--286, Uppsala, Sweden, August 2003. Google Scholar
Digital Library
- Chiyan Chen and Hongwei Xi. Meta-Programming through Typeful Code Representation. Journal of Functional Programming, 15(6):797--835, 2005. Google Scholar
Digital Library
- Adam Chlipala. Parametric higher-order abstract syntax for mechanized semantics. In Proceedings of the 13th ACM SIGPLAN International Conference on Functional Programming, ICFP '08, pages 143--156, New York, NY, USA, 2008. ACM. Google Scholar
Digital Library
- Brendan Eich. Narcissus. http://mxr.mozilla.org/mozilla/ source/js/narcissus/jsexec.js, 2010.Google Scholar
- Herman Geuvers and Mark-Jan Nederhof. Modular proof of strong normalization for the calculus of constructions. J. Funct. Program., 1(2):155--189, 1991.Google Scholar
Cross Ref
- Jan Herman Geuvers. Logics and type systems. 1993.Google Scholar
- Jean-Yves Girard. Interprétation fonctionelle et élimination des coupures de l'arithmétique d'ordre supérieur. PhD thesis, Université Paris VII, 1972.Google Scholar
- Barry Jay and Jens Palsberg. Typed self-interpretation by pattern matching. In Proceedings of ICFP'11, ACM SIGPLAN International Conference on Functional Programming, pages 247--258, Tokyo, September 2011. Google Scholar
Digital Library
- Stephen C. Kleene. definability and recursiveness. Duke Math. J., pages 340--353, 1936.Google Scholar
Cross Ref
- Oleg Mazonka and Daniel B. Cristofani. A very short self-interpreter. http://arxiv.org/html/cs/0311032v1, November 2003.Google Scholar
- Conor McBride. Outrageous but meaningful coincidences: Dependent type-safe syntax and evaluation. In Proceedings of the 6th ACM SIGPLAN Workshop on Generic Programming, WGP '10, pages 1--12, New York, NY, USA, 2010. ACM. Google Scholar
Digital Library
- John McCarthy. Recursive functions of symbolic expressions and their computation by machine, part i. Commun. ACM, 3(4):184--195, April 1960. Google Scholar
Digital Library
- Torben Æ. Mogensen. Efficient self-interpretations in lambda calculus. Journal of Functional Programming, 2(3):345--363, 1992. See also DIKU Report D-128, Sep 2, 1994.Google Scholar
Cross Ref
- Torben Æ. Mogensen. Linear-time self-interpretation of the pure lambda calculus. Higher-Order and Symbolic Computation, 13(3):217--237, 2000. Google Scholar
Digital Library
- Greg Morrisett, David Walker, Karl Crary, and Neal Glew. From System F to typed assembly language. ACM Trans. Program. Lang. Syst., 21(3):527--568, May 1999. Google Scholar
Digital Library
- Matthew Naylor. Evaluating Haskell in Haskell. The Monad.Reader, 10:25--33, 2008.Google Scholar
- Frank Pfenning and Peter Lee. Metacircularity in the polymorphic-calculus. Theoretical Computer Science, 89(1):137--159, 1991. Google Scholar
Digital Library
- Tillmann Rendel, Klaus Ostermann, and Christian Hofer. Typed self-representation. In Proceedings of PLDI'09, ACM SIGPLAN Conference on Programming Language Design and Implementation, pages 293--303, June 2009. Google Scholar
Digital Library
- John C. Reynolds. Definitional interpreters for higher-order programming languages. In Proceedings of 25th ACM National Conference, pages 717--740. ACM Press, 1972. The paper later appeared in Higher-Order and Symbolic Computation, 11, 363--397 (1998). Google Scholar
Digital Library
- Andreas Rossberg. HaMLet. http://www.mpi-sws.org/ rossberg/hamlet, 2010.Google Scholar
- Bratin Saha, Valery Trifonov, and Zhong Shao. Intensional analysis of quantified types. ACM Trans. Program. Lang. Syst., 25(2):159--209, 2003. Google Scholar
Digital Library
- Fangmin Song, Yongsen Xu, and Yuechen Qian. The self-reduction in lambda calculus. Theoretical Computer Science, 235(1):171--181, March 2000. Google Scholar
Digital Library
- John Tromp. Binary lambda calculus and combinatory logic. In Kolmogorov Complexity and Applications, 2006. A Revised Version is available at http://homepages.cwi.nl/ tromp/cl/LC.pdf.Google Scholar
- Philip Wadler. The expression problem. http://www.daimi.au.dk/madst/tool/papers/expression.txt.Google Scholar
- Alessandro Warth and Ian Piumarta. Ometa: An object-oriented language for pattern matching. In Proceedings of the 2007 Symposium on Dynamic Languages, DLS '07, pages 11--19, New York, NY, USA, 2007. ACM. Google Scholar
Digital Library
- Geoffrey Washburn and Stephanie Weirich. Boxes go bananas: Encoding higher-order abstract syntax with parametric polymorphism. In Proceedings of the Eighth ACM SIGPLAN International Conference on Functional Programming, ICFP '03, pages 249--262, New York, NY, USA, 2003. ACM. Google Scholar
Digital Library
- Wikipedia. PyPy. http://en.wikipedia.org/wiki/PyPy, 2010.Google Scholar
- Wikipedia. Rubinius. http://en.wikipedia.org/wiki/Rubinius, 2010.Google Scholar
- Tetsuo Yokoyama and Robert Glück. A reversible programming language and its invertible self-interpreter. In Proceedings of PEPM'07, ACM Symposium on Partial Evaluation and Semantics-Based Program Manipulation, 2007. Google Scholar
Digital Library
Index Terms
Self-Representation in Girard's System U
Recommendations
Breaking through the normalization barrier: a self-interpreter for f-omega
POPL '16: Proceedings of the 43rd Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming LanguagesAccording to conventional wisdom, a self-interpreter for a strongly normalizing lambda-calculus is impossible. We call this the normalization barrier. The normalization barrier stems from a theorem in computability theory that says that a total ...
Self-Representation in Girard's System U
POPL '15: Proceedings of the 42nd Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming LanguagesIn 1991, Pfenning and Lee studied whether System F could support a typed self-interpreter. They concluded that typed self-representation for System F "seems to be impossible", but were able to represent System F in Fω. Further, they found that the ...







Comments