Second-Order Matching via Explicit Substitutions

  • Flávio L. C. de Moura
  • Fairouz Kamareddine
  • Mauricio Ayala-Rincón
Part of the Lecture Notes in Computer Science book series (LNCS, volume 3452)


Matching is a basic operation extensively used in computation. Second-order matching, in particular, provides an adequate environment for expressing program transformations and pattern recognition for automated deduction. The past few years have established the benefit of using explicit substitutions for theorem proving and higher-order unification. In this paper, we will make use of explicit substitutions to facilitate matching: we develop a second-order matching algorithm via the λσ-style of explicit substitutions. We introduce a convenient notation for matching in the λσ-calculus. This notation keeps the matching equations separated from the incremental graftings. We characterise an important class of second-order matching problems which is essential to prove termination of the algorithm. In addition, we illustrate how the algorithm works through some examples.


Higher-Order Unification Second-Order Matching Explicit Substitutions 


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. ACCL91.
    Abadi, M., Cardelli, L., Curien, P.-L., Lévy, J.-J.: Explicit Substitutions. J. of Func. Programming 1(4), 375–416 (1991)zbMATHCrossRefGoogle Scholar
  2. ARK01.
    Ayala-Rincón, M., Kamareddine, F.: Unification via the λse-Style of Explicit Substitution. The Logical J. of the IGPL 9(4), 489–523 (2001)zbMATHCrossRefGoogle Scholar
  3. AMK05.
    Ayala-Rincón, M., de Moura, F.L.C., Kamareddine, F.: Comparing and Implementing Calculi of Explicit Substitutions with Eta-Reduction. In: de Queiroz, R., Poizat, B., Artemov, S. (eds.) To appear in Special Issue of Annals of Pure and Applied Logic - WoLLIC 2002 selected papers (2005)Google Scholar
  4. Bur89.
    Burckert, H.J.: Matching - A Special Case of Unification? Journal of Symbolic Computation 8, 523–536 (1989)MathSciNetCrossRefGoogle Scholar
  5. dB72.
    de Bruijn, N.G.: Lambda-Calculus Notation with Nameless Dummies, a Tool for Automatic Formula Manipulation, with Application to the Church-Rosser Theorem. Indag. Mat. 34(5), 381–392 (1972)CrossRefGoogle Scholar
  6. DHK00.
    Dowek, G., Hardin, T., Kirchner, C.: Higher-order unification via explicit substitutions. Information and Computation 157, 183–235 (2000)MathSciNetzbMATHCrossRefGoogle Scholar
  7. dlTC87.
    de la Tour, T.B., Caferra, R.: Proof analogy in interactive theorem proving: A method to express and use it via second order pattern matching. In: Proceedings of AAAI 1987, pp. 95–99. Morgan Kaufmann, San Francisco (1987)Google Scholar
  8. dlTC88.
    de la Tour, T.B., Caferra, R.: A formal approach to some usually informal techniques used in mathematical reasoning. In: Gianni, P. (ed.) ISSAC 1988. LNCS, vol. 358, pp. 402–406. Springer, Heidelberg (1989)CrossRefGoogle Scholar
  9. Dow94.
    Dowek, G.: Third order matching is decidable. Annals of Pure and Applied Logic 69, 135–155 (1994)MathSciNetzbMATHCrossRefGoogle Scholar
  10. Dow01.
    Dowek, G.: Higher-Order Unification and Matching. In: Robinson, A., Voronkov, A. (eds.) Handbook of Automated Reasoning, vol. II, ch. 16, pp. 1009–1062. MIT press and Elsevier (2001)Google Scholar
  11. Gol81.
    Dowek, G.: Third order matching is decidable. Annals of Pure and Applied Logic 69, 135–155 (1994)MathSciNetzbMATHCrossRefGoogle Scholar
  12. HL78.
    Huet, G., Lang, B.: Proving and applying program transformations expressed with second order patterns. Acta Informatica 11, 31–55 (1978)MathSciNetzbMATHCrossRefGoogle Scholar
  13. Hue76.
    Huet, G.: Résolution d’équations dans les langages d’ordre 1,2,...,ω. PhD thesis, University Paris-7 (1976)Google Scholar
  14. Loa03.
    Loader, R.: Higher order β matching is undecidable. Logic Journal of the IGPL 11(1), 51–68 (2003)MathSciNetzbMATHCrossRefGoogle Scholar
  15. Muñ01.
    Muñoz, C.: Proof-term synthesis on dependent-type systems via explicit substitutions. Theoretical Computer Science 266, 407–440 (2001)MathSciNetzbMATHCrossRefGoogle Scholar
  16. Nip93.
    Nipkow, T.: Functional unification of higher-order patterns. In: Proc. 8th IEEE Symp. Logic in Computer Science, pp. 64–74 (1993)Google Scholar
  17. Pad00.
    Padovani, V.: Decidability of fourth-order matching. Mathematical Structures in Computer Science 10(3), 361–372 (2000)MathSciNetzbMATHCrossRefGoogle Scholar
  18. Ree03.
    Reed, J.: Extending higher-order unification to support proof irrelevance. In: Basin, D., Wolff, B. (eds.) TPHOLs 2003. LNCS, vol. 2758, pp. 238–252. Springer, Heidelberg (2003)CrossRefGoogle Scholar
  19. Rob65.
    Robinson, J.A.: A Machine-oriented Logic Based on the Resolution Principle. Journal of the ACM 12(1), 23–41 (1965)zbMATHCrossRefGoogle Scholar
  20. Vis04.
    Visser, E.: A survey of strategies in rule-based program transformation systems. Journal of Symbolic Computation (2004) (Accepted for publication)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2005

Authors and Affiliations

  • Flávio L. C. de Moura
    • 1
  • Fairouz Kamareddine
    • 2
  • Mauricio Ayala-Rincón
    • 1
  1. 1.Departamento de MatemáticaUniversidade de BrasíliaBrasília D.F.Brasil
  2. 2.School of Mathematical and Computer SciencesHeriot-Watt UniversityEdinburghScotland

Personalised recommendations