Skip to main content

Semantic Code Clones in Logic Programs

  • Conference paper
Logic-Based Program Synthesis and Transformation (LOPSTR 2012)

Part of the book series: Lecture Notes in Computer Science ((LNTCS,volume 7844))

Abstract

In this paper, we study what is a semantic code clone pair in a logic program. Unlike our earlier work, that focused on simple syntactic equivalence for defining clones, we propose a more general approximation based on operational semantics and transformation rules. This new definition captures a wider set of clones, and allows to formally define the conditions under which a number of refactorings can be applied.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 54.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 72.00
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. Apt, K.: Logic programming. In: Handbook of Theoretical Computer Science. Formal Models and Sematics, vol. B, pp. 493–574. Elsevier (1990)

    Google Scholar 

  2. Brown, C., Thompson, S.: Clone detection and elimination for Haskell. In: Proceedings of the 2010 SIGPLAN Workshop on Partial Evaluation and Program Manipulation, PEPM 2010, pp. 111–120. ACM (2010)

    Google Scholar 

  3. Chen, W., Kifer, M., Warren, D.: HiLog: A foundation for higher-order logic programming. Journal of Logic Programming 15(3), 187–230 (1993)

    Article  MathSciNet  MATH  Google Scholar 

  4. Dandois, C., Vanhoof, W.: Clones in logic programs and how to detect them. In: Vidal, G. (ed.) LOPSTR 2011. LNCS, vol. 7225, pp. 90–105. Springer, Heidelberg (2012)

    Chapter  Google Scholar 

  5. Leuschel, M.: Advanced Techniques for Logic Program Specialisation. Ph.D. thesis, Katholieke Universiteit Leuven (1997)

    Google Scholar 

  6. Leuschel, M., Vidal, G.: Forward slicing by conjunctive partial deduction and argument filtering. In: Sagiv, M. (ed.) ESOP 2005. LNCS, vol. 3444, pp. 61–76. Springer, Heidelberg (2005)

    Chapter  Google Scholar 

  7. Li, H., Thompson, S.: Clone detection and removal for Erlang/OTP within a refactoring environment. In: Proceedings of the 2009 SIGPLAN Workshop on Partial Evaluation and Program Manipulation, PEPM 2009, pp. 169–178. ACM (2009)

    Google Scholar 

  8. Lloyd, J.W.: Foundations of Logic Programming, 2nd edn. Springer (1987)

    Google Scholar 

  9. Nadathur, G., Miller, D.: Higher-order logic programming. In: Handbook of Logic in Artificial Intelligence and Logic Programming, vol. 5, pp. 499–590. Oxford University Press (1998)

    Google Scholar 

  10. Palamidessi, C.: Algebraic properties of idempotent substitutions. In: Paterson, M.S. (ed.) Automata, Languages and Programming. LNCS, vol. 443, pp. 386–399. Springer, Heidelberg (1996)

    Chapter  Google Scholar 

  11. Pettorossi, A., Proietti, M., Senni, V.: Constraint-based correctness proofs for logic program transformations. Tech. Rep. 24, IASI-CNR (2011)

    Google Scholar 

  12. Pettorossi, A., Proietti, M.: Transformation of logic programs. In: Handbook of Logic in Artificial Intelligence and Logic Programming, vol. 5, pp. 697–787. Oxford University Press (1998)

    Google Scholar 

  13. Pettorossi, A., Proietti, M.: Synthesis and transformation of logic programs using unfold/fold proofs. The Journal of Logic Programming 41, 197–230 (1999)

    Article  MathSciNet  MATH  Google Scholar 

  14. Roy, C.K., Cordy, J.R.: A survey on software clone detection research. Tech. rep. (2007)

    Google Scholar 

  15. Roy, C.K., Cordy, J.R., Koschke, R.: Comparison and evaluation of code clone detection techniques and tools: A qualitative approach. Science of Computer Programming 74(7), 470–495 (2009)

    Article  MathSciNet  MATH  Google Scholar 

  16. Sahlin, D.: Mixtus: An automatic partial evaluator for full Prolog. New Generation Computing 12, 7–15 (1993)

    Article  MATH  Google Scholar 

  17. Serebrenik, A., Schrijvers, T., Demoen, B.: Improving Prolog programs: Refactoring for Prolog. Theory and Practice of Logic Programming (TPLP) 8, 201–215 (2008), other version consulted https://lirias.kuleuven.be/bitstream/123456789/164765/1/technical_note.pdf

    MathSciNet  MATH  Google Scholar 

  18. Seres, S., Spivey, M.: Higher-order transformation of logic programs. In: Lau, K.-K. (ed.) LOPSTR 2000. LNCS, vol. 2042, pp. 57–68. Springer, Heidelberg (2001)

    Chapter  Google Scholar 

  19. Tamaki, H., Sato, T.: Unfold/fold transformations of logic programs. In: Proceedings of the 2nd International Conference on Logic Programming, ICLP 1984 (1984)

    Google Scholar 

  20. Tamaki, H., Sato, T.: A generalized correctness proof of the unfold/fold logic program transformation. Tech. Rep. 86-4, Ibaraki University, Japan (1986)

    Google Scholar 

  21. Vanhoof, W.: Searching semantically equivalent code fragments in logic programs. In: Etalle, S. (ed.) LOPSTR 2004. LNCS, vol. 3573, pp. 1–18. Springer, Heidelberg (2005)

    Chapter  Google Scholar 

  22. Vanhoof, W., Degrave, F.: An algorithm for sophisticated code matching in logic programs. In: Garcia de la Banda, M., Pontelli, E. (eds.) ICLP 2008. LNCS, vol. 5366, pp. 785–789. Springer, Heidelberg (2008)

    Chapter  Google Scholar 

  23. Weber Vasconcelos, W., Aragão, M.A.T.: An adaptation of dynamic slicing techniques for logic programming. In: de Oliveira, F.M. (ed.) SBIA 1998. LNCS (LNAI), vol. 1515, pp. 151–160. Springer, Heidelberg (1998)

    Chapter  Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2013 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Dandois, C., Vanhoof, W. (2013). Semantic Code Clones in Logic Programs. In: Albert, E. (eds) Logic-Based Program Synthesis and Transformation. LOPSTR 2012. Lecture Notes in Computer Science, vol 7844. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-642-38197-3_4

Download citation

  • DOI: https://doi.org/10.1007/978-3-642-38197-3_4

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-642-38196-6

  • Online ISBN: 978-3-642-38197-3

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics