On Detecting Semantic Clones in Constraint Logic Programs

Research output: Contribution in Book/Catalog/Report/Conference proceedingConference contribution


Deciding whether two code fragments are semantic clones, or type-4 clones, is a problem with many ramifications. Current research often focuses on the problem in an imperative or object-oriented setting and most existing work uses abstract syntax trees, program dependency graphs, program metrics or text-based, token-based and machine learning-based approaches to identify semantic clones. In this work, we adopt a fundamentally different point of view and express clone detection as a search problem in a logic programming setting. Due to their restricted syntax and semantics, (constraint) logic programs are by nature simple and elegant candidates for automated analysis. After having formalized the clone detection problem at the level of predicates, we develop a study of the different parameters that come into play in the resulting framework. We try and identify the complexity issues involved in a general semantic clone detection procedure that essentially computes so-called most specific generalizations for predicates written in constraint logic programming (CLP). Even though well-known for basic structures such as literals and terms, generalization (or anti-unification) of more complex structures such as clauses and predicates has received very little attention. We show that the anti-unification allows both to control the search and guide the detection of cloned predicates. We pinpoint where efficient approximations are needed in order to be able to identify semantic code clones in a manageable time frame.
Original languageEnglish
Title of host publicationProceedings - 2022 IEEE 16th International Workshop on Software Clones, IWSC 2022
Subtitle of host publicationProceedings
PublisherIEEE Computer society
Pages32 - 38
Number of pages7
ISBN (Electronic)978-1-6654-8447-3
ISBN (Print)978-1-6654-8448-0
Publication statusPublished - 14 Dec 2022
Event2022 IEEE 16th International Workshop on Software Clones - Limassol, Cyprus
Duration: 2 Oct 20222 Oct 2022

Publication series

NameProceedings - 2022 IEEE 16th International Workshop on Software Clones, IWSC 2022


Conference2022 IEEE 16th International Workshop on Software Clones
Abbreviated titleIWSC 2022
Internet address


  • Semantic Clone Detection
  • Constraint Logic Programming
  • Anti-unification
  • Complexity


Dive into the research topics of 'On Detecting Semantic Clones in Constraint Logic Programs'. Together they form a unique fingerprint.

Cite this