skip to main content
research-article
Open Access

Explicit Refinement Types

Published:31 August 2023Publication History
Skip Abstract Section

Abstract

We present λert, a type theory supporting refinement types with <em>explicit proofs</em>. Instead of solving refinement constraints with an SMT solver like DML and Liquid Haskell, our system requires and permits programmers to embed proofs of properties within the program text, letting us support a rich logic of properties including quantifiers and induction. We show that the type system is sound by showing that every refined program erases to a simply-typed program, and by means of a denotational semantics, we show that every erased program has all of the properties demanded by its refined type. All of our proofs are formalised in Lean 4.

References

  1. Danel Ahman. 2018. Handling fibred algebraic effects. Proc. ACM Program. Lang., 2, POPL (2018), 7:1–7:29. https://doi.org/10.1145/3158095 Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. Robert Atkey. 2018. The Syntax and Semantics of Quantitative Type Theory. In LICS ’18: 33rd Annual ACM/IEEE Symposium on Logic in Computer Science, July 9–12, 2018, Oxford, United Kingdom. https://doi.org/10.1145/3209108.3209189 Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. Steven Awodey and Andrej Bauer. 2004. Propositions as [types]. Journal of logic and computation, 14, 4 (2004), 447–471. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. Bruno Barras and Bruno Bernardo. 2008. The implicit calculus of constructions as a programming language with dependent types. In Foundations of Software Science and Computational Structures: 11th International Conference, FOSSACS 2008, Held as Part of the Joint European Conferences on Theory and Practice of Software, ETAPS 2008, Budapest, Hungary, March 29-April 6, 2008. Proceedings 11. 365–379. Google ScholarGoogle ScholarCross RefCross Ref
  5. Sa Cui, Kevin Donnelly, and Hongwei Xi. 2005. Ats: A language that combines programming with theorem proving. In Frontiers of Combining Systems: 5th International Workshop, FroCoS 2005, Vienna, Austria, September 19-21, 2005. Proceedings 5. 310–320. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. Nicola Gambino and Peter Aczel. 2006. The generalised type-theoretic interpretation of constructive set theory. The Journal of Symbolic Logic, 71, 1 (2006), 67–103. https://doi.org/10.2178/jsl/1140641163 Google ScholarGoogle ScholarCross RefCross Ref
  7. Robert Harper. 1992. Constructing type systems over an operational semantics. Journal of Symbolic Computation, 14, 1 (1992), 71–84. issn:0747-7171 https://doi.org/10.1016/0747-7171(92)90026-Z Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. Ranjit Jhala and Niki Vazou. 2020. Refinement Types: A Tutorial. arXiv e-prints, Article arXiv:2010.07763, Oct., arXiv:2010.07763 pages. arxiv:2010.07763. Google ScholarGoogle Scholar
  9. Shin-ya Katsumata. 2014. Parametric Effect Monads and Semantics of Effect Systems. In Proceedings of the 41st ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL ’14). Association for Computing Machinery, New York, NY, USA. 633–645. isbn:9781450325448 https://doi.org/10.1145/2535838.2535846 Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. Alexei Kopylov. 2003. Dependent Intersection: A New Way of Defining Records in Type Theory. In 18th IEEE Symposium on Logic in Computer Science (LICS 2003), 22-25 June 2003, Ottawa, Canada, Proceedings. IEEE Computer Society, 86–95. https://doi.org/10.1109/LICS.2003.1210048 Google ScholarGoogle ScholarCross RefCross Ref
  11. Laura Kovács and Andrei Voronkov. 2013. First-Order Theorem Proving and Vampire. In Computer Aided Verification, Natasha Sharygina and Helmut Veith (Eds.). Springer Berlin Heidelberg, Berlin, Heidelberg. 1–35. isbn:978-3-642-39799-8 Google ScholarGoogle Scholar
  12. Nicolai Kraus, Martín Escardó, Thierry Coquand, and Thorsten Altenkirch. 2017. Notions of anonymous existence in Martin-Löf type theory. Logical Methods in Computer Science, 13, 1 (2017). Google ScholarGoogle Scholar
  13. Satoshi Kura. 2021. A General Semantic Construction of Dependent Refinement Type Systems, Categorically. In Foundations of Software Science and Computation Structures - 24th International Conference, FOSSACS 2021, Held as Part of the European Joint Conferences on Theory and Practice of Software, ETAPS 2021, Luxembourg City, Luxembourg, March 27 - April 1, 2021, Proceedings, Stefan Kiefer and Christine Tasson (Eds.) (Lecture Notes in Computer Science, Vol. 12650). Springer, 406–426. https://doi.org/10.1007/978-3-030-71995-1_21 Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. Zhaohui Luo. 1990. An extended calculus of constructions. Ph. D. Dissertation. University of Edinburgh. Google ScholarGoogle Scholar
  15. Paul-André Melliès and Noam Zeilberger. 2015. Functors Are Type Refinement Systems. In Proceedings of the 42nd Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL ’15). Association for Computing Machinery, New York, NY, USA. 3–16. isbn:9781450333009 https://doi.org/10.1145/2676726.2676970 Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. Robin Milner. 1978. A theory of type polymorphism in programming. Journal of computer and system sciences, 17, 3 (1978), 348–375. Google ScholarGoogle ScholarCross RefCross Ref
  17. Alexandre Miquel. 2000. A model for impredicative type systems, universes, intersection types and subtyping. In Proceedings Fifteenth Annual IEEE Symposium on Logic in Computer Science (Cat. No. 99CB36332). 18–29. Google ScholarGoogle ScholarCross RefCross Ref
  18. Eugenio Moggi. 1991. Notions of computation and monads. Information and Computation, 93, 1 (1991), 55–92. issn:0890-5401 https://doi.org/10.1016/0890-5401(91)90052-4 Selections from 1989 IEEE Symposium on Logic in Computer Science Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. John C. Reynolds. 2003. What do types mean? — From intrinsic to extrinsic semantics. Springer New York, New York, NY. 309–327. isbn:978-0-387-21798-7 https://doi.org/10.1007/978-0-387-21798-7_15 Google ScholarGoogle ScholarCross RefCross Ref
  20. Patrick M. Rondon, Ming Kawaguci, and Ranjit Jhala. 2008. Liquid Types. SIGPLAN Not., 43, 6 (2008), jun, 159–169. issn:0362-1340 https://doi.org/10.1145/1379022.1375602 Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. Vilhelm Sjöberg and Stephanie Weirich. 2015. Programming up to Congruence. SIGPLAN Not., 50, 1 (2015), Jan., 369–382. issn:0362-1340 https://doi.org/10.1145/2775051.2676974 Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. Jonathan Sterling and Robert Harper. 2021. Logical relations as types: Proof-relevant parametricity for program modules. Journal of the ACM (JACM), 68, 6 (2021), 1–47. Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. Matúš Tejiščák. 2019. Erasure in Dependently Typed Programming. Ph. D. Dissertation. University of St. Andrews. Google ScholarGoogle Scholar
  24. The Coq Development Team. 2021. The Coq Proof Assistant. https://doi.org/10.5281/zenodo.4501022 Google ScholarGoogle ScholarCross RefCross Ref
  25. Benno van den Berg and Martijn den Besten. 2021. Quadratic type checking for objective type theory. arXiv e-prints, Article arXiv:2102.00905, Feb., arXiv:2102.00905 pages. arxiv:2102.00905. Google ScholarGoogle Scholar
  26. Niki Vazou and Michael Greenberg. 2022. How to safely use extensionality in Liquid Haskell. In Haskell ’22: 15th ACM SIGPLAN International Haskell Symposium, Ljubljana, Slovenia, September 15 - 16, 2022, Nadia Polikarpova (Ed.). ACM, 13–26. https://doi.org/10.1145/3546189.3549919 Google ScholarGoogle ScholarDigital LibraryDigital Library
  27. Niki Vazou, Eric L. Seidel, Ranjit Jhala, Dimitrios Vytiniotis, and Simon Peyton-Jones. 2014. Refinement Types for Haskell. SIGPLAN Not., 49, 9 (2014), aug, 269–282. issn:0362-1340 https://doi.org/10.1145/2692915.2628161 Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. Christoph Weidenbach, Uwe Brahm, Thomas Hillenbrand, Enno Keen, Christian Theobald, and Dalibor Topić. 2002. Spass Version 2.0. In Automated Deduction—CADE-18, Andrei Voronkov (Ed.). Springer Berlin Heidelberg, Berlin, Heidelberg. 275–279. isbn:978-3-540-45620-9 Google ScholarGoogle Scholar
  29. Dominik Winterer, Chengyu Zhang, and Zhendong Su. 2020. On the Unusual Effectiveness of Type-Aware Operator Mutations for Testing SMT Solvers. 4, OOPSLA (2020), Article 193, nov, 25 pages. https://doi.org/10.1145/3428261 Google ScholarGoogle ScholarDigital LibraryDigital Library
  30. Hongwei Xi and Frank Pfenning. 1998. Eliminating Array Bound Checking through Dependent Types. In Proceedings of the ACM SIGPLAN 1998 Conference on Programming Language Design and Implementation (PLDI ’98). Association for Computing Machinery, New York, NY, USA. 249–257. isbn:0897919874 https://doi.org/10.1145/277650.277732 Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Explicit Refinement Types

              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

              • Published in

                cover image Proceedings of the ACM on Programming Languages
                Proceedings of the ACM on Programming Languages  Volume 7, Issue ICFP
                August 2023
                981 pages
                EISSN:2475-1421
                DOI:10.1145/3554311
                Issue’s Table of Contents

                Copyright © 2023 Owner/Author

                This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.

                Publisher

                Association for Computing Machinery

                New York, NY, United States

                Publication History

                • Published: 31 August 2023
                Published in pacmpl Volume 7, Issue ICFP

                Permissions

                Request permissions about this article.

                Request Permissions

                Check for updates

                Qualifiers

                • research-article

              PDF Format

              View or Download as a PDF file.

              PDF

              eReader

              View online with eReader.

              eReader