Journal of Automated Reasoning

, Volume 49, Issue 3, pp 409–426 | Cite as

Nested Abstract Syntax in Coq

  • André Hirschowitz
  • Marco Maggesi


We illustrate Nested Abstract Syntax as a high-level alternative representation of languages with binding constructs, based on nested datatypes. Our running example is a partial solution in the Coq proof assistant to the POPLmark Challenge. The resulting formalization is very compact and does not require any extra library or special logical apparatus. Along the way, we propose an original, high-level perspective on environments.


POPLmark Abstract syntax Semantics Nested datatypes Coq System F < : 


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Altenkirch, T., Reus, B.: Monadic presentations of lambda terms using generalized inductive types. In: Flum, J., Rodríguez-Artalejo, M. (eds.) CSL. Lecture Notes in Computer Science, vol. 1683, pp. 453–468. Springer (1999)Google Scholar
  2. 2.
    Aydemir, B., Bohannon, A., Fairbairn, M., Foster, J., Pierce, B., Sewell, P., Vytiniotis, D., Washburn, G., Weirich, S., Zdancewic, S.: Mechanized metatheory for the masses: the POPLmark challenge. In: Proceedings of the Eighteenth International Conference on Theorem Proving in Higher Order Logics (TPHOLs 2005) (2005)Google Scholar
  3. 3.
    Aydemir, B., Charguéraud, A., Pierce, B.C., Pollack, R., Weirich, S.: Engineering formal metatheory. In: POPL ’08: Proceedings of the 35th Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, pp. 3–15. ACM, New York, NY, USA (2008)CrossRefGoogle Scholar
  4. 4.
    Bird, R.S., Meertens, L.G.L.T.: Nested datatypes. In: MPC ’98: Proceedings of the Mathematics of Program Construction, pp. 52–67. Springer, London (1998)CrossRefGoogle Scholar
  5. 5.
    Bird, R.S., Paterson, R.: de Bruijn notation as a nested datatype. J. Funct. Program. 9(1), 77–91 (1999)MathSciNetzbMATHCrossRefGoogle Scholar
  6. 6.
    Cheney, J.: Nominal logic and abstract syntax. SIGACT News 36(4), 47–69 (2005)CrossRefGoogle Scholar
  7. 7.
    Crary, K., Harper, R.: Higher-order abstract syntax: setting the record straight. SIGACT News 37(3), 93–96 (2006)CrossRefGoogle Scholar
  8. 8.
    Gabbay, M., Pitts, A.M.: A new approach to abstract syntax with variable binding. Form. Asp. Comput. 13(3–5), 341–363 (2002)zbMATHCrossRefGoogle Scholar
  9. 9.
    Hirschowitz, A., Maggesi, M.: Modules over monads and linearity. In: Leivant, D., de Queiroz, R.J.G.B. (eds.) WoLLIC. Lecture Notes in Computer Science, vol. 4576, pp. 218–237. Springer (2007)Google Scholar
  10. 10.
    Hirschowitz, A., Maggesi, M.: Modules over monads and initial semantics. Inf. Comput. 208(5), 545–564 (2010) (Special Issue: 14th Workshop on Logic, Language, Information and Computation (WoLLIC 2007))MathSciNetzbMATHCrossRefGoogle Scholar
  11. 11.
    Honsell, F., Miculan, M., Scagnetto, I.: An axiomatic approach to metareasoning on nominal algebras in HOAS. In: Orejas, F., Spirakis, P.G., van Leeuwen, J. (eds.) ICALP. Lecture Notes in Computer Science, vol. 2076, pp. 963–978. Springer (2001)Google Scholar
  12. 12.
    Lee, D.K., Crary, K., Harper, R.: Towards a mechanized metatheory of standard ML. In: Hofmann, M., Felleisen, M. (eds.) POPL, pp. 173–184. ACM (2007)Google Scholar
  13. 13.
    Matthes, R.: Nested datatypes with generalized mendler iteration: map fusion and the example of the representation of untyped lambda calculus with explicit flattening. In: Audebaud, P., Paulin-Mohring, C. (eds.) International Conference on Mathematics of Program Construction (MPC), Marseille, 15/07/2008–18/07/2008. LNCS, vol. 5133, pp. 220–242. Springer (2008)
  14. 14.
    Matthes, R.: Recursion on nested datatypes in dependent type theory. In: Beckmann, A., Dimitracopoulos, C., Lwe, B. (eds.) Computability in Europe Logic and Theory of Algorithms (CiE), University of Athens, 15/06/2008–20/06/2008. LNCS, vol. 5028, pp. 431–446. Springer (2008) (Confrencier invit)
  15. 15.
    Matthes, R.: An induction principle for nested datatypes in intensional type theory. J. Funct. Program. 19(3&4), 439–468 (2009)MathSciNetzbMATHCrossRefGoogle Scholar
  16. 16.
    The Coq development team: The Coq proof assistant reference manual. LogiCal Project. Version 8.0 (2004)Google Scholar
  17. 17.
    Pfenning, F., Elliott, C.: Higher-order abstract syntax. In: PLDI, pp. 199–208 (1988)Google Scholar
  18. 18.
    Zsidó, J.: Catégories de lambda-calculs. Ph.D. thesis, Université de Nice–Sophia Antipolis (2010)Google Scholar

Copyright information

© Springer Science+Business Media B.V. 2010

Authors and Affiliations

  1. 1.CNRS, UNSNiceFrance
  2. 2.Univesità degli Studi di FirenzeFirenzeItaly

Personalised recommendations