skip to main content
research-article
Open Access
Artifacts Available
Artifacts Evaluated & Reusable

Dependent type systems as macros

Published:20 December 2019Publication History
Skip Abstract Section

Abstract

We present Turnstile+, a high-level, macros-based metaDSL for building dependently typed languages.

With it, programmers may rapidly prototype and iterate on the design of new dependently typed features and extensions.

Or they may create entirely new DSLs whose dependent type ``power'' is tailored to a specific domain.

Our framework's support of language-oriented programming also makes it suitable for experimenting with systems of interacting components, e.g., a proof assistant and its companion DSLs.

This paper explains the implementation details of Turnstile+, as well as how it may be used to create a wide-variety of dependently typed languages, from a lightweight one with indexed types, to a full spectrum proof assistant, complete with a tactic system and extensions for features like sized types and SMT interaction.

Skip Supplemental Material Section

Supplemental Material

a3-chang.webm

References

  1. 2017. RFC: The pi type trilogy. https://github.com/rust-lang/rfcs/issues/1930Google ScholarGoogle Scholar
  2. Andreas Abel. 2010. MiniAgda: Integrating Sized and Dependent Types. In PAR (EPTCS), Ana Bove, Ekaterina Komendantskaya, and Milad Niqui (Eds.), Vol. 43. 14–28. http://dblp.uni-trier.de/db/series/eptcs/eptcs43.html#abs-1012-4896Google ScholarGoogle Scholar
  3. Andreas Abel. 2012. Type-Based Termination, Inflationary Fixed-Points, and Mixed Inductive-Coinductive Types. In Proceedings 8th Workshop on Fixed Points in Computer Science, FICS 2012, Tallinn, Estonia, 24th March 2012. 1–11. Google ScholarGoogle ScholarCross RefCross Ref
  4. Thorsten Altenkirch, Nils Anders Danielsson, Andres Löh, and Nicolas Oury. 2010. ΠΣ: Dependent Types Without the Sugar. In Proceedings of the 10th International Conference on Functional and Logic Programming (FLOPS’10). 40–55.Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. Nada Amin, Tiark Rompf, and Martin Odersky. 2014. Foundations of Path-dependent Types. In Proceedings of the 2014 ACM International Conference on Object Oriented Programming Systems Languages & Applications (OOPSLA ’14). ACM, New York, NY, USA, 233–249. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. Abhishek Anand, Simon Boulier, Cyril Cohen, Matthieu Sozeau, and Nicolas Tabareau. 2018. Towards Certified MetaProgramming with Typed Template-Coq. (2018). www.irif.fr/~sozeau/research/publications/drafts/Towards_Certified_ Meta-Programming_with_Typed_Template-Coq.pdfGoogle ScholarGoogle Scholar
  7. Leif Andersen, Stephen Chang, and Matthias Felleisen. 2017. Super 8 Languages for Making Movies (Functional Pearl). Proc. ACM Program. Lang. 1, ICFP, Article 30 (Aug. 2017), 29 pages. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. Lennart Augustsson. 2007. Simpler, Easier! http://augustss.blogspot.ru/2007/10/simpler-easier-in-recent-paper-simply.htmlGoogle ScholarGoogle Scholar
  9. Andrej Bauer. 2012. How to Implement Dependent Type Theory. http://math.andrej.com/2012/11/08/how-to-implementdependent-type-theory-i/Google ScholarGoogle Scholar
  10. Jasmin C. Blanchette, Cezary Kaliszyk, Lawrence C. Paulson, and Josef Urban. 2016. Hammering towards QED. J. Formaliz. Reason. 9, 1 (2016), 101–148.Google ScholarGoogle Scholar
  11. Edwin Brady and Kevin Hammond. 2006. Dependently Typed MetaProgramming. In 7th Symposium on Trends in Functional Programming.Google ScholarGoogle Scholar
  12. Edwin C. Brady. 2005. Practical Implementation of a Dependently Typed Functional Programming Language. Ph.D. Dissertation. University of Durham.Google ScholarGoogle Scholar
  13. Stephen Chang, Alex Knauth, and Ben Greenman. 2017. Type Systems As Macros. In Proceedings of the 44th ACM SIGPLAN Symposium on Principles of Programming Languages. 694–705.Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. David Christiansen and Edwin Brady. 2016. Elaborator Reflection: Extending Idris in Idris. In Proceedings of the 21st ACM SIGPLAN International Conference on Functional Programming (ICFP 2016). ACM, New York, NY, USA, 284–297. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. Jesper Cockx, Dominique Devriese, and Frank Piessens. 2014. Pattern Matching Without K. In Proceedings of the 19th ACM SIGPLAN International Conference on Functional Programming (ICFP ’14). ACM, New York, NY, USA, 257–268. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. Thierry Coquand. 1992. Pattern Matching with Dependent Types. In Proceedings of the Workshop on Types for Proofs and Programs. 71–83.Google ScholarGoogle Scholar
  17. Thierry Coquand and Gérard P. Huet. 1988. The Calculus of Constructions. Inf. Comput. 76, 2/3 (1988), 95–120. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. Vincent Cremet, François Garillot, Sergueï Lenglet, and Martin Odersky. 2006. A Core Calculus for Scala Type Checking. In Proceedings of the 31st International Conference on Mathematical Foundations of Computer Science (MFCS’06). SpringerVerlag, Berlin, Heidelberg, 1–23. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. N.G. de Bruijn. 1991. Telescopic Mappings in Typed Lambda-Calculus. Information and Computation 91, 2 (1991), 189–204.Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. David Delahaye. 2000. A Tactic Language for the System Coq. In Proceedings of the 7th International Conference on Logic for Programming and Automated Reasoning (LPAR’00). Springer-Verlag, Berlin, Heidelberg, 85–95. http://dl.acm.org/citation. cfm?id=1765236.1765246Google ScholarGoogle ScholarCross RefCross Ref
  21. Dominique Devriese and Frank Piessens. 2013. Typed Syntactic Meta-programming. In of the 18th ACM SIGPLAN International Conference on Functional Programming (ICFP 2013). 73–86.Google ScholarGoogle Scholar
  22. Peter Dybjer. 1994. Inductive families. Formal Aspects of Computing 6, 4 (01 Jul 1994), 440–465.Google ScholarGoogle Scholar
  23. R. Kent Dybvig, Robert Hieb, and Carl Bruggeman. 1992. Syntactic Abstraction in Scheme. Lisp Symb. Comput. 5, 4 (Dec. 1992), 295–326. Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. Gabriel Ebner, Sebastian Ullrich, Jared Roesch, Jeremy Avigad, and Leonardo de Moura. 2017. A metaprogramming framework for formal verification. Proceedings of the ACM on Programming Languages (PACMPL) 1, ICFP (2017), 34:1–34:29. Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. Matthias Felleisen, Robert Bruce Findler, Matthew Flatt, Shriram Krishnamurthi, Eli Barzilay, Jay McCarthy, and Sam Tobin-Hochstadt. 2015. The Racket Manifesto. In 1st Summit on Advances in Programming Languages (SNAPL 2015). 113–128.Google ScholarGoogle Scholar
  26. Matthias Felleisen, Robert Bruce Findler, Matthew Flatt, Shriram Krishnamurthi, Eli Barzilay, Jay McCarthy, and Sam Tobin-Hochstadt. 2018. A Programmable Programming Language. Commun. ACM 61, 3 (Feb. 2018), 62–71. Google ScholarGoogle ScholarDigital LibraryDigital Library
  27. Matthew Flatt. 2002. Composable and Compilable Macros: You Want It when?. In Proceedings of the Seventh ACM SIGPLAN International Conference on Functional Programming (ICFP ’02). ACM, New York, NY, USA, 72–83. Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. Matthew Flatt. 2016. Binding As Sets of Scopes. In Proceedings of the 43rd Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages. 705–717.Google ScholarGoogle ScholarDigital LibraryDigital Library
  29. Matthew Flatt, Ryan Culpepper, David Darais, and Robert Bruce Findler. 2012. Macros That Work Together: Compiletime Bindings, Partial Expansion, and Definition Contexts. 22, 2 (March 2012), 181–216. Google ScholarGoogle ScholarDigital LibraryDigital Library
  30. Eduardo Giménez. 1995. Codifying Guarded Definitions with Recursive Schemes. In International Workshop on Types for Proofs and Programs (TYPES). Google ScholarGoogle ScholarCross RefCross Ref
  31. Healfdene Goguen, Conor McBride, and James McKinna. 2006. Eliminating Dependent Pattern Matching. In Algebra, Meaning, and Computation: Essays dedicated to Joseph A. Goguen on the Occasion of His 65th Birthday, Kokichi Futatsugi, Jean-Pierre Jouannaud, and José Meseguer (Eds.). Springer Berlin Heidelberg, Berlin, Heidelberg, 521–540. Google ScholarGoogle ScholarCross RefCross Ref
  32. Georges Gonthier and Assia Mahboubi. 2010. An introduction to small scale reflection in Coq. Journal of Formalized Reasoning 3, 2 (2010), 95–152. https://hal.inria.fr/inria-00515548Google ScholarGoogle Scholar
  33. Georges Gonthier, Beta Ziliani, Aleksandar Nanevski, and Derek Dreyer. 2011. How to Make Ad Hoc Proof Automation Less Ad Hoc. In Proceedings of the 16th ACM SIGPLAN International Conference on Functional Programming (ICFP ’11). ACM, New York, NY, USA, 163–175. Google ScholarGoogle ScholarDigital LibraryDigital Library
  34. John Hughes, Lars Pareto, and Amr Sabry. 1996. Proving the Correctness of Reactive Systems Using Sized Types. In Proceedings of the 23rd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL ’96). ACM, New York, NY, USA, 410–423. Google ScholarGoogle ScholarDigital LibraryDigital Library
  35. Joomy Korkut and David Christiansen. 2018. Extensible Type-Directed Editing. In Proceedings of the Workshop on Type-Driven Development.Google ScholarGoogle ScholarDigital LibraryDigital Library
  36. Robbert Krebbers, Amin Timany, and Lars Birkedal. 2017. Interactive Proofs in Higher-order Concurrent Separation Logic. In Proceedings of the 44th ACM SIGPLAN Symposium on Principles of Programming Languages (POPL 2017). ACM, New York, NY, USA, 205–217. Google ScholarGoogle ScholarDigital LibraryDigital Library
  37. Andres Löh, Conor McBride, and Wouter Swierstra. 2010. A Tutorial Implementation of a Dependently Typed Lambda Calculus. Fundam. Inform. 102, 2 (2010), 177–207.Google ScholarGoogle ScholarDigital LibraryDigital Library
  38. Gregory Malecha and Jesper Bengtson. 2016. Programming Languages and Systems: 25th European Symposium on Programming, ESOP 2016, Held as Part of the European Joint Conferences on Theory and Practice of Software, ETAPS 2016, Eindhoven, The Netherlands, April 2-8, 2016, Proceedings. Springer Berlin Heidelberg, Berlin, Heidelberg, Chapter Extensible and Efficient Automation Through Reflective Tactics, 532–559. Google ScholarGoogle ScholarCross RefCross Ref
  39. Alberto Martelli and Ugo Montanari. 1982. An Efficient Unification Algorithm. ACM Trans. Program. Lang. Syst. 4, 2 (April 1982), 258–282. Google ScholarGoogle ScholarDigital LibraryDigital Library
  40. Per Martin-Löf. 1975. An intuitionistic theory of types: Predicative part. Studies in Logic and the Foundations of Mathematics 80 (1975), 73–118.Google ScholarGoogle ScholarCross RefCross Ref
  41. Conor McBride. 2000. Dependently Typed Functional Programs and Their Proofs. Ph.D. Dissertation. University of Edinburgh, UK. http://hdl.handle.net/1842/374Google ScholarGoogle Scholar
  42. Bengt Nordström, Kent Petersson, and Jan M. Smith. 1990. Programming in Martin-Löf’s Type Theory: An Introduction. Clarendon Press, New York, NY, USA.Google ScholarGoogle ScholarDigital LibraryDigital Library
  43. Ulf Norell. 2007. Towards a Practical Programming Language Based on Dependent Type Theory. Ph.D. Dissertation. Chalmers University of Technology. http://www.cse.chalmers.se/~ulfn/papers/thesis.pdfGoogle ScholarGoogle Scholar
  44. Brigitte Pientka. 2008. A Type-theoretic Foundation for Programming with Higher-order Abstract Syntax and Firstclass Substitutions. In Proceedings of the 35th Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL ’08). 371–382.Google ScholarGoogle ScholarDigital LibraryDigital Library
  45. Benjamin C. Pierce, Arthur Azevedo de Amorim, Chris Casinghino, Marco Gaboardi, Michael Greenberg, Cˇ atˇ alin Hriţcu, Vilhelm Sjöberg, and Brent Yorgey. 2018. Logical Foundations. Electronic textbook.Google ScholarGoogle Scholar
  46. Benjamin C. Pierce and David N. Turner. 1998. Local Type Inference. In Proceedings of the 25th ACM SIGPLAN–SIGACT Symposium on Principles of Programming Languages. 252–265.Google ScholarGoogle Scholar
  47. Justin Pombrio and Shriram Krishnamurthi. 2015. Hygienic Resugaring of Compositional Desugaring. In Proceedings of the 20th ACM SIGPLAN International Conference on Functional Programming (ICFP 2015). ACM, New York, NY, USA, 75–87. Google ScholarGoogle ScholarDigital LibraryDigital Library
  48. Peter Sewell, Francesco Zappa Nardelli, Scott Owens, Gilles Peskine, Thomas Ridge, Susmit Sarkar, and Rok Strniša. 2007. Ott: Effective Tool Support for the Working Semanticist. In of the 12th ACM SIGPLAN International Conference on Functional Programming (ICFP 2007). ACM, New York, NY, USA, 1–12. Google ScholarGoogle ScholarDigital LibraryDigital Library
  49. Antonis Stampoulis and Zhong Shao. 2010. VeriML: Typed Computation of Logical Terms Inside a Language with Effects. In of the 15th ACM SIGPLAN International Conference on Functional Programming (ICFP 2010). 333–344.Google ScholarGoogle ScholarDigital LibraryDigital Library
  50. Emina Torlak and Rastislav Bodik. 2014. A Lightweight Symbolic Virtual Machine for Solver-aided Host Languages. In Proceedings of the 35th ACM SIGPLAN Conference on Programming Language Design and Implementation. 530–541.Google ScholarGoogle ScholarDigital LibraryDigital Library
  51. Stephanie Weirich. 2014. Pi Forall: notes from OPLSS. https://github.com/sweirich/pi-forallGoogle ScholarGoogle Scholar
  52. Stephanie Weirich, Antoine Voizard, Pedro Henrique Avezedo de Amorim, and Richard A. Eisenberg. 2017. A Specification for Dependent Types in Haskell. Proceedings of the ACM on Programming Languages (PACMPL) 1, ICFP (Aug. 2017). Google ScholarGoogle ScholarDigital LibraryDigital Library
  53. Hongwei Xi. 2007. Dependent ML An approach to practical programming with dependent types. Journal of Functional Programming 17, 2 (2007), 215–286. Google ScholarGoogle ScholarDigital LibraryDigital Library
  54. Brent A. Yorgey, Stephanie Weirich, Julien Cretin, Simon L. Peyton Jones, Dimitrios Vytiniotis, and José Pedro Magalhães. 2012. Giving Haskell a promotion. In Types in Language Design and Implementation (TLDI). Google ScholarGoogle ScholarDigital LibraryDigital Library
  55. Beta Ziliani, Derek Dreyer, Neelakantan R Krishnaswami, Aleksandar Nanevski, and Viktor Vafeiadis. 2013. Mtac: A Monad for Typed Tactic Programming in Coq. In Proceedings of the 18th ACM SIGPLAN International Conference on Functional Programming (ICFP 2013). ACM, New York, NY, USA, 87–100. Google ScholarGoogle ScholarDigital LibraryDigital Library
  56. Jean Karim Zinzindohoué, Karthikeyan Bhargavan, Jonathan Protzenko, and Benjamin Beurdouche. 2017. HACL*: A Verified Modern Cryptographic Library. In Conference on Computer and Communications Security, (CCS). Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Dependent type systems as macros

    Recommendations

    Comments

    Login options

    Check if you have access through your login credentials or your institution to get full access on this article.

    Sign in

    Full Access

    PDF Format

    View or Download as a PDF file.

    PDF

    eReader

    View online with eReader.

    eReader
    About Cookies On This Site

    We use cookies to ensure that we give you the best experience on our website.

    Learn more

    Got it!