topos.evaluation.policies.clones

Clone detection policy (pairwise, outside Ω).

Functors compute normalized AST distance; this module applies the clone threshold. Not a Φᵢ translator — does not participate in the SIMPLE / COMPOSABLE / SECURE lattice. Default lives in topos.evaluation.policies.calibration.

topos.evaluation.policies.clones.are_clones(source, target, threshold=0.1)[source]

Check if two programs are structural clones.

Programs are considered clones if their normalized distance is below the threshold.

Parameters:
  • source – The source ProgramObject.

  • target – The target ProgramObject.

  • threshold – Maximum normalized distance for clone detection.

Returns:

True if the programs are clones.