Skip to content

Program Difference

Will penalize the differences in the reference and foil programs, prioritizing foils that are more similar to the reference program. This is useful when you want to find a foil that is as close as possible to the reference program, but still different enough to explain the difference in behavior.

program-difference.lp
Source
% In the reference program but not in the foil
cost(program_diff(R), 1, 2) :- program(R, ref), not program(R, foil).

% In the foil program but not in the reference
cost(program_diff(R), 1, 2) :- not program(R, ref), program(R, foil).

Encoding

In the reference program but not in the foil

cost(program_diff(R), 1, 2) :- program(R, ref), not program(R, foil).

In the foil program but not in the reference

cost(program_diff(R), 1, 2) :- not program(R, ref), program(R, foil).