Searching semantically equivalent code fragments in logic programs

  • Authors:
  • Wim Vanhoof

  • Affiliations:
  • Institut d'Informatique, University of Namur, Belgium

  • Venue:
  • LOPSTR'04 Proceedings of the 14th international conference on Logic Based Program Synthesis and Transformation
  • Year:
  • 2004

Quantified Score

Hi-index 0.00

Visualization

Abstract

In this work, we devise an analysis that searches for semantically equivalent code fragments within a given logic program. The presence of duplicated code (or functionality) is a primary indication that the design of the program can be improved by performing a so-called refactoring transformation. Within the framework of our analysis, we formally characterize three situations of duplicated functionality and their associated refactorings: the extraction of a duplicated goal into a new predicate, the removal of equivalent predicates and the generalization of two predicates into a higher-order predicate. The resulting analysis detects in a completely automatic way what program fragments are suitable candidates for the considered refactoring transformations.