Skip to main content Accessibility help
×
Home

Eliminating dependent pattern matching without K

  • JESPER COCKX (a1), DOMINIQUE DEVRIESE (a1) and FRANK PIESSENS (a1)

Abstract

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.

Copyright

References

Hide All
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)
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.
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.
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.
Boutillier, P. (2014) De nouveaux outils pour Calculer avec des inductifs en Coq. PhD Thesis, Université Paris-Diderot-Paris VII.
Brady, E. (2013) Idris, a general purpose dependently typed programming language: Design and implementation. J. Funct. Program. 23 (5), 552593.
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)
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.
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.
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)
Coquand, T. (1992) Pattern matching with dependent types. In Proceedings of the 3rd Workshop on Types for Proofs and Program, pp. 66–79.
Dagand, P.-E. (2013) A Cosmology of Datatypes: Reusability and Dependent Types. PhD Thesis, University of Strathclyde.
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)
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.
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.
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.
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.
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.
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).
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.
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.
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)
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.
Luo, Z. (1994) Computation and Reasoning: A Type Theory for Computer Science, International Series of Monographs on Computer Science, vol. 11.
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.
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.
Martin-Löf, P. (1984) Intuitionistic Type Theory. Naples: Bibliopolis Number 1 in Studies in Proof Theory, vol. 76.
McBride, C. (1998) Towards dependent pattern matching in LEGO. TYPES meeting.
McBride, C. (2000) Dependently Typed Functional Programs and their Proofs. PhD Thesis, University of Edinburgh.
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.
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.
McBride, C. & McKinna, J. (2004) The view from the left. J. Funct. Program. 14 (1), 69111.
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.
Norell, U. (2007) Towards a Practical Programming Language Based on Dependent Type Theory. PhD Thesis, Chalmers University of Technology.
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)
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.
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)
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)
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.
Sozeau, M. (2015) Coq support for HoTT. In Workshop on Homotopy Type Theory / Univalent Foundations.
The Coq development team. (2012) The Coq Proof Assistant Reference Manual. LogiCal Project. Available at: http://coq.inria.fr. Version 8.4.
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)

Eliminating dependent pattern matching without K

  • JESPER COCKX (a1), DOMINIQUE DEVRIESE (a1) and FRANK PIESSENS (a1)

Metrics

Full text views

Total number of HTML views: 0
Total number of PDF views: 0 *
Loading metrics...

Abstract views

Total abstract views: 0 *
Loading metrics...

* Views captured on Cambridge Core between <date>. This data will be updated every 24 hours.

Usage data cannot currently be displayed

Eliminating dependent pattern matching without K

  • JESPER COCKX (a1), DOMINIQUE DEVRIESE (a1) and FRANK PIESSENS (a1)
Submit a response

Discussions

No Discussions have been published for this article.

×

Reply to: Submit a response


Your details


Conflicting interests

Do you have any conflicting interests? *