Hostname: page-component-8448b6f56d-cfpbc Total loading time: 0 Render date: 2024-04-18T08:20:49.564Z Has data issue: false hasContentIssue false

Eliminating dependent pattern matching without K

Published online by Cambridge University Press:  30 August 2016

JESPER COCKX
Affiliation:
iMinds-Distrinet, KU Leuven (e-mail: jesper.cockx@cs.kuleuven.be, dominique.devriese@cs.kuleuven.be, frank.piessens@cs.kuleuven.be)
DOMINIQUE DEVRIESE
Affiliation:
iMinds-Distrinet, KU Leuven (e-mail: jesper.cockx@cs.kuleuven.be, dominique.devriese@cs.kuleuven.be, frank.piessens@cs.kuleuven.be)
FRANK PIESSENS
Affiliation:
iMinds-Distrinet, KU Leuven (e-mail: jesper.cockx@cs.kuleuven.be, dominique.devriese@cs.kuleuven.be, frank.piessens@cs.kuleuven.be)
Rights & Permissions [Opens in a new window]

Abstract

Core share and HTML view are not available for this content. However, as you have access to this content, a full PDF is available via the ‘Save PDF’ action button.

Dependent pattern matching is an intuitive way to write programs and proofs in dependently typed languages. It is reminiscent of both pattern matching in functional languages and case analysis in on-paper mathematics. However, in general, it is incompatible with new type theories such as homotopy type theory (HoTT). As a consequence, proofs in such theories are typically harder to write and to understand. The source of this incompatibility is the reliance of dependent pattern matching on the so-called K axiom – also known as the uniqueness of identity proofs – which is inadmissible in HoTT. In this paper, we propose a new criterion for dependent pattern matching without K, and prove it correct by a translation to eliminators in the style of Goguen et al. (2006 Algebra, Meaning, and Computation). Our criterion is both less restrictive than existing proposals, and solves a previously undetected problem in the old criterion offered by Agda. It has been implemented in Agda and is the first to be supported by a formal proof. Thus, it brings the benefits of dependent pattern matching to contexts where we cannot assume K, such as HoTT.

Type
Research Article
Copyright
Copyright © Cambridge University Press 2016 

References

