Scoped and Typed Staging by Evaluation
Abstract: Using a dependently typed host language, we give a well scoped-and-typed by construction presentation of a minimal two level simply typed calculus with a static and a dynamic stage. The staging function partially evaluating the part of a term that are static is obtained by a model construction inspired by normalisation by evaluation. We then go on to demonstrate how this minimal language can be extended to provide additional metaprogramming capabilities, and to define a higher order functional language evaluating to digital circuit descriptions.
- Copatterns: programming infinite structures by observations. In The 40th Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL ’13, Rome, Italy - January 23 - 25, 2013, Roberto Giacobazzi and Radhia Cousot (Eds.). ACM, 27–38. https://doi.org/10.1145/2429069.2429075
- A type- and scope-safe universe of syntaxes with binding: their semantics and proofs. J. Funct. Program. 31 (2021), e22. https://doi.org/10.1017/S0956796820000076
- Type-and-scope safe programs and their proofs. In Proceedings of the 6th ACM SIGPLAN Conference on Certified Programs and Proofs, CPP 2017, Paris, France, January 16-17, 2017, Yves Bertot and Viktor Vafeiadis (Eds.). ACM, 195–207. https://doi.org/10.1145/3018610.3018613
- Categorical Reconstruction of a Reduction Free Normalization Proof. In Category Theory and Computer Science, 6th International Conference, CTCS ’95, Cambridge, UK, August 7-11, 1995, Proceedings (Lecture Notes in Computer Science, Vol. 953), David H. Pitt, David E. Rydeheard, and Peter T. Johnstone (Eds.). Springer, 182–199. https://doi.org/10.1007/3-540-60164-3_27
- Thorsten Altenkirch and Bernhard Reus. 1999. Monadic Presentations of Lambda Terms Using Generalized Inductive Types. In Computer Science Logic, 13th International Workshop, CSL ’99, 8th Annual Conference of the EACSL, Madrid, Spain, September 20-25, 1999, Proceedings (Lecture Notes in Computer Science, Vol. 1683), Jörg Flum and Mario Rodrıguez-Artalejo (Eds.). Springer, 453–468. https://doi.org/10.1007/3-540-48168-0_32
- Françoise Bellegarde and James Hook. 1994. Substitution: A Formal Methods Case Study Using Monads and Transformations. Sci. Comput. Program. 23, 2-3 (1994), 287–311. https://doi.org/10.1016/0167-6423(94)00022-0
- Ulrich Berger and Helmut Schwichtenberg. 1991. An Inverse of the Evaluation Functional for Typed lambda-calculus. In Proceedings of the Sixth Annual Symposium on Logic in Computer Science (LICS ’91), Amsterdam, The Netherlands, July 15-18, 1991. IEEE Computer Society, 203–211. https://doi.org/10.1109/LICS.1991.151645
- Richard S. Bird and Ross Paterson. 1999. De Bruijn Notation as a Nested Datatype. J. Funct. Program. 9, 1 (1999), 77–91. https://doi.org/10.1017/s0956796899003366
- Jacques Carette and Oleg Kiselyov. 2011. Multi-stage programming with functors and monads: Eliminating abstraction overhead from generic code. Sci. Comput. Program. 76, 5 (2011), 349–375. https://doi.org/10.1016/J.SCICO.2008.09.008
- Alonzo Church. 1941. The calculi of lambda-conversion. Number 6 in Annals of Mathematics Studies. Princeton University Press.
- Catarina Coquand. 2002. A Formalised Proof of the Soundness and Completeness of a Simply Typed Lambda-Calculus with Explicit Substitutions. High. Order Symb. Comput. 15, 1 (2002), 57–90. https://doi.org/10.1023/A:1019964114625
- Thierry Coquand and Peter Dybjer. 1997. Intuitionistic Model Constructions and Normalization Proofs. Math. Struct. Comput. Sci. 7, 1 (1997), 75–94. https://doi.org/10.1017/S0960129596002150
- Compiling Higher-Order Specifications to SMT Solvers: How to Deal with Rejection Constructively. In Proceedings of the 12th ACM SIGPLAN International Conference on Certified Programs and Proofs, CPP 2023, Boston, MA, USA, January 16-17, 2023, Robbert Krebbers, Dmitriy Traytel, Brigitte Pientka, and Steve Zdancewic (Eds.). ACM, 102–120. https://doi.org/10.1145/3573105.3575674
- Nicolaas Govert de Bruijn. 1972. Lambda Calculus Notation with Nameless Dummies. In Indagationes Mathematicae, Vol. 75. Elsevier, 381–392.
- Peter Dybjer. 1994. Inductive Families. Formal Aspects Comput. 6, 4 (1994), 440–465. https://doi.org/10.1007/BF01211308
- Pi-Ware: Hardware Description and Verification in Agda. In 21st International Conference on Types for Proofs and Programs, TYPES 2015, May 18-21, 2015, Tallinn, Estonia (LIPIcs, Vol. 69), Tarmo Uustalu (Ed.). Schloss Dagstuhl - Leibniz-Zentrum für Informatik, 9:1–9:27. https://doi.org/10.4230/LIPIcs.TYPES.2015.9
- An Introduction to Quantum Programming in Quipper. In Reversible Computation - 5th International Conference, RC 2013, Victoria, BC, Canada, July 4-5, 2013. Proceedings (Lecture Notes in Computer Science, Vol. 7948), Gerhard W. Dueck and D. Michael Miller (Eds.). Springer, 110–124. https://doi.org/10.1007/978-3-642-38986-3_10
- Mœbius: metaprogramming using contextual types: the stage where system f can pattern match on itself. Proc. ACM Program. Lang. 6, POPL (2022), 1–27. https://doi.org/10.1145/3498700
- András Kovács. 2022. Staged compilation with two-level type theory. Proc. ACM Program. Lang. 6, ICFP (2022), 540–569. https://doi.org/10.1145/3547641
- Per Martin-Löf. 1984. Intuitionistic type theory. Studies in proof theory, Vol. 1. Bibliopolis.
- John C. Mitchell and Eugenio Moggi. 1991. Kripke-Style Models for Typed lambda Calculus. Ann. Pure Appl. Log. 51, 1-2 (1991), 99–124. https://doi.org/10.1016/0168-0072(91)90067-V
- Ulf Norell. 2008. Dependently Typed Programming in Agda. In Advanced Functional Programming, 6th International School, AFP 2008, Heijen, The Netherlands, May 2008, Revised Lectures (Lecture Notes in Computer Science, Vol. 5832), Pieter W. M. Koopman, Rinus Plasmeijer, and S. Doaitse Swierstra (Eds.). Springer, 230–266. https://doi.org/10.1007/978-3-642-04652-0_5
- QWIRE: a core language for quantum circuits. In Proceedings of the 44th ACM SIGPLAN Symposium on Principles of Programming Languages, POPL 2017, Paris, France, January 18-20, 2017, Giuseppe Castagna and Andrew D. Gordon (Eds.). ACM, 846–858. https://doi.org/10.1145/3009837.3009894
- Mathys Rennela and Sam Staton. 2020. Classical Control, Quantum Circuits and Linear Logic in Enriched Category Theory. Log. Methods Comput. Sci. 16, 1 (2020). https://doi.org/10.23638/LMCS-16(1:30)2020
- Sven-Bodo Scholz. 2014. Partial evaluation as universal compiler tool: experiences from the SAC Eco system. In Proceedings of the ACM SIGPLAN 2014 workshop on Partial evaluation and program manipulation, PEPM 2014, January 20-21, 2014, San Diego, California, USA, Wei-Ngan Chin and Jurriaan Hage (Eds.). ACM, 95–96. https://doi.org/10.1145/2543728.2543747
- James Wood and Robert Atkey. 2022. A Framework for Substructural Type Systems. In Programming Languages and Systems - 31st European Symposium on Programming, ESOP 2022, Held as Part of the European Joint Conferences on Theory and Practice of Software, ETAPS 2022, Munich, Germany, April 2-7, 2022, Proceedings (Lecture Notes in Computer Science, Vol. 13240), Ilya Sergey (Ed.). Springer, 376–402. https://doi.org/10.1007/978-3-030-99336-8_14
Paper Prompts
Sign up for free to create and run prompts on this paper using GPT-5.
Top Community Prompts
Collections
Sign up for free to add this paper to one or more collections.