Skip to main content

A comprehensible guide to a new unifier for CIC including universe polymorphism and overloading*


Unification is a core component of every proof assistant or programming language featuring dependent types. In many cases, it must deal with higher order problems up to conversion. Since unification in such conditions is undecidable, unification algorithms may include several heuristics to solve common problems. However, when the stack of heuristics grows large, the result and complexity of the algorithm can become unpredictable. Our contributions are twofold: (1) We present a full description of a new unification algorithm for the Calculus of Inductive Constructions (the base logic of COQ), building it up from a basic calculus to the full Calculus of Inductive Constructions as it is implemented in COQ, including universe polymorphism, canonical structures (the overloading mechanism baked into COQ's unification), and a small set of useful heuristics. (2) We implemented our algorithm, and tested it on several libraries, providing evidence that the selected set of heuristics suffices for large developments.

Hide All

This research was partially supported by EU 7FP grant agreement 295261 (MEALS).

Hide All
Abel A. & Pientka B. (2011) Higher-order dynamic pattern unification for dependent types and records. In Proceedings of International Conference on Typed Lambda Calculi and Applications (TLCA). Berlin, Heidelberg: Springer, pp. 10–26.
Asperti A., Coen C. S., Tassi E. & Zacchiroli S. (2006) Crafting a proof assistant. In Berlin, Heidelberg: Springer-Verlag, ed. Altenkirch, Thorsten and McBride, Conor, pp. 18–32.
Asperti A., Ricciotti W., Coen C. S. & Tassi E. (2009) Hints in unification. In TPHOLs, ed. Berghofer, Stefan, Nipkow, Tobias, Urban, Christian, Wenzel, Makarius, LNCS, vol. 5674. Berlin, Heidelberg: Springer, pp. 84–98.
Asperti A., Ricciotti W., Coen C. S. & Tassi E. (2012) A bi-directional refinement algorithm for the calculus of (co)inductive constructions. Log. Methods Comput. Sci. (LMCS) 8 (1), 149.
Baader F. & Nipkow T. (1998) Term Rewriting and All That. New York, NY, USA: Cambridge University Press.
Baader F. & Siekmann J. H. (1994) Handbook of Logic in Artificial Intelligence and Logic Programming. New York, NY, USA: Oxford University Press, Inc.
Bender M. A., Fineman J. T., Gilbert S. & Tarjan R. E. (2015) A new approach to incremental cycle detection and related problems. ACM Trans. Algorithms 12 (2), 14:114:22.
Brady E. (2013) Idris, a general-purpose dependently typed programming language: Design and implementation. J. Funct. Program. (JFP) 23, pp. 552593.
Cervesato I. & Pfenning F. (2003) A linear spine calculus. J. Log. Comput. 13 (5), 639688.
Chlipala A. (2011) Certified Programming with Dependent Types. MIT Press. Available at:
de Moura L., Avigad J., Kong S. & Roux C. (2015) Elaboration in dependent type theory. Arxiv e-prints, May.
Dowek G., Hardin T., Kirchner C. & Pfenning F. (1996) Unification via explicit substitutions: The case of higher-order patterns. In Proceedings of lics'95. IEEE Computer Society Press, Washington, DC, USA, pp. 36637–4, 366–381.
Dunchev C., Guidi F., Sacerdoti Coen C. & Tassi E. (2015) Elpi: Fast, embeddable, λprolog interpreter. In Logic for Programming, Artificial Intelligence, and Reasoning, Davis M., Fehnker A., McIver A. & Voronkov A. (eds), Lecture Notes in Computer Science, vol. 9450. Berlin, Heidelberg: Springer, pp. 460468.
Elliott C. M. (1989) Higher-order unification with dependent function types. In Proceedings of 3rd International Conference Rewriting Techniques and Applications, LNCS, vol. 355. Berlin, Heidelberg: Springer-Verlag, pp. 121–136.
Garillot F. (2011 December) Generic Proof Tools and Finite Group Theory. PhD Thesis, Ecole Polytechnique X.
Garillot F., Gonthier G., Mahboubi A. & Rideau L. (2009) Packaging mathematical structures. In TPHOL. ed. Berghofer, Stefan, Nipkow, Tobias, Urban, Christian, Wenzel, Makarius: Springer, pp. 327–342.
Gonthier G., Mahboubi A. & Tassi E. (2008) A Small Scale Reflection Extension for the Coq System. Technical Report, INRIA.
Gonthier G., Ziliani B., Nanevski A. & Dreyer D. (2011) How to make ad hoc proof automation less ad hoc. In Proceedings of Inernational Conference of Functional Programming (ICFP). New York, NY, USA: ACM, pp. 163175.
Gonthier G., Ziliani B., Nanevski A. & Dreyer D. (2013a) How to make ad hoc proof automation less ad hoc. J. Funct. Program. (JFP) 23 (04), 357401.
Gonthier G., Asperti A., Avigad J., Bertot Y., Cohen C., Garillot F., Le Roux S., Mahboubi A., O'Connor R., Ould Biha S., Pasca I., Rideau L., Solovyev A., Tassi E. & Théry L. (2013b) A machine-checked proof of the odd order theorem. In ITP. ed. Blazy, Sandrine, Paulin-Mohring, Christine, Pichardie, David. Springer, pp. 163–179.
Harper R. & Pollack R. (1991) Type checking with universes. Theor. Comput. Sci. 89 (1), 107136.
Huet G. P. (2002) Higher order unification 30 years later. In Proceedings of the 15th International Conference on Theorem Proving in Higher Order Logics. In TPHOLs '02. London, UK: Springer-Verlag, pp. 3–12.
Knight K. (1989) Unification: A multidisciplinary survey. ACM Comput. Surv. 21 (1), 93124.
Mahboubi A. & Tassi E. (2013) Canonical Structures for the working Coq user. In ITP. ed. Blazy, Sandrine, Paulin-Mohring, Christine, Pichardie, David. Springer, pp. 19–34.
Miller D. (1991) Unification of simply typed lamda-terms as logic programming. In ICLP. ed. Beaumont, Anthony and Gupta, Gopal, MIT Press, pp. 255-269.
Nanevski A., Pfenning F. & Pientka B. (2008) Contextual modal type theory. ACM Trans. Comput. Logic 9 (3), pp. 23:123:49.
Norell U. (2007) Towards a Practical Programming Language Based on Dependent Type Theory. PhD Thesis, Chalmers University of Technology.
Norell U. (2009) Dependently typed programming in Agda. In Types in Language Design and Implementation (TLDI). ed. Koopman Pieter, Plasmeijer Rinus, and Swierstra Doaitse, ACM, pp. 230266.
Paulson L. C. (1985) Verifying the unification algorithm in lcf. Sci. Comput. Program. 5 (2), 143169.
Peyton Jones S., Vytiniotis D., Weirich S. & Washburn G. (2006) Simple unification-based type inference for GADTs. In Proceedings of Inernational Conference of Functional Programming (ICFP). New York, NY, USA: ACM. pp. 50–61.
Pfenning F. (1991) Unification and anti-unification in the calculus of constructions. In Proceedings of 6th Annual IEEE Symposium on Logic in Computer Science, Ieee Computer Society, Washington, D.C., United States, pp. 74–85.
Pfenning F. & Schürmann C. (1998) Algorithms for equality and unification in the presence of notational definitions. In Types for Proofs and Programs, ed. Altenkirch, Thorsten and Naraschewski, Wolfgang and Reus, Bernhard, LNCS. Springer-Verlag, p. 1657.
Reed J. (2009) Higher-order constraint simplification in dependent type theory. In Proceedings of the Fourth International Workshop on Logical Frameworks and Meta-Languages: Theory and Practice (LFMTP). New York, NY, USA: ACM, pp. 4956.
Robinson J. A. (1965) A machine-oriented logic based on the resolution principle. J. ACM (JACM) 12 (1), 2341.
Sacerdoti Coen C. (2004) Mathematical Knowledge Management and Interactive Theorem Proving. PhD Thesis, University of Bologna.
Saíbi A. (1999) Outils Generiques de Modelisation et de Demonstration Pour la Formalisation des Mathematiques en Theorie des Types. Application a la Theorie des Categories. PhD Thesis, University Paris 6.
Sozeau M. & Tabareau N. (2014) Universe polymorphism in Coq. In Proceedings of International Conference on Interactive Theorem Proving (ITP). Berlin, Heidelberg, Springer, pp. 499–514.
The Coq Development Team. (2012) The Coq Proof Assistant Reference Manual – Version V8.4. Available at:
Wadler P. & Blott S. (1989) How to make ad-hoc polymorphism less ad hoc. In Proceedings of the 16th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages. New York, NY, USA: ACM, pp. 60–76.
Ziliani B. & Sozeau M. (2015) A unification algorithm for Coq featuring universe polymorphism and overloading. In Proceedings of the International Conference of Functional Programming (ICFP). New York, NY, USA: ACM, pp. 179–191.
Ziliani B., Dreyer D., Krishnaswami N. R., Nanevski A. & Vafeiadis V. (2013) Mtac: A monad for typed tactic programming in Coq. In Proceedings of the 18th ACM SIGPLAN International Conference on Functional Programming (ICFP), New York, NY, USA: ACM, pp. 87100.
Ziliani B., Dreyer D., Krishnaswami N., Nanevski A. & Vafeiadis V. (2015) Mtac: A monad for typed tactic programming in Coq. J. Funct. Program. (JFP), Cambridge University Press, 25.
Recommend this journal

Email your librarian or administrator to recommend adding this journal to your organisation's collection.

Journal of Functional Programming
  • ISSN: 0956-7968
  • EISSN: 1469-7653
  • URL: /core/journals/journal-of-functional-programming
Please enter your name
Please enter a valid email address
Who would you like to send this to? *


Full text views

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

Abstract views

Total abstract views: 201 *
Loading metrics...

* Views captured on Cambridge Core between 7th February 2017 - 22nd November 2017. This data will be updated every 24 hours.