Abstract
Many popular languages have a self-interpreter, that is, an interpreter for the language written in itself. So far, work on polymorphically-typed self-interpreters has concentrated on self-recognizers that merely recover a program from its representation. A larger and until now unsolved challenge is to implement a polymorphically-typed self-evaluator that evaluates the represented program and produces a representation of the result. We present Fωμi, the first λ-calculus that supports a polymorphically-typed self-evaluator. Our calculus extends Fω with recursive types and intensional type functions and has decidable type checking. Our key innovation is a novel implementation of type equality proofs that enables us to define a versatile representation of programs. Our results establish a new category of languages that can support polymorphically-typed self-evaluators.
- Martin Abadi, Luca Cardelli, and Gordon Plotkin. Types for the scott numerals, 1993.Google Scholar
- Harold Abelson, Gerald Jay Sussman, and Julie Sussman. Structure and Interpretation of Computer Programs. MIT Press, 1985. Google Scholar
Digital Library
- Klaus Aehlig and Felix Joachimski. Operational aspects of untyped normalisation by evaluation. Mathematical Structures in Computer Science, 14:587–611, 8 2004. Google Scholar
Digital Library
- Arthur I. Baars and S. Doaitse Swierstra. Typing dynamic typing. In ICFP ’02: Proceedings of the 7th ACM SIGPLAN International Conference on Functional Programming, pages 157–166. ACM Press, 2002. Google Scholar
Digital Library
- Reg Braithwaite. The significance of the meta-circular interpreter. http://weblog.raganwald.com/2006/11/significance-of-metacircular_22.html, November 2006.Google Scholar
- Matt Brown and Jens Palsberg. Self-Representation in Girard’s System U. In Proceedings of the 42nd Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL ’15, pages 471– 484, New York, NY, USA, 2015. ACM. Google Scholar
Digital Library
- Matt Brown and Jens Palsberg. Breaking through the normalization barrier: A self-interpreter for F-omega. In Proceedings of the 43rd Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL 2016, pages 5–17, New York, NY, USA, 2016. ACM. Google Scholar
Digital Library
- Chiyan Chen, Dengping Zhu, and Hongwei Xi. Implementing Cut Elimination: A Case Study of Simulating Dependent Types in Haskell, pages 239–254. Springer Berlin Heidelberg, Berlin, Heidelberg, 2004.Google Scholar
- James Cheney and Ralf Hinze. A lightweight implementation of generics and dynamics. In Proceedings of the 2002 ACM SIGPLAN Workshop on Haskell, Haskell ’02, pages 90–104, New York, NY, USA, 2002. ACM. Google Scholar
Digital Library
- James Cheney and Ralf Hinze. First-class phantom types. Technical report, Cornell University, 2003.Google Scholar
- 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
- Gregory D. Collins and Zhong Shao. Intensional analysis of higherkinded recursive types. Technical report, Yale University, 2002.Google Scholar
- Karl Crary and Stephanie Weirich. Flexible type analysis. In In 1999 ACM International Conference on Functional Programming, pages 233–248. ACM Press, 1999. Google Scholar
Digital Library
- Karl Crary, Stephanie Weirich, and Greg Morrisett. Intensional polymorphism in type-erasure semantics. SIGPLAN Not., 34(1):301–312, September 1998. Google Scholar
Digital Library
- Dominic Duggan. A type-based semantics for user-defined marshalling in polymorphic languages, pages 273–297. Springer Berlin Heidelberg, Berlin, Heidelberg, 1998. Google Scholar
Digital Library
- Brendan Eich. Narcissus. http://mxr.mozilla.org/mozilla/ source/js/narcissus/jsexec.js, 2010.Google Scholar
- Andrzej Filinski and Henning Korsholm Rohde. A Denotational Account of Untyped Normalization by Evaluation, pages 167–181. Springer Berlin Heidelberg, Berlin, Heidelberg, 2004.Google Scholar
- Jean-Yves Girard, Paul Taylor, and Yves Lafont. Proofs and Types. Number 7 in Cambridge Tracts in Theoretical Computer Science. Cambridge University Press, 1989. Google Scholar
Digital Library
- Louis-Julien Guillemette and Stefan Monnier. A type-preserving compiler in Haskell. In Proceedings of the 13th ACM SIGPLAN international conference on Functional programming, ICFP ’08, pages 75–86, New York, NY, USA, 2008. ACM. Google Scholar
Digital Library
- Robert Harper and Greg Morrisett. Compiling polymorphism using intensional type analysis. In Proceedings of the 22Nd ACM SIGPLANSIGACT Symposium on Principles of Programming Languages, POPL ’95, pages 130–141, New York, NY, USA, 1995. ACM. Google Scholar
Digital Library
- 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
- Arie Middelkoop, Atze Dijkstra, and S. Doaitse Swierstra. A lean specification for GADTs: System F with first-class equality proofs. Higher Order Symbol. Comput., 23(2):145–166, June 2010. 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
- Greg Morrisett. Compiling with types. Technical report, 1995.Google Scholar
- Matthew Naylor. Evaluating Haskell in Haskell. The Monad.Reader, 10:25–33, 2008.Google Scholar
- Georg Neis, Derek Dreyer, and Andreas Rossberg. Non-parametric parametricity. In Proceedings of the 14th ACM SIGPLAN International Conference on Functional Programming, ICFP ’09, pages 135–148, New York, NY, USA, 2009. ACM. Google Scholar
Digital Library
- Emir Pasalic. The Role of Type Equality in Meta-programming. PhD thesis, 2004. AAI3151199. Google Scholar
Digital Library
- Frank Pfenning and Peter Lee. Metacircularity in the polymorphic λcalculus. Theoretical Computer Science, 89(1):137–159, 1991. Google Scholar
Digital Library
- Benjamin C. Pierce. Types and Programming Languages. MIT Press, Cambridge, MA, USA, 2002. Google Scholar
Digital Library
- Tillmann Rendel, Klaus Ostermann, and Christian Hofer. Typed selfrepresentation. In Proceedings of PLDI’09, ACM SIGPLAN Conference on Programming Language Design and Implementation, pages 293–303, June 2009. Google Scholar
Digital Library
- Armin Rigo and Samuele Pedroni. Pypy’s approach to virtual machine construction. In OOPSLA Companion, pages 044–953, 2006. 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
- Tim Sheard and Emir Pasalic. Meta-programming with built-in type equality. Electron. Notes Theor. Comput. Sci., 199:49–65, February 2008. Google Scholar
Digital Library
- Martin Sulzmann, Manuel M. T. Chakravarty, Simon Peyton Jones, and Kevin Donnelly. System F with type equality coercions. In TLDI’07, ACM SIGPLAN Workshop on Types in Language Design and Implementation, 2007. Google Scholar
Digital Library
- Valery Trifonov, Bratin Saha, and Zhong Shao. Fully reflexive intensional type analysis. SIGPLAN Not., 35(9):82–93, September 2000. Google Scholar
Digital Library
- Dimitrios Vytiniotis, Geoffrey Washburn, and Stephanie Weirich. An open and shut typecase. In Proceedings of the 2005 ACM SIGPLAN International Workshop on Types in Languages Design and Implementation, TLDI ’05, pages 13–24, New York, NY, USA, 2005. ACM. Google Scholar
Digital Library
- Dimitrios Vytiniotis and Stephanie Weirich. Parametricity, type equality, and higher-order polymorphism. Journal of Functional Programming, 20(02):175–210, 2010. 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
- Stephanie Weirich. Type-safe cast: (functional pearl). In Proceedings of the Fifth ACM SIGPLAN International Conference on Functional Programming, ICFP ’00, pages 58–67, New York, NY, USA, 2000. ACM. Google Scholar
Digital Library
- Stephanie Weirich. Higher-order intensional type analysis. In Proceedings of the 11th European Symposium on Programming Languages and Systems, ESOP ’02, pages 98–114, London, UK, UK, 2002. Springer-Verlag. Google Scholar
Digital Library
- Wikipedia. Mogensen-Scott encoding. https://en.wikipedia.org/wiki/Mogensen–Scott_encoding.Google Scholar
- Wikipedia. Rubinius. http://en.wikipedia.org/wiki/Rubinius, 2010.Google Scholar
- Andrew Wright and Matthias Felleisen. A syntactic approach to type soundness. Information and Computation, 115(1):38–94, 1994. Google Scholar
Digital Library
- Hongwei Xi, Chiyan Chen, and Gang Chen. Guarded recursive datatype constructors. In ACM SIGPLAN Notices, volume 38, pages 224–235. ACM, 2003. Google Scholar
Digital Library
- Zhe Yang. Encoding types in ML-like languages. In Proceedings of the Third ACM SIGPLAN International Conference on Functional Programming, ICFP ’98, pages 289–300, New York, NY, USA, 1998. ACM. Google Scholar
Digital Library
Index Terms
Typed self-evaluation via intensional type functions
Recommendations
Typed self-evaluation via intensional type functions
POPL '17: Proceedings of the 44th ACM SIGPLAN Symposium on Principles of Programming LanguagesMany popular languages have a self-interpreter, that is, an interpreter for the language written in itself. So far, work on polymorphically-typed self-interpreters has concentrated on self-recognizers that merely recover a program from its ...
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 ...
Breaking through the normalization barrier: a self-interpreter for f-omega
POPL '16According 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 ...







Comments