Abstract
Dependently typed programming languages and proof assistants such as Agda and Coq rely on computation to automatically simplify expressions during type checking. To overcome the lack of certain programming primitives or logical principles in those systems, it is common to appeal to axioms to postulate their existence. However, one can only postulate the bare existence of an axiom, not its computational behaviour. Instead, users are forced to postulate equality proofs and appeal to them explicitly to simplify expressions, making axioms dramatically more complicated to work with than built-in primitives. On the other hand, the equality reflection rule from extensional type theory solves these problems by collapsing computation and equality, at the cost of having no practical type checking algorithm. This paper introduces Rewriting Type Theory (RTT), a type theory where it is possible to add computational assumptions in the form of rewrite rules. Rewrite rules go beyond the computational capabilities of intensional type theory, but in contrast to extensional type theory, they are applied automatically so type checking does not require input from the user. To ensure type soundness of RTT—as well as effective type checking—we provide a framework where confluence of user-defined rewrite rules can be checked modularly and automatically, and where adding new rewrite rules is guaranteed to preserve subject reduction. The properties of RTT have been formally verified using the MetaCoq framework and an implementation of rewrite rules is already available in the Agda proof assistant.
- Andreas Abel, Joakim Öhman, and Andrea Vezzosi. 2018. Decidability of Conversion for Type Theory in Type Theory. Proceedings of the ACM on Programming Languages 2, POPL, Article 23 ( Jan. 2018 ), 29 pages. https://doi.org/10.1145/ 3158111 Google Scholar
Digital Library
- Andreas Abel and Brigitte Pientka. 2011. Higher-Order Dynamic Pattern Unification for Dependent Types and Records. In Typed Lambda Calculi and Applications-10th International Conference, TLCA 2011, Novi Sad, Serbia, June 1-3, 2011. Proceedings (Lecture Notes in Computer Science), C.-H. Luke Ong (Ed.), Vol. 6690. Springer, 10-26. https://doi.org/10. 1007/978-3-642-21691-6_5 Google Scholar
Cross Ref
- Agda Development Team. 2020. Agda 2.6.1 documentation. http://agda.readthedocs. io/en/v2.6.1/Google Scholar
- Guillaume Allais, Conor McBride, and Pierre Boutillier. 2013. New Equations for Neutral Terms: A Sound and Complete Decision Procedure, Formalized. In Proceedings of the 2013 ACM SIGPLAN Workshop on Dependently-typed Programming (DTP '13). ACM, New York, NY, USA, 13-24. https://doi.org/10.1145/2502409.2502411 Google Scholar
Digital Library
- Claus Appel, Vincent van Oostrom, and Jakob Grue Simonsen. 2010. Higher-Order (Non-) Modularity. In Proceedings of the 21st International Conference on Rewriting Techniques and Applications, RTA 2010, July 11-13, 2010, Edinburgh, Scottland, UK (LIPIcs), Christopher Lynch (Ed.), Vol. 6. Schloss Dagstuhl-Leibniz-Zentrum fuer Informatik, 17-32. https://doi.org/10.4230/LIPIcs.RTA. 2010.17 Google Scholar
Cross Ref
- Ali Assaf and Guillaume Burel. 2015. Translating HOL to Dedukti. Electronic Proceedings in Theoretical Computer Science 186 ( Jul 2015 ), 74-88. https://doi.org/10.4204/EPTCS.186.8 Google Scholar
Cross Ref
- Franco Barbanera, Maribel Fernández, and Herman Geuvers. 1997. Modularity of Strong Normalization in the Algebraiclambda-Cube. Journal of Functional Programming 7, 6 ( 1997 ), 613-660.Google Scholar
Digital Library
- Henk Barendregt. 1984. The Lambda Calculus, Its Syntax and Semantics. Studies in Logic and the Foundations of Mathematics, Vol. 103. Elsevier. https://doi.org/10.1016/B978-0-444-87508-2. 50001-0 Google Scholar
Cross Ref
- Bruno Barras, Jean-Pierre Jouannaud, Pierre-Yves Strub, and Qian Wang. 2011. CoQMTU: A Higher-Order Type Theory with a Predicative Hierarchy of Universes Parametrized by a Decidable First-Order Theory. In Proceedings of the 26th Annual IEEE Symposium on Logic in Computer Science, LICS 2011, June 21-24, 2011, Toronto, Ontario, Canada. IEEE Computer Society, 143-151. https://doi.org/10.1109/LICS. 2011.37 Google Scholar
Digital Library
- Ulrich Berger, Ralph Matthes, and Anton Setzer. 2019. Martin Hofmann's Case for Non-Strictly Positive Data Types. In 24th International Conference on Types for Proofs and Programs (TYPES 2018 ), Peter Dybjer, José Espírito Santo, and Luís Pinto (Eds.). Leibniz International Proceedings in Informatics (LIPIcs), Vol. 130. Schloss Dagstuhl-Leibniz-Zentrum fuer Informatik, 1 : 1-1 : 22. https://doi.org/10.4230/LIPIcs.TYPES. 2018.1 Google Scholar
Cross Ref
- 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. http://springerlink. metapress.com/openurl.asp?genre=article&issn= 0302-9743 &volume= 3091 &spage= 24Google Scholar
- Frédéric Blanqui. 2005. Definitions by rewriting in the Calculus of Constructions. Mathematical Structures in Computer Science 15, 1 ( 2005 ), 37-92. https://doi.org/10.1017/S0960129504004426 Google Scholar
Digital Library
- Frédéric Blanqui. 2018. Size-based termination of higher-order rewriting. Journal of Functional Programming 28 ( April 2018 ), e11. https://doi.org/10.1017/S0956796818000072 Google Scholar
Cross Ref
- Frédéric Blanqui. 2020. Type Safety of Rewrite Rules in Dependent Types. In 5th International Conference on Formal Structures for Computation and Deduction, FSCD 2020, June 29-July 6, 2020, Paris, France (Virtual Conference) (LIPIcs), Zena M. Ariola (Ed.), Vol. 167. Schloss Dagstuhl-Leibniz-Zentrum für Informatik, 13 : 1-13 : 14. https://doi.org/10.4230/LIPIcs.FSCD. 2020. 13 Google Scholar
Cross Ref
- Frédéric Blanqui, Jean-Pierre Jouannaud, and Albert Rubio. 2008. The Computability Path Ordering: The End of a Quest. 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, 1-14. https://doi.org/10.1007/978-3-540-87531-4_1 Google Scholar
Digital Library
- Mathieu Boespflug, Quentin Carbonneaux, and Olivier Hermant. 2012. The λΠ-calculus Modulo as a Universal Proof Language. In the Second International Workshop on Proof Exchange for Theorem Proving (PxTP 2012 ), Tjark Weber David Pichardie (Ed.), Vol. Vol. 878. Manchester, United Kingdom, pp. 28-43. https://hal-mines-paristech.archivesouvertes.fr/hal-00917845Google Scholar
- Jacek Chrzaszcz and Daria Walukiewicz-Chrzaszcz. 2007. Towards Rewriting in Coq. In Rewriting, Computation and Proof, Essays Dedicated to Jean-Pierre Jouannaud on the Occasion of His 60th Birthday (Lecture Notes in Computer Science), Hubert Comon-Lundh, Claude Kirchner, and Hélène Kirchner (Eds.), Vol. 4600. Springer, 113-131. https://doi.org/10.1007/978-3-540-73147-4_6 Google Scholar
Cross Ref
- Jesper Cockx. 2020. Type theory unchained: Extending Agda with user-defined rewrite rules (system description). ( 2020 ). To appear in the post-proceedings of the TYPES conference.Google Scholar
- The Coq Development Team. 2016. The Coq proof assistant reference manual. http://coq.inria. fr Version 8.6.Google Scholar
- Thierry Coquand and Christine Paulin. 1988. Inductively Defined Types. In Proceedings of the International Conference on Computer Logic (COLOG '88). Springer-Verlag, Berlin, Heidelberg, 50-66.Google Scholar
Digital Library
- Denis Cousineau and Gilles Dowek. 2007. Embedding Pure Type Systems in the Lambda-Pi-Calculus Modulo. In Typed Lambda Calculi and Applications, 8th International Conference, TLCA 2007, Paris, France, June 26-28, 2007, Proceedings (Lecture Notes in Computer Science), Simona Ronchi Della Rocca (Ed.), Vol. 4583. Springer, 102-117. https://doi.org/10. 1007/978-3-540-73228-0_9 Google Scholar
Cross Ref
- Bertram Felgenhauer and Vincent van Oostrom. 2013. Proof Orders for Decreasing Diagrams. In 24th International Conference on Rewriting Techniques and Applications, RTA 2013, June 24-26, 2013, Eindhoven, The Netherlands (LIPIcs), Femke van Raamsdonk (Ed.), Vol. 21. Schloss Dagstuhl-Leibniz-Zentrum fuer Informatik, 174-189. https://doi.org/10.4230/LIPIcs. RTA. 2013.174 Google Scholar
Cross Ref
- Gaspard Ferey and Jean-Pierre Jouannaud. 2019. Confluence in (Un)Typed Higher-Order Theories by means of Critical Pairs. (Dec. 2019 ). https://hal.archives-ouvertes.fr/hal-02096540 (under submission).Google Scholar
- Guillaume Genestier. 2019. SizeChangeTool: A Termination Checker for Rewriting Dependent Types. In HOR 2019-10th International Workshop on Higher-Order Rewriting (Joint Proceedings of HOR 2019 and IWC 2019 ), Mauricio Ayala-Rincón, Silvia Ghilezan, and Jakob Grue Simonsen (Eds.). Dortmund, Germany, 14-19. https://hal.archives-ouvertes. fr/hal02442465Google Scholar
- Gaëtan Gilbert, Jesper Cockx, Matthieu Sozeau, and Nicolas Tabareau. 2019. Definitional Proof-Irrelevance without K. Proceedings of the ACM on Programming Languages 3 ( Jan. 2019 ), 1-28. https://doi.org/10.1145/329031610.1145/3290316 Google Scholar
Cross Ref
- Martin Hofmann. 1993. Non Strictly Positive Datatypes in System F. Email on types mailing list. http://www.seas.upenn.edu/ sweirich/types/archive/1993/msg00027.html.Google Scholar
- Jean-Pierre Jouannaud and Jianqi Li. 2015. Termination of Dependently Typed Rewrite Rules. In 13th International Conference on Typed Lambda Calculi and Applications, TLCA 2015, July 1-3, 2015, Warsaw, Poland (LIPIcs), Thorsten Altenkirch (Ed.), Vol. 38. Schloss Dagstuhl-Leibniz-Zentrum fuer Informatik, 257-272. https://doi.org/10.4230/LIPIcs.TLCA. 2015.257 Google Scholar
Cross Ref
- Jean-Pierre Jouannaud and Mitsuhiro Okada. 1991. A Computation Model for Executable Higher-Order Algebraic Specification Languages. In Proceedings, Sixth Annual IEEE Symposium on Logic in Computer Science, 15-18 July, 1991, Amsterdam, The Netherlands. IEEE Computer Society, 350-361. https://doi.org/10.1109/LICS. 1991.151659 Google Scholar
Cross Ref
- Jean-Pierre Jouannaud and Albert Rubio. 1999. The Higher-Order Recursive Path Ordering. In Proceedings, 14th Annual IEEE Symposium on Logic in Computer Science, 2-5 July, 1999, Trento, Italy. IEEE Computer Society, 402-411. https: //doi.org/10.1109/LICS. 1999.782635 Google Scholar
Cross Ref
- Jean-Pierre Jouannaud and Pierre-Yves Strub. 2017. Coq without Type Casts: A Complete Proof of Coq Modulo Theory. In LPAR-21: 21st International Conference on Logic for Programming, Artificial Intelligence and Reasoning. EasyChair, Maun, Botswana, 474-489. https://hal.inria.fr/hal-01664457Google Scholar
- Chin Soon Lee, Neil D. Jones, and Amir M. Ben-Amram. 2001. The size-change principle for program termination. In Proceedings of the 28th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages. Association for Computing Machinery, 81-92. https://doi.org/10.1145/360204.360210 Google Scholar
Digital Library
- Per Martin-Löf. 1975. An Intuitionistic Theory of Types: Predicative Part. In Logic Colloquium '73, H.E. Rose and J.C. Shepherdson (Eds.). Studies in Logic and the Foundations of Mathematics, Vol. 80. Elsevier, 73-118. https://doi.org/10. 1016/ S0049-237X( 08 ) 71945-1 Google Scholar
Cross Ref
- Christine Paulin-Mohring. 2015. Introduction to the Calculus of Inductive Constructions. In All about Proofs, Proofs for All, Bruno Woltzenlogel Paleo and David Delahaye (Eds.). Studies in Logic (Mathematical logic and foundations), Vol. 55. College Publications. https://hal.inria.fr/hal-01094195Google Scholar
- Pierre-Marie Pédrot and Nicolas Tabareau. 2018. Failure is Not an Option: An Exceptional Type Theory. In ESOP 2018-27th European Symposium on Programming (Lecture Notes in Computer Science), Vol. 10801. Springer, Thessaloniki, Greece, 245-271. https://doi.org/10.1007/978-3-319-89884-1_9 Google Scholar
Cross Ref
- Pierre-Marie Pédrot, Nicolas Tabareau, Hans Jacob Fehrmann, and Éric Tanter. 2019. A Reasonably Exceptional Type Theory. Proceedings of the ACM on Programming Languages 3, ICFP, Article 108 ( July 2019 ), 29 pages. https://doi.org/10.1145/ 3341712 Google Scholar
Digital Library
- Ronan Saillard. 2015. Typechecking in the lambda-Pi-Calculus Modulo: Theory and Practice. Ph.D. Dissertation. MINES ParisTech.Google Scholar
- Gert Smolka. 2015. Confluence and Normalization in Reduction Systems. ( 2015 ). https://www.ps.uni-saarland.de/courses/ sem-ws15/ars. pdf (lecture notes).Google Scholar
- Matthieu Sozeau, Abhishek Anand, Simon Boulier, Cyril Cohen, Yannick Forster, Fabian Kunze, Gregory Malecha, Nicolas Tabareau, and Théo Winterhalter. 2020. The MetaCoq Project. Journal of Automated Reasoning (Feb. 2020 ). https: //doi.org/10.1007/s10817-019-09540-0 Google Scholar
Cross Ref
- Matthieu Sozeau, Simon Boulier, Yannick Forster, Nicolas Tabareau, and Théo Winterhalter. 2019. Coq Coq Correct! Verification of Type Checking and Erasure for Coq, in Coq. Proceedings of the ACM on Programming Languages 4, POPL, Article 8 ( Dec. 2019 ), 28 pages. https://doi.org/10.1145/3371076 Google Scholar
Digital Library
- Mark-Oliver Stehr. 2005a. The Open Calculus of Constructions (Part I): An Equational Type Theory with Dependent Types for Programming, Specification, and Interactive Theorem Proving. Fundamenta Informaticae 68, 1-2 ( 2005 ), 131-174.Google Scholar
- Mark-Oliver Stehr. 2005b. The Open Calculus of Constructions (Part II): An Equational Type Theory with Dependent Types for Programming, Specification, and Interactive Theorem Proving. Fundamenta Informaticae 68, 3 ( 2005 ), 249-288.Google Scholar
- Pierre-Yves Strub. 2010. Coq Modulo Theory. In Computer Science Logic, 24th International Workshop, CSL 2010, 19th Annual Conference of the EACSL, Brno, Czech Republic, August 23-27, 2010. Proceedings (Lecture Notes in Computer Science), Anuj Dawar and Helmut Veith (Eds.), Vol. 6247. Springer, 529-543. https://doi.org/10.1007/978-3-642-15205-4_40 Google Scholar
Cross Ref
- M. Takahashi. 1995. Parallel Reductions in ń-Calculus. Information and Computation 118, 1 ( 1995 ), 120-127. https: //doi.org/10.1006/inco. 1995.1057 Google Scholar
Digital Library
- Val Tannen. 1988. Combining Algebra and Higher-Order Types. In Proceedings, Third Annual Symposium on Logic in Computer Science, 5-8 July 1988, Edinburgh, Scotland, UK. IEEE Computer Society, 82-90. https://doi.org/10.1109/LICS. 1988.5103 Google Scholar
Cross Ref
- Terese. 2003. Term Rewriting Systems. Cambridge Tracts in Theoretical Computer Science, Vol. 55. Cambridge University Press.Google Scholar
- The Univalent Foundations Program. 2013. Homotopy Type Theory: Univalent Foundations of Mathematics. Institute for Advanced Study.Google Scholar
- Vincent van Oostrom. 1994a. Confluence by Decreasing Diagrams. Theoretical Computer Science 126, 2 ( 1994 ), 259-280. https://doi.org/10.1016/ 0304-3975 ( 92 ) 00023-K Google Scholar
Digital Library
- Vincent van Oostrom. 1994b. Confluence for abstract and higher-order rewriting. Ph.D. Dissertation. Vrije Universiteit Amsterdam.Google Scholar
- Vincent van Oostrom. 1995. Development Closed Critical Pairs. In Higher-Order Algebra, Logic, and Term Rewriting, Second International Workshop, HOA '95, Paderborn, Germany, September 21-22, 1995, Selected Papers (Lecture Notes in Computer Science), Gilles Dowek, Jan Heering, Karl Meinke, and Bernhard Möller (Eds.), Vol. 1074. Springer, 185-200. https://doi.org/10.1007/3-540-61254-8_26 Google Scholar
Cross Ref
- Daria Walukiewicz-Chrzaszcz. 2003. Termination of rewriting in the Calculus of Constructions. Journal of Functional Programming 13, 2 ( 2003 ), 339-414. https://doi.org/10.1017/S0956796802004641 Google Scholar
Digital Library
- Daria Walukiewicz-Chrzaszcz and Jacek Chrzaszcz. 2006. Consistency and Completeness of Rewriting in the Calculus of Constructions. In Automated Reasoning, Third International Joint Conference, IJCAR 2006, Seattle, WA, USA, August 17-20, 2006, Proceedings (Lecture Notes in Computer Science), Ulrich Furbach and Natarajan Shankar (Eds.), Vol. 4130. Springer, 619-631. https://doi.org/10.1007/11814771_50 Google Scholar
Digital Library
Index Terms
The taming of the rew: a type theory with computational assumptions
Recommendations
Impredicative Observational Equality
In dependent type theory, impredicativity is a powerful logical principle that allows the definition of propositions that quantify over arbitrarily large types, potentially resulting in self-referential propositions. Impredicativity can provide a ...
Observational equality: now for good
Building on the recent extension of dependent type theory with a universe of definitionally proof-irrelevant types, we introduce TTobs, a new type theory based on the setoidal interpretation of dependent type theory. TTobs equips every type with an ...
Type-preserving CPS translation of Σ and Π types is not not possible
Dependently typed languages such as Coq are used to specify and prove functional correctness of source programs, but what we ultimately need are guarantees about correctness of compiled code. By preserving dependent types through each compiler pass, we ...






Comments