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.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
References
Apt, K.: Logic programming. In: Handbook of Theoretical Computer Science. Formal Models and Sematics, vol. B, pp. 493–574. Elsevier (1990)
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)
Chen, W., Kifer, M., Warren, D.: HiLog: A foundation for higher-order logic programming. Journal of Logic Programming 15(3), 187–230 (1993)
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)
Leuschel, M.: Advanced Techniques for Logic Program Specialisation. Ph.D. thesis, Katholieke Universiteit Leuven (1997)
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)
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)
Lloyd, J.W.: Foundations of Logic Programming, 2nd edn. Springer (1987)
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)
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)
Pettorossi, A., Proietti, M., Senni, V.: Constraint-based correctness proofs for logic program transformations. Tech. Rep. 24, IASI-CNR (2011)
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)
Pettorossi, A., Proietti, M.: Synthesis and transformation of logic programs using unfold/fold proofs. The Journal of Logic Programming 41, 197–230 (1999)
Roy, C.K., Cordy, J.R.: A survey on software clone detection research. Tech. rep. (2007)
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)
Sahlin, D.: Mixtus: An automatic partial evaluator for full Prolog. New Generation Computing 12, 7–15 (1993)
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
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)
Tamaki, H., Sato, T.: Unfold/fold transformations of logic programs. In: Proceedings of the 2nd International Conference on Logic Programming, ICLP 1984 (1984)
Tamaki, H., Sato, T.: A generalized correctness proof of the unfold/fold logic program transformation. Tech. Rep. 86-4, Ibaraki University, Japan (1986)
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)
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)
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)
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights 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)