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

Normalization by evaluation for sized dependent types

Published:29 August 2017Publication History
Skip Abstract Section

Abstract

Sized types have been developed to make termination checking more perspicuous, more powerful, and more modular by integrating termination into type checking. In dependently-typed proof assistants where proofs by induction are just recursive functional programs, the termination checker is an integral component of the trusted core, as validity of proofs depend on termination. However, a rigorous integration of full-fledged sized types into dependent type theory is lacking so far. Such an integration is non-trivial, as explicit sizes in proof terms might get in the way of equality checking, making terms appear distinct that should have the same semantics.

In this article, we integrate dependent types and sized types with higher-rank size polymorphism, which is essential for generic programming and abstraction. We introduce a size quantifier ∀ which lets us ignore sizes in terms for equality checking, alongside with a second quantifier Π for abstracting over sizes that do affect the semantics of types and terms. Judgmental equality is decided by an adaptation of normalization-by-evaluation for our new type theory, which features type shape-directed reflection and reification. It follows that subtyping and type checking of normal forms are decidable as well, the latter by a bidirectional algorithm.

Skip Supplemental Material Section

Supplemental Material

References

  1. Andreas Abel. 2008. Semi-continuous Sized Types and Termination. Logical Methods in Computer Science 4, 2:3 (2008), 1–33. Google ScholarGoogle ScholarCross RefCross Ref
  2. Andreas Abel. 2010. Towards Normalization by Evaluation for the β η-Calculus of Constructions. In Functional and Logic Programming, 10th International Symposium, FLOPS 2010, Sendai, Japan, April 19-21, 2010. Proceedings (Lecture Notes in Computer Science), Matthias Blume, Naoki Kobayashi, and Germán Vidal (Eds.), Vol. 6009. Springer, 224–239. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. Andreas Abel. 2012. Type-Based Termination, Inflationary Fixed-Points, and Mixed Inductive-Coinductive Types. In Proceedings of the 8th Workshop on Fixed Points in Computer Science (FICS 2012) (Electronic Proceedings in Theoretical Computer Science), Dale Miller and Zoltán Ésik (Eds.), Vol. 77. 1–11. Google ScholarGoogle ScholarCross RefCross Ref
  4. Andreas Abel. 2013. Normalization by Evaluation: Dependent Types and Impredicativity. Unpublished. http://www.tcs.ifi. lmu.de/~abel/habil.pdfGoogle ScholarGoogle Scholar
  5. Andreas Abel and Thorsten Altenkirch. 2002. A Predicative Analysis of Structural Recursion. Journal of Functional Programming 12, 1 (2002), 1–41. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. Andreas Abel, Thierry Coquand, and Peter Dybjer. 2007. Normalization by Evaluation for Martin-Löf Type Theory with Typed Equality Judgements. In 22nd IEEE Symposium on Logic in Computer Science (LICS 2007), 10-12 July 2007, Wroclaw, Poland, Proceedings. IEEE Computer Society Press, 3–12. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. Andreas Abel, Thierry Coquand, and Miguel Pagano. 2009. A Modular Type-Checking Algorithm for Type Theory with Singleton Types and Proof Irrelevance. In Typed Lambda Calculi and Applications, 9th International Conference, TLCA 2009, Brasilia, Brazil, July 1-3, 2009, Proceedings (Lecture Notes in Computer Science), Pierre-Louis Curien (Ed.), Vol. 5608. Springer, 5–19. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. Andreas Abel, Thierry Coquand, and Miguel Pagano. 2011. A Modular Type-Checking Algorithm for Type Theory with Singleton Types and Proof Irrelevance. Logical Methods in Computer Science 7, 2:4 (2011), 1–57. Google ScholarGoogle ScholarCross RefCross Ref
  9. Andreas Abel and Brigitte Pientka. 2016. Well-founded recursion with copatterns and sized types. Journal of Functional Programming 26 (2016), 61. Google ScholarGoogle ScholarCross RefCross Ref
  10. Andreas Abel and Gabriel Scherer. 2012. On Irrelevance and Algorithmic Equality in Predicative Type Theory. Logical Methods in Computer Science 8, 1:29 (2012), 1–36. Google ScholarGoogle ScholarCross RefCross Ref
  11. AgdaTeam. 2017. The Agda Wiki. (2017). http://wiki.portal.chalmers.se/agdaGoogle ScholarGoogle Scholar
  12. Roberto M. Amadio (Ed.). 2008. 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. Lecture Notes in Computer Science, Vol. 4962. Springer. Google ScholarGoogle ScholarCross RefCross Ref
  13. Roberto M. Amadio and Solange Coupet-Grimal. 1998. Analysis of a Guard Condition in Type Theory (Extended Abstract).. In Foundations of Software Science and Computation Structure, First International Conference, FoSSaCS’98, Held as Part of the European Joint Conferences on the Theory and Practice of Software, ETAPS’98, Lisbon, Portugal, March 28 - April 4, 1998, Proceedings (Lecture Notes in Computer Science), Maurice Nivat (Ed.), Vol. 1378. Springer, 48–62. Google ScholarGoogle ScholarCross RefCross Ref
  14. Henk Barendregt. 1991. Introduction to Generalized Type Systems. Journal of Functional Programming 1, 2 (1991), 125–154.Google ScholarGoogle ScholarCross RefCross Ref
  15. Bruno Barras and Bruno Bernardo. 2008. The Implicit Calculus of Constructions as a Programming Language with Dependent Types, See [ Amadio 2008 ], 365–379. Google ScholarGoogle ScholarCross RefCross Ref
  16. Gilles Barthe, Maria João Frade, Eduardo Giménez, Luís Pinto, and Tarmo Uustalu. 2004. Type-Based Termination of Recursive Definitions. Mathematical Structures in Computer Science 14, 1 (2004), 97–141. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. Gilles Barthe, Benjamin Grégoire, and Fernando Pastawski. 2006. CICˆ: Type-Based Termination of Recursive Definitions in the Calculus of Inductive Constructions. In Logic for Programming, Artificial Intelligence, and Reasoning, 13th International Conference, LPAR 2006, Phnom Penh, Cambodia, November 13-17, 2006, Proceedings (Lecture Notes in Computer Science), Miki Hermann and Andrei Voronkov (Eds.), Vol. 4246. Springer, 257–271. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. Gilles Barthe, Benjamin Grégoire, and Colin Riba. 2008a. A Tutorial on Type-Based Termination. In LerNet ALFA Summer School (Lecture Notes in Computer Science), Ana Bove, Luís Soares Barbosa, Alberto Pardo, and Jorge Sousa Pinto (Eds.), Vol. 5520. Springer, 100–152. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. Gilles Barthe, Benjamin Grégoire, and Colin Riba. 2008b. Type-Based Termination with Sized Products. In Computer Science Logic, 22nd International Workshop, CSL 2008, 17th Annual Conference of the EACSL, Bertinoro, Italy, September 16-19, 2008. Proceedings (Lecture Notes in Computer Science), Michael Kaminski and Simone Martini (Eds.), Vol. 5213. Springer, 493–507. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. Ulrich Berger and Helmut Schwichtenberg. 1991. An Inverse to the Evaluation Functional for Typed λ-calculus. In Sixth Annual Symposium on Logic in Computer Science (LICS ’91), July, 1991, Amsterdam, The Netherlands, Proceedings. IEEE Computer Society Press, 203–211. Google ScholarGoogle ScholarCross RefCross Ref
  21. Frédéric Blanqui. 2004. A Type-Based Termination Criterion for Dependently-Typed Higher-Order Rewrite Systems. In Rewriting Techniques and Applications, 15th International Conference, RTA 2004, Aachen, Germany, June 3 – 5, 2004, Proceedings (Lecture Notes in Computer Science), Vincent van Oostrom (Ed.), Vol. 3091. Springer, 24–39. Google ScholarGoogle ScholarCross RefCross Ref
  22. Frédéric Blanqui. 2005. Decidability of Type-Checking in the Calculus of Algebraic Constructions with Size Annotations.. In Computer Science Logic, 19th International Workshop, CSL 2005, 14th Annual Conference of the EACSL, Oxford, UK, August 22-25, 2005, Proceedings (Lecture Notes in Computer Science), C.-H. Luke Ong (Ed.), Vol. 3634. Springer, 135–150. Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. Frédéric Blanqui and Colin Riba. 2006. Combining Typing and Size Constraints for Checking the Termination of HigherOrder Conditional Rewrite Systems. In Logic for Programming, Artificial Intelligence, and Reasoning, 13th International Conference, LPAR 2006, Phnom Penh, Cambodia, November 13-17, 2006, Proceedings (Lecture Notes in Computer Science), Miki Hermann and Andrei Voronkov (Eds.), Vol. 4246. Springer, 105–119. Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. Ana Bove. 2009. Another Look at Function Domains. Electronic Notes in Theoretical Computer Science 249 (2009), 61–74. Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. Ana Bove and Venanzio Capretta. 2005. Modelling general recursion in type theory. Mathematical Structures in Computer Science 15, 4 (2005), 671–708. Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. Edwin Brady. 2013. Idris, a general-purpose dependently typed programming language: Design and implementation. Journal of Functional Programming 23, 5 (2013), 552–593. Google ScholarGoogle ScholarCross RefCross Ref
  27. Thierry Coquand. 1996. An Algorithm for Type-Checking Dependent Types, In Mathematics of Program Construction. Selected Papers from the Third International Conference on the Mathematics of Program Construction ( July 17–21, 1995, Kloster Irsee, Germany). Science of Computer Programming 26, 1-3, 167–177. Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. Olivier Danvy. 1999. Type-Directed Partial Evaluation. In Partial Evaluation – Practice and Theory, DIKU 1998 International Summer School, Copenhagen, Denmark, June 29 - July 10, 1998 (Lecture Notes in Computer Science), John Hatcliff, Torben Æ. Mogensen, and Peter Thiemann (Eds.), Vol. 1706. Springer, 367–411. Google ScholarGoogle ScholarCross RefCross Ref
  29. N. G. de Bruijn. 1972. Lambda calculus notation with nameless dummies, a tool for automatic formula manipulation, with application to the Church-Rosser theorem. Indagationes Mathematicae 34 (1972), 381–392. Google ScholarGoogle Scholar
  30. Peter Dybjer. 2000. A General Formulation of Simultaneous Inductive-Recursive Definitions in Type Theory. The Journal of Symbolic Logic 65, 2 (2000), 525–549. Google ScholarGoogle ScholarCross RefCross Ref
  31. Peter Dybjer, Bengt Nordström, and Jan M. Smith (Eds.). 1995. Types for Proofs and Programs, International Workshop TYPES’94, Båstad, Sweden, June 6-10, 1994, Selected Papers. Lecture Notes in Computer Science, Vol. 996. Springer. Google ScholarGoogle ScholarCross RefCross Ref
  32. Daniel Fridlender and Miguel Pagano. 2013. A Type-Checking Algorithm for Martin-Löf Type Theory with Subtyping Based on Normalisation by Evaluation. In Typed Lambda Calculi and Applications, 11th International Conference, TLCA 2013, Eindhoven, The Netherlands, June 26-28, 2013. Proceedings (Lecture Notes in Computer Science), Masahito Hasegawa (Ed.), Vol. 7941. Springer, 140–155. Google ScholarGoogle ScholarCross RefCross Ref
  33. Herman Geuvers. 1994. A short and flexible proof of Strong Normalization for the Calculus of Constructions, See [ Dybjer et al. 1995 ], 14–38. Google ScholarGoogle ScholarCross RefCross Ref
  34. Eduardo Giménez. 1995. Codifying Guarded Definitions with Recursive Schemes, See [ Dybjer et al. 1995 ], 39–59. Google ScholarGoogle ScholarCross RefCross Ref
  35. Benjamin Grégoire and Xavier Leroy. 2002. A compiled implementation of strong reduction. In Proceedings of the Seventh ACM SIGPLAN International Conference on Functional Programming (ICFP ’02), Pittsburgh, Pennsylvania, USA, October 4-6, 2002 (SIGPLAN Notices), Vol. 37. ACM Press, 235–246. Google ScholarGoogle ScholarDigital LibraryDigital Library
  36. Benjamin Grégoire and Jorge Luis Sacchini. 2010. On Strong Normalization of the Calculus of Constructions with Type-Based Termination. In Logic for Programming, Artificial Intelligence, and Reasoning - 17th International Conference, LPAR-17, Yogyakarta, Indonesia, October 10-15, 2010. Proceedings (Lecture Notes in Computer Science), Christian G. Fermüller and Andrei Voronkov (Eds.), Vol. 6397. Springer, 333–347. Google ScholarGoogle ScholarCross RefCross Ref
  37. Robert Harper and Frank Pfenning. 2005. On Equivalence and Canonical Forms in the LF Type Theory. ACM Transactions on Computational Logic 6, 1 (2005), 61–101. Google ScholarGoogle ScholarDigital LibraryDigital Library
  38. Gérard P. Huet. 1989. The Constructive Engine. In A Perspective in Theoretical Computer Science - Commemorative Volume for Gift Siromoney, R. Narasimhan (Ed.). World Scientific Series in Computer Science, Vol. 16. World Scientific, 38–69. Google ScholarGoogle ScholarCross RefCross Ref
  39. John Hughes, Lars Pareto, and Amr Sabry. 1996. Proving the Correctness of Reactive Systems Using Sized Types. In Conference Record of POPL’96: The 23rd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, Papers Presented at the Symposium, St. Petersburg Beach, Florida, USA, January 21-24, 1996, Hans-Juergen Boehm and Guy L. Steele Jr. (Eds.). ACM Press, 410–423. Google ScholarGoogle ScholarDigital LibraryDigital Library
  40. INRIA. 2016. The Coq Proof Assistant Reference Manual (version 8.6 ed.). INRIA. http://coq.inria.fr/Google ScholarGoogle Scholar
  41. Ugo Dal Lago and Charles Grellois. 2017. Probabilistic Termination by Monadic Affine Sized Typing. In Programming Languages and Systems - 26th European Symposium on Programming, ESOP 2017, Held as Part of the European Joint Conferences on Theory and Practice of Software, ETAPS 2017, Uppsala, Sweden, April 22-29, 2017, Proceedings (Lecture Notes in Computer Science), Hongseok Yang (Ed.), Vol. 10201. Springer, 393–419. Google ScholarGoogle ScholarCross RefCross Ref
  42. Chin Soon Lee, Neil D. Jones, and Amir M. Ben-Amram. 2001. The Size-Change Principle for Program Termination. In Conference Record of POPL 2001: The 28th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, London, UK, January 17-19, 2001, Chris Hankin and Dave Schmidt (Eds.). ACM Press, 81–92. Google ScholarGoogle ScholarDigital LibraryDigital Library
  43. William Lovas and Frank Pfenning. 2010. Refinement Types for Logical Frameworks and Their Interpretation as Proof Irrelevance. Logical Methods in Computer Science 6, 4 (2010). Google ScholarGoogle ScholarCross RefCross Ref
  44. Per Martin-Löf. 1975. An Intuitionistic Theory of Types: Predicative Part. In Logic Colloquium ‘73, H. E. Rose and J. C. Shepherdson (Eds.). North-Holland, 73–118.Google ScholarGoogle Scholar
  45. Alexandre Miquel. 2000. A Model for Impredicative Type Systems, Universes, Intersection Types and Subtyping. In 15th Annual IEEE Symposium on Logic in Computer Science (LICS 2000), 26-29 June 2000, Santa Barbara, California, USA, Proceedings. IEEE Computer Society Press, 18–29. Google ScholarGoogle ScholarCross RefCross Ref
  46. Alexandre Miquel. 2001. The Implicit Calculus of Constructions. In Typed Lambda Calculi and Applications, 5th International Conference, TLCA 2001, Krakow, Poland, May 2-5, 2001, Proceedings (Lecture Notes in Computer Science), Samson Abramsky (Ed.), Vol. 2044. Springer, 344–359. Google ScholarGoogle ScholarCross RefCross Ref
  47. Nathan Mishra-Linger and Tim Sheard. 2008. Erasure and Polymorphism in Pure Type Systems, See [ Amadio 2008 ], 350–364. Google ScholarGoogle ScholarCross RefCross Ref
  48. Bengt Nordström. 1988. Terminating General Recursion. BIT 28, 3 (1988), 605–619. Google ScholarGoogle ScholarDigital LibraryDigital Library
  49. Ulf Norell. 2007. Towards a Practical Programming Language Based on Dependent Type Theory. Ph.D. Dissertation. Department of Computer Science and Engineering, Chalmers University of Technology, Göteborg, Sweden.Google ScholarGoogle Scholar
  50. Frank Pfenning. 2001. Intensionality, Extensionality, and Proof Irrelevance in Modal Type Theory. In 16th IEEE Symposium on Logic in Computer Science (LICS 2001), 16-19 June 2001, Boston University, USA, Proceedings. IEEE Computer Society Press, 221–230. Google ScholarGoogle ScholarCross RefCross Ref
  51. Jorge Luis Sacchini. 2013. Type-Based Productivity of Stream Definitions in the Calculus of Constructions. In 28th Annual ACM/IEEE Symposium on Logic in Computer Science, LICS 2013, New Orleans, LA, USA, June 25-28, 2013. IEEE Computer Society Press, 233–242. Google ScholarGoogle ScholarDigital LibraryDigital Library
  52. Jorge Luis Sacchini. 2014. Linear Sized Types in the Calculus of Constructions. In Functional and Logic Programming - 12th International Symposium, FLOPS 2014, Kanazawa, Japan, June 4-6, 2014. Proceedings (Lecture Notes in Computer Science), Michael Codish and Eijiro Sumii (Eds.), Vol. 8475. Springer, 169–185. Google ScholarGoogle ScholarCross RefCross Ref
  53. Aaron Stump, Vilhelm Sjöberg, and Stephanie Weirich. 2010. Termination Casts: A Flexible Approach to Termination with General Recursion. In Workshop on Partiality And Recursion in Interactive Theorem Provers, PAR 2010, Satellite Workshop of ITP’10 at FLoC 2010 (Electronic Proceedings in Theoretical Computer Science), Ana Bove, Ekaterina Komendantskaya, and Milad Niqui (Eds.), Vol. 43. 76–93. Google ScholarGoogle ScholarCross RefCross Ref
  54. Martin Sulzmann, Manuel M. T. Chakravarty, Simon L. Peyton Jones, and Kevin Donnelly. 2007. System F with type equality coercions. In Proceedings of TLDI’07: 2007 ACM SIGPLAN International Workshop on Types in Languages Design and Implementation, Nice, France, January 16, 2007, François Pottier and George C. Necula (Eds.). ACM Press, 53–66. Google ScholarGoogle ScholarDigital LibraryDigital Library
  55. David Wahlstedt. 2007. Dependent Type Theory with Parameterized First-Order Data Types and Well-Founded Recursion. Ph.D. Dissertation. Chalmers University of Technology.Google ScholarGoogle Scholar
  56. Benjamin Werner. 1992. A Normalization Proof for an Impredicative Type System with Large Eliminations over Integers. In Proceedings of the 1992 Workshop on Types for Proofs and Programs, Båstad, Sweden, June 1992, Bengt Nordström, Kent Petersson, and Gordon Plotkin (Eds.). 341–357. http://www.cs.chalmers.se/Cs/Research/Logic/Types/proc92.psGoogle ScholarGoogle Scholar
  57. Hongwei Xi. 2002. Dependent Types for Program Termination Verification. Journal of Higher-Order and Symbolic Computation 15, 1 (2002), 91–131. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Normalization by evaluation for sized dependent 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

          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!