Auto in Agda

Programming Proof Search Using Reflection
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 9129)


As proofs in type theory become increasingly complex, there is a growing need to provide better proof automation. This paper shows how to implement a Prolog-style resolution procedure in the dependently typed programming language Agda. Connecting this resolution procedure to Agda’s reflection mechanism provides a first-class proof search tactic for first-order Agda terms. As a result, writing proof automation tactics need not be different from writing any other program.


  1. Agda development team. Agda release notes documenting the reflection mechanism. The Agda Wiki (2013). and Accessed 9 Feb 2013
  2. Allais, G.: Proof automatization using reflection (implementations in Agda). MSc Intern report, University of Nottingham (2010)Google Scholar
  3. Brady, E.: Idris, a general-purpose dependently typed programming language: design and implementation. J. Funct. Program. 9, 23:552–593 (2013). doi:10.1017/S095679681300018X MathSciNetGoogle Scholar
  4. Braibant, T.: Emancipate yourself from LTac (2012).
  5. Chapman, J.: Type checking and normalisation. Ph.D. thesis, University of Nottingham (2009)Google Scholar
  6. Chlipala, A.: Certified Programming with Dependent Types. MIT Press, Cambridge (2013)MATHGoogle Scholar
  7. Danielsson, N.A.: A formalisation of a dependently typed language as an inductive-recursive family. In: Altenkirch, T., McBride, C. (eds.) TYPES 2006. LNCS, vol. 4502, pp. 93–109. Springer, Heidelberg (2007). doi:10.1145/2500365.2500575 CrossRefGoogle Scholar
  8. Coq development team. The Coq proof assistant reference manual. Logical Project (2004)Google Scholar
  9. Devriese, D., Piessens, F.: Typed syntactic meta-programming. In: Proceedings of the 2013 ACM SIGPLAN International Conference on Functional Programming (ICFP 2013). ACM, September 2013. doi:10.1145/2500365.2500575
  10. Gordon, M.J.C., Melham, T.F.: Introduction to HOL: A Theorem Proving Environment for Higher Order Logic. Cambridge University Press, New York (1993) MATHGoogle Scholar
  11. Lindblad, F., Benke, M.: A tool for automated theorem proving in Agda. In: Filliâtre, J.-C., Paulin-Mohring, C., Werner, B. (eds.) TYPES 2004. LNCS, vol. 3839, pp. 154–169. Springer, Heidelberg (2006) CrossRefGoogle Scholar
  12. Malecha, G., Chlipala, A., Braibant, T.: Compositional computational reflection. In: Klein, G., Gamboa, R. (eds.) ITP 2014. LNCS, vol. 8558, pp. 374–389. Springer, Heidelberg (2014) Google Scholar
  13. Martin-Löf, P.: Constructive mathematics and computer programming. In: Proceedings of a Discussion Meeting of the Royal Society of London on Mathematical Logic and Programming Languages, pp. 167–184. Prentice-Hall Inc. (1985)Google Scholar
  14. McBride, C.: First-order unification by structural recursion. J. Funct. Program. 11, 13:1061–1075 (2003). doi:10.1017/S0956796803004957 MathSciNetGoogle Scholar
  15. McBride, C.: Outrageous but meaningful coincidences: dependent type-safe syntax and evaluation. In: Proceedings of the 6th ACM SIGPLAN Workshop on Generic Programming, WGP 2010, pp. 1–12. ACM, New York (2010). doi:10.1145/1863495.1863497
  16. Norell, U.: Towards a practical programming language based on dependent type theory. Ph.D. thesis, Department of Computer Science and Engineering, Chalmers University of Technology (2007)Google Scholar
  17. Norell, U.: Dependently typed programming in Agda. In: Koopman, P., Plasmeijer, R., Swierstra, D. (eds.) AFP 2008. LNCS, vol. 5832, pp. 230–266. Springer, Heidelberg (2009a) CrossRefGoogle Scholar
  18. Norell, U.: Playing with Agda. Invited talk at TPHOLS (2009b)Google Scholar
  19. Oury, N., Swierstra, W.: The power of Pi. In: Proceedings of the 13th ACM SIGPLAN International Conference on Functional Programming, ICFP 2008, pp. 39–50 (2008). doi:10.1145/1411204.1411213
  20. Jones, S.P. (ed.): Haskell 98 Language and Libraries: the Revised report. Cambridge University Press, Cambridge (2003) Google Scholar
  21. Pitman, K.M.: Special forms in LISP. In: Proceedings of the 1980 ACM Conference on LISP and Functional Programming, pp. 179–187. ACM (1980)Google Scholar
  22. Sheard, T., Jones, S.P.: Template meta-programming for Haskell. In: Proceedings of the 2002 ACM SIGPLAN Workshop on Haskell, pp 1–16 (2002). doi:10.1145/581690.581691
  23. Stutterheim, J., Swierstra, W., Swierstra, D.: Forty hours of declarative programming: teaching prolog at the junior college Utrecht. In: Proceedings First International Workshop on Trends in Functional Programming in Education, Electronic Proceedings in Theoretical Computer Science, University of St. Andrews, Scotland, UK, 11 June 2012, vol. 106, pp 50–62 (2013)Google Scholar
  24. Swierstra, W.: More dependent types for distributed arrays. High.-Ord. Symbol. Comput. 23(4), 489–506 (2010)MATHMathSciNetCrossRefGoogle Scholar
  25. Swierstra, W., van Noort, T.: A library for polymorphic dynamic typing. J. Funct. Program. 23, 229–248 (2013). doi:10.1017/S0956796813000063 MATHCrossRefGoogle Scholar
  26. Taha, W., Sheard, T.: Multi-stage programming with explicit annotations. In: Proceedings of the 1997 ACM SIGPLAN Symposium on Partial Evaluation and Semantics-Based Program Manipulation, PEPM 1997 (1997). doi:10.1145/258993.259019
  27. van der Walt, P., Swierstra, W.: Engineering proof by reflection in Agda. In: Hinze, R. (ed.) IFL 2012. LNCS, vol. 8241, pp. 157–173. Springer, Heidelberg (2013) CrossRefGoogle Scholar
  28. van der Walt, P.: Reflection in Agda. Master’s thesis, Department of Computer Science, Utrecht University, Utrecht, The Netherlands (2012).
  29. Ziliani, B., Dreyer, D., Krishnaswami, N.R., Nanevski, A., Vafeiadis, V.: Mtac: a monad for typed tactic programming in Coq. In: Proceedings of the 18th ACM SIGPLAN International Conference on Functional Programming, ICFP 2013, pp 87–100 (2013). doi:10.1145/2500365.2500579

Copyright information

© Springer International Publishing Switzerland 2015

Authors and Affiliations

  1. 1.Universiteit UtrechtUtrechtThe Netherlands

Personalised recommendations