Altenkirch, T. (2012) Without-K problem. Available at: https://lists.chalmers.se/pipermail/agda/2012/004104.html. On the Agda mailing list. (last accessed date 09/08/2016)Google Scholar
Augustsson, L. (1985) Compiling pattern matching. In Functional Programming Languages and Computer Architecture: Nancy, France, September 16–19, 1985, Jouannaud, J.-P. (ed), Lecture Notes in Computer Science. Berlin, Heidelberg: Springer Berlin Heidelberg, pp. 368381.Google Scholar
Barras, B., Corbineau, P., Grégoire, B., Herbelin, H. & Sacchini, J. L. (2009) A new elimination rule for the calculus of inductive constructions. In Types for Proofs and Programs: International Conference, TYPES 2008 Torino, Italy, March 26–29, 2008 Revised Selected Papers. Berlin, Heidelberg: Springer Berlin Heidelberg, pp. 3248.Google Scholar
Bezem, M., Coquand, T. & Huber, S. (2014) A model of type theory in cubical sets. In 19th International Conference on Types for Proofs and Programs (TYPES 2013), Matthes, R. and Schubert, A. (eds), Leibniz International Proceedings in Informatics (LIPIcs), vol. 26. Dagstuhl, Germany: Schloss Dagstuhl–Leibniz-Zentrum fuer Informatik, pp. 107128.Google Scholar
Boutillier, P. (2014) De nouveaux outils pour Calculer avec des inductifs en Coq. PhD Thesis, Université Paris-Diderot-Paris VII.Google Scholar
Brady, E. (2013) Idris, a general purpose dependently typed programming language: Design and implementation. J. Funct. Program. 23 (5), 552593.Google Scholar
Cockx, J. (2014) Yet another way Agda –without-K is incompatible with univalence. Available at: https://lists.chalmers.se/pipermail/agda/2014/006367.html. On the Agda mailing list. (last accessed date 09/08/2016)Google Scholar
Cockx, J., Devriese, D. & Piessens, F. (2014) Pattern matching without K. In Proceedings of the 19th ACM SIGPLAN International Conference on Functional Programming. New York, NY, USA: ACM, pp. 257268.Google Scholar
Cockx, J., Devriese, D. & Piessens, F. (to appear) Unifiers as Equivalences: Proof-relevant unification of dependently typed data. In Proceedings of the 21th ACM SIGPLAN International Conference on Functional Programming. ACM.Google Scholar
Cohen, C., Coquand, T., Huber, S. & Mörtberg, A. (2015) Cubical type theory: A constructive interpretation of the univalence axiom. http://www.cse.chalmers.se/~coquand/cubicaltt.pdf (last accessed date 09/08/2016)Google Scholar
Coquand, T. (1992) Pattern matching with dependent types. In Proceedings of the 3rd Workshop on Types for Proofs and Program, pp. 66–79.Google Scholar
Dagand, P.-E. (2013) A Cosmology of Datatypes: Reusability and Dependent Types. PhD Thesis, University of Strathclyde.Google Scholar
Danielsson, N.-A. (2013) Experiments related to equality. Available at: http://www.cse.chalmers.se/~nad/repos/equality/. Agda code. (last accessed date 09/08/2016)Google Scholar
de Moura, L., Kong, S., Avigad, J., van Doorn, F. & von Raumer, J. (2015) The lean theorem prover (system description). In Proceedings of 25th International Conference on Automated Deduction (CADE-25), Felty, P. Amy and Middeldorp, A. (eds). Cham: Springer International Publishing, pp. 378388.Google Scholar
Devriese, D. & Piessens, F. (2011) On the bright side of type classes: Instance arguments in Agda. In ACM SIGPLAN International Conference on Functional Programming (ICFP), New York, NY, USA: ACM, pp. 143155.Google Scholar
Dybjer, P. (1991) Inductive sets and families in Martin-Löf's type theory and their set-theoretic semantics. In Proceedings of the 1st Workshop on Logical Frameworks, Huet, G. and Plotkin, G. (eds) pp. 213230.Google Scholar
Goguen, H., McBride, C. & McKinna, J. (2006) Eliminating dependent pattern matching. In Algebra, Meaning, and Computation: Essays dedicated to Joseph A. Goguen on the Occasion of His 65th Birthday. Berlin, Heidelberg: Springer Berlin Heidelberg, pp. 521540.Google Scholar
Hofmann, M. & Streicher, T. (1994) The groupoid model refutes uniqueness of identity proofs. In Proceedings of the 9th Annual IEEE Symposium on Logic in Computer Science (LICS), pp. 208–212.Google Scholar
Jouannaud, J.-P. & Kirchner, C. (1990) Solving Equations in Abstract Algebras: A Rule-Based Survey of Unification In Computational Logic: Essays in Honor of Alan Robinson, Lassez, J. L. (ed).Google Scholar
Kraus, N., Escardó, M., Coquand, T. & Altenkirch, T. (2013) Generalizations of Hedberg's theorem. In Typed Lambda Calculi and Applications, Hasegawa, M. (ed). Springer, pp. 173188.Google Scholar
Kraus, N. & Sattler, C. (2015) On the hierarchy of univalent universes: U(n) is not n-truncated. ACM Trans. Comput. Logic. 16 (2), 18:1–18:12. New York, NY, USA: ACM.Google Scholar
Licata, D. (2011) Just kidding: Understanding identity elimination in homotopy type theory. Available at: http://homotopytypetheory.org/2011/04/10/just-kidding-understanding-identity-elimination-in-homotopy-type-theory/. (last accessed date 09/08/2016)Google Scholar
Licata, D. R. & Shulman, M. (2013) Calculating the fundamental group of the circle in homotopy type theory. In Proceedings of 28th Annual IEEE/ACM Symposium on Logic in Computer Science.Google Scholar
Luo, Z. (1994) Computation and Reasoning: A Type Theory for Computer Science, International Series of Monographs on Computer Science, vol. 11.Google Scholar
Mangin, C. & Sozeau, M. (2015) Equations for hereditary substitution in Leivant's predicative system F: A case study. In Proceedings of the 10th International Workshop on Logical Frameworks and Meta-Languages: Theory and Practice, Cervesato, I. and Chaudhuri, K. pp. 7186.Google Scholar
Maranget, L. (2008) Compiling pattern matching to good decision trees. In Proceedings of the 2008 ACM SIGPLAN Workshop on ML. New York, NY, USA: ACM, pp. 3546.Google Scholar
Martin-Löf, P. (1984) Intuitionistic Type Theory. Naples: Bibliopolis Number 1 in Studies in Proof Theory, vol. 76.Google Scholar
McBride, C. (1998) Towards dependent pattern matching in LEGO. TYPES meeting.Google Scholar
McBride, C. (2000) Dependently Typed Functional Programs and their Proofs. PhD Thesis, University of Edinburgh.Google Scholar
McBride, C. (2002) Elimination with a motive. In Types for Proofs and Programs: International Workshop, TYPES 2000 Durham, UK, December 8–12, 2000 Selected Papers, Callaghan, P., Luo, Z., McKinna, J., and Pollack, R. (eds). Berlin, Heidelberg: Springer Berlin Heidelberg, pp. 197216.Google Scholar
McBride, C. (2005) Epigram: Practical programming with dependent types. In Advanced Functional Programming Vene, V. and Uustalu, T. (eds). Berlin, Heidelberg: Springer Berlin Heidelberg, pp. 130170.Google Scholar
McBride, C. & McKinna, J. (2004) The view from the left. J. Funct. Program. 14 (1), 69111.Google Scholar
McBride, C., Goguen, H. & McKinna, J. (2006) A few constructions on constructors. In Types for Proofs and Programs, Filliâtre, J.-C., Paulin-Mohring, C., and Werner, B. (eds). Berlin, Heidelberg: Springer Berlin Heidelberg, pp. 186200.Google Scholar
Norell, U. (2007) Towards a Practical Programming Language Based on Dependent Type Theory. PhD Thesis, Chalmers University of Technology.Google Scholar
Norell, U., Abel, A. & Danielsson, N. A. (2012) Release notes for Agda 2 version 2.3.2. Available at: http://wiki.portal.chalmers.se/agda/pmwiki.php?n=Main.Version-2-3-2. (last accessed date 09/08/2016)Google Scholar
Paulin-Mohring, C. (1993) Inductive definitions in the System Coq - rules and properties. In Proceedings of the International Conference on Typed Lambda Calculi and Applications, TLCA '93. London, UK: Springer-Verlag, pp. 328345.Google Scholar
Reed, J. (2013) Another possible without-K problem. Available at: https://lists.chalmers.se/pipermail/agda/2013/005578.html. On the Agda mailing list. (last accessed date 09/08/2016)Google Scholar
Sicard-Ramírez, A. (2013) –without-K option too restrictive?. Available at: https://lists.chalmers.se/pipermail/agda/2013/005407.html. On the Agda mailing list. (last accessed date 09/08/2016)Google Scholar
Sozeau, M. (2010) Equations: A dependent pattern-matching compiler. In Interactive Theorem Proving, Kaufmann, M. and Paulson, L. C. (eds). Berlin, Heidelberg: Springer Berlin Heidelberg, pp. 419434.Google Scholar
Sozeau, M. (2015) Coq support for HoTT. In Workshop on Homotopy Type Theory / Univalent Foundations.Google Scholar
The Coq development team. (2012) The Coq Proof Assistant Reference Manual. LogiCal Project. Available at: http://coq.inria.fr. Version 8.4.Google Scholar
The Univalent Foundations Program. (2013) Homotopy Type Theory: Univalent Foundations of Mathematics. Available at: http://homotopytypetheory.org/book, Institute for Advanced Study. (last accessed date 09/08/2016)Google Scholar
Submit a response

Discussions

No Discussions have been published for this article.