Journal of Automated Reasoning

, Volume 52, Issue 2, pp 155–190 | Cite as

Anti-unification for Unranked Terms and Hedges

Open Access
Article

Abstract

We study anti-unification for unranked terms and hedges that may contain term and hedge variables. The anti-unification problem of two hedges \({\tilde{s}}_1\) and \({\tilde{s}}_2\) is concerned with finding their generalization, a hedge \({\tilde{q}}\) such that both \({\tilde{s}}_1\) and \({\tilde{s}}_2\) are instances of \({\tilde{q}}\) under some substitutions. Hedge variables help to fill in gaps in generalizations, while term variables abstract single (sub)terms with different top function symbols. First, we design a complete and minimal algorithm to compute least general generalizations. Then, we improve the efficiency of the algorithm by restricting possible alternatives permitted in the generalizations. The restrictions are imposed with the help of a rigidity function, which is a parameter in the improved algorithm and selects certain common subsequences from the hedges to be generalized. The obtained rigid anti-unification algorithm is further made more precise by permitting combination of hedge and term variables in generalizations. Finally, we indicate a possible application of the algorithm in software engineering.

Keywords

Anti-unification Generalization Unranked terms Hedges Software clones 

References

  1. 1.
    Aït-Kaci, H., Sasaki, Y.: An axiomatic approach to feature term generalization. In: Raedt, L.D., Flach, P.A. (eds.) ECML. Lecture Notes in Computer Science, vol. 2167, pp. 1–12. Springer, Heidelberg (2001)Google Scholar
  2. 2.
    Alpuente, M., Escobar, S., Meseguer, J., Ojeda, P.: A modular equational generalization algorithm. In: Hanus, M. (ed.) LOPSTR. Lecture Notes in Computer Science, vol. 5438, pp. 24–39. Springer, Heidelberg (2008)Google Scholar
  3. 3.
    Alpuente, M., Escobar, S., Meseguer, J., Ojeda, P.: Order-sorted generalization. Electr. Notes Theor. Comput. Sci. 246, 27–38 (2009)CrossRefGoogle Scholar
  4. 4.
    Armengol, E., Plaza, E.: Bottom-up induction of feature terms. Mach. Learn. 41(3), 259–294 (2000)CrossRefMATHGoogle Scholar
  5. 5.
    Baader, F.: Unification, weak unification, upper bound, lower bound, and generalization problems. In: Book, R.V. (ed.) RTA. Lecture Notes in Computer Science, vol. 488, pp. 86–97. Springer, Heidelberg (1991)Google Scholar
  6. 6.
    Baxter, I.D., Yahin, A., de Moura, L.M., Sant’Anna, M., Bier, L.: Clone detection using abstract syntax trees. In: ICSM, pp. 368–377 (1998)Google Scholar
  7. 7.
    Biere, A.: Normalisation, unification and generalisation in free monoids. Master’s thesis, University of Karlsruhe (in German, 1993)Google Scholar
  8. 8.
    Bulychev, P., Minea, M.: An evaluation of duplicate code detection using anti-unification. In: Proc. 3rd International Workshop on Software Clones (2009)Google Scholar
  9. 9.
    Bulychev, P.E., Kostylev, E.V., Zakharov, V.A.: Anti-unification algorithms and their applications in program analysis. In: Pnueli, A., Virbitskaite, I., Voronkov, A. (eds.) Ershov Memorial Conference. Lecture Notes in Computer Science, vol. 5947, pp. 413–423. Springer, Heidelberg (2009)Google Scholar
  10. 10.
    Burghardt, J.: E-generalization using grammars. Artif. Intell. 165(1), 1–35 (2005)CrossRefMATHMathSciNetGoogle Scholar
  11. 11.
    Cicekli, I., Cicekli, N.K.: Generalizing predicates with string arguments. Appl. Intell. 25(1):23–36 (2006)CrossRefMATHGoogle Scholar
  12. 12.
    Cirstea, H., Kirchner, C., Kopetz, R., Moreau, P.E.: Anti-patterns for rule-based languages. J. Symb. Comput. 45(5), 523–550 (2010)CrossRefMATHMathSciNetGoogle Scholar
  13. 13.
    Delcher, A.L., Kasif, S.: Efficient parallel term matching and anti-unification. J. Autom. Reasoning 9(3), 391–406 (1992)CrossRefMATHMathSciNetGoogle Scholar
  14. 14.
    Evans, W.S., Fraser, C.W., Ma, F.: Clone detection via structural abstraction. Softw. Qual. J. 17(4), 309–330 (2009)CrossRefGoogle Scholar
  15. 15.
    Gusfield, D.: Algorithms on Strings, Trees, and Sequences—Computer Science and Computational Biology. Cambridge University Press, Cambridge (1997)CrossRefMATHGoogle Scholar
  16. 16.
    Huet, G.: Résolution d’équations dans des langages d’ordre 1,2,...,ω. PhD thesis, Université Paris VII (1976)Google Scholar
  17. 17.
    Kitzelmann, E., Schmid, U.: Inductive synthesis of functional programs: an explanation based generalization approach. J. Mach. Learn. Res. 7, 429–454 (2006)MATHMathSciNetGoogle Scholar
  18. 18.
    Koschke, R., Falke, R., Frenzel, P.: Clone detection using abstract syntax suffix trees. In: WCRE, pp. 253–262. IEEE Computer Society (2006)Google Scholar
  19. 19.
    Krumnack, U., Schwering, A., Gust, H., Kühnberger, K.U.: Restricted higher-order anti-unification for analogy making. In: Orgun, M.A., Thornton, J. (eds.) Australian Conference on Artificial Intelligence. Lecture Notes in Computer Science, vol. 4830, pp. 273–282. Springer, Heidelberg (2007)Google Scholar
  20. 20.
    Kutsia, T.: Solving equations with sequence variables and sequence functions. J. Symb. Comput. 42(3), 352–388 (2007)CrossRefMATHMathSciNetGoogle Scholar
  21. 21.
    Kutsia, T.: Flat matching. J. Symb. Comput. 43(12), 858–873 (2008)CrossRefMATHMathSciNetGoogle Scholar
  22. 22.
    Kutsia, T., Marin, M.: Matching with regular constraints. In: Sutcliffe, G., Voronkov, A. (eds.) LPAR. Lecture Notes in Computer Science, vol. 3835, pp. 215–229. Springer, Heidelberg (2005)Google Scholar
  23. 23.
    Kutsia, T., Marin, M.: Order-sorted unification with regular expression sorts. In: Lynch, C. (ed.) RTA, Schloss Dagstuhl—Leibniz-Zentrum fuer Informatik, LIPIcs, vol. 6, pp. 193–208 (2010)Google Scholar
  24. 24.
    Kutsia, T., Levy, J., Villaret, M.: Sequence unification through currying. In: Baader, F. (ed.) RTA. Lecture Notes in Computer Science, vol. 4533, pp. 288–302. Springer, Heidelberg (2007)Google Scholar
  25. 25.
    Kutsia, T., Levy, J., Villaret, M.: On the relation between context and sequence unification. J. Symb. Comput. 45(1), 74–95 (2010)CrossRefMATHMathSciNetGoogle Scholar
  26. 26.
    Kutsia, T., Levy, J., Villaret, M.: Anti-unification for unranked terms and hedges. In: Schmidt-Schauß, M. (ed.) RTA. Schloss Dagstuhl—Leibniz-Zentrum fuer Informatik, LIPIcs, vol. 10, pp. 219–234 (2011)Google Scholar
  27. 27.
    Li, H., Thompson, S.J.: Similar code detection and elimination for erlang programs. In: Carro, M., Peña, R. (eds.) PADL. Lecture Notes in Computer Science, vol. 5937, pp. 104–118. Springer, Heidelberg (2010)Google Scholar
  28. 28.
    Lu, J., Mylopoulos, J., Harao, M., Hagiya, M.: Higher order generalization and its application in program verification. Ann. Math. Artif. Intell. 28(1–4), 107–126 (2000)CrossRefMATHMathSciNetGoogle Scholar
  29. 29.
    Pfenning, F.: Unification and anti-unification in the calculus of constructions. In: LICS, pp. 74–85. IEEE Computer Society (1991)Google Scholar
  30. 30.
    Plaza, E.: Cases as terms: a feature term approach to the structured representation of cases. In: Veloso, M.M., Aamodt, A. (eds.) ICCBR. Lecture Notes in Computer Science, vol. 1010, pp. 265–276. Springer, Heidelberg (1995)Google Scholar
  31. 31.
    Plotkin, G.D.: A note on inductive generalization. Mach. Intell. 5(1), 153–163 (1970)Google Scholar
  32. 32.
    Reynolds, J.C.: Transformational systems and the algebraic structure of atomic formulas. Mach. Intell. 5(1), 135–151 (1970)Google Scholar
  33. 33.
    Roy, C.K., Cordy, J.R.: A Survey of Software Clone Detection Research. Tech. rep., School of Computing, Queen’s University at Kingston, ON, Canada (2007)Google Scholar
  34. 34.
    Roy, C.K., Cordy, J.R., Koschke, R.: Comparison and evaluation of code clone detection techniques and tools: a qualitative approach. Sci. Comput. Program 74(7), 470–495 (2009)CrossRefMATHMathSciNetGoogle Scholar
  35. 35.
    Schmid, U.: Inductive synthesis of functional programs, universal planning, folding of finite programs and schema abstraction by analogical reasoning. In: Lecture Notes in Computer Science, vol. 2654. Springer, Heidelberg (2003)Google Scholar
  36. 36.
    Wahler, V., Seipel, D., von Gudenberg, J.W., Fischer, G.: Clone detection in source code by frequent itemset techniques. In: SCAM, pp. 128–135. IEEE Computer Society Press, Los Alamitos (2004)Google Scholar
  37. 37.
    Yamamoto, A., Ito, K., Ishino, A., Arimura, H.: Modelling semi-structured documents with hedges for deduction and induction. In: Rouveirol, C., Sebag, M. (eds.) ILP. Lecture Notes in Computer Science, vol. 2157, pp. 240–247. Springer, Heidelberg (2001)Google Scholar
  38. 38.
    Yang, W.: Identifying syntactic differences between two programs. Softw. Pract. Exper. 21(7), 739–755 (1991)CrossRefGoogle Scholar

Copyright information

© The Author(s) 2013

Authors and Affiliations

  1. 1.Research Institute for Symbolic Computation (RISC)Johannes Kepler UniversityLinzAustria
  2. 2.Artificial Intelligence Research Institute (IIIA), Spanish Council for Scientific Research (CSIC)BarcelonaSpain
  3. 3.Departament d’Informàtica i Matemàtica Aplicada (IMA)Universitat de Girona (UdG)GironaSpain

Personalised recommendations